Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/world_entities/world_entity.h @ 6081

Last change on this file since 6081 was 5996, checked in by patrick, 18 years ago

orxonox/trunk: merged network branche into trunk with command svn merge -r 5824:HEAD

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