#ifndef MESH_ENTITY_H #define MESH_ENTITY_H #include "Prerequisites.h" #include "IEntity.h" class ModelEntity : public IEntity { public: ModelEntity( void (*SetShaderValuesFunc)(ShaderPtr& shader, ModelEntity* mesh) = NULL ); ~ModelEntity(); //inherited methods void Initialize(); void Update(float dt); void Draw(float dt); void OnLostDevice(); void OnResetDevice(); int GetID() { return mID; } void SetID(int id) { mID = id; } //new methods bool CanDraw() const { return mCanDraw; } void CanDraw(bool draw) { mCanDraw = draw; } void SetShader(const std::string& name, const std::string& path); void SetMesh(const std::string& name, const std::string& path); MeshPtr GetMesh() const {return mMesh;} void SetPosition(const D3DXVECTOR3& pos) { mPosition = pos; } void SetScale(float x, float y, float z) { mScale.x = x; mScale.y = y; mScale.z = z; } void SetScale(const D3DXVECTOR3& scale) { mScale = scale; } void SetOrientation(const D3DXQUATERNION& orient) { mOrientation = orient; } void SetWorld(const D3DXMATRIX& world) { mWorld = world; } const D3DXMATRIX& GetWorld() const { return mWorld; } const D3DXVECTOR3& GetPosition() const { return mPosition; } const D3DXVECTOR3& GetScale() const { return mScale; } const D3DXQUATERNION& GetOrientation() const { return mOrientation; } protected: void DrawShader(float dt); //function pointer to a function that is responsible for setting the shader's parameters void (*SetShaderValues)(ShaderPtr& shader, ModelEntity* mesh); MeshPtr mMesh; ShaderPtr mShader; IDirect3DDevice9Ptr mGDevice; //transformations D3DXMATRIX mWorld; D3DXVECTOR3 mPosition; D3DXVECTOR3 mScale; D3DXQUATERNION mOrientation; bool mCanDraw; private: int mID; }; #endif