Repository navigation
Expand file tree
/
Copy pathdeviceCode.h
More file actions
162 lines (137 loc) · 3.22 KB
/
Copy pathdeviceCode.h
File metadata and controls
162 lines (137 loc) · 3.22 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#pragma once
#include <owl/owl.h>
#include <owl/common/math/vec.h>
#include "owl/common/math/random.h"
#include <cuda_runtime.h>
#include "cuda_fp16.h"
using namespace owl;
#define NUM_BINS 32
#define MAX_CHANNELS 12
/* 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 StructuredVolumeChannel
{
vec3ui dims;
//If the data is too big to fit in one texture, we can use two.
cudaTextureObject_t scalarTex[2];
unsigned int splitAxis=3;//0=x, 1=y, 2=z, 3=none
unsigned int splitPos=0;
};
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 {
float* maxima;
box4f* bboxes;
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;
int spp = 1;
OptixTraversableHandle triangleTLAS;
int mode = 0;
bool enableShadows;
bool enableGradientShading;
short heatMapMode = 0;
float heatMapScale = 1.0f;
bool enableAccumulation;
vec3f lightDir;
float lightIntensity;
float ambient;
vec3f bgColor = vec3f(0.0f);
struct
{
int numChannels = 1;
//interval<float> domain;
OptixTraversableHandle rootMacrocellTLAS;
OptixTraversableHandle macrocellTLAS;
int numModes;
int meshType;
int numAdaptiveSamplingRays;
float dt;
vec3ui macrocellDims;
box3f rootDomain;
float2* macrocells; // scalar ranges for each macrocell.
float* majorants; // majorant values for each macrocell
float4 globalBoundsLo;
float4 globalBoundsHi;
//=== Structured Grid ===//
StructuredVolumeChannel sGrid[MAX_CHANNELS];
//=== Unstructured Grid ===//
OptixTraversableHandle elementTLAS;
} volume;
struct
{
cudaTextureObject_t xf;
// int numTexels;
float2 volumeDomain;
float2 xfDomain;
float opacityScale;
} transferFunction[MAX_CHANNELS];
struct
{
float diffuse; // Diffuse coefficient [0,1]
float specular; // Specular coefficient [0,1]
float shininess; // Specular exponent [1,128]
float gradientStep; // Gradient calculation step multiplier [0.001,0.1]
float3 specularColor; // RGB color for specular highlights
} material[MAX_CHANNELS];
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 dataValue;
float tHit;
int samples = 0;
int rejections = 0;
bool shadowRay;
bool missed;
bool debug;
short channelID = 0;
};
/* variables for the miss program */
struct MissProgData
{
vec3f color0;
vec3f color1;
};