-
Notifications
You must be signed in to change notification settings - Fork 0
/
ray.h
36 lines (30 loc) · 824 Bytes
/
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
#pragma once
#include "redner.h"
#include "vector.h"
#include "cuda_utils.h"
#include <limits>
template <typename T>
struct TRay {
DEVICE TRay() {}
template <typename T2>
DEVICE
TRay(const TVector3<T2> &org, const TVector3<T2> &dir, T2 tmin = 1e-3f)
: org(org), tmin(T(1e-3)), dir(dir), tmax(infinity<T>()) {}
template <typename T2>
DEVICE
TRay(const TRay<T2> &ray)
: org(ray.org), tmin(ray.tmin), dir(ray.dir), tmax(ray.tmax) {}
// if T == float this exactly matches OptiX prime's ray format
TVector3<T> org;
T tmin;
TVector3<T> dir;
T tmax;
};
template <typename T>
struct DTRay {
TVector3<T> org = TVector3<T>{0, 0, 0};
TVector3<T> dir = TVector3<T>{0, 0, 0};
};
using Ray = TRay<Real>;
using DRay = DTRay<Real>;
using OptiXRay = TRay<float>;