playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
27 lines (26 loc) • 593 B
JavaScript
import { ImmediateBatch } from "./immediate-batch.js";
class ImmediateBatches {
constructor(device) {
this.device = device;
this.map = /* @__PURE__ */ new Map();
}
getBatch(material, layer) {
let batch = this.map.get(material);
if (!batch) {
batch = new ImmediateBatch(this.device, material, layer);
this.map.set(material, batch);
}
return batch;
}
onPreRender(visibleList, transparent) {
this.map.forEach((batch) => {
batch.onPreRender(visibleList, transparent);
});
}
clear() {
this.map.forEach((batch) => batch.clear());
}
}
export {
ImmediateBatches
};