AGX Dynamics  2.35.0.1
agxRender::RenderProxy Class Reference

Abstract base class which encapsulated information for rendering a specific shape. More...

#include <RenderProxy.h>

+ Inheritance diagram for agxRender::RenderProxy:

Public Types

enum  EventType {
  ENABLE , TRANSFORM , ALPHA , COLOR ,
  SHAPE , REMOVE , RENDERMODE
}
 Enum for specifying a type of event which might change a RenderProxy. More...
 
enum  RenderMode { NOT_SET = 0x0 , SOLID = 0x1 , WIREFRAME = 0x2 }
 

Public Member Functions

 RenderProxy (PrimitiveType type, agxCollide::Shape *shape=nullptr)
 Constructor. More...
 
void callOnChange (EventType type)
 Explicitly fires event of type. More...
 
bool compare () const
 Compare the modified count with its associated shape. More...
 
virtual float getAlpha () const
 
virtual agx::Vec3 getColor () const
 
bool getEnable () const
 
const agxCollide::Geometry * getGeometry () const
 
agx::UInt32 getModifiedCount () const
 This value tells us that if the proxy is synchronized with the associated shape. More...
 
RenderMode getRenderMode () const
 
const agxCollide::Shape * getShape () const
 
const agx::AffineMatrix4x4 & getTransform () const
 
PrimitiveType getType () const
 
bool isEnabled () const
 
virtual void reset ()
 Will reset color, alpha and enabled state back to default state (as when initially created). More...
 
virtual void setAlpha (float alpha)
 Set the alpha value of this proxy. More...
 
virtual void setColor (const agx::Vec3 &color)
 Set the color of this proxy. More...
 
void setEnable (bool flag)
 Toggle this proxy for rendering on/off. More...
 
void setRenderMode (RenderMode mode)
 Set the render mode for this Proxy. More...
 
virtual void setTransform (const agx::AffineMatrix4x4 &transform)
 Set the transform of this RenderProxy, if overridden, set the m_transform and call onUpdate(TRANSFORM) More...
 
virtual void updateShape ()
 Called when a Shape has been changed (for example radius on a sphere is changed). More...
 
- 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 agx::Bool shouldRender (const agx::RigidBody *rb)
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 

Protected Member Functions

virtual ~RenderProxy ()
 Destructor. More...
 
virtual void onChange (EventType)
 Pure virtual method that should response on the different events. More...
 
void setModifiedCount (agx::UInt32 c)
 
void setShape (agxCollide::Shape *shape, const agxCollide::Geometry *geometry)
 Set the shape for this proxy. More...
 
virtual void synchronizeParameters ()
 This method should be implemented so that it extracts size parameters from an associated shape and store it in the Proxy parameters (radius/length etc). More...
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor. More...
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Protected Attributes

agx::observer_ptr< agxCollide::Shape > m_shape
 
agx::AffineMatrix4x4 m_transform
 
- 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

Abstract base class which encapsulated information for rendering a specific shape.

Definition at line 76 of file agxRender/RenderProxy.h.

Member Enumeration Documentation

◆ EventType

Enum for specifying a type of event which might change a RenderProxy.

Enumerator
ENABLE 

A RenderProxy is enabled/disabled.

TRANSFORM 

The transformation for a proxy is updated.

ALPHA 

The alpha value for a proxy is updated.

COLOR 

The color value for a proxy is updated.

SHAPE 

The Shape has been modified a rebuild is needed.

REMOVE 

The Shape has been removed from space, need to be removed from rendering.

RENDERMODE 

The RenderMode has been changed.

Definition at line 81 of file agxRender/RenderProxy.h.

◆ RenderMode

Enumerator
NOT_SET 
SOLID 
WIREFRAME 

Definition at line 91 of file agxRender/RenderProxy.h.

Constructor & Destructor Documentation

◆ RenderProxy()

