erebus

view liberebus/src/geomobj.h @ 3:a932848de652

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