pub struct InstanceInputUniformBuffer<BDI>{ /* private fields */ }
Expand description
Holds the GPU buffer of instance input data, which is the data about each mesh instance that the CPU provides.
BDI
is the buffer data input type, which the GPU mesh preprocessing
shader is expected to expand to the full buffer data type.
Implementations§
Source§impl<BDI> InstanceInputUniformBuffer<BDI>
impl<BDI> InstanceInputUniformBuffer<BDI>
Sourcepub fn new() -> InstanceInputUniformBuffer<BDI>
pub fn new() -> InstanceInputUniformBuffer<BDI>
Creates a new, empty buffer.
Sourcepub fn buffer(&self) -> &RawBufferVec<BDI>
pub fn buffer(&self) -> &RawBufferVec<BDI>
Returns the RawBufferVec
corresponding to this input uniform buffer.
Sourcepub fn add(&mut self, element: BDI) -> u32
pub fn add(&mut self, element: BDI) -> u32
Adds a new piece of buffered data to the uniform buffer and returns its index.
Sourcepub fn remove(&mut self, uniform_index: u32)
pub fn remove(&mut self, uniform_index: u32)
Removes a piece of buffered data from the uniform buffer.
This simply marks the data as free.
Sourcepub fn get(&self, uniform_index: u32) -> Option<BDI>
pub fn get(&self, uniform_index: u32) -> Option<BDI>
Returns the piece of buffered data at the given index.
Returns None
if the index is out of bounds or the data is removed.
Sourcepub fn get_unchecked(&self, uniform_index: u32) -> BDI
pub fn get_unchecked(&self, uniform_index: u32) -> BDI
Returns the piece of buffered data at the given index. Can return data that has previously been removed.
§Panics
if uniform_index
is not in bounds of Self::buffer
.
Sourcepub fn set(&mut self, uniform_index: u32, element: BDI)
pub fn set(&mut self, uniform_index: u32, element: BDI)
Stores a piece of buffered data at the given index.
§Panics
if uniform_index
is not in bounds of Self::buffer
.
pub fn ensure_nonempty(&mut self)
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if this buffer has no instances or false if it contains any instances.
Sourcepub fn into_buffer(self) -> RawBufferVec<BDI>
pub fn into_buffer(self) -> RawBufferVec<BDI>
Consumes this InstanceInputUniformBuffer
and returns the raw buffer
ready to be uploaded to the GPU.
Trait Implementations§
Auto Trait Implementations§
impl<BDI> Freeze for InstanceInputUniformBuffer<BDI>
impl<BDI> !RefUnwindSafe for InstanceInputUniformBuffer<BDI>
impl<BDI> Send for InstanceInputUniformBuffer<BDI>where
BDI: Send,
impl<BDI> Sync for InstanceInputUniformBuffer<BDI>where
BDI: Sync,
impl<BDI> Unpin for InstanceInputUniformBuffer<BDI>where
BDI: Unpin,
impl<BDI> !UnwindSafe for InstanceInputUniformBuffer<BDI>
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.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>
, which can then be
downcast
into Box<dyn 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>
, which 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> 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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self
using default()
.
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