erebus
view 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 |
line source
1 #ifndef GEOMOBJ_H_
2 #define GEOMOBJ_H_
4 #include "object.h"
5 #include "brdf.h"
7 class GeomObject : public Object {
8 public:
9 Reflectance *brdf;
11 ObjType get_type() const override;
13 bool intersect(const Ray &ray, RayHit *hit = 0) const override;
14 };
16 class Sphere : public GeomObject {
17 public:
18 bool intersect(const Ray &ray, RayHit *hit = 0) const override;
19 };
21 class Box : public GeomObject {
22 public:
23 bool intersect(const Ray &ray, RayHit *hit = 0) const override;
24 };
26 class Triangle : public GeomObject {
27 public:
28 Vector3 v[3];
29 Vector3 normal;
30 Vector3 vnorm[3];
31 Vector2 vtex[3];
33 bool intersect(const Ray &ray, RayHit *hit = 0) const override;
34 };
36 class Mesh : public GeomObject {
37 private:
38 std::vector<Triangle> faces;
40 public:
41 void begin();
42 void vertex(float x, float y, float z);
43 void normal(float x, float y, float z);
44 void texcoord(float u, float v);
45 void end();
47 bool intersect(const Ray &ray, RayHit *hit = 0) const override;
48 };
50 #endif // GEOMOBJ_H_