kavea/src/static/babylonjs-4.2.0.loaders.min.js

16 lines
153 KiB
JavaScript
Raw Normal View History

2021-09-19 18:40:50 -04:00
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-loaders",["babylonjs"],t):"object"==typeof exports?exports["babylonjs-loaders"]=t(require("babylonjs")):e.LOADERS=t(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=20)}([function(t,n){t.exports=e},function(e,t,n){"use strict";n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return i}));var r=n(0),o=n(2),a=function(){function e(){}return e.Get=function(e,t,n){if(!t||null==n||!t[n])throw new Error(e+": Failed to find index ("+n+")");return t[n]},e.Assign=function(e){if(e)for(var t=0;t<e.length;t++)e[t].index=t},e}(),i=function(){function e(e){this._completePromises=new Array,this._forAssetContainer=!1,this._babylonLights=[],this._disableInstancedMesh=0,this._disposed=!1,this._state=null,this._extensions=new Array,this._defaultBabylonMaterialData={},this._parent=e}return e.RegisterExtension=function(t,n){e.UnregisterExtension(t)&&r.Logger.Warn("Extension with the name '"+t+"' already exists"),e._RegisteredExtensions[t]={factory:n}},e.UnregisterExtension=function(t){return!!e._RegisteredExtensions[t]&&(delete e._RegisteredExtensions[t],!0)},Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gltf",{get:function(){return this._gltf},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bin",{get:function(){return this._bin},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"babylonScene",{get:function(){return this._babylonScene},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootBabylonMesh",{get:function(){return this._rootBabylonMesh},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){if(!this._disposed){for(var e in this._disposed=!0,this._completePromises.length=0,this._extensions){var t=this._extensions[e];t.dispose&&t.dispose(),delete this._extensions[e]}this._gltf=null,this._babylonScene=null,this._rootBabylonMesh=null,this._parent.dispose()}},e.prototype.importMeshAsync=function(e,t,n,r,o,a,i){var s=this;return Promise.resolve().then((function(){s._babylonScene=t,s._rootUrl=o,s._fileName=i||"scene",s._forAssetContainer=n,s._loadData(r);var a=null;if(e){var l={};if(s._gltf.nodes)for(var u=0,c=s._gltf.nodes;u<c.length;u++){var d=c[u];d.name&&(l[d.name]=d.index)}a=(e instanceof Array?e:[e]).map((function(e){var t=l[e];if(void 0===t)throw new Error("Failed to find node '"+e+"'");return t}))}return s._loadAsync(a,(function(){return{meshes:s._getMeshes(),particleSystems:[],skeletons:s._getSkeletons(),animationGroups:s._getAnimationGroups(),lights:s._babylonLights,transformNodes:s._getTransformNodes(),geometries:s._getGeometries()}}))}))},e.prototype.loadAsync=function(e,t,n,r,o){var a=this;return Promise.resolve().then((function(){return a._babylonScene=e,a._rootUrl=n,a._fileName=o||"scene",a._loadData(t),a._loadAsync(null,(function(){}))}))},e.proto
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function o(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return(a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.create;Object.create},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t)},function(e,t,n){"use strict";n.r(t),n.d(t,"EXT_lights_image_based",(function(){return i})),n.d(t,"EXT_mesh_gpu_instancing",(function(){return s})),n.d(t,"EXT_texture_webp",(function(){return l})),n.d(t,"KHR_draco_mesh_compression",(function(){return u})),n.d(t,"KHR_lights",(function(){return c})),n.d(t,"KHR_materials_pbrSpecularGlossiness",(function(){return d})),n.d(t,"KHR_materials_unlit",(function(){return f})),n.d(t,"KHR_materials_clearcoat",(function(){return h})),n.d(t,"KHR_materials_sheen",(function(){return p})),n.d(t,"KHR_materials_specular",(function(){return _})),n.d(t,"KHR_materials_ior",(function(){return m})),n.d(t,"KHR_materials_variants",(function(){return y})),n.d(t,"KHR_materials_transmission",(function(){return g})),n.d(t,"KHR_materials_translucency",(function(){return A})),n.d(t,"KHR_mesh_quantization",(function(){return T})),n.d(t,"KHR_texture_basisu",(function(){return x})),n.d(t,"KHR_texture_transform",(function(){return E})),n.d(t,"MSFT_audio_emitter",(function(){return L})),n.d(t,"MSFT_lod",(function(){return O})),n.d(t,"MSFT_minecraftMesh",(function(){return M})),n.d(t,"MSFT_sRGBFactors",(function(){return S})),n.d(t,"ExtrasAsMetadata",(function(){return w}));var r=n(0),o=n(1),a="EXT_lights_image_based",i=function(){function e(e){this.name=a,this._loader=e,this.enabled=this._loader.isExtensionUsed(a)}return e.prototype.dispose=function(){this._loader=null,delete this._lights},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._lights=t.lights}},e.prototype.loadSceneAsync=function(e,t){var n=this;return o.b.LoadExtensionAsync(e,t,this.name,(function(r,a){var i=new Array;i.push(n._loader.loadSceneAsync(e,t)),n._loader.logOpen(""+r);var s=o.a.Get(r+"/light",n._lights,a.light);return i.push(n._loadLightAsync("/extensions/"+n.name+"/lights/"+a.light,s).then((function(e){n._loader.babylonScene.environmentTexture=e}))),n._loader.logClose(),Promise.all(i).then((function(){}))}))},e.prototype._loadLightAsync=function(e,t){var n=this;if(!t._loaded){var a=new Array;this._loader.logOpen(""+e);for(var i=new Array(t.specularImages.length),s=function(n){var r=t.specularImages[n];i[n]=new Array(r.length);for(var s=function(t){var s=e+"/specularImages/"+n+"/"+t;l._loader.logOpen(""+s);var u=r[t],c=o.a.Get(s,l._loader.gltf.images,u);a.push(l._loader.loadImageAsync("/images/"+u,c).then((function(e){i[n][t]=e}))),l._loader.logClose()},u=0;u<r.length;u++)s(u)},l=this,u=0;u<t.specularImages.length;u++)s(u);this._loader.logClose(),t._loaded=Promise.all(a).then((function(){var e=new r.RawCubeTexture(n._loader.babylonScene,null,t.specularImageSize);if(e.name=t.name||"environment",t._babylonTexture=e,null!=t.intensity&&(e.level=t.intensity),t.rotation){var o=r.Quaternion.FromArray(t.rotation);n._loader.babylonScene.useRightHandedSystem||(o=r.Quaternion.Inverse(o)),r.Matrix.FromQuaternionToRef(o,e.getReflectionTextureMatrix())}var a=r.SphericalHarmonics.FromArray(t.irradianceCoefficients);a.scaleInPlace(t.intensity),a.convertIrradianceToLambertianRadiance();var s=r.SphericalPolynomial.FromHarmonics(a),l=(i.length-1)/r.Scalar.Log2(t.specularImageSize);return e.updateRGBDAsync(i,s,l)}))}return t._loaded.then((function(){return t._babylonTexture}))},e}();o.b.RegisterExtension(a,(function(e){return new i(e)}));var s=function()