-
Notifications
You must be signed in to change notification settings - Fork 0
/
HitRecord.hh
50 lines (38 loc) · 1.07 KB
/
HitRecord.hh
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
/*
Author: dok
Desc: Hit Record, contains information about ray/object intersections
*/
#ifndef HitRecord_hh
#define HitRecord_hh
#include "Primitive.hh"
#include "Material.hh"
#include <limits>
// big awesome comment here
class HitRecord{
private:
float t;
Primitive* primitive;
Material* material;
public:
/*----------------- Constructors ------------*/
HitRecord(){
t = std::numeric_limits<float>::infinity();
primitive = NULL;
material = NULL;
}
/*------------------- Accessors -------------*/
float GetT(){ return t; }
Primitive* GetPrimitive(){ return primitive; }
Material* GetMaterial(){ return material; }
/*------------------- Hit Record Functions ---------*/
bool Hit(float t, const Primitive* hit_primitive, const Material* hit_material){
if(this->t > t){
this->t = t;
this->primitive = (Primitive*)hit_primitive;
this->material = (Material*)hit_material;
return true;
}
return false;
}
};
#endif