Pyrogenesis  trunk
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
CRenderableObject Class Referenceabstract

#include <RenderableObject.h>

Inheritance diagram for CRenderableObject:
Inheritance graph
[legend]
Collaboration diagram for CRenderableObject:
Collaboration graph
[legend]

Public Member Functions

 CRenderableObject ()
 
virtual ~CRenderableObject ()
 
virtual void SetTransform (const CMatrix3D &transform)
 
const CMatrix3DGetTransform () const
 
const CMatrix3DGetInvTransform () const
 
void SetDirty (u32 dirtyflags)
 
virtual void CalcBounds ()=0
 (Re)calculates and stores any bounds or bound-dependent data for this object. More...
 
const CBoundingBoxAlignedGetWorldBounds ()
 Returns the world-space axis-aligned bounds of this object. More...
 
virtual void InvalidateBounds ()
 Marks the bounds as invalid. More...
 
void SetRenderData (CRenderData *renderdata)
 
CRenderDataGetRenderData ()
 Return object renderdata - can be null if renderer hasn't yet created the renderdata. More...
 

Protected Member Functions

void RecalculateBoundsIfNecessary ()
 Factored out so subclasses don't need to repeat this if they want to add additional getters for bounds-related methods (since they'll have to make sure to recalc the bounds if necessary before they return it). More...
 

Protected Attributes

CBoundingBoxAligned m_WorldBounds
 World-space bounds of this object. More...
 
CMatrix3D m_Transform
 
CMatrix3D m_InvTransform
 
CRenderDatam_RenderData
 
bool m_BoundsValid
 Remembers whether any bounds need to be recalculated. More...
 

Private Member Functions

 NONCOPYABLE (CRenderableObject)
 

Constructor & Destructor Documentation

CRenderableObject::CRenderableObject ( )
inline
virtual CRenderableObject::~CRenderableObject ( )
inlinevirtual

Member Function Documentation

virtual void CRenderableObject::CalcBounds ( )
pure virtual

(Re)calculates and stores any bounds or bound-dependent data for this object.

At this abstraction level, this is only the world-space bounds stored in m_WorldBounds; subclasses may use this method to (re)compute additional bounds if necessary, or any data that depends on the bounds. Whenever bound-dependent data is requested through a public interface, RecalculateBoundsIfNecessary should be called first to ensure bound correctness, which will in turn call this method if it turns out that they're outdated.

See also
m_BoundsValid
RecalculateBoundsIfNecessary

Implemented in CModelParticleEmitter, CModel, CModelDecal, and CPatch.

const CMatrix3D& CRenderableObject::GetInvTransform ( ) const
inline
CRenderData* CRenderableObject::GetRenderData ( )
inline

Return object renderdata - can be null if renderer hasn't yet created the renderdata.

const CMatrix3D& CRenderableObject::GetTransform ( ) const
inline
const CBoundingBoxAligned& CRenderableObject::GetWorldBounds ( )
inline

Returns the world-space axis-aligned bounds of this object.

virtual void CRenderableObject::InvalidateBounds ( )
inlinevirtual

Marks the bounds as invalid.

This will trigger RecalculateBoundsIfNecessary to recompute any bound-related data the next time any bound-related data is requested through a public interface – at least, if you've made sure to call it before returning the stored data.

Reimplemented in CModelAbstract.

CRenderableObject::NONCOPYABLE ( CRenderableObject  )
private
void CRenderableObject::RecalculateBoundsIfNecessary ( )
inlineprotected

Factored out so subclasses don't need to repeat this if they want to add additional getters for bounds-related methods (since they'll have to make sure to recalc the bounds if necessary before they return it).

void CRenderableObject::SetDirty ( u32  dirtyflags)
inline
void CRenderableObject::SetRenderData ( CRenderData renderdata)
inline
virtual void CRenderableObject::SetTransform ( const CMatrix3D transform)
inlinevirtual

Reimplemented in CModelParticleEmitter, CModel, and CModelDecal.

Member Data Documentation

bool CRenderableObject::m_BoundsValid
protected

Remembers whether any bounds need to be recalculated.

Subclasses that add any data that depends on the bounds should take care to consider the validity of the bounds and recalculate their data when necessary – overriding CalcBounds to do so would be a good idea, since it's already set up to be called by RecalculateBoundsIfNecessary whenever the bounds are marked as invalid. The latter should then be called before returning any bounds or bounds-derived data through a public interface (see the implementation of GetWorldBounds for an example).

See also
CalcBounds
InvalidateBounds
RecalculateBoundsIfNecessary
CMatrix3D CRenderableObject::m_InvTransform
protected
CRenderData* CRenderableObject::m_RenderData
protected
CMatrix3D CRenderableObject::m_Transform
protected
CBoundingBoxAligned CRenderableObject::m_WorldBounds
protected

World-space bounds of this object.


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