 |
AGXDynamics
2.35.0.3
|
Go to the documentation of this file.
17 #ifndef AGXRENDER_RENDERMANAGER_H
18 #define AGXRENDER_RENDERMANAGER_H
33 class StatisticsEntries;
39 class RenderProxyFactory;
45 class HeightFieldProxy;
47 class HollowCylinderProxy;
49 class TruncatedConeProxy;
50 class HollowTruncatedConeProxy;
137 void setEnable(
bool flag );
142 bool getEnable( )
const;
147 bool isEnabled()
const;
158 float getAlpha( )
const;
164 void disableFlags(
unsigned int flags );
170 void enableFlags(
unsigned int flags );
175 bool isEnabledFlags(
unsigned int flags )
const;
180 void setFlags(
unsigned int flags );
230 CylinderProxy* acquireCylinder(
float radius,
float height );
286 CapsuleProxy* acquireCapsule(
float radius,
float height );
325 void clear(
bool clearText =
true,
bool clearGlobalProxies =
true );
336 bool hasRenderable(
Renderable* renderable )
const;
342 bool removeRenderable(
Renderable* renderable );
365 void setScaleFactor(
float scaleFactor = 1.0f );
370 float getScaleFactor()
const;
438 void addAllGeometries();
447 void updateAABBProxies( );
450 void updateObserverFrames();
462 void updateParticleSystemProxies();
465 void updateRenderables();
468 void updateContactProxies();
471 void updateParticleContactProxies();
472 void updateParticleGeometryContactProxies();
475 void updateConstraintProxies();
478 void clearShapeProxies();
503 m_mgr->m_cacheVector.push_back(
this );
506 virtual void clear() = 0;
507 virtual void flush() = 0;
508 virtual void setAlpha(
float alpha ) = 0;
518 template <
typename T>
539 for (
size_t i = m_index; i < m_pool.size(); i++ )
542 m_pool.resize(
std::min( m_index, m_pool.size() ) );
551 for (
size_t i = 0; i < m_pool.size(); i++ )
585 template <
typename T,
typename P1>
596 T* acquire(
const P1& param );
600 T* acquire() {
return nullptr; }
653 virtual SphereProxy* createSphere(
float radius ) = 0;
662 virtual CylinderProxy* createCylinder(
float radius,
float height ) = 0;
665 virtual HollowCylinderProxy* createHollowCylinder(
float radius,
float height,
float thickness ) = 0;
668 virtual ConeProxy* createCone(
float radius,
float height ) = 0;
671 virtual TruncatedConeProxy* createTruncatedCone(
float topRadius,
float bottomRadius,
float height ) = 0;
674 virtual HollowTruncatedConeProxy* createHollowTruncatedCone(
float topRadius,
float bottomRadius,
float height,
float thickness ) = 0;
677 virtual CapsuleProxy* createCapsule(
float radius,
float height ) = 0;
680 virtual WireShapeProxy* createWireShape(
float radius,
float height,
769 void setEnable(
bool flag );
770 bool getEnable( )
const;
919 template<
typename T>
922 if ( m_index < m_pool.size() ) {
923 T* proxy = m_pool[m_index++];
929 const void* p =
nullptr;
930 const T* px =
static_cast<const T*
>( p );
931 T* proxy = m_mgr->getProxyFactory()->create( px);
932 proxy->setEnable(
true );
933 m_pool.push_back( proxy );
934 m_index = m_pool.size();
939 template<
typename T,
typename P1>
942 if ( this->m_index < this->m_pool.size() ) {
943 T* proxy = this->m_pool[this->m_index++];
948 T* proxy = this->m_mgr->getProxyFactory()->create( param );
949 proxy->setEnable(
true );
950 this->m_pool.push_back( proxy );
951 this->m_index = this->m_pool.size();
agx::observer_ptr< RenderManager > m_mgr
agxData::ValueRef m_particleContactBound
@ RENDER_RENDERABLES
Execute render for all registered Renderables.
@ RENDER_PARTICLE_CONTACTS
Render particle contacts.
virtual PlaneProxy * createPlane(const agx::Vec3 &normal, agx::Real distance)=0
Interface for creating and returning PlaneProxy.
virtual CapsuleProxy * createCapsule(float radius, float height)=0
Interface for creating and returning a CapsuleProxy.
@ RENDER_OBSERVER_FRAMES
Render Observer frames.
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
Abstract representation of a value.
PrimitiveCache< CapsuleProxy > m_capsuleCache
EventType
Enum for specifying a type of event which might change a RenderProxy.
Class that implements a simple graph for plotting scalar values.
virtual ContactsProxy * createContacts(const agxCollide::GeometryContactPtrVector &)=0
Interface for creating and returning ContactsProxy.
virtual ~PrimitiveCache()
Destructor: calls clear()
Namespace containing classes for handling debug rendering of collision geometries,...
ProxyVector::const_iterator const_iterator
@ RENDER_STATISTICS
Render statistics text/graphs onto screen.
RenderProxyRef m_particleContactRenderProxy
PrimitiveCache1(RenderManager *mgr)
Constructor.
Subclass that implements a ConeProxy.
@ RENDER_SENSORS
Render geometries which are sensors.
const_iterator begin() const
PrimitiveCache1< ContactsProxy, agxCollide::GeometryContactPtrVector > m_contactsCache
Flags
Flags for specifying what is enabled in the debug rendering system.
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
@ RENDER_CONSTRAINTS
Render rigid body constraint attachments.
Subclass that implements a HeightfieldProxy.
AGXOSG_EXPORT osg::Geode * createText(const std::string &text, const agx::Vec3 &relPosition=agx::Vec3(0, 0, 0), const agx::Vec4f &color=agxRender::Color::Yellow(), agx::Real size=0.2)
Create a text object.
Subclass that implements a CapsuleProxy.
agx::Vector< agx::ref_ptr< T > > ProxyVector
RenderProxy::RenderMode getDefaultRenderMode() const
virtual ConeProxy * createCone(float radius, float height)=0
Interface for creating and returning a ConeProxy.
A HeightField is a collision shape that can be created from a grid structure, like an image.
Class for listening for add/remove geometry events for an associated Space.
agxRender::GraphRef m_graph
void setRenderManager(RenderManager *mgr)
virtual HollowTruncatedConeProxy * createHollowTruncatedCone(float topRadius, float bottomRadius, float height, float thickness)=0
Interface for creating and returning a HollowTruncatedConeProxy.
Subclass that implements a TruncatedConeProxy.
Data storage for a collection of entity instances of a specified EntityModel.
Subclass that implements a BoxProxy.
PrimitiveCache1< RigidBodyBatchRenderProxy, const agx::RigidBodyPtrSetVector * > m_rbCache
@ SHRINK_BUFFER
Buffer is deallocated and replaced by an newly allocated empty buffer.
agx::Vector< RenderableRef > RenderableRefVector
agx::observer_ptr< agxCollide::Space > m_space
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
CacheBase(RenderManager *mgr)
#define AGXPHYSICS_EXPORT
@ RENDER_BATCH_CONTACTS
Render contacts as one batch call for all contacts.
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
Subclass that implements a TextProxy.
void clear()
Reduce number of proxies to 0.
@ RENDER_BODY_PARTITION
Color for a RigidBody is selected based on which partition it belongs to.
@ REMOVE
The Shape has been removed from space, need to be removed from rendering.
RenderableRefVector m_renderables
Class holding rigid bodies that makes it possible to batch render these objects.
AGXOSG_EXPORT agxCollide::Trimesh * createTrimesh(osg::Node *node)
Extracts mesh data from an osg::Node, creates an agxCollide::Trimesh from it and returns the result.
With this class you can attach an ObserverFrame object relative to a RigidBody.
A listener that will be responsible for calling RenderManager every time a Shape is added/removed fro...
A basic particle system that contains all the storages and buffers required for basic operation and a...
Smart pointer for handling referenced counted objects.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Abstract base class that acts as an interface and can render the data from a Graph.
SphereProxy * create(float radius)
Create a SphereProxy without arguments.
Class for storing RenderProxies that are currently in use.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Subclass that implements a CylinderProxy.
Class for storing RenderProxies that are currently in use.
PrimitiveCache< HollowCylinderProxy > m_hollowCylinderCache
@ RENDER_AABB_TREES
Render AABB trees.
Subclass that implements a PlaneProxy.
agx::ref_ptr< SpaceListener > m_listener
agxData::BufferRef m_particleGeometryContactRadiusBuffer
agxData::ValueRef m_particleGeometryContactBound
Vec3T< T > min(const Vec3T< T > &lhs, const Vec3T< T > &rhs)
@ RENDER_BATCH_WIRES
Wire content batch rendered.
RenderProxy::RenderMode m_defaultRenderMode
void setAlpha(float alpha)
Set alpha value for all proxies.
@ RENDER_NICE_CONTACTS
Render contacts with high fidelity.
RenderProxyRef m_particleGeometryContactRenderProxy
const_iterator end() const
std::pair< const agx::ParticleSystem *, agxRender::RenderProxyRef > ConstParticleSystemPtrRenderProxyPtrPair
AGXOSG_EXPORT void setAlpha(osg::Node *node, float alpha)
Set the alpha part of the material for a node.
Abstract base class which encapsulated information for rendering a specific shape.
@ RENDER_BODIES
Render rigid body mass centers.
virtual RigidBodyBatchRenderProxy * createRigidBodies(const agx::RigidBodyPtrSetVector *)=0
Interface for creating and returning batch rendering of rigid bodies (cm).
virtual BoxProxy * createBox(const agx::Vec3 &halfExtents)=0
Interface for creating and returning a BoxProxy.
agx::Vector< ConstParticleSystemPtrRenderProxyPtrPair > ParticleSystemProxyContainer
Abstract representation of a data buffer.
The geometry representation used by the collision detection engine.
@ RENDER_TEXT
Render text.
agx::HashVector< agx::UInt32, agx::ref_ptr< RenderProxy > > RenderProxyHashVector
@ RENDER_MESH
Render trimesh/height field.
PrimitiveCache< CylinderProxy > m_cylinderCache
PrimitiveCache< PlaneProxy > m_planeCache
ProxyVector::iterator iterator
PrimitiveCache< ConeProxy > m_coneCache
Subclass that implements a HollowTruncatedConeProxy.
CacheVector m_cacheVector
@ RENDER_BOUNDING_VOLUMES
Render bounding volumes for geometries.
agxData::BufferRef m_particleContactRadiusBuffer
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
@ RENDER_PARTICLE_EMITTERS
Render particle emitters.
A component is an object containing other objects, enabling hierarchical structuring.
PrimitiveCache1< SphereProxy, float > m_sphereCache
RenderProxy::RenderMode m_defaultRenderMode
Subclass that implements a SphereProxy.
virtual SphereProxy * createSphere(float radius)=0
Interface for creating and returning a SphereProxy.
RenderProxyHashVector m_proxies
virtual HollowCylinderProxy * createHollowCylinder(float radius, float height, float thickness)=0
Interface for creating and returning a HollowCylinderProxy.
Subclass that implements a CylinderProxy.
virtual TruncatedConeProxy * createTruncatedCone(float topRadius, float bottomRadius, float height)=0
Interface for creating and returning a TruncatedConeProxy.
Base class providing referencing counted objects.
#define AGX_DECLARE_POINTER_TYPES(type)
RenderProxyRefContainer m_globalProxies
E.g., wires that hold their proxy (i.e., not doing acquire to fetch their render proxy).
virtual LineProxy * createLine(const agx::Vec3 &p1, const agx::Vec3 &p2)=0
Interface for creating and returning a LineProxy.
agxSDK::Simulation * m_simulation
agx::ref_ptr< RenderProxyFactory > m_factory
@ RENDER_PARTICLE_GEOMETRY_CONTACTS
Render particle-geometry contacts.
PrimitiveCache(RenderManager *mgr)
Constructor.
virtual TextProxy * createText(const agx::String &text, const agx::Vec3 &pos)=0
Interface for creating and returning TextProxy.
Inherit from this class and implement the render() method to make it it self during debug rendering.
void flush()
Reduce size of pooled RenderProxy down to the number of used ones.
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
PrimitiveCache< TextProxy > m_textCache
PrimitiveCache1< BoxProxy, agx::Vec3 > m_boxCache
Subclass that implements a WireShapeProxy.
Triangle mesh for geometric intersection tests.
PrimitiveCache< HollowTruncatedConeProxy > m_hollowTruncatedConeCache
agx::Vector< CacheBase * > CacheVector
@ RENDER_BATCH_BODIES
Batch render bodies.
AGXTERRAIN_EXPORT void clear()
Subclass that implements a LineProxy.
Abstract class which is responsible for returning a pointer to a specified RenderProxy type.
@ RENDER_DEFAULT
The default rendering mode.
PrimitiveCache< TruncatedConeProxy > m_truncatedConeCache
@ RENDER_PARTICLE_SYSTEMS
Render particle systems.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
@ RENDER_GEOMETRIES
Render collision geometries.
@ RENDER_GEOMETRY_CONTACTS
Render geometry contacts.
ParticleSystemProxyContainer m_particleSystems
virtual CylinderProxy * createCylinder(float radius, float height)=0
Interface for creating and returning a CylinderProxy.
Subclass that implements a TrimeshProxy.
void setEnable(bool flag)
float m_ContactsProxySize
agx::Vector< agx::ref_ptr< agxRender::RenderProxy > > RenderProxyRefContainer
PrimitiveCache< LineProxy > m_lineCache
@ RENDER_CONTACTS
Render all types of contacts.