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