Struct mod3d_base::BufferAccessor

source ·
pub struct BufferAccessor<'a, R: Renderable + ?Sized> {
    pub data: &'a BufferData<'a, R>,
    pub elements_per_data: u32,
    pub ele_type: BufferElementType,
    pub byte_offset: u32,
    pub stride: u32,
    /* private fields */
}
Expand description

A subset of a BufferData, used for vertex attributes; hence for use in a vertex attribute pointer.

A BufferAccessor is used for a single attribute of a set of data, such as Position or Normal.

Fields§

§data: &'a BufferData<'a, R>

The BufferData that contains the actual vertex attribute data

§elements_per_data: u32

For attributes: number of elements per vertex (1 to 4, or 4, 9 or 16) For indices: number of indices in the buffer

§ele_type: BufferElementType

The type of each element

For indices this must be Int8, Int16 or Int32

§byte_offset: u32

Offset from start of buffer to first byte of data

§stride: u32

Stride of data in the buffer - 0 for count*sizeof(ele_type) Unused for indices

Implementations§

source§

impl<'a, R: Renderable> BufferAccessor<'a, R>

source

pub fn new( data: &'a BufferData<'a, R>, count: u32, ele_type: BufferElementType, byte_offset: u32, stride: u32, ) -> Self

Create a new view of a BufferData

source

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

Create the render buffer required by the BufferAccessor

source

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

Borrow the client

Trait Implementations§

source§

impl<'a, R> Debug for BufferAccessor<'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 BufferAccessor<'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 BufferAccessor<'a, R>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<'a, R> Unpin for BufferAccessor<'a, R>
where <R as Renderable>::Accessor: Unpin,

§

impl<'a, R> !UnwindSafe for BufferAccessor<'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§

default 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>,

§

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

§

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.