pub struct BufferDescriptor<'a, R: Renderable> { /* private fields */ }
Expand description
A descriptor of a subset of a BufferData
, used for vertex attributes;
hence for use in a vertex attribute pointer.
A BufferDescriptor allows portion of a BufferData to contain an array of structs with multiple fields for, e.g., Vertex, Normal and Color.
A BufferDescriptor is used within a crate::BufferDataAccessor to describe just an individual field element.
Implementations§
Source§impl<'a, R: Renderable> BufferDescriptor<'a, R>
impl<'a, R: Renderable> BufferDescriptor<'a, R>
Sourcepub fn data(&self) -> &BufferData<'a, R>
pub fn data(&self) -> &BufferData<'a, R>
Get a reference to the underlying BufferData
Sourcepub fn byte_offset(&self) -> u32
pub fn byte_offset(&self) -> u32
Get the byte offset within the underlying BufferData for this descriptor
Sourcepub fn byte_length(&self) -> u32
pub fn byte_length(&self) -> u32
Get the byte length within the underlying BufferData for this descriptor
Sourcepub fn stride(&self) -> u32
pub fn stride(&self) -> u32
Get the byte stride between different indices for the instances for this descriptor
Sourcepub fn element(&self, n: usize) -> &VertexDesc
pub fn element(&self, n: usize) -> &VertexDesc
Get a reference to the n’th element
Sourcepub fn elements(&self) -> &[VertexDesc]
pub fn elements(&self) -> &[VertexDesc]
Get a reference to the elements
Sourcepub fn new(
data: &'a BufferData<'a, R>,
byte_offset: u32,
byte_length: u32,
stride: u32,
elements: Vec<VertexDesc>,
) -> Self
pub fn new( data: &'a BufferData<'a, R>, byte_offset: u32, byte_length: u32, stride: u32, elements: Vec<VertexDesc>, ) -> Self
Create a new view of a BufferData
Sourcepub fn add_vertex_desc(&mut self, vertex_desc: VertexDesc) -> u8
pub fn add_vertex_desc(&mut self, vertex_desc: VertexDesc) -> u8
Add a VertexDesc to the fields that this BufferDescriptor describes.
Sourcepub fn create_client(&self, renderable: &mut R)
pub fn create_client(&self, renderable: &mut R)
Create the render buffer required by the BufferDescriptor
Sourcepub fn borrow_client(&self) -> Ref<'_, R::Descriptor>
pub fn borrow_client(&self) -> Ref<'_, R::Descriptor>
Borrow the client