1 | /*! |
---|
2 | * @file world_entity.h |
---|
3 | * Definition of the basic WorldEntity |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _WORLD_ENTITY_H |
---|
7 | #define _WORLD_ENTITY_H |
---|
8 | |
---|
9 | #include "p_node.h" |
---|
10 | #include "model.h" |
---|
11 | |
---|
12 | // FORWARD DECLARATION |
---|
13 | class SoundBuffer; |
---|
14 | class SoundSource; |
---|
15 | class BVTree; |
---|
16 | |
---|
17 | //class CharacterAttributes; |
---|
18 | |
---|
19 | |
---|
20 | //! Basis-class all interactive stuff in the world is derived from |
---|
21 | class WorldEntity : public PNode |
---|
22 | { |
---|
23 | public: |
---|
24 | WorldEntity(const TiXmlElement* root = NULL); |
---|
25 | virtual ~WorldEntity (); |
---|
26 | |
---|
27 | void loadParams(const TiXmlElement* root); |
---|
28 | |
---|
29 | /** @see loadModelWithScale(const char*, float) @param fileName the File to load */ |
---|
30 | void loadModel(const char* fileName, float scaling = 1.0f); |
---|
31 | |
---|
32 | bool buildObbTree(unsigned int depth); |
---|
33 | |
---|
34 | |
---|
35 | //void addAbility(Ability* ability); |
---|
36 | //void removeAbility(Ability* ability); |
---|
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; }; |
---|
42 | |
---|
43 | // void setCharacterAttributes(CharacterAttributes* charAttr); |
---|
44 | // CharacterAttributes* getCharacterAttributes(); |
---|
45 | |
---|
46 | /** @returns a reference to the obb tree of this worldentity */ |
---|
47 | BVTree* getOBBTree() { return this->obbTree; }; |
---|
48 | |
---|
49 | virtual void postSpawn (); |
---|
50 | virtual void leftWorld (); |
---|
51 | |
---|
52 | virtual void tick (float time); |
---|
53 | virtual void draw () const; |
---|
54 | virtual void collidesWith (WorldEntity* entity, const Vector& location); |
---|
55 | |
---|
56 | |
---|
57 | /** @returns the Count of Faces on this WorldEntity */ |
---|
58 | virtual unsigned int getFaceCount () const { if (this->model) return this->model->getFaceCount(); else return 0; }; |
---|
59 | |
---|
60 | void drawBVTree(unsigned int depth, int drawMode) const; |
---|
61 | |
---|
62 | protected: |
---|
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 |
---|
65 | // CharacterAttributes* charAttr; //!< the character attributes of a world_entity |
---|
66 | |
---|
67 | private: |
---|
68 | bool bCollide; //!< If it should be considered for the collisiontest. |
---|
69 | bool bVisible; //!< If it should be visible. |
---|
70 | }; |
---|
71 | |
---|
72 | #endif /* _WORLD_ENTITY_H */ |
---|