shadow$provide.module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$sources$TextureSource = function(global, require, module, exports) { global = require("module$node_modules$eventemitter3$index"); var pow2 = require("module$node_modules$pixi_DOT_js$lib$maths$misc$pow2"), definedProps = require("module$node_modules$pixi_DOT_js$lib$scene$container$utils$definedProps"), uid = require("module$node_modules$pixi_DOT_js$lib$utils$data$uid"), TextureStyle = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$TextureStyle"); "use strict"; const node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$sources$TextureSource$classdecl$var2 = class extends global { constructor(options = {}) { super(); this.options = options; this._gpuData = Object.create(null); this._gcLastUsed = -1; this.uid = uid.uid("textureSource"); this._resourceType = "textureSource"; this._resourceId = uid.uid("resource"); this.uploadMethodId = "unknown"; this.mipLevelCount = this.sampleCount = this.height = this.width = this.pixelHeight = this.pixelWidth = this._resolution = 1; this.autoGenerateMipmaps = !1; this.format = "rgba8unorm"; this.viewDimension = this.dimension = "2d"; this.arrayLayerCount = 1; this.transient = this.antialias = !1; this._touched = 0; this._textureBindLocation = this._batchTick = -1; options = {...node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$sources$TextureSource$classdecl$var2.defaultOptions, ...options}; this.label = options.label ?? ""; this.resource = options.resource; this.autoGarbageCollect = options.autoGarbageCollect; this._resolution = options.resolution; this.pixelWidth = options.width ? options.width * this._resolution : this.resource ? this.resourceWidth ?? 1 : 1; this.pixelHeight = options.height ? options.height * this._resolution : this.resource ? this.resourceHeight ?? 1 : 1; this.width = this.pixelWidth / this._resolution; this.height = this.pixelHeight / this._resolution; this.format = options.format; this.dimension = options.dimensions; this.viewDimension = options.viewDimension ?? options.dimensions; this.arrayLayerCount = options.arrayLayerCount; this.mipLevelCount = options.mipLevelCount; this.autoGenerateMipmaps = options.autoGenerateMipmaps; this.sampleCount = options.sampleCount; this.antialias = options.antialias; this.transient = options.transient ?? !1; this.alphaMode = options.alphaMode; this.style = new TextureStyle.TextureStyle(definedProps.definedProps(options)); this.destroyed = !1; this._refreshPOT(); } get source() { return this; } get style() { return this._style; } set style(value) { this.style !== value && (this._style?.off("change", this._onStyleChange, this), this._style = value, this._style?.on("change", this._onStyleChange, this), this._onStyleChange()); } set maxAnisotropy(value) { this._style.maxAnisotropy = value; } get maxAnisotropy() { return this._style.maxAnisotropy; } get addressMode() { return this._style.addressMode; } set addressMode(value) { this._style.addressMode = value; } get repeatMode() { return this._style.addressMode; } set repeatMode(value) { this._style.addressMode = value; } get magFilter() { return this._style.magFilter; } set magFilter(value) { this._style.magFilter = value; } get minFilter() { return this._style.minFilter; } set minFilter(value) { this._style.minFilter = value; } get mipmapFilter() { return this._style.mipmapFilter; } set mipmapFilter(value) { this._style.mipmapFilter = value; } get lodMinClamp() { return this._style.lodMinClamp; } set lodMinClamp(value) { this._style.lodMinClamp = value; } get lodMaxClamp() { return this._style.lodMaxClamp; } set lodMaxClamp(value) { this._style.lodMaxClamp = value; } _onStyleChange() { this.emit("styleChange", this); } update() { if (this.resource) { const resolution = this._resolution; if (this.resize(this.resourceWidth / resolution, this.resourceHeight / resolution)) { return; } } this.emit("update", this); } destroy() { this.destroyed = !0; this.unload(); this.emit("destroy", this); this._style && (this._style.destroy(), this._style = null); this.resource = this.uploadMethodId = null; this.removeAllListeners(); } unload() { this._resourceId = uid.uid("resource"); this.emit("change", this); this.emit("unload", this); for (const key in this._gpuData) { this._gpuData[key]?.destroy?.(); } this._gpuData = Object.create(null); } get resourceWidth() { const {resource} = this; return resource.naturalWidth || resource.videoWidth || resource.displayWidth || resource.width; } get resourceHeight() { const {resource} = this; return resource.naturalHeight || resource.videoHeight || resource.displayHeight || resource.height; } get resolution() { return this._resolution; } set resolution(resolution) { this._resolution !== resolution && (this._resolution = resolution, this.width = this.pixelWidth / resolution, this.height = this.pixelHeight / resolution); } resize(width, height, resolution) { resolution || (resolution = this._resolution); width || (width = this.width); height || (height = this.height); width = Math.round(width * resolution); height = Math.round(height * resolution); this.width = width / resolution; this.height = height / resolution; this._resolution = resolution; if (this.pixelWidth === width && this.pixelHeight === height) { return !1; } this._refreshPOT(); this.pixelWidth = width; this.pixelHeight = height; this.emit("resize", this); this._resourceId = uid.uid("resource"); this.emit("change", this); return !0; } updateMipmaps() { this.autoGenerateMipmaps && 1 < this.mipLevelCount && this.emit("updateMipmaps", this); } set wrapMode(value) { this._style.wrapMode = value; } get wrapMode() { return this._style.wrapMode; } set scaleMode(value) { this._style.scaleMode = value; } get scaleMode() { return this._style.scaleMode; } _refreshPOT() { this.isPowerOfTwo = pow2.isPow2(this.pixelWidth) && pow2.isPow2(this.pixelHeight); } static test(_resource) { throw Error("Unimplemented"); } }; require = node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$sources$TextureSource$classdecl$var2; require.defaultOptions = {resolution:1, format:"bgra8unorm", alphaMode:"premultiply-alpha-on-upload", dimensions:"2d", viewDimension:"2d", arrayLayerCount:1, mipLevelCount:1, autoGenerateMipmaps:!1, sampleCount:1, antialias:!1, autoGarbageCollect:!1}; exports.TextureSource = require; }; //# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$sources$TextureSource.js.map