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

Abstract base class for graphical objects that are used by units, or as props attached to other CModelAbstract objects. More...

#include <ModelAbstract.h>

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

Classes

struct  CustomSelectionShape
 Describes a custom selection shape to be used for a model's selection box instead of the default recursive bounding boxes. More...
 

Public Member Functions

 CModelAbstract ()
 
virtual ~CModelAbstract ()
 
virtual std::unique_ptr< CModelAbstractClone () const =0
 
virtual CModelDummyToCModelDummy ()
 Dynamic cast. More...
 
virtual CModelToCModel ()
 Dynamic cast. More...
 
virtual CModelDecalToCModelDecal ()
 Dynamic cast. More...
 
virtual CModelParticleEmitterToCModelParticleEmitter ()
 Dynamic cast. More...
 
virtual const CBoundingBoxAligned GetWorldBoundsRec ()
 Returns world space bounds of this object and all child objects. More...
 
virtual const CBoundingBoxOrientedGetSelectionBox ()
 Returns the world-space selection box of this model. More...
 
virtual void InvalidateBounds ()
 Marks the bounds as invalid. More...
 
void SetCustomSelectionShape (CustomSelectionShape *descriptor)
 Sets a custom selection shape as described by a descriptor. More...
 
virtual const CBoundingBoxAligned GetObjectSelectionBoundsRec ()
 Returns the (object-space) bounds that should be used to construct a selection box for this model and its children. More...
 
virtual void SetTerrainDirty (ssize_t i0, ssize_t j0, ssize_t i1, ssize_t j1)=0
 Called when terrain has changed in the given inclusive bounds. More...
 
virtual void SetEntityVariable (const std::string &name, float value)
 Called when the entity tries to set some variable to affect the display of this model and/or its child objects. More...
 
virtual void ValidatePosition ()=0
 Ensure that both the transformation and the bone matrices are correct for this model and all its props. More...
 
virtual void InvalidatePosition ()=0
 Mark this model's position and bone matrices, and all props' positions as invalid. More...
 
virtual void SetPlayerID (player_id_t id)
 
virtual player_id_t GetPlayerID () const
 
virtual void SetShadingColor (const CColor &color)
 
virtual const CColorGetShadingColor () const
 
- Public Member Functions inherited from CRenderableObject
 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...
 

Public Attributes

CModelAbstractm_Parent
 If non-null, points to the model that we are attached to. More...
 
bool m_PositionValid
 True if both transform and and bone matrices are valid. More...
 
player_id_t m_PlayerID
 
CColor m_ShadingColor
 Modulating color. More...
 

Protected Member Functions

void CalcSelectionBox ()
 
- Protected Member Functions inherited from CRenderableObject
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

CBoundingBoxOriented m_SelectionBox
 Selection box for this model. More...
 
bool m_SelectionBoxValid
 Is the current selection box valid? More...
 
CustomSelectionShapem_CustomSelectionShape
 Pointer to a descriptor for a custom-defined selection box shape. More...
 
- Protected Attributes inherited from CRenderableObject
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 (CModelAbstract)
 

Detailed Description

Abstract base class for graphical objects that are used by units, or as props attached to other CModelAbstract objects.

This includes meshes, terrain decals, and sprites. These objects exist in a tree hierarchy.

Constructor & Destructor Documentation

◆ CModelAbstract()

CModelAbstract::CModelAbstract ( )
inline

◆ ~CModelAbstract()

virtual CModelAbstract::~CModelAbstract ( )
inlinevirtual

Member Function Documentation

◆ CalcSelectionBox()

void CModelAbstract::CalcSelectionBox ( )
protected

◆ Clone()

virtual std::unique_ptr< CModelAbstract > CModelAbstract::Clone ( ) const
pure virtual

◆ GetObjectSelectionBoundsRec()

virtual const CBoundingBoxAligned CModelAbstract::GetObjectSelectionBoundsRec ( )
inlinevirtual

Returns the (object-space) bounds that should be used to construct a selection box for this model and its children.

May return an empty bound to indicate that this model and its children should not be selectable themselves, or should not be included in its parent model's selection box. This method is used for constructing the default selection boxes, as opposed to any boxes of custom shape specified by m_CustomSelectionShape.

If you wish your model type to be included in selection boxes, override this method and have it return the object-space bounds of itself, augmented recursively (via this method) with the object-space selection bounds of its children.

Reimplemented in CModel.

◆ GetPlayerID()

virtual player_id_t CModelAbstract::GetPlayerID ( ) const
inlinevirtual

