AGXDynamics  2.31.1.0
agxCollide::RenderData Class Reference

Class for storing rendering information for a Shape. More...

#include <RenderData.h>

+ Inheritance diagram for agxCollide::RenderData:

Public Types

enum  Mode { TRIANGLES =4 }
 Specifies which type of primitive this render data represents. More...
 
enum  StateInfo { STANDARD =0x0, NO_RENDER =0x1 }
 

Public Member Functions

 RenderData ()
 Constructor. More...
 
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
 
RenderData * clone () const
 Returns an exact copy of the render data as a new object. More...
 
const char * getClassName () const override
 
const agx::Vec4Vector & getColorArray () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object. More...
 
const agx::UInt32Vector & getIndexArray () const
 
Mode getMode () const
 
const agx::Vec3Vector & getNormalArray () const
 
int getReferenceCount () const
 
agxCollide::RenderMaterial * getRenderMaterial () const
 
bool getShouldRender () const
 
agxStream::StorageAgent * getStorageAgent () const override
 
const agx::Vec2Vector & getTexCoordArray () const
 
agx::Uuid getUuid () const
 
const agx::Vec3Vector & getVertexArray () const
 
bool hasRenderMaterial () const
 
template<typename T >
bool is () const
 Subclass test. More...
 
bool isFinished () const
 
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...
 
virtual void restore (agxStream::InputArchive &in) override
 
void setColorArray (const agx::Vec4Vector &color)
 Set and copy the colors. More...
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object. More...
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive. More...
 
void setIndexArray (const agx::UInt32Vector &indices, Mode mode)
 Set (and copy) the indices. More...
 
void setNormalArray (const agx::Vec3Vector &normals)
 Set (and copy) the normals. More...
 
void setRenderMaterial (agxCollide::RenderMaterial *renderMaterial)
 Set the renderMaterial of this RenderData. More...
 
void setShouldRender (bool shouldRender)
 Set if the data stored should be rendered at all. More...
 
void setTexCoordArray (const agx::Vec2Vector &texCoords)
 Set (and copy) the texture coordinates. More...
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object. More...
 
void setVertexArray (const agx::Vec3Vector &vertices)
 Set (and copy) the vertices. More...
 
virtual void store (agxStream::OutputArchive &out) const override
 
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 agxStream::Serializable * create ()
 
static agxStream::Serializable * create (agxStream::InputArchive &)
 
static const char * getConstructClassId ()
 
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled. More...
 
template<typename T >
static bool ValidateCast (const Referenced *object)
 

Protected Member Functions

virtual ~RenderData ()
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
void generateUuid ()
 

Static Protected Member Functions

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

Protected Attributes

agx::UInt32Vector m_indices
 
Mode m_mode
 
Mutex m_mutex
 
agx::Vec3Vector m_normals
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 
agxCollide::RenderMaterialRef m_renderMaterial
 
agx::UInt32 m_renderState
 
agx::Vec2Vector m_texCoords
 
agx::Vec4Vector m_vertexColor
 
agx::Vec3Vector m_vertices
 

Detailed Description

Class for storing rendering information for a Shape.

This data can later be accessed by a rendering engine. You can also derive from this class and implement your own containing more relevant information for your specific needs, such as textures, multitexcoords, shaders etc. Just make sure you implement the store/restore method too.

Definition at line 39 of file RenderData.h.

Member Enumeration Documentation

◆ Mode

Specifies which type of primitive this render data represents.

Enumerator
TRIANGLES 

Definition at line 44 of file RenderData.h.

◆ StateInfo

Enumerator
STANDARD 
NO_RENDER 

Definition at line 58 of file RenderData.h.

Constructor & Destructor Documentation

◆ RenderData()

agxCollide::RenderData::RenderData ( )

Constructor.

◆ ~RenderData()

virtual agxCollide::RenderData::~RenderData ( )
protectedvirtual

Member Function Documentation

◆ allocateObserverVector()

void agx::Referenced::allocateObserverVector ( ) const
protectedinherited

◆ as() [1/2]

template<typename T >
T* agx::Referenced::as ( )
inherited

Subclass casting.

Template type must match actual type, dynamic_cast assertion will fail otherwise.

Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), agx::InternalData::getOrCreate(), and agx::InternalData::hasData().

◆ as() [2/2]

template<typename T >
const T* agx::Referenced::as ( ) const
inherited

◆ asSafe() [1/2]

