pub struct Renderer { /* private fields */ }Expand description
Renders Scenes. One renderer (and one set of atlases) is shared by
all windows of an application.
Implementations§
Source§impl Renderer
impl Renderer
pub fn new(gpu: &GpuContext) -> Renderer
Sourcepub fn atlas(&mut self) -> &mut Atlas
pub fn atlas(&mut self) -> &mut Atlas
The glyph/image atlas. Painting code inserts tiles here; they are
uploaded to the GPU on the next Renderer::render.
Sourcepub fn render(
&mut self,
gpu: &GpuContext,
scene: &Scene,
target: &TextureView,
format: TextureFormat,
size: (u32, u32),
clear: Color,
)
pub fn render( &mut self, gpu: &GpuContext, scene: &Scene, target: &TextureView, format: TextureFormat, size: (u32, u32), clear: Color, )
Renders scene into target (a view of a format texture of size
pixels), clearing it to clear first. Submits its own command buffer.
Sourcepub fn render_to_rgba(
&mut self,
gpu: &GpuContext,
scene: &Scene,
width: u32,
height: u32,
clear: Color,
) -> Vec<u8> ⓘ
pub fn render_to_rgba( &mut self, gpu: &GpuContext, scene: &Scene, width: u32, height: u32, clear: Color, ) -> Vec<u8> ⓘ
Renders scene offscreen and returns tightly packed RGBA8 pixels
(premultiplied alpha). Used for screenshots and visual tests.
Sourcepub fn read_texture_rgba(
&self,
gpu: &GpuContext,
texture: &Texture,
width: u32,
height: u32,
) -> Vec<u8> ⓘ
pub fn read_texture_rgba( &self, gpu: &GpuContext, texture: &Texture, width: u32, height: u32, ) -> Vec<u8> ⓘ
Copies a texture’s contents back to the CPU as RGBA8.
Auto Trait Implementations§
impl !RefUnwindSafe for Renderer
impl !UnwindSafe for Renderer
impl Freeze for Renderer
impl Send for Renderer
impl Sync for Renderer
impl Unpin for Renderer
impl UnsafeUnpin 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