◆ GetSelectionBox()

const CBoundingBoxOriented & CModelAbstract::GetSelectionBox ( )
virtual

Returns the world-space selection box of this model.

Used primarily for hittesting against against a selection ray. The returned selection box may be empty to indicate that it does not wish to participate in the selection process.

◆ GetShadingColor()

virtual const CColor & CModelAbstract::GetShadingColor ( ) const
inlinevirtual

◆ GetWorldBoundsRec()

virtual const CBoundingBoxAligned CModelAbstract::GetWorldBoundsRec ( )
inlinevirtual

Returns world space bounds of this object and all child objects.

Reimplemented in CModel.

◆ InvalidateBounds()

virtual void CModelAbstract::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 from CRenderableObject.

◆ InvalidatePosition()

virtual void CModelAbstract::InvalidatePosition ( )
pure virtual

Mark this model's position and bone matrices, and all props' positions as invalid.

Implemented in CModelDecal, CModel, CModelDummy, and CModelParticleEmitter.

◆ NONCOPYABLE()

CModelAbstract::NONCOPYABLE ( CModelAbstract  )
private

◆ SetCustomSelectionShape()

void CModelAbstract::SetCustomSelectionShape ( CustomSelectionShape descriptor)
inline

Sets a custom selection shape as described by a descriptor.

Argument may be NULL if you wish to keep the default behaviour of using the recursively-calculated bounding boxes.

◆ SetEntityVariable()

virtual void CModelAbstract::SetEntityVariable ( const std::string &  name,
float  value 
)
inlinevirtual

Called when the entity tries to set some variable to affect the display of this model and/or its child objects.

Reimplemented in CModel, and CModelParticleEmitter.

◆ SetPlayerID()

virtual void CModelAbstract::SetPlayerID ( player_id_t  id)
inlinevirtual

Reimplemented in CModel.

◆ SetShadingColor()

virtual void CModelAbstract::SetShadingColor ( const CColor color)
inlinevirtual

Reimplemented in CModel.

◆ SetTerrainDirty()

virtual void CModelAbstract::SetTerrainDirty ( ssize_t  i0,
ssize_t  j0,
ssize_t  i1,
ssize_t  j1 
)
pure virtual

Called when terrain has changed in the given inclusive bounds.

Might call SetDirty if the change affects this model.

Implemented in CModelDecal, CModel, CModelParticleEmitter, and CModelDummy.

◆ ToCModel()

virtual CModel * CModelAbstract::ToCModel ( )
inlinevirtual

Dynamic cast.

Reimplemented in CModel.

◆ ToCModelDecal()

virtual CModelDecal * CModelAbstract::ToCModelDecal ( )
inlinevirtual

Dynamic cast.

Reimplemented in CModelDecal.

◆ ToCModelDummy()

virtual CModelDummy * CModelAbstract::ToCModelDummy ( )
inlinevirtual

Dynamic cast.

Reimplemented in CModelDummy.

◆ ToCModelParticleEmitter()

virtual CModelParticleEmitter * CModelAbstract::ToCModelParticleEmitter ( )
inlinevirtual

Dynamic cast.

Reimplemented in CModelParticleEmitter.

◆ ValidatePosition()

virtual void CModelAbstract::ValidatePosition ( )
pure virtual

Ensure that both the transformation and the bone matrices are correct for this model and all its props.

Implemented in CModelDecal, CModel, CModelDummy, and CModelParticleEmitter.

Member Data Documentation

◆ m_CustomSelectionShape

CustomSelectionShape* CModelAbstract::m_CustomSelectionShape
protected

Pointer to a descriptor for a custom-defined selection box shape.

If no custom selection box is required, this is NULL and the standard recursive-bounding-box-based selection box is used. Otherwise, a custom selection box described by this field will be used.

See also
SetCustomSelectionShape

◆ m_Parent

CModelAbstract* CModelAbstract::m_Parent

If non-null, points to the model that we are attached to.

◆ m_PlayerID

player_id_t CModelAbstract::m_PlayerID

◆ m_PositionValid

bool CModelAbstract::m_PositionValid

True if both transform and and bone matrices are valid.

◆ m_SelectionBox

CBoundingBoxOriented CModelAbstract::m_SelectionBox
protected

Selection box for this model.

◆ m_SelectionBoxValid

bool CModelAbstract::m_SelectionBoxValid
protected

Is the current selection box valid?

◆ m_ShadingColor

CColor CModelAbstract::m_ShadingColor

Modulating color.


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