ld33_umonster

view src/dragon.h @ 10:1b30bd381667

sweep curve mesh gen and dragon horns
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 27 Aug 2015 05:25:04 +0300
parents 3b4460b34d43
children
line source
1 #ifndef DRAGON_H_
2 #define DRAGON_H_
4 #include "vmath/vmath.h"
5 #include "mesh.h"
6 #include "metasurf.h"
8 struct Capsule {
9 Vector3 p[2];
10 float w[2];
11 };
13 struct DynVertex {
14 float x, y, z;
15 float nx, ny, nz;
16 };
18 class Dragon {
19 private:
20 Vector3 pos, dir;
21 Vector3 head_pos, target;
22 float head_xlim[2], head_ylim[2];
24 struct metasurface *msurf;
26 public:
27 Dragon();
28 ~Dragon();
30 void set_position(const Vector3 &p);
31 void set_direction(const Vector3 &dir);
32 void set_target(const Vector3 &p);
34 void set_head_limits(float xmin, float xmax, float ymin, float ymax);
35 void move_head(const Vector3 &p);
36 void move_head(float dx, float dy);
37 const Vector3 &head_position() const;
38 Vector3 breath_dir() const;
40 void update();
41 void draw() const;
43 // implementation details, must be public for the msurf callbacks
44 Capsule *neck_seg;
45 int neck_seg_count;
46 DynVertex *dyn_varr;
47 mutable int dyn_vidx;
48 unsigned int dyn_vbo;
50 void flush_dynvbo() const;
51 };
53 #endif // DRAGON_H_