1.3.77
 
Loading...
Searching...
No Matches
RayTracingBackend.h
Go to the documentation of this file.
1
16#ifndef RAYTRACING_BACKEND_H
17#define RAYTRACING_BACKEND_H
18
19#include "RayTracingTypes.h"
20#include <memory>
21#include <string>
22
23namespace helios {
24
43 public:
44 virtual ~RayTracingBackend() = default;
45
46 // ========== Lifecycle Management ==========
47
54 virtual void initialize() = 0;
55
61 virtual void shutdown() = 0;
62
63 // ========== Geometry Management ==========
64
73 virtual void updateGeometry(const RayTracingGeometry &geometry) = 0;
74
81 virtual void buildAccelerationStructure() = 0;
82
83 // ========== Material/Optical Properties ==========
84
90 virtual void updateMaterials(const RayTracingMaterial &materials) = 0;
91
92 // ========== Radiation Sources ==========
93
99 virtual void updateSources(const std::vector<RayTracingSource> &sources) = 0;
100
101 // ========== Diffuse/Sky Radiation ==========
102
112 virtual 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) = 0;
113
129 virtual 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,
130 float solar_disk_cos_angle, const std::vector<float> &camera_diffuse_flux, const std::vector<uint32_t> &band_emission_flag) = 0;
131
132 // ========== Ray Launching ==========
133
139 virtual void launchDirectRays(const RayTracingLaunchParams &params) = 0;
140
146 virtual void launchDiffuseRays(const RayTracingLaunchParams &params) = 0;
147
153 virtual void launchCameraRays(const RayTracingLaunchParams &params) = 0;
154
160 virtual void launchPixelLabelRays(const RayTracingLaunchParams &params) = 0;
161
162 // ========== Results Retrieval ==========
163
171 virtual void getRadiationResults(RayTracingResults &results) = 0;
172
182 virtual void getCameraResults(std::vector<float> &pixel_data, std::vector<uint> &pixel_labels, std::vector<float> &pixel_depths, uint camera_id, const helios::int2 &resolution) = 0;
183
184 // ========== Buffer Management Utilities ==========
185
194 virtual void zeroRadiationBuffers(size_t launch_band_count) = 0;
195
199 virtual void zeroScatterBuffers() = 0;
200
210 virtual void zeroCameraPixelBuffers(const helios::int2 &resolution) = 0;
211
218 virtual void copyScatterToRadiation() = 0;
219
228 virtual void uploadRadiationOut(const std::vector<float> &radiation_out_top, const std::vector<float> &radiation_out_bottom) = 0;
229
238 virtual void uploadCameraScatterBuffers(const std::vector<float> &scatter_top_cam, const std::vector<float> &scatter_bottom_cam) = 0;
239
248 virtual void zeroCameraScatterBuffers(size_t launch_band_count) = 0;
249
257 virtual void uploadSourceFluxes(const std::vector<float> &fluxes) = 0;
258
268 virtual void uploadSourceFluxesCam(const std::vector<float> &fluxes_cam) = 0;
269
270 // ========== Diagnostics ==========
271
275 virtual void queryGPUMemory() const = 0;
276
282 virtual std::string getBackendName() const = 0;
283
284 protected:
300 void validateGeometryBeforeUpload(const RayTracingGeometry &geometry) const {
301#ifndef NDEBUG
302 geometry.validate();
303#endif
304 }
305
306 public:
307 // ========== Factory Method ==========
308
326 static std::unique_ptr<RayTracingBackend> create(const std::string &backend_type);
327 };
328
338 bool probeAnyGPUBackend() noexcept;
339
340} // namespace helios
341
342#endif // RAYTRACING_BACKEND_H