Last updated

API / geotoolkit / webgl / BufferAttribute / BufferAttribute

Class: BufferAttribute

webgl.BufferAttribute.BufferAttribute

This class stores data for an attribute, which allows for more efficient passing of data to the GPU.

Throws

BufferAttribute should be a typed array

Table of contents

Constructors
Methods

Contents

Constructors

new BufferAttribute(array, itemSize, normalized, dynamic)

new BufferAttribute(array, itemSize, normalized?, dynamic?)

Create BufferAttribute

Parameters

Name Type Description
arrayTypedArraytyped array
itemSizenumberthe number of values of the array that associated with a particular vertex
Optional normalizedbooleanApplies to integer data only. Indicates how the underlying data in the buffer maps to the values in the GLSL code
Optional dynamicbooleanDefines the intended usage pattern of the data store for optimization purposes
Methods

get

get(offset): number

Return a value at given position in array
Note that this should not be confused with index of vertex.

Parameters

Name Type Description
offsetnumberthe offset of array

Returns

number

value


getArray

getArray(): TypedArray

Return the typed array in the buffer

Returns

TypedArray

array typed array


getAttributes

getAttributes(): Attributes

Return attributes for this BufferAttribute

Returns

Attributes

The attributes


set

set(value, offset): BufferAttribute

Set a value at given position in array
Note that this should not be confused with index of vertex.

Parameters

Name Type Description
valuenumberthe value to be set
offsetnumberthe offset of array. Note this should not be confused with index of vertices.

Returns

BufferAttribute

this


setArray

setArray(array): BufferAttribute

Set the typed array in the buffer

Throws

TypeError if array is not a Typed Array

Parameters

Name Type Description
arraynumber[]typed array

Returns

BufferAttribute

this


setDynamic

setDynamic(dynamic): BufferAttribute

Whether the buffer is updated dynamically or not.

Parameters

Name Type Description
dynamicbooleanthe dynamic flag

Returns

BufferAttribute

this


setName

setName(name): BufferAttribute

Set name for this attribute

Parameters

Name Type Description
namestringthe attribute name

Returns

BufferAttribute

this