import { Usage } from '../constants'; import { Matrix3 } from './../math/Matrix3'; import { Matrix4 } from './../math/Matrix4'; /** * see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js|src/core/BufferAttribute.js} */ export class BufferAttribute { /** * @param 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. * @param 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. * @param 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. */ constructor(array: ArrayLike, itemSize: number, normalized?: boolean); // array parameter should be TypedArray. /** * @default '' */ name: string; array: ArrayLike; itemSize: number; /** * @default THREE.StaticDrawUsage */ usage: Usage; /** * @default { offset: number; count: number } */ updateRange: { offset: number; count: number }; /** * @default 0 */ version: number; /** * @default false */ normalized: boolean; /** * @default 0 */ count: number; set needsUpdate(value: boolean); readonly isBufferAttribute: true; onUploadCallback: () => void; onUpload(callback: () => void): this; setUsage(usage: Usage): this; clone(): this; copy(source: BufferAttribute): this; copyAt(index1: number, attribute: BufferAttribute, index2: number): this; copyArray(array: ArrayLike): this; applyMatrix3(m: Matrix3): this; applyMatrix4(m: Matrix4): this; applyNormalMatrix(m: Matrix3): this; transformDirection(m: Matrix4): this; set(value: ArrayLike | ArrayBufferView, offset?: number): this; getX(index: number): number; setX(index: number, x: number): this; getY(index: number): number; setY(index: number, y: number): this; getZ(index: number): number; setZ(index: number, z: number): this; getW(index: number): number; setW(index: number, z: number): this; setXY(index: number, x: number, y: number): this; setXYZ(index: number, x: number, y: number, z: number): this; setXYZW(index: number, x: number, y: number, z: number, w: number): this; toJSON(): { itemSize: number; type: string; array: number[]; normalized: boolean; }; } /** * @deprecated THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead. */ export class Int8Attribute extends BufferAttribute { constructor(array: any, itemSize: number); } /** * @deprecated THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead. */ export class Uint8Attribute extends BufferAttribute { constructor(array: any, itemSize: number); } /** * @deprecated THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead. */ export class Uint8ClampedAttribute extends BufferAttribute { constructor(array: any, itemSize: number); } /** * @deprecated THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead. */ export class Int16Attribute extends BufferAttribute { constructor(array: any, itemSize: number); } /** * @deprecated THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead. */ export class Uint16Attribute extends BufferAttribute { constructor(array: any, itemSize: number); } /** * @deprecated THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead. */ export class Int32Attribute extends BufferAttribute { constructor(array: any, itemSize: number); } /** * @deprecated THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead. */ export class Uint32Attribute extends BufferAttribute { constructor(array: any, itemSize: number); } /** * @deprecated THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead. */ export class Float32Attribute extends BufferAttribute { constructor(array: any, itemSize: number); } /** * @deprecated THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead. */ export class Float64Attribute extends BufferAttribute { constructor(array: any, itemSize: number); } export class Int8BufferAttribute extends BufferAttribute { constructor( array: Iterable | ArrayLike | ArrayBuffer | number, itemSize: number, normalized?: boolean, ); } export class Uint8BufferAttribute extends BufferAttribute { constructor( array: Iterable | ArrayLike | ArrayBuffer | number, itemSize: number, normalized?: boolean, ); } export class Uint8ClampedBufferAttribute extends BufferAttribute { constructor( array: Iterable | ArrayLike | ArrayBuffer | number, itemSize: number, normalized?: boolean, ); } export class Int16BufferAttribute extends BufferAttribute { constructor( array: Iterable | ArrayLike | ArrayBuffer | number, itemSize: number, normalized?: boolean, ); } export class Uint16BufferAttribute extends BufferAttribute { constructor( array: Iterable | ArrayLike | ArrayBuffer | number, itemSize: number, normalized?: boolean, ); } export class Int32BufferAttribute extends BufferAttribute { constructor( array: Iterable | ArrayLike | ArrayBuffer | number, itemSize: number, normalized?: boolean, ); } export class Uint32BufferAttribute extends BufferAttribute { constructor( array: Iterable | ArrayLike | ArrayBuffer | number, itemSize: number, normalized?: boolean, ); } export class Float16BufferAttribute extends BufferAttribute { constructor( array: Iterable | ArrayLike | ArrayBuffer | number, itemSize: number, normalized?: boolean, ); } export class Float32BufferAttribute extends BufferAttribute { constructor( array: Iterable | ArrayLike | ArrayBuffer | number, itemSize: number, normalized?: boolean, ); } export class Float64BufferAttribute extends BufferAttribute { constructor( array: Iterable | ArrayLike | ArrayBuffer | number, itemSize: number, normalized?: boolean, ); }