AGX Dynamics  2.35.0.1
agxQt::RigidBodyRenderCache Class Reference

RigidBodyRenderCache is used to cache mappings between RigidBodies and GeometryNodes for fast lookup to circumvent the complexity of agxOSG::findGeometryNode. More...

#include <RigidBodyRenderCache.h>

+ Inheritance diagram for agxQt::RigidBodyRenderCache:

Public Member Functions

 RigidBodyRenderCache (bool onlyAddEmittedBodies=true)
 Default constructor. More...
 
void addToCache (osg::Group *rootNode)
 Add all GeometryNodes with connected RigidBodies in the osg::Group. More...
 
void clear ()
 Clear the internal cache. More...
 
agxOSG::GeometryNode * getNode (agx::RigidBody *body)
 Get the current mapping in the cache between a RigidBody to a GeometryNode. More...
 
bool getOnlyAddEmittedBodies () const
 
void setOnlyAddEmittedBodies (bool enable)
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor. More...
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting. More...
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match. More...
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test. More...
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object. More...
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 

Protected Member Functions

virtual ~RigidBodyRenderCache ()
 
bool shouldAddBody (agx::RigidBody *body) const
 
void traverseAndInsert (osg::Group *group)
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor. More...
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Additional Inherited Members

- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More...
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

RigidBodyRenderCache is used to cache mappings between RigidBodies and GeometryNodes for fast lookup to circumvent the complexity of agxOSG::findGeometryNode.

This is primary used in qtViewer to quickly disable/enable rendering of emitter RigidBodies. Note: This will not work with bodies that contains more than Geometry!

Definition at line 36 of file RigidBodyRenderCache.h.

Constructor & Destructor Documentation

◆ RigidBodyRenderCache()

agxQt::RigidBodyRenderCache::RigidBodyRenderCache ( bool  onlyAddEmittedBodies = true)

Default constructor.

Parameters
onlyAddEmittedBodies- True if only emitted RigidBodies should be added, false otherwise.

◆ ~RigidBodyRenderCache()

virtual agxQt::RigidBodyRenderCache::~RigidBodyRenderCache ( )
protectedvirtual

Member Function Documentation

◆ addToCache()

void agxQt::RigidBodyRenderCache::addToCache ( osg::Group *  rootNode)

Add all GeometryNodes with connected RigidBodies in the osg::Group.

Note: This will not work with bodies that contains more than Geometry!

Parameters
rootNode- the rootNode that is used to build the cache.

◆ clear()

void agxQt::RigidBodyRenderCache::clear ( )

Clear the internal cache.

◆ getNode()

agxOSG::GeometryNode* agxQt::RigidBodyRenderCache::getNode ( agx::RigidBody *  body)

Get the current mapping in the cache between a RigidBody to a GeometryNode.

Returns
the current GeometryNode mapped from the RigidBody.

◆ getOnlyAddEmittedBodies()

bool agxQt::RigidBodyRenderCache::getOnlyAddEmittedBodies ( ) const
Returns
true if only emitted bodies should be added, false otherwise.

◆ setOnlyAddEmittedBodies()

void agxQt::RigidBodyRenderCache::setOnlyAddEmittedBodies ( bool  enable)
Parameters
enable- true if only emitted bodies should be added, false otherwise.

◆ shouldAddBody()

bool agxQt::RigidBodyRenderCache::shouldAddBody ( agx::RigidBody *  body) const
protected

◆ traverseAndInsert()

void agxQt::RigidBodyRenderCache::traverseAndInsert ( osg::Group *  group)
protected

The documentation for this class was generated from the following file: