1.3.64
 
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
123 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,
124 float solar_disk_cos_angle) = 0;
125
126 // ========== Ray Launching ==========
127
133 virtual void launchDirectRays(const RayTracingLaunchParams &params) = 0;
134
140 virtual void launchDiffuseRays(const RayTracingLaunchParams &params) = 0;
141
147 virtual void launchCameraRays(const RayTracingLaunchParams &params) = 0;
148
154 virtual void launchPixelLabelRays(const RayTracingLaunchParams &params) = 0;
155
156 // ========== Results Retrieval ==========
157
165 virtual void getRadiationResults(RayTracingResults &results) = 0;
166
176 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;
177
178 // ========== Buffer Management Utilities ==========
179
188 virtual void zeroRadiationBuffers(size_t launch_band_count) = 0;
189
193 virtual void zeroScatterBuffers() = 0;
194
204 virtual void zeroCameraPixelBuffers(const helios::int2 &resolution) = 0;
205
212 virtual void copyScatterToRadiation() = 0;
213
222 virtual void uploadRadiationOut(const std::vector<float> &radiation_out_top, const std::vector<float> &radiation_out_bottom) = 0;
223
232 virtual void uploadCameraScatterBuffers(const std::vector<float> &scatter_top_cam, const std::vector<float> &scatter_bottom_cam) = 0;
233
242 virtual void zeroCameraScatterBuffers(size_t launch_band_count) = 0;
243
251 virtual void uploadSourceFluxes(const std::vector<float> &fluxes) = 0;
252
253 // ========== Diagnostics ==========
254
258 virtual void queryGPUMemory() const = 0;
259
265 virtual std::string getBackendName() const = 0;
266
267 protected:
283 void validateGeometryBeforeUpload(const RayTracingGeometry &geometry) const {
284#ifndef NDEBUG
285 geometry.validate();
286#endif
287 }
288
289 public:
290 // ========== Factory Method ==========
291
301 static std::unique_ptr<RayTracingBackend> create(const std::string &backend_type);
302 };
303
304} // namespace helios
305
306#endif // RAYTRACING_BACKEND_H