1.3.64
Loading...
Searching...
No Matches
RayTracingTypes.h
Go to the documentation of this file.
1
16
#ifndef RAYTRACING_TYPES_H
17
#define RAYTRACING_TYPES_H
18
19
#include "
Context.h
"
20
#include "
IndexTypes.h
"
21
#include <vector>
22
23
namespace
helios {
24
28
struct
PrimitiveTypeGeometry
{
29
std::vector<helios::vec3>
vertices
;
30
std::vector<uint>
UUIDs
;
31
size_t
count
= 0;
32
};
33
40
struct
RayTracingGeometry
{
41
42
// Per-primitive data (indexed by primitive index 0..primitive_count-1)
43
std::vector<float>
transform_matrices
;
44
std::vector<uint>
primitive_types
;
45
std::vector<uint>
primitive_UUIDs
;
46
std::vector<uint>
primitive_IDs
;
47
std::vector<uint>
object_IDs
;
48
std::vector<helios::int2>
object_subdivisions
;
49
std::vector<char>
twosided_flags
;
50
std::vector<float>
solid_fractions
;
51
52
// UUID-to-position lookup table (indexed by UUID value)
56
std::vector<uint>
primitive_positions
;
57
58
// Per-type geometry data
59
PrimitiveTypeGeometry
patches
;
60
PrimitiveTypeGeometry
triangles
;
61
PrimitiveTypeGeometry
tiles
;
62
PrimitiveTypeGeometry
voxels
;
63
PrimitiveTypeGeometry
bboxes
;
64
65
// Disk-specific data (disks don't use vertex arrays)
66
std::vector<helios::vec3>
disk_centers
;
67
std::vector<float>
disk_radii
;
68
std::vector<helios::vec3>
disk_normals
;
69
std::vector<uint>
disk_UUIDs
;
70
size_t
disk_count
= 0;
71
72
// Texture/masking data
73
std::vector<bool>
mask_data
;
74
std::vector<helios::int2>
mask_sizes
;
75
std::vector<int>
mask_IDs
;
76
std::vector<helios::vec2>
uv_data
;
77
std::vector<int>
uv_IDs
;
78
79
// Periodic boundary condition
80
helios::vec2
periodic_flag
;
81
82
// Counts
83
size_t
primitive_count
= 0;
84
size_t
patch_count
= 0;
85
size_t
triangle_count
= 0;
86
size_t
tile_count
= 0;
87
size_t
voxel_count
= 0;
88
size_t
bbox_count
= 0;
89
uint
bbox_UUID_base
= 0;
90
91
// UUID ↔ Position mapping utility (CPU-side type-safe conversion)
92
UUIDPositionMapper
mapper;
93
94
// ========== Helper Methods for Backend Implementation ==========
95
111
size_t
getPerPrimitiveBufferSize
()
const
{
112
return
primitive_count
;
113
}
114
125
size_t
getUUIDLookupBufferSize
()
const
{
126
if
(
primitive_UUIDs
.empty())
127
return
0;
128
return
*std::max_element(
primitive_UUIDs
.begin(),
primitive_UUIDs
.end()) + 1;
129
}
130
154
void
validate
()
const
;
155
};
156
163
struct
RayTracingMaterial
{
164
std::vector<float>
reflectivity
;
165
std::vector<float>
transmissivity
;
166
std::vector<float>
reflectivity_cam
;
167
std::vector<float>
transmissivity_cam
;
168
std::vector<float>
specular_exponent
;
169
std::vector<float>
specular_scale
;
170
171
size_t
num_bands
= 0;
172
size_t
num_sources
= 0;
173
size_t
num_primitives
= 0;
174
size_t
num_cameras
= 0;
175
};
176
180
struct
RayTracingSource
{
181
helios::vec3
position
;
182
helios::vec3
rotation
;
183
helios::vec2
width
;
184
uint
type
;
185
std::vector<float>
fluxes
;
186
std::vector<float>
fluxes_cam
;
187
};
188
192
struct
RayTracingLaunchParams
{
193
// Launch dimensions
194
uint
launch_offset
= 0;
195
uint
launch_count
= 0;
196
uint
rays_per_primitive
= 0;
197
uint
random_seed
= 0;
198
199
// Band configuration
200
uint
current_band
= 0;
201
uint
num_bands_global
= 0;
202
uint
num_bands_launch
= 0;
203
std::vector<bool>
band_launch_flag
;
204
205
// Scattering
206
uint
scattering_iteration
= 0;
207
uint
max_scatters
= 0;
208
209
// Face selection (for diffuse rays)
210
uint
launch_face
= 0;
211
212
// Camera-specific parameters
213
uint
camera_id
= 0;
214
helios::vec3
camera_position
;
215
helios::vec2
camera_direction
;
216
float
camera_focal_length
= 0.0f;
217
float
camera_lens_diameter
= 0.0f;
218
float
camera_fov_aspect
= 0.0f;
219
helios::int2
camera_resolution
;
220
float
camera_HFOV
= 0.0f;
221
uint
antialiasing_samples
= 1;
222
helios::int2
camera_pixel_offset
;
223
float
camera_viewplane_length
= 0.0f;
224
float
camera_pixel_solid_angle
= 0.0f;
225
helios::int2
camera_resolution_full
;
226
227
// Diffuse radiation parameters (for diffuse ray launches)
228
std::vector<float>
diffuse_flux
;
229
std::vector<float>
diffuse_extinction
;
230
std::vector<helios::vec3>
diffuse_peak_dir
;
231
std::vector<float>
diffuse_dist_norm
;
232
233
// Emission/outgoing radiation (for diffuse ray launches)
234
std::vector<float>
radiation_out_top
;
235
std::vector<float>
radiation_out_bottom
;
236
237
// Flags
238
bool
specular_reflection_enabled
=
false
;
239
};
240
247
struct
RayTracingResults
{
248
std::vector<float>
radiation_in
;
249
std::vector<float>
radiation_out_top
;
250
std::vector<float>
radiation_out_bottom
;
251
std::vector<float>
scatter_buff_top
;
252
std::vector<float>
scatter_buff_bottom
;
253
std::vector<float>
scatter_buff_top_cam
;
254
std::vector<float>
scatter_buff_bottom_cam
;
255
std::vector<float>
radiation_specular
;
256
std::vector<float>
sky_energy
;
257
258
size_t
num_primitives
= 0;
259
size_t
num_bands
= 0;
260
size_t
num_sources
= 0;
261
size_t
num_cameras
= 0;
262
};
263
264
}
// namespace helios
265
266
#endif
// RAYTRACING_TYPES_H
plugins
radiation
include
RayTracingTypes.h
Generated by
1.9.8