UNPKG

47.6 kBJavaScriptView Raw
1var VRM=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.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 i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));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=6)}([function(e,t){e.exports=THREE},function(e,t){e.exports="varying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n varying vec3 vNormal;\n\n#endif\n\nstruct BlinnPhongMaterial {\n\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n\n};\n\nvoid RE_Direct_BlinnPhong(const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight) {\n\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n dotNL = saturate(smoothstep(f_ShadeShift, f_ShadeShift + (1.0 + f_ShadeToony), dotNL));\n vec3 irradiance = mix(v_ShadeColor.rgb, vec3(1.0), dotNL);\n\n irradiance = irradiance * mix(directLight.color, vec3(average(directLight.color)), f_LightColorAttenuation);\n\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n\n irradiance *= PI;\n\n #endif\n\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong(directLight, geometry, material.specularColor, material.specularShininess) * material.specularStrength;\n\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong(const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight) {\n\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n\n}\n\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n\n#define Material_LightProbeLOD(material) (0)\n"},function(e,t){e.exports="#include <mtoon_uniforms> // MToon uniforms\n\n// Extend MeshPhongMaterial\n#define PHONG\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n// #include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n// #include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\n#include <lights_mtoon_pars_fragment>\n\nvoid main() {\n\n #include <clipping_planes_fragment>\n\n vec4 diffuseColor = vec4(diffuse, opacity);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n\n // accumulation\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n\n // modulation\n #include <aomap_fragment>\n\n // vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n vec3 outgoingLight = reflectedLight.directDiffuse + totalEmissiveRadiance;\n\n #include <envmap_fragment>\n\n // outgoingLight = mix(v_ShadeColor.rgb, diffuseColor.rgb, saturate(outgoingLight / diffuseColor.rgb));\n outgoingLight = clamp(outgoingLight, 0.0, 1.0);\n\n // MToon additive matcap\n vec3 viewNormal = normalize(normal);\n vec2 rimUv = vec2(dot(vec3(1.0, 0.0, 0.0), normal), -dot(vec3(0.0, 1.0, 0.0), normal)) * 0.5 + 0.5;\n vec4 rimColor = texture2D(t_SphereAdd, rimUv);\n outgoingLight += rimColor.rgb;\n\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n\n}\n"},function(e,t){e.exports="uniform float f_Cutoff;\nuniform vec4 v_Color;\nuniform vec4 v_ShadeColor;\nuniform sampler2D t_MainTex;\nuniform sampler2D t_ShadeTexture;\nuniform float f_BumpScale;\nuniform sampler2D t_BumpMap;\nuniform float f_ReceiveShadowRate;\nuniform sampler2D t_ReceiveShadowTexture;\nuniform float f_ShadeShift;\nuniform float f_ShadeToony;\nuniform float f_LightColorAttenuation;\nuniform sampler2D t_SphereAdd;\nuniform vec4 v_EmissionColor;\nuniform sampler2D t_EmissionMap;\nuniform sampler2D t_OutlineWidthTexture;\nuniform float f_OutlineWidth;\nuniform float f_OutlineScaledMaxDistance;\nuniform vec4 v_OutlineColor;\nuniform float f_OutlineLightingMix;\n\nuniform int f_DebugMode;\nuniform int f_BlendMode;\nuniform int f_OutlineWidthMode;\nuniform int f_OutlineColorMode;\nuniform int f_CullMode; // Cull [Back | Front | Off]\nuniform int f_OutlineCullMode;\nuniform float f_SrcBlend; // Blend [SrcFactor] [DstFactor]\nuniform float f_DstBlend; // Blend [SrcFactor] [DstFactor]\nuniform int f_ZWrite; // ZWrite [On | Off]\nuniform int f_IsFirstSetup;\n"},function(e,t){e.exports="// Extend MeshPhongMaterial\n#define PHONG\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n varying vec3 vNormal;\n\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n vNormal = normalize( transformedNormal );\n\n#endif\n\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n\n vViewPosition = - mvPosition.xyz;\n\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n\n}\n"},function(e,t,n){var r=n(0),i=function(){function e(e){this.manager=void 0!==e?e:r.DefaultLoadingManager,this.dracoLoader=null}e.prototype={constructor:e,crossOrigin:"anonymous",load:function(e,t,n,i){var a=this,s=void 0!==this.path?this.path:r.LoaderUtils.extractUrlBase(e),o=new r.FileLoader(a.manager);o.setResponseType("arraybuffer"),o.load(e,function(e){try{a.parse(e,s,t,i)}catch(e){if(void 0===i)throw e;i(e)}},n,i)},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setDRACOLoader:function(e){return this.dracoLoader=e,this},parse:function(e,f,d,p){var h,m={};if("string"==typeof e)h=e;else if(r.LoaderUtils.decodeText(new Uint8Array(e,0,4))===s){try{m[t.KHR_BINARY_GLTF]=new function(e){this.name=t.KHR_BINARY_GLTF,this.content=null,this.body=null;var n=new DataView(e,0,o);if(this.header={magic:r.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==s)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected. Use LegacyGLTFLoader instead.");var i=new DataView(e,o),a=0;for(;a<i.byteLength;){var u=i.getUint32(a,!0);a+=4;var c=i.getUint32(a,!0);if(a+=4,c===l.JSON){var f=new Uint8Array(e,o+a,u);this.content=r.LoaderUtils.decodeText(f)}else if(c===l.BIN){var d=o+a;this.body=e.slice(d,d+u)}a+=u}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}(e)}catch(e){return void(p&&p(e))}h=m[t.KHR_BINARY_GLTF].content}else h=r.LoaderUtils.decodeText(new Uint8Array(e));var g=JSON.parse(h);if(void 0===g.asset||g.asset.version[0]<2)p&&p(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported. Use LegacyGLTFLoader instead."));else{if(g.extensionsUsed)for(var v=0;v<g.extensionsUsed.length;++v){var _=g.extensionsUsed[v],S=g.extensionsRequired||[];switch(_){case t.KHR_LIGHTS_PUNCTUAL:m[_]=new i(g);break;case t.KHR_MATERIALS_UNLIT:m[_]=new a(g);break;case t.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:m[_]=new c;break;case t.KHR_DRACO_MESH_COMPRESSION:m[_]=new u(g,this.dracoLoader);break;case t.MSFT_TEXTURE_DDS:m[t.MSFT_TEXTURE_DDS]=new n;break;default:S.indexOf(_)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+_+'".')}}var M=new B(g,m,{path:f||this.path||"",crossOrigin:this.crossOrigin,manager:this.manager});M.parse(function(e,t,n,r,i){var a={scene:e,scenes:t,cameras:n,animations:r,asset:i.asset,parser:M,userData:{}};C(m,a,i),d(a)},p)}}};var t={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function n(){if(!r.DDSLoader)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing THREE.DDSLoader");this.name=t.MSFT_TEXTURE_DDS,this.ddsLoader=new r.DDSLoader}function i(e){this.name=t.KHR_LIGHTS_PUNCTUAL,this.lights=[];for(var n=(e.extensions&&e.extensions[t.KHR_LIGHTS_PUNCTUAL]||{}).lights||[],i=0;i<n.length;i++){var a,s=n[i],o=new r.Color(16777215);void 0!==s.color&&o.fromArray(s.color);var l=void 0!==s.range?s.range:0;switch(s.type){case"directional":(a=new r.DirectionalLight(o)).target.position.set(0,0,1),a.add(a.target);break;case"point":(a=new r.PointLight(o)).distance=l;break;case"spot":(a=new r.SpotLight(o)).distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,a.angle=s.spot.outerConeAngle,a.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,a.target.position.set(0,0,1),a.add(a.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+s.type+'".')}a.decay=2,void 0!==s.intensity&&(a.intensity=s.intensity),a.name=s.name||"light_"+i,this.lights.push(a)}}function a(e){this.name=t.KHR_MATERIALS_UNLIT}a.prototype.getMaterialType=function(e){return r.MeshBasicMaterial},a.prototype.extendParams=function(e,t,n){var i=[];e.color=new r.Color(1,1,1),e.opacity=1;var a=t.pbrMetallicRoughness;if(a){if(Array.isArray(a.baseColorFactor)){var s=a.baseColorFactor;e.color.fromArray(s),e.opacity=s[3]}void 0!==a.baseColorTexture&&i.push(n.assignTexture(e,"map",a.baseColorTexture.index))}return Promise.all(i)};var s="glTF",o=12,l={JSON:1313821514,BIN:5130562};function u(e,n){if(!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=t.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=n}function c(){return{name:t.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return r.ShaderMaterial},extendParams:function(e,t,n){var i=t.extensions[this.name],a=r.ShaderLib.standard,s=r.UniformsUtils.clone(a.uniforms),o=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),l=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),u=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),c=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),f=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","material.specularRoughness = clamp( 1.0 - glossinessFactor, 0.04, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),d=a.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",o).replace("#include <metalnessmap_pars_fragment>",l).replace("#include <roughnessmap_fragment>",u).replace("#include <metalnessmap_fragment>",c).replace("#include <lights_physical_fragment>",f);delete s.roughness,delete s.metalness,delete s.roughnessMap,delete s.metalnessMap,s.specular={value:(new r.Color).setHex(1118481)},s.glossiness={value:.5},s.specularMap={value:null},s.glossinessMap={value:null},e.vertexShader=a.vertexShader,e.fragmentShader=d,e.uniforms=s,e.defines={STANDARD:""},e.color=new r.Color(1,1,1),e.opacity=1;var p=[];if(Array.isArray(i.diffuseFactor)){var h=i.diffuseFactor;e.color.fromArray(h),e.opacity=h[3]}if(void 0!==i.diffuseTexture&&p.push(n.assignTexture(e,"map",i.diffuseTexture.index)),e.emissive=new r.Color(0,0,0),e.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,e.specular=new r.Color(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture){var m=i.specularGlossinessTexture.index;p.push(n.assignTexture(e,"glossinessMap",m)),p.push(n.assignTexture(e,"specularMap",m))}return Promise.all(p)},createMaterial:function(e){var t=new r.ShaderMaterial({defines:e.defines,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,fog:!0,lights:!0,opacity:e.opacity,transparent:e.transparent});return t.isGLTFSpecularGlossinessMaterial=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t.extensions.derivatives=!0,t},cloneMaterial:function(e){var t=e.clone();t.isGLTFSpecularGlossinessMaterial=!0;for(var n=this.specularGlossinessParams,r=0,i=n.length;r<i;r++)t[n[r]]=e[n[r]];return t},refreshUniforms:function(e,t,n,r,i,a){if(!0===i.isGLTFSpecularGlossinessMaterial){var s,o=i.uniforms,l=i.defines;o.opacity.value=i.opacity,o.diffuse.value.copy(i.color),o.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),o.map.value=i.map,o.specularMap.value=i.specularMap,o.alphaMap.value=i.alphaMap,o.lightMap.value=i.lightMap,o.lightMapIntensity.value=i.lightMapIntensity,o.aoMap.value=i.aoMap,o.aoMapIntensity.value=i.aoMapIntensity,i.map?s=i.map:i.specularMap?s=i.specularMap:i.displacementMap?s=i.displacementMap:i.normalMap?s=i.normalMap:i.bumpMap?s=i.bumpMap:i.glossinessMap?s=i.glossinessMap:i.alphaMap?s=i.alphaMap:i.emissiveMap&&(s=i.emissiveMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),o.uvTransform.value.copy(s.matrix)),o.envMap.value=i.envMap,o.envMapIntensity.value=i.envMapIntensity,o.flipEnvMap.value=i.envMap&&i.envMap.isCubeTexture?-1:1,o.refractionRatio.value=i.refractionRatio,o.specular.value.copy(i.specular),o.glossiness.value=i.glossiness,o.glossinessMap.value=i.glossinessMap,o.emissiveMap.value=i.emissiveMap,o.bumpMap.value=i.bumpMap,o.normalMap.value=i.normalMap,o.displacementMap.value=i.displacementMap,o.displacementScale.value=i.displacementScale,o.displacementBias.value=i.displacementBias,null!==o.glossinessMap.value&&void 0===l.USE_GLOSSINESSMAP&&(l.USE_GLOSSINESSMAP="",l.USE_ROUGHNESSMAP=""),null===o.glossinessMap.value&&void 0!==l.USE_GLOSSINESSMAP&&(delete l.USE_GLOSSINESSMAP,delete l.USE_ROUGHNESSMAP)}}}}function f(e,t,n,i){r.Interpolant.call(this,e,t,n,i)}u.prototype.decodePrimitive=function(e,t){var n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,s={},o={},l={};for(var u in a)u in L&&(s[L[u]]=a[u]);for(u in e.attributes)if(void 0!==L[u]&&void 0!==a[u]){var c=n.accessors[e.attributes[u]],f=S[c.componentType];l[L[u]]=f,o[L[u]]=!0===c.normalized}return t.getDependency("bufferView",i).then(function(e){return new Promise(function(t){r.decodeDracoFile(e,function(e){for(var n in e.attributes){var r=e.attributes[n],i=o[n];void 0!==i&&(r.normalized=i)}t(e)},s,l)})})},f.prototype=Object.create(r.Interpolant.prototype),f.prototype.constructor=f,f.prototype.interpolate_=function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,u=r-t,c=(n-t)/u,f=c*c,d=f*c,p=e*l,h=p-l,m=2*d-3*f+1,g=d-2*f+c,v=-2*d+3*f,_=d-f,S=0;S!==s;S++){var M=a[h+S+s],b=a[h+S+o]*u,y=a[p+S+s],L=a[p+S]*u;i[S]=m*M+g*b+v*y+_*L}return i};var d=0,p=1,h=2,m=3,g=4,v=5,_=6,S=(Number,r.Matrix3,r.Matrix4,r.Vector2,r.Vector3,r.Vector4,r.Texture,{5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array}),M={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipMapNearestFilter,9985:r.LinearMipMapNearestFilter,9986:r.NearestMipMapLinearFilter,9987:r.LinearMipMapLinearFilter},b={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},y=(r.BackSide,r.FrontSide,r.NeverDepth,r.LessDepth,r.EqualDepth,r.LessEqualDepth,r.GreaterEqualDepth,r.NotEqualDepth,r.GreaterEqualDepth,r.AlwaysDepth,r.AddEquation,r.SubtractEquation,r.ReverseSubtractEquation,r.ZeroFactor,r.OneFactor,r.SrcColorFactor,r.OneMinusSrcColorFactor,r.SrcAlphaFactor,r.OneMinusSrcAlphaFactor,r.DstAlphaFactor,r.OneMinusDstAlphaFactor,r.DstColorFactor,r.OneMinusDstColorFactor,r.SrcAlphaSaturateFactor,{SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16}),L={POSITION:"position",NORMAL:"normal",TEXCOORD_0:"uv",TEXCOORD0:"uv",TEXCOORD:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",COLOR0:"color",COLOR:"color",WEIGHTS_0:"skinWeight",WEIGHT:"skinWeight",JOINTS_0:"skinIndex",JOINT:"skinIndex"},T={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},x={CUBICSPLINE:r.InterpolateSmooth,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete},R="OPAQUE",w="MASK",A="BLEND";function E(e,t){return"string"!=typeof e||""===e?"":/^(https?:)?\/\//i.test(e)?e:/^data:.*,.*$/i.test(e)?e:/^blob:.*$/i.test(e)?e:t+e}function C(e,t,n){for(var r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function P(e,t){void 0!==t.extras&&("object"==typeof t.extras?e.userData=t.extras:console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function O(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){var i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length){e.morphTargetDictionary={};for(n=0,r=i.length;n<r;n++)e.morphTargetDictionary[i[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function D(e,t){return e.indices===t.indices&&I(e.attributes,t.attributes)}function I(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(e[n]!==t[n])return!1;return!0}function F(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function G(e,t){for(var n=0,r=e.length;n<r;n++){var i=e[n];if(D(i.primitive,t))return i.promise}return null}function U(e){if(e.isInterleavedBufferAttribute){for(var t=e.count,n=e.itemSize,i=e.array.slice(0,t*n),a=0;a<t;++a)i[a]=e.getX(a),n>=2&&(i[a+1]=e.getY(a)),n>=3&&(i[a+2]=e.getZ(a)),n>=4&&(i[a+3]=e.getW(a));return new r.BufferAttribute(i,n,e.normalized)}return e.clone()}function B(e,t,n){this.json=e||{},this.extensions=t||{},this.options=n||{},this.cache=new function(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}},this.primitiveCache=[],this.multiplePrimitivesCache=[],this.multiPassGeometryCache=[],this.textureLoader=new r.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer")}function N(e,t,n){var r=t.attributes;for(var i in r){var a=L[i],s=n[r[i]];a&&(a in e.attributes||e.addAttribute(a,s))}void 0===t.indices||e.index||e.setIndex(n[t.indices]),void 0!==t.targets&&function(e,t,n){for(var r=!1,i=!1,a=0,s=t.length;a<s&&(void 0!==(u=t[a]).POSITION&&(r=!0),void 0!==u.NORMAL&&(i=!0),!r||!i);a++);if(r||i){var o=[],l=[];for(a=0,s=t.length;a<s;a++){var u=t[a],c="morphTarget"+a;if(r){if(void 0!==u.POSITION){var f=U(n[u.POSITION]);f.name=c;for(var d=e.attributes.position,p=0,h=f.count;p<h;p++)f.setXYZ(p,f.getX(p)+d.getX(p),f.getY(p)+d.getY(p),f.getZ(p)+d.getZ(p))}else f=e.attributes.position;o.push(f)}if(i){if(void 0!==u.NORMAL){var m;(m=U(n[u.NORMAL])).name=c;var g=e.attributes.normal;for(p=0,h=m.count;p<h;p++)m.setXYZ(p,m.getX(p)+g.getX(p),m.getY(p)+g.getY(p),m.getZ(p)+g.getZ(p))}else m=e.attributes.normal;l.push(m)}}r&&(e.morphAttributes.position=o),i&&(e.morphAttributes.normal=l)}}(e,t.targets,n),P(e,t)}return B.prototype.parse=function(e,t){var n=this.json;this.cache.removeAll(),this.markDefs(),this.getMultiDependencies(["scene","animation","camera"]).then(function(t){var r=t.scenes||[],i=r[n.scene||0],a=t.animations||[],s=t.cameras||[];e(i,r,s,a,n)}).catch(t)},B.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],r={},i={},a=0,s=t.length;a<s;a++)for(var o=t[a].joints,l=0,u=o.length;l<u;l++)e[o[l]].isBone=!0;for(var c=0,f=e.length;c<f;c++){var d=e[c];void 0!==d.mesh&&(void 0===r[d.mesh]&&(r[d.mesh]=i[d.mesh]=0),r[d.mesh]++,void 0!==d.skin&&(n[d.mesh].isSkinnedMesh=!0))}this.json.meshReferences=r,this.json.meshUses=i},B.prototype.getDependency=function(e,t){var n=e+":"+t,r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this.loadNode(t);break;case"mesh":r=this.loadMesh(t);break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this.loadBufferView(t);break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this.loadMaterial(t);break;case"texture":r=this.loadTexture(t);break;case"skin":r=this.loadSkin(t);break;case"animation":r=this.loadAnimation(t);break;case"camera":r=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(n,r)}return r},B.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var n=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map(function(t,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t},B.prototype.getMultiDependencies=function(e){for(var t={},n=[],r=0,i=e.length;r<i;r++){var a=e[r],s=this.getDependencies(a);s=s.then(function(e,n){t[e]=n}.bind(this,a+("mesh"===a?"es":"s"))),n.push(s)}return Promise.all(n).then(function(){return t})},B.prototype.loadBuffer=function(e){var n=this.json.buffers[e],r=this.fileLoader;if(n.type&&"arraybuffer"!==n.type)throw new Error("THREE.GLTFLoader: "+n.type+" buffer type is not supported.");if(void 0===n.uri&&0===e)return Promise.resolve(this.extensions[t.KHR_BINARY_GLTF].body);var i=this.options;return new Promise(function(e,t){r.load(E(n.uri,i.path),e,void 0,function(){t(new Error('THREE.GLTFLoader: Failed to load buffer "'+n.uri+'".'))})})},B.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){var n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})},B.prototype.loadAccessor=function(e){var t=this,n=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse)return null;var a=[];return void 0!==i.bufferView?a.push(this.getDependency("bufferView",i.bufferView)):a.push(null),void 0!==i.sparse&&(a.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),a.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(a).then(function(e){var a,s,o=e[0],l=y[i.type],u=S[i.componentType],c=u.BYTES_PER_ELEMENT,f=c*l,d=i.byteOffset||0,p=n.bufferViews[i.bufferView].byteStride,h=!0===i.normalized;if(p&&p!==f){var m="InterleavedBuffer:"+i.bufferView+":"+i.componentType,g=t.cache.get(m);g||(a=new u(o),g=new r.InterleavedBuffer(a,p/c),t.cache.add(m,g)),s=new r.InterleavedBufferAttribute(g,l,d/c,h)}else a=null===o?new u(i.count*l):new u(o,d,i.count*l),s=new r.BufferAttribute(a,l,h);if(void 0!==i.sparse){var v=y.SCALAR,_=S[i.sparse.indices.componentType],M=i.sparse.indices.byteOffset||0,b=i.sparse.values.byteOffset||0,L=new _(e[1],M,i.sparse.count*v),T=new u(e[2],b,i.sparse.count*l);null!==o&&s.setArray(s.array.slice());for(var x=0,R=L.length;x<R;x++){var w=L[x];if(s.setX(w,T[x*l]),l>=2&&s.setY(w,T[x*l+1]),l>=3&&s.setZ(w,T[x*l+2]),l>=4&&s.setW(w,T[x*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return s})},B.prototype.loadTexture=function(e){var n,i=this,a=this.json,s=this.options,o=this.textureLoader,l=window.URL||window.webkitURL,u=a.textures[e],c=u.extensions||{},f=(n=c[t.MSFT_TEXTURE_DDS]?a.images[c[t.MSFT_TEXTURE_DDS].source]:a.images[u.source]).uri,d=!1;return void 0!==n.bufferView&&(f=i.getDependency("bufferView",n.bufferView).then(function(e){d=!0;var t=new Blob([e],{type:n.mimeType});return f=l.createObjectURL(t)})),Promise.resolve(f).then(function(e){var n=r.Loader.Handlers.get(e);return n||(n=c[t.MSFT_TEXTURE_DDS]?i.extensions[t.MSFT_TEXTURE_DDS].ddsLoader:o),new Promise(function(t,r){n.load(E(e,s.path),t,void 0,r)})}).then(function(e){!0===d&&l.revokeObjectURL(f),e.flipY=!1,void 0!==u.name&&(e.name=u.name);var t=(a.samplers||{})[u.sampler]||{};return e.magFilter=M[t.magFilter]||r.LinearFilter,e.minFilter=M[t.minFilter]||r.LinearMipMapLinearFilter,e.wrapS=b[t.wrapS]||r.RepeatWrapping,e.wrapT=b[t.wrapT]||r.RepeatWrapping,e})},B.prototype.assignTexture=function(e,t,n){return this.getDependency("texture",n).then(function(n){e[t]=n})},B.prototype.loadMaterial=function(e){this.json;var n,i=this.extensions,a=this.json.materials[e],s={},o=a.extensions||{},l=[];if(o[t.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var u=i[t.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];n=u.getMaterialType(a),l.push(u.extendParams(s,a,this))}else if(o[t.KHR_MATERIALS_UNLIT]){var c=i[t.KHR_MATERIALS_UNLIT];n=c.getMaterialType(a),l.push(c.extendParams(s,a,this))}else{n=r.MeshStandardMaterial;var f=a.pbrMetallicRoughness||{};if(s.color=new r.Color(1,1,1),s.opacity=1,Array.isArray(f.baseColorFactor)){var d=f.baseColorFactor;s.color.fromArray(d),s.opacity=d[3]}if(void 0!==f.baseColorTexture&&l.push(this.assignTexture(s,"map",f.baseColorTexture.index)),s.metalness=void 0!==f.metallicFactor?f.metallicFactor:1,s.roughness=void 0!==f.roughnessFactor?f.roughnessFactor:1,void 0!==f.metallicRoughnessTexture){var p=f.metallicRoughnessTexture.index;l.push(this.assignTexture(s,"metalnessMap",p)),l.push(this.assignTexture(s,"roughnessMap",p))}}!0===a.doubleSided&&(s.side=r.DoubleSide);var h=a.alphaMode||R;return h===A?s.transparent=!0:(s.transparent=!1,h===w&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&n!==r.MeshBasicMaterial&&(l.push(this.assignTexture(s,"normalMap",a.normalTexture.index)),s.normalScale=new r.Vector2(1,1),void 0!==a.normalTexture.scale&&s.normalScale.set(a.normalTexture.scale,a.normalTexture.scale)),void 0!==a.occlusionTexture&&n!==r.MeshBasicMaterial&&(l.push(this.assignTexture(s,"aoMap",a.occlusionTexture.index)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&n!==r.MeshBasicMaterial&&(s.emissive=(new r.Color).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&n!==r.MeshBasicMaterial&&l.push(this.assignTexture(s,"emissiveMap",a.emissiveTexture.index)),Promise.all(l).then(function(){var e;return e=n===r.ShaderMaterial?i[t.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new n(s),void 0!==a.name&&(e.name=a.name),e.normalScale&&(e.normalScale.y=-e.normalScale.y),e.map&&(e.map.encoding=r.sRGBEncoding),e.emissiveMap&&(e.emissiveMap.encoding=r.sRGBEncoding),e.specularMap&&(e.specularMap.encoding=r.sRGBEncoding),P(e,a),a.extensions&&C(i,e,a),e})},B.prototype.loadGeometries=function(e){var n,i=this,a=this.extensions,s=this.primitiveCache,o=function(e){if(e.length<2)return!1;var t=e[0],n=t.targets||[];if(void 0===t.indices)return!1;for(var r=1,i=e.length;r<i;r++){var a=e[r];if(t.mode!==a.mode)return!1;if(void 0===a.indices)return!1;if(!I(t.attributes,a.attributes))return!1;var s=a.targets||[];if(n.length!==s.length)return!1;for(var o=0,l=n.length;o<l;o++)if(!I(n[o],s[o]))return!1}return!0}(e);return o&&(n=e,e=[e[0]]),this.getDependencies("accessor").then(function(l){for(var u=[],c=0,f=e.length;c<f;c++){var d=e[c],p=G(s,d);if(p)u.push(p);else if(d.extensions&&d.extensions[t.KHR_DRACO_MESH_COMPRESSION]){var h=a[t.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(d,i).then(function(e){return N(e,d,l),e});s.push({primitive:d,promise:h}),u.push(h)}else{var m=new r.BufferGeometry;N(m,d,l);h=Promise.resolve(m);s.push({primitive:d,promise:h}),u.push(h)}}return Promise.all(u).then(function(t){if(o){var a=t[0];if(null!==(_=function(e,t,n){for(var r=0,i=e.length;r<i;r++){var a=e[r];if(t===a.baseGeometry&&F(n,a.primitives))return a.geometry}return null}(v=i.multiPassGeometryCache,a,n)))return[_.geometry];var s=new r.BufferGeometry;for(var u in s.name=a.name,s.userData=a.userData,a.attributes)s.addAttribute(u,a.attributes[u]);for(var u in a.morphAttributes)s.morphAttributes[u]=a.morphAttributes[u];for(var c=[],f=0,d=0,p=n.length;d<p;d++){for(var h=l[n[d].indices],m=0,g=h.count;m<g;m++)c.push(h.array[m]);s.addGroup(f,h.count,d),f+=h.count}return s.setIndex(c),v.push({geometry:s,baseGeometry:a,primitives:n}),[s]}if(t.length>1&&void 0!==r.BufferGeometryUtils){for(d=1,p=e.length;d<p;d++)if(e[0].mode!==e[d].mode)return t;var v,_;if(_=function(e,t){for(var n=0,r=e.length;n<r;n++){var i=e[n];if(F(t,i.baseGeometries))return i.geometry}return null}(v=i.multiplePrimitivesCache,t)){if(null!==_.geometry)return[_.geometry]}else{s=r.BufferGeometryUtils.mergeBufferGeometries(t,!0);if(v.push({geometry:s,baseGeometries:t}),null!==s)return[s]}}return t})})},B.prototype.loadMesh=function(e){var n=this,i=(this.json,this.extensions),a=this.json.meshes[e];return this.getMultiDependencies(["accessor","material"]).then(function(s){for(var o=a.primitives,l=[],u=0,c=o.length;u<c;u++)l[u]=void 0===o[u].material?new r.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide}):s.materials[o[u].material];return n.loadGeometries(o).then(function(s){for(var u=1===s.length&&s[0].groups.length>0,c=[],f=0,S=s.length;f<S;f++){var M,b=s[f],y=o[f],L=u?l:l[f];if(y.mode===g||y.mode===v||y.mode===_||void 0===y.mode)M=!0===a.isSkinnedMesh?new r.SkinnedMesh(b,L):new r.Mesh(b,L),y.mode===v?M.drawMode=r.TriangleStripDrawMode:y.mode===_&&(M.drawMode=r.TriangleFanDrawMode);else if(y.mode===p)M=new r.LineSegments(b,L);else if(y.mode===m)M=new r.Line(b,L);else if(y.mode===h)M=new r.LineLoop(b,L);else{if(y.mode!==d)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+y.mode);M=new r.Points(b,L)}Object.keys(M.geometry.morphAttributes).length>0&&O(M,a),M.name=a.name||"mesh_"+e,s.length>1&&(M.name+="_"+f),P(M,a),c.push(M);for(var T=u?M.material:[M.material],x=void 0!==b.attributes.color,R=void 0===b.attributes.normal,w=!0===M.isSkinnedMesh,A=Object.keys(b.morphAttributes).length>0,E=A&&void 0!==b.morphAttributes.normal,C=0,D=T.length;C<D;C++){L=T[C];if(M.isPoints){var I="PointsMaterial:"+L.uuid,F=n.cache.get(I);F||(F=new r.PointsMaterial,r.Material.prototype.copy.call(F,L),F.color.copy(L.color),F.map=L.map,F.lights=!1,n.cache.add(I,F)),L=F}else if(M.isLine){I="LineBasicMaterial:"+L.uuid;var G=n.cache.get(I);G||(G=new r.LineBasicMaterial,r.Material.prototype.copy.call(G,L),G.color.copy(L.color),G.lights=!1,n.cache.add(I,G)),L=G}if(x||R||w||A){I="ClonedMaterial:"+L.uuid+":";L.isGLTFSpecularGlossinessMaterial&&(I+="specular-glossiness:"),w&&(I+="skinning:"),x&&(I+="vertex-colors:"),R&&(I+="flat-shading:"),A&&(I+="morph-targets:"),E&&(I+="morph-normals:");var U=n.cache.get(I);U||(U=L.isGLTFSpecularGlossinessMaterial?i[t.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].cloneMaterial(L):L.clone(),w&&(U.skinning=!0),x&&(U.vertexColors=r.VertexColors),R&&(U.flatShading=!0),A&&(U.morphTargets=!0),E&&(U.morphNormals=!0),n.cache.add(I,U)),L=U}T[C]=L,L.aoMap&&void 0===b.attributes.uv2&&void 0!==b.attributes.uv&&(console.log("THREE.GLTFLoader: Duplicating UVs to support aoMap."),b.addAttribute("uv2",new r.BufferAttribute(b.attributes.uv.array,2))),L.isGLTFSpecularGlossinessMaterial&&(M.onBeforeRender=i[t.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].refreshUniforms)}M.material=u?T:T[0]}if(1===c.length)return c[0];var B=new r.Group;for(f=0,S=c.length;f<S;f++)B.add(c[f]);return B})})},B.prototype.loadCamera=function(e){var t,n=this.json.cameras[e],i=n[n.type];if(i)return"perspective"===n.type?t=new r.PerspectiveCamera(r.Math.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(t=new r.OrthographicCamera(i.xmag/-2,i.xmag/2,i.ymag/2,i.ymag/-2,i.znear,i.zfar)),void 0!==n.name&&(t.name=n.name),P(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")},B.prototype.loadSkin=function(e){var t=this.json.skins[e],n={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(n):this.getDependency("accessor",t.inverseBindMatrices).then(function(e){return n.inverseBindMatrices=e,n})},B.prototype.loadAnimation=function(e){this.json;var t=this.json.animations[e];return this.getMultiDependencies(["accessor","node"]).then(function(n){for(var i=[],a=0,s=t.channels.length;a<s;a++){var o=t.channels[a],l=t.samplers[o.sampler];if(l){var u=o.target,c=void 0!==u.node?u.node:u.id,d=void 0!==t.parameters?t.parameters[l.input]:l.input,p=void 0!==t.parameters?t.parameters[l.output]:l.output,h=n.accessors[d],m=n.accessors[p],g=n.nodes[c];if(g){var v;switch(g.updateMatrix(),g.matrixAutoUpdate=!0,T[u.path]){case T.weights:v=r.NumberKeyframeTrack;break;case T.rotation:v=r.QuaternionKeyframeTrack;break;case T.position:case T.scale:default:v=r.VectorKeyframeTrack}var _=g.name?g.name:g.uuid,S=void 0!==l.interpolation?x[l.interpolation]:r.InterpolateLinear,M=[];T[u.path]===T.weights?g.traverse(function(e){!0===e.isMesh&&e.morphTargetInfluences&&M.push(e.name?e.name:e.uuid)}):M.push(_);for(var b=0,y=M.length;b<y;b++){var L=new v(M[b]+"."+T[u.path],r.AnimationUtils.arraySlice(h.array,0),r.AnimationUtils.arraySlice(m.array,0),S);"CUBICSPLINE"===l.interpolation&&(L.createInterpolant=function(e){return new f(this.times,this.values,this.getValueSize()/3,e)},L.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),i.push(L)}}}}c=void 0!==t.name?t.name:"animation_"+e;return new r.AnimationClip(c,void 0,i)})},B.prototype.loadNode=function(e){this.json;var n=this.extensions,i=this.json.meshReferences,a=this.json.meshUses,s=this.json.nodes[e];return this.getMultiDependencies(["mesh","skin","camera","light"]).then(function(e){var o;if(!0===s.isBone)o=new r.Bone;else if(void 0!==s.mesh){var l=e.meshes[s.mesh];if(i[s.mesh]>1){var u=a[s.mesh]++;(o=l.clone()).name+="_instance_"+u,o.onBeforeRender=l.onBeforeRender;for(var c=0,f=o.children.length;c<f;c++)o.children[c].name+="_instance_"+u,o.children[c].onBeforeRender=l.children[c].onBeforeRender}else o=l}else if(void 0!==s.camera)o=e.cameras[s.camera];else if(s.extensions&&s.extensions[t.KHR_LIGHTS_PUNCTUAL]&&void 0!==s.extensions[t.KHR_LIGHTS_PUNCTUAL].light){o=n[t.KHR_LIGHTS_PUNCTUAL].lights[s.extensions[t.KHR_LIGHTS_PUNCTUAL].light]}else o=new r.Object3D;if(void 0!==s.name&&(o.name=r.PropertyBinding.sanitizeNodeName(s.name)),P(o,s),s.extensions&&C(n,o,s),void 0!==s.matrix){var d=new r.Matrix4;d.fromArray(s.matrix),o.applyMatrix(d)}else void 0!==s.translation&&o.position.fromArray(s.translation),void 0!==s.rotation&&o.quaternion.fromArray(s.rotation),void 0!==s.scale&&o.scale.fromArray(s.scale);return o})},B.prototype.loadScene=function(){function e(t,n,i,a,s){var o=a[t],l=i.nodes[t];if(void 0!==l.skin)for(var u=!0===o.isGroup?o.children:[o],c=0,f=u.length;c<f;c++){for(var d=u[c],p=s[l.skin],h=[],m=[],g=0,v=p.joints.length;g<v;g++){var _=p.joints[g],S=a[_];if(S){h.push(S);var M=new r.Matrix4;void 0!==p.inverseBindMatrices&&M.fromArray(p.inverseBindMatrices.array,16*g),m.push(M)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',_)}d.bind(new r.Skeleton(h,m),d.matrixWorld)}if(n.add(o),l.children){var b=l.children;for(c=0,f=b.length;c<f;c++){e(b[c],o,i,a,s)}}}return function(t){var n=this.json,i=this.extensions,a=this.json.scenes[t];return this.getMultiDependencies(["node","skin"]).then(function(t){var s=new r.Scene;void 0!==a.name&&(s.name=a.name),P(s,a),a.extensions&&C(i,s,a);for(var o=a.nodes||[],l=0,u=o.length;l<u;l++)e(o[l],s,n,t.nodes,t.skins);return s})}}(),e}();e.exports=i},function(e,t,n){"use strict";n.r(t);var r=n(0),i=n(1),a=n.n(i),s=n(2),o=n.n(s),l=n(3),u=n.n(l),c=n(4),f=n.n(c);Object.assign(r.ShaderChunk,{mtoon_uniforms:u.a,lights_mtoon_pars_fragment:a.a});const d=new Map([["VRM/UnlitTexture",{defines:{},uniforms:Object.assign({},r.ShaderLib.basic.uniforms,{f_Cutoff:{value:0},v_Color:{value:new r.Vector4(1,1,1,1)}}),vertexShader:r.ShaderLib.basic.vertexShader,fragmentShader:r.ShaderLib.basic.fragmentShader,lights:!1}],["VRM/UnlitCutout",{defines:{},uniforms:Object.assign({},r.ShaderLib.basic.uniforms,{f_Cutoff:{value:0},v_Color:{value:new r.Vector4(1,1,1,1)}}),vertexShader:r.ShaderLib.basic.vertexShader,fragmentShader:r.ShaderLib.basic.fragmentShader,lights:!1}],["VRM/UnlitTransparent",{defines:{},uniforms:Object.assign({},r.ShaderLib.basic.uniforms,{f_Cutoff:{value:0},v_Color:{value:new r.Vector4(1,1,1,1)}}),vertexShader:r.ShaderLib.basic.vertexShader,fragmentShader:r.ShaderLib.basic.fragmentShader,lights:!1}],["VRM/UnlitTransparentZWrite",{defines:{},uniforms:Object.assign({},r.ShaderLib.basic.uniforms,{f_Cutoff:{value:0},v_Color:{value:new r.Vector4(1,1,1,1)}}),vertexShader:r.ShaderLib.basic.vertexShader,fragmentShader:r.ShaderLib.basic.fragmentShader,lights:!1}],["VRM/MToon",{defines:{},uniforms:Object.assign({},r.ShaderLib.phong.uniforms,{f_Cutoff:{value:0},v_Color:{value:new r.Vector4(1,1,1,1)}}),vertexShader:f.a,fragmentShader:o.a,lights:!0}]]),p=new Map([["common",e=>{e.uniforms.f_Cutoff&&(e.defines.ALPHATEST=e.uniforms.f_Cutoff.value.toFixed(6));const t=e.uniforms.v_Color.value;e.uniforms.diffuse={value:new r.Color(t.x,t.y,t.z)},e.uniforms.opacity={value:t.w},e.uniforms.t_MainTex&&(e.map=e.uniforms.t_MainTex.value,e.uniforms.map=e.uniforms.t_MainTex)}],["VRM/UnlitTexture",e=>null],["VRM/UnlitCutout",e=>null],["VRM/UnlitTransparent",e=>{e.transparent=!0}],["VRM/UnlitTransparentZWrite",e=>{e.transparent=!0}],["VRM/MToon",e=>{switch(e.uniforms.shininess={value:0},e.userData.RenderType){case"Opaque":e.defines.ALPHATEST=0;break;case"Cutout":break;case"Transparent":e.defines.ALPHATEST=0,e.transparent=!0;break;case"TransparentCutout":e.transparent=!0}if(e.uniforms.f_BumpScale&&(e.bumpScale=e.uniforms.f_BumpScale.value),e.uniforms.t_BumpMap&&(e.bumpMap=e.uniforms.t_BumpMap.value),e.uniforms.v_EmissionColor&&(e.emissive=e.uniforms.v_EmissionColor.value),e.uniforms.t_EmissionMap&&(e.emissiveMap=e.uniforms.t_EmissionMap.value),e.uniforms.f_CullMode)switch(e.uniforms.f_CullMode.value){case 0:e.side=r.FrontSide;break;case 1:e.side=r.BackSide;break;case 2:e.side=r.DoubleSide}}]]);class h extends r.ShaderMaterial{constructor(e){super(e),Object.assign(this.uniforms,{v_Color:{value:new r.Vector4(1,0,1,1)}}),this.vertexShader=r.ShaderLib.basic.vertexShader,this.fragmentShader=r.ShaderLib.basic.fragmentShader,p.get("common")(this)}fromMaterialProperty(e){if(this.name=e.name,!d.has(e.shader)||!p.has(e.shader))return;const t=d.get(e.shader),n={},r={};for(const t of Object.keys(e.floatProperties))r["f"+t]={value:e.floatProperties[t]};for(const t of Object.keys(e.keywordMap))n[t]=e.keywordMap[t];for(const t of Object.keys(e.tagMap))this.userData[t]={value:e.tagMap[t]};for(const t of Object.keys(e.textureProperties))r["t"+t]={value:e.textureProperties[t]};for(const t of Object.keys(e.vectorProperties))r["v"+t]={value:e.vectorProperties[t]};Object.assign(this.defines,t.defines),Object.assign(this.defines,n),Object.assign(this.uniforms,t.uniforms),Object.assign(this.uniforms,r),this.vertexShader=t.vertexShader,this.fragmentShader=t.fragmentShader,this.lights=t.lights,p.get("common")(this),p.get(e.shader)(this)}}class m{}class g{}class v{}class _{}class S{}class M{}var b=function(e,t,n,r){return new(n||(n=Promise))(function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,o)}l((r=r.apply(e,t||[])).next())})};class y{constructor(){this.name="",this.shader="",this.renderQueue=2e3,this.floatProperties={},this.keywordMap={},this.tagMap={},this.textureProperties={},this.vectorProperties={}}fromObject(e,t){return b(this,void 0,void 0,function*(){this.name=e.name,this.shader=e.shader,this.renderQueue=e.renderQueue;for(const t of Object.keys(e.floatProperties))this.floatProperties[t]=Number(e.floatProperties[t]);for(const t of Object.keys(e.keywordMap))this.keywordMap[t]=e.keywordMap[t];for(const t of Object.keys(e.tagMap))this.tagMap[t]=e.tagMap[t];for(const n of Object.keys(e.textureProperties))this.textureProperties[n]=t?yield t.loadTexture(e.textureProperties[n]):null;for(const t of Object.keys(e.vectorProperties)){const n=e.vectorProperties[t];n.length=4,this.vectorProperties[t]=(new r.Vector4).fromArray(n)}})}}class L{}class T{}class x{}class R{}class w{}var A=function(e,t,n,r){return new(n||(n=Promise))(function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,o)}l((r=r.apply(e,t||[])).next())})};class E{}class C{}class P{constructor(){this.asset=new C,this.scene=new r.Scene,this.parser={},this.userData={},this.materialProperties=[],this.humanoid=new S,this.meta=new L,this.blendShapeMaster=new m,this.firstPerson=new v,this.secondaryAnimation=new T,this.meshes=[],this.blendShapeWeights=[]}fromGLTF(e){return A(this,void 0,void 0,function*(){this.asset=e.asset,this.scene=e.scene,this.parser=e.parser,this.userData=e.userData,this.materialProperties=[];for(const t of e.userData.gltfExtensions.VRM.materialProperties){const e=new y;yield e.fromObject(t,this.parser),this.materialProperties.push(e)}return this.humanoid=new S,Object.assign(this.humanoid,e.userData.gltfExtensions.VRM.humanoid),this.meta=new L,Object.assign(this.meta,e.userData.gltfExtensions.VRM.meta),this.blendShapeMaster=new m,Object.assign(this.blendShapeMaster,e.userData.gltfExtensions.VRM.blendShapeMaster),this.firstPerson=new v,Object.assign(this.firstPerson,e.userData.gltfExtensions.VRM.firstPerson),this.secondaryAnimation=new T,Object.assign(this.secondaryAnimation,e.userData.gltfExtensions.VRM.secondaryAnimation),this.scene.traverse(e=>{if(e instanceof r.Mesh){const t=e.geometry instanceof r.BufferGeometry&&!!e.geometry.morphAttributes.position;if(Array.isArray(e.material))for(let n=0;n<e.material.length;++n){const r=this.materialProperties.find(t=>t.name===e.material[n].name),i=new h({morphTargets:t,skinning:!0});i.fromMaterialProperty(r),e.material[n]=i}else{const n=this.materialProperties.find(t=>t.name===e.material.name),r=new h({morphTargets:t,skinning:!0});r.fromMaterialProperty(n),e.material=r}}}),this.meshes=this.parser.json.meshes.map(()=>[]),this.scene.traverse(e=>{if(e instanceof r.Mesh){const t=this.parser.json.nodes.find(t=>t.name===e.name);if(t&&void 0!==t.mesh)return void(this.meshes[t.mesh]=[e]);const n=e.name.lastIndexOf("_"),r=-1!==n?Number(e.name.substr(n+1)):0,i=-1===n||isNaN(r)?e.name:e.name.substr(0,n),a=this.parser.json.meshes.findIndex(e=>e.name===i);-1!==a&&(this.meshes[a][r]=e)}}),this.blendShapeWeights=new Array(this.blendShapeMaster.blendShapeGroups.length).fill(0),this})}getBlendShapeWeight(e){return this.blendShapeWeights[e]}setBlendShapeWeight(e,t){const n=this.blendShapeMaster.blendShapeGroups[e];n&&(n.binds.forEach(e=>{this.meshes[e.mesh].forEach(n=>{n.morphTargetInfluences&&(n.morphTargetInfluences[e.index]=t*(e.weight/100))})}),this.blendShapeWeights[e]=t)}}const O=n(5);class D{constructor(e){this.manager=e||r.DefaultLoadingManager,this.gltfLoader=new O(this.manager)}load(e,t,n,r){this.gltfLoader.load(e,e=>{(new P).fromGLTF(e).then(e=>{t(e)})},n,r)}setCrossOrigin(e){return this.gltfLoader.setCrossOrigin(e),this}setPath(e){return this.gltfLoader.setPath(e),this}setDRACOLoader(e){return this.gltfLoader.setDRACOLoader(e),this}}n.d(t,"GLTF",function(){return E}),n.d(t,"Asset",function(){return C}),n.d(t,"VRM",function(){return P}),n.d(t,"MaterialProperty",function(){return y}),n.d(t,"Humanoid",function(){return S}),n.d(t,"HumanBone",function(){return M}),n.d(t,"Meta",function(){return L}),n.d(t,"BlendShapeMaster",function(){return m}),n.d(t,"BlendShapeGroup",function(){return g}),n.d(t,"FirstPerson",function(){return v}),n.d(t,"MeshAnnotation",function(){return _}),n.d(t,"SecondaryAnimation",function(){return T}),n.d(t,"BoneGroup",function(){return x}),n.d(t,"ColliderGroup",function(){return R}),n.d(t,"Collider",function(){return w}),n.d(t,"VRMLoader",function(){return D})}]);
\No newline at end of file