-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhitrecord.cpp
More file actions
48 lines (39 loc) · 788 Bytes
/
hitrecord.cpp
File metadata and controls
48 lines (39 loc) · 788 Bytes
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
#include "hitrecord.h"
#include "utility.h"
QVector3D HitRecord::pointsInRange() const
{
return _pointsInRange;
}
void HitRecord::setPointsInRange(const QVector3D& p)
{
_pointsInRange = p;
}
QVector3D HitRecord::normal() const
{
return _normal;
}
void HitRecord::setInRange(double t)
{
_inRange = t;
}
double HitRecord::inRange() const
{
return _inRange;
}
bool HitRecord::frontFace() const
{
return _frontFace;
}
void HitRecord::setFaceNormal(const Ray& r, const QVector3D& outwardNormal)
{
_frontFace = Utility::dot(r.direction(), outwardNormal) < 0;
_normal = _frontFace ? outwardNormal :-outwardNormal;
}
AbstractMaterial* HitRecord::material()
{
return _material;
}
void HitRecord::setMaterial(AbstractMaterial* m)
{
_material = m;
}