-
Notifications
You must be signed in to change notification settings - Fork 1
/
hitrecord.h
66 lines (50 loc) · 1.37 KB
/
hitrecord.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
#ifndef _HIT_RECORD_H_
#define _HIT_RECORD_H_
#include "common.h"
#include "vec3.h"
#include "onb.h"
namespace Renzoku {
/**
* Minimal data for visibility test and nearest intersection tracking.
*/
class GeometryHit : public BaseObject {
public:
Float t;
bool hit;
Shape *shape;
Float beta, gamma;
GeometryHit() : shape(NULL), hit(false), t(RAY_TMAX), beta(0.0f), gamma(0.0f) {
}
};
class HitRecord : public BaseObject {
public:
bool hit;
Float t, beta, gamma;
Vec3 tangent, normal;
Vec3 shading_normal;
Onb uvn;
// TODO: to use union here; we need a variable to indicate type
Material *material;
AreaLight *light;
EnvLight *env_light;
Shape *shape;
Surface *surface;
Vec2 uv; // texture coordinates
HitRecord() : material(NULL), light(NULL), env_light(NULL), shape(NULL), surface(NULL),
hit(false), t(RAY_TMAX), beta(0.0f), gamma(0.0f) {
}
/**
* Copy minimal hit info for nearest hit point tracking.
* Other info can be filled after the nearest hit point is found.
*/
void copy_geometry_hit(const GeometryHit &r) {
t = r.t;
beta = r.beta;
gamma = r.gamma;
hit = r.hit;
shape = r.shape;
}
};
typedef vector<HitRecord> HitRecords;
} // end namespace Renzoku
#endif