22 #ifndef INCLUDED_MODEL 23 #define INCLUDED_MODEL 39 #define MODELFLAG_CASTSHADOWS (1<<0) 40 #define MODELFLAG_NOLOOPANIMATION (1<<1) 41 #define MODELFLAG_SILHOUETTE_DISPLAY (1<<2) 42 #define MODELFLAG_SILHOUETTE_OCCLUDER (1<<3) 43 #define MODELFLAG_IGNORE_LOS (1<<4) 132 for (
size_t i=0;i<
m_Props.size();i++) {
133 m_Props[i].m_Model->SetDirtyRec(dirtyflags);
139 for (
size_t i = 0; i <
m_Props.size(); ++i)
145 for (
size_t i = 0; i <
m_Props.size(); ++i)
212 CSkeletonAnim*
BuildAnimation(
const VfsPath& pathname,
const CStr& name,
const CStr& ID,
int frequency,
float speed,
float actionpos,
float actionpos2,
float soundpos);
CSkeletonAnimManager & m_SkeletonAnimManager
Definition: Model.h:304
CSkeletonAnim * BuildAnimation(const VfsPath &pathname, const CStr &name, const CStr &ID, int frequency, float speed, float actionpos, float actionpos2, float soundpos)
Load raw animation frame animation from given file, and build an animation specific to this model...
Definition: Model.cpp:258
void HideAmmoProp()
Hide the ammo prop (if any), and show any other props on that prop point.
Definition: Model.cpp:558
Describes the position of a prop point within its parent model.
Definition: ModelDef.h:48
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:143
CMatrix3D * m_BoneMatrices
Current state of all bones on this model; null if associated modeldef isn't skeletal.
Definition: Model.h:289
virtual const CBoundingBoxAligned GetWorldBoundsRec()
Returns world space bounds of this object and all child objects.
Definition: Model.cpp:195
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:291
void UpdateTo(float time)
Definition: Model.cpp:294
const std::vector< Prop > & GetProps() const
Definition: Model.h:242
void ReleaseData()
Definition: Model.cpp:63
bool m_PositionValid
True if both transform and and bone matrices are valid.
Definition: ModelAbstract.h:168
std::vector< Prop > & GetProps()
Definition: Model.h:241
Definition: Material.h:28
Public API for simulation system.
Definition: Simulation2.h:47
int32_t player_id_t
valid player IDs are non-negative (see ICmpOwnership)
Definition: Player.h:24
const CMatrix3D * GetAnimatedBoneMatrices()
Definition: Model.h:194
Definition: Matrix3D.h:33
std::shared_ptr< CModelDef > CModelDefPtr
Definition: MeshManager.h:26
bool SetAnimation(CSkeletonAnim *anim, bool once=false)
Definition: Model.cpp:451
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
Definition: debug.h:287
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:105
void RemoveShadowsRec()
Definition: Model.cpp:642
virtual void SetShadingColor(const CColor &color)
Definition: Model.cpp:671
int m_Flags
Definition: Model.h:267
bool IsSkinned()
Return whether this is a skinned/skeletal model.
Definition: Model.h:191
bool InitModel(const CModelDefPtr &modeldef)
Definition: Model.cpp:76
Definition: SkeletonAnimDef.h:44
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:513
void ShowAmmoProp()
Show the ammo prop (if any), and hide any other props on that prop point.
Definition: Model.cpp:543
virtual CModelAbstract * Clone() const
Definition: Model.cpp:594
virtual void ValidatePosition()
Ensure that both the transformation and the bone matrices are correct for this model and all its prop...
Definition: Model.cpp:321
CModelAbstract * m_Model
Pointer to the model associated with this prop.
Definition: Model.h:72
void SetDirty(u32 dirtyflags)
Definition: RenderableObject.h:87
virtual void SetTransform(const CMatrix3D &transform)
Set transform of this object.
Definition: Model.cpp:618
size_t m_AmmoLoadedProp
If m_AmmoPropPoint is not NULL, then the index in m_Props of the ammo prop.
Definition: Model.h:301
virtual const CBoundingBoxAligned GetObjectSelectionBoundsRec()
Reimplemented here since proper models should participate in selection boxes.
Definition: Model.cpp:203
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:531
virtual CModel * ToCModel()
Dynamic cast.
Definition: Model.h:87
void CalcAnimatedObjectBounds(CSkeletonAnimDef *anim, CBoundingBoxAligned &result)
Auxiliary method; calculate object-space bounds encompassing all vertex positions for given animation...
Definition: Model.cpp:144
float m_MinHeight
Definition: Model.h:57
virtual void SetDirtyRec(int dirtyflags)
Calls SetDirty on this model and all child objects.
Definition: Model.h:130
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:140
CModelAbstract * FindFirstAmmoProp()
Find the first prop used for ammo, by this model or its own props.
Definition: Model.cpp:573
const CBoundingBoxAligned & GetObjectBounds()
Returns the object-space bounds for this model, excluding its children.
Definition: Model.h:156
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:65
float m_MaxHeight
Definition: Model.h:58
Abstract base class for graphical objects that are used by units, or as props attached to other CMode...
Definition: ModelAbstract.h:36
CModel(CSkeletonAnimManager &skeletonAnimManager, CSimulation2 &simulation)
Definition: Model.cpp:47
Definition: SkeletonAnimManager.h:37
Definition: BoundingBoxAligned.h:35
static size_t model
Definition: x86_x64.cpp:221
CBoundingBoxAligned m_ObjectBounds
Definition: Model.h:275
~CModel()
Definition: Model.cpp:56
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:137
void RecalculateBoundsIfNecessary()
Factored out so subclasses don't need to repeat this if they want to add additional getters for bound...
Definition: RenderableObject.h:131
void CalcStaticObjectBounds()
Auxiliary method; calculates object space bounds of this model, based solely on vertex positions...
Definition: Model.cpp:130
bool m_Selectable
Definition: Model.h:76
const CModelDefPtr & GetModelDef()
Definition: Model.h:98
CMaterial & GetMaterial()
Definition: Model.h:107
CSkeletonAnim * m_Anim
Definition: Model.h:277
CMaterial m_Material
Definition: Model.h:269
void SetPlayerID(player_id_t id)
Definition: Model.cpp:663
int GetFlags() const
Definition: Model.h:122
CSimulation2 & m_Simulation
Definition: Model.h:264
CObjectEntry * m_ObjectEntry
Definition: Model.h:73
void SetFlags(int flags)
Definition: Model.h:120
const SPropPoint * m_AmmoPropPoint
The prop point to which the ammo prop is attached, or NULL if none.
Definition: Model.h:296
CSkeletonAnim * GetAnimation() const
Definition: Model.h:113
void CopyAnimationFrom(CModel *source)
Definition: Model.cpp:498
virtual void InvalidatePosition()
Mark this model's position and bone matrices, and all props' positions as invalid.
Definition: Model.cpp:311
bool m_Hidden
Should this prop be temporarily removed from rendering?
Definition: Model.h:75
Prop()
Definition: Model.h:55
float m_AnimTime
Definition: Model.h:279
Definition: ObjectEntry.h:38
void SetMaterial(const CMaterial &material)
Definition: Model.cpp:658
CModelDefPtr m_pModelDef
Definition: Model.h:271
void AddFlagsRec(int flags)
Definition: Model.cpp:627
Definition: SkeletonAnim.h:32