playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
28 lines (26 loc) • 798 B
JavaScript
class WebglDrawCommands {
allocate(maxCount) {
if (this.glCounts && this.glCounts.length === maxCount) {
return;
}
this.glCounts = new Int32Array(maxCount);
this.glOffsetsBytes = new Int32Array(maxCount);
this.glInstanceCounts = new Int32Array(maxCount);
}
add(i, indexOrVertexCount, instanceCount, firstIndexOrVertex) {
this.glCounts[i] = indexOrVertexCount;
this.glOffsetsBytes[i] = firstIndexOrVertex * this.indexSizeBytes;
this.glInstanceCounts[i] = instanceCount;
}
update(count) {
let totalPrimitives = 0;
return totalPrimitives;
}
constructor(indexSizeBytes){
this.glCounts = null;
this.glOffsetsBytes = null;
this.glInstanceCounts = null;
this.indexSizeBytes = indexSizeBytes;
}
}
export { WebglDrawCommands };