Struct three_d::core::render_target::DepthTarget
source · [−]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 DepthTargetTexture2D) 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
sourceimpl<'a> DepthTarget<'a>
impl<'a> DepthTarget<'a>
sourcepub fn clear(&self, clear_state: ClearState) -> ThreeDResult<&Self>
pub fn clear(&self, clear_state: ClearState) -> ThreeDResult<&Self>
Clears the depth of this depth target as defined by the given clear state.
sourcepub fn clear_partially(
&self,
scissor_box: ScissorBox,
clear_state: ClearState
) -> ThreeDResult<&Self>
pub fn clear_partially(
&self,
scissor_box: ScissorBox,
clear_state: ClearState
) -> ThreeDResult<&Self>
Clears the depth of the part of this depth target that is inside the given scissor box.
sourcepub fn write(
&self,
render: impl FnOnce() -> ThreeDResult<()>
) -> ThreeDResult<&Self>
pub fn write(
&self,
render: impl FnOnce() -> ThreeDResult<()>
) -> ThreeDResult<&Self>
Writes whatever rendered in the render closure into this depth target.
sourcepub fn write_partially(
&self,
scissor_box: ScissorBox,
render: impl FnOnce() -> ThreeDResult<()>
) -> ThreeDResult<&Self>
pub fn write_partially(
&self,
scissor_box: ScissorBox,
render: impl FnOnce() -> ThreeDResult<()>
) -> ThreeDResult<&Self>
Writes whatever rendered in the render closure into the part of this depth target defined by the scissor box.
sourcepub fn read(&self) -> ThreeDResult<Vec<f32>>
pub fn read(&self) -> ThreeDResult<Vec<f32>>
Returns the depth values in this depth target.
sourcepub fn read_partially(&self, scissor_box: ScissorBox) -> ThreeDResult<Vec<f32>>
pub fn read_partially(&self, scissor_box: ScissorBox) -> ThreeDResult<Vec<f32>>
Returns the depth values in this depth target inside the given scissor box.
sourcepub fn width(&self) -> u32
pub fn width(&self) -> u32
Returns the width of the depth target in texels, which is simply the width of the underlying texture.
sourcepub fn height(&self) -> u32
pub fn height(&self) -> u32
Returns the height of the depth target in texels, which is simply the height of the underlying texture.
sourcepub fn scissor_box(&self) -> ScissorBox
pub fn scissor_box(&self) -> ScissorBox
Returns the scissor box that encloses the entire target.
sourceimpl<'a> DepthTarget<'a>
impl<'a> DepthTarget<'a>
sourcepub fn render(
&self,
camera: &Camera,
objects: &[&dyn Object],
lights: &[&dyn Light]
) -> ThreeDResult<&Self>
pub fn render(
&self,
camera: &Camera,
objects: &[&dyn Object],
lights: &[&dyn Light]
) -> ThreeDResult<&Self>
Render the objects using the given camera and lights into this depth 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.
sourcepub fn render_partially(
&self,
scissor_box: ScissorBox,
camera: &Camera,
objects: &[&dyn Object],
lights: &[&dyn Light]
) -> ThreeDResult<&Self>
pub fn render_partially(
&self,
scissor_box: ScissorBox,
camera: &Camera,
objects: &[&dyn Object],
lights: &[&dyn Light]
) -> ThreeDResult<&Self>
Render the objects using the given camera and lights into the part of this depth 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.
Trait Implementations
sourceimpl<'a> Clone for DepthTarget<'a>
impl<'a> Clone for DepthTarget<'a>
sourcefn clone(&self) -> DepthTarget<'a>
fn clone(&self) -> DepthTarget<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more