Struct BufferData

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

Source

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

Source

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

Replace the client data with one of this data

Source

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

Borrow the client

Source

pub fn as_ptr(&self) -> *const u8

Get a const u8 ptr to the data itself

Source

pub fn as_slice(&self) -> &[u8]

Get the slice that is the data itself

Trait Implementations§

Source§

impl<'a, R: Renderable> Debug for BufferData<'a, R>

Source§

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

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

impl<'a, R: Renderable + ?Sized> Display for BufferData<'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 + ?Sized> DefaultIndentedDisplay for BufferData<'a, R>

Auto Trait Implementations§

§

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

§

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

§

impl<'a, R> Send for BufferData<'a, R>
where <R as Renderable>::Buffer: Send,

§

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

§

impl<'a, R> Unpin for BufferData<'a, R>
where <R as Renderable>::Buffer: Unpin,

§

impl<'a, R> UnwindSafe for BufferData<'a, R>
where <R as Renderable>::Buffer: UnwindSafe,

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.