RenderTargetMultisample

Struct RenderTargetMultisample 

Source
pub struct RenderTargetMultisample<C: TextureDataType, D: DepthTextureDataType> { /* private fields */ }
Expand description

A multisampled render target for color and depth data. Use this if you want to avoid aliasing, ie. jagged edges, when rendering to a RenderTarget.

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 RenderTargetMultisample::resolve, RenderTargetMultisample::resolve_to, RenderTargetMultisample::resolve_color_to or RenderTargetMultisample::resolve_depth_to methods.

Also see ColorTargetMultisample and DepthTargetMultisample.

Implementations§

Source§

impl<C: TextureDataType, D: DepthTextureDataType> RenderTargetMultisample<C, D>

Source

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

Constructs a new multisample render 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_color_to(&self, target: &ColorTarget<'_>)

Resolves the color of the multisample render target into the given non-multisample color target. The target must have the same width, height and TextureDataType as the color part of this target.

Source

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

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

Source

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

Resolves the multisample render target into the given non-multisample render target. The target must have the same width, height, TextureDataType and DepthTextureDataType as this target. If the given render target is the screen render target, it must be non-multisampled or have the same number of samples as this target.

Source

pub fn resolve_color(&self) -> Texture2D

Resolves the color of the multisample render target to a default non-multisample Texture2D. Use RenderTargetMultisample::resolve_color_to to resolve to a custom non-multisample texture.

Source

pub fn resolve_depth(&self) -> DepthTexture2D

Resolves the depth of the multisample render target to a default non-multisample DepthTexture2D. Use RenderTargetMultisample::resolve_depth_to to resolve to a custom non-multisample texture.

Source

pub fn resolve(&self) -> (Texture2D, DepthTexture2D)

Resolves the multisample render target to default non-multisample Texture2D and DepthTexture2D. Use RenderTargetMultisample::resolve_to to resolve to custom non-multisample textures.

Source§

impl<C: TextureDataType, D: DepthTextureDataType> RenderTargetMultisample<C, 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<C: TextureDataType, D: DepthTextureDataType> RenderTargetMultisample<C, 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§

§

impl<C, D> Freeze for RenderTargetMultisample<C, D>

§

impl<C, D> RefUnwindSafe for RenderTargetMultisample<C, D>

§

impl<C, D> Send for RenderTargetMultisample<C, D>
where C: Send, D: Send,

§

impl<C, D> Sync for RenderTargetMultisample<C, D>
where C: Sync, D: Sync,

§

impl<C, D> Unpin for RenderTargetMultisample<C, D>
where C: Unpin, D: Unpin,

§

impl<C, D> UnwindSafe for RenderTargetMultisample<C, D>
where C: UnwindSafe, D: UnwindSafe,

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,