agxRender::RenderProxy::RenderProxy ( PrimitiveType  type,
agxCollide::Shape *  shape = nullptr 
)

Constructor.

◆ ~RenderProxy()

virtual agxRender::RenderProxy::~RenderProxy ( )
protectedvirtual

Destructor.

Member Function Documentation

◆ callOnChange()

void agxRender::RenderProxy::callOnChange ( EventType  type)

Explicitly fires event of type.

Parameters
type- type of event to fire to this render proxy

Referenced by setAlpha(), setColor(), setEnable(), setRenderMode(), and setTransform().

◆ compare()

bool agxRender::RenderProxy::compare ( ) const

Compare the modified count with its associated shape.

◆ getAlpha()

float agxRender::RenderProxy::getAlpha ( ) const
inlinevirtual
Returns
the current alpha value for this proxy

Definition at line 1001 of file agxRender/RenderProxy.h.

◆ getColor()

agx::Vec3 agxRender::RenderProxy::getColor ( ) const
inlinevirtual
Returns
the current color

Definition at line 989 of file agxRender/RenderProxy.h.

◆ getEnable()

bool agxRender::RenderProxy::getEnable ( ) const
inline
Returns
true if this proxy is enabled

Definition at line 1036 of file agxRender/RenderProxy.h.

◆ getGeometry()

const agxCollide::Geometry * agxRender::RenderProxy::getGeometry ( ) const
inline

Definition at line 1024 of file agxRender/RenderProxy.h.

◆ getModifiedCount()

agx::UInt32 agxRender::RenderProxy::getModifiedCount ( ) const
inline

This value tells us that if the proxy is synchronized with the associated shape.

When a shape change any of its attributes, it will increment its own number. If it does not match this, it will trigger onChange(SHAPE).

Returns
the current modified count for this Proxy.

Definition at line 1009 of file agxRender/RenderProxy.h.

Referenced by agxRender::HeightFieldProxy::setHeights().

◆ getRenderMode()

RenderProxy::RenderMode agxRender::RenderProxy::getRenderMode ( ) const
inline
Returns
the current render mode for this Proxy

Definition at line 1047 of file agxRender/RenderProxy.h.

◆ getShape()

const agxCollide::Shape * agxRender::RenderProxy::getShape ( ) const
inline

Definition at line 1020 of file agxRender/RenderProxy.h.

References m_shape.

Referenced by agxRender::HeightFieldProxy::setHeights().

◆ getTransform()

const agx::AffineMatrix4x4 & agxRender::RenderProxy::getTransform ( ) const
inline
Returns
the current transform for this proxy

Definition at line 978 of file agxRender/RenderProxy.h.

References m_transform.

◆ getType()

PrimitiveType agxRender::RenderProxy::getType ( ) const
inline
Returns
the type of this RenderProxy

Definition at line 972 of file agxRender/RenderProxy.h.

◆ isEnabled()

bool agxRender::RenderProxy::isEnabled ( ) const
inline
Returns
true if this proxy is enabled

Definition at line 165 of file agxRender/RenderProxy.h.

◆ onChange()

virtual void agxRender::RenderProxy::onChange ( EventType  )
inlineprotectedvirtual

Pure virtual method that should response on the different events.

This method is (indirectly via callOnChange) called from most set* methods. Should really never be called direct from anywhere else but from callOnChange.

Definition at line 195 of file agxRender/RenderProxy.h.

◆ reset()

virtual void agxRender::RenderProxy::reset ( )
virtual

Will reset color, alpha and enabled state back to default state (as when initially created).

Reimplemented in agxOSG::WireRenderProxy, agxOSG::ContactProxy, and agxOSG::RigidBodyBatchRenderProxy< ContainerType, TransformType >.

◆ setAlpha()

void agxRender::RenderProxy::setAlpha ( float  alpha)
inlinevirtual

Set the alpha value of this proxy.

If overridden, store color in m_alpha and call onUpdate(ALPHA)

