pub struct Renderer { /* private fields */ }Expand description
A class used for rendering using any number of render pipelines.
Implementations§
Source§impl Renderer
impl Renderer
Sourcepub async fn new(window: &Window) -> Result<Self>
pub async fn new(window: &Window) -> Result<Self>
Creates a new renderer given a window.
§Requirements:
- any of the supported backends
- all native features must be supported by the rendering device
Sourcepub fn with_camera(self, camera: Camera) -> Self
pub fn with_camera(self, camera: Camera) -> Self
Sets the camera of the renderer.
pub fn add_pipeline(&mut self, pipeline: Box<dyn RenderPipeline>)
Sourcepub fn get_texture(&self, label: &str, texture_path: &Path) -> Result<Texture>
pub fn get_texture(&self, label: &str, texture_path: &Path) -> Result<Texture>
Loads a texture from a file.
Sourcepub async fn render(&mut self) -> Result<(), SurfaceError>
pub async fn render(&mut self) -> Result<(), SurfaceError>
Runs on every iteration of the window’s event_loop. Renders without altering the state of the Renderer.
Auto Trait Implementations§
impl !Freeze for Renderer
impl !RefUnwindSafe for Renderer
impl !Send for Renderer
impl !Sync for Renderer
impl Unpin for Renderer
impl !UnwindSafe for Renderer
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more