@three.ez/batched-mesh-extensions
Version:
Utility extension methods for BatchedMesh
28 lines • 801 B
JavaScript
/**
* A class that creates and manages a list of render items, used to determine the rendering order based on depth.
* @internal
*/
export class MultiDrawRenderList {
constructor() {
this.array = [];
this.pool = [];
}
push(instanceId, depth, start, count) {
const pool = this.pool;
const list = this.array;
const index = list.length;
if (index >= pool.length) {
pool.push({ start: null, count: null, z: null, zSort: null, index: null });
}
const item = pool[index];
item.index = instanceId;
item.start = start;
item.count = count;
item.z = depth;
list.push(item);
}
reset() {
this.array.length = 0;
}
}
//# sourceMappingURL=MultiDrawRenderList.js.map