added forces + damping, k factors
[hair] / src / hair.h
1 #ifndef PARTICLES_H_
2 #define PARTICLES_H_
3
4 #include <gmath/gmath.h>
5
6 #include "mesh.h" 
7
8 struct HairStrand {
9         Vec3 pos;
10         Vec3 velocity;
11         /* directions relative to the spawn point */
12         Vec3 anchor_dirs[3];
13         Vec3 spawn_pt;
14         Vec3 spawn_dir;
15 };
16
17 class Hair {
18 private:
19         float hair_length;
20         std::vector<HairStrand> hair;
21         Mat4 xform;
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 };
33
34 #endif //PARTICLES_H_
35