Struct three_d::PhongInstancedMesh[][src]

pub struct PhongInstancedMesh {
    pub name: String,
    pub material: PhongMaterial,
    // some fields omitted
}
Expand description

Extends a InstancedMesh by adding functionality to render it based on the Phong shading model.

Fields

name: Stringmaterial: PhongMaterial

Implementations

impl PhongInstancedMesh[src]

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

pub fn render_with_lighting(
    &self,
    render_states: RenderStates,
    viewport: Viewport,
    camera: &Camera,
    ambient_light: Option<&AmbientLight>,
    directional_lights: &[&DirectionalLight],
    spot_lights: &[&SpotLight],
    point_lights: &[&PointLight]
) -> Result<(), Error>
[src]

Render the instanced triangle mesh shaded with the given lights based on the Phong shading model. Must be called in a render target render function, for example in the callback function of Screen::write.

Methods from Deref<Target = InstancedMesh>

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

Render the instanced mesh with a color per triangle vertex. The colors are defined when constructing the instanced 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 instanced mesh.

Errors

Will return an error if the instanced mesh has no colors.

pub fn render_with_color(
    &self,
    color: &Vec4,
    render_states: RenderStates,
    viewport: Viewport,
    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 instanced mesh.

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

Render the instanced 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 instanced mesh.

Errors

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

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

Render the instanced mesh with the given InstancedMeshProgram. 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 instanced mesh.

Errors

Will return an error if the instanced mesh shader program requires a certain attribute and the instanced 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.

pub fn update_transformations(&mut self, transformations: &[Mat4])[src]

Updates the transformations applied to each mesh instance before they are rendered. The mesh is rendered in as many instances as there are transformation matrices.

Trait Implementations

impl Deref for PhongInstancedMesh[src]

type Target = InstancedMesh

The resulting type after dereferencing.

fn deref(&self) -> &InstancedMesh[src]

Dereferences the value.

impl DerefMut for PhongInstancedMesh[src]

fn deref_mut(&mut self) -> &mut Self::Target[src]

Mutably dereferences the value.

impl Drop for PhongInstancedMesh[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

impl Geometry for PhongInstancedMesh[src]

fn render_depth_to_red(
    &self,
    render_states: RenderStates,
    viewport: Viewport,
    camera: &Camera,
    max_depth: f32
) -> Result<(), Error>
[src]

Render the depth (scaled such that a value of 1 corresponds to max_depth) into the red channel of the current color render target which for example is used for picking. Must be called in a render target render function, for example in the callback function of Screen::write. Read more

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

Render only the depth 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. Read more

fn aabb(&self) -> Option<AxisAlignedBoundingBox>[src]

impl PhongGeometry for PhongInstancedMesh[src]

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

Render the geometry and surface material parameters of the mesh, ie. the first part of a deferred render pass. Read more

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

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

Performs the conversion.

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.

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

Performs the conversion.