Skip to main content

RaytraceScene

Struct RaytraceScene 

Source
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.

Source

pub fn new() -> Self

Creates an empty ray-tracing scene with a default neutral diffuse material registered at index 0.

§Returns
  • Self - Empty RaytraceScene.
Source

pub fn bump_revision(&mut self)

Increments the scene revision counter so temporal accumulators invalidate stale frames.

§Arguments
  • &Self - Mutable scene reference.
Source

pub fn add_material(&mut self, material: RtMaterial) -> u32

Registers a material and returns its material_id.

§Arguments
  • &Self - Mutable scene reference.
  • RtMaterial - Physical material descriptor.
§Returns
  • u32 - Registered material index.
Source

pub fn add_blas(&mut self, blas: Blas3D) -> u32

Registers a prebuilt Blas3D and returns its blas_id.

§Arguments
  • &Self - Mutable scene reference.
  • Blas3D - Bottom-level triangle BVH.
§Returns
  • u32 - Registered BLAS index.
Source

pub fn add_mesh(&mut self, mesh: &Mesh3D) -> u32

Builds and registers a Blas3D from an existing Mesh3D and returns its blas_id.

§Arguments
  • &Self - Mutable scene reference.
  • &Mesh3D - Source mesh geometry.
§Returns
  • u32 - Registered BLAS index.
Source

pub fn add_instance( &mut self, blas_id: u32, transform: Mat4, material_id: u32, ) -> usize

Adds a transformed mesh instance referencing blas_id and returns its stable instance_id.

§Arguments
  • &Self - Mutable scene reference.
  • u32 - Registered BLAS index.
  • Mat4 - Local-to-world affine transform matrix.
  • u32 - Material index.
§Returns
  • usize - Stable TLAS instance identifier.
Source

pub fn update_instance_transform( &mut self, instance_id: usize, transform: Mat4, ) -> bool

Updates an existing instance’s world transform without rebuilding its underlying Blas3D.

§Arguments
  • &Self - Mutable scene reference.
  • usize - Stable instance identifier.
  • Mat4 - Updated local-to-world affine transform.
§Returns
  • bool - true when the instance existed and was updated.
Source

pub fn add_primitive(&mut self, primitive: RtPrimitive) -> usize

Appends an analytic primitive to the scene and returns its index.

§Arguments
  • &Self - Mutable scene reference.
  • RtPrimitive - Bound analytic primitive.
§Returns
  • usize - Analytic primitive index.
Source

pub fn add_sdf_tracer(&mut self, tracer: SdfSphereTracer) -> usize

Appends an implicit SDF sphere-tracer volume to the scene and returns its index.

§Arguments
  • &Self - Mutable scene reference.
  • SdfSphereTracer - Configured SDF volume.
§Returns
  • usize - SDF volume index.
Source

pub fn add_light(&mut self, light: RtLight) -> usize

Appends a physical light emitter to the scene and returns its index.

§Arguments
  • &Self - Mutable scene reference.
  • RtLight - Light descriptor.
§Returns
  • usize - Light index.
Source

pub fn rebuild_tlas(&mut self)

Rebuilds the scene TLAS using the binned Surface Area Heuristic.

§Arguments
  • &Self - Mutable scene reference.
Source

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.
Source

pub fn material(&self, material_id: u32) -> RtMaterial

Returns the RtMaterial registered at material_id, falling back to a default diffuse material if out of bounds.

§Arguments
  • &Self - Scene reference.
  • u32 - Material identifier.
§Returns
  • RtMaterial - Resolved material descriptor.
Source

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.
Source

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 - true when any occluder intersects the ray segment.
Source

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.
Source

pub fn evaluate_environment(&self, direction: Vec3) -> Vec3

Evaluates the background environment radiance along unit world-space direction direction.

§Arguments
  • &Self - Scene reference.
  • Vec3 - Escaping world-space ray direction.
§Returns
  • Vec3 - Linear HDR RGB sky or environment radiance.
Source

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 - Source euv-core 3D world containing meshes, objects, lights, sky, and camera.
  • f32 - Target viewport width-to-height aspect ratio.
§Returns
  • Self - Populated RaytraceScene with built BLAS/TLAS acceleration structures.
Source§

impl RaytraceScene

Implements impl #impl_generics #name #ty_generics #where_clause.

Source

pub fn get_blas_list(&self) -> &Vec<Blas3D>

Source

pub fn get_mut_blas_list(&mut self) -> &mut Vec<Blas3D>

Source

pub fn set_blas_list(&mut self, val: Vec<Blas3D>) -> &mut Self

Source

pub fn get_tlas(&self) -> &Tlas3D

Source

pub fn get_mut_tlas(&mut self) -> &mut Tlas3D

Source

pub fn set_tlas(&mut self, val: Tlas3D) -> &mut Self

Source

pub fn get_primitives(&self) -> &Vec<RtPrimitive>

Source

pub fn get_mut_primitives(&mut self) -> &mut Vec<RtPrimitive>

Source

pub fn set_primitives(&mut self, val: Vec<RtPrimitive>) -> &mut Self

Source

pub fn get_sdf_tracers(&self) -> &Vec<SdfSphereTracer>

Source

pub fn get_mut_sdf_tracers(&mut self) -> &mut Vec<SdfSphereTracer>

Source

pub fn set_sdf_tracers(&mut self, val: Vec<SdfSphereTracer>) -> &mut Self

Source

pub fn get_materials(&self) -> &Vec<RtMaterial>

Source

pub fn get_mut_materials(&mut self) -> &mut Vec<RtMaterial>

Source

pub fn set_materials(&mut self, val: Vec<RtMaterial>) -> &mut Self

Source

pub fn get_lights(&self) -> &Vec<RtLight>

Source

pub fn get_mut_lights(&mut self) -> &mut Vec<RtLight>

Source

pub fn set_lights(&mut self, val: Vec<RtLight>) -> &mut Self

Source

pub fn get_environment(&self) -> RtEnvironment

Source

pub fn get_mut_environment(&mut self) -> &mut RtEnvironment

Source

pub fn set_environment(&mut self, val: RtEnvironment) -> &mut Self

Source

pub fn get_camera(&self) -> RtCamera

Source

pub fn get_mut_camera(&mut self) -> &mut RtCamera

Source

pub fn set_camera(&mut self, val: RtCamera) -> &mut Self

Source

pub fn get_revision(&self) -> u64

Source

pub fn get_mut_revision(&mut self) -> &mut u64

Source

pub fn set_revision(&mut self, val: u64) -> &mut Self

Trait Implementations§

Source§

impl Clone for RaytraceScene

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RaytraceScene

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RaytraceScene

Default empty ray-tracing scene constructor for RaytraceScene.

Source§

fn default() -> Self

Creates an empty RaytraceScene with a default matte material at slot 0.

§Returns
  • Self - Empty scene ready for geometry and lights.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.