AGX Dynamics  2.37.2.0
agxOSG::RenderProxyFactory Class Reference

Implementation of the abstract class from the agxRender namespace, this class is responsible for creating RenderProxy of various types and render them as efficiently as possible in OpenSceneGraph. More...

#include <RenderProxy.h>

+ Inheritance diagram for agxOSG::RenderProxyFactory:

Classes

struct  ShapeData
 Class for storing OSG specific data for each RenderProxy. More...
 

Public Member Functions

 RenderProxyFactory ()
 
void addChild (osg::Node *node, agxRender::RenderProxy::RenderMode mode)
 Add a child to the root, default getDefaultRenderMode() will be used for determining if the node should go into wireframe and or solid parent. More...
 
void addChild (osg::Node *node, agxRender::RenderProxy *proxy)
 
agxRender::BoxProxy * createBox (const agx::Vec3 &halfExtents) override
 
agxRender::CapsuleProxy * createCapsule (float radius, float height) override
 
agxRender::ConeProxy * createCone (float radius, float height) override
 
agxRender::ContactsProxy * createContacts (const agxCollide::GeometryContactPtrVector &contacts) override
 
agxRender::CylinderProxy * createCylinder (float radius, float height) override
 
agxRender::HeightFieldProxy * createHeightfield (agxCollide::HeightField *hf) override
 Create and return a RenderProxy for a Heightfield. More...
 
agxRender::HollowCylinderProxy * createHollowCylinder (float radius, float height, float thickness) override
 
agxRender::HollowTruncatedConeProxy * createHollowTruncatedCone (float topRadius, float bottomRadius, float height, float thickness) override
 
agxRender::LineProxy * createLine (const agx::Vec3 &p1, const agx::Vec3 &p2) override
 
agxRender::PlaneProxy * createPlane (const agx::Vec3 &normal, agx::Real distance) override
 
agxRender::RigidBodyBatchRenderProxy * createRigidBodies (const agx::RigidBodyPtrSetVector *enabledBodies) override
 Interface for creating and returning batch rendering of rigid bodies (cm). More...
 
agxRender::SphereProxy * createSphere (float radius) override
 
agxRender::RenderProxy * createSphereBatchRenderer (agxData::Buffer *positions, agxData::Buffer *rotations, agxData::Buffer *radii, agxData::Buffer *colors, agxData::Buffer *enableRendering, agxData::Value *bound, agx::Component *context) override
 
agxRender::TextProxy * createText (const agx::String &text, const agx::Vec3 &pos) override
 
agxRender::TrimeshProxy * createTrimesh (agxCollide::Trimesh *mesh) override
 Create and return a RenderProxy for a Trimesh. More...
 
agxRender::TruncatedConeProxy * createTruncatedCone (float topRadius, float bottomRadius, float height) override
 
agxRender::WireRenderProxy * createWire (float radius, const agx::Vec3 &color) override
 
agxRender::WireShapeProxy * createWireShape (float radius, float height, const agx::Vec3 &previousEndPoint0, const agx::Vec3 &previousEndPoint1) override
 
const agx::AffineMatrix4x4 & getGlobalTransform () const
 
agxRender::Graph::GraphRenderer * getGraphRenderer () override
 
osg::Node * getRootNode ()
 
osg::Group * getSolidRootNode ()
 
osg::Group * getTextNode ()
 The text node is not child of the node returned in getRootNode(), hence this node MUST be added separately. More...
 
osg::Group * getWireframeRootNode ()
 
void setGlobalTransform (const agx::AffineMatrix4x4 &m)
 Set a transformation which will be applied to all transformations for RenderProxy's. More...
 
void setRenderMode (agxRender::RenderProxy *proxy, osg::Node *node, agxRender::RenderProxy::RenderMode mode)
 Set the RenderMode for a specified node. More...
 
void setSphereBatchRenderModeSprites (bool flag)
 
- Public Member Functions inherited from agxRender::RenderProxyFactory
 RenderProxyFactory ()
 
SphereProxy * create (float radius)
 Create a SphereProxy without arguments. More...
 
BoxProxy * create (const agx::Vec3 &halfExtents)
 Create a BoxProxy without arguments. More...
 
LineProxy * create (const LineProxy *)
 Create a LineProxy without arguments. More...
 
CylinderProxy * create (const CylinderProxy *)
 Create a CylinderProxy without arguments. More...
 
HollowCylinderProxy * create (const HollowCylinderProxy *)
 Create a CylinderProxy without arguments. More...
 
ConeProxy * create (const ConeProxy *)
 Create a ConeProxy without arguments. More...
 
TruncatedConeProxy * create (const TruncatedConeProxy *)
 Create a TruncatedConeProxy without arguments. More...
 
