Pyrogenesis
13997
|
Abstract base class for graphical objects that are used by units, or as props attached to other CModelAbstract objects. More...
#include <ModelAbstract.h>
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 () | |
~CModelAbstract () | |
virtual CModelAbstract * | Clone () const =0 |
virtual CModel * | ToCModel () |
Dynamic cast. More... | |
virtual CModelDecal * | ToCModelDecal () |
Dynamic cast. More... | |
virtual CModelParticleEmitter * | ToCModelParticleEmitter () |
Dynamic cast. More... | |
virtual void | SetDirtyRec (int dirtyflags)=0 |
Calls SetDirty on this model and all child objects. More... | |
virtual const CBoundingBoxAligned | GetWorldBoundsRec () |
Returns world space bounds of this object and all child objects. More... | |
virtual const CBoundingBoxOriented & | GetSelectionBox () |
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 &colour) |
virtual CColor | GetShadingColor () const |
![]() | |
CRenderableObject () | |
virtual | ~CRenderableObject () |
virtual void | SetTransform (const CMatrix3D &transform) |
const CMatrix3D & | GetTransform () const |
const CMatrix3D & | GetInvTransform () const |
void | SetDirty (u32 dirtyflags) |
virtual void | CalcBounds ()=0 |
(Re)calculates and stores any bounds or bound-dependent data for this object. More... | |
const CBoundingBoxAligned & | GetWorldBounds () |
Returns the world-space axis-aligned bounds of this object. More... | |
void | SetRenderData (CRenderData *renderdata) |
CRenderData * | GetRenderData () |
Return object renderdata - can be null if renderer hasn't yet created the renderdata. More... | |
Public Attributes | |
CModelAbstract * | m_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 () |
![]() | |
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... | |
CustomSelectionShape * | m_CustomSelectionShape |
Pointer to a descriptor for a custom-defined selection box shape. More... | |
![]() | |
CBoundingBoxAligned | m_WorldBounds |
World-space bounds of this object. More... | |
CMatrix3D | m_Transform |
CMatrix3D | m_InvTransform |
CRenderData * | m_RenderData |
bool | m_BoundsValid |
Remembers whether any bounds need to be recalculated. More... | |
Private Member Functions | |
NONCOPYABLE (CModelAbstract) | |
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.
Definition at line 36 of file ModelAbstract.h.
|
inline |
Definition at line 63 of file ModelAbstract.h.
|
inline |
Definition at line 68 of file ModelAbstract.h.
|
protected |
Definition at line 34 of file ModelAbstract.cpp.
|
pure virtual |
Implemented in CModel, CModelParticleEmitter, and CModelDecal.
|
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.
Definition at line 128 of file ModelAbstract.h.
|
inlinevirtual |
Definition at line 155 of file ModelAbstract.h.
|
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.
Definition at line 24 of file ModelAbstract.cpp.
|
inlinevirtual |
Definition at line 158 of file ModelAbstract.h.
|
inlinevirtual |
Returns world space bounds of this object and all child objects.
Reimplemented in CModel.
Definition at line 92 of file ModelAbstract.h.
|
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.
Definition at line 100 of file ModelAbstract.h.
|
pure virtual |
Mark this model's position and bone matrices, and all props' positions as invalid.
Implemented in CModel, CModelParticleEmitter, and CModelDecal.
|
private |
|
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.
Definition at line 110 of file ModelAbstract.h.
|
pure virtual |
Calls SetDirty on this model and all child objects.
Implemented in CModelParticleEmitter, CModel, and CModelDecal.
|
inlinevirtual |
Called when the entity tries to set some variable to affect the display of this model and/or its child objects.
Reimplemented in CModelParticleEmitter, and CModel.
Definition at line 140 of file ModelAbstract.h.
|
inlinevirtual |
Reimplemented in CModel.
Definition at line 152 of file ModelAbstract.h.
|
inlinevirtual |
Reimplemented in CModel.
Definition at line 157 of file ModelAbstract.h.
|
pure virtual |
Called when terrain has changed in the given inclusive bounds.
Might call SetDirty if the change affects this model.
Implemented in CModelParticleEmitter, CModel, and CModelDecal.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Dynamic cast.
Reimplemented in CModelParticleEmitter.
Definition at line 82 of file ModelAbstract.h.
|
pure virtual |
Ensure that both the transformation and the bone matrices are correct for this model and all its props.
Implemented in CModel, CModelParticleEmitter, and CModelDecal.
|
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.
Definition at line 187 of file ModelAbstract.h.
CModelAbstract* CModelAbstract::m_Parent |
If non-null, points to the model that we are attached to.
Definition at line 165 of file ModelAbstract.h.
player_id_t CModelAbstract::m_PlayerID |
Definition at line 170 of file ModelAbstract.h.
bool CModelAbstract::m_PositionValid |
True if both transform and and bone matrices are valid.
Definition at line 168 of file ModelAbstract.h.
|
protected |
Selection box for this model.
Definition at line 178 of file ModelAbstract.h.
|
protected |
Is the current selection box valid?
Definition at line 181 of file ModelAbstract.h.
CColor CModelAbstract::m_ShadingColor |
Modulating color.
Definition at line 173 of file ModelAbstract.h.