mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-28 21:09:42 +00:00
Share the StateSet used to invert front face
This commit is contained in:
parent
67c8faec75
commit
563807ee53
1 changed files with 9 additions and 3 deletions
|
@ -102,9 +102,15 @@ namespace SceneUtil
|
||||||
// Need to invert culling because of the negative scale
|
// Need to invert culling because of the negative scale
|
||||||
// Note: for absolute correctness we would need to check the current front face for every mesh then invert it
|
// Note: for absolute correctness we would need to check the current front face for every mesh then invert it
|
||||||
// However MW isn't doing this either, so don't. Assuming all meshes are using backface culling is more efficient.
|
// However MW isn't doing this either, so don't. Assuming all meshes are using backface culling is more efficient.
|
||||||
|
static osg::ref_ptr<osg::StateSet> frontFaceStateSet;
|
||||||
|
if (!frontFaceStateSet)
|
||||||
|
{
|
||||||
|
frontFaceStateSet = new osg::StateSet;
|
||||||
osg::FrontFace* frontFace = new osg::FrontFace;
|
osg::FrontFace* frontFace = new osg::FrontFace;
|
||||||
frontFace->setMode(osg::FrontFace::CLOCKWISE);
|
frontFace->setMode(osg::FrontFace::CLOCKWISE);
|
||||||
trans->getOrCreateStateSet()->setAttributeAndModes(frontFace, osg::StateAttribute::ON);
|
frontFaceStateSet->setAttributeAndModes(frontFace, osg::StateAttribute::ON);
|
||||||
|
}
|
||||||
|
trans->setStateSet(frontFaceStateSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trans)
|
if (trans)
|
||||||
|
|
Loading…
Reference in a new issue