Struct ascending_graphics::InstanceBuffer
source · pub struct InstanceBuffer<K: BufferLayout> {
pub unprocessed: Vec<Vec<OrderedIndex>>,
pub buffers: Vec<Option<InstanceDetails>>,
pub clipped_buffers: Vec<Vec<ClippedInstanceDetails>>,
pub buffer: Buffer<K>,
pub layer_size: usize,
/* private fields */
}Fields§
§unprocessed: Vec<Vec<OrderedIndex>>§buffers: Vec<Option<InstanceDetails>>§clipped_buffers: Vec<Vec<ClippedInstanceDetails>>§buffer: Buffer<K>§layer_size: usizeImplementations§
source§impl<K: BufferLayout> InstanceBuffer<K>
impl<K: BufferLayout> InstanceBuffer<K>
sourcepub fn create_buffer(
gpu_device: &GpuDevice,
data: &[u8],
layer_size: usize
) -> Self
pub fn create_buffer( gpu_device: &GpuDevice, data: &[u8], layer_size: usize ) -> Self
Used to create GpuBuffer from a BufferPass. Only use this for creating a reusable buffer.
pub fn add_buffer_store( &mut self, renderer: &GpuRenderer, index: OrderedIndex, layer: usize )
pub fn finalize(&mut self, renderer: &mut GpuRenderer)
sourcepub fn new(gpu_device: &GpuDevice, layer_size: usize) -> Self
pub fn new(gpu_device: &GpuDevice, layer_size: usize) -> Self
creates a new pre initlized InstanceBuffer with a default size. default size is based on the initial InstanceLayout::default_buffer length.
pub fn is_empty(&self) -> bool
sourcepub fn is_clipped(&self) -> bool
pub fn is_clipped(&self) -> bool
Returns if the buffer is clipped or not to deturmine if you should use buffers or clipped_buffers.
sourcepub fn set_as_clipped(&mut self)
pub fn set_as_clipped(&mut self)
Sets the Buffer into Clipping mode. This will Produce a clipped_buffers instead of the buffers which will still be layered but a Vector of individual objects will Exist rather than a grouped object per layer. Will make it less Efficient but allows Bounds Clipping.
sourcepub fn instances(&self, bounds: Option<Range<u64>>) -> BufferSlice<'_>
pub fn instances(&self, bounds: Option<Range<u64>>) -> BufferSlice<'_>
Returns wgpu::BufferSlice of vertices. bounds is used to set a specific Range if needed. If bounds is None then range is 0..vertex_count.
sourcepub fn with_capacity(
gpu_device: &GpuDevice,
capacity: usize,
layer_size: usize
) -> Self
pub fn with_capacity( gpu_device: &GpuDevice, capacity: usize, layer_size: usize ) -> Self
Creates a Buffer based on capacity. Capacity is the amount of objects to initialize for.
Auto Trait Implementations§
impl<K> !Freeze for InstanceBuffer<K>
impl<K> !RefUnwindSafe for InstanceBuffer<K>
impl<K> Send for InstanceBuffer<K>where
K: Send,
impl<K> Sync for InstanceBuffer<K>where
K: Sync,
impl<K> Unpin for InstanceBuffer<K>where
K: Unpin,
impl<K> !UnwindSafe for InstanceBuffer<K>
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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 more