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§
§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
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)