63 #include "LightSourceNode.hh"
69 namespace SceneGraph {
76 const std::string& _name)
104 for(
unsigned int i=0; i<
lights_.size(); i++)
129 for(
unsigned int i=0; i<
lights_.size(); i++)
146 glLightfv(_index, GL_AMBIENT, (GLfloat *)_light.ambientColor.data());
147 glLightfv(_index, GL_DIFFUSE, (GLfloat *)_light.diffuseColor.data());
148 glLightfv(_index, GL_SPECULAR, (GLfloat *)_light.specularColor.data());
150 glLightfv(_index, GL_POSITION, (GLfloat *)_light.realPosition.data());
151 glLightfv(_index, GL_SPOT_DIRECTION, (GLfloat *)_light.spotDirection.data());
153 glLightf(_index, GL_SPOT_EXPONENT, _light.spotExponent);
154 glLightf(_index, GL_SPOT_CUTOFF, _light.spotCutoff);
155 glLightf(_index, GL_CONSTANT_ATTENUATION, _light.constantAttenuation);
156 glLightf(_index, GL_LINEAR_ATTENUATION, _light.linearAttenuation);
157 glLightf(_index, GL_QUADRATIC_ATTENUATION, _light.quadraticAttenuation);
165 glGetLightfv(_index, GL_AMBIENT, (GLfloat *)_light.ambientColor.data());
166 glGetLightfv(_index, GL_DIFFUSE, (GLfloat *)_light.diffuseColor.data());
167 glGetLightfv(_index, GL_SPECULAR, (GLfloat *)_light.specularColor.data());
168 glGetLightfv(_index, GL_POSITION, (GLfloat *)_light.position.data());
169 glGetLightfv(_index, GL_SPOT_DIRECTION, (GLfloat *)_light.spotDirection.data());
171 glGetLightfv(_index, GL_SPOT_EXPONENT, &_light.spotExponent);
172 glGetLightfv(_index, GL_SPOT_CUTOFF, &_light.spotCutoff);
173 glGetLightfv(_index, GL_CONSTANT_ATTENUATION, &_light.constantAttenuation);
174 glGetLightfv(_index, GL_LINEAR_ATTENUATION, &_light.linearAttenuation);
175 glGetLightfv(_index, GL_QUADRATIC_ATTENUATION, &_light.quadraticAttenuation);
Namespace providing different geometric functions concerning angles.
Structure to hold options for one LightSource.
static void enable(GLenum _cap)
replaces glEnable, but supports locking
static void disable(GLenum _cap)
replaces glDisable, but supports locking
void set_parameters(GLenum _index, LightSource &_light)
set _light Options in OpenGL for GL_LIGHT::_index
void get_parameters(GLenum _index, LightSource &_light)
get _light Options in OpenGL for GL_LIGHT::_index
void enable(GLenum _nr)
enable LightSource _nr
const GLMatrixd & inverse_modelview() const
get inverse modelview matrix
void leave(GLState &_state, const DrawModes::DrawMode &_drawmode)
restores original Light Sources
LightSourceNode(BaseNode *_parent=0, const std::string &_name="<LightSourceNode>")
Default constructor. Applies all properties.
GLenum index2gl(int _nr)
return GL_LIGHT* for light _nr
std::vector< LightSource > lights_
store LightSources of this node
void enter(GLState &_state, const DrawModes::DrawMode &_drawmode)
set current Light Sources
std::vector< LightSource > lightsSave_
save old LightSources