HollowTruncatedConeProxy * create (const HollowTruncatedConeProxy *)
 Create a HollowTruncatedConeProxy without arguments. More...
 
CapsuleProxy * create (const CapsuleProxy *)
 Create a CapsuleProxy without arguments. More...
 
TextProxy * create (const TextProxy *)
 Create a TextProxy without arguments. More...
 
PlaneProxy * create (const PlaneProxy *)
 Create a PlaneProxy without arguments. More...
 
ContactsProxy * create (const agxCollide::GeometryContactPtrVector &contacts)
 Create a ContactsProxy without arguments. More...
 
RigidBodyBatchRenderProxy * create (const agx::RigidBodyPtrSetVector *enabledBodies)
 Create a rigid body batch render proxy. More...
 
RenderProxy::RenderMode getDefaultRenderMode () const
 
bool getEnable () const
 
void setDefaultRenderMode (RenderProxy::RenderMode mode)
 Set the default RenderMode that will be used when a new RenderProxy is created. More...
 
void setEnable (bool flag)
 
- 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...
 

Static Public Member Functions

static float getDefaultDetailRatio ()
 
static void setDefaultDetailRatio (float detailRatio)
 Assign new default detail ratio for the rendered geometries. More...
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 

Protected Member Functions

virtual ~RenderProxyFactory ()
 Destructor. More...
 
- Protected Member Functions inherited from agxRender::RenderProxyFactory
void setRenderManager (RenderManager *mgr)
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor. More...
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Protected Attributes

agx::ref_ptr< agxOSG::GraphRenderer > m_graphRenderer
 
agx::AffineMatrix4x4 m_invTransform
 
osg::ref_ptr< osg::MatrixTransform > m_parent
 
osg::ref_ptr< osg::Group > m_solidParent
 
bool m_sphereBatchRenderModeSprites
 
osg::ref_ptr< osg::Group > m_textParent
 
osg::ref_ptr< osg::Group > m_wireframeParent
 
- Protected Attributes inherited from agxRender::RenderProxyFactory
RenderProxy::RenderMode m_defaultRenderMode
 
bool m_enabled
 
RenderManager * m_mgr
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Additional Inherited Members

- 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...
 

Detailed Description

Implementation of the abstract class from the agxRender namespace, this class is responsible for creating RenderProxy of various types and render them as efficiently as possible in OpenSceneGraph.

There are several node-roots:

Definition at line 74 of file agxOSG/RenderProxy.h.

Constructor & Destructor Documentation

◆ RenderProxyFactory()

agxOSG::RenderProxyFactory::RenderProxyFactory ( )

◆ ~RenderProxyFactory()

virtual agxOSG::RenderProxyFactory::~RenderProxyFactory ( )
protectedvirtual

Destructor.

Reimplemented from agxRender::RenderProxyFactory.

Member Function Documentation

◆ addChild() [1/2]

void agxOSG::RenderProxyFactory::addChild ( osg::Node *  node,
agxRender::RenderProxy::RenderMode  mode 
)

Add a child to the root, default getDefaultRenderMode() will be used for determining if the node should go into wireframe and or solid parent.

◆ addChild() [2/2]

void agxOSG::RenderProxyFactory::addChild ( osg::Node *  node,
agxRender::RenderProxy *  proxy 
)

◆ createBox()

agxRender::BoxProxy* agxOSG::RenderProxyFactory::createBox ( const agx::Vec3 &  halfExtents)
overridevirtual
Parameters
halfExtents- The size of the box
Returns
a pointer to a new BoxProxy with specified size

Implements agxRender::RenderProxyFactory.

◆ createCapsule()

agxRender::CapsuleProxy* agxOSG::RenderProxyFactory::createCapsule ( float  radius,
float  height 
)
overridevirtual
Parameters
radius- The radius of a capsule
height- The height of a capsule
Returns
a pointer to a new CapsuleProxy

Implements agxRender::RenderProxyFactory.

◆ createCone()

agxRender::ConeProxy* agxOSG::RenderProxyFactory::createCone ( float  radius,
float  height 
)
overridevirtual
Parameters
radius- The radius of the cone
height- The height of the cone
Returns
a pointer to a new ConeProxy

Implements agxRender::RenderProxyFactory.

◆ createContacts()

agxRender::ContactsProxy* agxOSG::RenderProxyFactory::createContacts ( const agxCollide::GeometryContactPtrVector &  contacts)
overridevirtual
Parameters
contacts- Vector with all contacts that should be visualized
Returns
a pointer to a new ContactsProxy

Implements agxRender::RenderProxyFactory.

◆ createCylinder()

