Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/world_entity.h @ 5994

Last change on this file since 5994 was 5994, checked in by bensch, 18 years ago

orxonox/trunk: much cleaner Model Loading unloading, model is now private to WorldEntity (not protected)

File size: 2.3 KB
Line 
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
14class SoundBuffer;
15class SoundSource;
16class BVTree;
17class Model;
18
19//class CharacterAttributes;
20
21
22//! Basis-class all interactive stuff in the world is derived from
23class WorldEntity : public PNode
24{
25 public:
26  WorldEntity(const TiXmlElement* root = NULL);
27  virtual ~WorldEntity ();
28
29  void loadParams(const TiXmlElement* root);
30
31  void loadModel(const char* fileName, float scaling = 1.0f);
32  void setModel(Model* model, unsigned int modelNumber = 0);
33  Model* getModel(unsigned int modelNumber = 0) const { return this->model; };
34
35  bool buildObbTree(unsigned int depth);
36  /** @returns a reference to the obb tree of this worldentity */
37  BVTree* getOBBTree() const { return this->obbTree; };
38
39  /** @param visibility if the Entity should be visible (been draw) */
40  void setVisibiliy (bool visibility) { this->bVisible = visibility; };
41  /** @returns true if the entity is visible, false otherwise */
42  inline bool isVisible() const { return this->bVisible; };
43
44
45
46  virtual void postSpawn ();
47  virtual void leftWorld ();
48
49  virtual void tick (float time);
50  virtual void draw () const;
51  virtual void collidesWith (WorldEntity* entity, const Vector& location);
52
53  void drawBVTree(unsigned int depth, int drawMode) const;
54
55  /* @returns the Count of Faces on this WorldEntity */
56  //unsigned int getFaceCount () const { return (this->model != NULL)?this->model->getFaceCount():0; };
57  //  void addAbility(Ability* ability);
58  //  void removeAbility(Ability* ability);
59  //  void setCharacterAttributes(CharacterAttributes* charAttr);
60  //  CharacterAttributes* getCharacterAttributes();
61
62
63 protected:
64  //  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
65
66 private:
67  Model*                  model;            //!< The model that should be loaded for this entity.
68  BVTree*                 obbTree;          //!< this is the obb tree reference needed for collision detection
69
70  bool                    bCollide;         //!< If it should be considered for the collisiontest.
71  bool                    bVisible;         //!< If it should be visible.
72};
73
74#endif /* _WORLD_ENTITY_H */
Note: See TracBrowser for help on using the repository browser.