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.
impl RtLight
Constructors, importance sampling, and direct area-light intersection for RtLight.
Sourcepub fn directional(
direction: Vec3,
color: Vec3,
intensity: f32,
angular_radius_rad: f32,
) -> Self
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.0for razor-sharp sun shadows).
§Returns
Self- DirectionalRtLight.
Sourcepub fn spot(
position: Vec3,
direction: Vec3,
color: Vec3,
intensity: f32,
inner_deg: f32,
outer_deg: f32,
radius: f32,
) -> Self
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- SpotlightRtLight.
Sourcepub fn rect_area(
position: Vec3,
normal: Vec3,
dimensions: Vec2,
color: Vec3,
intensity: f32,
two_sided: bool,
) -> Self
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 areaRtLight.
Sourcepub fn disk_area(
position: Vec3,
normal: Vec3,
radius: f32,
color: Vec3,
intensity: f32,
two_sided: bool,
) -> Self
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 areaRtLight.
Sourcepub fn sample_light(&self, hit_point: Vec3, xi: [f32; 2]) -> RtLightSample
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.
Sourcepub fn intersect_area(
&self,
ray: &Ray3D,
t_min: f32,
t_max: f32,
) -> Option<(f32, Vec3, f32)>
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.
impl RtLight
Implements impl #impl_generics #name #ty_generics #where_clause.