cloth

view src/simworld.h @ 3:28a31079dcdf

disc
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 04 Jan 2016 10:52:15 +0200
parents 2eac424f58b2
children
line source
1 #ifndef SIMWORLD_H_
2 #define SIMWORLD_H_
4 #include <vector>
5 #include "particle.h"
6 #include "vmath/vmath.h"
7 #include "object.h"
9 struct Collision {
10 float dist;
11 Vector3 pos;
12 Vector3 normal;
13 float elast;
14 };
16 class SimWorld {
17 private:
18 std::vector<Object*> objects;
19 std::vector<Particle*> part;
20 Vector3 grav;
21 float damping;
23 public:
24 SimWorld();
26 void set_gravity(const Vector3 &f);
28 void add_object(Object *o);
29 int get_object_count() const;
30 Object *get_object(int idx) const;
32 void add_particle(Particle *p);
34 bool collision(const Ray &ray, float rad, Collision *col) const;
36 void step(float dt);
38 void draw_particles() const;
40 friend class Particle;
41 };
43 #endif // SIMWORLD_H_