Skip to content

GLInstancedBufferAttribute

Defined in: core/utils/GLInstancedBufferAttribute.ts:8

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

Defined in: core/utils/GLInstancedBufferAttribute.ts:35

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

The size of individual elements in the array.

1 | 2 | 4

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

Properties

array

array: TypedArray

Defined in: core/utils/GLInstancedBufferAttribute.ts:20

The data array that holds the attribute values.


isGLInstancedBufferAttribute

isGLInstancedBufferAttribute: boolean = true

Defined in: core/utils/GLInstancedBufferAttribute.ts:12

Indicates if this is an isGLInstancedBufferAttribute.


meshPerAttribute

meshPerAttribute: number

Defined in: core/utils/GLInstancedBufferAttribute.ts:16

The number of meshes that share the same attribute data.

Methods

update()

update(renderer, count): void

Defined in: core/utils/GLInstancedBufferAttribute.ts:54

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