pub struct DepthTarget<'a> { /* private fields */ }
Expand description

Adds additional functionality to clear, read from and write to a texture. Use the as_depth_target function directly on the texture structs (for example DepthTexture2D) to construct a depth target. Combine this together with a ColorTarget with RenderTarget::new to be able to write to both a depth and color target at the same time. A depth target purely adds functionality, so it can be created each time it is needed, the actual data is saved in the texture.

Implementations§

source§

impl<'a> DepthTarget<'a>

source

pub fn clear(&self, clear_state: ClearState) -> &Self

Clears the depth of this depth target as defined by the given clear state.

source

pub fn clear_partially( &self, scissor_box: ScissorBox, clear_state: ClearState ) -> &Self

Clears the depth of the part of this depth target that is inside the given scissor box.

source

pub fn write<E: Error>( &self, render: impl FnOnce() -> Result<(), E> ) -> Result<&Self, E>

Writes whatever rendered in the render closure into this depth target.

source

pub fn write_partially<E: Error>( &self, scissor_box: ScissorBox, render: impl FnOnce() -> Result<(), E> ) -> Result<&Self, E>

Writes whatever rendered in the render closure into the part of this depth target defined by the scissor box.

source

pub fn read(&self) -> Vec<f32>

Returns the depth values in this depth target.

source

pub fn read_partially(&self, scissor_box: ScissorBox) -> Vec<f32>

Returns the depth values in this depth target inside the given scissor box.

source

pub fn width(&self) -> u32

Returns the width of the depth target in texels, which is simply the width of the underlying texture.

source

pub fn height(&self) -> u32

Returns the height of the depth target in texels, which is simply the height of the underlying texture.

source§

impl<'a> DepthTarget<'a>

source

pub fn scissor_box(&self) -> ScissorBox

Returns the scissor box that encloses the entire target.

source

pub fn viewport(&self) -> Viewport

Returns the viewport that encloses the entire target.

source§

impl<'a> DepthTarget<'a>

source

pub fn render( &self, camera: &Camera, objects: impl IntoIterator<Item = impl Object>, lights: &[&dyn Light] ) -> &Self

Render the objects using the given camera and lights into this render target. Use an empty array for the lights argument, if the objects does not require lights to be rendered. Also, objects outside the camera frustum are not rendered and the objects are rendered in the order given by cmp_render_order.

source

pub fn render_partially( &self, scissor_box: ScissorBox, camera: &Camera, objects: impl IntoIterator<Item = impl Object>, lights: &[&dyn Light] ) -> &Self

Render the objects using the given camera and lights into the part of this render target defined by the scissor box. Use an empty array for the lights argument, if the objects does not require lights to be rendered. Also, objects outside the camera frustum are not rendered and the objects are rendered in the order given by cmp_render_order.

source

pub fn render_with_material( &self, material: &dyn Material, camera: &Camera, geometries: impl IntoIterator<Item = impl Geometry>, lights: &[&dyn Light] ) -> &Self

Render the geometries with the given Material using the given camera and lights into this render target. Use an empty array for the lights argument, if the material does not require lights to be rendered.

source

pub fn render_partially_with_material( &self, scissor_box: ScissorBox, material: &dyn Material, camera: &Camera, geometries: impl IntoIterator<Item = impl Geometry>, lights: &[&dyn Light] ) -> &Self

Render the geometries with the given Material using the given camera and lights into the part of this render target defined by the scissor box. Use an empty array for the lights argument, if the material does not require lights to be rendered.

source

pub fn render_with_effect( &self, effect: &dyn Effect, camera: &Camera, geometries: impl IntoIterator<Item = impl Geometry>, lights: &[&dyn Light], color_texture: Option<ColorTexture<'_>>, depth_texture: Option<DepthTexture<'_>> ) -> &Self

Render the geometries with the given Effect using the given camera and lights into this render target. Use an empty array for the lights argument, if the effect does not require lights to be rendered.

source

pub fn render_partially_with_effect( &self, scissor_box: ScissorBox, effect: &dyn Effect, camera: &Camera, geometries: impl IntoIterator<Item = impl Geometry>, lights: &[&dyn Light], color_texture: Option<ColorTexture<'_>>, depth_texture: Option<DepthTexture<'_>> ) -> &Self

Render the geometries with the given Effect using the given camera and lights into the part of this render target defined by the scissor box. Use an empty array for the lights argument, if the effect does not require lights to be rendered.

source

pub fn apply_screen_material( &self, material: &dyn Material, camera: &Camera, lights: &[&dyn Light] ) -> &Self

Apply the given Material to this render target. Use an empty array for the lights argument, if the material does not require lights to be rendered.

source

pub fn apply_screen_material_partially( &self, scissor_box: ScissorBox, material: &dyn Material, camera: &Camera, lights: &[&dyn Light] ) -> &Self

Apply the given Material to the part of this render target defined by the scissor box. Use an empty array for the lights argument, if the material does not require lights to be rendered.

source

pub fn apply_screen_effect( &self, effect: &dyn Effect, camera: &Camera, lights: &[&dyn Light], color_texture: Option<ColorTexture<'_>>, depth_texture: Option<DepthTexture<'_>> ) -> &Self

Apply the given Effect to this render target. Use an empty array for the lights argument, if the effect does not require lights to be rendered.

source

pub fn apply_screen_effect_partially( &self, scissor_box: ScissorBox, effect: &dyn Effect, camera: &Camera, lights: &[&dyn Light], color_texture: Option<ColorTexture<'_>>, depth_texture: Option<DepthTexture<'_>> ) -> &Self

Apply the given Effect to the part of this render target defined by the scissor box. Use an empty array for the lights argument, if the effect does not require lights to be rendered.

Trait Implementations§

source§

impl<'a> Clone for DepthTarget<'a>

source§

fn clone(&self) -> DepthTarget<'a>

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

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for DepthTarget<'a>

§

impl<'a> !Send for DepthTarget<'a>

§

impl<'a> !Sync for DepthTarget<'a>

§

impl<'a> Unpin for DepthTarget<'a>

§

impl<'a> UnwindSafe for DepthTarget<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.