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