agxRender::CylinderProxy* agxOSG::RenderProxyFactory::createCylinder ( float  radius,
float  height 
)
overridevirtual
Parameters
radius- The radius of a cylinder
height- The height of a cylinder
Returns
a pointer to a new CylinderProxy

Implements agxRender::RenderProxyFactory.

◆ createHeightfield()

agxRender::HeightFieldProxy* agxOSG::RenderProxyFactory::createHeightfield ( agxCollide::HeightField *  hf)
overridevirtual

Create and return a RenderProxy for a Heightfield.

Parameters
hf- The heightfield for which a HeightfieldProxy will be created.

Implements agxRender::RenderProxyFactory.

◆ createHollowCylinder()

agxRender::HollowCylinderProxy* agxOSG::RenderProxyFactory::createHollowCylinder ( float  radius,
float  height,
float  thickness 
)
overridevirtual
Parameters
radius- The radius for the a cylinder
height- The height for the cylinder
thickness- The thickness for the cylinder

Implements agxRender::RenderProxyFactory.

◆ createHollowTruncatedCone()

agxRender::HollowTruncatedConeProxy* agxOSG::RenderProxyFactory::createHollowTruncatedCone ( float  topRadius,
float  bottomRadius,
float  height,
float  thickness 
)
overridevirtual
Parameters
topRadius- The top radius of the cone
bottomRadius- The bottom radius of the cone
height- The height of the cone
thickness- The thickness of the cone

Implements agxRender::RenderProxyFactory.

◆ createLine()

agxRender::LineProxy* agxOSG::RenderProxyFactory::createLine ( const agx::Vec3 &  p1,
const agx::Vec3 &  p2 
)
overridevirtual
Parameters
p1,p2- Start, end points in WORLD coordinate system
Returns
a pointer to a new LineProxy

Implements agxRender::RenderProxyFactory.

◆ createPlane()

agxRender::PlaneProxy* agxOSG::RenderProxyFactory::createPlane ( const agx::Vec3 &  normal,
agx::Real  distance 
)
overridevirtual
Parameters
normal- The normal of a plane
distance- The scalar part of the plane
Returns
a pointer to a new PlaneProxy

Implements agxRender::RenderProxyFactory.

◆ createRigidBodies()

agxRender::RigidBodyBatchRenderProxy* agxOSG::RenderProxyFactory::createRigidBodies ( const agx::RigidBodyPtrSetVector *  )
overridevirtual

Interface for creating and returning batch rendering of rigid bodies (cm).

Implements agxRender::RenderProxyFactory.

◆ createSphere()

agxRender::SphereProxy* agxOSG::RenderProxyFactory::createSphere ( float  radius)
overridevirtual
Parameters
radius- The radius of the new sphere
Returns
a pointer to a new SphereProxy with specified radius

Implements agxRender::RenderProxyFactory.

◆ createSphereBatchRenderer()

agxRender::RenderProxy* agxOSG::RenderProxyFactory::createSphereBatchRenderer ( agxData::Buffer *  positions,
agxData::Buffer *  rotations,
agxData::Buffer *  radii,
agxData::Buffer *  colors,
agxData::Buffer *  enableRendering,
agxData::Value *  bound,
agx::Component *  context 
)
overridevirtual

◆ createText()

agxRender::TextProxy* agxOSG::RenderProxyFactory::createText ( const agx::String &  text,
const agx::Vec3 &  pos 
)
overridevirtual
Parameters
text- The text
pos- Position of the text. Currently only x,y is used.
Returns
a pointer to a new TextProxy

Implements agxRender::RenderProxyFactory.

◆ createTrimesh()

agxRender::TrimeshProxy* agxOSG::RenderProxyFactory::createTrimesh ( agxCollide::Trimesh *  mesh)
overridevirtual

Create and return a RenderProxy for a Trimesh.

Parameters
mesh- The mesh shape for which a TrimeshProxy will be created.

Implements agxRender::RenderProxyFactory.

◆ createTruncatedCone()

agxRender::TruncatedConeProxy* agxOSG::RenderProxyFactory::createTruncatedCone ( float  topRadius,
float  bottomRadius,
float  height 
)
overridevirtual
Parameters
topRadius- The top radius of the cone
bottomRadius- The bottom radius of the cone
height- The height of the cone
Returns
a pointer to a new ConeProxy

Implements agxRender::RenderProxyFactory.

◆ createWire()

agxRender::WireRenderProxy* agxOSG::RenderProxyFactory::createWire ( float  radius,
const agx::Vec3 &  color 
)
overridevirtual

◆ createWireShape()

