erebus

annotate liberebus/src/geomobj.h @ 0:4abdce1361b9

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 27 Apr 2014 16:02:47 +0300
parents
children 474a0244f57d
rev   line source
nuclear@0 1 #ifndef GEOMOBJ_H_
nuclear@0 2 #define GEOMOBJ_H_
nuclear@0 3
nuclear@0 4 #include "object.h"
nuclear@0 5 #include "brdf.h"
nuclear@0 6
nuclear@0 7 class GeomObject : public Object {
nuclear@0 8 public:
nuclear@0 9 Reflectance *brdf;
nuclear@0 10
nuclear@0 11 ObjType get_type() const override;
nuclear@0 12
nuclear@0 13 bool intersect(const Ray &ray, RayHit *hit = 0) const override;
nuclear@0 14 };
nuclear@0 15
nuclear@0 16 class Sphere : public GeomObject {
nuclear@0 17 public:
nuclear@0 18 bool intersect(const Ray &ray, RayHit *hit = 0) const override;
nuclear@0 19 };
nuclear@0 20
nuclear@0 21 class Box : public GeomObject {
nuclear@0 22 public:
nuclear@0 23 bool intersect(const Ray &ray, RayHit *hit = 0) const override;
nuclear@0 24 };
nuclear@0 25
nuclear@0 26 class Triangle : public GeomObject {
nuclear@0 27 public:
nuclear@0 28 Vector3 v[3];
nuclear@0 29 Vector3 normal;
nuclear@0 30 Vector3 vnorm[3];
nuclear@0 31 Vector2 vtex[3];
nuclear@0 32
nuclear@0 33 bool intersect(const Ray &ray, RayHit *hit = 0) const override;
nuclear@0 34 };
nuclear@0 35
nuclear@0 36 class Mesh : public GeomObject {
nuclear@0 37 private:
nuclear@0 38 std::vector<Triangle> faces;
nuclear@0 39
nuclear@0 40 public:
nuclear@0 41 void begin();
nuclear@0 42 void vertex(float x, float y, float z);
nuclear@0 43 void normal(float x, float y, float z);
nuclear@0 44 void texcoord(float u, float v);
nuclear@0 45 void end();
nuclear@0 46
nuclear@0 47 bool intersect(const Ray &ray, RayHit *hit = 0) const override;
nuclear@0 48 };
nuclear@0 49
nuclear@0 50 #endif // GEOMOBJ_H_