Files
il/resources/public/js/cljs-runtime/module$node_modules$pixi_DOT_js$lib$rendering$renderers$gpu$buffer$UboBatch.js
2026-07-01 22:38:29 -06:00

38 lines
1.2 KiB
JavaScript

shadow$provide.module$node_modules$pixi_DOT_js$lib$rendering$renderers$gpu$buffer$UboBatch = function(global, require, module, exports) {
class UboBatch {
constructor({minUniformOffsetAlignment}) {
this.byteIndex = 0;
this._minUniformOffsetAlignment = minUniformOffsetAlignment;
this.data = new Float32Array(65535);
}
clear() {
this.byteIndex = 0;
}
addEmptyGroup(size) {
if (size > this._minUniformOffsetAlignment / 4) {
throw Error(`UniformBufferBatch: array is too large: ${4 * size}`);
}
const start = this.byteIndex;
size = Math.ceil((start + 4 * size) / this._minUniformOffsetAlignment) * this._minUniformOffsetAlignment;
if (size > 4 * this.data.length) {
throw Error("UniformBufferBatch: ubo batch got too big");
}
this.byteIndex = size;
return start;
}
addGroup(array) {
const offset = this.addEmptyGroup(array.length);
for (let i = 0; i < array.length; i++) {
this.data[offset / 4 + i] = array[i];
}
return offset;
}
destroy() {
this.data = null;
}
}
exports.UboBatch = UboBatch;
};
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$rendering$renderers$gpu$buffer$UboBatch.js.map