@realsee/five
Version:
Realsee Renderer SDK
33 lines (32 loc) • 1.73 kB
TypeScript
import { InstancedBufferGeometry, InstancedBufferAttribute, BufferGeometry } from 'three';
declare class InstancedPrefabBufferGeometry extends InstancedBufferGeometry {
prefabGeometry: BufferGeometry;
prefabCount: number;
/**
* A wrapper around THREE.InstancedBufferGeometry, which is more memory efficient than PrefabBufferGeometry, but requires the ANGLE_instanced_arrays extension.
*
* @param {BufferGeometry} prefab The Geometry instance to repeat.
* @param {Number} count The number of times to repeat the geometry.
*/
constructor(prefab: BufferGeometry, count: number);
/**
* Creates a BufferAttribute on this geometry instance.
*
* @param {String} name Name of the attribute.
* @param {Number} itemSize Number of floats per vertex (typically 1, 2, 3 or 4).
* @param {function=} factory Function that will be called for each prefab upon creation. Accepts 3 arguments: data[], index and prefabCount. Calls setPrefabData.
*
* @returns {BufferAttribute}
*/
createAttribute(name: string, itemSize: number, factory?: (data: any[], index: number, prefabCount: number) => void): InstancedBufferAttribute;
/**
* Sets data for a prefab at a given index.
* Usually called in a loop.
*
* @param {String|BufferAttribute} attribute The attribute or attribute name where the data is to be stored.
* @param {Number} prefabIndex Index of the prefab in the buffer geometry.
* @param {Array} data Array of data. Length should be equal to item size of the attribute.
*/
setPrefabData(attribute: string | InstancedBufferAttribute, prefabIndex: number, data: any[]): void;
}
export { InstancedPrefabBufferGeometry };