cloth2

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/object.h	Mon Jan 11 16:51:16 2016 +0200
     1.3 @@ -0,0 +1,37 @@
     1.4 +#ifndef OBJECT_H_
     1.5 +#define OBJECT_H_
     1.6 +
     1.7 +#include <gmath/gmath.h>
     1.8 +
     1.9 +using namespace gph;
    1.10 +
    1.11 +class Object;
    1.12 +
    1.13 +struct HitPoint {
    1.14 +	float t;
    1.15 +	Vector3 pos, normal;
    1.16 +	Ray ray;
    1.17 +	Object *obj;
    1.18 +};
    1.19 +
    1.20 +class Object {
    1.21 +public:
    1.22 +	virtual ~Object();
    1.23 +
    1.24 +	virtual bool intersect(const Ray &ray, HitPoint *pt) const = 0;
    1.25 +	virtual void draw() const = 0;
    1.26 +};
    1.27 +
    1.28 +class Triangle : public Object {
    1.29 +public:
    1.30 +	Vector3 v[3];
    1.31 +	Vector3 normal;
    1.32 +
    1.33 +	Triangle();
    1.34 +	Triangle(const Vector3 &a, const Vector3 &b, const Vector3 &c);
    1.35 +
    1.36 +	virtual bool intersect(const Ray &ray, HitPoint *pt) const;
    1.37 +	virtual void draw() const;
    1.38 +};
    1.39 +
    1.40 +#endif