@realsee/five
Version:
Realsee Renderer SDK
39 lines (38 loc) • 1.8 kB
TypeScript
import { Geometry, BufferGeometry, BufferAttribute } from 'three';
declare class PrefabBufferGeometry extends BufferGeometry {
prefabGeometry: Geometry | BufferGeometry;
isPrefabBufferGeometry: boolean;
prefabCount: number;
prefabVertexCount: number;
/**
* A BufferGeometry where a 'prefab' geometry is repeated a number of times.
*
* @param {Geometry|BufferGeometry} prefab The Geometry instance to repeat.
* @param {Number} count The number of times to repeat the geometry.
*/
constructor(prefab: Geometry | BufferGeometry, count: number);
bufferIndices(): void;
bufferPositions(): void;
bufferUvs(): void;
bufferNormals(): void;
/**
* 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): BufferAttribute;
/**
* Sets data for all vertices of 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 | BufferAttribute, prefabIndex: number, data: any[]): void;
}
export { PrefabBufferGeometry };