UNPKG

playcanvas

Version:

PlayCanvas WebGL game engine

29 lines (26 loc) 794 B
import { ImmediateBatch } from './immediate-batch.js'; // helper class storing line batches for a single layer class ImmediateBatches { getBatch(material, layer) { var 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()); } constructor(device){ this.device = device; // dictionary of Material to ImmediateBatch mapping this.map = new Map(); } } export { ImmediateBatches };