mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-30 07:21:12 +00:00
consolidate node mask checks (#3125)
* consolidate node mask checks This PR simplifies a few checks against node masks in object paging by using the osg provided `setTraversalMask`. * objectpaging.cpp
This commit is contained in:
parent
786b6b7c9a
commit
b22fb7a7bf
@ -272,7 +272,7 @@ namespace MWRender
|
|||||||
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
|
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
|
||||||
, mCurrentStateSet(nullptr)
|
, mCurrentStateSet(nullptr)
|
||||||
, mCurrentDistance(0.f)
|
, mCurrentDistance(0.f)
|
||||||
, mAnalyzeMask(analyzeMask) {}
|
{ setTraversalMask(analyzeMask); }
|
||||||
|
|
||||||
typedef std::unordered_map<osg::StateSet*, unsigned int> StateSetCounter;
|
typedef std::unordered_map<osg::StateSet*, unsigned int> StateSetCounter;
|
||||||
struct Result
|
struct Result
|
||||||
@ -283,9 +283,6 @@ namespace MWRender
|
|||||||
|
|
||||||
void apply(osg::Node& node) override
|
void apply(osg::Node& node) override
|
||||||
{
|
{
|
||||||
if (!(node.getNodeMask() & mAnalyzeMask))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (node.getStateSet())
|
if (node.getStateSet())
|
||||||
mCurrentStateSet = node.getStateSet();
|
mCurrentStateSet = node.getStateSet();
|
||||||
|
|
||||||
@ -308,9 +305,6 @@ namespace MWRender
|
|||||||
}
|
}
|
||||||
void apply(osg::Geometry& geom) override
|
void apply(osg::Geometry& geom) override
|
||||||
{
|
{
|
||||||
if (!(geom.getNodeMask() & mAnalyzeMask))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (osg::Array* array = geom.getVertexArray())
|
if (osg::Array* array = geom.getVertexArray())
|
||||||
mResult.mNumVerts += array->getNumElements();
|
mResult.mNumVerts += array->getNumElements();
|
||||||
|
|
||||||
@ -345,7 +339,6 @@ namespace MWRender
|
|||||||
osg::StateSet* mCurrentStateSet;
|
osg::StateSet* mCurrentStateSet;
|
||||||
StateSetCounter mGlobalStateSetCounter;
|
StateSetCounter mGlobalStateSetCounter;
|
||||||
float mCurrentDistance;
|
float mCurrentDistance;
|
||||||
osg::Node::NodeMask mAnalyzeMask;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DebugVisitor : public osg::NodeVisitor
|
class DebugVisitor : public osg::NodeVisitor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user