Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6084 was 6005, checked in by bensch, 19 years ago

orxonox/trunk: automatic LOD-loading

File size: 2.5 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
54  virtual void draw () const;
55  void drawLODsafe() const;
56
57  virtual void collidesWith (WorldEntity* entity, const Vector& location);
58  void drawBVTree(unsigned int depth, int drawMode) const;
59
60  /* @returns the Count of Faces on this WorldEntity */
61  //unsigned int getFaceCount () const { return (this->model != NULL)?this->model->getFaceCount():0; };
62  //  void addAbility(Ability* ability);
63  //  void removeAbility(Ability* ability);
64  //  void setCharacterAttributes(CharacterAttributes* charAttr);
65  //  CharacterAttributes* getCharacterAttributes();
66
67
68 protected:
69  //  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
70
71 private:
72  std::vector<Model*>     models;            //!< The model that should be loaded for this entity.
73  BVTree*                 obbTree;          //!< this is the obb tree reference needed for collision detection
74
75  bool                    bCollide;         //!< If it should be considered for the collisiontest.
76  bool                    bVisible;         //!< If it should be visible.
77};
78
79#endif /* _WORLD_ENTITY_H */
Note: See TracBrowser for help on using the repository browser.