Struct three_d::core::render_target::ColorTargetMultisample
source · pub struct ColorTargetMultisample<C: TextureDataType> { /* private fields */ }
Expand description
A multisample render target for color data. Use this if you want to avoid aliasing, ie. jagged edges, when rendering to a ColorTarget.
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 ColorTargetMultisample::resolve or ColorTargetMultisample::resolve_to methods.
Also see RenderTargetMultisample and DepthTargetMultisample.
Implementations§
source§impl<C: TextureDataType> ColorTargetMultisample<C>
impl<C: TextureDataType> ColorTargetMultisample<C>
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 color 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 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 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: &ColorTarget<'_>)
pub fn resolve_to(&self, target: &ColorTarget<'_>)
Resolves the multisample color target into the given non-multisample color target. The target must have the same width, height and TextureDataType as this target.
sourcepub fn resolve(&self) -> Texture2D
pub fn resolve(&self) -> Texture2D
Resolves the multisample color target to a default non-multisample Texture2D. Use ColorTargetMultisample::resolve_to to resolve to a custom non-multisample texture.
source§impl<C: TextureDataType> ColorTargetMultisample<C>
impl<C: TextureDataType> ColorTargetMultisample<C>
sourcepub fn scissor_box(&self) -> ScissorBox
pub fn scissor_box(&self) -> ScissorBox
Returns the scissor box that encloses the entire target.
source§impl<C: TextureDataType> ColorTargetMultisample<C>
impl<C: TextureDataType> ColorTargetMultisample<C>
sourcepub fn render(
&self,
camera: &Camera,
objects: impl IntoIterator<Item = impl Object>,
lights: &[&dyn Light]
) -> &Self
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.
sourcepub fn render_partially(
&self,
scissor_box: ScissorBox,
camera: &Camera,
objects: impl IntoIterator<Item = impl Object>,
lights: &[&dyn Light]
) -> &Self
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.
sourcepub fn render_with_material(
&self,
material: &dyn Material,
camera: &Camera,
geometries: impl IntoIterator<Item = impl Geometry>,
lights: &[&dyn Light]
) -> &Self
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.
sourcepub fn render_partially_with_material(
&self,
scissor_box: ScissorBox,
material: &dyn Material,
camera: &Camera,
geometries: impl IntoIterator<Item = impl Geometry>,
lights: &[&dyn Light]
) -> &Self
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.
sourcepub 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
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.
sourcepub 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
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.
sourcepub fn apply_screen_material(
&self,
material: &dyn Material,
camera: &Camera,
lights: &[&dyn Light]
) -> &Self
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.
sourcepub fn apply_screen_material_partially(
&self,
scissor_box: ScissorBox,
material: &dyn Material,
camera: &Camera,
lights: &[&dyn Light]
) -> &Self
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.
sourcepub fn apply_screen_effect(
&self,
effect: &dyn Effect,
camera: &Camera,
lights: &[&dyn Light],
color_texture: Option<ColorTexture<'_>>,
depth_texture: Option<DepthTexture<'_>>
) -> &Self
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.
sourcepub 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
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.