59 #ifndef ACG_LIGHTSOURCE_NODE_HH 60 #define ACG_LIGHTSOURCE_NODE_HH 65 #include "BaseNode.hh" 66 #include "../GL/gl.hh" 102 fixedPosition =
false;
104 ambientColor =
Vec4f(0.1f,0.1f,0.1f,1.0f);
105 diffuseColor =
Vec4f(1.0f,1.0f,1.0f,1.0f);
106 specularColor =
Vec4f(1.0f,1.0f,1.0f,1.0f);
107 position =
Vec4f(0.0f,0.0f,1.0f,0.0f);
108 realPosition =
Vec4f(0.0f,0.0f,1.0f,0.0f);
109 spotDirection =
Vec3f(0.0f,0.0f,-1.0f);
113 constantAttenuation = 1;
114 linearAttenuation = 0;
115 quadraticAttenuation = 0;
128 float constantAttenuation;
129 float linearAttenuation;
130 float quadraticAttenuation;
138 const std::string& _name =
"<LightSourceNode>");
153 { lights_[gl2index(_nr)].enabled =
true; }
157 { lights_[gl2index(_nr)].enabled =
false; }
161 { lights_[gl2index(_nr)].position = _pos; }
165 { set_position(_nr,
Vec4f(_pos[0], _pos[1], _pos[2], 1)); }
169 { set_position(_nr,
Vec4f(_pos[0], _pos[1], _pos[2], 0)); }
173 { lights_[gl2index(_nr)].ambientColor = _color; }
177 { lights_[gl2index(_nr)].diffuseColor = _color; }
181 { lights_[gl2index(_nr)].specularColor = _color; }
185 { lights_[gl2index(_nr)].fixedPosition = _state; }
191 {
return( _nr - GL_LIGHT0); }
195 {
return( _nr + GL_LIGHT0); }
198 void set_parameters(GLenum _index,
LightSource& _light);
201 void get_parameters(GLenum _index,
LightSource& _light);
217 #endif // ACG_LIGHTSOURCE_NODE_HH defined GLenum index2gl(int _nr)
return GL_LIGHT* for light _nr
void set_diffuse_color(GLenum _nr, Vec4f _color)
set Diffuse color for LightSource _nr
std::vector< LightSource > lightsSave_
save old LightSources
void enable(GLenum _nr)
enable LightSource _nr
VectorT< float, 4 > Vec4f
void set_direction(GLenum _nr, Vec3f _pos)
set direction for directional LightSource
Structure to hold options for one LightSource.
void fixed_position(GLenum _nr, bool _state)
make LightSource fixed or moveable with ModelViewMatrix
VectorT< float, 3 > Vec3f
void set_position(GLenum _nr, Vec3f _pos)
set position for Point-LightSource
std::vector< LightSource > lights_
store LightSources of this node
virtual ~LightSourceNode()
Destructor.
ACG::SceneGraph::LightSource LightSource
Simple Name for the LightSource.
Namespace providing different geometric functions concerning angles.
void set_ambient_color(GLenum _nr, Vec4f _color)
set Ambient color for LightSource _nr
void set_specular_color(GLenum _nr, Vec4f _color)
set Specular color for LightSource _nr
void disable(GLenum _nr)
disable LightSource _nr
void set_position(GLenum _nr, Vec4f _pos)
set position ( _pos = 1) or direction ( _pos = 0) of LightSource
int gl2index(GLenum _nr)
return index in vector for GL_LIGHT*