GRIM,EMI: SHADERS: cos() expects radiants, _(pen)umbraangle is in degrees.

Also, use cosf() instead of cos(), the latter working on doubles.
This commit is contained in:
Vincent Pelletier 2015-03-21 08:27:56 +01:00
parent 1ab56fa3cd
commit 2990d241e1

View file

@ -1112,8 +1112,8 @@ void GfxOpenGLS::setupLight(Grim::Light *light, int lightId) {
lightPos = Math::Vector4d(-light->_dir.x(), -light->_dir.y(), -light->_dir.z(), 0.0f);
lightDir = Math::Vector4d(0.0f, 0.0f, 0.0f, -1.0f);
} else if (light->_type == Grim::Light::Spot) {
float cosPenumbra = cos(light->_penumbraangle);
float cosUmbra = cos(light->_umbraangle);
float cosPenumbra = cosf(light->_penumbraangle * M_PI / 180.0f);
float cosUmbra = cosf(light->_umbraangle * M_PI / 180.0f);
lightPos = Math::Vector4d(light->_pos.x(), light->_pos.y(), light->_pos.z(), 1.0f);
lightDir = Math::Vector4d(light->_dir.x(), light->_dir.y(), light->_dir.z(), 1.0f);
lightParams = Math::Vector4d(light->_falloffNear, light->_falloffFar, cosPenumbra, cosUmbra);