Definition at line 993 of file agxRender/RenderProxy.h.

References ALPHA, callOnChange(), and agx::equivalent().

◆ setColor()

void agxRender::RenderProxy::setColor ( const agx::Vec3 &  color)
inlinevirtual

Set the color of this proxy.

If overridden, store color in m_color and call onUpdate(COLOR)

Definition at line 982 of file agxRender/RenderProxy.h.

References callOnChange(), COLOR, and agx::equivalent().

◆ setEnable()

void agxRender::RenderProxy::setEnable ( bool  flag)
inline

Toggle this proxy for rendering on/off.

Will trigger onUpdate(ENABLE)

Definition at line 1028 of file agxRender/RenderProxy.h.

References callOnChange(), and ENABLE.

◆ setModifiedCount()

void agxRender::RenderProxy::setModifiedCount ( agx::UInt32  c)
inlineprotected

Definition at line 1005 of file agxRender/RenderProxy.h.

Referenced by agxRender::HeightFieldProxy::setHeights(), and setShape().

◆ setRenderMode()

void agxRender::RenderProxy::setRenderMode ( RenderProxy::RenderMode  mode)
inline

Set the render mode for this Proxy.

Will trigger onUpdate(RENDERMODE)

Definition at line 1040 of file agxRender/RenderProxy.h.

References callOnChange(), and RENDERMODE.

◆ setShape()

void agxRender::RenderProxy::setShape ( agxCollide::Shape *  shape,
const agxCollide::Geometry *  geometry 
)
inlineprotected

Set the shape for this proxy.

Definition at line 1013 of file agxRender/RenderProxy.h.

References m_shape, and setModifiedCount().

◆ setTransform()

void agxRender::RenderProxy::setTransform ( const agx::AffineMatrix4x4 &  transform)
inlinevirtual

Set the transform of this RenderProxy, if overridden, set the m_transform and call onUpdate(TRANSFORM)

Reimplemented in agxOSG::TextProxy.

Definition at line 974 of file agxRender/RenderProxy.h.

References callOnChange(), m_transform, agxData::transform(), and TRANSFORM.

Referenced by agxOSG::RigidBodyBatchRenderProxy< ContainerType, TransformType >::ADD_COMMON_METHODS().

◆ shouldRender()

static agx::Bool agxRender::RenderProxy::shouldRender ( const agx::RigidBody *  rb)
static
Returns
true if the rigid body should be rendered - otherwise false

Referenced by agxRender::RigidBodyBatchRenderProxy::set().

◆ synchronizeParameters()

virtual void agxRender::RenderProxy::synchronizeParameters ( )
inlineprotectedvirtual

This method should be implemented so that it extracts size parameters from an associated shape and store it in the Proxy parameters (radius/length etc).

Reimplemented in agxRender::BoxProxy, agxRender::WireShapeProxy, agxRender::CapsuleProxy, agxRender::HollowTruncatedConeProxy, agxRender::TruncatedConeProxy, agxRender::ConeProxy, agxRender::HollowCylinderProxy, agxRender::CylinderProxy, agxRender::LineProxy, agxRender::SphereProxy, and agxRender::PlaneProxy.

Definition at line 188 of file agxRender/RenderProxy.h.

◆ updateShape()

virtual void agxRender::RenderProxy::updateShape ( )
inlinevirtual

Called when a Shape has been changed (for example radius on a sphere is changed).

Definition at line 128 of file agxRender/RenderProxy.h.

Member Data Documentation

◆ m_shape

agx::observer_ptr<agxCollide::Shape> agxRender::RenderProxy::m_shape
protected

Definition at line 205 of file agxRender/RenderProxy.h.

Referenced by getShape(), and setShape().

◆ m_transform

agx::AffineMatrix4x4 agxRender::RenderProxy::m_transform
protected

Definition at line 206 of file agxRender/RenderProxy.h.

Referenced by getTransform(), and setTransform().


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