22 #ifndef INCLUDED_MODEL 23 #define INCLUDED_MODEL 37 #define MODELFLAG_CASTSHADOWS (1<<0) 38 #define MODELFLAG_NOLOOPANIMATION (1<<1) 39 #define MODELFLAG_SILHOUETTE_DISPLAY (1<<2) 40 #define MODELFLAG_SILHOUETTE_OCCLUDER (1<<3) 41 #define MODELFLAG_IGNORE_LOS (1<<4) 42 #define MODELFLAG_FLOATONWATER (1<<5) 129 for (
size_t i = 0; i <
m_Props.size(); ++i)
135 for (
size_t i = 0; i <
m_Props.size(); ++i)
CModel(CSimulation2 &simulation)
Definition: Model.cpp:42
void HideAmmoProp()
Hide the ammo prop (if any), and show any other props on that prop point.
Definition: Model.cpp:459
std::shared_ptr< CModelDef > CModelDefPtr
Definition: MeshManager.h:27
Describes the position of a prop point within its parent model.
Definition: ModelDef.h:54
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 chil...
Definition: Model.h:133
CMatrix3D * m_BoneMatrices
Current state of all bones on this model; null if associated modeldef isn't skeletal.
Definition: Model.h:264
virtual const CBoundingBoxAligned GetWorldBoundsRec()
Returns world space bounds of this object and all child objects.
Definition: Model.cpp:139
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.
std::vector< Prop > m_Props
Definition: Model.h:266
void UpdateTo(float time)
Definition: Model.cpp:201
void ReleaseData()
Definition: Model.cpp:57
bool m_PositionValid
True if both transform and and bone matrices are valid.
Definition: ModelAbstract.h:169
std::vector< Prop > & GetProps()
Definition: Model.h:216
Definition: Material.h:28
Public API for simulation system.
Definition: Simulation2.h:46
int32_t player_id_t
valid player IDs are non-negative (see ICmpOwnership)
Definition: Player.h:24
CSkeletonAnim * GetAnimation() const
Definition: Model.h:111
const CMatrix3D * GetAnimatedBoneMatrices()
Definition: Model.h:184
Definition: Matrix3D.h:33
const std::vector< Prop > & GetProps() const
Definition: Model.h:217
bool SetAnimation(CSkeletonAnim *anim, bool once=false)
Definition: Model.cpp:363
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
Definition: debug.h:290
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.
Definition: Model.cpp:99
void RemoveShadowsRec()
Definition: Model.cpp:540
virtual void SetShadingColor(const CColor &color)
Definition: Model.cpp:568
int m_Flags
Definition: Model.h:242
bool IsSkinned()
Return whether this is a skinned/skeletal model.
Definition: Model.h:181
bool InitModel(const CModelDefPtr &modeldef)
Definition: Model.cpp:70
Definition: SkeletonAnimDef.h:47
int GetFlags() const
Definition: Model.h:120
void AddProp(const SPropPoint *point, CModelAbstract *model, CObjectEntry *objectentry, float minHeight=0.f, float maxHeight=0.f, bool selectable=true)
Add a prop to the model on the given point.
Definition: Model.cpp:414
virtual CModelAbstract * Clone() const
Definition: Model.cpp:495
void ShowAmmoProp()
Show the ammo prop (if any), and hide any other props on that prop point.
Definition: Model.cpp:444
virtual void ValidatePosition()
Ensure that both the transformation and the bone matrices are correct for this model and all its prop...
Definition: Model.cpp:228
CModelAbstract * m_Model
Pointer to the model associated with this prop.
Definition: Model.h:70
virtual void SetTransform(const CMatrix3D &transform)
Set transform of this object.
Definition: Model.cpp:519
size_t m_AmmoLoadedProp
If m_AmmoPropPoint is not NULL, then the index in m_Props of the ammo prop.
Definition: Model.h:276
virtual const CBoundingBoxAligned GetObjectSelectionBoundsRec()
Reimplemented here since proper models should participate in selection boxes.
Definition: Model.cpp:147
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.
Definition: Model.cpp:432
virtual CModel * ToCModel()
Dynamic cast.
Definition: Model.h:85
void CalcAnimatedObjectBounds(CSkeletonAnimDef *anim, CBoundingBoxAligned &result)
Auxiliary method; calculate object-space bounds encompassing all vertex positions for given animation...
Definition: Model.cpp:132
float m_MinHeight
Definition: Model.h:55
intptr_t ssize_t
Definition: wposix_types.h:82
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 chil...
Definition: ModelAbstract.h:141
CModelAbstract * FindFirstAmmoProp()
Find the first prop used for ammo, by this model or its own props.
Definition: Model.cpp:474
const CBoundingBoxAligned & GetObjectBounds()
Returns the object-space bounds for this model, excluding its children.
Definition: Model.h:146
const SPropPoint * m_Point
Location of the prop point within its parent model, relative to either a bone in the parent model or ...
Definition: Model.h:63
float m_MaxHeight
Definition: Model.h:56
Abstract base class for graphical objects that are used by units, or as props attached to other CMode...
Definition: ModelAbstract.h:37
Definition: BoundingBoxAligned.h:33
CBoundingBoxAligned m_ObjectBounds
Definition: Model.h:250
~CModel()
Definition: Model.cpp:50
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.
Definition: Model.h:127
void RecalculateBoundsIfNecessary()
Factored out so subclasses don't need to repeat this if they want to add additional getters for bound...
Definition: RenderableObject.h:130
void CalcStaticObjectBounds()
Auxiliary method; calculates object space bounds of this model, based solely on vertex positions...
Definition: Model.cpp:124
bool m_Selectable
Definition: Model.h:74
const CModelDefPtr & GetModelDef()
Definition: Model.h:96
CMaterial & GetMaterial()
Definition: Model.h:105
CSkeletonAnim * m_Anim
Definition: Model.h:252
CMaterial m_Material
Definition: Model.h:244
void SetPlayerID(player_id_t id)
Definition: Model.cpp:560
CSimulation2 & m_Simulation
Definition: Model.h:239
CObjectEntry * m_ObjectEntry
Definition: Model.h:71
void SetFlags(int flags)
Definition: Model.h:118
const SPropPoint * m_AmmoPropPoint
The prop point to which the ammo prop is attached, or NULL if none.
Definition: Model.h:271
void CopyAnimationFrom(CModel *source)
Definition: Model.cpp:403
virtual void InvalidatePosition()
Mark this model's position and bone matrices, and all props' positions as invalid.
Definition: Model.cpp:218
bool m_Hidden
Should this prop be temporarily removed from rendering?
Definition: Model.h:73
Prop()
Definition: Model.h:53
float m_AnimTime
Definition: Model.h:254
Definition: ObjectEntry.h:38
void SetMaterial(const CMaterial &material)
Definition: Model.cpp:555
CModelDefPtr m_pModelDef
Definition: Model.h:246
void AddFlagsRec(int flags)
Definition: Model.cpp:528
Definition: SkeletonAnim.h:32