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 | |
---|
11 | #include "glincl.h" |
---|
12 | |
---|
13 | // FORWARD DECLARATION |
---|
14 | class SoundBuffer; |
---|
15 | class SoundSource; |
---|
16 | class BVTree; |
---|
17 | class Model; |
---|
18 | |
---|
19 | //class CharacterAttributes; |
---|
20 | |
---|
21 | |
---|
22 | //! Basis-class all interactive stuff in the world is derived from |
---|
23 | class WorldEntity : public PNode |
---|
24 | { |
---|
25 | public: |
---|
26 | WorldEntity(const TiXmlElement* root = NULL); |
---|
27 | virtual ~WorldEntity (); |
---|
28 | |
---|
29 | void loadParams(const TiXmlElement* root); |
---|
30 | void loadModel(const char* fileName, float scaling = 1.0f); |
---|
31 | bool buildObbTree(unsigned int depth); |
---|
32 | |
---|
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 */ |
---|
36 | inline bool isVisible() const { return this->bVisible; }; |
---|
37 | |
---|
38 | |
---|
39 | |
---|
40 | virtual void postSpawn (); |
---|
41 | virtual void leftWorld (); |
---|
42 | |
---|
43 | virtual void tick (float time); |
---|
44 | virtual void draw () const; |
---|
45 | virtual void collidesWith (WorldEntity* entity, const Vector& location); |
---|
46 | |
---|
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; }; |
---|
50 | |
---|
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(); |
---|
57 | |
---|
58 | |
---|
59 | protected: |
---|
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 |
---|
62 | // CharacterAttributes* charAttr; //!< the character attributes of a world_entity |
---|
63 | |
---|
64 | private: |
---|
65 | bool bCollide; //!< If it should be considered for the collisiontest. |
---|
66 | bool bVisible; //!< If it should be visible. |
---|
67 | }; |
---|
68 | |
---|
69 | #endif /* _WORLD_ENTITY_H */ |
---|