-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRay.h
62 lines (49 loc) · 1.32 KB
/
Ray.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
#pragma once
#include "LocalFrame.h"
class SceneObject;
class Ray
{
public:
enum SampleType{DEFINITE, RANDOM};
enum PhotonType{INVOL, OUTVOL, NOUSE, HITVOL};
SampleType originSampleType;
SampleType directionSampleType;
vec3f origin;
vec3f direction; // EndRay if length < 0.5
vec3f color;
float directionProb;
float originProb;
float photonProb;
PhotonType photonType;
SceneObject* insideObject;
SceneObject* contactObject;
unsigned contactObjectTriangleID;
int current_tid, intersect_tid;
int pixelID;
// filled outside scatter()
SceneObject* intersectObject;
unsigned intersectObjectTriangleID;
float intersectDist;
Ray()
{
photonType = OUTVOL;
insideObject = intersectObject = contactObject = NULL;
color = vec3f(1, 1, 1);
directionProb = 1;
originProb = 1;
photonProb = 1;
originSampleType = DEFINITE;
directionSampleType = RANDOM;
pixelID = -1;
current_tid = -1;
intersect_tid = -1;
intersectDist = -1;
}
vec3f getRadianceDecay(const float& dist) const;
vec3f getBSDF(const Ray& outRay) const;
float getCosineTerm(bool flat = false) const;
float getDirectionSampleProbDensity(const Ray& outRay) const;
float getOriginSampleProbDensity(const Ray& outRay) const;
float getContinueSampleProbDensity(const Ray& outRay) const;
vec3f getContactNormal(bool flat = false) const;
};