Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: preparations for LOD's

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