-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLaboration.h
75 lines (53 loc) · 1.17 KB
/
Laboration.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef LABORATION_H
#define LABORATION_H
#include "Shapes.h"
class LPlane: public Shape
{
Vec n;
float d;
public:
void test(Ray& ray, HitData& hit);
Vec normal(Vec &point) { return n; }
LPlane(Vec normal, float _d, Color color);
};
class LSphere : public Shape
{
Vec center;
float radius;
float radius2;
public:
void test(Ray& ray, HitData& hit);
Vec normal(Vec &point);
LSphere(Vec _center, float _radius, Color _color);
};
class LTriangle : public Shape
{
Vec p1, p2, p3, nor, plane;
Vec edge0, edge1;
public:
void test(Ray& ray, HitData& hit);
Vec normal(Vec &point);
LTriangle(Vec _p1, Vec _p2, Vec _p3, Color _color);
};
class LOBB : public Shape
{
public:
Vec Bcenter;
Vec Bu, Buo;
Vec Bv, Bvo;
Vec Bw, Bwo;
Vec Pu, Puo;
Vec Pv, Pvo;
Vec Pw, Pwo;
float halfBu;
float halfBv;
float halfBw;
void test(Ray& ray, HitData& hit);
Vec normal(Vec& point);
// Center point, lenght U vector, length V vector, length W vector, color
LOBB(Vec b, Vec b1, Vec b2, Vec b3, float Hu, float Hv, float Hw, Color _color);
LOBB(Vec b, float Hu, float Hv, float Hw, Color _color);
};
float angle(Vec& v1, Vec& v2);
Vec cross(const Vec& v1, const Vec& v2);
#endif