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
impl RenderTarget
Sourcepub fn get_height(&self) -> i32
pub fn get_height(&self) -> i32
Gets the height of the rendering target.
Sourcepub fn set_camera(&mut self, val: &dyn ICamera)
pub fn set_camera(&mut self, val: &dyn ICamera)
Sets the camera used for rendering the scene.
Sourcepub fn get_camera(&self) -> Option<Camera>
pub fn get_camera(&self) -> Option<Camera>
Gets the camera used for rendering the scene.
Sourcepub fn get_texture(&self) -> Texture2D
pub fn get_texture(&self) -> Texture2D
Gets the texture generated by the rendering target.
Sourcepub fn render(&mut self, target: &dyn INode)
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.
Sourcepub fn render_clear(&mut self, color: &Color, depth: f32, stencil: i32)
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.
Sourcepub fn render_clear_with_target(
&mut self,
target: &dyn INode,
color: &Color,
depth: f32,
stencil: i32,
)
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.
Sourcepub fn save_async(&mut self, filename: &str, handler: Box<dyn FnMut(bool)>)
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.
pub fn new(width: i32, height: i32) -> RenderTarget
Trait Implementations§
Source§impl Clone for RenderTarget
impl Clone for RenderTarget
Source§fn clone(&self) -> RenderTarget
fn clone(&self) -> RenderTarget
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Drop for RenderTarget
impl Drop for RenderTarget
Auto Trait Implementations§
impl Freeze for RenderTarget
impl RefUnwindSafe for RenderTarget
impl Send for RenderTarget
impl Sync for RenderTarget
impl Unpin for RenderTarget
impl UnwindSafe for RenderTarget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more