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:
parent
72400747f2
commit
5fb8877746
1 changed files with 11 additions and 7 deletions
|
@ -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())
|
||||||
|
|
Loading…
Reference in a new issue