-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcamera.cu
22 lines (20 loc) · 990 Bytes
/
camera.cu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "cuda_path_tracer/camera.cuh"
__device__ auto defocusDiskSample(curandStatePhilox4_32_10_t &state,
const Vec3 ¢er, const Vec3 &u,
const Vec3 &v) -> Vec3 {
const auto p = randomInUnitDiskRejectionSampling(state);
return center + p.x * u + p.y * v;
}
__device__ auto defocusDiskSample(curandState_t &state, const Vec3 ¢er,
const Vec3 &u, const Vec3 &v) -> Vec3 {
const auto p = randomInUnitDiskRejectionSampling(state);
return center + p.x * u + p.y * v;
}
__device__ auto
defocusDisk4Samples(curandStatePhilox4_32_10_t &state, const Vec3 ¢er,
const Vec3 &u,
const Vec3 &v) -> cuda::std::tuple<Vec3, Vec3, Vec3, Vec3> {
const auto [p1, p2, p3, p4] = randomInUnitDisk(state);
return {center + p1.x * u + p1.y * v, center + p2.x * u + p2.y * v,
center + p3.x * u + p3.y * v, center + p4.x * u + p4.y * v};
}