Trait riddle_renderer_wgpu::RenderContext [−][src]
Types which accept render calls, tracks current world transform, and are consumed when the calls are presented.
Example
let mut render_ctx /*: impl RenderContext*/ = renderer.begin_render()?; render_ctx.clear(Color::RED)?; // Change the current transform matrix, and draw a rect render_ctx.set_transform(glam::Mat4::from_scale(glam::vec3(2.0, 2.0, 1.0)).into())?; render_ctx.fill_rect(&Rect::new(vec2(0.0, 0.0), vec2(10.0, 10.0)), Color::GREEN)?; render_ctx.present()?;
Required methods
fn set_transform(
&mut self,
transform: ColumnMatrix4<f32>
) -> Result<(), RendererError>
[src]
&mut self,
transform: ColumnMatrix4<f32>
) -> Result<(), RendererError>
Replace the current world transform.
fn clear(&mut self, color: Color<f32>) -> Result<(), RendererError>
[src]
Fill the target with a flat color.
fn render_internal<R: WGPURenderable>(
&mut self,
renderable: &R
) -> Result<(), RendererError>
[src]
&mut self,
renderable: &R
) -> Result<(), RendererError>
Render a Renderable
to the target with the current world transform.
This is only called by internal crate code.
fn fill_rect(
&mut self,
rect: &Rect<f32>,
color: Color<f32>
) -> Result<(), RendererError>
[src]
&mut self,
rect: &Rect<f32>,
color: Color<f32>
) -> Result<(), RendererError>
Draw a solid rect with the given color.
fn present(self) -> Result<(), RendererError>
[src]
Consume the context and present any outstanding draw calls.