[−][src]Struct tray_rust::bxdf::bsdf::BSDF
The BSDF contains the various BRDFs and BTDFs that describe the surface's properties at some point. It also transforms incident and outgoing light directions into shading space to make the BxDFs easier to implement. TODO: We really need the memory pool. Each time we get the bsdf from a material we need to allocate a decent amount of stuff since they each need their own tangent, bitangent and differential geometry reference.
Fields
p: Point
The hit point
n: Normal
Shading normal, may be perturbed by bump mapping
ng: Normal
The actual geometry normal
tan: Vector
Tangent vector for the surface
bitan: Vector
Bitangent vector for the surface
eta: f32
Refractive index of the geometry
Methods
impl<'a> BSDF<'a>
[src]
pub fn new<'b>(
bxdfs: &'a [&'a dyn BxDF],
eta: f32,
dg: &DifferentialGeometry<'b>
) -> BSDF<'a>
[src]
bxdfs: &'a [&'a dyn BxDF],
eta: f32,
dg: &DifferentialGeometry<'b>
) -> BSDF<'a>
Create a new BSDF using the BxDFs passed to shade the differential geometry with
refractive index eta
pub fn num_bxdfs(&self) -> usize
[src]
Return the total number of BxDFs
pub fn num_matching(&self, flags: EnumSet<BxDFType>) -> usize
[src]
Return the number of BxDFs matching the flags
pub fn to_shading(&self, v: &Vector) -> Vector
[src]
Transform the vector from world space to shading space
pub fn from_shading(&self, v: &Vector) -> Vector
[src]
Transform the vectro from shading space to world space
pub fn eval(
&self,
wo_world: &Vector,
wi_world: &Vector,
flags: EnumSet<BxDFType>
) -> Colorf
[src]
&self,
wo_world: &Vector,
wi_world: &Vector,
flags: EnumSet<BxDFType>
) -> Colorf
Evaluate the BSDF for the outgoing and incident light directions
w_o
and w_i
in world space, sampling the desired subset of BxDFs
selected by the flags passed. wo_world
and wi_world
should point from
the hit point in the outgoing and incident light directions respectively.
pub fn sample(
&self,
wo_world: &Vector,
flags: EnumSet<BxDFType>,
samples: &Sample
) -> (Colorf, Vector, f32, EnumSet<BxDFType>)
[src]
&self,
wo_world: &Vector,
flags: EnumSet<BxDFType>,
samples: &Sample
) -> (Colorf, Vector, f32, EnumSet<BxDFType>)
Sample a component of the BSDF to get an incident light direction for light
leaving the surface along w_o
.
samples
are the 3 random values to use when sampling a component of the BSDF
and a the chosen BSDF
Returns the color, direction, pdf and the type of BxDF that was sampled.
pub fn pdf(
&self,
wo_world: &Vector,
wi_world: &Vector,
flags: EnumSet<BxDFType>
) -> f32
[src]
&self,
wo_world: &Vector,
wi_world: &Vector,
flags: EnumSet<BxDFType>
) -> f32
Compute the pdf for sampling the pair of incident and outgoing light directions for the BxDFs matching the flags set
Auto Trait Implementations
impl<'a> !Send for BSDF<'a>
impl<'a> !Sync for BSDF<'a>
impl<'a> Unpin for BSDF<'a>
impl<'a> !UnwindSafe for BSDF<'a>
impl<'a> !RefUnwindSafe for BSDF<'a>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,