Struct three_d::PhongForwardMesh[][src]

pub struct PhongForwardMesh {
    pub name: String,
    pub material: PhongMaterial,
    // some fields omitted
}

A triangle mesh that adds additional lighting functionality based on the Phong shading model to a Mesh.

Fields

name: Stringmaterial: PhongMaterial

Implementations

impl PhongForwardMesh[src]

pub fn new(
    context: &Context,
    cpu_mesh: &CPUMesh,
    material: &PhongMaterial
) -> Result<Self, Error>
[src]

pub fn render_with_ambient(
    &self,
    render_states: RenderStates,
    viewport: Viewport,
    transformation: &Mat4,
    camera: &Camera,
    ambient_light: &AmbientLight
) -> Result<(), Error>
[src]

Render the triangle mesh shaded with an ambient light. Must be called in a render target render function, for example in the callback function of Screen::write.

pub fn render_with_ambient_and_directional(
    &self,
    render_states: RenderStates,
    viewport: Viewport,
    transformation: &Mat4,
    camera: &Camera,
    ambient_light: &AmbientLight,
    directional_light: &DirectionalLight
) -> Result<(), Error>
[src]

Render the triangle mesh shaded with an ambient and a directional light. Must be called in a render target render function, for example in the callback function of Screen::write.

Methods from Deref<Target = Mesh>

pub fn render_depth(
    &self,
    render_states: RenderStates,
    viewport: Viewport,
    transformation: &Mat4,
    camera: &Camera
) -> Result<(), Error>
[src]

Render only the depth of the mesh into the current depth render target which is useful for shadow maps or depth pre-pass. Must be called in a render target render function, for example in the callback function of Screen::write. The transformation can be used to position, orientate and scale the mesh.

pub fn render_color(
    &self,
    render_states: RenderStates,
    viewport: Viewport,
    transformation: &Mat4,
    camera: &Camera
) -> Result<(), Error>
[src]

Render the mesh with a color per triangle vertex. The colors are defined when constructing the mesh. Must be called in a render target render function, for example in the callback function of Screen::write. The transformation can be used to position, orientate and scale the mesh.

Errors

Will return an error if the mesh has no colors.

pub fn render_with_color(
    &self,
    color: &Vec4,
    render_states: RenderStates,
    viewport: Viewport,
    transformation: &Mat4,
    camera: &Camera
) -> Result<(), Error>
[src]

Render the instanced mesh with the given color. Must be called in a render target render function, for example in the callback function of Screen::write. The transformation can be used to position, orientate and scale the mesh.

pub fn render_with_texture(
    &self,
    texture: &dyn Texture,
    render_states: RenderStates,
    viewport: Viewport,
    transformation: &Mat4,
    camera: &Camera
) -> Result<(), Error>
[src]

Render the mesh with the given texture. Must be called in a render target render function, for example in the callback function of Screen::write. The transformation can be used to position, orientate and scale the mesh.

Errors

Will return an error if the mesh has no uv coordinates.

pub fn render(
    &self,
    program: &MeshProgram,
    render_states: RenderStates,
    viewport: Viewport,
    transformation: &Mat4,
    camera: &Camera
) -> Result<(), Error>
[src]

Render the mesh with the given MeshProgram. Must be called in a render target render function, for example in the callback function of Screen::write. The transformation can be used to position, orientate and scale the mesh.

Errors

Will return an error if the mesh shader program requires a certain attribute and the mesh does not have that attribute. For example if the program needs the normal to calculate lighting, but the mesh does not have per vertex normals, this function will return an error.

Trait Implementations

impl Deref for PhongForwardMesh[src]

type Target = Mesh

The resulting type after dereferencing.

impl Drop for PhongForwardMesh[src]

Auto Trait Implementations

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, 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.