1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-06 23:15:33 +00:00

Don't set the root node to dynamic

This commit is contained in:
scrawl 2015-03-26 00:11:23 +01:00
parent 72400747f2
commit 5fb8877746

View file

@ -41,9 +41,17 @@ public:
osg::PolygonMode* mode = new osg::PolygonMode; osg::PolygonMode* mode = new osg::PolygonMode;
mode->setMode(osg::PolygonMode::FRONT_AND_BACK, mode->setMode(osg::PolygonMode::FRONT_AND_BACK,
mWireframe ? osg::PolygonMode::LINE : osg::PolygonMode::FILL); mWireframe ? osg::PolygonMode::LINE : osg::PolygonMode::FILL);
mNode->getOrCreateStateSet()->setAttributeAndModes(mode, osg::StateAttribute::ON);
mNode->getOrCreateStateSet()->setMode(GL_CULL_FACE, mWireframe ? osg::StateAttribute::OFF // Create a new stateset instead of changing the old one, this alleviates the need to set
: osg::StateAttribute::ON); // the StateSet to DYNAMIC DataVariance, which would have a performance impact.
osg::StateSet* stateset = new osg::StateSet;
stateset->setAttributeAndModes(mode, osg::StateAttribute::ON);
stateset->setMode(GL_CULL_FACE, mWireframe ? osg::StateAttribute::OFF
: osg::StateAttribute::ON);
mNode->setStateSet(stateset);
return true; return true;
} }
default: default:
@ -138,10 +146,6 @@ int main(int argc, char** argv)
// Mask to separate cull visitors from update visitors // Mask to separate cull visitors from update visitors
viewer.getCamera()->setCullMask(~(0x1)); viewer.getCamera()->setCullMask(~(0x1));
// We're going to change this from the event callback, set the variance to DYNAMIC so that
// we don't interfere with the draw thread.
root->getOrCreateStateSet()->setDataVariance(osg::Node::DYNAMIC);
viewer.addEventHandler(new osgViewer::StatsHandler); viewer.addEventHandler(new osgViewer::StatsHandler);
while (!viewer.done()) while (!viewer.done())