/*! * @file world_entity.h * Definition of the basic WorldEntity */ #ifndef _WORLD_ENTITY_H #define _WORLD_ENTITY_H #include "p_node.h" #include "model.h" // FORWARD DECLARATION class CharacterAttributes; class SoundEngine; class SoundBuffer; class SoundSource; class BVTree; //! Basis-class all interactive stuff in the world is derived from class WorldEntity : public PNode { public: WorldEntity(const TiXmlElement* root = NULL); virtual ~WorldEntity (); void loadParams(const TiXmlElement* root); /** @see loadModelWithScale(const char*, float) @param fileName the File to load */ void loadModel(const char* fileName) { this->loadModelWithScale(fileName, 1.0); }; void loadModelWithScale(const char* fileName, float scaling); bool buildObbTree(unsigned int depth); //void addAbility(Ability* ability); //void removeAbility(Ability* ability); /** @param visibility if the Entity should be visible (been draw) */ void setVisibiliy (bool visibility) { this->bVisible = visibility; }; /** @returns true if the entity is visible, false otherwise */ bool isVisible() const { return this->bVisible; }; void setCharacterAttributes(CharacterAttributes* charAttr); CharacterAttributes* getCharacterAttributes(); /** @returns a reference to the obb tree of this worldentity */ BVTree* getOBBTree() { return this->obbTree; }; virtual void postSpawn (); virtual void leftWorld (); virtual void hit (WorldEntity* weapon, Vector* loc); virtual void collidesWith (WorldEntity* entity, const Vector& location); /** @returns the Count of Faces on this WorldEntity */ virtual unsigned int getFaceCount () const { if (this->model) return this->model->getFaceCount(); else return 0; }; virtual void tick (float time); virtual void draw (); void drawBVTree(unsigned int depth, int drawMode); protected: Model* model; //!< The model that should be loaded for this entity. CharacterAttributes* charAttr; //!< the character attributes of a world_entity BVTree* obbTree; //!< this is the obb tree reference needed for collision detection private: bool bCollide; //!< If it should be considered for the collisiontest. bool bVisible; //!< If it should be visible. }; #endif /* _WORLD_ENTITY_H */