Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: some build-efficiency-issues

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 "model.h"
12
13
14// FORWARD DECLARATION
15class CharacterAttributes;
16class SoundEngine;
17class SoundBuffer;
18class SoundSource;
19class BVTree;
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  /** @see loadModelWithScale(const char*, float) @param fileName the File to load */
32  void loadModel(const char* fileName) { this->loadModelWithScale(fileName, 1.0); };
33  void loadModelWithScale(const char* fileName, float scaling);
34
35  bool buildObbTree(unsigned int depth);
36
37
38  //void addAbility(Ability* ability);
39  //void removeAbility(Ability* ability);
40
41  /** @param visibility if the Entity should be visible (been draw) */
42  void setVisibiliy (bool visibility) { this->bVisible = visibility; };
43  /** @returns true if the entity is visible, false otherwise */
44  bool isVisible() const { return this->bVisible; };
45
46  void setCharacterAttributes(CharacterAttributes* charAttr);
47  CharacterAttributes* getCharacterAttributes();
48
49  /** @returns a reference to the obb tree of this worldentity */
50  BVTree* getOBBTree() { return this->obbTree; };
51
52  virtual void postSpawn ();
53  virtual void leftWorld ();
54
55  virtual void hit (WorldEntity* weapon, Vector* loc);
56  virtual void collidesWith (WorldEntity* entity, const Vector& location);
57
58  /** @returns the Count of Faces on this WorldEntity */
59  virtual unsigned int getFaceCount () const { if (this->model) return this->model->getFaceCount(); else return 0; };
60
61  virtual void tick (float time);
62  virtual void draw ();
63  void drawBVTree(int depth, int drawMode);
64
65 protected:
66  Model*                  model;            //!< The model that should be loaded for this entity.
67  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
68  BVTree*                 obbTree;          //!< this is the obb tree reference needed for collision detection
69
70 private:
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.