AGX Dynamics  2.37.3.2
agxOSG::ContainerShapeBatchRenderer< ContainerType, TransformType > Class Template Reference

Class that handles batch rendering of objects in forward iterator compliant container. More...

#include <RenderProxy.h>

+ Inheritance diagram for agxOSG::ContainerShapeBatchRenderer< ContainerType, TransformType >:

Public Member Functions

 ContainerShapeBatchRenderer (osg::Geode *geode, const ContainerType *container, agxOSG::RenderProxyFactory *factory, agxRender::RenderProxy *proxy)
 Construct given shape composite and compatible container. More...
 
virtual ~ContainerShapeBatchRenderer ()
 Destructor. More...
 
void clear ()
 Reset container pointer and removes all child transforms. More...
 
void setContainer (const ContainerType *container)
 Assign compatible container. More...
 
void update (bool addScaleTransform=false)
 Updates transforms. More...
 
- Public Member Functions inherited from agxOSG::ShapeBatchRenderer< TransformType >
void clear ()
 Clear the root transform node from all child transforms. More...
 
float getScale () const
 
void setScale (float scale)
 Assign transform scale. More...
 

Protected Member Functions

agx::Vec3f findScale (const typename ContainerType::value_type &val) const
 Find scale (agx::Vec3) given container value type. More...
 
template<>
agx::Vec3f findScale (const agxRender::WireRenderProxy::SegmentDefContainer::value_type &val) const
 
agx::AffineMatrix4x4 findTransform (const typename ContainerType::value_type &val) const
 Find transform (agx::AffineMatrix4x4) given container value type. More...
 
template<>
agx::AffineMatrix4x4 findTransform (const agxCollide::GeometryContactPtrVector::value_type &) const
 
template<>
agx::AffineMatrix4x4 findTransform (const agx::RigidBodyPtrSetVector::value_type &rbRefPtr) const
 
template<>
agx::AffineMatrix4x4 findTransform (const agxRender::RigidBodyBatchRenderProxy::Container::value_type &rbPtr) const
 
template<>
agx::AffineMatrix4x4 findTransform (const agxData::Array< agx::Vec3 >::value_type &p) const
 
- Protected Member Functions inherited from agxOSG::ShapeBatchRenderer< TransformType >
 ShapeBatchRenderer (osg::Shape *shape, agxOSG::RenderProxyFactory *factory, agxRender::RenderProxy *proxy)
 Construct given single shape. More...
 
 ShapeBatchRenderer (osg::Geode *geode, agxOSG::RenderProxyFactory *factory, agxRender::RenderProxy *proxy)
 Construct given geode. More...
 
virtual ~ShapeBatchRenderer ()
 Destructor. More...
 
void prepare (size_t numObjects)
 Prepare the root transform with the current amount of child nodes. More...
 
void prepareWithScale (size_t numObjects)
 Including scale transform. More...
 
void setTransform (TransformType *obj, const agx::AffineMatrix4x4 &transform, const agx::Vec3f &scale)
 Assign transform (given agx type) to a supported osg transform. More...
 

Protected Attributes

const ContainerType * m_container
 
- Protected Attributes inherited from agxOSG::ShapeBatchRenderer< TransformType >
osg::ref_ptr< osg::Geode > m_geode
 
float m_scale
 

Detailed Description

template<typename ContainerType, typename TransformType>
class agxOSG::ContainerShapeBatchRenderer< ContainerType, TransformType >

Class that handles batch rendering of objects in forward iterator compliant container.

Default ContainerType::value_type& val -> val->getTransform() is used (i.e., typically reference counted or observers to objects with method getTransform()). Template specialization has to be implemented to handle other types... at all.

E.g., for ContainerType = agxCollide::GeometryContactPtrVector: void findTransform( const agxCollide::GeometryContactPtrVector::value_type& ) has to be implemented.

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

Constructor & Destructor Documentation

◆ ContainerShapeBatchRenderer()

template<typename ContainerType, typename TransformType>
agxOSG::ContainerShapeBatchRenderer< ContainerType, TransformType >::ContainerShapeBatchRenderer ( osg::Geode *  geode,
const ContainerType *  container,
agxOSG::RenderProxyFactory *  factory,
agxRender::RenderProxy *  proxy 
)
inline

Construct given shape composite and compatible container.

Parameters
geode- geode with one or many shapes
container- compatible container
factory- render proxy factory
proxy- render proxy

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

◆ ~ContainerShapeBatchRenderer()

template<typename ContainerType, typename TransformType>
virtual agxOSG::ContainerShapeBatchRenderer< ContainerType, TransformType >::~ContainerShapeBatchRenderer ( )
inlinevirtual

Destructor.

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

References agxTerrain::Profiler::clear().

Member Function Documentation

◆ clear()

template<typename ContainerType , typename TransformType >
void agxOSG::ContainerShapeBatchRenderer< ContainerType, TransformType >::clear ( )

Reset container pointer and removes all child transforms.

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

References agxTerrain::Profiler::clear().

◆ findScale() [1/2]

template<typename ContainerType, typename TransformType >
agx::Vec3f agxOSG::ContainerShapeBatchRenderer< ContainerType, TransformType >::findScale ( const typename ContainerType::value_type &  val) const
protected

Find scale (agx::Vec3) given container value type.

Default assigned scale returned.

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

◆ findScale() [2/2]

◆ findTransform() [1/5]

template<typename ContainerType, typename TransformType >
agx::AffineMatrix4x4 agxOSG::ContainerShapeBatchRenderer< ContainerType, TransformType >::findTransform ( const typename ContainerType::value_type &  val) const
protected

Find transform (agx::AffineMatrix4x4) given container value type.

Parameters
val- container value
Returns
current transform

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

◆ findTransform() [2/5]

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

◆ findTransform() [3/5]

template<>
agx::AffineMatrix4x4 agxOSG::ContainerShapeBatchRenderer< agx::RigidBodyPtrSetVector, osg::AutoTransform >::findTransform ( const agx::RigidBodyPtrSetVector::value_type &  rbRefPtr) const
inlineprotected

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

◆ findTransform() [4/5]

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

◆ findTransform() [5/5]

template<>
agx::AffineMatrix4x4 agxOSG::ContainerShapeBatchRenderer< agxData::Array< agx::Vec3 >, osg::MatrixTransform >::findTransform ( const agxData::Array< agx::Vec3 >::value_type &  p) const
inlineprotected

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

References agx::AffineMatrix4x4T< Real >::translate().

◆ setContainer()

template<typename ContainerType, typename TransformType >
void agxOSG::ContainerShapeBatchRenderer< ContainerType, TransformType >::setContainer ( const ContainerType *  container)

Assign compatible container.

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

◆ update()

template<typename ContainerType , typename TransformType >
void agxOSG::ContainerShapeBatchRenderer< ContainerType, TransformType >::update ( bool  addScaleTransform = false)

Updates transforms.

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

References agxAssert, and agxData::transform().

Member Data Documentation

◆ m_container

template<typename ContainerType, typename TransformType>
const ContainerType* agxOSG::ContainerShapeBatchRenderer< ContainerType, TransformType >::m_container
protected

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


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