pub struct InstanceBuffer { /* private fields */ }Expand description
A buffer containing per instance data. To send this data to a shader, use the Program::use_instance_attribute method.
Implementations
sourceimpl InstanceBuffer
impl InstanceBuffer
sourcepub fn new(context: &Context) -> ThreeDResult<Self>
pub fn new(context: &Context) -> ThreeDResult<Self>
Creates a new empty instance buffer.
sourcepub fn new_with_data<T: BufferDataType>(
context: &Context,
data: &[T]
) -> ThreeDResult<Self>
pub fn new_with_data<T: BufferDataType>(
context: &Context,
data: &[T]
) -> ThreeDResult<Self>
Creates a new instance buffer and fills it with the given data. The data should be in the same format as specified in the shader.
As an example, if specified as vec3 in the shader it needs to be specified as an array of Vector3<T> where T is a primitive type that implements BufferDataType, for example can be f16 or f32.
sourcepub fn fill<T: BufferDataType>(&mut self, data: &[T]) -> ThreeDResult<()>
pub fn fill<T: BufferDataType>(&mut self, data: &[T]) -> ThreeDResult<()>
Fills the instance buffer with the given data. The data should be in the same format as specified in the shader.
As an example, if specified as vec3 in the shader it needs to be specified as an array of Vector3<T> where T is a primitive type that implements BufferDataType, for example can be f16 or f32.
sourcepub fn instance_count(&self) -> u32
pub fn instance_count(&self) -> u32
The number of instance attributes in the buffer.
sourcepub fn new_with_static<T: BufferDataType>(
context: &Context,
data: &[T]
) -> ThreeDResult<Self>
👎 Deprecated: use new_with_data() and specify the data in the same format as in the shader (for example an array of Vec3 instead of f32)
pub fn new_with_static<T: BufferDataType>(
context: &Context,
data: &[T]
) -> ThreeDResult<Self>
use new_with_data() and specify the data in the same format as in the shader (for example an array of Vec3 instead of f32)
Creates a new instance buffer and fills it with the given data which must contain between 1 and 4 contiguous values for each vertex. Use this method instead of new_with_dynamic when you do not expect the data to change often.
sourcepub fn new_with_dynamic<T: BufferDataType>(
context: &Context,
data: &[T]
) -> ThreeDResult<Self>
👎 Deprecated: use new_with_data() and specify the data in the same format as in the shader (for example an array of Vec3 instead of f32)
pub fn new_with_dynamic<T: BufferDataType>(
context: &Context,
data: &[T]
) -> ThreeDResult<Self>
use new_with_data() and specify the data in the same format as in the shader (for example an array of Vec3 instead of f32)
Creates a new instance buffer and fills it with the given data which must contain between 1 and 4 contiguous values for each vertex. Use this method instead of new_with_static when you expect the data to change often.
sourcepub fn fill_with_static<T: BufferDataType>(&mut self, data: &[T])
👎 Deprecated: use fill() and specify the data in the same format as in the shader (for example an array of Vec3 instead of f32)
pub fn fill_with_static<T: BufferDataType>(&mut self, data: &[T])
use fill() and specify the data in the same format as in the shader (for example an array of Vec3 instead of f32)
Fills the instance buffer with the given data which must contain between 1 and 4 contiguous values for each vertex. Use this method instead of fill_with_dynamic when you do not expect the data to change often.
sourcepub fn fill_with_dynamic<T: BufferDataType>(&mut self, data: &[T])
👎 Deprecated: use fill() and specify the data in the same format as in the shader (for example an array of Vec3 instead of f32)
pub fn fill_with_dynamic<T: BufferDataType>(&mut self, data: &[T])
use fill() and specify the data in the same format as in the shader (for example an array of Vec3 instead of f32)
Fills the instance buffer with the given data which must contain between 1 and 4 contiguous values for each vertex. Use this method instead of fill_with_static when you expect the data to change often.
Auto Trait Implementations
impl !RefUnwindSafe for InstanceBuffer
impl !Send for InstanceBuffer
impl !Sync for InstanceBuffer
impl Unpin for InstanceBuffer
impl !UnwindSafe for InstanceBuffer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more