Trait arendur::lighting::Light
[−]
[src]
pub trait Light: Sync + Send { fn flags(&self) -> LightFlag; fn evaluate_sampled(&self, pos: Point3f, sample: Point2f) -> LightSample; fn generate_path(&self, samples: SampleInfo) -> PathInfo; fn pdf_path(
&self,
pos: Point3f,
dir: Vector3f,
normal: Vector3f
) -> (Float, Float); fn power(&self) -> RGBSpectrumf; fn is_delta(&self) -> bool { ... } fn evaluate_ray(&self, rd: &RayDifferential) -> RGBSpectrumf { ... } fn evaluate_path(&self, _pos: Point3f, _dir: Vector3f) -> RGBSpectrumf { ... } fn pdf(&self, _pos: Point3f, _wi: Vector3f) -> Float { ... } fn preprocess(&mut self, _s: &Scene) { ... } }
A Light
Required Methods
fn flags(&self) -> LightFlag
return the flags of the light
fn evaluate_sampled(&self, pos: Point3f, sample: Point2f) -> LightSample
Given a pos
in local frame with a uniform sample
in $[0, 1)$, sample an incoming direction from the light to that
location, returns the sampling result in a LightSample
.
fn generate_path(&self, samples: SampleInfo) -> PathInfo
Generate a photon path from the light source based on the sample info
fn pdf_path(
&self,
pos: Point3f,
dir: Vector3f,
normal: Vector3f
) -> (Float, Float)
&self,
pos: Point3f,
dir: Vector3f,
normal: Vector3f
) -> (Float, Float)
Given position and direction of a photon path, and the light's normal
return its pdfs as (pdfpos, pdfdir)
fn power(&self) -> RGBSpectrumf
returns an estimation of total power of this light
Provided Methods
fn is_delta(&self) -> bool
test if the light has delta distribution
fn evaluate_ray(&self, rd: &RayDifferential) -> RGBSpectrumf
Given a position and an incoming direction in local coordinates,
evaluate the light's radiance along that direction. This method
takes an RayDifferential
because some light implementations
might found thouse differentials helpful.
Default implementation yields zero radiance
fn evaluate_path(&self, _pos: Point3f, _dir: Vector3f) -> RGBSpectrumf
Given a position on surface and an direction in local coordinates, evaluate the light's emitted radiance along that direction.
Default implementation yields zero radiance
fn pdf(&self, _pos: Point3f, _wi: Vector3f) -> Float
Given a position and lighting ray wi
of an interaction,
return the pdf of it
fn preprocess(&mut self, _s: &Scene)
preporcess with scene components, if necessary. renderers should respect this requirement.
Default implementation is noop.
Implementors
impl Light for TriangleInstance
impl<S, M> Light for ShapedPrimitive<S, M> where
S: Shape,
M: Material,impl<T: Primitive> Light for TransformedComposable<T>
impl<T: Primitive> Light for TransformedComposable<Arc<T>>
impl Light for TransformedComposable<Arc<Primitive>>
impl Light for PointLight
impl Light for SpotLight
impl Light for DistantLight