22 lines
1.3 KiB
JavaScript
22 lines
1.3 KiB
JavaScript
shadow$provide.module$node_modules$pixi_DOT_js$lib$assets$loader$parsers$textures$utils$createTexture = function(global, require, module, exports) {
|
|
var Texture = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$Texture"), warn = require("module$node_modules$pixi_DOT_js$lib$utils$logging$warn"), Cache = require("module$node_modules$pixi_DOT_js$lib$assets$cache$Cache");
|
|
"use strict";
|
|
exports.createTexture = function(source, loader, url) {
|
|
source.label = url;
|
|
source._sourceOrigin = url;
|
|
const texture = new Texture.Texture({source, label:url}), unload = () => {
|
|
delete loader.promiseCache[url];
|
|
Cache.Cache.has(url) && Cache.Cache.remove(url);
|
|
};
|
|
texture.source.once("destroy", () => {
|
|
loader.promiseCache[url] && (warn.warn("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."), unload());
|
|
});
|
|
texture.once("destroy", () => {
|
|
source.destroyed || (warn.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."), unload());
|
|
});
|
|
return texture;
|
|
};
|
|
};
|
|
|
|
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$assets$loader$parsers$textures$utils$createTexture.js.map
|