pub struct NormalMaterial {
    pub normal_scale: f32,
    pub normal_texture: Option<Arc<Texture2D>>,
    pub render_states: RenderStates,
}
Expand description

Render the object with colors that reflect its normals which primarily is used for debug purposes. A normal with an x value of -1 yields 0.0 in the red channel and an x value of 1 yields 1.0 in the red channel. The same mapping is applied from y value to green channel and z value to blue channel.

Fields§

§normal_scale: f32

A scalar multiplier applied to each normal vector of the Self::normal_texture.

§normal_texture: Option<Arc<Texture2D>>

A tangent space normal map, also known as bump map.

§render_states: RenderStates

Render states.

Implementations§

source§

impl NormalMaterial

source

pub fn new(context: &Context, cpu_material: &CpuMaterial) -> Self

Constructs a new normal material from a CpuMaterial where only relevant information is used.

source

pub fn from_physical_material(physical_material: &PhysicalMaterial) -> Self

Creates a normal material from a PhysicalMaterial.

Trait Implementations§

source§

impl Clone for NormalMaterial

source§

fn clone(&self) -> NormalMaterial

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for NormalMaterial

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl FromCpuMaterial for NormalMaterial

source§

fn from_cpu_material(context: &Context, cpu_material: &CpuMaterial) -> Self

Creates a new material that can be used for rendering from a CpuMaterial.
source§

impl Material for NormalMaterial

source§

fn fragment_shader_source( &self, _use_vertex_colors: bool, _lights: &[&dyn Light] ) -> String

Returns the fragment shader source for this material. Should output the final fragment color.
source§

fn use_uniforms(&self, program: &Program, _camera: &Camera, _lights: &[&dyn Light])

Sends the uniform data needed for this material to the fragment shader.
source§

fn render_states(&self) -> RenderStates

Returns the render states needed to render with this material.
source§

fn material_type(&self) -> MaterialType

Returns the type of material.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> SerializableAny for Twhere T: 'static + Any + Clone + Send + Sync,