Failed hack for collision detection with a sphere.
[hair] / src / hair.h
index 19fa82e..9ef5130 100644 (file)
@@ -4,11 +4,21 @@
 #include <gmath/gmath.h>
 
 #include "mesh.h" 
+#include "object.h"
+
+struct HairStrand {
+       Vec3 pos;
+       Vec3 velocity;
+       Vec3 spawn_pt;
+       Vec3 spawn_dir;
+};
 
 class Hair {
 private:
-       std::vector<Vec3> spawn_points;
-       std::vector<Vec3> spawn_directions;
+       float hair_length;
+       std::vector<HairStrand> hair;
+       Mat4 xform;
+       std::vector<CollSphere *> colliders;
 
 public:
        Hair();
@@ -16,6 +26,11 @@ public:
 
        bool init(const Mesh *m, int num_spawns, float thresh = 0.4);
        void draw() const;
+
+       void set_transform(Mat4 &xform);
+       void update(float dt);
+       void add_collider(CollSphere *cobj);
+       Vec3 handle_collision(const Vec3 &v) const;
 };
 
 #endif //PARTICLES_H_