1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Don't bother multiplying a matrix by its inverse and applying that to the light direction.

Hopefully this will improve numerical stability and reduce shadow flicker a little.
This commit is contained in:
AnyOldName3 2019-01-24 23:07:38 +00:00
parent 4438ab4493
commit d82c85913a

View File

@ -474,7 +474,7 @@ void MWShadowTechnique::LightData::setLightData(osg::RefMatrix* lm, const osg::L
lightDir.set(-lightPos.x(), -lightPos.y(), -lightPos.z());
lightDir.normalize();
OSG_INFO<<" Directional light, lightPos="<<lightPos<<", lightDir="<<lightDir<<std::endl;
if (lightMatrix.valid())
if (lightMatrix.valid() && *lightMatrix != osg::Matrixf(modelViewMatrix))
{
OSG_INFO<<" Light matrix "<<*lightMatrix<<std::endl;
osg::Matrix lightToLocalMatrix(*lightMatrix * osg::Matrix::inverse(modelViewMatrix) );