template<typename T >
T* agx::Referenced::asSafe ( )
inherited

Safe subclass casting, return nullptr if template type does not match.

Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().

◆ asSafe() [2/2]

template<typename T >
const T* agx::Referenced::asSafe ( ) const
inherited

◆ clone()

RenderData* agxCollide::RenderData::clone ( ) const

Returns an exact copy of the render data as a new object.

◆ create() [1/2]

static agxStream::Serializable* agxCollide::RenderData::create ( )
inlinestatic

Definition at line 120 of file RenderData.h.

◆ create() [2/2]

static agxStream::Serializable* agxCollide::RenderData::create ( agxStream::InputArchive &  )
inlinestatic

Definition at line 120 of file RenderData.h.

◆ deleteUsingDeleteHandler()

void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited

◆ generateUuid()

void agxStream::Serializable::generateUuid ( )
protectedinherited

◆ getClassName()

const char* agxCollide::RenderData::getClassName ( ) const
inlineoverridevirtual
Returns
the class name of this class.

Reimplemented from agxStream::Serializable.

Definition at line 120 of file RenderData.h.

◆ getColorArray()

const agx::Vec4Vector& agxCollide::RenderData::getColorArray ( ) const
Returns
a reference to the colors

◆ getConstructClassId()

static const char* agxCollide::RenderData::getConstructClassId ( )
inlinestatic

Definition at line 120 of file RenderData.h.

◆ getDeleteHandler()

static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.

◆ getEnableSerialization()

bool agxStream::Serializable::getEnableSerialization ( ) const
inherited
Returns
true if serialization is enabled for this object

Definition at line 273 of file Serializable.h.

◆ getEnableUuidGeneration()

bool agxStream::Serializable::getEnableUuidGeneration ( )
inherited
Returns
true if Uuid:s should be generated for each new Serializable object

◆ getIndex()

agx::UInt32 agxStream::Serializable::getIndex ( ) const
inherited

This index is given at creation of this object.

It is guaranteed to be unique for the lifetime of this library instance. As long as the application is running. This value is not serialized or restored. A new object will always get a new index no matter how it is created.

Returns
an instance index of this object. This is unique for the lifetime of this library instance.

Definition at line 247 of file Serializable.h.

◆ getIndexArray()

const agx::UInt32Vector& agxCollide::RenderData::getIndexArray ( ) const
Returns
a reference to the indices

◆ getMode()

Mode agxCollide::RenderData::getMode ( ) const
Returns
the current primitive mode

◆ getNormalArray()

const agx::Vec3Vector& agxCollide::RenderData::getNormalArray ( ) const
Returns
a reference to the normals

◆ getReferenceCount()

int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.

◆ getRenderMaterial()

agxCollide::RenderMaterial* agxCollide::RenderData::getRenderMaterial ( ) const
Returns
the RenderMaterial for this RenderData. Null if none is set.

◆ getShouldRender()

bool agxCollide::RenderData::getShouldRender ( ) const
Returns
if the data should be rendered

◆ getStorageAgent()

agxStream::StorageAgent* agxCollide::RenderData::getStorageAgent ( ) const
inlineoverridevirtual
Returns
the storage agent

Implements agxStream::Serializable.

Definition at line 120 of file RenderData.h.

◆ getTexCoordArray()

const agx::Vec2Vector& agxCollide::RenderData::getTexCoordArray ( ) const
Returns
a reference to the texture coordinates

◆ getUuid()

agx::Uuid agxStream::Serializable::getUuid ( ) const
inherited
Returns
a unique id for this instance.

Definition at line 268 of file Serializable.h.

Referenced by agxSDK::UuidHashCollisionFilter::match().

◆ getVertexArray()

const agx::Vec3Vector& agxCollide::RenderData::getVertexArray ( ) const
Returns
a reference to the vertices

◆ hasRenderMaterial()

bool agxCollide::RenderData::hasRenderMaterial ( ) const
Returns
true if this RenderData has a RenderMaterial specified.

◆ is()

template<typename T >
bool agx::Referenced::is ( ) const
inherited

◆ isFinished()

bool agxStream::Serializable::isFinished ( ) const
inherited
Returns
true if this class is restored correctly and should not be deleted during destruction of an Archive.

Definition at line 252 of file Serializable.h.

References AGX_FORCE_INLINE.

◆ reference()

