DepthTargetMultisample

Struct DepthTargetMultisample 

Source
pub struct DepthTargetMultisample<D: DepthTextureDataType> { /* private fields */ }
Expand description

A multisample render target for depth data. Use this if you want to avoid aliasing, ie. jagged edges, when rendering to a DepthTarget.

After rendering into this target, it needs to be resolved to a non-multisample texture to be able to sample it in a shader. To do this, use the DepthTargetMultisample::resolve or DepthTargetMultisample::resolve_to methods.

Also see RenderTargetMultisample and ColorTargetMultisample.

Implementations§

Source§

impl<D: DepthTextureDataType> DepthTargetMultisample<D>

Source

pub fn new( context: &Context, width: u32, height: u32, number_of_samples: u32, ) -> Self

Constructs a new multisample depth target with the given dimensions and number of samples. The number of samples must be larger than 0, less than or equal to the maximum number of samples supported by the hardware and power of two.

Source

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

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

Source

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

Clears the color and depth of the part of this 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 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 target defined by the scissor box.

Source

pub fn width(&self) -> u32

The width of this target.

Source

pub fn height(&self) -> u32

The height of this target.

Source

pub fn number_of_samples(&self) -> u32

The number of samples for each fragment.

Source

pub fn resolve_to(&self, target: &DepthTarget<'_>)

Resolves the multisample depth target into the given non-multisample depth target. The target must have the same width, height and DepthTextureDataType as this target.

Source

pub fn resolve(&self) -> DepthTexture2D

Resolves the multisample depth target to a default non-multisample DepthTexture2D. Use DepthTargetMultisample::resolve_to to resolve to a custom non-multisample texture.

Source§

impl<D: DepthTextureDataType> DepthTargetMultisample<D>

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<D: DepthTextureDataType> DepthTargetMultisample<D>

Source

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

Render the objects using the given viewer 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 viewer 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, viewer: impl Viewer, objects: impl IntoIterator<Item = impl Object>, lights: &[&dyn Light], ) -> &Self

Render the objects using the given viewer 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 viewer 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, viewer: impl Viewer, geometries: impl IntoIterator<Item = impl Geometry>, lights: &[&dyn Light], ) -> &Self

Render the geometries with the given Material using the given viewer 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, viewer: impl Viewer, geometries: impl IntoIterator<Item = impl Geometry>, lights: &[&dyn Light], ) -> &Self

Render the geometries with the given Material using the given viewer 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, viewer: impl Viewer, 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 viewer 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, viewer: impl Viewer, 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 viewer 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, viewer: impl Viewer, 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, viewer: impl Viewer, 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, viewer: impl Viewer, 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, viewer: impl Viewer, 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.

Auto Trait Implementations§

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

Source§

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

Source§

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.
Source§

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