00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _CIvfLight_h_
00026 #define _CIvfLight_h_
00027
00028 #include <ivf/IvfShape.h>
00029
00030 IvfSmartPointer(CIvfLight);
00031
00040 class IVF_API CIvfLight : public CIvfShape {
00041 public:
00042 enum TLightType {
00043 LT_POINT,
00044 LT_DIRECTIONAL,
00045 LT_SPOT
00046 };
00047 private:
00048 int m_lightn;
00049
00050 GLfloat m_ambient[4];
00051 GLfloat m_diffuse[4];
00052 GLfloat m_specular[4];
00053 GLfloat m_position[4];
00054 GLint m_constatt;
00055 GLint m_linatt;
00056 GLint m_quadatt;
00057
00058 float m_spotCutoff;
00059 float m_spotDirection[3];
00060 float m_spotExponent;
00061
00062 TLightType m_lightType;
00063 bool m_enabled;
00064 public:
00065 CIvfLight();
00066 virtual ~CIvfLight();
00067
00069 void enable();
00070
00072 void disable();
00073
00075 bool isEnabled();
00076
00078 void setNumber(int number);
00079
00080 IvfClassInfo("CIvfLight",CIvfShape);
00081
00083 void setAmbientColor( const float r, const float g,
00084 const float b, const float a );
00086 void setDiffuseColor( const float r, const float g,
00087 const float b, const float a );
00089 void setSpecularColor( const float r, const float g,
00090 const float b, const float a );
00091
00100 void setLightPosition( const float x, const float y, const float z, const float w );
00101 void setLightPosition( const float x, const float y, const float z);
00102 void setDirection( const float x, const float y, const float z);
00103
00105 void setConstAtt( const int a );
00106
00108 void setLinAtt( const int a );
00109
00111 void setQuadAtt( const int a );
00112
00114 void getAmbientColor( float &r, float &g, float &b, float &a ) const;
00115
00117 void getDiffuseColor( float &r, float &g, float &b, float &a ) const;
00118
00120 void getSpecularColor( float &r, float &g, float &b, float &a ) const;
00121
00123 void getLightPosition( float &x, float &y, float &z, float &w ) const;
00124
00126 void getConstAtt( int &a ) const;
00127
00129 void getLinAtt( int &a ) const;
00130
00132 void getQuadAtt( int &a ) const;
00133
00135 void setSpotExponent(float exponent);
00136
00138 float getSpotExponent();
00139
00141 void setSpotCutoff(float cutoff);
00142
00144 float getSpotCutoff();
00145
00147 void setSpotDirection(float ex, float ey, float ez);
00148
00150 void getSpotDirection(float &ex, float &ey, float &ez);
00151
00159 void setType(TLightType lightType);
00160
00162 TLightType getType();
00163
00164 protected:
00165 virtual void createGeometry();
00166 };
00167
00168 #endif