Files
il/resources/public/js/cljs-runtime/module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$utils$textureFrom.js
2026-07-01 22:38:29 -06:00

46 lines
2.3 KiB
JavaScript

shadow$provide.module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$utils$textureFrom = function(global, require, module, exports) {
function textureSourceFrom(options = {}) {
var hasResource = options && options.resource;
const res = hasResource ? options.resource : options;
options = hasResource ? options : {resource:options};
for (hasResource = 0; hasResource < sources.length; hasResource++) {
const Source = sources[hasResource];
if (Source.test(res)) {
return new Source(options);
}
}
throw Error(`Could not find a source type for resource: ${options.resource}`);
}
function resourceToTexture(options = {}, skipCache = !1) {
const hasResource = options && options.resource, resource = hasResource ? options.resource : options;
options = hasResource ? options : {resource:options};
if (!skipCache && Cache.Cache.has(resource)) {
return Cache.Cache.get(resource);
}
options = new Texture.Texture({source:textureSourceFrom(options)});
options.on("destroy", () => {
Cache.Cache.has(resource) && Cache.Cache.remove(resource);
});
skipCache || Cache.Cache.set(resource, options);
return options;
}
function textureFrom(id, skipCache = !1) {
return "string" === typeof id ? Cache.Cache.get(id) : id instanceof TextureSource.TextureSource ? new Texture.Texture({source:id}) : resourceToTexture(id, skipCache);
}
var Cache = require("module$node_modules$pixi_DOT_js$lib$assets$cache$Cache");
global = require("module$node_modules$pixi_DOT_js$lib$extensions$Extensions");
var TextureSource = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$sources$TextureSource"), Texture = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$Texture");
"use strict";
const sources = [];
global.extensions.handleByList(global.ExtensionType.TextureSource, sources);
Texture.Texture.from = textureFrom;
TextureSource.TextureSource.from = textureSourceFrom;
exports.autoDetectSource = function(options = {}) {
return textureSourceFrom(options);
};
exports.resourceToTexture = resourceToTexture;
exports.textureFrom = textureFrom;
};
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$utils$textureFrom.js.map