erebus

view liberebus/src/geomobj.h @ 4:93894c232d65

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