73 void updateSources(
const std::vector<RayTracingSource> &sources)
override;
76 void updateDiffuseRadiation(
const std::vector<float> &flux,
const std::vector<float> &extinction,
const std::vector<helios::vec3> &peak_dir,
const std::vector<float> &dist_norm,
const std::vector<float> &sky_energy)
override;
78 void updateSkyModel(
const std::vector<helios::vec4> &sky_radiance_params,
const std::vector<float> &camera_sky_radiance,
const helios::vec3 &sun_direction,
const std::vector<float> &solar_disk_radiance,
float solar_disk_cos_angle)
override;
88 void getCameraResults(std::vector<float> &pixel_data, std::vector<uint> &pixel_labels, std::vector<float> &pixel_depths,
uint camera_id,
const helios::int2 &resolution)
override;
95 void uploadRadiationOut(
const std::vector<float> &radiation_out_top,
const std::vector<float> &radiation_out_bottom)
override;
96 void uploadCameraScatterBuffers(
const std::vector<float> &scatter_top_cam,
const std::vector<float> &scatter_bottom_cam)
override;
106 RTcontext OptiX_Context;
109 RTprogram direct_raygen;
110 RTprogram diffuse_raygen;
111 RTprogram camera_raygen;
112 RTprogram pixel_label_raygen;
115 RTgeometrygroup base_geometry_group;
116 RTacceleration base_acceleration;
117 RTgroup top_level_group;
118 RTacceleration top_level_acceleration;
119 RTtransform transform;
122 RTgeometry patch_geometry;
123 RTgeometry triangle_geometry;
124 RTgeometry disk_geometry;
125 RTgeometry tile_geometry;
126 RTgeometry voxel_geometry;
127 RTgeometry bbox_geometry;
130 RTgeometryinstance patch_geometryinstance;
131 RTgeometryinstance triangle_geometryinstance;
132 RTgeometryinstance disk_geometryinstance;
133 RTgeometryinstance tile_geometryinstance;
134 RTgeometryinstance voxel_geometryinstance;
135 RTgeometryinstance bbox_geometryinstance;
138 RTmaterial patch_material;
139 RTmaterial triangle_material;
140 RTmaterial disk_material;
141 RTmaterial tile_material;
142 RTmaterial voxel_material;
143 RTmaterial bbox_material;
146 RTprogram rectangle_intersect;
147 RTprogram rectangle_bounds;
148 RTprogram triangle_intersect;
149 RTprogram triangle_bounds;
150 RTprogram disk_intersect;
151 RTprogram disk_bounds;
152 RTprogram tile_intersect;
153 RTprogram tile_bounds;
154 RTprogram voxel_intersect;
155 RTprogram voxel_bounds;
156 RTprogram bbox_intersect;
157 RTprogram bbox_bounds;
160 RTprogram closest_hit_direct;
161 RTprogram closest_hit_diffuse;
162 RTprogram closest_hit_camera;
163 RTprogram closest_hit_pixel_label;
164 RTprogram miss_direct;
165 RTprogram miss_diffuse;
166 RTprogram miss_camera;
169 RTbuffer patch_vertices_RTbuffer;
170 RTvariable patch_vertices_RTvariable;
171 RTbuffer triangle_vertices_RTbuffer;
172 RTvariable triangle_vertices_RTvariable;
173 RTbuffer disk_centers_RTbuffer;
174 RTvariable disk_centers_RTvariable;
175 RTbuffer disk_radii_RTbuffer;
176 RTvariable disk_radii_RTvariable;
177 RTbuffer disk_normals_RTbuffer;
178 RTvariable disk_normals_RTvariable;
179 RTbuffer tile_vertices_RTbuffer;
180 RTvariable tile_vertices_RTvariable;
181 RTbuffer voxel_vertices_RTbuffer;
182 RTvariable voxel_vertices_RTvariable;
183 RTbuffer bbox_vertices_RTbuffer;
184 RTvariable bbox_vertices_RTvariable;
185 RTbuffer object_subdivisions_RTbuffer;
186 RTvariable object_subdivisions_RTvariable;
187 RTbuffer primitive_type_RTbuffer;
188 RTvariable primitive_type_RTvariable;
189 RTbuffer primitive_solid_fraction_RTbuffer;
190 RTvariable primitive_solid_fraction_RTvariable;
193 RTbuffer patch_UUID_RTbuffer;
194 RTvariable patch_UUID_RTvariable;
195 RTbuffer triangle_UUID_RTbuffer;
196 RTvariable triangle_UUID_RTvariable;
197 RTbuffer disk_UUID_RTbuffer;
198 RTvariable disk_UUID_RTvariable;
199 RTbuffer tile_UUID_RTbuffer;
200 RTvariable tile_UUID_RTvariable;
201 RTbuffer voxel_UUID_RTbuffer;
202 RTvariable voxel_UUID_RTvariable;
203 RTbuffer bbox_UUID_RTbuffer;
204 RTvariable bbox_UUID_RTvariable;
205 RTbuffer objectID_RTbuffer;
206 RTvariable objectID_RTvariable;
207 RTbuffer primitiveID_RTbuffer;
208 RTvariable primitiveID_RTvariable;
209 RTbuffer primitive_positions_RTbuffer;
210 RTvariable primitive_positions_RTvariable;
211 RTbuffer twosided_flag_RTbuffer;
212 RTvariable twosided_flag_RTvariable;
215 RTbuffer rho_RTbuffer;
216 RTvariable rho_RTvariable;
217 RTbuffer tau_RTbuffer;
218 RTvariable tau_RTvariable;
219 RTbuffer rho_cam_RTbuffer;
220 RTvariable rho_cam_RTvariable;
221 RTbuffer tau_cam_RTbuffer;
222 RTvariable tau_cam_RTvariable;
223 RTbuffer specular_exponent_RTbuffer;
224 RTvariable specular_exponent_RTvariable;
225 RTbuffer specular_scale_RTbuffer;
226 RTvariable specular_scale_RTvariable;
227 RTbuffer transform_matrix_RTbuffer;
228 RTvariable transform_matrix_RTvariable;
231 RTbuffer radiation_in_RTbuffer;
232 RTvariable radiation_in_RTvariable;
233 RTbuffer radiation_out_top_RTbuffer;
234 RTvariable radiation_out_top_RTvariable;
235 RTbuffer radiation_out_bottom_RTbuffer;
236 RTvariable radiation_out_bottom_RTvariable;
237 RTbuffer Rsky_RTbuffer;
238 RTvariable Rsky_RTvariable;
239 RTbuffer radiation_specular_RTbuffer;
240 RTvariable radiation_specular_RTvariable;
241 RTbuffer scatter_buff_top_RTbuffer;
242 RTvariable scatter_buff_top_RTvariable;
243 RTbuffer scatter_buff_bottom_RTbuffer;
244 RTvariable scatter_buff_bottom_RTvariable;
245 RTbuffer radiation_in_camera_RTbuffer;
246 RTvariable radiation_in_camera_RTvariable;
247 RTbuffer scatter_buff_top_cam_RTbuffer;
248 RTvariable scatter_buff_top_cam_RTvariable;
249 RTbuffer scatter_buff_bottom_cam_RTbuffer;
250 RTvariable scatter_buff_bottom_cam_RTvariable;
253 RTbuffer camera_pixel_label_RTbuffer;
254 RTvariable camera_pixel_label_RTvariable;
255 RTbuffer camera_pixel_depth_RTbuffer;
256 RTvariable camera_pixel_depth_RTvariable;
259 RTbuffer diffuse_flux_RTbuffer;
260 RTvariable diffuse_flux_RTvariable;
261 RTbuffer diffuse_extinction_RTbuffer;
262 RTvariable diffuse_extinction_RTvariable;
263 RTbuffer diffuse_peak_dir_RTbuffer;
264 RTvariable diffuse_peak_dir_RTvariable;
265 RTbuffer diffuse_dist_norm_RTbuffer;
266 RTvariable diffuse_dist_norm_RTvariable;
267 RTbuffer sky_radiance_params_RTbuffer;
268 RTvariable sky_radiance_params_RTvariable;
269 RTbuffer camera_sky_radiance_RTbuffer;
270 RTvariable camera_sky_radiance_RTvariable;
271 RTbuffer solar_disk_radiance_RTbuffer;
272 RTvariable solar_disk_radiance_RTvariable;
275 RTbuffer source_positions_RTbuffer;
276 RTvariable source_positions_RTvariable;
277 RTbuffer source_types_RTbuffer;
278 RTvariable source_types_RTvariable;
279 RTbuffer source_fluxes_RTbuffer;
280 RTvariable source_fluxes_RTvariable;
281 RTbuffer source_fluxes_cam_RTbuffer;
282 RTvariable source_fluxes_cam_RTvariable;
283 RTbuffer source_widths_RTbuffer;
284 RTvariable source_widths_RTvariable;
285 RTbuffer source_rotations_RTbuffer;
286 RTvariable source_rotations_RTvariable;
287 RTbuffer band_launch_flag_RTbuffer;
288 RTvariable band_launch_flag_RTvariable;
289 RTbuffer max_scatters_RTbuffer;
290 RTvariable max_scatters_RTvariable;
293 RTbuffer maskdata_RTbuffer;
294 RTvariable maskdata_RTvariable;
295 RTbuffer masksize_RTbuffer;
296 RTvariable masksize_RTvariable;
297 RTbuffer maskID_RTbuffer;
298 RTvariable maskID_RTvariable;
299 RTbuffer uvdata_RTbuffer;
300 RTvariable uvdata_RTvariable;
301 RTbuffer uvID_RTbuffer;
302 RTvariable uvID_RTvariable;
305 RTvariable direct_ray_type_RTvariable;
306 RTvariable diffuse_ray_type_RTvariable;
307 RTvariable camera_ray_type_RTvariable;
308 RTvariable pixel_label_ray_type_RTvariable;
309 RTvariable random_seed_RTvariable;
310 RTvariable launch_offset_RTvariable;
311 RTvariable launch_face_RTvariable;
312 RTvariable Nprimitives_RTvariable;
313 RTvariable bbox_UUID_base_RTvariable;
314 RTvariable Nsources_RTvariable;
315 RTvariable Nbands_global_RTvariable;
316 RTvariable Nbands_launch_RTvariable;
317 RTvariable Ncameras_RTvariable;
318 RTvariable periodic_flag_RTvariable;
319 RTvariable sun_direction_RTvariable;
320 RTvariable solar_disk_cos_angle_RTvariable;
321 RTvariable camera_position_RTvariable;
322 RTvariable camera_direction_RTvariable;
323 RTvariable camera_lens_diameter_RTvariable;
324 RTvariable camera_focal_length_RTvariable;
325 RTvariable FOV_aspect_ratio_RTvariable;
326 RTvariable camera_HFOV_RTvariable;
327 RTvariable camera_resolution_RTvariable;
328 RTvariable camera_viewplane_length_RTvariable;
329 RTvariable camera_pixel_solid_angle_RTvariable;
330 RTvariable camera_pixel_offset_x_RTvariable;
331 RTvariable camera_pixel_offset_y_RTvariable;
332 RTvariable camera_ID_RTvariable;
333 RTvariable camera_resolution_full_RTvariable;
334 RTvariable specular_reflection_enabled_RTvariable;
335 RTvariable scattering_iteration_RTvariable;
338 void addBuffer(
const char *name, RTbuffer &buffer, RTvariable &variable, RTbuffertype type, RTformat format,
size_t dimension);
339 void zeroBuffer1D(RTbuffer &buffer,
size_t bsize);
340 void zeroBuffer2D(RTbuffer &buffer,
const helios::int2 &bsize);
341 void initializeBuffer1Df(RTbuffer &buffer,
const std::vector<float> &array);
342 void initializeBuffer1Dui(RTbuffer &buffer,
const std::vector<uint> &array);
343 void initializeBuffer1Di(RTbuffer &buffer,
const std::vector<int> &array);
344 void initializeBuffer1Dchar(RTbuffer &buffer,
const std::vector<char> &array);
345 void initializeBuffer1Dbool(RTbuffer &buffer,
const std::vector<bool> &array);
346 void initializeBuffer1Dfloat2(RTbuffer &buffer,
const std::vector<helios::vec2> &array);
347 void initializeBuffer1Dfloat3(RTbuffer &buffer,
const std::vector<helios::vec3> &array);
348 void initializeBuffer1Dfloat4(RTbuffer &buffer,
const std::vector<helios::vec4> &array);
349 void initializeBuffer1Dint2(RTbuffer &buffer,
const std::vector<helios::int2> &array);
350 void initializeBuffer2Df(RTbuffer &buffer,
const std::vector<std::vector<float>> &array);
351 void initializeBuffer2Dui(RTbuffer &buffer,
const std::vector<std::vector<uint>> &array);
352 void initializeBuffer2Di(RTbuffer &buffer,
const std::vector<std::vector<int>> &array);
353 void initializeBuffer2Dfloat2(RTbuffer &buffer,
const std::vector<std::vector<helios::vec2>> &array);
354 void initializeBuffer2Dfloat3(RTbuffer &buffer,
const std::vector<std::vector<helios::vec3>> &array);
355 void initializeBuffer2Dfloat3(RTbuffer &buffer,
const std::vector<std::vector<optix::float3>> &array);
356 void initializeBuffer3Dbool(RTbuffer &buffer,
const std::vector<std::vector<std::vector<bool>>> &array);
357 void copyBuffer1D(RTbuffer &source, RTbuffer &dest);
358 std::vector<float> getOptiXbufferData(RTbuffer buffer);
359 std::vector<uint> getOptiXbufferData_ui(RTbuffer buffer);
364 void sourcesToBuffers(
const std::vector<RayTracingSource> &sources);
365 void diffuseToBuffers(
const std::vector<float> &flux,
const std::vector<float> &extinction,
const std::vector<helios::vec3> &peak_dir,
const std::vector<float> &dist_norm,
const std::vector<float> &sky_energy);
366 void skyModelToBuffers(
const std::vector<helios::vec4> &sky_radiance_params,
const std::vector<float> &camera_sky_radiance,
const helios::vec3 &sun_direction,
const std::vector<float> &solar_disk_radiance,
float solar_disk_cos_angle);
373 bool is_initialized =
false;
374 size_t current_primitive_count = 0;
375 size_t current_patch_count = 0;
376 size_t current_triangle_count = 0;
377 size_t current_disk_count = 0;
378 size_t current_tile_count = 0;
379 size_t current_voxel_count = 0;
380 size_t current_bbox_count = 0;
381 size_t current_source_count = 0;
382 size_t current_band_count = 0;
383 size_t current_camera_count = 0;