00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef GLLIGHT_H
00019 #define GLLIGHT_H
00020
00021 #include <GL/gl.h>
00022 #include "glscene.h"
00023
00029 namespace GLScene
00030 {
00031
00032 class GLLight: public GLRenderState
00033 {
00034
00035 bool spotLight;
00036 GLfloat spot_direction[3];
00037 GLfloat spot_exponent;
00038 GLfloat spot_cutoff;
00039
00040 GLfloat constant_attenuation;
00041 GLfloat linear_attenuation;
00042 GLfloat quadratic_attenuation;
00043
00044 GLfloat specular[4];
00045 GLfloat diffuse[4];
00046 GLfloat ambient[4];
00047
00048 GLfloat position[4];
00049
00050 public:
00051 SML_TAG(light);
00052
00053
00054
00055
00056
00057
00058 GLLight();
00059 virtual ~GLLight();
00060
00061
00062 void enableSpotLight();
00063 void disableSpotLight();
00064 void setSpotDirection(GLfloat x, GLfloat y, GLfloat z);
00065 void setSpotExponent(GLfloat x);
00066 void setSpotCutoff(GLfloat c);
00067
00068 bool getSpotLight() { return spotLight; }
00069 const GLfloat* getSpotDirection() {return spot_direction; }
00070 GLfloat getSpotExponent() { return spot_exponent; }
00071 GLfloat getSpotCutoff() { return spot_cutoff; }
00072
00073
00074 void setConstantAttenuation(GLfloat a);
00075 void setLinearAttenuation(GLfloat a);
00076 void setQuadraticAttenuation(GLfloat a);
00077
00078 GLfloat getConstantAttenuation() { return constant_attenuation; }
00079 GLfloat getLinearAttenuation() { return linear_attenuation; }
00080 GLfloat getQuadraticAttenuation() { return quadratic_attenuation; }
00081
00082
00083 void setSpecular(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
00084 void setDiffuse(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
00085 void setAmbient(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
00086
00087 const GLfloat* getSpecular() { return specular; }
00088 const GLfloat* getDiffuse() { return diffuse; }
00089 const GLfloat* getAmbient() { return ambient; }
00090
00091
00092 void setPos(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
00093 const GLfloat* getPos() { return position; }
00094
00095 void render();
00096
00097 void use(GLenum light);
00098
00099
00100
00101
00102
00103
00104 };
00105
00106 };
00107 #endif