[4680] | 1 | /*! |
---|
[4885] | 2 | * @file world_entity.h |
---|
| 3 | * Definition of the basic WorldEntity |
---|
[2190] | 4 | */ |
---|
[2036] | 5 | |
---|
[3224] | 6 | #ifndef _WORLD_ENTITY_H |
---|
| 7 | #define _WORLD_ENTITY_H |
---|
[2036] | 8 | |
---|
[3365] | 9 | #include "p_node.h" |
---|
[4680] | 10 | #include "model.h" |
---|
[2036] | 11 | |
---|
[4885] | 12 | // FORWARD DECLARATION |
---|
[4504] | 13 | class SoundBuffer; |
---|
| 14 | class SoundSource; |
---|
[5143] | 15 | class BVTree; |
---|
[4504] | 16 | |
---|
[5498] | 17 | //class CharacterAttributes; |
---|
[4682] | 18 | |
---|
[5498] | 19 | |
---|
[4885] | 20 | //! Basis-class all interactive stuff in the world is derived from |
---|
[3365] | 21 | class WorldEntity : public PNode |
---|
[4680] | 22 | { |
---|
[2036] | 23 | public: |
---|
[4261] | 24 | WorldEntity(const TiXmlElement* root = NULL); |
---|
[3221] | 25 | virtual ~WorldEntity (); |
---|
[3365] | 26 | |
---|
[4261] | 27 | void loadParams(const TiXmlElement* root); |
---|
[3531] | 28 | |
---|
[5057] | 29 | /** @see loadModelWithScale(const char*, float) @param fileName the File to load */ |
---|
[5499] | 30 | void loadModel(const char* fileName, float scaling = 1.0f); |
---|
[5498] | 31 | |
---|
[5061] | 32 | bool buildObbTree(unsigned int depth); |
---|
[5057] | 33 | |
---|
[5061] | 34 | |
---|
[2190] | 35 | //void addAbility(Ability* ability); |
---|
| 36 | //void removeAbility(Ability* ability); |
---|
[4885] | 37 | |
---|
| 38 | /** @param visibility if the Entity should be visible (been draw) */ |
---|
| 39 | void setVisibiliy (bool visibility) { this->bVisible = visibility; }; |
---|
| 40 | /** @returns true if the entity is visible, false otherwise */ |
---|
| 41 | bool isVisible() const { return this->bVisible; }; |
---|
[5026] | 42 | |
---|
[5498] | 43 | // void setCharacterAttributes(CharacterAttributes* charAttr); |
---|
| 44 | // CharacterAttributes* getCharacterAttributes(); |
---|
[3583] | 45 | |
---|
[5026] | 46 | /** @returns a reference to the obb tree of this worldentity */ |
---|
[5143] | 47 | BVTree* getOBBTree() { return this->obbTree; }; |
---|
[5026] | 48 | |
---|
[3229] | 49 | virtual void postSpawn (); |
---|
[3583] | 50 | virtual void leftWorld (); |
---|
| 51 | |
---|
[5501] | 52 | virtual void tick (float time); |
---|
| 53 | virtual void draw () const; |
---|
[5029] | 54 | virtual void collidesWith (WorldEntity* entity, const Vector& location); |
---|
[3365] | 55 | |
---|
[5501] | 56 | |
---|
[4836] | 57 | /** @returns the Count of Faces on this WorldEntity */ |
---|
[4746] | 58 | virtual unsigned int getFaceCount () const { if (this->model) return this->model->getFaceCount(); else return 0; }; |
---|
[4680] | 59 | |
---|
[5501] | 60 | void drawBVTree(unsigned int depth, int drawMode) const; |
---|
[4680] | 61 | |
---|
[3583] | 62 | protected: |
---|
[4885] | 63 | Model* model; //!< The model that should be loaded for this entity. |
---|
| 64 | BVTree* obbTree; //!< this is the obb tree reference needed for collision detection |
---|
[5498] | 65 | // CharacterAttributes* charAttr; //!< the character attributes of a world_entity |
---|
[4680] | 66 | |
---|
[2036] | 67 | private: |
---|
[4885] | 68 | bool bCollide; //!< If it should be considered for the collisiontest. |
---|
| 69 | bool bVisible; //!< If it should be visible. |
---|
[2036] | 70 | }; |
---|
| 71 | |
---|
[3224] | 72 | #endif /* _WORLD_ENTITY_H */ |
---|