RigidBodyRenderCache is used to cache generated visuals and lookup mappings of RigidBodies cloned from Templates in agx::RigidBodyEmitter and other related granular applications.
More...
#include <RigidBodyRenderCache.h>
|
| class | RigidBodyVisualGroup |
| | A help class to store all information we need to copy a rigid body visualization to duplicate the rigid body from a rigid body template. More...
|
| |
RigidBodyRenderCache is used to cache generated visuals and lookup mappings of RigidBodies cloned from Templates in agx::RigidBodyEmitter and other related granular applications.
It is used to optimize rendering by basic instantiation of similar template bodies and also for fast lookup to circumvent the complexity of agxOSG::findGeometryNode.
Definition at line 36 of file RigidBodyRenderCache.h.
◆ RigidBodyVisualGroupConstObserver
◆ RigidBodyVisualGroupConstRef
◆ RigidBodyVisualGroupObserver
◆ RigidBodyVisualGroupRef
◆ RigidBodyRenderCache()
| agxOSG::RigidBodyRenderCache::RigidBodyRenderCache |
( |
bool |
onlyAddEmittedBodies = true | ) |
|
Default constructor.
- Parameters
-
| onlyAddEmittedBodies | - True if only emitted RigidBodies should be added, false otherwise. |
◆ ~RigidBodyRenderCache()
| virtual agxOSG::RigidBodyRenderCache::~RigidBodyRenderCache |
( |
| ) |
|
|
protectedvirtual |
◆ addTemplateBodyToVisualCache()
Add template body to visual cache that is used during playback in qtViewer.
- Parameters
-
| body | - The specified template body to add to node cache. |
- Returns
- the cached visual node, with all properties we need to recreated it, for the template body. An empty group if the body isn't a template.
◆ addToCache()
| void agxOSG::RigidBodyRenderCache::addToCache |
( |
osg::Group * |
rootNode | ) |
|
Add the osg::Group created from a RigidBody to the cache.
- Parameters
-
| rootNode | - the rootNode that is used to build the cache. |
◆ bodyIsTemplateEmitted()
| bool agxOSG::RigidBodyRenderCache::bodyIsTemplateEmitted |
( |
agx::RigidBody * |
body | ) |
|
Checks wherever the specifed body is generated/cloned from the temlpate body via RigidBodyEmitter och creation via the Momentum API.
- Note
- - the function checks if a string property called "TemplateUUID" eixsts in the body's property container.
◆ clear()
| void agxOSG::RigidBodyRenderCache::clear |
( |
| ) |
|
Clear the internal cache.
◆ getCachedTemplateBodyVisual()
Get cached template body visual from the node cache if it exists.
- Returns
- the cached visual node, with all properties we need to recreated it, for the template body if it exists, otherwise an empty group.
◆ getNode()
| osg::Group * agxOSG::RigidBodyRenderCache::getNode |
( |
agx::RigidBody * |
body | ) |
|
Get the current mapping in the cache between a RigidBody to a osg::Group.
- Returns
- the current osg::Group mapped from the RigidBody.
◆ getOnlyAddEmittedBodies()
| bool agxOSG::RigidBodyRenderCache::getOnlyAddEmittedBodies |
( |
| ) |
const |
- Returns
- true if only emitted bodies should be added, false otherwise.
◆ getOrCreateCachedTemplateBodyNode()
Gets cached template body visual from the node cache if it exists, otherwise a new visual node will be created in the cache and returned.
If the specified body is not a generated from a Template, the function returns nullptr.
- Parameters
-
| body | - the specified body that should be used to get or create the visual representation from the node cache. |
- Returns
- the cached visual node for the template body. This is a an empty group if the RB isn't template.
◆ setOnlyAddEmittedBodies()
| void agxOSG::RigidBodyRenderCache::setOnlyAddEmittedBodies |
( |
bool |
enable | ) |
|
- Parameters
-
| enable | - true if only emitted bodies should be added, false otherwise. |
◆ shouldAddBody()
| bool agxOSG::RigidBodyRenderCache::shouldAddBody |
( |
agx::RigidBody * |
body | ) |
const |
|
protected |
◆ traverseAndInsert()
| void agxOSG::RigidBodyRenderCache::traverseAndInsert |
( |
osg::Group * |
rootNode | ) |
|
|
protected |
The documentation for this class was generated from the following file: