59 #ifndef ACG_LIGHTSOURCE_NODE_HH
60 #define ACG_LIGHTSOURCE_NODE_HH
65 #include "BaseNode.hh"
66 #include "../GL/gl.hh"
74 namespace SceneGraph {
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
Namespace providing different geometric functions concerning angles.
Structure to hold options for one LightSource.
void set_direction(GLenum _nr, Vec3f _pos)
set direction for directional LightSource
void set_ambient_color(GLenum _nr, Vec4f _color)
set Ambient color for LightSource _nr
VectorT< float, 4 > Vec4f
void set_position(GLenum _nr, Vec4f _pos)
set position ( _pos = 1) or direction ( _pos = 0) of LightSource
void fixed_position(GLenum _nr, bool _state)
make LightSource fixed or moveable with ModelViewMatrix
void disable(GLenum _nr)
disable LightSource _nr
void set_position(GLenum _nr, Vec3f _pos)
set position for Point-LightSource
void enable(GLenum _nr)
enable LightSource _nr
VectorT< float, 3 > Vec3f
GLenum index2gl(int _nr)
return GL_LIGHT* for light _nr
std::vector< LightSource > lights_
store LightSources of this node
virtual ~LightSourceNode()
Destructor.
Structure to hold options for one LightSource.
int gl2index(GLenum _nr)
return index in vector for GL_LIGHT*
void set_specular_color(GLenum _nr, Vec4f _color)
set Specular color for LightSource _nr
ACG::SceneGraph::LightSource LightSource
Simple Name for the LightSource.
std::vector< LightSource > lightsSave_
save old LightSources
void set_diffuse_color(GLenum _nr, Vec4f _color)
set Diffuse color for LightSource _nr