Skip to main content

LightProbeGrid3D

Struct LightProbeGrid3D 

Source
pub struct LightProbeGrid3D { /* private fields */ }
Expand description

Regular 3D grid of L2 Spherical Harmonics irradiance probes supporting trilinear interpolation, normal bias, and automated baking.

Implementations§

Source§

impl LightProbeGrid3D

3D regular lattice management, SH9 probe baking, and trilinear normal-biased sampling for LightProbeGrid3D.

Source

pub fn new(bounds: AxisAlignedBox3D, dims: [usize; 3], normal_bias: f32) -> Self

Creates a pre-allocated regular 3D LightProbeGrid3D spanning bounds with dimensions dims = [nx, ny, nz].

§Arguments
  • AxisAlignedBox3D - World-space probe volume bounds.
  • [usize; 3] - Grid resolution [nx, ny, nz] (each clamped >= 1).
  • f32 - Surface normal bias offset in meters (>= 0.0).
§Returns
  • Self - Zero-initialized light probe grid.
Source

pub fn probe_index(&self, ix: usize, iy: usize, iz: usize) -> usize

Computes the flat array index of probe (ix, iy, iz).

§Arguments
  • usize - Grid X index.
  • usize - Grid Y index.
  • usize - Grid Z index.
§Returns
  • usize - Flat probe index into self.probes.
Source

pub fn probe_position(&self, ix: usize, iy: usize, iz: usize) -> Vec3

Computes the world-space position of probe (ix, iy, iz).

§Arguments
  • usize - Grid X index.
  • usize - Grid Y index.
  • usize - Grid Z index.
§Returns
  • Vec3 - World-space center of the requested probe.
Source

pub fn probe_at(&self, ix: usize, iy: usize, iz: usize) -> Sh9Probe3D

Returns the stored Sh9Probe3D at lattice index (ix, iy, iz).

§Arguments
  • usize - Grid X index.
  • usize - Grid Y index.
  • usize - Grid Z index.
§Returns
  • Sh9Probe3D - Stored L2 SH probe.
Source

pub fn set_probe_at( &mut self, ix: usize, iy: usize, iz: usize, probe: Sh9Probe3D, )

Overwrites the stored Sh9Probe3D at lattice index (ix, iy, iz).

§Arguments
  • usize - Grid X index.
  • usize - Grid Y index.
  • usize - Grid Z index.
  • Sh9Probe3D - New SH9 probe coefficients.
Source

pub fn bake_from_rig_and_sky( &mut self, rig: &LightRig3D, sky: &PhysicalSky3D, sun_dir: Vec3, sky_samples: u32, )

Automatically bakes every probe in the 3D grid from LightRig3D and PhysicalSky3D into L2 Spherical Harmonics.

§Arguments
  • &LightRig3D - Scene lighting rig (directional, point, spot, and area lights).
  • &PhysicalSky3D - Physical atmospheric sky dome.
  • Vec3 - Unit sun direction for sky evaluation.
  • u32 - Sky-dome Hammersley sphere sample count (0 uses default 128).
Source

pub fn sample_irradiance(&self, world_pos: Vec3, normal: Vec3) -> Vec3

Trilinearly interpolates the 8 surrounding L2 SH9 probes with normal bias and evaluates diffuse irradiance along normal.

§Arguments
  • Vec3 - World-space shading point.
  • Vec3 - World-space surface normal.
§Returns
  • Vec3 - Trilinearly interpolated linear HDR diffuse irradiance RGB.
Source§

impl LightProbeGrid3D

Implements impl #impl_generics #name #ty_generics #where_clause.

Source

pub fn get_bounds(&self) -> AxisAlignedBox3D

Source

pub fn get_mut_bounds(&mut self) -> &mut AxisAlignedBox3D

Source

pub fn set_bounds(&mut self, val: AxisAlignedBox3D) -> &mut Self

Source

pub fn get_dims(&self) -> [usize; 3]

Source

pub fn get_mut_dims(&mut self) -> &mut [usize; 3]

Source

pub fn set_dims(&mut self, val: [usize; 3]) -> &mut Self

Source

pub fn get_normal_bias(&self) -> f32

Source

pub fn get_mut_normal_bias(&mut self) -> &mut f32

Source

pub fn set_normal_bias(&mut self, val: f32) -> &mut Self

Source

pub fn get_probes(&self) -> &Vec<Sh9Probe3D>

Source

pub fn get_mut_probes(&mut self) -> &mut Vec<Sh9Probe3D>

Source

pub fn set_probes(&mut self, val: Vec<Sh9Probe3D>) -> &mut Self

Trait Implementations§

Source§

impl Clone for LightProbeGrid3D

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 LightProbeGrid3D

Source§

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

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

impl PartialEq for LightProbeGrid3D

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LightProbeGrid3D

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.