Skip to content

GLInstancedBufferAttribute

A class that extends GLBufferAttribute to handle instanced buffer attributes. This class was specifically created to allow updating instanced buffer attributes during the onBeforeRender callback, providing an efficient way to modify the buffer data dynamically before rendering.

Extends

  • unknown

Constructors

new GLInstancedBufferAttribute()

new GLInstancedBufferAttribute(gl, type, itemSize, elementSize, array, meshPerAttribute): GLInstancedBufferAttribute

Parameters

gl: WebGL2RenderingContext

The WebGL2RenderingContext used to create the buffer.

type: number

The type of data in the attribute.

itemSize: number

The number of elements per attribute.

elementSize: 1 | 2 | 4

The size of individual elements in the array.

array: TypedArray

The data array that holds the attribute values.

meshPerAttribute: number = 1

The number of meshes that share the same attribute data.

Returns

GLInstancedBufferAttribute

Overrides

GLBufferAttribute.constructor

Defined in

core/utils/GLInstancedBufferAttribute.ts:35

Properties

array

array: TypedArray

The data array that holds the attribute values.

Defined in

core/utils/GLInstancedBufferAttribute.ts:20


isGLInstancedBufferAttribute

isGLInstancedBufferAttribute: boolean = true

Indicates if this is an isGLInstancedBufferAttribute.

Defined in

core/utils/GLInstancedBufferAttribute.ts:12


meshPerAttribute

meshPerAttribute: number

The number of meshes that share the same attribute data.

Defined in

core/utils/GLInstancedBufferAttribute.ts:16

Methods

update()

update(renderer, count): void

Updates the buffer data. This method is designed to be called during the onBeforeRender callback. It ensures that the attribute data is updated just before the rendering process begins.

Parameters

renderer: WebGLRenderer

The WebGLRenderer used to render the scene.

count: number

The number of elements to update in the buffer.

Returns

void

Defined in

core/utils/GLInstancedBufferAttribute.ts:54