Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: model scaleable

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
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.