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>

source

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.

source

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

Clears the color 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 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: &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.

source

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>

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<C: TextureDataType> ColorTargetMultisample<C>

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.

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

§

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.