1 | // |
---|
2 | // Orbital |
---|
3 | // |
---|
4 | // Copyright: (c) 2012 Various People |
---|
5 | // |
---|
6 | |
---|
7 | /* FIXME: this file is pure crap; it's only a test. */ |
---|
8 | |
---|
9 | #if !defined __TANK_H__ |
---|
10 | #define __TANK_H__ |
---|
11 | |
---|
12 | class Tank : public WorldEntity |
---|
13 | { |
---|
14 | public: |
---|
15 | Tank() |
---|
16 | : m_angle(0.f), |
---|
17 | m_ready(false) |
---|
18 | { |
---|
19 | m_body.SendCommand("sc0.1,0.1,0,1,ab6,6,15,ty-2,sc1,1,1,1,afcb4,5,16,0.4,tx4,mx,fl,sc0.2,0.7,0,1,afcb8,7,10,0.4,tz-4,fl"); |
---|
20 | m_head.SendCommand("sc0.2,0.7,0,1,afcb3,6,10,0.4,tx-8,afcb3,6,10,0.4,tx4,ty10,fl,sc1,1,1,1,afcb3,6,10,0.4,rx-30,ty10,fl"); |
---|
21 | } |
---|
22 | |
---|
23 | ~Tank() |
---|
24 | { |
---|
25 | } |
---|
26 | |
---|
27 | char const *GetName() { return "<tank>"; } |
---|
28 | |
---|
29 | protected: |
---|
30 | virtual void TickGame(float seconds) |
---|
31 | { |
---|
32 | WorldEntity::TickGame(seconds); |
---|
33 | |
---|
34 | m_angle += seconds * 50.f; |
---|
35 | } |
---|
36 | |
---|
37 | virtual void TickDraw(float seconds) |
---|
38 | { |
---|
39 | WorldEntity::TickDraw(seconds); |
---|
40 | |
---|
41 | if (!m_ready) |
---|
42 | { |
---|
43 | m_body.SendCommand("irb"); |
---|
44 | m_head.SendCommand("irb"); |
---|
45 | m_ready = true; |
---|
46 | } |
---|
47 | |
---|
48 | mat4 model = mat4::translate(m_position); |
---|
49 | |
---|
50 | m_body.Render(model); |
---|
51 | |
---|
52 | model = model * mat4::rotate(m_angle, vec3(0, 1, 0)); |
---|
53 | m_head.Render(model); |
---|
54 | } |
---|
55 | |
---|
56 | private: |
---|
57 | Mesh m_body, m_head; |
---|
58 | float m_angle; |
---|
59 | bool m_ready; |
---|
60 | }; |
---|
61 | |
---|
62 | #endif /* __TANK_H__ */ |
---|
63 | |
---|