52 m_group(group), m_geometryIndices(geometryIndex) { }
56 bool isValid()
const {
return m_group !=
nullptr; }
58 size_t getNumChildren()
const {
return isValid() ? m_group->getNumChildren() : 0; }
60 osg::Group*
getGroup()
const {
return m_group; }
63 osg::ref_ptr<osg::Group> m_group;
65 std::vector<size_t> m_geometryIndices;
148 bool m_onlyAddEmittedBodies;
#define AGX_DECLARE_POINTER_TYPES(type)
A help class to store all information we need to copy a rigid body visualization to duplicate the rig...
size_t getNumChildren() const
osg::Group * getGroup() const
RigidBodyVisualGroup(osg::Group *group, std::vector< size_t > geometryIndex)
agxCollide::GeometryRef getGeometry(agx::RigidBody *newBody, size_t visualIndex) const
RigidBodyRenderCache is used to cache generated visuals and lookup mappings of RigidBodies cloned fro...
const RigidBodyRenderCache::RigidBodyVisualGroup & getOrCreateCachedTemplateBodyNode(agx::RigidBody *body)
Gets cached template body visual from the node cache if it exists, otherwise a new visual node will b...
void traverseAndInsert(osg::Group *rootNode)
bool shouldAddBody(agx::RigidBody *body) const
void setOnlyAddEmittedBodies(bool enable)
RigidBodyRenderCache(bool onlyAddEmittedBodies=true)
Default constructor.
const RigidBodyRenderCache::RigidBodyVisualGroup & addTemplateBodyToVisualCache(agx::RigidBody *body)
Add template body to visual cache that is used during playback in qtViewer.
bool getOnlyAddEmittedBodies() const
osg::Group * getNode(agx::RigidBody *body)
Get the current mapping in the cache between a RigidBody to a osg::Group.
virtual ~RigidBodyRenderCache()
const RigidBodyRenderCache::RigidBodyVisualGroup & getCachedTemplateBodyVisual(agx::RigidBody *body)
Get cached template body visual from the node cache if it exists.
void clear()
Clear the internal cache.
void addToCache(osg::Group *rootNode)
Add the osg::Group created from a RigidBody to the cache.
bool bodyIsTemplateEmitted(agx::RigidBody *body)
Checks wherever the specifed body is generated/cloned from the temlpate body via RigidBodyEmitter och...
Inheritance with partial specialization due to bug with ref_ptr containers.
Base class providing referencing counted objects.
The rigid body class, combining a geometric model and a frame of reference.
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.