Struct bottomless_pit::material::LineMaterial
source · pub struct LineMaterial { /* private fields */ }Expand description
A diffrent type of material used to draw WebGPU debug lines. These lines will allways be 1px wide and only one instance of this material should ever be made per programm.
Implementations§
source§impl LineMaterial
impl LineMaterial
sourcepub fn add_line(
&mut self,
start: Vec2<f32>,
end: Vec2<f32>,
colour: Colour,
renderer: &RenderInformation<'_, '_>
)
pub fn add_line( &mut self, start: Vec2<f32>, end: Vec2<f32>, colour: Colour, renderer: &RenderInformation<'_, '_> )
Queues a line from the two points.
Examples found in repository?
examples/line.rs (lines 31-36)
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
fn render<'pass, 'others>(
&'others mut self,
mut render_handle: RenderInformation<'pass, 'others>,
) where
'others: 'pass,
{
self.material.add_line(
Vec2 { x: 0.0, y: 0.0 },
Vec2 { x: 100.0, y: 100.0 },
Colour::WHITE,
&render_handle,
);
self.material.draw(&mut render_handle);
}sourcepub fn draw<'pass, 'others>(
&'others mut self,
information: &mut RenderInformation<'pass, 'others>
)where
'others: 'pass,
pub fn draw<'pass, 'others>(
&'others mut self,
information: &mut RenderInformation<'pass, 'others>
)where
'others: 'pass,
Draws all queued lines to the screen.
Examples found in repository?
examples/line.rs (line 38)
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
fn render<'pass, 'others>(
&'others mut self,
mut render_handle: RenderInformation<'pass, 'others>,
) where
'others: 'pass,
{
self.material.add_line(
Vec2 { x: 0.0, y: 0.0 },
Vec2 { x: 100.0, y: 100.0 },
Colour::WHITE,
&render_handle,
);
self.material.draw(&mut render_handle);
}pub fn get_vertex_count(&self) -> u64
Auto Trait Implementations§
impl !RefUnwindSafe for LineMaterial
impl Send for LineMaterial
impl Sync for LineMaterial
impl Unpin for LineMaterial
impl !UnwindSafe for LineMaterial
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