cloth
diff src/simworld.h @ 0:92983e143a03
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 11 Feb 2013 19:40:36 +0200 |
parents | |
children | 76d4b3e8e941 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/simworld.h Mon Feb 11 19:40:36 2013 +0200 1.3 @@ -0,0 +1,39 @@ 1.4 +#ifndef SIMWORLD_H_ 1.5 +#define SIMWORLD_H_ 1.6 + 1.7 +#include <vector> 1.8 +#include "particle.h" 1.9 +#include "vmath/vmath.h" 1.10 + 1.11 +struct Collision { 1.12 + Vector3 pos; 1.13 + Vector3 normal; 1.14 + float elast; 1.15 +}; 1.16 + 1.17 +class SimWorld { 1.18 +private: 1.19 + std::vector<Object*> objects; 1.20 + std::vector<Particle*> part; 1.21 + Vector3 grav; 1.22 + float damping; 1.23 + 1.24 +public: 1.25 + SimWorld(); 1.26 + 1.27 + void set_bounds(float xmin, float xmax, float ymin, float ymax); 1.28 + 1.29 + void set_gravity(const Vector3 &f); 1.30 + 1.31 + void add_particle(Particle *p); 1.32 + 1.33 + bool collision(const Ray &ray, float rad, Collision *col) const; 1.34 + 1.35 + void step(float dt); 1.36 + 1.37 + void draw_particles() const; 1.38 + 1.39 + friend class Particle; 1.40 +}; 1.41 + 1.42 +#endif // SIMWORLD_H_