Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: minor cleanup

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