AGXDynamics  2.31.1.0
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...
 
float getScale () const
 
void setContainer (const ContainerType *container)
 Assign compatible container. More...
 
void setScale (float scale)
 Assign transform scale. More...
 
void update (bool addScaleTransform=false)
 Updates transforms. 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
 
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
 
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().

◆ getScale()

template<typename TransformType >
float agxOSG::ShapeBatchRenderer< TransformType >::getScale ( ) const
inherited

◆ prepare()

template<typename TransformType>
void agxOSG::ShapeBatchRenderer< TransformType >::prepare ( size_t  numObjects)
protectedinherited

Prepare the root transform with the current amount of child nodes.

Parameters
numObjects- number of child transforms

◆ prepareWithScale()

template<typename TransformType>
void agxOSG::ShapeBatchRenderer< TransformType >::prepareWithScale ( size_t  numObjects)
protectedinherited

Including scale transform.

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

◆ setScale()

template<typename TransformType >
void agxOSG::ShapeBatchRenderer< TransformType >::setScale ( float  scale)
inherited

Assign transform scale.

Default: 1.

Parameters
scale- new scale

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

◆ setTransform()

template<typename TransformType>
void agxOSG::ShapeBatchRenderer< TransformType >::setTransform ( TransformType *  obj,
const agx::AffineMatrix4x4 &  transform,
const agx::Vec3f &  scale 
)
protectedinherited

Assign transform (given agx type) to a supported osg transform.

Parameters
obj- transform object to be assigned
transform- transform to a assign
scale- scale factor

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

◆ m_geode

template<typename TransformType>
osg::ref_ptr< osg::Geode > agxOSG::ShapeBatchRenderer< TransformType >::m_geode
protectedinherited

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

◆ m_scale

template<typename TransformType>
float agxOSG::ShapeBatchRenderer< TransformType >::m_scale
protectedinherited

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


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