22 #ifndef INCLUDED_MODEL
23 #define INCLUDED_MODEL
40 #define MODELFLAG_CASTSHADOWS (1<<0)
41 #define MODELFLAG_NOLOOPANIMATION (1<<1)
42 #define MODELFLAG_SILHOUETTE_DISPLAY (1<<2)
43 #define MODELFLAG_SILHOUETTE_OCCLUDER (1<<3)
44 #define MODELFLAG_IGNORE_LOS (1<<4)
45 #define MODELFLAG_FILTERED (1<<5) // used internally by renderer
133 for (
size_t i=0;i<
m_Props.size();i++) {
134 m_Props[i].m_Model->SetDirtyRec(dirtyflags);
140 for (
size_t i = 0; i <
m_Props.size(); ++i)
141 m_Props[i].m_Model->SetTerrainDirty(i0, j0, i1, j1);
146 for (
size_t i = 0; i <
m_Props.size(); ++i)
147 m_Props[i].m_Model->SetEntityVariable(name, value);
CSkeletonAnimManager & m_SkeletonAnimManager
void HideAmmoProp()
Hide the ammo prop (if any), and show any other props on that prop point.
Describes the position of a prop point within its parent model.
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...
CMatrix3D * m_BoneMatrices
Current state of all bones on this model; null if associated modeldef isn't skeletal.
virtual const CBoundingBoxAligned GetWorldBoundsRec()
Returns world space bounds of this object and all child objects.
std::vector< Prop > m_Props
void UpdateTo(float time)
const std::vector< Prop > & GetProps() const
bool m_PositionValid
True if both transform and and bone matrices are valid.
std::vector< Prop > & GetProps()
Public API for simulation system.
int32_t player_id_t
valid player IDs are non-negative (see ICmpOwnership)
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...
bool SetAnimation(CSkeletonAnim *anim, bool once=false)
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
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.
bool IsSkinned()
Return whether this is a skinned/skeletal model.
bool InitModel(const CModelDefPtr &modeldef)
void ShowAmmoProp()
Show the ammo prop (if any), and hide any other props on that prop point.
virtual CModelAbstract * Clone() const
virtual void ValidatePosition()
Ensure that both the transformation and the bone matrices are correct for this model and all its prop...
CModelAbstract * m_Model
Pointer to the model associated with this prop.
void SetDirty(u32 dirtyflags)
virtual void SetTransform(const CMatrix3D &transform)
Set transform of this object.
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.
size_t m_AmmoLoadedProp
If m_AmmoPropPoint is not NULL, then the index in m_Props of the ammo prop.
virtual const CBoundingBoxAligned GetObjectSelectionBoundsRec()
Reimplemented here since proper models should participate in selection boxes.
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.
virtual CModel * ToCModel()
Dynamic cast.
void CalcAnimatedObjectBounds(CSkeletonAnimDef *anim, CBoundingBoxAligned &result)
Auxiliary method; calculate object-space bounds encompassing all vertex positions for given animation...
virtual void SetDirtyRec(int dirtyflags)
Calls SetDirty on this model and all child objects.
CModelAbstract * FindFirstAmmoProp()
Find the first prop used for ammo, by this model or its own props.
const CBoundingBoxAligned & GetObjectBounds()
Returns the object-space bounds for this model, excluding its children.
const SPropPoint * m_Point
Location of the prop point within its parent model, relative to either a bone in the parent model or ...
Abstract base class for graphical objects that are used by units, or as props attached to other CMode...
CModel(CSkeletonAnimManager &skeletonAnimManager, CSimulation2 &simulation)
CBoundingBoxAligned m_ObjectBounds
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.
void RecalculateBoundsIfNecessary()
Factored out so subclasses don't need to repeat this if they want to add additional getters for bound...
void CalcStaticObjectBounds()
Auxiliary method; calculates object space bounds of this model, based solely on vertex positions...
const CModelDefPtr & GetModelDef()
CMaterial & GetMaterial()
void SetPlayerID(player_id_t id)
CSimulation2 & m_Simulation
CObjectEntry * m_ObjectEntry
const SPropPoint * m_AmmoPropPoint
The prop point to which the ammo prop is attached, or NULL if none.
CSkeletonAnim * GetAnimation() const
void CopyAnimationFrom(CModel *source)
virtual void SetShadingColor(const CColor &colour)
virtual void InvalidatePosition()
Mark this model's position and bone matrices, and all props' positions as invalid.
bool m_Hidden
Should this prop be temporarily removed from rendering?
void SetMaterial(const CMaterial &material)
boost::shared_ptr< CModelDef > CModelDefPtr
void AddFlagsRec(int flags)