BufferAttribute
This class stores data for an attribute (such as vertex positions, face indices, normals, colors, UVs, and any custom attributes ) associated with a BufferGeometry, which allows for more efficient passing of data to the GPU. See that page for details and a usage example.<br /><br /> Data is stored as vectors of any length (defined by itemSize), and in general in the methods outlined below if passing in an index, this is automatically multiplied by the vector length.
Type Parameters
- T extends TypedArray = TypedArray
Hierarchy
- ElementEventDispatcher
- BufferAttribute
Constructors
constructor
- new BufferAttribute<T extends TypedArray = TypedArray>(
array: T,
itemSize: number,
): BufferAttribute<T>Type Parameters
- T extends TypedArray = TypedArray
Parameters
- array: T
- itemSize: number
Returns BufferAttribute<T>
Overrides ElementEventDispatcher.constructor
Properties
_ array
The geometry attribute data store as TypedArray.
item Size
If the buffer is storing a 3-component vector (such as a position, normal, or color), then this will count the number of such vectors stored.
normalized
If attribute data is normalized.
count
dynamic
The data of this buffer always need update.
update Range
Object containing:
offset:Integer - Default is 0. Position at which to start update.
count:Integer - Default is -1, which means don't use update ranges.
This can be used to only update some components of stored vectors (for example, just the component related to color).
is Buffer Attribute
Used to check type of this or extended instance. This value should not be changed by user.
is Data Dropped
When the data is cleared from memory, this mark will be set true.
remove Data After Upload
Remove the data after it is uploaded to GPU memory.
version
A version number, incremented every time the needsUpdate property is set to true.
on Update Callback
A callback function for updating. It will be called after needsUpdate.
on Upload Callback
A callback function for uploading. It will be called after the data uploaded to WebGL.
Readonlyuser Data
Inherited from ElementEventDispatcher.userData
_ uuid
Inherited from ElementEventDispatcher._uuid
uuid
Inherited from ElementEventDispatcher.uuid
_ listeners
Inherited from ElementEventDispatcher._listeners
Accessors
array
needs Update
- set needsUpdate(value: boolean): void
When this attribute is set to true, the version will be change.
Parameters
- value: boolean
Returns void
business Tag
- get businessTag(): string
Returns string
Inherited from ElementEventDispatcher.businessTag
- set businessTag(v: string): void
Parameters
- v: string
Returns void
Inherited from ElementEventDispatcher.businessTag
Methods
notify Content Change
Returns void
set Array
set Dynamic
copy
Copy the data to this object from source.
Parameters
- source: BufferAttribute
the data source.
Returns this
- source: BufferAttribute
copy At
Copy the data at specified position. The given index is items' index, do not need to multiply with item' size.
Parameters
- index1: number
the start position of this array.
- attribute: BufferAttribute
the start position of this array.
- index2: number
the start position of source array.
Returns this
- index1: number
copy Array
Copy the data from given array to this array.
Parameters
- array: TypedArray | number[]
the start position of this array.
Returns this
- array: TypedArray | number[]
copy Color Array
copy Vector2 Array
copy Vector3 Array
copy Vector4 Array
set
Copy the data from given Array or typedArray.
Parameters
- value: ArrayLike<number>
an Array or TypedArray from which to copy values.
- offset: number
(optional) index of the array at which to start copying.
Returns this
- value: ArrayLike<number>
get X
Return the x component of all items.
Parameters
- index: number
Returns number
set X
Set the x component of the vector at the given index.
Parameters
- index: number
- x: number
Returns this
get Y
Return the y component of all vectors.
Parameters
- index: number
Returns number
set Y
Set the y component of the vector at the given index.
Parameters
- index: number
- y: number
Returns this
get Z
Return the z component of all vectors.
Parameters
- index: number
Returns number
set Z
Set the z component of the vector at the given index.
Parameters
- index: number
- z: number
Returns this
get W
Return the w component of all vectors.
Parameters
- index: number
Returns number
set W
Set the w component of the vector at the given index.
Parameters
- index: number
- w: number
Returns this
set XY
Set the x and y component of the vector at the given index.
Parameters
- index: number
- x: number
- y: number
Returns this
set XYZ
Set the x , y and z component of the vector at the given index.
Parameters
- index: number
- x: number
- y: number
- z: number
Returns this
set XYZW
Set all component of the vector at the given index.
Parameters
- index: number
- x: number
- y: number
- z: number
- w: number
Returns this
get Vector2
clone
Return a clone of this object.
Returns BufferAttribute<T>
destroy
Release the memory which is occupied by this instance from CPU and GPU.
Returns void
Overrides ElementEventDispatcher.destroy
free GPU
Returns void
mark Business Tag
Parameters
- v: string
Returns this
Inherited from ElementEventDispatcher.markBusinessTag
is Destroyed
Returns boolean
Inherited from ElementEventDispatcher.isDestroyed
validate
Returns void
Inherited from ElementEventDispatcher.validate
destroy All Resources Owned
Returns void
Inherited from ElementEventDispatcher.destroyAllResourcesOwned
free All Gpu Resource Owned
Returns void
Inherited from ElementEventDispatcher.freeAllGpuResourceOwned
on
once
has
off
emit
Active the event and call the registered listener.
Parameters
- type: EventType<never>
Returns void
Inherited from ElementEventDispatcher.emit
clear All Listeners
Removes all listeners from listening list.
Returns void
Inherited from ElementEventDispatcher.clearAllListeners
This class stores data for an attribute (such as vertex positions, face indices, normals, colors, UVs, and any custom attributes ) associated with a BufferGeometry, which allows for more efficient passing of data to the GPU. See that page for details and a usage example.
Data is stored as vectors of any length (defined by itemSize), and in general in the methods outlined below if passing in an index, this is automatically multiplied by the vector length.