Pyrogenesis
13997
|
#include <Model.h>
Classes | |
struct | Prop |
Public Member Functions | |
CModel (CSkeletonAnimManager &skeletonAnimManager, CSimulation2 &simulation) | |
~CModel () | |
virtual CModel * | ToCModel () |
Dynamic cast. More... | |
bool | InitModel (const CModelDefPtr &modeldef) |
void | UpdateTo (float time) |
const CModelDefPtr & | GetModelDef () |
void | SetMaterial (const CMaterial &material) |
void | SetPlayerID (player_id_t id) |
virtual void | SetShadingColor (const CColor &colour) |
CMaterial & | GetMaterial () |
bool | SetAnimation (CSkeletonAnim *anim, bool once=false) |
CSkeletonAnim * | GetAnimation () const |
void | CopyAnimationFrom (CModel *source) |
void | SetFlags (int flags) |
int | GetFlags () const |
void | AddFlagsRec (int flags) |
void | RemoveShadowsRec () |
virtual void | SetDirtyRec (int dirtyflags) |
Calls SetDirty on this model and all child objects. More... | |
virtual void | SetTerrainDirty (ssize_t i0, ssize_t j0, ssize_t i1, ssize_t j1) |
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 | CalcBounds () |
Overridden to calculate both the world-space and object-space bounds of this model, and stores the result in m_Bounds and m_ObjectBounds, respectively. More... | |
const CBoundingBoxAligned & | GetObjectBounds () |
Returns the object-space bounds for this model, excluding its children. More... | |
virtual const CBoundingBoxAligned | GetWorldBoundsRec () |
Returns world space bounds of this object and all child objects. More... | |
void | CalcStaticObjectBounds () |
Auxiliary method; calculates object space bounds of this model, based solely on vertex positions, and stores the result in m_ObjectBounds. More... | |
void | CalcAnimatedObjectBounds (CSkeletonAnimDef *anim, CBoundingBoxAligned &result) |
Auxiliary method; calculate object-space bounds encompassing all vertex positions for given animation, and stores the result in m_ObjectBounds. More... | |
virtual const CBoundingBoxAligned | GetObjectSelectionBoundsRec () |
Reimplemented here since proper models should participate in selection boxes. More... | |
virtual void | SetTransform (const CMatrix3D &transform) |
Set transform of this object. More... | |
bool | IsSkinned () |
Return whether this is a skinned/skeletal model. More... | |
const CMatrix3D * | GetAnimatedBoneMatrices () |
CSkeletonAnim * | BuildAnimation (const VfsPath &pathname, const CStr &name, float speed, float actionpos, float actionpos2, float soundpos) |
Load raw animation frame animation from given file, and build an animation specific to this model. More... | |
void | AddProp (const SPropPoint *point, CModelAbstract *model, CObjectEntry *objectentry, float minHeight=0.f, float maxHeight=0.f) |
Add a prop to the model on the given point. More... | |
void | AddAmmoProp (const SPropPoint *point, CModelAbstract *model, CObjectEntry *objectentry) |
Add a prop to the model on the given point, and treat it as the ammo prop. More... | |
void | ShowAmmoProp () |
Show the ammo prop (if any), and hide any other props on that prop point. More... | |
void | HideAmmoProp () |
Hide the ammo prop (if any), and show any other props on that prop point. More... | |
CModelAbstract * | FindFirstAmmoProp () |
Find the first prop used for ammo, by this model or its own props. More... | |
std::vector< Prop > & | GetProps () |
const std::vector< Prop > & | GetProps () const |
virtual CModelAbstract * | Clone () const |
virtual void | ValidatePosition () |
Ensure that both the transformation and the bone matrices are correct for this model and all its props. More... | |
virtual void | InvalidatePosition () |
Mark this model's position and bone matrices, and all props' positions as invalid. More... | |
![]() | |
CModelAbstract () | |
~CModelAbstract () | |
virtual CModelDecal * | ToCModelDecal () |
Dynamic cast. More... | |
virtual CModelParticleEmitter * | ToCModelParticleEmitter () |
Dynamic cast. 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 player_id_t | GetPlayerID () const |
virtual CColor | GetShadingColor () const |
![]() | |
CRenderableObject () | |
virtual | ~CRenderableObject () |
const CMatrix3D & | GetTransform () const |
const CMatrix3D & | GetInvTransform () const |
void | SetDirty (u32 dirtyflags) |
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... | |
Private Member Functions | |
NONCOPYABLE (CModel) | |
void | ReleaseData () |
Private Attributes | |
CSimulation2 & | m_Simulation |
int | m_Flags |
CMaterial | m_Material |
CModelDefPtr | m_pModelDef |
CBoundingBoxAligned | m_ObjectBounds |
CSkeletonAnim * | m_Anim |
float | m_AnimTime |
CMatrix3D * | m_BoneMatrices |
Current state of all bones on this model; null if associated modeldef isn't skeletal. More... | |
std::vector< Prop > | m_Props |
const SPropPoint * | m_AmmoPropPoint |
The prop point to which the ammo prop is attached, or NULL if none. More... | |
size_t | m_AmmoLoadedProp |
If m_AmmoPropPoint is not NULL, then the index in m_Props of the ammo prop. More... | |
CSkeletonAnimManager & | m_SkeletonAnimManager |
Additional Inherited Members | |
![]() | |
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... | |
![]() | |
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... | |
![]() | |
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... | |
CModel::CModel | ( | CSkeletonAnimManager & | skeletonAnimManager, |
CSimulation2 & | simulation | ||
) |
void CModel::AddAmmoProp | ( | const SPropPoint * | point, |
CModelAbstract * | model, | ||
CObjectEntry * | objectentry | ||
) |
void CModel::AddProp | ( | const SPropPoint * | point, |
CModelAbstract * | model, | ||
CObjectEntry * | objectentry, | ||
float | minHeight = 0.f , |
||
float | maxHeight = 0.f |
||
) |
CSkeletonAnim * CModel::BuildAnimation | ( | const VfsPath & | pathname, |
const CStr & | name, | ||
float | speed, | ||
float | actionpos, | ||
float | actionpos2, | ||
float | soundpos | ||
) |
Load raw animation frame animation from given file, and build an animation specific to this model.
pathname | animation file to load |
name | animation name (e.g. "idle") |
speed | animation speed as a factor of the default animation speed |
actionpos | offset of 'action' event, in range [0, 1] |
actionpos2 | offset of 'action2' event, in range [0, 1] |
sound | offset of 'sound' event, in range [0, 1] |
void CModel::CalcAnimatedObjectBounds | ( | CSkeletonAnimDef * | anim, |
CBoundingBoxAligned & | result | ||
) |
Auxiliary method; calculate object-space bounds encompassing all vertex positions for given animation, and stores the result in m_ObjectBounds.
Called by CalcBounds (instead of CalcStaticBounds) if it has been determined that the object-space bounds need to take animations into account.
|
virtual |
Overridden to calculate both the world-space and object-space bounds of this model, and stores the result in m_Bounds and m_ObjectBounds, respectively.
Implements CRenderableObject.
void CModel::CalcStaticObjectBounds | ( | ) |
Auxiliary method; calculates object space bounds of this model, based solely on vertex positions, and stores the result in m_ObjectBounds.
Called by CalcBounds (instead of CalcAnimatedObjectBounds) if it has been determined that the object-space bounds are static.
|
virtual |
Implements CModelAbstract.
CModelAbstract * CModel::FindFirstAmmoProp | ( | ) |
|
inline |
|
inline |
|
inline |
|
virtual |
Reimplemented here since proper models should participate in selection boxes.
Reimplemented from CModelAbstract.
|
virtual |
Returns world space bounds of this object and all child objects.
Reimplemented from CModelAbstract.
void CModel::HideAmmoProp | ( | ) |
bool CModel::InitModel | ( | const CModelDefPtr & | modeldef | ) |
|
virtual |
Mark this model's position and bone matrices, and all props' positions as invalid.
Implements CModelAbstract.
|
inline |
|
private |
bool CModel::SetAnimation | ( | CSkeletonAnim * | anim, |
bool | once = false |
||
) |
|
inlinevirtual |
Calls SetDirty on this model and all child objects.
Implements CModelAbstract.
|
inlinevirtual |
Called when the entity tries to set some variable to affect the display of this model and/or its child objects.
Reimplemented from CModelAbstract.
|
virtual |
Reimplemented from CModelAbstract.
|
virtual |
Reimplemented from CModelAbstract.
|
inlinevirtual |
Called when terrain has changed in the given inclusive bounds.
Might call SetDirty if the change affects this model.
Implements CModelAbstract.
|
virtual |
Set transform of this object.
Reimplemented from CRenderableObject.
void CModel::ShowAmmoProp | ( | ) |
|
inlinevirtual |
|
virtual |
Ensure that both the transformation and the bone matrices are correct for this model and all its props.
Implements CModelAbstract.
|
private |
|
private |
|
private |
|
private |
Current state of all bones on this model; null if associated modeldef isn't skeletal.
Props may attach to these bones by means of the SPropPoint::m_BoneIndex field; in this case their transformation matrix held is relative to the bone transformation (see SPropPoint and CModel::ValidatePosition).
|
private |
|
private |
|
private |
|
private |