RenderTarget

Struct RenderTarget 

Source
pub struct RenderTarget { /* private fields */ }
Expand description

A RenderTarget is a buffer that allows you to render a Node into a texture.

Implementations§

Source§

impl RenderTarget

Source

pub fn get_width(&self) -> i32

Gets the width of the rendering target.

Source

pub fn get_height(&self) -> i32

Gets the height of the rendering target.

Source

pub fn set_camera(&mut self, val: &dyn ICamera)

Sets the camera used for rendering the scene.

Source

pub fn get_camera(&self) -> Option<Camera>

Gets the camera used for rendering the scene.

Source

pub fn get_texture(&self) -> Texture2D

Gets the texture generated by the rendering target.

Source

pub fn render(&mut self, target: &dyn INode)

Renders a node to the target without replacing its previous contents.

§Arguments
  • target - The node to be rendered onto the render target.
Source

pub fn render_clear(&mut self, color: &Color, depth: f32, stencil: i32)

Clears the previous color, depth and stencil values on the render target.

§Arguments
  • color - The clear color used to clear the render target.
  • depth - Optional. The value used to clear the depth buffer of the render target. Default is 1.
  • stencil - Optional. The value used to clear the stencil buffer of the render target. Default is 0.
Source

pub fn render_clear_with_target( &mut self, target: &dyn INode, color: &Color, depth: f32, stencil: i32, )

Renders a node to the target after clearing the previous color, depth and stencil values on it.

§Arguments
  • target - The node to be rendered onto the render target.
  • color - The clear color used to clear the render target.
  • depth - The value used to clear the depth buffer of the render target. Default can be 1.
  • stencil - The value used to clear the stencil buffer of the render target. Default can be 0.
Source

pub fn save_async(&mut self, filename: &str, handler: Box<dyn FnMut(bool)>)

Saves the contents of the render target to a PNG file asynchronously.

§Arguments
  • filename - The name of the file to save the contents to.
  • handler - The function to call when the save operation is complete. The function will be passed a boolean value indicating whether the save operation was successful.
Source

pub fn new(width: i32, height: i32) -> RenderTarget

Trait Implementations§

Source§

impl Clone for RenderTarget

Source§

fn clone(&self) -> RenderTarget

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Drop for RenderTarget

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl IObject for RenderTarget

Source§

fn raw(&self) -> i64

Source§

fn obj(&self) -> &dyn IObject

Source§

fn as_any(&self) -> &dyn Any

Source§

fn get_id(&self) -> i32

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.