Struct ggez::graphics::MeshBatch [−][src]
pub struct MeshBatch { /* fields omitted */ }
Expand description
Mesh that will be rendered with hardware instancing. Use this when you have a lot of similar geometry which does not move around often.
Implementations
Creates a new mesh batch.
Takes ownership of the Mesh
.
Removes all instances from the batch.
Calling this invalidates the entire buffer, however this will not automatically deallocate graphics card memory or flush the buffer.
Returns a reference to mesh instances
Returns a mutable reference to mesh instances.
Please note that manually altering items in this slice
will not automatically invalidate the buffer, you will
have to manually call flush()
or flush_range()
later.
Adds a new instance to the mesh batch
Returns a handle with which to modify the instance using
set()
Calling this invalidates the entire buffer and will result in
flusing it on the next graphics::draw()
call.
Alters an instance in the batch to use the given draw params.
Calling this invalidates the entire buffer and will result in
flusing it on the next graphics::draw()
call.
This might cause performance issues with large batches, to avoid this
consider using flush_range
to explicitly invalidate required data slice.
Alters a range of instances in the batch to use the given draw params
Calling this invalidates the entire buffer and will result in
flusing it on the next graphics::draw()
call.
This might cause performance issues with large batches, to avoid this
consider using flush_range
to explicitly invalidate required data slice.
pub fn flush_range(
&mut self,
ctx: &mut Context,
first_handle: MeshIdx,
count: usize
) -> GameResult
pub fn flush_range(
&mut self,
ctx: &mut Context,
first_handle: MeshIdx,
count: usize
) -> GameResult
Immediately sends specified slice of data in the batch to the graphics card.
Calling this counts as a full buffer flush, but only flushes the data within the provided range, anything outside of this range will not be touched.
Use it for updating small portions of large batches.
Immediately sends all data in the batch to the graphics card.
In general, graphics::draw()
on the MeshBatch
will do this automatically when buffer contents are updated.
Draws the drawable onto the rendering target.
Returns a bounding box in the form of a Rect
.
Sets the blend mode to be used when drawing this drawable.
Gets the blend mode to be used when drawing this drawable.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for MeshBatch
impl !UnwindSafe for MeshBatch