32 class StatisticsEntries;
38 class RenderProxyFactory;
44 class HeightFieldProxy;
46 class HollowCylinderProxy;
48 class TruncatedConeProxy;
49 class HollowConeProxy;
141 bool getEnable( )
const;
146 bool isEnabled()
const;
157 float getAlpha( )
const;
325 void clear(
bool clearText =
true,
bool clearGlobalProxies =
true );
506 m_mgr->m_cacheVector.push_back(
this );
521 template <
typename T>
542 for (
size_t i = m_index; i < m_pool.size(); i++ )
543 m_pool[i]->callOnChange( RenderProxy::REMOVE );
545 m_pool.resize( std::min( m_index, m_pool.size() ) );
554 for (
size_t i = 0; i < m_pool.size(); i++ )
555 m_pool[i]->setAlpha( alpha );
563 ( *it )->callOnChange( RenderProxy::REMOVE );
588 template <
typename T,
typename P1>
603 T* acquire() {
return nullptr; }
771 template<
typename T>
774 if ( m_index < m_pool.size() ) {
775 T* proxy = m_pool[m_index++];
781 const void* p =
nullptr;
782 const T* px =
static_cast<const T*
>( p );
783 T* proxy = m_mgr->getProxyFactory()->create( px);
785 proxy->setEnable(
true );
786 m_pool.push_back( proxy );
787 m_index = m_pool.size();
793 template<
typename T,
typename P1>
796 if ( this->m_index < this->m_pool.size() ) {
797 T* proxy = this->m_pool[this->m_index++];
802 T* proxy = this->m_mgr->getProxyFactory()->create( param );
804 proxy->setEnable(
true );
805 this->m_pool.push_back( proxy );
806 this->m_index = this->m_pool.size();
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGXPHYSICS_EXPORT
The geometry representation used by the collision detection engine.
Class for listening for add/remove geometry events for an associated Space.
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
Data storage for a collection of entity instances of a specified EntityModel.
Subclass that implements a BoxProxy.
Subclass that implements a CapsuleProxy.
Subclass that implements a ConeProxy.
Subclass that implements a CylinderProxy.
Class that implements a simple graph for plotting scalar values.
Subclass that implements a HollowConeProxy.
Subclass that implements a CylinderProxy.
Subclass that implements a LineProxy.
Subclass that implements a PlaneProxy.
Class for storing RenderProxies that are currently in use.
T * acquire(const P1 ¶m)
PrimitiveCache1(RenderManager *mgr)
Constructor.
Class for storing RenderProxies that are currently in use.
virtual ~PrimitiveCache()
Destructor: calls clear()
const_iterator begin() const
ProxyVector::const_iterator const_iterator
void clear()
Reduce number of proxies to 0.
const_iterator end() const
agx::Vector< agx::ref_ptr< T > > ProxyVector
void flush()
Reduce size of pooled RenderProxy down to the number of used ones.
ProxyVector::iterator iterator
PrimitiveCache(RenderManager *mgr)
Constructor.
void setAlpha(float alpha)
Set alpha value for all proxies.
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
void renderAABBTrees(RenderProxy *proxy)
Render AABB tree for the specified proxy.
PrimitiveCache1< ContactsProxy, agxCollide::GeometryContactPtrVector > m_contactsCache
virtual ~RenderManager()
Destructor.
TextProxy * acquireText(const agx::String &text, const agx::Vec3 &pos, float size=1)
Create and return a new text sphere from the Proxy factory.
CylinderProxy * acquireCylinder(float radius, float height)
Create and return a new proxy Cylinder from the Proxy factory.
void addRenderable(Renderable *renderable)
Add custom render object.
RenderProxyFactory * getProxyFactory()
void setSpace(agxCollide::Space *space)
Associate a new space with this RenderManager, used by agxSDK::Simulation.
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 setAlpha(float alpha)
Loop over all proxies and set alpha value to the specified value, also sets the new default alpha val...
RenderableRefVector m_renderables
float getScaleFactor() const
agx::ref_ptr< SpaceListener > m_listener
CapsuleProxy * acquireCapsule(const agx::Vec3 &begin, const agx::Vec3 &end, float radius)
Create and return a new proxy Capsule from the Proxy factory.
PrimitiveCache< ConeProxy > m_coneCache
void enableFlags(unsigned int flags)
Enable all rendering flags specified in flags.
void updateAABBProxies()
Update all AABB (for geometries) proxies (boxes)
PrimitiveCache< PlaneProxy > m_planeCache
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.
agxRender::GraphRef m_graph
void updateGraphs()
Update the graphs.
void updateParticleGeometryContactProxies()
CacheVector m_cacheVector
BoxProxy * acquireBox(const agx::Vec3 &halfExtents)
Create and return a new proxy boxy from the Proxy factory.
PrimitiveCache1< RigidBodyBatchRenderProxy, const agx::RigidBodyPtrSetVector * > m_rbCache
LineProxy * acquireLine(const agx::Vec3 &p1, const agx::Vec3 &p2)
Create and return a new proxy Line from the Proxy factory.
bool isEnabledFlags(unsigned int flags) const
RenderProxy * findShapeProxy(const agxCollide::Shape *shape)
Try to locate a RenderProxy which is associated (already added) for the specified shape.
PrimitiveCache< CapsuleProxy > m_capsuleCache
PrimitiveCache< TruncatedConeProxy > m_truncatedConeCache
RenderProxyRef m_particleGeometryContactRenderProxy
void remove(const agxCollide::Shape *shape)
Remove a Shape from the set of shapes that should be rendered.
void setProxyFactory(RenderProxyFactory *factory)
Associate a new factory for creating RenderProxy's on request from the RenderManager.
ParticleSystemProxyContainer m_particleSystems
void updateObserverFrames()
Update all observer frames.
SphereProxy * acquireSphere(float radius)
Create and return a new proxy sphere 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.
RenderProxyHashVector m_proxies
void updateBodyProxies(agxData::EntityStorage *islandStorage=nullptr)
Go through all bodies and acquire proxies for them.
void updateConstraintProxies()
Update all constraints (call render)
void updateParticleContactProxies()
void disableFlags(unsigned int flags)
Disable all rendering flags specified in flags.
void updateAllProxies(agxRender::RenderProxy::EventType eventType)
Fires event given eventType for all proxies.
RenderManager(agxSDK::Simulation *sim)
Constructor.
bool hasRenderable(Renderable *renderable) const
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.
PrimitiveCache< HollowConeProxy > m_hollowConeCache
agxRender::ContactsProxy * acquireContacts(const agxCollide::GeometryContactPtrVector &contacts, float scale)
Create and return a new proxy Contact from the Proxy factory.
agxData::BufferRef m_particleGeometryContactRadiusBuffer
PlaneProxy * acquirePlane(const agx::Vec3 &normal, agx::Real distance)
agxData::ValueRef m_particleContactBound
float m_ContactsProxySize
agx::HashVector< agx::UInt32, agx::ref_ptr< RenderProxy > > RenderProxyHashVector
CapsuleProxy * acquireCapsule(float radius, float height)
Create and return a new proxy Capsule from the Proxy factory.
void clearShapeProxies()
Remove all shape proxies.
void clear(bool clearText=true, bool clearGlobalProxies=true)
Clear all acquired RenderProxy.
void updateParticleSystemProxies()
Update particleSystems.
void remove(const agx::ParticleSystem *particleSystem)
void setScaleFactor(float scaleFactor=1.0f)
Set the scale of the debug rendering of contacts and center of mass, it will not affect already creat...
RenderProxyRefContainer m_globalProxies
E.g., wires that hold their proxy (i.e., not doing acquire to fetch their render proxy).
PrimitiveCache< TextProxy > m_textCache
void update()
Updates a new state for the rendering, acquires renderable objects for shapes, text etc.
HollowCylinderProxy * acquireHollowCylinder(float radius, float height, float thickness)
Create and return a new proxy HollowCylinder from the Proxy factory.
agx::Vector< RenderableRef > RenderableRefVector
void add(const agx::ParticleSystem *particleSystem)
PrimitiveCache< CylinderProxy > m_cylinderCache
PrimitiveCache< HollowCylinderProxy > m_hollowCylinderCache
agx::Vector< CacheBase * > CacheVector
void updateRenderables()
Call render for all Renderables.
bool removeRenderable(Renderable *renderable)
Remove custom render object renderable.
void setEnable(bool flag)
Enable/disable the whole rendering system.
void setDefaultRenderMode(RenderProxy::RenderMode mode)
Set the new default render mode for all RenderProxies activated after this call.
ConeProxy * acquireCone(const agx::Vec3 &p1, const agx::Vec3 &p2, float radius)
Create and return a new proxy Cone from the Proxy factory.
void updateContactProxies()
acquire proxies for contacts
void renderBoundingVolume(const agxCollide::Geometry *geometry)
Render bounding volume for the geom.
RenderProxyRef m_particleContactRenderProxy
agxSDK::Simulation * m_simulation
void acquireGeometry(const agxCollide::Geometry *geometry, const agx::Vec3 &color)
agxRender::WireRenderProxy * acquireWire(float radius, const agx::Vec3 &color)
Create and return a new proxy wire from the proxy factory.
void updateText()
Update only text proxies.
void updateProxy(RenderProxy *proxy, agxData::EntityStorage *islandStorage=nullptr)
Update size, color and transform.
agx::ref_ptr< RenderProxyFactory > m_factory
agxData::BufferRef m_particleContactRadiusBuffer
agx::Vector< ConstParticleSystemPtrRenderProxyPtrPair > ParticleSystemProxyContainer
void setFlags(unsigned int flags)
Set the render flags.
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.
agxRender::RigidBodyBatchRenderProxy * acquireRigidBodies(const agx::RigidBodyPtrSetVector *enabledBodies, float scale)
Create and return a new proxy rigid body batch from the Proxy factory.
agx::Vector< agx::ref_ptr< agxRender::RenderProxy > > RenderProxyRefContainer
std::pair< const agx::ParticleSystem *, agxRender::RenderProxyRef > ConstParticleSystemPtrRenderProxyPtrPair
RenderProxy::RenderMode m_defaultRenderMode
PrimitiveCache< LineProxy > m_lineCache
PrimitiveCache1< BoxProxy, agx::Vec3 > m_boxCache
void renderObserverFrame(const agx::ObserverFrame *observerFrame)
Render an ObserverFrame.
PrimitiveCache1< SphereProxy, float > m_sphereCache
agxSDK::Simulation * getSimulation()
void addAllGeometries()
Go through space and add all geometries to the set of shapes that should be rendered.
agxData::ValueRef m_particleGeometryContactBound
void updateShapeProxies(agxData::EntityStorage *islandStorage=nullptr)
Update (transform and color) for all shapes.
void flush()
Based on the number of used RenderProxy (for each type), reduce the cache down to that size.
void remove(const agxCollide::Geometry *geometry)
Remove a Geometry (and its shapes) from the set of shapes that should be rendered.
Abstract class which is responsible for returning a pointer to a specified RenderProxy type.
SphereProxy * create(float radius)
Create a SphereProxy without arguments.
virtual CapsuleProxy * createCapsule(float radius, float height)=0
Interface for creating and returning a CapsuleProxy.
virtual LineProxy * createLine(const agx::Vec3 &p1, const agx::Vec3 &p2)=0
Interface for creating and returning a LineProxy.
virtual agxRender::RigidBodyBatchRenderProxy * createRigidBodies(const agx::RigidBodyPtrSetVector *)=0
Interface for creating and returning batch rendering of rigid bodies (cm).
virtual ConeProxy * createCone(float radius, float height)=0
Interface for creating and returning a ConeProxy.
virtual TextProxy * createText(const agx::String &text, const agx::Vec3 &pos, float size=1)=0
Interface for creating and returning TextProxy.
virtual BoxProxy * createBox(const agx::Vec3 &halfExtents)=0
Interface for creating and returning a BoxProxy.
virtual HollowConeProxy * createHollowCone(float topRadius, float bottomRadius, float height, float thickness)=0
Interface for creating and returning a HollowConeProxy.
virtual PlaneProxy * createPlane(const agx::Vec3 &normal, agx::Real distance)=0
Interface for creating and returning PlaneProxy.
virtual TruncatedConeProxy * createTruncatedCone(float topRadius, float bottomRadius, float height)=0
Interface for creating and returning a TruncatedConeProxy.
virtual agxRender::ContactsProxy * createContacts(const agxCollide::GeometryContactPtrVector &)=0
Interface for creating and returning ContactsProxy.
virtual HollowCylinderProxy * createHollowCylinder(float outerRadius, float height, float thickness)=0
Interface for creating and returning a HollowCylinderProxy.
RenderProxy::RenderMode m_defaultRenderMode
virtual CylinderProxy * createCylinder(float radius, float height)=0
Interface for creating and returning a CylinderProxy.
RenderProxy::RenderMode getDefaultRenderMode() const
virtual SphereProxy * createSphere(float radius)=0
Interface for creating and returning a SphereProxy.
Abstract base class which encapsulated information for rendering a specific shape.
EventType
Enum for specifying a type of event which might change a RenderProxy.
Inherit from this class and implement the render() method to make it it self during debug rendering.
Class holding rigid bodies that makes it possible to batch render these objects.
A listener that will be responsible for calling RenderManager every time a Shape is added/removed fro...
agxCollide::Space * getSpace()
void addShapeNotification(agxCollide::Space *space, agxCollide::Geometry *geometry, agxCollide::Shape *shape)
Called when a Shape is added to a Geometry which is associated to Space.
void removeShapeNotification(agxCollide::Space *space, agxCollide::Geometry *geometry, agxCollide::Shape *shape)
Called when a Shape is removed from a Geometry which is associated to Space.
virtual ~SpaceListener()
Destructor.
void removeGeometryNotification(agxCollide::Space *space, agxCollide::Geometry *geometry)
Called when a Geometry is removed to the associated Space.
void addNotification(agxCollide::Space *space)
Called when this listener is added to a Space.
SpaceListener(RenderManager *mgr)
Constructor.
agx::observer_ptr< agxCollide::Space > m_space
agx::observer_ptr< RenderManager > m_mgr
void addGeometryNotification(agxCollide::Space *space, agxCollide::Geometry *geometry)
Called when a Geometry is added to the associated Space.
Subclass that implements a SphereProxy.
Subclass that implements a TextProxy.
Subclass that implements a TruncatedConeProxy.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
@ SHRINK_BUFFER
Buffer is deallocated and replaced by an newly allocated empty buffer.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
With this class you can attach an ObserverFrame object relative to a RigidBody.
A basic particle system that contains all the storages and buffers required for basic operation and a...
Base class providing referencing counted objects.
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
Smart pointer for handling referenced counted objects.
Namespace containing classes for handling debug rendering of collision geometries,...
Flags
Flags for specifying what is enabled in the debug rendering system.
@ RENDER_STATISTICS
Render statistics text/graphs onto screen.
@ RENDER_BATCH_WIRES
Wire content batch rendered.
@ RENDER_BODIES
Render rigid body mass centers.
@ RENDER_BOUNDING_VOLUMES
Render bounding volumes for geometries.
@ RENDER_GEOMETRY_CONTACTS
Render geometry contacts.
@ RENDER_RENDERABLES
Execute render for all registered Renderables.
@ RENDER_PARTICLE_EMITTERS
Render particle emitters.
@ RENDER_CONTACTS
Render all types of contacts.
@ RENDER_PARTICLE_GEOMETRY_CONTACTS
Render particle-geometry contacts.
@ RENDER_GEOMETRIES
Render collision geometries.
@ RENDER_NICE_CONTACTS
Render contacts with high fidelity.
@ RENDER_TEXT
Render text.
@ RENDER_MESH
Render trimesh/height field.
@ RENDER_CONSTRAINTS
Render rigid body constraint attachments.
@ RENDER_PARTICLE_CONTACTS
Render particle contacts.
@ RENDER_DEFAULT
The default rendering mode.
@ RENDER_AABB_TREES
Render AABB trees.
@ RENDER_BODY_PARTITION
Color for a RigidBody is selected based on which partition it belongs to.
@ RENDER_BATCH_BODIES
Batch render bodies.
@ RENDER_BATCH_CONTACTS
Render contacts as one batch call for all contacts.
@ RENDER_SENSORS
Render geometries which are sensors.
@ RENDER_PARTICLE_SYSTEMS
Render particle systems.
@ RENDER_OBSERVER_FRAMES
Render Observer frames.
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
virtual void setAlpha(float alpha)=0
CacheBase(RenderManager *mgr)