mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-15 21:19:57 +00:00
f1ac408f35
OSG 3.4 adds the ability to place Drawables directly in the scene graph, without a Geode decorating them. Leveraging this should give a small performance boost, because the redundant Geodes increase culling overhead. There is still an oustanding issue with the RemoveDrawableVisitor no longer working correctly, because Drawables can have multiple parents.
43 lines
1 KiB
C++
43 lines
1 KiB
C++
#ifndef OPENMW_COMPONENTS_SCENEUTIL_VISITOR_H
|
|
#define OPENMW_COMPONENTS_SCENEUTIL_VISITOR_H
|
|
|
|
#include <osg/NodeVisitor>
|
|
|
|
// Commonly used scene graph visitors
|
|
namespace SceneUtil
|
|
{
|
|
|
|
// Find a Group by name, case-insensitive
|
|
// If not found, mFoundNode will be NULL
|
|
class FindByNameVisitor : public osg::NodeVisitor
|
|
{
|
|
public:
|
|
FindByNameVisitor(const std::string& nameToFind)
|
|
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
|
|
, mNameToFind(nameToFind)
|
|
, mFoundNode(NULL)
|
|
{
|
|
}
|
|
|
|
virtual void apply(osg::Group& group);
|
|
|
|
std::string mNameToFind;
|
|
osg::Group* mFoundNode;
|
|
};
|
|
|
|
// Disable freezeOnCull for all visited particlesystems
|
|
class DisableFreezeOnCullVisitor : public osg::NodeVisitor
|
|
{
|
|
public:
|
|
DisableFreezeOnCullVisitor()
|
|
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
|
|
{
|
|
}
|
|
|
|
virtual void apply(osg::Geode &geode);
|
|
virtual void apply(osg::Drawable& drw);
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|