cloth2

view src/object.h @ 0:ef0c22554406

cloth sim test, initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 11 Jan 2016 16:51:16 +0200
parents
children
line source
1 #ifndef OBJECT_H_
2 #define OBJECT_H_
4 #include <gmath/gmath.h>
6 using namespace gph;
8 class Object;
10 struct HitPoint {
11 float t;
12 Vector3 pos, normal;
13 Ray ray;
14 Object *obj;
15 };
17 class Object {
18 public:
19 virtual ~Object();
21 virtual bool intersect(const Ray &ray, HitPoint *pt) const = 0;
22 virtual void draw() const = 0;
23 };
25 class Triangle : public Object {
26 public:
27 Vector3 v[3];
28 Vector3 normal;
30 Triangle();
31 Triangle(const Vector3 &a, const Vector3 &b, const Vector3 &c);
33 virtual bool intersect(const Ray &ray, HitPoint *pt) const;
34 virtual void draw() const;
35 };
37 #endif