[][src]Struct pbrt::textures::constant::ConstantTexture

pub struct ConstantTexture<T> where
    T: Debug
{ /* fields omitted */ }

Implements trait Texture to return the given value.

Methods

impl<T> ConstantTexture<T> where
    T: Debug
[src]

pub fn new(value: T) -> ConstantTexture<T>[src]

Create a new ConstantTexture with the given constant value.

Examples

use pbrt::core::spectrum::Spectrum;
use pbrt::core::texture::Texture;
use pbrt::textures::constant::ConstantTexture;

let t = ConstantTexture::new(10.);
assert_eq!(10., t.evaluate(&Default::default()));

let t = ConstantTexture::new(Spectrum::from_rgb([1., 0., 0.]));
assert_eq!(
    Spectrum::from_rgb([1., 0., 0.]),
    t.evaluate(&Default::default())
);

Trait Implementations

impl<T: Clone> Clone for ConstantTexture<T> where
    T: Debug
[src]

impl<T> Debug for ConstantTexture<T> where
    T: Debug
[src]

fn fmt(&self, f: &mut Formatter) -> Result[src]

Implements fmt that surfaces the relevant details for the ConstantTexture.

impl<T> Texture<T> for ConstantTexture<T> where
    T: Clone + Debug
[src]

fn evaluate(&self, _si: &SurfaceInteraction) -> T[src]

Implements evaluate that just returns the same value for any SurfaceInteraction

Auto Trait Implementations

impl<T> RefUnwindSafe for ConstantTexture<T> where
    T: RefUnwindSafe

impl<T> Send for ConstantTexture<T> where
    T: Send

impl<T> Sync for ConstantTexture<T> where
    T: Sync

impl<T> Unpin for ConstantTexture<T> where
    T: Unpin

impl<T> UnwindSafe for ConstantTexture<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SetParameter for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.