pub struct DrawBatch {
pub circles: Vec<[f32; 7]>,
pub rects: Vec<[f32; 8]>,
pub lines: Vec<[f32; 9]>,
}Expand description
Draw call batching for GPU efficiency.
Fields§
§circles: Vec<[f32; 7]>Batched circles (center_x, center_y, radius, color_rgba)
rects: Vec<[f32; 8]>Batched rectangles (x, y, w, h, color_rgba)
lines: Vec<[f32; 9]>Batched lines (x1, y1, x2, y2, width, color_rgba)
Implementations§
Source§impl DrawBatch
impl DrawBatch
Sourcepub fn add_circle(
&mut self,
x: f32,
y: f32,
radius: f32,
r: f32,
g: f32,
b: f32,
a: f32,
)
pub fn add_circle( &mut self, x: f32, y: f32, radius: f32, r: f32, g: f32, b: f32, a: f32, )
Add a circle to the batch.
Sourcepub fn add_rect(
&mut self,
x: f32,
y: f32,
w: f32,
h: f32,
r: f32,
g: f32,
b: f32,
a: f32,
)
pub fn add_rect( &mut self, x: f32, y: f32, w: f32, h: f32, r: f32, g: f32, b: f32, a: f32, )
Add a rectangle to the batch.
Sourcepub fn add_line(
&mut self,
x1: f32,
y1: f32,
x2: f32,
y2: f32,
width: f32,
r: f32,
g: f32,
b: f32,
a: f32,
)
pub fn add_line( &mut self, x1: f32, y1: f32, x2: f32, y2: f32, width: f32, r: f32, g: f32, b: f32, a: f32, )
Add a line to the batch.
Sourcepub fn unbatched_draw_calls(&self) -> usize
pub fn unbatched_draw_calls(&self) -> usize
Total draw calls if not batched.
Sourcepub fn batched_draw_calls(&self) -> usize
pub fn batched_draw_calls(&self) -> usize
Actual draw calls with batching (3 max: circles, rects, lines).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DrawBatch
impl RefUnwindSafe for DrawBatch
impl Send for DrawBatch
impl Sync for DrawBatch
impl Unpin for DrawBatch
impl UnwindSafe for DrawBatch
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().