mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-12 00:36:43 +00:00
The performance impact isn't so big anymore since the last commit.
This commit is contained in:
parent
1d198a5592
commit
acf9fc2d37
1 changed files with 31 additions and 46 deletions
|
@ -274,16 +274,6 @@ namespace SceneUtil
|
||||||
|
|
||||||
if (lights.size())
|
if (lights.size())
|
||||||
{
|
{
|
||||||
|
|
||||||
static std::map<osg::Node*, osg::ref_ptr<osg::StateSet> > statesets;
|
|
||||||
std::map<osg::Node*, osg::ref_ptr<osg::StateSet> >::iterator found = statesets.find(node);
|
|
||||||
osg::ref_ptr<osg::StateSet> stateset;
|
|
||||||
if (found != statesets.end())
|
|
||||||
{
|
|
||||||
stateset = found->second;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
// we do the intersections in view space
|
// we do the intersections in view space
|
||||||
osg::BoundingSphere nodeBound = node->getBound();
|
osg::BoundingSphere nodeBound = node->getBound();
|
||||||
osg::Matrixf mat = *cv->getModelViewMatrix();
|
osg::Matrixf mat = *cv->getModelViewMatrix();
|
||||||
|
@ -299,7 +289,6 @@ namespace SceneUtil
|
||||||
|
|
||||||
if (lightList.empty())
|
if (lightList.empty())
|
||||||
{
|
{
|
||||||
statesets[node] = NULL;
|
|
||||||
traverse(node, nv);
|
traverse(node, nv);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -316,16 +305,12 @@ namespace SceneUtil
|
||||||
lightList.pop_back();
|
lightList.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
stateset = mLightManager->getLightListStateSet(lightList);
|
osg::StateSet* stateset = mLightManager->getLightListStateSet(lightList);
|
||||||
statesets[node] = stateset;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stateset)
|
|
||||||
cv->pushStateSet(stateset);
|
cv->pushStateSet(stateset);
|
||||||
|
|
||||||
traverse(node, nv);
|
traverse(node, nv);
|
||||||
|
|
||||||
if (stateset)
|
|
||||||
cv->popStateSet();
|
cv->popStateSet();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue