InstancedBufferAttribute

An instanced version of BufferAttribute.

Core Class

An instanced version of BufferAttribute.

Extends

Type Parameters

T

T extends TypedArray = TypedArray

Constructors

Constructor

new InstancedBufferAttribute<T>(data, itemSize, meshPerAttribute?): InstancedBufferAttribute<T>

Parameters

data

T

itemSize

number

meshPerAttribute?

number

Returns

InstancedBufferAttribute<T>

Overrides

BufferAttribute.constructor

Properties

_array

_array: T

The geometry attribute data store as TypedArray.

Inherited from

BufferAttribute._array


itemSize

itemSize: number

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.

Inherited from

BufferAttribute.itemSize


normalized

normalized: boolean

If attribute data is normalized.

Inherited from

BufferAttribute.normalized


count

count: number

Stores the array’s length divided by the itemSize.

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.

Inherited from

BufferAttribute.count


dynamic

dynamic: boolean

The data of this buffer always need update.

Deprecated

will not take effect, update attribute.array if need to reupload

Inherited from

BufferAttribute.dynamic


updateRange

updateRange: object

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).

offset

offset: number

count

count: number

Deprecated

will not take effect, update attribute.array instead

Inherited from

BufferAttribute.updateRange


isBufferAttribute

isBufferAttribute: boolean

Used to check type of this or extended instance. This value should not be changed by user.

Inherited from

BufferAttribute.isBufferAttribute


isDataDropped

isDataDropped: boolean

When the data is cleared from memory, this mark will be set true.

Deprecated

never updated, always false.

Inherited from

BufferAttribute.isDataDropped


removeDataAfterUpload

removeDataAfterUpload: boolean

Remove the data after it is uploaded to GPU memory.

Deprecated

will not take effect

Inherited from

BufferAttribute.removeDataAfterUpload


version

version: number

A version number, incremented every time the needsUpdate property is set to true.

Inherited from

BufferAttribute.version


onUpdateCallback

onUpdateCallback: () => void

A callback function for updating. It will be called after needsUpdate.

Returns

void

Inherited from

BufferAttribute.onUpdateCallback


onUploadCallback

onUploadCallback: () => void

A callback function for uploading. It will be called after the data uploaded to WebGL.

Returns

void

Inherited from

BufferAttribute.onUploadCallback


meshPerAttribute

meshPerAttribute: number

Defines how often a value of this buffer attribute should be repeated. A value of one means that each value of the instanced attribute is used for a single instance. A value of two means that each value is used for two consecutive instances (and so on). Default is 1.


isInstancedBufferAttribute

isInstancedBufferAttribute: boolean

Used to check type of this or extended instance. This value should not be changed by user.


userData

readonly userData: Record<keyof any, any>

Inherited from

BufferAttribute.userData


_uuid

_uuid: any

Inherited from

BufferAttribute._uuid


uuid

uuid: string

Inherited from

BufferAttribute.uuid


_listeners

_listeners: Map<Symbol, Listener<never>[]>

Inherited from

BufferAttribute._listeners

Accessors

array

Get Signature

get array(): T

The geometry attribute data store as TypedArray.

Returns

T

Set Signature

set array(v): void

Parameters
v

T

Returns

void

Inherited from

BufferAttribute.array


needsUpdate

Set Signature

set needsUpdate(value): void

When this attribute is set to true, the version will be change.

Parameters
value

boolean

Returns

void

Inherited from

BufferAttribute.needsUpdate


businessTag

Get Signature

get businessTag(): string

Returns

string

Set Signature

set businessTag(v): void

Parameters
v

string

Returns

void

Inherited from

BufferAttribute.businessTag

Methods

notifyContentChange()

notifyContentChange(): void

Returns

void

Inherited from

BufferAttribute.notifyContentChange


setArray()

setArray(array): this

Change the data of array.

Parameters

array

T

Returns

this

Inherited from

BufferAttribute.setArray


setDynamic()

setDynamic(value): this

Change the state of dynamic.

Parameters

value

boolean

Returns

this

Inherited from

BufferAttribute.setDynamic


copyAt()

copyAt(index1, attribute, index2): this

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

Inherited from

BufferAttribute.copyAt


copyArray()

copyArray(array): this

Copy the data from given array to this array.

Parameters

array

TypedArray | number[]

the start position of this array.

Returns

this

Inherited from

BufferAttribute.copyArray


copyColorArray()

copyColorArray(colors): this

Copy the data from given array to this array.

Parameters

colors

Color[]

the start position of this array.

Returns

this

Inherited from

BufferAttribute.copyColorArray


copyVector2Array()

copyVector2Array(vectors): this

Copy the data which is type of Vector2 from given array to this array.

Parameters

vectors

Vector2[]

the start position of this array.

Returns

this

Inherited from

BufferAttribute.copyVector2Array


copyVector3Array()

copyVector3Array(vectors): this

Copy the data which is type of Vector3 from given array to this array.

Parameters

vectors

Vector3[]

the start position of this array.

Returns

this

Inherited from

BufferAttribute.copyVector3Array


copyVector4Array()

copyVector4Array(vectors): this

Copy the data which is type of Vector4 from given array to this array.

Parameters

vectors

Vector4[]

the start position of this array.

Returns

this

Inherited from

BufferAttribute.copyVector4Array


set()

set(value, offset?): this

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

Inherited from

BufferAttribute.set


getX()

getX(index): number

Return the x component of all items.

Parameters

index

number

Returns

number

Inherited from

BufferAttribute.getX


setX()

setX(index, x): this

Set the x component of the vector at the given index.

Parameters

index

number

x

number

Returns

this

Inherited from

BufferAttribute.setX


getY()

getY(index): number

Return the y component of all vectors.

Parameters

index

number

Returns

number

Inherited from

BufferAttribute.getY


setY()

setY(index, y): this

Set the y component of the vector at the given index.

Parameters

index

number

y

number

Returns

this

Inherited from

BufferAttribute.setY


getZ()

getZ(index): number

Return the z component of all vectors.

Parameters

index

number

Returns

number

Inherited from

BufferAttribute.getZ


setZ()

setZ(index, z): this

Set the z component of the vector at the given index.

Parameters

index

number

z

number

Returns

this

Inherited from

BufferAttribute.setZ


getW()

getW(index): number

Return the w component of all vectors.

Parameters

index

number

Returns

number

Inherited from

BufferAttribute.getW


setW()

setW(index, w): this

Set the w component of the vector at the given index.

Parameters

index

number

w

number

Returns

this

Inherited from

BufferAttribute.setW


setXY()

setXY(index, x, y): this

Set the x and y component of the vector at the given index.

Parameters

index

number

x

number

y

number

Returns

this

Inherited from

BufferAttribute.setXY


setXYZ()

setXYZ(index, x, y, z): this

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

Inherited from

BufferAttribute.setXYZ


setXYZW()

setXYZW(index, x, y, z, w): this

Set all component of the vector at the given index.

Parameters

index

number

x

number

y

number

z

number

w

number

Returns

this

Inherited from

BufferAttribute.setXYZW


getVector2()

getVector2(index, out?): Vector2

Return the vector2 at specific position.

Parameters

index

number

out?

Vector2

Returns

Vector2

Inherited from

BufferAttribute.getVector2


clone()

clone(): BufferAttribute<T>

Return a clone of this object.

Returns

BufferAttribute<T>

Inherited from

BufferAttribute.clone


destroy()

destroy(): void

Release the memory which is occupied by this instance from CPU and GPU.

Returns

void

Inherited from

BufferAttribute.destroy


freeGPU()

freeGPU(): void

Returns

void

Inherited from

BufferAttribute.freeGPU


copy()

copy(source): this

Copy the data to this object from source.

Parameters

source

InstancedBufferAttribute

the data source.

Returns

this

Overrides

BufferAttribute.copy


markBusinessTag()

markBusinessTag(v): this

Parameters

v

string

Returns

this

Inherited from

BufferAttribute.markBusinessTag


isDestroyed()

isDestroyed(): boolean

Returns

boolean

Inherited from

BufferAttribute.isDestroyed


validate()

validate(): void

Returns

void

Inherited from

BufferAttribute.validate


destroyAllResourcesOwned()

destroyAllResourcesOwned(): void

Returns

void

Inherited from

BufferAttribute.destroyAllResourcesOwned


freeAllGpuResourceOwned()

freeAllGpuResourceOwned(): void

Returns

void

Inherited from

BufferAttribute.freeAllGpuResourceOwned


on()

on<T>(_type, _listener): void

Adds a listener to an event type.

Type Parameters

T

T

Parameters

_type

EventType<T>

_listener

Listener<T>

Returns

void

Inherited from

BufferAttribute.on


once()

once<T>(_type, _listener): void

Only active the listener one times and then off it| it.

Type Parameters

T

T

Parameters

_type

EventType<T>

_listener

Listener<T>

Returns

void

Inherited from

BufferAttribute.once


has()

has<T>(_type, _listener): boolean

Checks if listener is added to an event type.

Type Parameters

T

T

Parameters

_type

EventType<T>

_listener

Listener<T>

Returns

boolean

Inherited from

BufferAttribute.has


off()

off<T>(_type, _listener): void

Removes a listener from listening list.

Type Parameters

T

T

Parameters

_type

EventType<T>

_listener

Listener<T>

Returns

void

Inherited from

BufferAttribute.off


emit()

Call Signature

emit(type): void

Active the event and call the registered listener.

Parameters
type

EventType<never>

Returns

void

Inherited from

BufferAttribute.emit

Call Signature

emit<T>(type, payload): void

Type Parameters
T

T

Parameters
type

EventType<T>

payload

T

Returns

void

Inherited from

BufferAttribute.emit


clearAllListeners()

clearAllListeners(): void

Removes all listeners from listening list.

Returns

void

Inherited from

BufferAttribute.clearAllListeners