aboutsummaryrefslogtreecommitdiff
path: root/sons_of_sol/AIShip.hpp
blob: d54c2bf32456af80cd4ce70f78420bbacf699cb9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef AISHIP_HPP_
#define AISHIP_HPP_

/*
 * Author: jrahm
 * created: 2013/12/07
 * AIShip.hpp: <description>
 */

#include "glox/GloxCommon.hpp"
#include "glox/GloxState.hpp"
#include "glox/objects/GloxCube.hpp"
#include "slox/loader/SloxModelObject.hpp"

#include "glox/GloxPoint.hpp"
#include "slox/SloxCommon.hpp"

class AIShip {
 public:
  class Updater {
   public:
    virtual glox::GloxPoint<> update(uint32_t) = 0;
  };
  inline AIShip(Updater* update = NULL)
      : update_func(update), m_roll(0), m_roll_to(0) {}

  void update();

  void draw(float dist);

  void setTimeOffset(uint32_t off);

  inline void setUpdateFunction(Updater* updater);

  static void setModel(slox::SloxModelObject* high, slox::SloxModelObject* med,
                       slox::SloxModelObject* low);

  inline const glox::GloxPoint<>& getPosition() { return m_position; }

 private:
  Updater* update_func;

  void calculate_roll_to();

  float m_ptich;
  float m_yaw;
  float m_roll;

  float m_roll_to;
  float m_weight;
  uint32_t m_time_offset;

  glox::GloxPoint<> m_position;
  glox::GloxPoint<> m_last_position;
  glox::GloxPoint<> m_future_position;

  static slox::SloxModelObject* s_high_model;
  static slox::SloxModelObject* s_med_model;
  static slox::SloxModelObject* s_low_model;

  static glox::GloxCube* s_really_far_away_model;
};

#endif /* AISHIP_HPP_ */