Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: buildObbTree-function added to WorldEntity

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