pub struct StorageBufferAttribute {
pub item_size: usize,
/* private fields */
}Expand description
three.js’ StorageBufferAttribute / StorageInstancedBufferAttribute
(src/renderers/common/): an attribute whose GPU buffer is also a storage
buffer, so a compute kernel can write what a draw reads as vertices.
A handle, as IndirectStorageBufferAttribute
is: clones are the same attribute, and the renderer keys the one GPU buffer
on id, which storage( &attribute, ty, count ) (in
nodes::tsl) carries too. Turn it into a geometry attribute with
.into(). The array is the buffer’s initial contents only; it is uploaded
once, padded to vec4 stride when the item size is 3.
Fields§
§item_size: usizeBufferAttribute.itemSize, unpadded.
Implementations§
Source§impl StorageBufferAttribute
impl StorageBufferAttribute
Sourcepub fn new(
contents: impl Into<StorageContents>,
item_size: usize,
kind: ArrayKind,
) -> Self
pub fn new( contents: impl Into<StorageContents>, item_size: usize, kind: ArrayKind, ) -> Self
new StorageBufferAttribute( count | array, itemSize, typeClass ). With
a count, the array is count * item_size zeros of kind; with an
array, kind is ignored as three ignores typeClass.
Sourcepub fn new_instanced(
contents: impl Into<StorageContents>,
item_size: usize,
kind: ArrayKind,
) -> Self
pub fn new_instanced( contents: impl Into<StorageContents>, item_size: usize, kind: ArrayKind, ) -> Self
new StorageInstancedBufferAttribute( count | array, itemSize, typeClass )
— read as a vertex attribute, it steps once per instance.
Sourcepub fn data(&self) -> Ref<'_, TypedArray>
pub fn data(&self) -> Ref<'_, TypedArray>
attribute.array — the initial contents.
Sourcepub fn is_instanced(&self) -> bool
pub fn is_instanced(&self) -> bool
isStorageInstancedBufferAttribute.