Commit fe0c95fd authored by Mike Kremer's avatar Mike Kremer
Browse files

Fixed setting of OpenGL parameters such that directional light sources are now...

Fixed setting of OpenGL parameters such that directional light sources are now handled correctly in the scene.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10178 383ad7c9-94d9-4d36-a494-682f7c89f535
parent da013a36
......@@ -535,11 +535,17 @@ void LightNode::setParameters(GLenum _index, LightSource& _light)
Vec3d& sd = _light.realSpotDirection_;
GLfloat dir[3] = {(float)sd[0], (float)sd[1], (float)sd[2]};
glLightfv(_index, GL_POSITION, (GLfloat *)_light.realPosition_.data());
glLightfv(_index, GL_SPOT_DIRECTION, dir);
glLightf(_index, GL_SPOT_EXPONENT, _light.spotExponent_);
glLightf(_index, GL_SPOT_CUTOFF, _light.spotCutoff_);
bool directional = _light.directional();
Vec4f& p = _light.realPosition_;
GLfloat realPos[4] = {(float)p[0], (float)p[1], (float)p[2], (directional ? 0.0f : 1.0f)};
glLightfv(_index, GL_POSITION, realPos);
if(!directional) glLightfv(_index, GL_SPOT_DIRECTION, dir);
if(!directional) glLightf(_index, GL_SPOT_EXPONENT, _light.spotExponent_);
if(!directional) glLightf(_index, GL_SPOT_CUTOFF, _light.spotCutoff_);
glLightf(_index, GL_CONSTANT_ATTENUATION, _light.constantAttenuation_);
glLightf(_index, GL_LINEAR_ATTENUATION, _light.linearAttenuation_);
glLightf(_index, GL_QUADRATIC_ATTENUATION, _light.quadraticAttenuation_);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment