ComputerGraphik TU WIEN
tank.hpp
Go to the documentation of this file.
1 #ifndef TANK_HPP
2 #define TANK_HPP
3 
4 #include "sceneObject.hpp"
5 
6 class GameLogic;
9 
11 
15 class Tank : public SceneObject {
16 public:
17  class Gun : public SceneObject
18  {
19  public:
20  Gun(const std::string& name, Scene* scene = 0, Model* model = 0, const glm::mat4& modelMatrix = glm::mat4(1));
21  virtual ~Gun();
22 
23  bool animate(double time);
24  void update(double deltaT);
25 
26  private:
27  double lastAnimate;
28  };
29 
30  class Turret : public SceneObject
31  {
32  public:
33  Turret(const std::string& name, Scene* scene = 0, Model* model = 0, const glm::mat4& modelMatrix = glm::mat4(1));
34  virtual ~Turret();
35 
36  void update(double deltaT);
37  };
38 
39 public:
40  Tank(const std::string& name, Scene* scene = 0, Model* model = 0, const glm::mat4& modelMatrix = glm::mat4(1));
41  virtual ~Tank();
42 
43  void reset();
44  bool animate(double time);
45  void update(double deltaT);
46 
47  double getHP() const { return hp; }
48  void setHP(double val) { hp = val; }
49 
50  bool getActive() const { return active; }
51  void setActive(bool val) { active = val; }
52 
53  glm::mat4 getShootOrigin() const;
54 
55 private:
56  double hp;
57  bool active;
58  double lastCPU;
59  double lastGPU;
60 
61  std::shared_ptr<SceneObject> gun;
62  std::shared_ptr<SceneObject> turret;
63  std::shared_ptr<SceneObject> trackL;
64  std::shared_ptr<SceneObject> trackR;
65  std::shared_ptr<SceneObject> shootOrigin;
66 
67  std::shared_ptr<GameLogic> gameLogic;
68  std::shared_ptr<ParticleSystemCPU> psCPU;
69  std::shared_ptr<ParticleSystemGPU> psGPU;
70 };
71 
72 #endif //TANK_HPP
void reset()
Definition: tank.cpp:27
void update(double deltaT)
Definition: tank.cpp:185
double lastCPU
Definition: tank.hpp:58
std::shared_ptr< SceneObject > trackL
Definition: tank.hpp:63
Encapsulates a graphical object model in the GPU.
Definition: model.hpp:14
std::shared_ptr< SceneObject > turret
Definition: tank.hpp:62
Definition: tank.hpp:17
Gun(const std::string &name, Scene *scene=0, Model *model=0, const glm::mat4 &modelMatrix=glm::mat4(1))
Definition: tank.cpp:160
std::shared_ptr< ParticleSystemGPU > psGPU
Definition: tank.hpp:69
std::shared_ptr< SceneObject > gun
Definition: tank.hpp:61
void setActive(bool val)
Definition: tank.hpp:51
Model * model
Definition: sceneObject.hpp:69
Tank(const std::string &name, Scene *scene=0, Model *model=0, const glm::mat4 &modelMatrix=glm::mat4(1))
Definition: tank.cpp:12
double lastAnimate
Definition: tank.hpp:27
bool animate(double time)
Definition: tank.cpp:172
glm::mat4 getShootOrigin() const
Definition: tank.cpp:151
Implementation of GPU particle system.
Definition: particleSystemGPU.hpp:26
void update(double deltaT)
Definition: tank.cpp:67
double lastGPU
Definition: tank.hpp:59
Turret(const std::string &name, Scene *scene=0, Model *model=0, const glm::mat4 &modelMatrix=glm::mat4(1))
Definition: tank.cpp:210
void setHP(double val)
Definition: tank.hpp:48
std::shared_ptr< SceneObject > trackR
Definition: tank.hpp:64
Encapsulates the Rendering Engine, holds a complete scene and it's assets.
Definition: scene.hpp:71
Scene * scene
Definition: sceneObject.hpp:68
std::shared_ptr< GameLogic > gameLogic
Definition: tank.hpp:67
std::shared_ptr< ParticleSystemCPU > psCPU
Definition: tank.hpp:68
Definition: tank.hpp:30
virtual ~Turret()
Definition: tank.cpp:216
std::string name
Definition: sceneObject.hpp:73
glm::mat4 modelMatrix
Definition: sceneObject.hpp:71
Implementation of CPU particle system.
Definition: particleSystemCPU.hpp:22
bool getActive() const
Definition: tank.hpp:50
virtual ~Tank()
Definition: tank.cpp:22
The base class of the objects which are rendered.
Definition: sceneObject.hpp:30
Implements the tank functionalities.
Definition: tank.hpp:15
double getHP() const
Definition: tank.hpp:47
bool animate(double time)
Definition: tank.cpp:120
std::shared_ptr< SceneObject > shootOrigin
Definition: tank.hpp:65
bool active
Definition: tank.hpp:57
void update(double deltaT)
Definition: tank.cpp:221
virtual ~Gun()
Definition: tank.cpp:167
double hp
Definition: tank.hpp:56
Implements the game logic of SteelWorms.
Definition: gameLogic.hpp:75