Struct tridify_rs::ShapeBatch
source · pub struct ShapeBatch {
pub vertices: Vec<Vertex>,
pub indices: Vec<u32>,
pub index_id_counter: u32,
}
Fields§
§vertices: Vec<Vertex>
§indices: Vec<u32>
§index_id_counter: u32
Implementations§
source§impl ShapeBatch
impl ShapeBatch
pub fn new() -> Self
sourcepub fn bake_buffers(
&self,
graphics: &impl Graphics
) -> Result<ShapeBuffer, Box<dyn Error>>
pub fn bake_buffers( &self, graphics: &impl Graphics ) -> Result<ShapeBuffer, Box<dyn Error>>
Create buffers based on current batch data.
pub fn add_mesh(&mut self, mesh: Mesh) -> &mut ShapeBatch
sourcepub fn add_triangle(&mut self, v: [Vertex; 3]) -> &mut ShapeBatch
pub fn add_triangle(&mut self, v: [Vertex; 3]) -> &mut ShapeBatch
Add a triangle to the batch specifying its 3 vertices
pub fn add_rect(&mut self, rect: &Rect, color: Color) -> &mut ShapeBatch
sourcepub fn add_2d_square(
&mut self,
center: Vec3,
w: f32,
h: f32,
color: Color
) -> &mut ShapeBatch
pub fn add_2d_square( &mut self, center: Vec3, w: f32, h: f32, color: Color ) -> &mut ShapeBatch
Add a square on axis XY to the batch specifying the center, width, height and color.
sourcepub fn add_square(
&mut self,
center: Vec3,
up: Vec3,
normal: Vec3,
w: f32,
h: f32,
color: Color
) -> &mut ShapeBatch
pub fn add_square( &mut self, center: Vec3, up: Vec3, normal: Vec3, w: f32, h: f32, color: Color ) -> &mut ShapeBatch
Add a square to the batch specifying the center, width, height and color.
Trait Implementations§
source§impl Debug for ShapeBatch
impl Debug for ShapeBatch
source§impl Default for ShapeBatch
impl Default for ShapeBatch
source§fn default() -> ShapeBatch
fn default() -> ShapeBatch
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for ShapeBatch
impl Send for ShapeBatch
impl Sync for ShapeBatch
impl Unpin for ShapeBatch
impl UnwindSafe for ShapeBatch
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for Pwhere R: Read + ReadEndian<P>, P: Default,
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()
.