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>
impl<D: DepthTextureDataType> DepthTargetMultisample<D>
Sourcepub fn new(
context: &Context,
width: u32,
height: u32,
number_of_samples: u32,
) -> Self
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.
Sourcepub fn clear(&self, clear_state: ClearState) -> &Self
pub fn clear(&self, clear_state: ClearState) -> &Self
Clears the color and depth of this target as defined by the given clear state.
Sourcepub fn clear_partially(
&self,
scissor_box: ScissorBox,
clear_state: ClearState,
) -> &Self
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.
Sourcepub fn write<E: Error>(
&self,
render: impl FnOnce() -> Result<(), E>,
) -> Result<&Self, E>
pub fn write<E: Error>( &self, render: impl FnOnce() -> Result<(), E>, ) -> Result<&Self, E>
Writes whatever rendered in the render closure into this target.
Sourcepub fn write_partially<E: Error>(
&self,
scissor_box: ScissorBox,
render: impl FnOnce() -> Result<(), E>,
) -> Result<&Self, E>
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.
Sourcepub fn number_of_samples(&self) -> u32
pub fn number_of_samples(&self) -> u32
The number of samples for each fragment.
Sourcepub fn resolve_to(&self, target: &DepthTarget<'_>)
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.
Sourcepub fn resolve(&self) -> DepthTexture2D
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>
impl<D: DepthTextureDataType> DepthTargetMultisample<D>
Sourcepub fn scissor_box(&self) -> ScissorBox
pub fn scissor_box(&self) -> ScissorBox
Returns the scissor box that encloses the entire target.
Source§impl<D: DepthTextureDataType> DepthTargetMultisample<D>
impl<D: DepthTextureDataType> DepthTargetMultisample<D>
Sourcepub fn render(
&self,
viewer: impl Viewer,
objects: impl IntoIterator<Item = impl Object>,
lights: &[&dyn Light],
) -> &Self
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.
Sourcepub fn render_partially(
&self,
scissor_box: ScissorBox,
viewer: impl Viewer,
objects: impl IntoIterator<Item = impl Object>,
lights: &[&dyn Light],
) -> &Self
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.
Sourcepub fn render_with_material(
&self,
material: &dyn Material,
viewer: impl Viewer,
geometries: impl IntoIterator<Item = impl Geometry>,
lights: &[&dyn Light],
) -> &Self
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.
Sourcepub 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
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.
Sourcepub 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
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.
Sourcepub 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
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.
Sourcepub fn apply_screen_material(
&self,
material: &dyn Material,
viewer: impl Viewer,
lights: &[&dyn Light],
) -> &Self
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.
Sourcepub fn apply_screen_material_partially(
&self,
scissor_box: ScissorBox,
material: &dyn Material,
viewer: impl Viewer,
lights: &[&dyn Light],
) -> &Self
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.
Sourcepub fn apply_screen_effect(
&self,
effect: &dyn Effect,
viewer: impl Viewer,
lights: &[&dyn Light],
color_texture: Option<ColorTexture<'_>>,
depth_texture: Option<DepthTexture<'_>>,
) -> &Self
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.
Sourcepub 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
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.