agxRender::WireShapeProxy* agxOSG::RenderProxyFactory::createWireShape ( float  radius,
float  height,
const agx::Vec3 &  previousEndPoint0,
const agx::Vec3 &  previousEndPoint1 
)
overridevirtual
Parameters
radius- The radius of a capsule
height- The height of a capsule
previousEndPoint0- The previous lower end point of the WireShape.
previousEndPoint1- The previous upper end point of the WireShape.
Returns
a pointer to a new WireShapeProxy

Implements agxRender::RenderProxyFactory.

◆ getDefaultDetailRatio()

static float agxOSG::RenderProxyFactory::getDefaultDetailRatio ( )
static
Returns
the currently used detail ratio

◆ getGlobalTransform()

const agx::AffineMatrix4x4& agxOSG::RenderProxyFactory::getGlobalTransform ( ) const
inline
Returns
the current global transformation

Definition at line 248 of file agxOSG/RenderProxy.h.

◆ getGraphRenderer()

agxRender::Graph::GraphRenderer* agxOSG::RenderProxyFactory::getGraphRenderer ( )
overridevirtual
Returns
the implementation of a GraphRenderer for osg.

Implements agxRender::RenderProxyFactory.

◆ getRootNode()

osg::Node* agxOSG::RenderProxyFactory::getRootNode ( )
inline
Returns
the node under which the solid and wire frame nodes lies.

Definition at line 224 of file agxOSG/RenderProxy.h.

◆ getSolidRootNode()

osg::Group* agxOSG::RenderProxyFactory::getSolidRootNode ( )
inline
Returns
the parent of all solid renderable objects

Definition at line 229 of file agxOSG/RenderProxy.h.

◆ getTextNode()

osg::Group* agxOSG::RenderProxyFactory::getTextNode ( )
inline

The text node is not child of the node returned in getRootNode(), hence this node MUST be added separately.

Returns
the node under which all the Text element will go

Definition at line 218 of file agxOSG/RenderProxy.h.

◆ getWireframeRootNode()

osg::Group* agxOSG::RenderProxyFactory::getWireframeRootNode ( )
inline
Returns
the parent of all wireframe renderable objects

Definition at line 234 of file agxOSG/RenderProxy.h.

◆ setDefaultDetailRatio()

static void agxOSG::RenderProxyFactory::setDefaultDetailRatio ( float  detailRatio)
static

Assign new default detail ratio for the rendered geometries.

◆ setGlobalTransform()

void agxOSG::RenderProxyFactory::setGlobalTransform ( const agx::AffineMatrix4x4 &  m)

Set a transformation which will be applied to all transformations for RenderProxy's.

This can be used to transform all objects to the center of the earth instead of trying to render on the surface of the earth (6000km). This transform is by default I. If you for example do m.setTranslate(-10,0,0) all RenderProxy's will be rendered translated -10 units in X. If a RenderManager is present, RenderManager::update() will be called

◆ setRenderMode()

void agxOSG::RenderProxyFactory::setRenderMode ( agxRender::RenderProxy *  proxy,
osg::Node *  node,
agxRender::RenderProxy::RenderMode  mode 
)

Set the RenderMode for a specified node.

◆ setSphereBatchRenderModeSprites()

void agxOSG::RenderProxyFactory::setSphereBatchRenderModeSprites ( bool  flag)

Member Data Documentation

◆ m_graphRenderer

agx::ref_ptr<agxOSG::GraphRenderer> agxOSG::RenderProxyFactory::m_graphRenderer
protected

Definition at line 290 of file agxOSG/RenderProxy.h.

◆ m_invTransform

agx::AffineMatrix4x4 agxOSG::RenderProxyFactory::m_invTransform
protected

Definition at line 291 of file agxOSG/RenderProxy.h.

◆ m_parent

osg::ref_ptr<osg::MatrixTransform> agxOSG::RenderProxyFactory::m_parent
protected

Definition at line 288 of file agxOSG/RenderProxy.h.

◆ m_solidParent

osg::ref_ptr<osg::Group> agxOSG::RenderProxyFactory::m_solidParent
protected

Definition at line 286 of file agxOSG/RenderProxy.h.

◆ m_sphereBatchRenderModeSprites

bool agxOSG::RenderProxyFactory::m_sphereBatchRenderModeSprites
protected

Definition at line 292 of file agxOSG/RenderProxy.h.

◆ m_textParent

osg::ref_ptr<osg::Group> agxOSG::RenderProxyFactory::m_textParent
protected

Definition at line 289 of file agxOSG/RenderProxy.h.

◆ m_wireframeParent

osg::ref_ptr<osg::Group> agxOSG::RenderProxyFactory::m_wireframeParent
protected

Definition at line 287 of file agxOSG/RenderProxy.h.


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