rl-loadout-lib
Version:
Load Rocket League assets into three.js
30 lines • 923 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Convenience function to call dispose() on an object if it's not undefined or null.
* @param object nullable object that must have a dispose method
*/
const three_1 = require("three");
function disposeIfExists(object) {
if (object != undefined && object.dispose != undefined) {
object.dispose();
}
}
exports.disposeIfExists = disposeIfExists;
exports.StringUtil = {
nullOrEmpty: (s) => s == undefined || s === ''
};
function htmlImageToTexture(image) {
if (image == undefined) {
return undefined;
}
const t = new three_1.Texture(image);
t.wrapS = three_1.RepeatWrapping;
t.wrapT = three_1.RepeatWrapping;
t.encoding = three_1.LinearEncoding;
t.flipY = false;
t.needsUpdate = true;
return t;
}
exports.htmlImageToTexture = htmlImageToTexture;
//# sourceMappingURL=util.js.map