fixed materials etc (not all), improvements
[hair] / src / hair.h
1 #ifndef PARTICLES_H_
2 #define PARTICLES_H_
3
4 #include <gmath/gmath.h>
5
6 #include "mesh.h" 
7 #include "object.h"
8
9 struct HairStrand {
10         Vec3 pos;
11         Vec3 velocity;
12         Vec3 spawn_pt;
13         Vec3 spawn_dir;
14 };
15
16 class Hair {
17 private:
18         float hair_length;
19         std::vector<HairStrand> hair;
20         Mat4 xform;
21         std::vector<CollSphere *> colliders;
22
23 public:
24         Hair();
25         ~Hair();
26
27         bool init(const Mesh *m, int num_spawns, float thresh = 0.4);
28         void draw() const;
29
30         void set_transform(Mat4 &xform);
31         void update(float dt);
32         void add_collider(CollSphere *cobj);
33         Vec3 handle_collision(const Vec3 &v) const;
34 };
35
36 #endif //PARTICLES_H_
37