53 #ifndef ACG_LIGHTSOURCE_NODE_HH 54 #define ACG_LIGHTSOURCE_NODE_HH 59 #include "BaseNode.hh" 60 #include "../GL/gl.hh" 96 fixedPosition =
false;
98 ambientColor =
Vec4f(0.1f,0.1f,0.1f,1.0f);
99 diffuseColor =
Vec4f(1.0f,1.0f,1.0f,1.0f);
100 specularColor =
Vec4f(1.0f,1.0f,1.0f,1.0f);
101 position =
Vec4f(0.0f,0.0f,1.0f,0.0f);
102 realPosition =
Vec4f(0.0f,0.0f,1.0f,0.0f);
103 spotDirection =
Vec3f(0.0f,0.0f,-1.0f);
107 constantAttenuation = 1;
108 linearAttenuation = 0;
109 quadraticAttenuation = 0;
122 float constantAttenuation;
123 float linearAttenuation;
124 float quadraticAttenuation;
132 const std::string& _name =
"<LightSourceNode>");
147 { lights_[gl2index(_nr)].enabled =
true; }
151 { lights_[gl2index(_nr)].enabled =
false; }
155 { lights_[gl2index(_nr)].position = _pos; }
159 { set_position(_nr,
Vec4f(_pos[0], _pos[1], _pos[2], 1)); }
163 { set_position(_nr,
Vec4f(_pos[0], _pos[1], _pos[2], 0)); }
167 { lights_[gl2index(_nr)].ambientColor = _color; }
171 { lights_[gl2index(_nr)].diffuseColor = _color; }
175 { lights_[gl2index(_nr)].specularColor = _color; }
179 { lights_[gl2index(_nr)].fixedPosition = _state; }
185 {
return( _nr - GL_LIGHT0); }
189 {
return( _nr + GL_LIGHT0); }
192 void set_parameters(GLenum _index,
LightSource& _light);
195 void get_parameters(GLenum _index,
LightSource& _light);
211 #endif // ACG_LIGHTSOURCE_NODE_HH defined void set_position(GLenum _nr, Vec4f _pos)
set position ( _pos = 1) or direction ( _pos = 0) of LightSource
Structure to hold options for one LightSource.
void disable(GLenum _nr)
disable LightSource _nr
Namespace providing different geometric functions concerning angles.
VectorT< float, 4 > Vec4f
ACG::SceneGraph::LightSource LightSource
Simple Name for the LightSource.
void set_position(GLenum _nr, Vec3f _pos)
set position for Point-LightSource
std::vector< LightSource > lightsSave_
save old LightSources
void set_diffuse_color(GLenum _nr, Vec4f _color)
set Diffuse color for LightSource _nr
int gl2index(GLenum _nr)
return index in vector for GL_LIGHT*
VectorT< float, 3 > Vec3f
void set_direction(GLenum _nr, Vec3f _pos)
set direction for directional LightSource
std::vector< LightSource > lights_
store LightSources of this node
GLenum index2gl(int _nr)
return GL_LIGHT* for light _nr
virtual ~LightSourceNode()
Destructor.
void enable(GLenum _nr)
enable LightSource _nr
void set_specular_color(GLenum _nr, Vec4f _color)
set Specular color for LightSource _nr
void fixed_position(GLenum _nr, bool _state)
make LightSource fixed or moveable with ModelViewMatrix
void set_ambient_color(GLenum _nr, Vec4f _color)
set Ambient color for LightSource _nr