pub struct Renderer<'o, 'p>where
'o: 'p,{ /* private fields */ }Expand description
Use the Renderer with Materials to draw things to the current render surface
Implementations§
Source§impl<'p, 'o> Renderer<'p, 'o>
impl<'p, 'o> Renderer<'p, 'o>
Sourcepub fn reset_camera(&mut self)
pub fn reset_camera(&mut self)
Resets the camera to the defualt camera.
Examples found in repository?
examples/camera.rs (line 60)
47 fn render<'o>(&'o mut self, mut render: RenderHandle<'o>) {
48 let mut render_handle = render.begin_pass(Colour::BLACK);
49
50 self.material.add_rectangle(
51 Vec2 { x: 0.0, y: 0.0 },
52 Vec2 { x: 300.0, y: 300.0 },
53 Colour::WHITE,
54 &render_handle,
55 );
56
57 self.camera.set_active(&mut render_handle);
58 self.material.draw(&mut render_handle);
59
60 render_handle.reset_camera();
61 self.text
62 .add_instance(vec2!(0.0), Colour::WHITE, &render_handle);
63 self.text.draw(&mut render_handle);
64 }Sourcepub fn get_size(&self) -> Vec2<u32>
pub fn get_size(&self) -> Vec2<u32>
Gives the size of the current render surface
Examples found in repository?
examples/lightmap.rs (line 84)
80 fn render<'o>(&'o mut self, mut render_handle: RenderHandle<'o>) {
81 self.create_shadow_map(&mut render_handle);
82
83 let mut p2 = render_handle.begin_pass(Colour::BLACK);
84 let size = p2.get_size();
85 let size = Vec2 {
86 x: size.x as f32,
87 y: size.y as f32,
88 };
89
90 self.material
91 .add_rectangle(Vec2 { x: 0.0, y: 0.0 }, size, Colour::WHITE, &p2);
92 self.material.draw(&mut p2);
93 }Auto Trait Implementations§
impl<'o, 'p> Freeze for Renderer<'o, 'p>
impl<'o, 'p> !RefUnwindSafe for Renderer<'o, 'p>
impl<'o, 'p> Send for Renderer<'o, 'p>
impl<'o, 'p> Sync for Renderer<'o, 'p>
impl<'o, 'p> Unpin for Renderer<'o, 'p>
impl<'o, 'p> !UnwindSafe for Renderer<'o, 'p>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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