Skip to main content

RtLight

Struct RtLight 

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

Physical scene light combining emitter geometry with linear HDR color and intensity.

Implementations§

Source§

impl RtLight

Constructors, importance sampling, and direct area-light intersection for RtLight.

Source

pub fn directional( direction: Vec3, color: Vec3, intensity: f32, angular_radius_rad: f32, ) -> Self

Creates a directional sun/sky light with optional angular radius for physically soft shadows.

§Arguments
  • Vec3 - Direction pointing from the scene toward the light source.
  • Vec3 - Linear HDR light color.
  • f32 - Radiant irradiance multiplier.
  • f32 - Angular half-angle in radians (0.0 for razor-sharp sun shadows).
§Returns
  • Self - Directional RtLight.
Source

pub fn point(position: Vec3, color: Vec3, intensity: f32, radius: f32) -> Self

Creates an omnidirectional spherical point light with inverse-square attenuation.

§Arguments
  • Vec3 - World-space light center.
  • Vec3 - Linear HDR light color.
  • f32 - Luminous intensity.
  • f32 - Spherical radius in meters (0.0 for delta point light).
§Returns
  • Self - Point RtLight.
Source

pub fn spot( position: Vec3, direction: Vec3, color: Vec3, intensity: f32, inner_deg: f32, outer_deg: f32, radius: f32, ) -> Self

Creates a focused spotlight with inner/outer cone angles in degrees and optional soft emitter radius.

§Arguments
  • Vec3 - World-space emitter origin.
  • Vec3 - Beam forward direction.
  • Vec3 - Linear HDR light color.
  • f32 - Luminous intensity.
  • f32 - Inner full-brightness half-angle in degrees.
  • f32 - Outer cutoff half-angle in degrees.
  • f32 - Emitter radius in meters.
§Returns
  • Self - Spotlight RtLight.
Source

pub fn rect_area( position: Vec3, normal: Vec3, dimensions: Vec2, color: Vec3, intensity: f32, two_sided: bool, ) -> Self

Creates a physically based rectangular area light emitter oriented along normal.

§Arguments
  • Vec3 - World-space rectangle center.
  • Vec3 - Outward emitting surface normal.
  • Vec2 - Emitter (width, height) dimensions in meters.
  • Vec3 - Linear HDR emission color.
  • f32 - Emitted radiance multiplier.
  • bool - Whether both sides of the rectangle emit radiance.
§Returns
  • Self - Rectangular area RtLight.
Source

pub fn disk_area( position: Vec3, normal: Vec3, radius: f32, color: Vec3, intensity: f32, two_sided: bool, ) -> Self

Creates a physically based circular disk area light emitter oriented along normal.

§Arguments
  • Vec3 - World-space disk center.
  • Vec3 - Outward emitting surface normal.
  • f32 - Disk radius in meters.
  • Vec3 - Linear HDR emission color.
  • f32 - Emitted radiance multiplier.
  • bool - Whether both sides of the disk emit radiance.
§Returns
  • Self - Circular disk area RtLight.
Source

pub fn sample_light(&self, hit_point: Vec3, xi: [f32; 2]) -> RtLightSample

Importance-samples a direct lighting direction and solid-angle PDF from hit_point.

§Arguments
  • &Self - Light emitter reference.
  • Vec3 - World-space shaded surface position.
  • [f32; 2] - Uniform quasi-random or pseudo-random pair in [0.0, 1.0)^2.
§Returns
  • RtLightSample - Sampled direction, distance, incident radiance, solid-angle PDF, and delta flag.
Source

pub fn intersect_area( &self, ray: &Ray3D, t_min: f32, t_max: f32, ) -> Option<(f32, Vec3, f32)>

Intersects a ray with an explicit finite area light (RectArea or DiskArea) returning (distance, radiance, solid_angle_pdf).

§Arguments
  • &Self - Light emitter reference.
  • &Ray3D - World-space ray.
  • f32 - Minimum accepted distance.
  • f32 - Maximum accepted distance.
§Returns
  • Option<(f32, Vec3, f32)> - Hit distance, emitted HDR radiance, and solid-angle sampling PDF for MIS.
Source§

impl RtLight

Implements impl #impl_generics #name #ty_generics #where_clause.

Source

pub fn get_kind(&self) -> RtLightKind

Source

pub fn get_mut_kind(&mut self) -> &mut RtLightKind

Source

pub fn set_kind(&mut self, val: RtLightKind) -> &mut Self

Source

pub fn get_color(&self) -> Vec3

Source

pub fn get_mut_color(&mut self) -> &mut Vec3

Source

pub fn set_color(&mut self, val: Vec3) -> &mut Self

Source

pub fn get_intensity(&self) -> f32

Source

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

Source

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

Trait Implementations§

Source§

impl Clone for RtLight

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 Copy for RtLight

Source§

impl Debug for RtLight

Source§

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

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

impl PartialEq for RtLight

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 RtLight

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.