Struct BufferDescriptor

Source
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>

Source

pub fn data(&self) -> &BufferData<'a, R>

Get a reference to the underlying BufferData

Source

pub fn byte_offset(&self) -> u32

Get the byte offset within the underlying BufferData for this descriptor

Source

pub fn byte_length(&self) -> u32

Get the byte length within the underlying BufferData for this descriptor

Source

pub fn stride(&self) -> u32

Get the byte stride between different indices for the instances for this descriptor

Source

pub fn element(&self, n: usize) -> &VertexDesc

Get a reference to the n’th element

Source

pub fn elements(&self) -> &[VertexDesc]

Get a reference to the elements

Source

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

Source

pub fn add_vertex_desc(&mut self, vertex_desc: VertexDesc) -> u8

Add a VertexDesc to the fields that this BufferDescriptor describes.

Source

pub fn create_client(&self, renderable: &mut R)

Create the render buffer required by the BufferDescriptor

Source

pub fn borrow_client(&self) -> Ref<'_, R::Descriptor>

Borrow the client

Trait Implementations§

Source§

impl<'a, R> AsRef<[u8]> for BufferDescriptor<'a, R>
where R: Renderable,

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a, R> Debug for BufferDescriptor<'a, R>
where R: Renderable,

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a, R: Renderable> Display for BufferDescriptor<'a, R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a, R: Renderable> DefaultIndentedDisplay for BufferDescriptor<'a, R>

Auto Trait Implementations§

§

impl<'a, R> !Freeze for BufferDescriptor<'a, R>

§

impl<'a, R> !RefUnwindSafe for BufferDescriptor<'a, R>

§

impl<'a, R> !Send for BufferDescriptor<'a, R>

§

impl<'a, R> !Sync for BufferDescriptor<'a, R>

§

impl<'a, R> Unpin for BufferDescriptor<'a, R>
where <R as Renderable>::Descriptor: Unpin,

§

impl<'a, R> !UnwindSafe for BufferDescriptor<'a, R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, O, T> IndentedDisplay<'a, O> for T

Source§

fn indent(&self, ind: &mut Indenter<'a, O>) -> Result<(), Error>

Display for humans with indent
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.