void agx::Referenced::reference ( void *  ptr = nullptr) const
inherited

Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.

This method should be used with care, always balanced with the same number of calls to unreference.

◆ restore()

virtual void agxCollide::RenderData::restore ( agxStream::InputArchive &  in)
overridevirtual

◆ setColorArray()

void agxCollide::RenderData::setColorArray ( const agx::Vec4Vector &  color)

Set and copy the colors.

◆ setDeleteHandler()

static void agx::Referenced::setDeleteHandler ( DeleteHandler *  handler)
staticprotectedinherited

Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.

◆ setEnableSerialization()

void agxStream::Serializable::setEnableSerialization ( bool  flag)
inherited

Set to false to disable serialization of this object.

It will just be ignored during serialization (writing). It is still possible to restore TO this object.

◆ setEnableUuidGeneration()

static void agxStream::Serializable::setEnableUuidGeneration ( bool  flag)
staticinherited

Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.

◆ setFinished()

void agxStream::Serializable::setFinished ( )
inherited

Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.

◆ setIndexArray()

void agxCollide::RenderData::setIndexArray ( const agx::UInt32Vector &  indices,
Mode  mode 
)

Set (and copy) the indices.

◆ setNormalArray()

void agxCollide::RenderData::setNormalArray ( const agx::Vec3Vector &  normals)

Set (and copy) the normals.

◆ setRenderMaterial()

void agxCollide::RenderData::setRenderMaterial ( agxCollide::RenderMaterial *  renderMaterial)

Set the renderMaterial of this RenderData.

◆ setShouldRender()

void agxCollide::RenderData::setShouldRender ( bool  shouldRender)

Set if the data stored should be rendered at all.

◆ setTexCoordArray()

void agxCollide::RenderData::setTexCoordArray ( const agx::Vec2Vector &  texCoords)

Set (and copy) the texture coordinates.

◆ setUuid()

void agxStream::Serializable::setUuid ( const agx::Uuid &  uuid)
inherited

Explicitly set a Uuid on a serializable object.

Use this method with great care, as it can result in non-unique identifiers in the system!

◆ setVertexArray()

void agxCollide::RenderData::setVertexArray ( const agx::Vec3Vector &  vertices)

Set (and copy) the vertices.

◆ store()

virtual void agxCollide::RenderData::store ( agxStream::OutputArchive &  out) const
overridevirtual

◆ unreference()

void agx::Referenced::unreference ( void *  ptr = nullptr) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.

This method should be used with care, always balanced with the same number of calls to reference.

Referenced by agxData::EntityRef< ContactMaterialPtr >::~EntityRef().

◆ unreference_nodelete()

void agx::Referenced::unreference_nodelete ( ) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.

◆ ValidateCast()

template<typename T >
static bool agx::Referenced::ValidateCast ( const Referenced *  object)
staticinherited

Member Data Documentation

◆ m_indices

agx::UInt32Vector agxCollide::RenderData::m_indices
protected

Definition at line 129 of file RenderData.h.

◆ m_mode

Mode agxCollide::RenderData::m_mode
protected

Definition at line 135 of file RenderData.h.

◆ m_mutex

Mutex agx::Referenced::m_mutex
mutableprotectedinherited

Definition at line 240 of file Referenced.h.

◆ m_normals

agx::Vec3Vector agxCollide::RenderData::m_normals
protected

Definition at line 130 of file RenderData.h.

◆ m_observers

ObserverContainer agx::Referenced::m_observers
mutableprotectedinherited

Definition at line 239 of file Referenced.h.

◆ m_refCount

AtomicValue agx::Referenced::m_refCount
mutableprotectedinherited

Definition at line 241 of file Referenced.h.

◆ m_renderMaterial

agxCollide::RenderMaterialRef agxCollide::RenderData::m_renderMaterial
protected

Definition at line 133 of file RenderData.h.

◆ m_renderState

agx::UInt32 agxCollide::RenderData::m_renderState
protected

Definition at line 134 of file RenderData.h.

◆ m_texCoords

agx::Vec2Vector agxCollide::RenderData::m_texCoords
protected

Definition at line 131 of file RenderData.h.

◆ m_vertexColor

agx::Vec4Vector agxCollide::RenderData::m_vertexColor
protected

Definition at line 132 of file RenderData.h.

◆ m_vertices

agx::Vec3Vector agxCollide::RenderData::m_vertices
protected

Definition at line 128 of file RenderData.h.


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