shadow$provide.module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$CubeTexture = function(global, require, module, exports) { function getCubeCacheKey(faceIds, options) { const opts = options ? {...options} : {}; delete opts.label; options = Object.keys(opts).sort(); options = options.length ? `|${options.map(k => `${k}=${String(opts[k])}`).join("\x26")}` : ""; return `cube:${faceKeys.map(k => faceIds[k]).join(",")}${options}`; } global = require("module$node_modules$eventemitter3$index"); var Cache = require("module$node_modules$pixi_DOT_js$lib$assets$cache$Cache"), uid = require("module$node_modules$pixi_DOT_js$lib$utils$data$uid"), CubeTextureSource = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$sources$CubeTextureSource"), Texture = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$Texture"); "use strict"; const faceKeys = "left right top bottom front back".split(" "); class CubeTexture extends global { constructor(options) { super(); this.uid = uid.uid("cubeTexture"); this.destroyed = !1; const {label, source} = options; this.label = label; this.source = source; this.source.label = this.label ?? this.source.label; } static from(options, skipCache = !1) { if (options instanceof CubeTextureSource.CubeTextureSource) { return new CubeTexture({source:options}); } const {faces, ...sourceOptions} = options; let cacheKey = null; options = faceKeys.every(key => "string" === typeof faces[key]); if (!skipCache && options && (cacheKey = getCubeCacheKey(faces, sourceOptions), Cache.Cache.has(cacheKey))) { return Cache.Cache.get(cacheKey); } skipCache = input => input.isTexture ? input : Texture.Texture.from(input); options = {}; for (var key of faceKeys) { options[key] = skipCache(faces[key]).source; } key = new CubeTexture({source:new CubeTextureSource.CubeTextureSource({...sourceOptions, faces:options}), label:sourceOptions.label}); cacheKey && (Cache.Cache.set(cacheKey, key), key.once("destroy", () => { Cache.Cache.has(cacheKey) && Cache.Cache.remove(cacheKey); })); return key; } destroy(destroySource = !1) { this.destroyed || (this.destroyed = !0, destroySource && this.source.destroy(), this.emit("destroy", this), this.removeAllListeners()); } } exports.CubeTexture = CubeTexture; }; //# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$CubeTexture.js.map