UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

130 lines 3.24 kB
/** * @readonly * @type {number} */ export const BVH_BOX_BYTE_SIZE: number; /** * In words (4 byte) * @readonly * @type {number} */ export const BVH_BINARY_NODE_SIZE: number; /** * @readonly * @type {number} */ export const BVH_LEAF_NODE_SIZE: number; export class BinaryUint32BVH { /** * * @private * @type {ArrayBuffer} */ private __data_buffer; /** * @readonly * @type {Float32Array} * @private */ private readonly __data_float32; /** * @readonly * @private * @type {Uint32Array} */ private readonly __data_uint32; /** * * @type {number} * @private */ private __node_count_binary; /** * * @type {number} * @private */ private __node_count_leaf; /** * * @param {ArrayBuffer} buffer */ set data(buffer: ArrayBuffer); get data(): ArrayBuffer; /** * In bytes * @returns {number} */ estimateByteSize(): number; getTotalBoxCount(): number; get binary_node_count(): number; get leaf_node_count(): number; /** * * @returns {number} */ getLeafBlockAddress(): number; get float32(): Float32Array<ArrayBufferLike>; get uint32(): Uint32Array<ArrayBufferLike>; /** * Resolve index of the node to address where the node data starts, this is required to know where AABB is stored in memory * @param {number} node_index * @returns {number} */ getNodeAddress(node_index: number): number; initialize_structure(): void; /** * * @param {number} count */ setLeafCount(count: number): void; /** * * @param {number} index * @return {number} */ getLeafAddress(index: number): number; /** * * @param {number} index * @param {number} payload * @param {number} x0 * @param {number} y0 * @param {number} z0 * @param {number} x1 * @param {number} y1 * @param {number} z1 */ setLeafData(index: number, payload: number, x0: number, y0: number, z0: number, x1: number, y1: number, z1: number): void; /** * Read bounds of a box at the given address * @param {number} address where the box is found * @param {number[]|Float32Array} destination where to write the box coordinates (x0,y0,z0,x1,y1,z1) * @param {number} destination_offset offset within the destination array where to start writing results */ readBounds(address: number, destination: number[] | Float32Array, destination_offset: number): void; /** * * @param {number} leaf_index * @returns {number} */ readLeafPayload(leaf_index: number): number; compute_total_surface_area(): number; /** * Sort leaf nodes according to their morton codes * @param {number[]} bounds */ sort_morton(bounds: number[]): void; /** * Does not update intermediate node bounds * @param {number} i * @param {number} j * @private */ private __swap_leaves; /** * Assemble leaf nodes into hierarchy, set binary node bounds iteratively bottom up */ build(): void; } //# sourceMappingURL=BinaryUint32BVH.d.ts.map