pub struct BufferData<'a, R: Renderable> {
pub byte_offset: u32,
pub byte_length: u32,
/* private fields */
}
Expand description
A data buffer for use with vertex data. It may be indices or vertex coordinates etc.
A data buffer may contain a lot of data per vertex, such as
position, normal, tangent, color etc. a BufferView
on the data is
then a subset of this data - perhaps picking out just the
position, for example, for a set of vertices
The data buffer may, indeed, contain data for more than one object
- and the objects may have different data per vertex. The data
buffer is pretty free-form, it is a
BufferView
on the BufferData which identifies the object it applies to, and the vertex attributes required.
A data buffer may then be used by many BufferView
s. Each BufferView
may be
used by many primitives for a single model; alternatively,
primitives may have their own individual BufferViews
.
A client may have one copy of the data for all the primitives and models.
Fields§
§byte_offset: u32
Offset in to the data buffer for the first byte
byte_length: u32
Length of data used in the buffer
Implementations§
Source§impl<'a, R: Renderable> BufferData<'a, R>
impl<'a, R: Renderable> BufferData<'a, R>
Sourcepub fn new<B: ByteBuffer + ?Sized>(
data: &'a B,
byte_offset: u32,
byte_length: u32,
) -> Self
pub fn new<B: ByteBuffer + ?Sized>( data: &'a B, byte_offset: u32, byte_length: u32, ) -> Self
Create a new BufferData given a buffer, offset and length; if the length is zero then the whole of the data buffer post offset is used
If offset and length are both zero, then all the data is used
Sourcepub fn create_client(&self, renderable: &mut R)
pub fn create_client(&self, renderable: &mut R)
Replace the client data with one of this data
Sourcepub fn borrow_client(&self) -> Ref<'_, R::Buffer>
pub fn borrow_client(&self) -> Ref<'_, R::Buffer>
Borrow the client