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