home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 February / Chip_2001-02_cd1.bin / bonus / demos / CS / exp / SOURCES / GLENGINE / light.h < prev    next >
C/C++ Source or Header  |  2000-08-15  |  2KB  |  80 lines

  1. #ifndef __OGL2_LIGHT__
  2. #define __OGL2_LIGHT__
  3.  
  4. #include "types.h"
  5. #include "entity.h"
  6.  
  7. extern "C++" {
  8.  
  9. class Light : public Entity {
  10. public:
  11.   virtual ~Light () {}
  12.   virtual void GL (GLenum light, double time = 0.0) = 0;
  13. };
  14.  
  15. class Lights : public EntityList<Light> {
  16. public:
  17.   void GL (double time = 0.0);
  18. };
  19.  
  20. class LightGL : public Light
  21. {
  22.   GLfloat ambient[4];
  23.   GLfloat diffuse[4];
  24.   GLfloat specular[4];
  25.   GLfloat position[4];
  26.   GLfloat spot_direction[3];
  27.  
  28.   GLfloat spot_exponent;
  29.   GLfloat spot_cutoff;
  30.   GLfloat constant_attenuation;
  31.   GLfloat linear_attenuation;
  32.   GLfloat quadratic_attenuation;
  33.  
  34. public:  
  35.  
  36.   LightGL ();
  37.  
  38.   void Reset ();
  39.  
  40.   void GL (GLenum light, double time = 0.0);
  41.  
  42.   void Ambient (GLfloat r, GLfloat g, GLfloat b, GLfloat a = 1.0F),
  43.        Diffuse (GLfloat r, GLfloat g, GLfloat b, GLfloat a = 1.0F),
  44.        Specular (GLfloat r, GLfloat g, GLfloat b, GLfloat a = 1.0F),
  45.        Ambient (GLfloat* v),
  46.        Diffuse (GLfloat* v),
  47.        Specular (GLfloat* v);
  48.  
  49.   void Position (GLfloat x, GLfloat y, GLfloat z, GLfloat w = 1.0F),
  50.        Position (GLfloat* v),
  51.        SpotDirection (GLfloat i, GLfloat j, GLfloat k),
  52.        SpotDirection (GLfloat* v);
  53.  
  54.   void SpotExponent (GLfloat f),
  55.        SpotCutoff (GLfloat f),
  56.        ConstantAttenuation (GLfloat f),
  57.        LinearAttenuation (GLfloat f),
  58.        QuadraticAttenuation (GLfloat f);
  59.  
  60.  
  61.   // Feedback
  62.  
  63.   const GLfloat* Ambient ();
  64.   const GLfloat* Diffuse ();
  65.   const GLfloat* Specular ();
  66.   const GLfloat* Position ();
  67.   const GLfloat* SpotDirection ();
  68.  
  69.   GLfloat SpotExponent (),
  70.        SpotCutoff (),
  71.        ConstantAttenuation (),
  72.        LinearAttenuation (),
  73.        QuadraticAttenuation ();
  74. };
  75.  
  76. } // extern "C++"
  77.  
  78. #endif
  79.  
  80.