Struct three_d::phong::PhongMesh [−][src]
pub struct PhongMesh { pub material: PhongMaterial, // some fields omitted }
Expand description
Extends a Mesh by adding functionality to render it based on the Phong shading model.
Fields
material: PhongMaterial
Implementations
impl PhongMesh
[src]
impl PhongMesh
[src]pub fn new(
context: &Context,
cpu_mesh: &CPUMesh,
material: &PhongMaterial
) -> Result<Self, Error>
[src]
context: &Context,
cpu_mesh: &CPUMesh,
material: &PhongMaterial
) -> Result<Self, Error>
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]
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 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 = Mesh>
pub fn render_color(
&self,
render_states: RenderStates,
viewport: Viewport,
camera: &Camera
) -> Result<(), Error>
[src]
pub fn render_color(
&self,
render_states: RenderStates,
viewport: Viewport,
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.
Errors
Will return an error if the mesh has no colors.
pub fn render_with_color(
&self,
color: &Vec4,
render_states: RenderStates,
viewport: Viewport,
camera: &Camera
) -> Result<(), Error>
[src]
pub fn render_with_color(
&self,
color: &Vec4,
render_states: RenderStates,
viewport: Viewport,
camera: &Camera
) -> Result<(), Error>
[src]Render the mesh with the given color. Must be called in a render target render function, for example in the callback function of Screen::write.
pub fn render_uvs(
&self,
render_states: RenderStates,
viewport: Viewport,
camera: &Camera
) -> Result<(), Error>
[src]
pub fn render_uvs(
&self,
render_states: RenderStates,
viewport: Viewport,
camera: &Camera
) -> Result<(), Error>
[src]Render the uv coordinates of the mesh in red (u) and green (v). Must be called in a render target render function, for example in the callback function of Screen::write.
Errors
Will return an error if the mesh has no uv coordinates.
pub fn render_with_texture(
&self,
texture: &impl Texture,
render_states: RenderStates,
viewport: Viewport,
camera: &Camera
) -> Result<(), Error>
[src]
pub fn render_with_texture(
&self,
texture: &impl Texture,
render_states: RenderStates,
viewport: Viewport,
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.
Errors
Will return an error if the mesh has no uv coordinates.
pub fn render(
&self,
program: &MeshProgram,
render_states: RenderStates,
viewport: Viewport,
camera: &Camera
) -> Result<(), Error>
[src]
pub fn render(
&self,
program: &MeshProgram,
render_states: RenderStates,
viewport: Viewport,
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.
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 Geometry for PhongMesh
[src]
impl Geometry for PhongMesh
[src]fn render_depth_to_red(
&self,
render_states: RenderStates,
viewport: Viewport,
camera: &Camera,
max_depth: f32
) -> Result<(), Error>
[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]
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 PhongMesh
[src]
impl PhongGeometry for PhongMesh
[src]fn geometry_pass(
&self,
render_states: RenderStates,
viewport: Viewport,
camera: &Camera
) -> Result<(), Error>
[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
impl !RefUnwindSafe for PhongMesh
impl !Send for PhongMesh
impl !Sync for PhongMesh
impl Unpin for PhongMesh
impl !UnwindSafe for PhongMesh
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more