-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeviceCode.h
128 lines (107 loc) · 2.14 KB
/
DeviceCode.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#pragma once
#include <owl/owl.h>
#include <owl/common/math/vec.h>
#include "owl/common/math/random.h"
#include "UnstructuredElementHelpers.h"
#include "cuda_fp16.h"
#include <cuda_runtime.h>
using namespace owl;
#define NUM_BINS 32
/* variables for the triangle mesh geometry */
struct TriangleData
{
/*! base color we use for the entire mesh */
vec3f color;
/*! array/buffer of vertex indices */
vec3i *indices;
/*! array/buffer of vertex positions */
vec3f *vertices;
};
struct UnstructuredElementData
{
unsigned int *tetrahedra;
unsigned int *pyramids;
unsigned int *hexahedra;
unsigned int *wedges;
uint32_t bytesPerIndex;
vec3f *vertices;
float *scalars;
uint64_t offset; // for pre-split geom
uint64_t numTetrahedra;
uint64_t numPyramids;
uint64_t numWedges;
uint64_t numHexahedra;
uint8_t *maxima;
half *bboxes;
};
struct MacrocellData
{
float4 *bboxes;
float* maxima;
// int offset; // for pre-split geom
};
/* variables for the ray generation program */
struct LaunchParams
{
uint32_t *fbPtr;
vec2i fbSize;
vec4f *accumBuffer;
uint32_t frameID;
uint32_t accumID;
OptixTraversableHandle triangleTLAS;
bool shadows;
vec3f lightDir;
struct
{
OptixTraversableHandle elementTLAS;
OptixTraversableHandle macrocellTLAS;
int numModes;
int mode;
int numAdaptiveSamplingRays;
float dt;
vec3i macrocellDims;
// float* macrocells;
float4 globalBoundsLo;
float4 globalBoundsHi;
} volume;
struct
{
cudaTextureObject_t xf;
// int numTexels;
float2 volumeDomain;
//float2 xfDomain;
float opacityScale;
} transferFunction;
struct
{
vec3f origin;
vec3f lower_left_corner;
vec3f horizontal;
vec3f vertical;
} camera;
};
struct RayGenData
{};
struct RayPayload
{
float t0;
float t1;
owl::common::LCG<4> rng; // random number generator
vec4f rgba;
float dataMax;
float dataMin;
float dataAvg;
float dataValue;
float tHit;
int samples;
float maxima[NUM_BINS];
bool shadowRay;
bool missed;
bool debug;
};
/* variables for the miss program */
struct MissProgData
{
vec3f color0;
vec3f color1;
};