|
AGX Dynamics 2.41.3.0
|
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc. More...
#include <RenderManager.h>
Inheritance diagram for agxRender::RenderManager:Classes | |
| struct | CacheBase |
| class | PrimitiveCache |
| Class for storing RenderProxies that are currently in use. More... | |
| class | PrimitiveCache1 |
| Class for storing RenderProxies that are currently in use. More... | |
Public Types | |
| typedef std::pair< const agx::ParticleSystem *, agxRender::RenderProxyRef > | ConstParticleSystemPtrRenderProxyPtrPair |
| typedef agx::Vector< ConstParticleSystemPtrRenderProxyPtrPair > | ParticleSystemProxyContainer |
Public Member Functions | |
| RenderManager (agxSDK::Simulation *sim) | |
| Constructor. | |
| BoxProxy * | acquireBox (const agx::Vec3 &halfExtents) |
| Create and return a new proxy boxy from the Proxy factory. | |
| CapsuleProxy * | acquireCapsule (const agx::Vec3 &begin, const agx::Vec3 &end, float radius) |
| Create and return a new proxy Capsule from the Proxy factory. | |
| CapsuleProxy * | acquireCapsule (float radius, float height) |
| Create and return a new proxy Capsule from the Proxy factory. | |
| ConeProxy * | acquireCone (const agx::Vec3 &p1, const agx::Vec3 &p2, float radius) |
| Create and return a new proxy Cone from the Proxy factory. | |
| agxRender::ContactsProxy * | acquireContacts (const agxCollide::GeometryContactPtrVector &contacts, float scale) |
| Create and return a new proxy Contact from the Proxy factory. | |
| CylinderProxy * | acquireCylinder (const agx::Vec3 &begin, const agx::Vec3 &end, float radius) |
| Create and return a new proxy Cylinder from the Proxy factory. | |
| CylinderProxy * | acquireCylinder (float radius, float height) |
| Create and return a new proxy Cylinder from the Proxy factory. | |
| void | acquireGeometry (const agxCollide::Geometry *geometry, const agx::Vec3 &color) |
| HollowConeProxy * | acquireHollowCone (const agx::Vec3 &p1, const agx::Vec3 &p2, float topRadius, float bottomRadius, float thickness) |
| Create and return a new HollowConeProxy from the Proxy factory. | |
| HollowCylinderProxy * | acquireHollowCylinder (float radius, float height, float thickness) |
| Create and return a new proxy HollowCylinder from the Proxy factory. | |
| LineProxy * | acquireLine (const agx::Vec3 &p1, const agx::Vec3 &p2) |
| Create and return a new proxy Line from the Proxy factory. | |
| PlaneProxy * | acquirePlane (const agx::Vec3 &normal, agx::Real distance) |
| agxRender::RigidBodyBatchRenderProxy * | acquireRigidBodies (const agx::RigidBodyPtrSetVector *enabledBodies, float scale) |
| Create and return a new proxy rigid body batch from the Proxy factory. | |
| SphereProxy * | acquireSphere (float radius) |
| Create and return a new proxy sphere from the Proxy factory. | |
| TextProxy * | acquireText (const agx::String &text, const agx::Vec3 &pos, float size=1) |
| Create and return a new text sphere from the Proxy factory. | |
| TruncatedConeProxy * | acquireTruncatedCone (const agx::Vec3 &p1, const agx::Vec3 &p2, float topRadius, float bottomRadius) |
| Create and return a new proxy TruncatedCone from the Proxy factory. | |
| agxRender::WireRenderProxy * | acquireWire (float radius, const agx::Vec3 &color) |
| Create and return a new proxy wire from the proxy factory. | |
| void | addRenderable (Renderable *renderable) |
| Add custom render object. | |
| void | clear (bool clearText=true, bool clearGlobalProxies=true) |
| Clear all acquired RenderProxy. | |
| void | disableFlags (unsigned int flags) |
Disable all rendering flags specified in flags. | |
| void | enableFlags (unsigned int flags) |
Enable all rendering flags specified in flags. | |
| RenderProxy * | findShapeProxy (const agxCollide::Shape *shape) |
| Try to locate a RenderProxy which is associated (already added) for the specified shape. | |
| float | getAlpha () const |
| bool | getEnable () const |
| RenderProxyFactory * | getProxyFactory () |
| float | getScaleFactor () const |
| agxSDK::Simulation * | getSimulation () |
| bool | hasRenderable (Renderable *renderable) const |
| bool | isEnabled () const |
| bool | isEnabledFlags (unsigned int flags) const |
| bool | removeRenderable (Renderable *renderable) |
Remove custom render object renderable. | |
| void | setAlpha (float alpha) |
| Loop over all proxies and set alpha value to the specified value, also sets the new default alpha value. | |
| void | setDefaultRenderMode (RenderProxy::RenderMode mode) |
| Set the new default render mode for all RenderProxies activated after this call. | |
| void | setEnable (bool flag) |
| Enable/disable the whole rendering system. | |
| void | setFlags (unsigned int flags) |
| Set the render flags. | |
| void | setProxyFactory (RenderProxyFactory *factory) |
| Associate a new factory for creating RenderProxy's on request from the RenderManager. | |
| void | setScaleFactor (float scaleFactor=1.0f) |
| Set the scale of the debug rendering of contacts and center of mass, it will not affect already created/rendered objects, only new, if you want the scale to affect all objects, call setEnable(false), setEnable(true) Default is 1.0 which corresponds to a rendering which suits objects of size 1m or larger... | |
| void | update () |
| Updates a new state for the rendering, acquires renderable objects for shapes, text etc. | |
| void | updateAllProxies (agxRender::RenderProxy::EventType eventType) |
| Fires event given eventType for all proxies. | |
Public Member Functions inherited from agx::Referenced | |
| Referenced () | |
| Default constructor. | |
| Referenced (const Referenced &) | |
| template<typename T > | |
| T * | as () |
| Subclass casting. | |
| template<typename T > | |
| const T * | as () const |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. | |
| template<typename T > | |
| const T * | asSafe () const |
| int | getReferenceCount () const |
| template<typename T > | |
| bool | is () const |
| Subclass test. | |
| Referenced & | operator= (const Referenced &) |
| Assignment operator. Will increment the number of references to the referenced object. | |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. | |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
Protected Types | |
| typedef agx::Vector< CacheBase * > | CacheVector |
| typedef agx::Vector< RenderableRef > | RenderableRefVector |
| typedef agx::HashVector< agx::UInt32, agx::ref_ptr< RenderProxy > > | RenderProxyHashVector |
| typedef agx::Vector< agx::ref_ptr< agxRender::RenderProxy > > | RenderProxyRefContainer |
Protected Member Functions | |
| virtual | ~RenderManager () |
| Destructor. | |
| RenderProxy * | add (agxCollide::Shape *shape, const agxCollide::Geometry *geometry, const agx::Vec3 &color=agx::Vec3(-1, 0, 0), bool addToProxies=true) |
| Add a shape to the set of active shape proxies. | |
| void | add (const agx::ParticleSystem *particleSystem) |
| void | add (const agxCollide::Geometry *geometry, const agx::Vec3 &color=agx::Vec3(-1, 0, 0), bool addToProxies=true) |
| Add a geometry (and its shapes) to the set of active shape proxies. | |
| void | addAllGeometries () |
| Go through space and add all geometries to the set of shapes that should be rendered. | |
| void | clearShapeProxies () |
| Remove all shape proxies. | |
| void | flush () |
| Based on the number of used RenderProxy (for each type), reduce the cache down to that size. | |
| Graph * | getGraph () |
| void | remove (const agx::ParticleSystem *particleSystem) |
| void | remove (const agxCollide::Geometry *geometry) |
| Remove a Geometry (and its shapes) from the set of shapes that should be rendered. | |
| void | remove (const agxCollide::Shape *shape) |
| Remove a Shape from the set of shapes that should be rendered. | |
| void | renderAABBTrees (RenderProxy *proxy) |
Render AABB tree for the specified proxy. | |
| void | renderBoundingVolume (const agxCollide::Geometry *geometry) |
Render bounding volume for the geom. | |
| void | renderObserverFrame (const agx::ObserverFrame *observerFrame) |
| Render an ObserverFrame. | |
| void | setSpace (agxCollide::Space *space) |
| Associate a new space with this RenderManager, used by agxSDK::Simulation. | |
| void | updateAABBProxies () |
| Update all AABB (for geometries) proxies (boxes) | |
| void | updateBodyProxies (agxData::EntityStorage *islandStorage=nullptr) |
| Go through all bodies and acquire proxies for them. | |
| void | updateConstraintProxies () |
| Update all constraints (call render) | |
| void | updateContactProxies () |
| acquire proxies for contacts | |
| void | updateGraphs () |
| Update the graphs. | |
| void | updateObserverFrames () |
| Update all observer frames. | |
| void | updateParticleContactProxies () |
| void | updateParticleGeometryContactProxies () |
| void | updateParticleSystemProxies () |
| Update particleSystems. | |
| void | updateProxy (RenderProxy *proxy, agxData::EntityStorage *islandStorage=nullptr) |
| Update size, color and transform. | |
| void | updateRenderables () |
| Call render for all Renderables. | |
| void | updateShapeProxies (agxData::EntityStorage *islandStorage=nullptr) |
| Update (transform and color) for all shapes. | |
| void | updateText () |
| Update only text proxies. | |
Protected Member Functions inherited from agx::Referenced | |
| virtual | ~Referenced () |
| Destructor. | |
| 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. | |
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
The state (what to be rendered can be set using methods enableFlags/disableFlags/setFlags. The RenderManager needs a RenderProxyFactory, implemented according to the design pattern 'Factory'. It will be responsible for creating the renderable objects which the RenderManager requests. The implementation of the RenderProxyFactory is up to the user, depending on rendering system.
The RenderManager has a cache of previously created RenderProxy, so it will try to reuse these between frames.
Definition at line 105 of file RenderManager.h.
|
protected |
Definition at line 606 of file RenderManager.h.
| typedef std::pair< const agx::ParticleSystem*, agxRender::RenderProxyRef > agxRender::RenderManager::ConstParticleSystemPtrRenderProxyPtrPair |
Definition at line 373 of file RenderManager.h.
| typedef agx::Vector< ConstParticleSystemPtrRenderProxyPtrPair > agxRender::RenderManager::ParticleSystemProxyContainer |
Definition at line 374 of file RenderManager.h.
|
protected |
Definition at line 626 of file RenderManager.h.
|
protected |
Definition at line 490 of file RenderManager.h.
|
protected |
Definition at line 628 of file RenderManager.h.
| agxRender::RenderManager::RenderManager | ( | agxSDK::Simulation * | sim | ) |
Constructor.
| sim | - The associated simulation for which this RenderManager exists. |
|
protectedvirtual |
Destructor.
Create and return a new proxy boxy from the Proxy factory.
| halfExtents | - The size of the box |
| CapsuleProxy * agxRender::RenderManager::acquireCapsule | ( | const agx::Vec3 & | begin, |
| const agx::Vec3 & | end, | ||
| float | radius | ||
| ) |
Create and return a new proxy Capsule from the Proxy factory.
| begin | - The start point in WORLD coordinate system for a capsule |
| end | - The end point in WORLD coordinate system for a capsule |
| radius | - The radius of a capsule |
| CapsuleProxy * agxRender::RenderManager::acquireCapsule | ( | float | radius, |
| float | height | ||
| ) |
Create and return a new proxy Capsule from the Proxy factory.
| radius | - The radius of a capsule |
| height | - The height of a capsule |
| ConeProxy * agxRender::RenderManager::acquireCone | ( | const agx::Vec3 & | p1, |
| const agx::Vec3 & | p2, | ||
| float | radius | ||
| ) |
Create and return a new proxy Cone from the Proxy factory.
| p1 | - The start point in WORLD coordinate system for a cone |
| p2 | - The end point in WORLD coordinate system for a cone |
| radius | - The top radius of a cone |
| agxRender::ContactsProxy * agxRender::RenderManager::acquireContacts | ( | const agxCollide::GeometryContactPtrVector & | contacts, |
| float | scale | ||
| ) |
Create and return a new proxy Contact from the Proxy factory.
| contacts | - Vector with all contacts that should be rendered |
| scale | - Scale that can be used for scaling the size of the rendered contacts |
| CylinderProxy * agxRender::RenderManager::acquireCylinder | ( | const agx::Vec3 & | begin, |
| const agx::Vec3 & | end, | ||
| float | radius | ||
| ) |
Create and return a new proxy Cylinder from the Proxy factory.
| begin | - The start point in WORLD coordinate system for a cylinder |
| end | - The end point in WORLD coordinate system for a cylinder |
| radius | - The radius of a cylinder |
| CylinderProxy * agxRender::RenderManager::acquireCylinder | ( | float | radius, |
| float | height | ||
| ) |
Create and return a new proxy Cylinder from the Proxy factory.
| radius | - The radius of a cylinder |
| height | - The height of a cylinder |
| void agxRender::RenderManager::acquireGeometry | ( | const agxCollide::Geometry * | geometry, |
| const agx::Vec3 & | color | ||
| ) |
| HollowConeProxy * agxRender::RenderManager::acquireHollowCone | ( | const agx::Vec3 & | p1, |
| const agx::Vec3 & | p2, | ||
| float | topRadius, | ||
| float | bottomRadius, | ||
| float | thickness | ||
| ) |
Create and return a new HollowConeProxy from the Proxy factory.
| p1 | - The start point in WORLD coordinate system for a cone |
| p2 | - The end point in WORLD coordinate system for a cone |
| topRadius | - The top radius of a cone (at p1) |
| bottomRadius | - The bottom radius for the cone (at p2) |
| thickness | - The wall thickness |
| HollowCylinderProxy * agxRender::RenderManager::acquireHollowCylinder | ( | float | radius, |
| float | height, | ||
| float | thickness | ||
| ) |
Create and return a new proxy HollowCylinder from the Proxy factory.
| radius | - The radius of a cylinder |
| height | - The height of a cylinder |
Create and return a new proxy Line from the Proxy factory.
| p1,p2 | - Start, end points in WORLD coordinate system |
| PlaneProxy * agxRender::RenderManager::acquirePlane | ( | const agx::Vec3 & | normal, |
| agx::Real | distance | ||
| ) |
| normal | - The normal of a plane |
| distance | - The scalar part of the plane |
| agxRender::RigidBodyBatchRenderProxy * agxRender::RenderManager::acquireRigidBodies | ( | const agx::RigidBodyPtrSetVector * | enabledBodies, |
| float | scale | ||
| ) |
Create and return a new proxy rigid body batch from the Proxy factory.
| enabledBodies | - container with enabled bodies |
| scale | - scale that can be used for scaling the size of the rendered bodies |
| SphereProxy * agxRender::RenderManager::acquireSphere | ( | float | radius | ) |
Create and return a new proxy sphere from the Proxy factory.
| radius | - The radius of the new sphere |
| TextProxy * agxRender::RenderManager::acquireText | ( | const agx::String & | text, |
| const agx::Vec3 & | pos, | ||
| float | size = 1 |
||
| ) |
Create and return a new text sphere from the Proxy factory.
| text | - The text |
| pos | - Position of the text. Currently only x,y is used. |
| size | - Size of the text. Used to scale the text. |
| TruncatedConeProxy * agxRender::RenderManager::acquireTruncatedCone | ( | const agx::Vec3 & | p1, |
| const agx::Vec3 & | p2, | ||
| float | topRadius, | ||
| float | bottomRadius | ||
| ) |
Create and return a new proxy TruncatedCone from the Proxy factory.
| p1 | - The start point in WORLD coordinate system for a cone |
| p2 | - The end point in WORLD coordinate system for a cone |
| topRadius | - The top radius of a cone (at p1) |
| bottomRadius | - The bottom radius for the cone (at p2) |
| agxRender::WireRenderProxy * agxRender::RenderManager::acquireWire | ( | float | radius, |
| const agx::Vec3 & | color | ||
| ) |
Create and return a new proxy wire from the proxy factory.
| radius | - global radius of this wire |
| color | - color of this wire |
|
protected |
Add a shape to the set of active shape proxies.
| shape | - The shape which should be rendered |
| geometry | - The Geometry for the shape |
| color | - the color which will be used for the geometry. The default value x=-1, is to indicate that its the RenderManager which should set the color |
| addToProxies | - If true (default), it will be added to the Shape proxies and will be updated when shape transforms. If not, it will be rendered only once. |
|
protected |
|
protected |
Add a geometry (and its shapes) to the set of active shape proxies.
| geometry | - The geometry which should be rendered |
| color | - the color which will be used for the geometry. The default value x=-1, is to indicate that its the RenderManager which should set the color |
| addToProxies | - If true (default), it will be added to the Shape proxies and will be updated when shape transforms. If not, it will be rendered only once. |
|
protected |
Go through space and add all geometries to the set of shapes that should be rendered.
| void agxRender::RenderManager::addRenderable | ( | Renderable * | renderable | ) |
Add custom render object.
| renderable | - custom render object derived from the base class Renderable. |
| void agxRender::RenderManager::clear | ( | bool | clearText = true, |
| bool | clearGlobalProxies = true |
||
| ) |
Clear all acquired RenderProxy.
Will call atRemove for each Proxy that is removed.
| clearText | - true to clear text proxies (Default: true) |
| clearGlobalProxies | - true to clear global proxies that are not part of a cache (Default: true) |
|
protected |
Remove all shape proxies.
| void agxRender::RenderManager::disableFlags | ( | unsigned int | flags | ) |
Disable all rendering flags specified in flags.
| flags | - The rendering flags to be disabled |
| void agxRender::RenderManager::enableFlags | ( | unsigned int | flags | ) |
Enable all rendering flags specified in flags.
| flags | - The rendering flags to be enabled |
| RenderProxy * agxRender::RenderManager::findShapeProxy | ( | const agxCollide::Shape * | shape | ) |
Try to locate a RenderProxy which is associated (already added) for the specified shape.
| shape | - A pointer to a shape, for which a RenderProxy should be found. |
|
protected |
Based on the number of used RenderProxy (for each type), reduce the cache down to that size.
Remove any outstanding ones.
|
inline |
Definition at line 685 of file RenderManager.h.
References m_alpha.
|
inline |
Definition at line 679 of file RenderManager.h.
References m_enable.
Referenced by isEnabled().
|
protected |
| RenderProxyFactory * agxRender::RenderManager::getProxyFactory | ( | ) |
| float agxRender::RenderManager::getScaleFactor | ( | ) | const |
|
inline |
Definition at line 376 of file RenderManager.h.
| bool agxRender::RenderManager::hasRenderable | ( | Renderable * | renderable | ) | const |
renderable is added
|
inline |
Definition at line 691 of file RenderManager.h.
References getEnable().
| bool agxRender::RenderManager::isEnabledFlags | ( | unsigned int | flags | ) | const |
flags are enabled.
|
protected |
|
protected |
Remove a Geometry (and its shapes) from the set of shapes that should be rendered.
| geometry | - The Geometry that should be removed |
|
protected |
Remove a Shape from the set of shapes that should be rendered.
| shape | - The shape that should be removed |
| bool agxRender::RenderManager::removeRenderable | ( | Renderable * | renderable | ) |
Remove custom render object renderable.
|
protected |
Render AABB tree for the specified proxy.
|
protected |
Render bounding volume for the geom.
|
protected |
Render an ObserverFrame.
| void agxRender::RenderManager::setAlpha | ( | float | alpha | ) |
Loop over all proxies and set alpha value to the specified value, also sets the new default alpha value.
| alpha | - the new alpha value |
| void agxRender::RenderManager::setDefaultRenderMode | ( | RenderProxy::RenderMode | mode | ) |
Set the new default render mode for all RenderProxies activated after this call.
| void agxRender::RenderManager::setEnable | ( | bool | flag | ) |
Enable/disable the whole rendering system.
Rendering of shapes, constraints and Renderables is disabled.
| flag | - if true, the rendering is enabled, otherwise disabled |
| void agxRender::RenderManager::setFlags | ( | unsigned int | flags | ) |
Set the render flags.
| void agxRender::RenderManager::setProxyFactory | ( | RenderProxyFactory * | factory | ) |
Associate a new factory for creating RenderProxy's on request from the RenderManager.
| factory | - The new render proxy factory |
| void agxRender::RenderManager::setScaleFactor | ( | float | scaleFactor = 1.0f | ) |
Set the scale of the debug rendering of contacts and center of mass, it will not affect already created/rendered objects, only new, if you want the scale to affect all objects, call setEnable(false), setEnable(true) Default is 1.0 which corresponds to a rendering which suits objects of size 1m or larger...
|
protected |
Associate a new space with this RenderManager, used by agxSDK::Simulation.
| void agxRender::RenderManager::update | ( | ) |
Updates a new state for the rendering, acquires renderable objects for shapes, text etc.
Will dispatch create calls to the associated RenderProxyFactory.
|
protected |
Update all AABB (for geometries) proxies (boxes)
| void agxRender::RenderManager::updateAllProxies | ( | agxRender::RenderProxy::EventType | eventType | ) |
Fires event given eventType for all proxies.
| eventType | - event type to fire |
|
protected |
Go through all bodies and acquire proxies for them.
|
protected |
Update all constraints (call render)
|
protected |
acquire proxies for contacts
|
protected |
Update the graphs.
|
protected |
Update all observer frames.
|
protected |
|
protected |
|
protected |
Update particleSystems.
|
protected |
Update size, color and transform.
|
protected |
Call render for all Renderables.
|
protected |
Update (transform and color) for all shapes.
|
protected |
Update only text proxies.
|
protected |
Definition at line 494 of file RenderManager.h.
Referenced by getAlpha().
|
protected |
Definition at line 618 of file RenderManager.h.
|
protected |
Definition at line 607 of file RenderManager.h.
|
protected |
Definition at line 611 of file RenderManager.h.
|
protected |
Definition at line 614 of file RenderManager.h.
|
protected |
Definition at line 620 of file RenderManager.h.
|
protected |
Definition at line 498 of file RenderManager.h.
|
protected |
Definition at line 612 of file RenderManager.h.
|
protected |
Definition at line 630 of file RenderManager.h.
|
protected |
Definition at line 493 of file RenderManager.h.
Referenced by getEnable().
|
protected |
Definition at line 492 of file RenderManager.h.
|
protected |
Definition at line 625 of file RenderManager.h.
|
protected |
E.g., wires that hold their proxy (i.e., not doing acquire to fetch their render proxy).
Definition at line 629 of file RenderManager.h.
|
protected |
Definition at line 496 of file RenderManager.h.
|
protected |
Definition at line 616 of file RenderManager.h.
|
protected |
Definition at line 613 of file RenderManager.h.
|
protected |
Definition at line 619 of file RenderManager.h.
|
protected |
Definition at line 623 of file RenderManager.h.
|
protected |
Definition at line 634 of file RenderManager.h.
|
protected |
Definition at line 632 of file RenderManager.h.
|
protected |
Definition at line 636 of file RenderManager.h.
|
protected |
Definition at line 635 of file RenderManager.h.
|
protected |
Definition at line 633 of file RenderManager.h.
|
protected |
Definition at line 637 of file RenderManager.h.
|
protected |
Definition at line 501 of file RenderManager.h.
|
protected |
Definition at line 610 of file RenderManager.h.
|
protected |
Definition at line 491 of file RenderManager.h.
|
protected |
Definition at line 621 of file RenderManager.h.
|
protected |
Definition at line 627 of file RenderManager.h.
|
protected |
Definition at line 499 of file RenderManager.h.
|
protected |
Definition at line 495 of file RenderManager.h.
|
protected |
Definition at line 617 of file RenderManager.h.
|
protected |
Definition at line 609 of file RenderManager.h.
|
protected |
Definition at line 615 of file RenderManager.h.