playcanvas
Version:
PlayCanvas WebGL game engine
21 lines (19 loc) • 637 B
JavaScript
class WebglDrawCommands {
constructor(indexSizeBytes){
this.glCounts = null;
this.glOffsetsBytes = null;
this.glInstanceCounts = null;
this.indexSizeBytes = indexSizeBytes;
}
allocate(maxCount) {
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;
}
}
export { WebglDrawCommands };