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
00026 #ifndef __SGL_POSITIONAL_LIGHT_HPP
00027 #define __SGL_POSITIONAL_LIGHT_HPP
00028
00029 #include <sgl.h>
00030 #include <sglLight.hpp>
00031
00032
00033
00064 class SGL_DLL_API sglPositionalLight : public sglLight
00065 {
00066 public:
00068 sglPositionalLight();
00070 virtual ~sglPositionalLight();
00071
00076 void setPosition(const sglVec3f &pos);
00077
00081 void getPosition(sglVec3f &pos) const;
00082
00090 void setAttenuation(float constant, float linear, float quadratic);
00091
00100 void getAttenuation(float &constant, float &linear, float &quadratic) const;
00101
00109 void setFalloff(float falloff);
00110
00114 float getFalloff() const { return 1.0f/m_falloff_inverse; }
00115
00116
00117 virtual void setup(GLenum gl_light_number) const;
00118
00119
00120 virtual sglNode *clone(unsigned int mode) const;
00121
00122
00123 virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00124
00125 protected:
00126 virtual void computeBound();
00127
00128 void copyTo(sglPositionalLight *dst, unsigned int mode) const;
00129
00130 private:
00131 sglPositionalLight(const sglPositionalLight &);
00132 sglPositionalLight &operator=(const sglPositionalLight &);
00133
00134 protected:
00135 sglVec4f m_position;
00136
00137 float m_attenuation_constant;
00138 float m_attenuation_linear;
00139 float m_attenuation_quadratic;
00140
00141 float m_falloff_inverse;
00142 };
00143
00144 #endif