Class: InstancedBufferAttribute

zen3d.InstancedBufferAttribute(array, size, normalizedopt, meshPerAttributeopt)

new InstancedBufferAttribute(array, size, normalizedopt, meshPerAttributeopt)

An instanced version of zen3d.BufferAttribute.
Parameters:
Name Type Attributes Default Description
array TypedArray Used to instantiate the buffer.
size Integer the number of values of the array that should be associated with a particular vertex. For instance, if this attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3.
normalized boolean <optional>
false Indicates how the underlying data in the buffer maps to the values in the GLSL code. For instance, if array is an instance of UInt16Array, and normalized is true, the values 0 - +65535 in the array data will be mapped to 0.0f - +1.0f in the GLSL attribute. An Int16Array (signed) would map from -32767 - +32767 to -1.0f - +1.0f. If normalized is false, the values will be converted to floats which contain the exact value, i.e. 32767 becomes 32767.0f.
meshPerAttribute Integer <optional>
1
Source:

Extends

Members

array :TypedArray

The array holding data stored in the buffer.
Type:
  • TypedArray
Inherited From:
Source:

count :Integer

Stores the array's length divided by the 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.
Type:
  • Integer
Inherited From:
Source:

dynamic :boolean

Whether the buffer is dynamic or not. If false, the GPU is informed that contents of the buffer are likely to be used often and not change often. This corresponds to the gl.STATIC_DRAW flag. If true, the GPU is informed that contents of the buffer are likely to be used often and change often. This corresponds to the gl.DYNAMIC_DRAW flag.
Type:
  • boolean
Inherited From:
Default Value:
  • false
Source:

(readonly) isInstancedBufferAttribute :boolean

Type:
  • boolean
Default Value:
  • true
Source:

meshPerAttribute :Integer

Type:
  • Integer
Source:

normalized :boolean

Indicates how the underlying data in the buffer maps to the values in the GLSL shader code. See the constructor above for details.
Type:
  • boolean
Inherited From:
Source:

size :Integer

The length of vectors that are being stored in the array.
Type:
  • Integer
Inherited From:
Source:

updateRange

Object containing: offset: Default is 0. Position at whcih to start update. count: 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).
Inherited From:
Source:

version :Integer

A version number, incremented every time the data changes.
Type:
  • Integer
Inherited From:
Default Value:
  • 0
Source:

Methods

clone() → {zen3d.BufferAttribute}

Return a new attribute with the same parameters as this attribute.
Inherited From:
Source:
Returns:
Type
zen3d.BufferAttribute

copy(source) → {zen3d.BufferAttribute}

Copy the parameters from the passed attribute.
Parameters:
Name Type Description
source zen3d.BufferAttribute The attribute to be copied.
Overrides:
Source:
Returns:
Type
zen3d.BufferAttribute

setArray(array)

Array to the TypedArray passed in here. After setting the array, zen3d.BufferAttribute#version should be incremented.
Parameters:
Name Type Description
array TypedArray
Inherited From:
Source: