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

51 lines
1.7 KiB
JavaScript

shadow$provide.module$node_modules$pixi_DOT_js$lib$rendering$renderers$gpu$shader$BindGroup = function(global, require, module, exports) {
class BindGroup {
constructor(resources) {
this.resources = Object.create(null);
this._dirty = !0;
let index = 0;
for (const i in resources) {
this.setResource(resources[i], index++);
}
this._updateKey();
}
_updateKey() {
if (this._dirty) {
this._dirty = !1;
var keyParts = [], index = 0;
for (const i in this.resources) {
keyParts[index++] = this.resources[i]._resourceId;
}
this._key = keyParts.join("|");
}
}
setResource(resource, index) {
const currentResource = this.resources[index];
resource !== currentResource && (currentResource?.off?.("change", this.onResourceChange, this), resource.on?.("change", this.onResourceChange, this), this.resources[index] = resource, this._dirty = !0);
}
getResource(index) {
return this.resources[index];
}
_touch(now, tick) {
const resources = this.resources;
for (const i in resources) {
resources[i]._gcLastUsed = now, resources[i]._touched = tick;
}
}
destroy() {
const resources = this.resources;
for (const i in resources) {
resources[i]?.off?.("change", this.onResourceChange, this);
}
this.resources = null;
}
onResourceChange(resource) {
this._dirty = !0;
resource.destroyed ? this.destroy() : this._updateKey();
}
}
exports.BindGroup = BindGroup;
};
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$rendering$renderers$gpu$shader$BindGroup.js.map