Skip to main content

InstanceBuffer

Struct InstanceBuffer 

Source
pub struct InstanceBuffer {
    pub id: BufferId,
    pub source: BufferSource,
    pub count: usize,
    pub item_size: usize,
    pub per_vertex: bool,
}
Expand description

The CPU-side buffer behind one or more instanced vertex attributes — three.js’ InstancedBufferAttribute / InstancedInterleavedBuffer.

RangeNode.setup() and createInstanceMatrixNode() both branch on uniformBufferSize <= builder.getUniformBufferLimit(): under the limit the data is a uniform buffer indexed by instanceIndex (BufferNode), over it an instanced attribute, which is what lifts the ~1024-instance cap the 64 KiB uniform binding imposes. Rc identity is the buffer’s identity, so two range( 0, 1 ) calls are two buffers with two different random fills, exactly as two RangeNodes are in three.js.

Fields§

§id: BufferId

This buffer’s identity — see BufferId.

§source: BufferSource

Where the buffer’s contents come from.

§count: usize

The instance count — InstancedBufferAttribute.count.

§item_size: usize

Floats per instance, i.e. the attribute stride in components: 16 for the interleaved instance matrix (new InstancedInterleavedBuffer( array, 16, 1 )), 4 for a range().

§per_vertex: bool

The buffer steps once per vertex: attributeArray()’s StorageBufferAttribute read through .toAttribute(), which is not an InstancedBufferAttribute. false for everything else here.

Trait Implementations§

Source§

impl Debug for InstanceBuffer

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.