ShaderAttribute Class
A helper to handle creating and updating a BufferAttribute instance.
Constructor
ShaderAttribute
-
type
-
dynamicBuffer
-
arrayType
Parameters:
-
type
StringThe buffer attribute type. See ShaderAttribute.typeSizeMap for valid values.
-
dynamicBuffer
BooleanWhether this buffer attribute should be marked as dynamic or not.
-
arrayType
FunctionA reference to a TypedArray constructor. Defaults to Float32Array if none provided.
Item Index
Methods
Attributes
Methods
_createBufferAttribute
-
size
Creates a BufferAttribute instance if one doesn't exist already.
Ensures a typed array is present by calling _ensureTypedArray() first.
If a buffer attribute exists already, then it will be marked as needing an update.
Parameters:
-
size
NumberThe size of the typed array to create if one doesn't exist, or resize existing array to.
_ensureTypedArray
-
size
Make sure this attribute has a typed array associated with it.
If it does, then it will ensure the typed array is of the correct size.
If not, a new TypedArrayHelper instance will be created.
Parameters:
-
size
NumberThe size of the typed array to create or update to.
flagUpdate
()
Calculate the number of indices that this attribute should mark as needing updating. Also marks the attribute as needing an update.
getLength
()
Number
Returns the length of the typed array associated with this attribute.
Returns:
The length of the typed array. Will be 0 if no typed array has been created yet.
resetUpdateRange
()
Reset the index update counts for this attribute
setUpdateRange
-
min
-
max
Calculate the minimum and maximum update range for this buffer attribute using component size independant min and max values.
Parameters:
-
min
NumberThe start of the range to mark as needing an update.
-
max
NumberThe end of the range to mark as needing an update.
splice
-
start
-
end
Perform a splice operation on this attribute"s buffer.
Parameters:
-
start
NumberThe start index of the splice. Will be multiplied by the number of components for this attribute.
-
end
NumberThe end index of the splice. Will be multiplied by the number of components for this attribute.