pub struct UniformBuffer { /* private fields */ }Expand description
A buffer for transferring a set of uniform variables to the shader program (see also use_uniform_block).
Implementations
sourceimpl UniformBuffer
impl UniformBuffer
sourcepub fn new(context: &Context, sizes: &[u32]) -> ThreeDResult<UniformBuffer>
pub fn new(context: &Context, sizes: &[u32]) -> ThreeDResult<UniformBuffer>
Creates a new uniform buffer with room for a set of variables of varying length defined by the sizes argument.
So for example if you create a uniform buffer with &[3, 1, 4, 16] as the sizes argument, you will have a uniform buffer that has four variables:
The first with 3 elements (a Vec3), the second with 1 element (a f32), the third with four elements (a Vec4) and the last with 16 elements (a Mat4).
The variables are initialized to 0.
sourcepub fn update(&mut self, index: u32, data: &[f32]) -> ThreeDResult<()>
pub fn update(&mut self, index: u32, data: &[f32]) -> ThreeDResult<()>
Update the values of the variable at the given index with the given data.
Errors
Will return an error if the index is not in the range [0-max] where max is the length of the sizes argument given at construction.
Will return an error if the data length does not match the element count of the variable (defined at construction) at the given index.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for UniformBuffer
impl !Send for UniformBuffer
impl !Sync for UniformBuffer
impl Unpin for UniformBuffer
impl !UnwindSafe for UniformBuffer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more