BufferAttribute<TData extends NativeArray<num>> constructor

BufferAttribute<TData extends NativeArray<num>>(
  1. TData arrayList,
  2. int itemSize, [
  3. bool normalized = false
])

array -- Must be a TypedArray. Used to instantiate the buffer.

This array should have

itemSize * numVertices

elements, where numVertices is the number of vertices in the associated BufferGeometry.

itemSize -- 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 -- (optional) Applies to integer data only. 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 -32768 - +32767 to -1.0f

  • +1.0f. If normalized is false, the values will be converted to floats unmodified, i.e. 32767 becomes 32767.0f.

Implementation

BufferAttribute(TData arrayList, int itemSize, [bool normalized = false]) {
  type = "BufferAttribute";
  array = arrayList;
  this.itemSize = itemSize;
  count = arrayList.length ~/ itemSize;
  this.normalized = normalized == true;

  usage = StaticDrawUsage;
  updateRange = {"offset": 0, "count": -1};

  version = 0;
}