pub struct RaytraceScene { /* private fields */ }Expand description
Complete ray-traceable 3D scene holding BLAS/TLAS geometry, analytic primitives, SDF volumes, materials, lights, sky environment, and camera.
Implementations§
Source§impl RaytraceScene
Geometry management, unified ray queries, environment shading, and World3D conversion for RaytraceScene.
impl RaytraceScene
Geometry management, unified ray queries, environment shading, and World3D conversion for RaytraceScene.
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates an empty ray-tracing scene with a default neutral diffuse material registered at index 0.
§Returns
Self- EmptyRaytraceScene.
Sourcepub fn bump_revision(&mut self)
pub fn bump_revision(&mut self)
Increments the scene revision counter so temporal accumulators invalidate stale frames.
§Arguments
&Self- Mutable scene reference.
Sourcepub fn add_material(&mut self, material: RtMaterial) -> u32
pub fn add_material(&mut self, material: RtMaterial) -> u32
Sourcepub fn update_instance_transform(
&mut self,
instance_id: usize,
transform: Mat4,
) -> bool
pub fn update_instance_transform( &mut self, instance_id: usize, transform: Mat4, ) -> bool
Sourcepub fn add_primitive(&mut self, primitive: RtPrimitive) -> usize
pub fn add_primitive(&mut self, primitive: RtPrimitive) -> usize
Sourcepub fn add_sdf_tracer(&mut self, tracer: SdfSphereTracer) -> usize
pub fn add_sdf_tracer(&mut self, tracer: SdfSphereTracer) -> usize
Sourcepub fn rebuild_tlas(&mut self)
pub fn rebuild_tlas(&mut self)
Rebuilds the scene TLAS using the binned Surface Area Heuristic.
§Arguments
&Self- Mutable scene reference.
Sourcepub fn refit_tlas(&mut self)
pub fn refit_tlas(&mut self)
Refits the scene TLAS bottom-up in O(N) with zero heap allocation after moving instances.
§Arguments
&Self- Mutable scene reference.
Sourcepub fn material(&self, material_id: u32) -> RtMaterial
pub fn material(&self, material_id: u32) -> RtMaterial
Sourcepub fn trace_closest(
&self,
ray: &Ray3D,
t_min: f32,
t_max: f32,
) -> Option<RtHit>
pub fn trace_closest( &self, ray: &Ray3D, t_min: f32, t_max: f32, ) -> Option<RtHit>
Traces a world-space ray against the TLAS, analytic primitives, and SDF volumes returning the globally closest hit.
§Arguments
&Self- Scene reference.&Ray3D- World-space normalized ray.f32- Minimum accepted hit distance.f32- Maximum accepted hit distance.
§Returns
Option<RtHit>- Globally closest surface hit if any.
Sourcepub fn trace_any_hit(&self, ray: &Ray3D, t_min: f32, t_max: f32) -> bool
pub fn trace_any_hit(&self, ray: &Ray3D, t_min: f32, t_max: f32) -> bool
Tests whether a world-space ray is occluded by any TLAS mesh, analytic primitive, or SDF volume in [t_min, t_max].
§Arguments
&Self- Scene reference.&Ray3D- World-space shadow or ambient-occlusion ray.f32- Minimum accepted hit distance.f32- Maximum accepted hit distance.
§Returns
bool-truewhen any occluder intersects the ray segment.
Sourcepub fn intersect_area_lights(
&self,
ray: &Ray3D,
t_min: f32,
t_max: f32,
) -> Option<(usize, f32, Vec3, f32)>
pub fn intersect_area_lights( &self, ray: &Ray3D, t_min: f32, t_max: f32, ) -> Option<(usize, f32, Vec3, f32)>
Intersects a ray against all finite area lights in the scene returning (light_index, distance, radiance, solid_angle_pdf) of the closest hit.
§Arguments
&Self- Scene reference.&Ray3D- World-space ray.f32- Minimum accepted distance.f32- Maximum accepted distance.
§Returns
Option<(usize, f32, Vec3, f32)>- Closest intersected area light metadata if any.
Sourcepub fn evaluate_environment(&self, direction: Vec3) -> Vec3
pub fn evaluate_environment(&self, direction: Vec3) -> Vec3
Sourcepub fn from_world3d(world: &World3D, aspect: f32) -> Self
pub fn from_world3d(world: &World3D, aspect: f32) -> Self
Bridges an existing euv-core World3D scene directly into a ready-to-trace RaytraceScene.
§Arguments
&World3D- Sourceeuv-core3D world containing meshes, objects, lights, sky, and camera.f32- Target viewport width-to-height aspect ratio.
§Returns
Self- PopulatedRaytraceScenewith built BLAS/TLAS acceleration structures.
Source§impl RaytraceScene
Implements impl #impl_generics #name #ty_generics #where_clause.
impl RaytraceScene
Implements impl #impl_generics #name #ty_generics #where_clause.