Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CRenderableObject Class Referenceabstract

#include <RenderableObject.h>

Inheritance diagram for CRenderableObject:
Collaboration diagram for CRenderableObject:

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::CRenderableObject ( )
inline

◆ ~CRenderableObject()

virtual CRenderableObject::~CRenderableObject ( )
inlinevirtual

Member Function Documentation

◆ CalcBounds()

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 CPatch, CModelDecal, CModel, CModelDummy, and CModelParticleEmitter.

◆ GetInvTransform()

const CMatrix3D & CRenderableObject::GetInvTransform ( ) const
inline

◆ GetRenderData()

CRenderData * CRenderableObject::GetRenderData ( )
inline

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

◆ GetTransform()

const CMatrix3D & CRenderableObject::GetTransform ( ) const
inline

◆ GetWorldBounds()

const CBoundingBoxAligned & CRenderableObject::GetWorldBounds ( )
inline

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

◆ InvalidateBounds()

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.

◆ NONCOPYABLE()

CRenderableObject::NONCOPYABLE ( CRenderableObject  )
private

◆ RecalculateBoundsIfNecessary()

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

◆ SetDirty()

void CRenderableObject::SetDirty ( u32  dirtyflags)
inline

◆ SetRenderData()

void CRenderableObject::SetRenderData ( CRenderData renderdata)
inline

◆ SetTransform()

virtual void CRenderableObject::SetTransform ( const CMatrix3D transform)
inlinevirtual

Reimplemented in CModelDecal, CModel, and CModelParticleEmitter.

Member Data Documentation

◆ m_BoundsValid

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

◆ m_InvTransform

CMatrix3D CRenderableObject::m_InvTransform
protected

◆ m_RenderData

CRenderData* CRenderableObject::m_RenderData
protected

◆ m_Transform

CMatrix3D CRenderableObject::m_Transform
protected

◆ m_WorldBounds

CBoundingBoxAligned CRenderableObject::m_WorldBounds
protected

World-space bounds of this object.


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