@realsee/five 6.0.0-alpha.48 → 6.0.0-alpha.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/assets/search.js +1 -1
- package/docs/classes/five.AnimationFrameLoop.html +1 -1
- package/docs/classes/five.BVH.html +1 -1
- package/docs/classes/five.BVHIntersect.html +1 -1
- package/docs/classes/five.BVHNode.html +1 -1
- package/docs/classes/five.BVHVector3.html +1 -1
- package/docs/classes/five.BoxBoundingVolume.html +1 -1
- package/docs/classes/five.Camera.html +1 -1
- package/docs/classes/five.CullingVolume.html +1 -1
- package/docs/classes/five.Fetcher.html +1 -1
- package/docs/classes/five.Five.html +19 -19
- package/docs/classes/five.InternalWebGLRenderer.html +1 -1
- package/docs/classes/five.IntersectMesh.html +1 -1
- package/docs/classes/five.Model.html +19 -17
- package/docs/classes/five.NetworkAbortError.html +1 -1
- package/docs/classes/five.NetworkFirbiddenError.html +1 -1
- package/docs/classes/five.NetworkResponseError.html +1 -1
- package/docs/classes/five.NetworkSubscribe.html +1 -1
- package/docs/classes/five.NetworkTimeoutError.html +1 -1
- package/docs/classes/five.PBMContainer.html +1 -1
- package/docs/classes/five.PBMGroup.html +1 -1
- package/docs/classes/five.PBMMesh.html +1 -1
- package/docs/classes/five.PBMMeshMaterial.html +1 -1
- package/docs/classes/five.PanoCircleMesh.html +1 -1
- package/docs/classes/five.PanoCircleMeshCustom.html +1 -1
- package/docs/classes/five.PanoCircleMeshSolid.html +1 -1
- package/docs/classes/five.RegionBoundingVolume.html +1 -1
- package/docs/classes/five.RequestScheduler.html +1 -1
- package/docs/classes/five.Scene.html +1 -1
- package/docs/classes/five.SphereBoundingVolume.html +1 -1
- package/docs/classes/five.Subscribe.html +1 -1
- package/docs/classes/five.TextureLoader.html +1 -1
- package/docs/classes/five.Tile.html +1 -1
- package/docs/classes/five.Tile3DModel.html +1 -1
- package/docs/classes/five.TileCubeTextureTarget.html +1 -1
- package/docs/classes/five.TileNode.html +1 -1
- package/docs/classes/five.Tileset.html +1 -1
- package/docs/classes/five.TilesetCache.html +1 -1
- package/docs/classes/five.TilesetTraverser.html +1 -1
- package/docs/classes/five.Work.html +1 -1
- package/docs/classes/five.XRButton.html +1 -1
- package/docs/classes/gltf_loader.DDSLoader.html +1 -1
- package/docs/classes/gltf_loader.DRACOLoader.html +1 -1
- package/docs/classes/gltf_loader.GLTFLoader.html +1 -1
- package/docs/classes/gltf_loader.GLTFObject.html +1 -1
- package/docs/classes/gltf_loader.GLTFParser.html +1 -1
- package/docs/classes/gltf_loader.THREEGLTFLoader.html +1 -1
- package/docs/classes/line.Line.html +1 -1
- package/docs/classes/line.LineGeometry.html +1 -1
- package/docs/classes/line.LineMaterial.html +1 -1
- package/docs/classes/line.LineSegmentsGeometry.html +1 -1
- package/docs/classes/line.THREE_Line2.html +1 -1
- package/docs/classes/line.THREE_LineSegments2.html +1 -1
- package/docs/classes/react.Store.html +1 -1
- package/docs/classes/sticker.Sticker.html +1 -1
- package/docs/classes/vfx.Airflow.html +1 -1
- package/docs/classes/vfx.Flame.html +1 -1
- package/docs/classes/vfx.Particle.html +1 -1
- package/docs/classes/vfx.SpotLight.html +1 -1
- package/docs/enums/five.VolumePlaneIntersect.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/five.AddableObject.html +1 -1
- package/docs/interfaces/five.AjaxOptions.html +1 -1
- package/docs/interfaces/five.AnimationFrame.html +1 -1
- package/docs/interfaces/five.BaseEvent.html +1 -1
- package/docs/interfaces/five.BoundingVolume.html +1 -1
- package/docs/interfaces/five.CameraPose.html +1 -1
- package/docs/interfaces/five.ClipperParameter.html +1 -1
- package/docs/interfaces/five.DepthPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.EventCallback.html +13 -11
- package/docs/interfaces/five.FiveInitArgs.html +1 -1
- package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.GestureEvent.html +1 -1
- package/docs/interfaces/five.ImageOptions.html +1 -1
- package/docs/interfaces/five.ImageURLMappings.html +1 -1
- package/docs/interfaces/five.ImageURLOptions.html +1 -1
- package/docs/interfaces/five.IntersectEvent.html +1 -1
- package/docs/interfaces/five.IntersectMeshInterface.html +1 -1
- package/docs/interfaces/five.Intersection.html +1 -1
- package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +6 -6
- package/docs/interfaces/five.ModeChangeEvent.html +1 -1
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ModelEvent.html +1 -1
- package/docs/interfaces/five.ModelLodOptions.html +1 -1
- package/docs/interfaces/five.ModelsEvent.html +1 -1
- package/docs/interfaces/five.MotionKeyframe.html +1 -1
- package/docs/interfaces/five.MovePanoOptions.html +1 -1
- package/docs/interfaces/five.NetworkOptions.html +1 -1
- package/docs/interfaces/five.NetworkResourceEvent.html +1 -1
- package/docs/interfaces/five.ObjectEvent.html +1 -1
- package/docs/interfaces/five.PBMPanoPicture.html +1 -1
- package/docs/interfaces/five.PBMParameters.html +1 -1
- package/docs/interfaces/five.PanoCircleMeshCustomOptions.html +1 -1
- package/docs/interfaces/five.PanoCircleMeshInterface.html +1 -1
- package/docs/interfaces/five.PanoCircleMeshOptions.html +1 -1
- package/docs/interfaces/five.PanoCircleMeshSolidOptions.html +1 -1
- package/docs/interfaces/five.PanoEvent.html +1 -1
- package/docs/interfaces/five.PanoTextureEvent.html +1 -1
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.Pose.html +1 -1
- package/docs/interfaces/five.RenderEvent.html +1 -1
- package/docs/interfaces/five.Scissor.html +1 -1
- package/docs/interfaces/five.State.html +1 -1
- package/docs/interfaces/five.StateEvent.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.emit.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.hasListener.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.off.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.on.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.once.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.waitUnitl.html +1 -1
- package/docs/interfaces/five.TextureOptions.html +1 -1
- package/docs/interfaces/five.Tile3DModelLoaderOptions.html +2 -2
- package/docs/interfaces/five.TileCubeNode.html +1 -1
- package/docs/interfaces/five.TileCubeTree.html +1 -1
- package/docs/interfaces/five.TileHeader.html +1 -1
- package/docs/interfaces/five.TilesetHeader.html +1 -1
- package/docs/interfaces/five.TilesetOptions.html +1 -1
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.WebXRAxesParams.html +1 -1
- package/docs/interfaces/five.WebXRControllerParams.html +1 -1
- package/docs/interfaces/five.WorkCubeImage.html +1 -1
- package/docs/interfaces/five.WorkImage.html +1 -1
- package/docs/interfaces/five.WorkInitial.html +1 -1
- package/docs/interfaces/five.WorkModel.html +1 -1
- package/docs/interfaces/five.WorkObserver.html +1 -1
- package/docs/interfaces/five.WorkOptions.html +1 -1
- package/docs/interfaces/five.WorkResolvedObserver.html +1 -1
- package/docs/interfaces/five.WorkTile.html +1 -1
- package/docs/interfaces/five.WorkVideo.html +1 -1
- package/docs/interfaces/five.WorksEvent.html +1 -1
- package/docs/interfaces/five.XRControllerEvent.html +1 -1
- package/docs/interfaces/five.XRGestureEvent.html +1 -1
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.XRSessionEvent.html +1 -1
- package/docs/interfaces/gltf_loader.DDS.html +1 -1
- package/docs/interfaces/gltf_loader.GLTF.html +1 -1
- package/docs/interfaces/gltf_loader.GLTFReference.html +1 -1
- package/docs/interfaces/gltf_loader.THREEGLTF.html +1 -1
- package/docs/interfaces/react.FiveActionReactCallbacks.html +1 -1
- package/docs/interfaces/react.FiveInjectionTypes.html +4 -4
- package/docs/interfaces/react.PropTypeOfFiveFeatures.html +1 -1
- package/docs/interfaces/sticker.IntersectionLike.html +1 -1
- package/docs/interfaces/vfx.ParticleArgs.html +1 -1
- package/docs/interfaces/vfx.ParticleTweenKeyframe.html +1 -1
- package/docs/interfaces/vue.FiveActionVueCallbacks.html +1 -1
- package/docs/modules/five.SubscribeMixinType.html +1 -1
- package/docs/modules/five.html +4 -4
- package/docs/modules/gltf_loader.html +1 -1
- package/docs/modules/line.html +1 -1
- package/docs/modules/react.html +1 -1
- package/docs/modules/sticker.html +1 -1
- package/docs/modules/vfx.html +1 -1
- package/docs/modules/vue.html +1 -1
- package/docs/modules.html +1 -1
- package/five/index.d.ts +28 -7
- package/five/index.js +4 -4
- package/gltf-loader/index.js +3 -3
- package/line/index.js +3 -3
- package/package.json +1 -1
- package/react/index.js +2 -2
- package/sticker/index.js +3 -3
- package/umd/five-gltf-loader.js +1 -1
- package/umd/five-line.js +1 -1
- package/umd/five-sticker.js +1 -1
- package/umd/five.js +1 -1
- package/vfx/index.js +2 -2
- package/vue/index.js +2 -2
package/gltf-loader/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @realsee/five
|
|
3
3
|
*
|
|
4
|
-
* Generated: 2023-11-
|
|
5
|
-
* Version: 6.0.0-alpha.
|
|
4
|
+
* Generated: 2023-11-23
|
|
5
|
+
* Version: 6.0.0-alpha.49
|
|
6
6
|
*
|
|
7
7
|
* Terms:
|
|
8
8
|
* Realsee SDK License Agreement
|
|
@@ -257,4 +257,4 @@
|
|
|
257
257
|
* Agreement and all related documents shall be drafted in English.
|
|
258
258
|
*/
|
|
259
259
|
|
|
260
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");function t(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var r=t(e),a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},a(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){function t(t){e.Loader.call(this,t),this.dracoLoader=null,this.ddsLoader=null}function r(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}t.prototype=Object.assign(Object.create(e.Loader.prototype),{constructor:t,load:function(t,r,a,n){var s,o=this;s=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:e.LoaderUtils.extractUrlBase(t),o.manager.itemStart(t);var i=function(e){n?n(e):console.error(e),o.manager.itemError(t),o.manager.itemEnd(t)},c=new e.FileLoader(o.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),"use-credentials"===o.crossOrigin&&c.setWithCredentials(!0),c.load(t,(function(e){try{o.parse(e,s,(function(e){r(e),o.manager.itemEnd(t)}),i)}catch(e){i(e)}}),a,i)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(t,r,u,d){var m,y={};if("string"==typeof t)m=t;else if(e.LoaderUtils.decodeText(new Uint8Array(t,0,4))===l){try{y[a.KHR_BINARY_GLTF]=new p(t)}catch(e){return void(d&&d(e))}m=y[a.KHR_BINARY_GLTF].content}else m=e.LoaderUtils.decodeText(new Uint8Array(t));var T=JSON.parse(m);if(void 0===T.asset||T.asset.version[0]<2)d&&d(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{if(T.extensionsUsed)for(var M=0;M<T.extensionsUsed.length;++M){var A=T.extensionsUsed[M],R=T.extensionsRequired||[];switch(A){case a.KHR_LIGHTS_PUNCTUAL:y[A]=new s(T);break;case a.KHR_MATERIALS_CLEARCOAT:y[A]=new i;break;case a.KHR_MATERIALS_TRANSMISSION:y[A]=new c;break;case a.KHR_MATERIALS_UNLIT:y[A]=new o;break;case a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:y[A]=new g;break;case a.KHR_DRACO_MESH_COMPRESSION:y[A]=new h(T,this.dracoLoader);break;case a.MSFT_TEXTURE_DDS:y[A]=new n(this.ddsLoader);break;case a.KHR_TEXTURE_TRANSFORM:y[A]=new f;break;case a.KHR_MESH_QUANTIZATION:y[A]=new v;break;default:R.indexOf(A)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+A+'".')}}var S=new j(T,y,{path:r||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});S.fileLoader.setRequestHeader(this.requestHeader),S.parse(u,d)}}});var a={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function n(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=a.MSFT_TEXTURE_DDS,this.ddsLoader=e}function s(e){this.name=a.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[a.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function o(){this.name=a.KHR_MATERIALS_UNLIT}function i(){this.name=a.KHR_MATERIALS_CLEARCOAT}function c(){this.name=a.KHR_MATERIALS_TRANSMISSION}s.prototype.loadLight=function(t){var r,a=this.lightDefs[t],n=new e.Color(16777215);void 0!==a.color&&n.fromArray(a.color);var s=void 0!==a.range?a.range:0;switch(a.type){case"directional":(r=new e.DirectionalLight(n)).target.position.set(0,0,-1),r.add(r.target);break;case"point":(r=new e.PointLight(n)).distance=s;break;case"spot":(r=new e.SpotLight(n)).distance=s,a.spot=a.spot||{},a.spot.innerConeAngle=void 0!==a.spot.innerConeAngle?a.spot.innerConeAngle:0,a.spot.outerConeAngle=void 0!==a.spot.outerConeAngle?a.spot.outerConeAngle:Math.PI/4,r.angle=a.spot.outerConeAngle,r.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,r.target.position.set(0,0,-1),r.add(r.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+a.type+'".')}return r.position.set(0,0,0),r.decay=2,void 0!==a.intensity&&(r.intensity=a.intensity),r.name=a.name||"light_"+t,Promise.resolve(r)},o.prototype.getMaterialType=function(){return e.MeshBasicMaterial},o.prototype.extendParams=function(t,r,a){var n=[];t.color=new e.Color(1,1,1),t.opacity=1;var s=r.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){var o=s.baseColorFactor;t.color.fromArray(o),t.opacity=o[3]}void 0!==s.baseColorTexture&&n.push(a.assignTexture(t,"map",s.baseColorTexture))}return Promise.all(n)},i.prototype.getMaterialType=function(){return e.MeshPhysicalMaterial},i.prototype.extendParams=function(t,r,a){var n=[],s=r.extensions[this.name];if(void 0!==s.clearcoatFactor&&(t.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&n.push(a.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&n.push(a.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(n.push(a.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){var o=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new e.Vector2(o,o)}return Promise.all(n)},c.prototype.getMaterialType=function(){return e.MeshPhysicalMaterial},c.prototype.extendParams=function(e,t,r){var a=t.extensions[this.name];return void 0!==a.transmissionFactor&&(e.premultipliedAlpha=!0,e.transparent=!0,e.opacity=1,e.transparency=a.transmissionFactor,(e.map||e.color.r*e.color.g*e.color.b<.99)&&(e.transparency*=.75)),Promise.all([])};var l="glTF",u=12,d={JSON:1313821514,BIN:5130562};function p(t){this.name=a.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,u);if(this.header={magic:e.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==l)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var n=new DataView(t,u),s=0;s<n.byteLength;){var o=n.getUint32(s,!0);s+=4;var i=n.getUint32(s,!0);if(s+=4,i===d.JSON){var c=new Uint8Array(t,u+s,o);this.content=e.LoaderUtils.decodeText(c)}else if(i===d.BIN){var p=u+s;this.body=t.slice(p,p+o)}s+=o}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function h(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=a.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function f(){this.name=a.KHR_TEXTURE_TRANSFORM}function m(t){e.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var r=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),a=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),n=["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"),s=["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"),o=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),i={specular:{value:(new e.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=i,this.onBeforeCompile=function(e){for(var t in i)e.uniforms[t]=i[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;"),e.fragmentShader=e.fragmentShader.replace("uniform float metalness;","uniform float glossiness;"),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_pars_fragment>",r),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_pars_fragment>",a),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_fragment>",n),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_fragment>",s),e.fragmentShader=e.fragmentShader.replace("#include <lights_physical_fragment>",o)},Object.defineProperties(this,{specular:{get:function(){return i.specular.value},set:function(e){i.specular.value=e}},specularMap:{get:function(){return i.specularMap.value},set:function(e){i.specularMap.value=e}},glossiness:{get:function(){return i.glossiness.value},set:function(e){i.glossiness.value=e}},glossinessMap:{get:function(){return i.glossinessMap.value},set:function(e){i.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(t)}function g(){return{name:a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return m},extendParams:function(t,r,a){var n=r.extensions[this.name];t.color=new e.Color(1,1,1),t.opacity=1;var s=[];if(Array.isArray(n.diffuseFactor)){var o=n.diffuseFactor;t.color.fromArray(o),t.opacity=o[3]}if(void 0!==n.diffuseTexture&&s.push(a.assignTexture(t,"map",n.diffuseTexture)),t.emissive=new e.Color(0,0,0),t.glossiness=void 0!==n.glossinessFactor?n.glossinessFactor:1,t.specular=new e.Color(1,1,1),Array.isArray(n.specularFactor)&&t.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var i=n.specularGlossinessTexture;s.push(a.assignTexture(t,"glossinessMap",i)),s.push(a.assignTexture(t,"specularMap",i))}return Promise.all(s)},createMaterial:function(t){var r=new m(t);return r.fog=!0,r.color=t.color,r.map=void 0===t.map?null:t.map,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=void 0===t.aoMap?null:t.aoMap,r.aoMapIntensity=1,r.emissive=t.emissive,r.emissiveIntensity=1,r.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,r.bumpMap=void 0===t.bumpMap?null:t.bumpMap,r.bumpScale=1,r.normalMap=void 0===t.normalMap?null:t.normalMap,r.normalMapType=e.TangentSpaceNormalMap,t.normalScale&&(r.normalScale=t.normalScale),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=void 0===t.specularMap?null:t.specularMap,r.specular=t.specular,r.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,r.glossiness=t.glossiness,r.alphaMap=null,r.envMap=void 0===t.envMap?null:t.envMap,r.envMapIntensity=1,r.refractionRatio=.98,r}}}function v(){this.name=a.KHR_MESH_QUANTIZATION}function y(t,r,a,n){e.Interpolant.call(this,t,r,a,n)}h.prototype.decodePrimitive=function(e,t){var r=this.json,a=this.dracoLoader,n=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,o={},i={},c={};for(var l in s){var u=I[l]||l.toLowerCase();o[u]=s[l]}for(l in e.attributes){u=I[l]||l.toLowerCase();if(void 0!==s[l]){var d=r.accessors[e.attributes[l]],p=L[d.componentType];c[u]=p,i[u]=!0===d.normalized}}return t.getDependency("bufferView",n).then((function(e){return new Promise((function(t){a.decodeDracoFile(e,(function(e){for(var r in e.attributes){var a=e.attributes[r],n=i[r];void 0!==n&&(a.normalized=n)}t(e)}),o,c)}))}))},f.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},m.prototype=Object.create(e.MeshStandardMaterial.prototype),m.prototype.constructor=m,m.prototype.copy=function(t){return e.MeshStandardMaterial.prototype.copy.call(this,t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},y.prototype=Object.create(e.Interpolant.prototype),y.prototype.constructor=y,y.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,r=this.sampleValues,a=this.valueSize,n=e*a*3+a,s=0;s!==a;s++)t[s]=r[n+s];return t},y.prototype.beforeStart_=y.prototype.copySampleValue_,y.prototype.afterEnd_=y.prototype.copySampleValue_,y.prototype.interpolate_=function(e,t,r,a){for(var n=this.resultBuffer,s=this.sampleValues,o=this.valueSize,i=2*o,c=3*o,l=a-t,u=(r-t)/l,d=u*u,p=d*u,h=e*c,f=h-c,m=-2*p+3*d,g=p-d,v=1-m,y=g-d+u,T=0;T!==o;T++){var M=s[f+T+o],A=s[f+T+i]*l,R=s[h+T+o],S=s[h+T]*l;n[T]=v*M+y*A+m*R+g*S}return n};var T=0,M=1,A=2,R=3,S=4,b=5,w=6,L={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},_={9728:e.NearestFilter,9729:e.LinearFilter,9984:e.NearestMipmapNearestFilter,9985:e.LinearMipmapNearestFilter,9986:e.NearestMipmapLinearFilter,9987:e.LinearMipmapLinearFilter},E={33071:e.ClampToEdgeWrapping,33648:e.MirroredRepeatWrapping,10497:e.RepeatWrapping},x={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},I={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},C={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},D={CUBICSPLINE:void 0,LINEAR:e.InterpolateLinear,STEP:e.InterpolateDiscrete},P="OPAQUE",O="MASK",U="BLEND",F={"image/png":e.RGBAFormat,"image/jpeg":e.RGBFormat};function k(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function H(e,t,r){for(var a in r.extensions)void 0===e[a]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[a]=r.extensions[a])}function N(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function G(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var r=0,a=t.weights.length;r<a;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){var n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(r=0,a=n.length;r<a;r++)e.morphTargetDictionary[n[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function B(e){for(var t="",r=Object.keys(e).sort(),a=0,n=r.length;a<n;a++)t+=r[a]+":"+e[r[a]]+";";return t}function j(t,a,n){this.json=t||{},this.extensions=a||{},this.options=n||{},this.cache=new r,this.associations=new Map,this.primitiveCache={},this.textureLoader=new e.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new e.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function K(t,r,a){var n=r.attributes,s=[];function o(e,r){return a.getDependency("accessor",e).then((function(e){t.setAttribute(r,e)}))}for(var i in n){var c=I[i]||i.toLowerCase();c in t.attributes||s.push(o(n[i],c))}if(void 0!==r.indices&&!t.index){var l=a.getDependency("accessor",r.indices).then((function(e){t.setIndex(e)}));s.push(l)}return N(t,r),function(t,r,a){var n=r.attributes,s=new e.Box3;if(void 0!==n.POSITION){var o=(h=a.json.accessors[n.POSITION]).min,i=h.max;if(void 0!==o&&void 0!==i){s.set(new e.Vector3(o[0],o[1],o[2]),new e.Vector3(i[0],i[1],i[2]));var c=r.targets;if(void 0!==c){for(var l=new e.Vector3,u=new e.Vector3,d=0,p=c.length;d<p;d++){var h,f=c[d];if(void 0!==f.POSITION)o=(h=a.json.accessors[f.POSITION]).min,i=h.max,void 0!==o&&void 0!==i?(u.setX(Math.max(Math.abs(o[0]),Math.abs(i[0]))),u.setY(Math.max(Math.abs(o[1]),Math.abs(i[1]))),u.setZ(Math.max(Math.abs(o[2]),Math.abs(i[2]))),l.max(u)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}s.expandByVector(l)}t.boundingBox=s;var m=new e.Sphere;s.getCenter(m.center),m.radius=s.min.distanceTo(s.max)/2,t.boundingSphere=m}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,r,a),Promise.all(s).then((function(){return void 0!==r.targets?function(e,t,r){for(var a=!1,n=!1,s=0,o=t.length;s<o&&(void 0!==(l=t[s]).POSITION&&(a=!0),void 0!==l.NORMAL&&(n=!0),!a||!n);s++);if(!a&&!n)return Promise.resolve(e);var i=[],c=[];for(s=0,o=t.length;s<o;s++){var l=t[s];if(a){var u=void 0!==l.POSITION?r.getDependency("accessor",l.POSITION):e.attributes.position;i.push(u)}n&&(u=void 0!==l.NORMAL?r.getDependency("accessor",l.NORMAL):e.attributes.normal,c.push(u))}return Promise.all([Promise.all(i),Promise.all(c)]).then((function(t){var r=t[0],s=t[1];return a&&(e.morphAttributes.position=r),n&&(e.morphAttributes.normal=s),e.morphTargetsRelative=!0,e}))}(t,r.targets,a):t}))}function V(t,r){var a=t.getIndex();if(null===a){var n=[],s=t.getAttribute("position");if(void 0===s)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var o=0;o<s.count;o++)n.push(o);t.setIndex(n),a=t.getIndex()}var i=a.count-2,c=[];if(r===e.TriangleFanDrawMode)for(o=1;o<=i;o++)c.push(a.getX(0)),c.push(a.getX(o)),c.push(a.getX(o+1));else for(o=0;o<i;o++)o%2==0?(c.push(a.getX(o)),c.push(a.getX(o+1)),c.push(a.getX(o+2))):(c.push(a.getX(o+2)),c.push(a.getX(o+1)),c.push(a.getX(o)));c.length/3!==i&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var l=t.clone();return l.setIndex(c),l}return j.prototype.parse=function(e,t){var r=this,a=this.json,n=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var s={scene:t[0][a.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:a.asset,parser:r,userData:{}};H(n,s,a),N(s,a),e(s)})).catch(t)},j.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],a={},n={},s=0,o=t.length;s<o;s++)for(var i=t[s].joints,c=0,l=i.length;c<l;c++)e[i[c]].isBone=!0;for(var u=0,d=e.length;u<d;u++){var p=e[u];void 0!==p.mesh&&(void 0===a[p.mesh]&&(a[p.mesh]=n[p.mesh]=0),a[p.mesh]++,void 0!==p.skin&&(r[p.mesh].isSkinnedMesh=!0))}this.json.meshReferences=a,this.json.meshUses=n},j.prototype.getDependency=function(e,t){var r=e+":"+t,n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this.loadNode(t);break;case"mesh":n=this.loadMesh(t);break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this.loadBufferView(t);break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this.loadMaterial(t);break;case"texture":n=this.loadTexture(t);break;case"skin":n=this.loadSkin(t);break;case"animation":n=this.loadAnimation(t);break;case"camera":n=this.loadCamera(t);break;case"light":n=this.extensions[a.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,n)}return n},j.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var r=this,a=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(a.map((function(t,a){return r.getDependency(e,a)}))),this.cache.add(e,t)}return t},j.prototype.loadBuffer=function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[a.KHR_BINARY_GLTF].body);var n=this.options;return new Promise((function(e,a){r.load(k(t.uri,n.path),e,void 0,(function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},j.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,a=t.byteOffset||0;return e.slice(a,a+r)}))},j.prototype.loadAccessor=function(t){var r=this,a=this.json,n=this.json.accessors[t];if(void 0===n.bufferView&&void 0===n.sparse)return Promise.resolve(null);var s=[];return void 0!==n.bufferView?s.push(this.getDependency("bufferView",n.bufferView)):s.push(null),void 0!==n.sparse&&(s.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(s).then((function(t){var s,o,i=t[0],c=x[n.type],l=L[n.componentType],u=l.BYTES_PER_ELEMENT,d=u*c,p=n.byteOffset||0,h=void 0!==n.bufferView?a.bufferViews[n.bufferView].byteStride:void 0,f=!0===n.normalized;if(h&&h!==d){var m=Math.floor(p/h),g="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+m+":"+n.count,v=r.cache.get(g);v||(s=new l(i,m*h,n.count*h/u),v=new e.InterleavedBuffer(s,h/u),r.cache.add(g,v)),o=new e.InterleavedBufferAttribute(v,c,p%h/u,f)}else s=null===i?new l(n.count*c):new l(i,p,n.count*c),o=new e.BufferAttribute(s,c,f);if(void 0!==n.sparse){var y=x.SCALAR,T=L[n.sparse.indices.componentType],M=n.sparse.indices.byteOffset||0,A=n.sparse.values.byteOffset||0,R=new T(t[1],M,n.sparse.count*y),S=new l(t[2],A,n.sparse.count*c);null!==i&&(o=new e.BufferAttribute(o.array.slice(),o.itemSize,o.normalized));for(var b=0,w=R.length;b<w;b++){var _=R[b];if(o.setX(_,S[b*c]),c>=2&&o.setY(_,S[b*c+1]),c>=3&&o.setZ(_,S[b*c+2]),c>=4&&o.setW(_,S[b*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o}))},j.prototype.loadTexture=function(t){var r,n=this,s=this.json,o=this.options,i=this.textureLoader,c=self.URL||self.webkitURL,l=s.textures[t],u=l.extensions||{},d=(r=u[a.MSFT_TEXTURE_DDS]?s.images[u[a.MSFT_TEXTURE_DDS].source]:s.images[l.source]).uri,p=!1;return void 0!==r.bufferView&&(d=n.getDependency("bufferView",r.bufferView).then((function(e){p=!0;var t=new Blob([e],{type:r.mimeType});return d=c.createObjectURL(t)}))),Promise.resolve(d).then((function(e){var t=o.manager.getHandler(e);return t||(t=u[a.MSFT_TEXTURE_DDS]?n.extensions[a.MSFT_TEXTURE_DDS].ddsLoader:i),new Promise((function(r,a){t.load(k(e,o.path),r,void 0,a)}))})).then((function(a){!0===p&&c.revokeObjectURL(d),a.flipY=!1,l.name&&(a.name=l.name),r.mimeType in F&&(a.format=F[r.mimeType]);var o=(s.samplers||{})[l.sampler]||{};return a.magFilter=_[o.magFilter]||e.LinearFilter,a.minFilter=_[o.minFilter]||e.LinearMipmapLinearFilter,a.wrapS=E[o.wrapS]||e.RepeatWrapping,a.wrapT=E[o.wrapT]||e.RepeatWrapping,n.associations.set(a,{type:"textures",index:t}),a}))},j.prototype.assignTexture=function(t,r,n){var s=this;return this.getDependency("texture",n.index).then((function(o){if(!o.isCompressedTexture)switch(r){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":o.format=e.RGBFormat}if(void 0===n.texCoord||0==n.texCoord||"aoMap"===r&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+r+" not yet supported."),s.extensions[a.KHR_TEXTURE_TRANSFORM]){var i=void 0!==n.extensions?n.extensions[a.KHR_TEXTURE_TRANSFORM]:void 0;if(i){var c=this.associations.get(o);o=s.extensions[a.KHR_TEXTURE_TRANSFORM].extendTexture(o,i),this.associations.set(o,c)}}t[r]=o}))},j.prototype.assignFinalMaterial=function(t){var r=t.geometry,a=t.material,n=void 0!==r.attributes.tangent,s=void 0!==r.attributes.color,o=void 0===r.attributes.normal,i=!0===t.isSkinnedMesh,c=Object.keys(r.morphAttributes).length>0,l=c&&void 0!==r.morphAttributes.normal;if(t.isPoints){var u="PointsMaterial:"+a.uuid,d=this.cache.get(u);d||(d=new e.PointsMaterial,e.Material.prototype.copy.call(d,a),d.color.copy(a.color),d.map=a.map,d.sizeAttenuation=!1,this.cache.add(u,d)),a=d}else if(t.isLine){u="LineBasicMaterial:"+a.uuid;var p=this.cache.get(u);p||(p=new e.LineBasicMaterial,e.Material.prototype.copy.call(p,a),p.color.copy(a.color),this.cache.add(u,p)),a=p}if(n||s||o||i||c){u="ClonedMaterial:"+a.uuid+":";a.isGLTFSpecularGlossinessMaterial&&(u+="specular-glossiness:"),i&&(u+="skinning:"),n&&(u+="vertex-tangents:"),s&&(u+="vertex-colors:"),o&&(u+="flat-shading:"),c&&(u+="morph-targets:"),l&&(u+="morph-normals:");var h=this.cache.get(u);h||(h=a.clone(),i&&(h.skinning=!0),n&&(h.vertexTangents=!0),s&&(h.vertexColors=!0),o&&(h.flatShading=!0),c&&(h.morphTargets=!0),l&&(h.morphNormals=!0),this.cache.add(u,h),this.associations.set(h,this.associations.get(a))),a=h}a.aoMap&&void 0===r.attributes.uv2&&void 0!==r.attributes.uv&&r.setAttribute("uv2",r.attributes.uv),a.normalScale&&!n&&(a.normalScale.y=-a.normalScale.y),a.clearcoatNormalScale&&!n&&(a.clearcoatNormalScale.y=-a.clearcoatNormalScale.y),t.material=a},j.prototype.loadMaterial=function(t){var r,n=this,s=this.json,o=this.extensions,i=s.materials[t],c={},l=i.extensions||{},u=[];if(l[a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var d=o[a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];r=d.getMaterialType(),u.push(d.extendParams(c,i,n))}else if(l[a.KHR_MATERIALS_UNLIT]){var p=o[a.KHR_MATERIALS_UNLIT];r=p.getMaterialType(),u.push(p.extendParams(c,i,n))}else{r=e.MeshStandardMaterial;var h=i.pbrMetallicRoughness||{};if(c.color=new e.Color(1,1,1),c.opacity=1,Array.isArray(h.baseColorFactor)){var f=h.baseColorFactor;c.color.fromArray(f),c.opacity=f[3]}void 0!==h.baseColorTexture&&u.push(n.assignTexture(c,"map",h.baseColorTexture)),c.metalness=void 0!==h.metallicFactor?h.metallicFactor:1,c.roughness=void 0!==h.roughnessFactor?h.roughnessFactor:1,void 0!==h.metallicRoughnessTexture&&(u.push(n.assignTexture(c,"metalnessMap",h.metallicRoughnessTexture)),u.push(n.assignTexture(c,"roughnessMap",h.metallicRoughnessTexture)))}!0===i.doubleSided&&(c.side=e.DoubleSide);var g=i.alphaMode||P;if(g===U?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,g===O&&(c.alphaTest=void 0!==i.alphaCutoff?i.alphaCutoff:.5)),void 0!==i.normalTexture&&r!==e.MeshBasicMaterial&&(u.push(n.assignTexture(c,"normalMap",i.normalTexture)),c.normalScale=new e.Vector2(1,1),void 0!==i.normalTexture.scale&&c.normalScale.set(i.normalTexture.scale,i.normalTexture.scale)),void 0!==i.occlusionTexture&&r!==e.MeshBasicMaterial&&(u.push(n.assignTexture(c,"aoMap",i.occlusionTexture)),void 0!==i.occlusionTexture.strength&&(c.aoMapIntensity=i.occlusionTexture.strength)),void 0!==i.emissiveFactor&&r!==e.MeshBasicMaterial&&(c.emissive=(new e.Color).fromArray(i.emissiveFactor)),void 0!==i.emissiveTexture&&r!==e.MeshBasicMaterial&&u.push(n.assignTexture(c,"emissiveMap",i.emissiveTexture)),l[a.KHR_MATERIALS_CLEARCOAT]){var v=o[a.KHR_MATERIALS_CLEARCOAT];r=v.getMaterialType(),u.push(v.extendParams(c,{extensions:l},n))}if(l[a.KHR_MATERIALS_TRANSMISSION]){v=o[a.KHR_MATERIALS_TRANSMISSION];r=v.getMaterialType(),u.push(v.extendParams(c,{extensions:l},n))}return Promise.all(u).then((function(){var s;return s=r===m?o[a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(c):new r(c),i.name&&(s.name=i.name),s.map&&(s.map.encoding=e.sRGBEncoding),s.emissiveMap&&(s.emissiveMap.encoding=e.sRGBEncoding),N(s,i),n.associations.set(s,{type:"materials",index:t}),i.extensions&&H(o,s,i),s}))},j.prototype.loadGeometries=function(t){var r=this,n=this.extensions,s=this.primitiveCache;function o(e){return n[a.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,r).then((function(t){return K(t,e,r)}))}for(var i,c,l=[],u=0,d=t.length;u<d;u++){var p,h=t[u],f=(c=void 0,(c=(i=h).extensions&&i.extensions[a.KHR_DRACO_MESH_COMPRESSION])?"draco:"+c.bufferView+":"+c.indices+":"+B(c.attributes):i.indices+":"+B(i.attributes)+":"+i.mode),m=s[f];if(m)l.push(m.promise);else p=h.extensions&&h.extensions[a.KHR_DRACO_MESH_COMPRESSION]?o(h):K(new e.BufferGeometry,h,r),s[f]={primitive:h,promise:p},l.push(p)}return Promise.all(l)},j.prototype.loadMesh=function(t){for(var r,a=this,n=this.json.meshes[t],s=n.primitives,o=[],i=0,c=s.length;i<c;i++){var l=void 0===s[i].material?(void 0===(r=this.cache).DefaultMaterial&&(r.DefaultMaterial=new e.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:e.FrontSide})),r.DefaultMaterial):this.getDependency("material",s[i].material);o.push(l)}return o.push(a.loadGeometries(s)),Promise.all(o).then((function(r){for(var o=r.slice(0,r.length-1),i=r[r.length-1],c=[],l=0,u=i.length;l<u;l++){var d,p=i[l],h=s[l],f=o[l];if(h.mode===S||h.mode===b||h.mode===w||void 0===h.mode)!0!==(d=!0===n.isSkinnedMesh?new e.SkinnedMesh(p,f):new e.Mesh(p,f)).isSkinnedMesh||d.geometry.attributes.skinWeight.normalized||d.normalizeSkinWeights(),h.mode===b?d.geometry=V(d.geometry,e.TriangleStripDrawMode):h.mode===w&&(d.geometry=V(d.geometry,e.TriangleFanDrawMode));else if(h.mode===M)d=new e.LineSegments(p,f);else if(h.mode===R)d=new e.Line(p,f);else if(h.mode===A)d=new e.LineLoop(p,f);else{if(h.mode!==T)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);d=new e.Points(p,f)}Object.keys(d.geometry.morphAttributes).length>0&&G(d,n),d.name=n.name||"mesh_"+t,i.length>1&&(d.name+="_"+l),N(d,n),a.assignFinalMaterial(d),c.push(d)}if(1===c.length)return c[0];var m=new e.Group;for(l=0,u=c.length;l<u;l++)m.add(c[l]);return m}))},j.prototype.loadCamera=function(t){var r,a=this.json.cameras[t],n=a[a.type];if(n)return"perspective"===a.type?r=new e.PerspectiveCamera(e.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===a.type&&(r=new e.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),a.name&&(r.name=a.name),N(r,a),Promise.resolve(r);console.warn("THREE.GLTFLoader: Missing camera parameters.")},j.prototype.loadSkin=function(e){var t=this.json.skins[e],r={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(r):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return r.inverseBindMatrices=e,r}))},j.prototype.loadAnimation=function(t){for(var r=this.json.animations[t],a=[],n=[],s=[],o=[],i=[],c=0,l=r.channels.length;c<l;c++){var u=r.channels[c],d=r.samplers[u.sampler],p=u.target,h=void 0!==p.node?p.node:p.id,f=void 0!==r.parameters?r.parameters[d.input]:d.input,m=void 0!==r.parameters?r.parameters[d.output]:d.output;a.push(this.getDependency("node",h)),n.push(this.getDependency("accessor",f)),s.push(this.getDependency("accessor",m)),o.push(d),i.push(p)}return Promise.all([Promise.all(a),Promise.all(n),Promise.all(s),Promise.all(o),Promise.all(i)]).then((function(a){for(var n=a[0],s=a[1],o=a[2],i=a[3],c=a[4],l=[],u=0,d=n.length;u<d;u++){var p=n[u],h=s[u],f=o[u],m=i[u],g=c[u];if(void 0!==p){var v;switch(p.updateMatrix(),p.matrixAutoUpdate=!0,C[g.path]){case C.weights:v=e.NumberKeyframeTrack;break;case C.rotation:v=e.QuaternionKeyframeTrack;break;default:v=e.VectorKeyframeTrack}var T=p.name?p.name:p.uuid,M=void 0!==m.interpolation?D[m.interpolation]:e.InterpolateLinear,A=[];C[g.path]===C.weights?p.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&A.push(e.name?e.name:e.uuid)})):A.push(T);var R=f.array;if(f.normalized){var S;if(R.constructor===Int8Array)S=1/127;else if(R.constructor===Uint8Array)S=1/255;else if(R.constructor==Int16Array)S=1/32767;else{if(R.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");S=1/65535}for(var b=new Float32Array(R.length),w=0,L=R.length;w<L;w++)b[w]=R[w]*S;R=b}for(w=0,L=A.length;w<L;w++){var _=new v(A[w]+"."+C[g.path],h.array,R,M);"CUBICSPLINE"===m.interpolation&&(_.createInterpolant=function(e){return new y(this.times,this.values,this.getValueSize()/3,e)},_.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(_)}}}var E=r.name?r.name:"animation_"+t;return new e.AnimationClip(E,void 0,l)}))},j.prototype.loadNode=function(t){var r,n=this.json,s=this.extensions,o=this,i=n.meshReferences,c=n.meshUses,l=n.nodes[t];return(r=[],void 0!==l.mesh&&r.push(o.getDependency("mesh",l.mesh).then((function(e){var t;if(i[l.mesh]>1){var r=c[l.mesh]++;(t=e.clone()).name+="_instance_"+r}else t=e;return void 0!==l.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,r=l.weights.length;t<r;t++)e.morphTargetInfluences[t]=l.weights[t]})),t}))),void 0!==l.camera&&r.push(o.getDependency("camera",l.camera)),l.extensions&&l.extensions[a.KHR_LIGHTS_PUNCTUAL]&&void 0!==l.extensions[a.KHR_LIGHTS_PUNCTUAL].light&&r.push(o.getDependency("light",l.extensions[a.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(r)).then((function(r){var a;if((a=!0===l.isBone?new e.Bone:r.length>1?new e.Group:1===r.length?r[0]:new e.Object3D)!==r[0])for(var n=0,i=r.length;n<i;n++)a.add(r[n]);if(l.name&&(a.userData.name=l.name,a.name=e.PropertyBinding.sanitizeNodeName(l.name)),N(a,l),l.extensions&&H(s,a,l),void 0!==l.matrix){var c=new e.Matrix4;c.fromArray(l.matrix),a.applyMatrix4(c)}else void 0!==l.translation&&a.position.fromArray(l.translation),void 0!==l.rotation&&a.quaternion.fromArray(l.rotation),void 0!==l.scale&&a.scale.fromArray(l.scale);return o.associations.set(a,{type:"nodes",index:t}),a}))},j.prototype.loadScene=function(){function t(r,a,n,s){var o=n.nodes[r];return s.getDependency("node",r).then((function(t){return void 0===o.skin?t:s.getDependency("skin",o.skin).then((function(e){for(var t=[],a=0,n=(r=e).joints.length;a<n;a++)t.push(s.getDependency("node",r.joints[a]));return Promise.all(t)})).then((function(a){return t.traverse((function(t){if(t.isMesh){for(var n=[],s=[],o=0,i=a.length;o<i;o++){var c=a[o];if(c){n.push(c);var l=new e.Matrix4;void 0!==r.inverseBindMatrices&&l.fromArray(r.inverseBindMatrices.array,16*o),s.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',r.joints[o])}t.bind(new e.Skeleton(n,s),t.matrixWorld)}})),t}));var r})).then((function(e){a.add(e);var r=[];if(o.children)for(var i=o.children,c=0,l=i.length;c<l;c++){var u=i[c];r.push(t(u,e,n,s))}return Promise.all(r)}))}return function(r){var a=this.json,n=this.extensions,s=this.json.scenes[r],o=new e.Group;s.name&&(o.name=s.name),N(o,s),s.extensions&&H(n,o,s);for(var i=s.nodes||[],c=[],l=0,u=i.length;l<u;l++)c.push(t(i[l],o,a,this));return Promise.all(c).then((function(){return o}))}}(),t}(),o=function(t){e.Loader.call(this,t),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}};o.prototype=Object.assign(Object.create(e.Loader.prototype),{constructor:o,setDecoderPath:function(e){return this.decoderPath=e,this},setDecoderConfig:function(e){return this.decoderConfig=e,this},setWorkerLimit:function(e){return this.workerLimit=e,this},setVerbosity:function(){console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.")},setDrawMode:function(){console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.")},setSkipDequantization:function(){console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.")},load:function(t,r,a,n){var s=new e.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),"use-credentials"===this.crossOrigin&&s.setWithCredentials(!0),s.load(t,(e=>{var t={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,t).then(r).catch(n)}),a,n)},decodeDracoFile:function(e,t,r,a){var n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:a||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,n).then(t)},decodeGeometry:function(e,t){for(var r in t.attributeTypes){var a=t.attributeTypes[r];void 0!==a.BYTES_PER_ELEMENT&&(t.attributeTypes[r]=a.name)}var n,s=JSON.stringify(t);if(o.taskCache.has(e)){var i=o.taskCache.get(e);if(i.key===s)return i.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var c=this.workerNextTaskID++,l=e.byteLength,u=this._getWorker(c,l).then((r=>(n=r,new Promise(((r,a)=>{n._callbacks[c]={resolve:r,reject:a},n.postMessage({type:"decode",id:c,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return u.catch((()=>!0)).then((()=>{n&&c&&this._releaseTask(n,c)})),o.taskCache.set(e,{key:s,promise:u}),u},_createGeometry:function(t){var r=new e.BufferGeometry;t.index&&r.setIndex(new e.BufferAttribute(t.index.array,1));for(var a=0;a<t.attributes.length;a++){var n=t.attributes[a],s=n.name,o=n.array,i=n.itemSize;r.setAttribute(s,new e.BufferAttribute(o,i))}return r},_loadLibrary:function(t,r){var a=new e.FileLoader(this.manager);return a.setPath(this.decoderPath),a.setResponseType(r),new Promise(((e,r)=>{a.load(t,e,void 0,r)}))},preload:function(){return this._initDecoder(),this},_initDecoder:function(){if(this.decoderPending)return this.decoderPending;var e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{var r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);var a=o.DRACOWorker.toString(),n=["/* draco decoder */",r,"","/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n]))})),this.decoderPending},_getWorker:function(e,t){return this._initDecoder().then((()=>{var r;this.workerPool.length<this.workerLimit?((r=new Worker(this.workerSourceURL))._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(e){var t=e.data;switch(t.type){case"decode":r._callbacks[t.id].resolve(t);break;case"error":r._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},this.workerPool.push(r)):this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));return(r=this.workerPool[this.workerPool.length-1])._taskCosts[e]=t,r._taskLoad+=t,r}))},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))},dispose:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}),o.DRACOWorker=function(){var e,t;function r(e,t,r,a,n,s){var o,i,c=s.num_components(),l=r.num_points()*c;switch(n){case Float32Array:o=new e.DracoFloat32Array,t.GetAttributeFloatForAllPoints(r,s,o),i=new Float32Array(l);break;case Int8Array:o=new e.DracoInt8Array,t.GetAttributeInt8ForAllPoints(r,s,o),i=new Int8Array(l);break;case Int16Array:o=new e.DracoInt16Array,t.GetAttributeInt16ForAllPoints(r,s,o),i=new Int16Array(l);break;case Int32Array:o=new e.DracoInt32Array,t.GetAttributeInt32ForAllPoints(r,s,o),i=new Int32Array(l);break;case Uint8Array:o=new e.DracoUInt8Array,t.GetAttributeUInt8ForAllPoints(r,s,o),i=new Uint8Array(l);break;case Uint16Array:o=new e.DracoUInt16Array,t.GetAttributeUInt16ForAllPoints(r,s,o),i=new Uint16Array(l);break;case Uint32Array:o=new e.DracoUInt32Array,t.GetAttributeUInt32ForAllPoints(r,s,o),i=new Uint32Array(l);break;default:throw new Error("THREE.DRACOLoader: Unexpected attribute type.")}for(var u=0;u<l;u++)i[u]=o.GetValue(u);return e.destroy(o),{name:a,array:i,itemSize:c}}onmessage=function(a){var n=a.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var s=n.buffer,o=n.taskConfig;t.then((e=>{var t=e.draco,a=new t.Decoder,i=new t.DecoderBuffer;i.Init(new Int8Array(s),s.byteLength);try{var c=function(e,t,a,n){var s,o,i=n.attributeIDs,c=n.attributeTypes,l=t.GetEncodedGeometryType(a);if(l===e.TRIANGULAR_MESH)s=new e.Mesh,o=t.DecodeBufferToMesh(a,s);else{if(l!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");s=new e.PointCloud,o=t.DecodeBufferToPointCloud(a,s)}if(!o.ok()||0===s.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+o.error_msg());var u={index:null,attributes:[]};for(var d in i){var p,h,f=self[c[d]];if(n.useUniqueIDs)h=i[d],p=t.GetAttributeByUniqueId(s,h);else{if(-1===(h=t.GetAttributeId(s,e[i[d]])))continue;p=t.GetAttribute(s,h)}u.attributes.push(r(e,t,s,d,f,p))}if(l===e.TRIANGULAR_MESH){for(var m=s.num_faces(),g=new Uint32Array(3*m),v=new e.DracoInt32Array,y=0;y<m;++y){t.GetFaceFromMesh(s,y,v);for(var T=0;T<3;++T)g[3*y+T]=v.GetValue(T)}u.index={array:g,itemSize:1},e.destroy(v)}return e.destroy(s),u}(t,a,i,o),l=c.attributes.map((e=>e.array.buffer));c.index&&l.push(c.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:c},l)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{t.destroy(i),t.destroy(a)}}))}}},o.taskCache=new WeakMap,o.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},o.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},o.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},o.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};var i=function(t){e.CompressedTextureLoader.call(this,t)};i.prototype=Object.assign(Object.create(e.CompressedTextureLoader.prototype),{constructor:i,parse:function(t,r){var a={mipmaps:[],width:0,height:0,format:null,mipmapCount:1};function n(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}function s(e,t,r,a){for(var n=r*a*4,s=new Uint8Array(e,t,n),o=new Uint8Array(n),i=0,c=0,l=0;l<a;l++)for(var u=0;u<r;u++){var d=s[c],p=s[++c],h=s[++c],f=s[++c];c++,o[i]=h,o[++i]=p,o[++i]=d,o[++i]=f,i++}return o}var o,i=n("DXT1"),c=n("DXT3"),l=n("DXT5"),u=n("ETC1"),d=new Int32Array(t,0,31);if(542327876!==d[0])return console.error("THREE.DDSLoader.parse: Invalid magic number in DDS header."),a;if(4&!d[20])return console.error("THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code."),a;var p,h=d[21],f=!1;switch(h){case i:o=8,a.format=e.RGB_S3TC_DXT1_Format;break;case c:o=16,a.format=e.RGBA_S3TC_DXT3_Format;break;case l:o=16,a.format=e.RGBA_S3TC_DXT5_Format;break;case u:o=8,a.format=e.RGB_ETC1_Format;break;default:if(!(32===d[22]&&16711680&d[23]&&65280&d[24]&&255&d[25]&&4278190080&d[26]))return console.error("THREE.DDSLoader.parse: Unsupported FourCC code ",(p=h,String.fromCharCode(255&p,p>>8&255,p>>16&255,p>>24&255))),a;f=!0,o=64,a.format=e.RGBAFormat}a.mipmapCount=1,131072&d[2]&&!1!==r&&(a.mipmapCount=Math.max(1,d[7]));var m=d[28];if(a.isCubemap=!!(512&m),a.isCubemap&&(!(1024&m)||!(2048&m)||!(4096&m)||!(8192&m)||!(16384&m)||!(32768&m)))return console.error("THREE.DDSLoader.parse: Incomplete cubemap faces"),a;a.width=d[4],a.height=d[3];for(var g=d[1]+4,v=a.isCubemap?6:1,y=0;y<v;y++)for(var T=a.width,M=a.height,A=0;A<a.mipmapCount;A++){if(f)var R=(S=s(t,g,T,M)).length;else{R=Math.max(4,T)/4*Math.max(4,M)/4*o;var S=new Uint8Array(t,g,R)}var b={data:S,width:T,height:M};a.mipmaps.push(b),g+=R,T=Math.max(T>>1,1),M=Math.max(M>>1,1)}return a}});var c=function(e){function t(t){var a=e.call(this)||this;return a.needsRender=!0,t&&t.children.length&&a.add.apply(a,t.children),a.mixer=new r.AnimationMixer(a),a}return n(t,e),t.prototype.clone=function(){var t=e.prototype.clone.call(this,!0),a=new r.AnimationMixer(t);return t.mixer=a,t.needsRender=!0,t},t}(r.Group),l=function(e){function t(t){var r=e.call(this,t)||this;return r.ddsLoader=new i(t),r.dracoLoader=new o(t),r.dracoLoader.setDecoderPath("https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/"),r}return n(t,e),Object.defineProperty(t,"version",{get:function(){return"6.0.0-alpha.48"},enumerable:!1,configurable:!0}),t.prototype.load=function(t,r,a,n){return e.prototype.load.call(this,t,r,a,n)},t.prototype.parse=function(t,r,a,n){return e.prototype.parse.call(this,t,r,(function(e){var t=new c(e.scene),r=e.scenes.map((function(r){return r===e.scene?t:new c(r)}));a(Object.assign(e,{scene:t,scenes:r}))}),n)},t}(s);exports.DDSLoader=i,exports.DRACOLoader=o,exports.GLTFLoader=l,exports.GLTFObject=c,exports.THREEGLTFLoader=s;
|
|
260
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");function t(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var r=t(e),a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},a(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){function t(t){e.Loader.call(this,t),this.dracoLoader=null,this.ddsLoader=null}function r(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}t.prototype=Object.assign(Object.create(e.Loader.prototype),{constructor:t,load:function(t,r,a,n){var s,o=this;s=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:e.LoaderUtils.extractUrlBase(t),o.manager.itemStart(t);var i=function(e){n?n(e):console.error(e),o.manager.itemError(t),o.manager.itemEnd(t)},c=new e.FileLoader(o.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),"use-credentials"===o.crossOrigin&&c.setWithCredentials(!0),c.load(t,(function(e){try{o.parse(e,s,(function(e){r(e),o.manager.itemEnd(t)}),i)}catch(e){i(e)}}),a,i)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(t,r,u,d){var m,y={};if("string"==typeof t)m=t;else if(e.LoaderUtils.decodeText(new Uint8Array(t,0,4))===l){try{y[a.KHR_BINARY_GLTF]=new p(t)}catch(e){return void(d&&d(e))}m=y[a.KHR_BINARY_GLTF].content}else m=e.LoaderUtils.decodeText(new Uint8Array(t));var T=JSON.parse(m);if(void 0===T.asset||T.asset.version[0]<2)d&&d(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{if(T.extensionsUsed)for(var M=0;M<T.extensionsUsed.length;++M){var A=T.extensionsUsed[M],R=T.extensionsRequired||[];switch(A){case a.KHR_LIGHTS_PUNCTUAL:y[A]=new s(T);break;case a.KHR_MATERIALS_CLEARCOAT:y[A]=new i;break;case a.KHR_MATERIALS_TRANSMISSION:y[A]=new c;break;case a.KHR_MATERIALS_UNLIT:y[A]=new o;break;case a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:y[A]=new g;break;case a.KHR_DRACO_MESH_COMPRESSION:y[A]=new h(T,this.dracoLoader);break;case a.MSFT_TEXTURE_DDS:y[A]=new n(this.ddsLoader);break;case a.KHR_TEXTURE_TRANSFORM:y[A]=new f;break;case a.KHR_MESH_QUANTIZATION:y[A]=new v;break;default:R.indexOf(A)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+A+'".')}}var S=new j(T,y,{path:r||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});S.fileLoader.setRequestHeader(this.requestHeader),S.parse(u,d)}}});var a={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function n(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=a.MSFT_TEXTURE_DDS,this.ddsLoader=e}function s(e){this.name=a.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[a.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function o(){this.name=a.KHR_MATERIALS_UNLIT}function i(){this.name=a.KHR_MATERIALS_CLEARCOAT}function c(){this.name=a.KHR_MATERIALS_TRANSMISSION}s.prototype.loadLight=function(t){var r,a=this.lightDefs[t],n=new e.Color(16777215);void 0!==a.color&&n.fromArray(a.color);var s=void 0!==a.range?a.range:0;switch(a.type){case"directional":(r=new e.DirectionalLight(n)).target.position.set(0,0,-1),r.add(r.target);break;case"point":(r=new e.PointLight(n)).distance=s;break;case"spot":(r=new e.SpotLight(n)).distance=s,a.spot=a.spot||{},a.spot.innerConeAngle=void 0!==a.spot.innerConeAngle?a.spot.innerConeAngle:0,a.spot.outerConeAngle=void 0!==a.spot.outerConeAngle?a.spot.outerConeAngle:Math.PI/4,r.angle=a.spot.outerConeAngle,r.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,r.target.position.set(0,0,-1),r.add(r.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+a.type+'".')}return r.position.set(0,0,0),r.decay=2,void 0!==a.intensity&&(r.intensity=a.intensity),r.name=a.name||"light_"+t,Promise.resolve(r)},o.prototype.getMaterialType=function(){return e.MeshBasicMaterial},o.prototype.extendParams=function(t,r,a){var n=[];t.color=new e.Color(1,1,1),t.opacity=1;var s=r.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){var o=s.baseColorFactor;t.color.fromArray(o),t.opacity=o[3]}void 0!==s.baseColorTexture&&n.push(a.assignTexture(t,"map",s.baseColorTexture))}return Promise.all(n)},i.prototype.getMaterialType=function(){return e.MeshPhysicalMaterial},i.prototype.extendParams=function(t,r,a){var n=[],s=r.extensions[this.name];if(void 0!==s.clearcoatFactor&&(t.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&n.push(a.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&n.push(a.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(n.push(a.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){var o=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new e.Vector2(o,o)}return Promise.all(n)},c.prototype.getMaterialType=function(){return e.MeshPhysicalMaterial},c.prototype.extendParams=function(e,t,r){var a=t.extensions[this.name];return void 0!==a.transmissionFactor&&(e.premultipliedAlpha=!0,e.transparent=!0,e.opacity=1,e.transparency=a.transmissionFactor,(e.map||e.color.r*e.color.g*e.color.b<.99)&&(e.transparency*=.75)),Promise.all([])};var l="glTF",u=12,d={JSON:1313821514,BIN:5130562};function p(t){this.name=a.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,u);if(this.header={magic:e.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==l)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var n=new DataView(t,u),s=0;s<n.byteLength;){var o=n.getUint32(s,!0);s+=4;var i=n.getUint32(s,!0);if(s+=4,i===d.JSON){var c=new Uint8Array(t,u+s,o);this.content=e.LoaderUtils.decodeText(c)}else if(i===d.BIN){var p=u+s;this.body=t.slice(p,p+o)}s+=o}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function h(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=a.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function f(){this.name=a.KHR_TEXTURE_TRANSFORM}function m(t){e.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var r=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),a=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),n=["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"),s=["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"),o=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),i={specular:{value:(new e.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=i,this.onBeforeCompile=function(e){for(var t in i)e.uniforms[t]=i[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;"),e.fragmentShader=e.fragmentShader.replace("uniform float metalness;","uniform float glossiness;"),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_pars_fragment>",r),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_pars_fragment>",a),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_fragment>",n),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_fragment>",s),e.fragmentShader=e.fragmentShader.replace("#include <lights_physical_fragment>",o)},Object.defineProperties(this,{specular:{get:function(){return i.specular.value},set:function(e){i.specular.value=e}},specularMap:{get:function(){return i.specularMap.value},set:function(e){i.specularMap.value=e}},glossiness:{get:function(){return i.glossiness.value},set:function(e){i.glossiness.value=e}},glossinessMap:{get:function(){return i.glossinessMap.value},set:function(e){i.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(t)}function g(){return{name:a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return m},extendParams:function(t,r,a){var n=r.extensions[this.name];t.color=new e.Color(1,1,1),t.opacity=1;var s=[];if(Array.isArray(n.diffuseFactor)){var o=n.diffuseFactor;t.color.fromArray(o),t.opacity=o[3]}if(void 0!==n.diffuseTexture&&s.push(a.assignTexture(t,"map",n.diffuseTexture)),t.emissive=new e.Color(0,0,0),t.glossiness=void 0!==n.glossinessFactor?n.glossinessFactor:1,t.specular=new e.Color(1,1,1),Array.isArray(n.specularFactor)&&t.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var i=n.specularGlossinessTexture;s.push(a.assignTexture(t,"glossinessMap",i)),s.push(a.assignTexture(t,"specularMap",i))}return Promise.all(s)},createMaterial:function(t){var r=new m(t);return r.fog=!0,r.color=t.color,r.map=void 0===t.map?null:t.map,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=void 0===t.aoMap?null:t.aoMap,r.aoMapIntensity=1,r.emissive=t.emissive,r.emissiveIntensity=1,r.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,r.bumpMap=void 0===t.bumpMap?null:t.bumpMap,r.bumpScale=1,r.normalMap=void 0===t.normalMap?null:t.normalMap,r.normalMapType=e.TangentSpaceNormalMap,t.normalScale&&(r.normalScale=t.normalScale),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=void 0===t.specularMap?null:t.specularMap,r.specular=t.specular,r.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,r.glossiness=t.glossiness,r.alphaMap=null,r.envMap=void 0===t.envMap?null:t.envMap,r.envMapIntensity=1,r.refractionRatio=.98,r}}}function v(){this.name=a.KHR_MESH_QUANTIZATION}function y(t,r,a,n){e.Interpolant.call(this,t,r,a,n)}h.prototype.decodePrimitive=function(e,t){var r=this.json,a=this.dracoLoader,n=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,o={},i={},c={};for(var l in s){var u=I[l]||l.toLowerCase();o[u]=s[l]}for(l in e.attributes){u=I[l]||l.toLowerCase();if(void 0!==s[l]){var d=r.accessors[e.attributes[l]],p=L[d.componentType];c[u]=p,i[u]=!0===d.normalized}}return t.getDependency("bufferView",n).then((function(e){return new Promise((function(t){a.decodeDracoFile(e,(function(e){for(var r in e.attributes){var a=e.attributes[r],n=i[r];void 0!==n&&(a.normalized=n)}t(e)}),o,c)}))}))},f.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},m.prototype=Object.create(e.MeshStandardMaterial.prototype),m.prototype.constructor=m,m.prototype.copy=function(t){return e.MeshStandardMaterial.prototype.copy.call(this,t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},y.prototype=Object.create(e.Interpolant.prototype),y.prototype.constructor=y,y.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,r=this.sampleValues,a=this.valueSize,n=e*a*3+a,s=0;s!==a;s++)t[s]=r[n+s];return t},y.prototype.beforeStart_=y.prototype.copySampleValue_,y.prototype.afterEnd_=y.prototype.copySampleValue_,y.prototype.interpolate_=function(e,t,r,a){for(var n=this.resultBuffer,s=this.sampleValues,o=this.valueSize,i=2*o,c=3*o,l=a-t,u=(r-t)/l,d=u*u,p=d*u,h=e*c,f=h-c,m=-2*p+3*d,g=p-d,v=1-m,y=g-d+u,T=0;T!==o;T++){var M=s[f+T+o],A=s[f+T+i]*l,R=s[h+T+o],S=s[h+T]*l;n[T]=v*M+y*A+m*R+g*S}return n};var T=0,M=1,A=2,R=3,S=4,b=5,w=6,L={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},_={9728:e.NearestFilter,9729:e.LinearFilter,9984:e.NearestMipmapNearestFilter,9985:e.LinearMipmapNearestFilter,9986:e.NearestMipmapLinearFilter,9987:e.LinearMipmapLinearFilter},E={33071:e.ClampToEdgeWrapping,33648:e.MirroredRepeatWrapping,10497:e.RepeatWrapping},x={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},I={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},C={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},D={CUBICSPLINE:void 0,LINEAR:e.InterpolateLinear,STEP:e.InterpolateDiscrete},P="OPAQUE",O="MASK",U="BLEND",F={"image/png":e.RGBAFormat,"image/jpeg":e.RGBFormat};function k(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function H(e,t,r){for(var a in r.extensions)void 0===e[a]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[a]=r.extensions[a])}function N(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function G(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var r=0,a=t.weights.length;r<a;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){var n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(r=0,a=n.length;r<a;r++)e.morphTargetDictionary[n[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function B(e){for(var t="",r=Object.keys(e).sort(),a=0,n=r.length;a<n;a++)t+=r[a]+":"+e[r[a]]+";";return t}function j(t,a,n){this.json=t||{},this.extensions=a||{},this.options=n||{},this.cache=new r,this.associations=new Map,this.primitiveCache={},this.textureLoader=new e.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new e.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function K(t,r,a){var n=r.attributes,s=[];function o(e,r){return a.getDependency("accessor",e).then((function(e){t.setAttribute(r,e)}))}for(var i in n){var c=I[i]||i.toLowerCase();c in t.attributes||s.push(o(n[i],c))}if(void 0!==r.indices&&!t.index){var l=a.getDependency("accessor",r.indices).then((function(e){t.setIndex(e)}));s.push(l)}return N(t,r),function(t,r,a){var n=r.attributes,s=new e.Box3;if(void 0!==n.POSITION){var o=(h=a.json.accessors[n.POSITION]).min,i=h.max;if(void 0!==o&&void 0!==i){s.set(new e.Vector3(o[0],o[1],o[2]),new e.Vector3(i[0],i[1],i[2]));var c=r.targets;if(void 0!==c){for(var l=new e.Vector3,u=new e.Vector3,d=0,p=c.length;d<p;d++){var h,f=c[d];if(void 0!==f.POSITION)o=(h=a.json.accessors[f.POSITION]).min,i=h.max,void 0!==o&&void 0!==i?(u.setX(Math.max(Math.abs(o[0]),Math.abs(i[0]))),u.setY(Math.max(Math.abs(o[1]),Math.abs(i[1]))),u.setZ(Math.max(Math.abs(o[2]),Math.abs(i[2]))),l.max(u)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}s.expandByVector(l)}t.boundingBox=s;var m=new e.Sphere;s.getCenter(m.center),m.radius=s.min.distanceTo(s.max)/2,t.boundingSphere=m}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,r,a),Promise.all(s).then((function(){return void 0!==r.targets?function(e,t,r){for(var a=!1,n=!1,s=0,o=t.length;s<o&&(void 0!==(l=t[s]).POSITION&&(a=!0),void 0!==l.NORMAL&&(n=!0),!a||!n);s++);if(!a&&!n)return Promise.resolve(e);var i=[],c=[];for(s=0,o=t.length;s<o;s++){var l=t[s];if(a){var u=void 0!==l.POSITION?r.getDependency("accessor",l.POSITION):e.attributes.position;i.push(u)}n&&(u=void 0!==l.NORMAL?r.getDependency("accessor",l.NORMAL):e.attributes.normal,c.push(u))}return Promise.all([Promise.all(i),Promise.all(c)]).then((function(t){var r=t[0],s=t[1];return a&&(e.morphAttributes.position=r),n&&(e.morphAttributes.normal=s),e.morphTargetsRelative=!0,e}))}(t,r.targets,a):t}))}function V(t,r){var a=t.getIndex();if(null===a){var n=[],s=t.getAttribute("position");if(void 0===s)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var o=0;o<s.count;o++)n.push(o);t.setIndex(n),a=t.getIndex()}var i=a.count-2,c=[];if(r===e.TriangleFanDrawMode)for(o=1;o<=i;o++)c.push(a.getX(0)),c.push(a.getX(o)),c.push(a.getX(o+1));else for(o=0;o<i;o++)o%2==0?(c.push(a.getX(o)),c.push(a.getX(o+1)),c.push(a.getX(o+2))):(c.push(a.getX(o+2)),c.push(a.getX(o+1)),c.push(a.getX(o)));c.length/3!==i&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var l=t.clone();return l.setIndex(c),l}return j.prototype.parse=function(e,t){var r=this,a=this.json,n=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var s={scene:t[0][a.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:a.asset,parser:r,userData:{}};H(n,s,a),N(s,a),e(s)})).catch(t)},j.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],a={},n={},s=0,o=t.length;s<o;s++)for(var i=t[s].joints,c=0,l=i.length;c<l;c++)e[i[c]].isBone=!0;for(var u=0,d=e.length;u<d;u++){var p=e[u];void 0!==p.mesh&&(void 0===a[p.mesh]&&(a[p.mesh]=n[p.mesh]=0),a[p.mesh]++,void 0!==p.skin&&(r[p.mesh].isSkinnedMesh=!0))}this.json.meshReferences=a,this.json.meshUses=n},j.prototype.getDependency=function(e,t){var r=e+":"+t,n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this.loadNode(t);break;case"mesh":n=this.loadMesh(t);break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this.loadBufferView(t);break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this.loadMaterial(t);break;case"texture":n=this.loadTexture(t);break;case"skin":n=this.loadSkin(t);break;case"animation":n=this.loadAnimation(t);break;case"camera":n=this.loadCamera(t);break;case"light":n=this.extensions[a.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,n)}return n},j.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var r=this,a=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(a.map((function(t,a){return r.getDependency(e,a)}))),this.cache.add(e,t)}return t},j.prototype.loadBuffer=function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[a.KHR_BINARY_GLTF].body);var n=this.options;return new Promise((function(e,a){r.load(k(t.uri,n.path),e,void 0,(function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},j.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,a=t.byteOffset||0;return e.slice(a,a+r)}))},j.prototype.loadAccessor=function(t){var r=this,a=this.json,n=this.json.accessors[t];if(void 0===n.bufferView&&void 0===n.sparse)return Promise.resolve(null);var s=[];return void 0!==n.bufferView?s.push(this.getDependency("bufferView",n.bufferView)):s.push(null),void 0!==n.sparse&&(s.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(s).then((function(t){var s,o,i=t[0],c=x[n.type],l=L[n.componentType],u=l.BYTES_PER_ELEMENT,d=u*c,p=n.byteOffset||0,h=void 0!==n.bufferView?a.bufferViews[n.bufferView].byteStride:void 0,f=!0===n.normalized;if(h&&h!==d){var m=Math.floor(p/h),g="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+m+":"+n.count,v=r.cache.get(g);v||(s=new l(i,m*h,n.count*h/u),v=new e.InterleavedBuffer(s,h/u),r.cache.add(g,v)),o=new e.InterleavedBufferAttribute(v,c,p%h/u,f)}else s=null===i?new l(n.count*c):new l(i,p,n.count*c),o=new e.BufferAttribute(s,c,f);if(void 0!==n.sparse){var y=x.SCALAR,T=L[n.sparse.indices.componentType],M=n.sparse.indices.byteOffset||0,A=n.sparse.values.byteOffset||0,R=new T(t[1],M,n.sparse.count*y),S=new l(t[2],A,n.sparse.count*c);null!==i&&(o=new e.BufferAttribute(o.array.slice(),o.itemSize,o.normalized));for(var b=0,w=R.length;b<w;b++){var _=R[b];if(o.setX(_,S[b*c]),c>=2&&o.setY(_,S[b*c+1]),c>=3&&o.setZ(_,S[b*c+2]),c>=4&&o.setW(_,S[b*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o}))},j.prototype.loadTexture=function(t){var r,n=this,s=this.json,o=this.options,i=this.textureLoader,c=self.URL||self.webkitURL,l=s.textures[t],u=l.extensions||{},d=(r=u[a.MSFT_TEXTURE_DDS]?s.images[u[a.MSFT_TEXTURE_DDS].source]:s.images[l.source]).uri,p=!1;return void 0!==r.bufferView&&(d=n.getDependency("bufferView",r.bufferView).then((function(e){p=!0;var t=new Blob([e],{type:r.mimeType});return d=c.createObjectURL(t)}))),Promise.resolve(d).then((function(e){var t=o.manager.getHandler(e);return t||(t=u[a.MSFT_TEXTURE_DDS]?n.extensions[a.MSFT_TEXTURE_DDS].ddsLoader:i),new Promise((function(r,a){t.load(k(e,o.path),r,void 0,a)}))})).then((function(a){!0===p&&c.revokeObjectURL(d),a.flipY=!1,l.name&&(a.name=l.name),r.mimeType in F&&(a.format=F[r.mimeType]);var o=(s.samplers||{})[l.sampler]||{};return a.magFilter=_[o.magFilter]||e.LinearFilter,a.minFilter=_[o.minFilter]||e.LinearMipmapLinearFilter,a.wrapS=E[o.wrapS]||e.RepeatWrapping,a.wrapT=E[o.wrapT]||e.RepeatWrapping,n.associations.set(a,{type:"textures",index:t}),a}))},j.prototype.assignTexture=function(t,r,n){var s=this;return this.getDependency("texture",n.index).then((function(o){if(!o.isCompressedTexture)switch(r){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":o.format=e.RGBFormat}if(void 0===n.texCoord||0==n.texCoord||"aoMap"===r&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+r+" not yet supported."),s.extensions[a.KHR_TEXTURE_TRANSFORM]){var i=void 0!==n.extensions?n.extensions[a.KHR_TEXTURE_TRANSFORM]:void 0;if(i){var c=this.associations.get(o);o=s.extensions[a.KHR_TEXTURE_TRANSFORM].extendTexture(o,i),this.associations.set(o,c)}}t[r]=o}))},j.prototype.assignFinalMaterial=function(t){var r=t.geometry,a=t.material,n=void 0!==r.attributes.tangent,s=void 0!==r.attributes.color,o=void 0===r.attributes.normal,i=!0===t.isSkinnedMesh,c=Object.keys(r.morphAttributes).length>0,l=c&&void 0!==r.morphAttributes.normal;if(t.isPoints){var u="PointsMaterial:"+a.uuid,d=this.cache.get(u);d||(d=new e.PointsMaterial,e.Material.prototype.copy.call(d,a),d.color.copy(a.color),d.map=a.map,d.sizeAttenuation=!1,this.cache.add(u,d)),a=d}else if(t.isLine){u="LineBasicMaterial:"+a.uuid;var p=this.cache.get(u);p||(p=new e.LineBasicMaterial,e.Material.prototype.copy.call(p,a),p.color.copy(a.color),this.cache.add(u,p)),a=p}if(n||s||o||i||c){u="ClonedMaterial:"+a.uuid+":";a.isGLTFSpecularGlossinessMaterial&&(u+="specular-glossiness:"),i&&(u+="skinning:"),n&&(u+="vertex-tangents:"),s&&(u+="vertex-colors:"),o&&(u+="flat-shading:"),c&&(u+="morph-targets:"),l&&(u+="morph-normals:");var h=this.cache.get(u);h||(h=a.clone(),i&&(h.skinning=!0),n&&(h.vertexTangents=!0),s&&(h.vertexColors=!0),o&&(h.flatShading=!0),c&&(h.morphTargets=!0),l&&(h.morphNormals=!0),this.cache.add(u,h),this.associations.set(h,this.associations.get(a))),a=h}a.aoMap&&void 0===r.attributes.uv2&&void 0!==r.attributes.uv&&r.setAttribute("uv2",r.attributes.uv),a.normalScale&&!n&&(a.normalScale.y=-a.normalScale.y),a.clearcoatNormalScale&&!n&&(a.clearcoatNormalScale.y=-a.clearcoatNormalScale.y),t.material=a},j.prototype.loadMaterial=function(t){var r,n=this,s=this.json,o=this.extensions,i=s.materials[t],c={},l=i.extensions||{},u=[];if(l[a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var d=o[a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];r=d.getMaterialType(),u.push(d.extendParams(c,i,n))}else if(l[a.KHR_MATERIALS_UNLIT]){var p=o[a.KHR_MATERIALS_UNLIT];r=p.getMaterialType(),u.push(p.extendParams(c,i,n))}else{r=e.MeshStandardMaterial;var h=i.pbrMetallicRoughness||{};if(c.color=new e.Color(1,1,1),c.opacity=1,Array.isArray(h.baseColorFactor)){var f=h.baseColorFactor;c.color.fromArray(f),c.opacity=f[3]}void 0!==h.baseColorTexture&&u.push(n.assignTexture(c,"map",h.baseColorTexture)),c.metalness=void 0!==h.metallicFactor?h.metallicFactor:1,c.roughness=void 0!==h.roughnessFactor?h.roughnessFactor:1,void 0!==h.metallicRoughnessTexture&&(u.push(n.assignTexture(c,"metalnessMap",h.metallicRoughnessTexture)),u.push(n.assignTexture(c,"roughnessMap",h.metallicRoughnessTexture)))}!0===i.doubleSided&&(c.side=e.DoubleSide);var g=i.alphaMode||P;if(g===U?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,g===O&&(c.alphaTest=void 0!==i.alphaCutoff?i.alphaCutoff:.5)),void 0!==i.normalTexture&&r!==e.MeshBasicMaterial&&(u.push(n.assignTexture(c,"normalMap",i.normalTexture)),c.normalScale=new e.Vector2(1,1),void 0!==i.normalTexture.scale&&c.normalScale.set(i.normalTexture.scale,i.normalTexture.scale)),void 0!==i.occlusionTexture&&r!==e.MeshBasicMaterial&&(u.push(n.assignTexture(c,"aoMap",i.occlusionTexture)),void 0!==i.occlusionTexture.strength&&(c.aoMapIntensity=i.occlusionTexture.strength)),void 0!==i.emissiveFactor&&r!==e.MeshBasicMaterial&&(c.emissive=(new e.Color).fromArray(i.emissiveFactor)),void 0!==i.emissiveTexture&&r!==e.MeshBasicMaterial&&u.push(n.assignTexture(c,"emissiveMap",i.emissiveTexture)),l[a.KHR_MATERIALS_CLEARCOAT]){var v=o[a.KHR_MATERIALS_CLEARCOAT];r=v.getMaterialType(),u.push(v.extendParams(c,{extensions:l},n))}if(l[a.KHR_MATERIALS_TRANSMISSION]){v=o[a.KHR_MATERIALS_TRANSMISSION];r=v.getMaterialType(),u.push(v.extendParams(c,{extensions:l},n))}return Promise.all(u).then((function(){var s;return s=r===m?o[a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(c):new r(c),i.name&&(s.name=i.name),s.map&&(s.map.encoding=e.sRGBEncoding),s.emissiveMap&&(s.emissiveMap.encoding=e.sRGBEncoding),N(s,i),n.associations.set(s,{type:"materials",index:t}),i.extensions&&H(o,s,i),s}))},j.prototype.loadGeometries=function(t){var r=this,n=this.extensions,s=this.primitiveCache;function o(e){return n[a.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,r).then((function(t){return K(t,e,r)}))}for(var i,c,l=[],u=0,d=t.length;u<d;u++){var p,h=t[u],f=(c=void 0,(c=(i=h).extensions&&i.extensions[a.KHR_DRACO_MESH_COMPRESSION])?"draco:"+c.bufferView+":"+c.indices+":"+B(c.attributes):i.indices+":"+B(i.attributes)+":"+i.mode),m=s[f];if(m)l.push(m.promise);else p=h.extensions&&h.extensions[a.KHR_DRACO_MESH_COMPRESSION]?o(h):K(new e.BufferGeometry,h,r),s[f]={primitive:h,promise:p},l.push(p)}return Promise.all(l)},j.prototype.loadMesh=function(t){for(var r,a=this,n=this.json.meshes[t],s=n.primitives,o=[],i=0,c=s.length;i<c;i++){var l=void 0===s[i].material?(void 0===(r=this.cache).DefaultMaterial&&(r.DefaultMaterial=new e.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:e.FrontSide})),r.DefaultMaterial):this.getDependency("material",s[i].material);o.push(l)}return o.push(a.loadGeometries(s)),Promise.all(o).then((function(r){for(var o=r.slice(0,r.length-1),i=r[r.length-1],c=[],l=0,u=i.length;l<u;l++){var d,p=i[l],h=s[l],f=o[l];if(h.mode===S||h.mode===b||h.mode===w||void 0===h.mode)!0!==(d=!0===n.isSkinnedMesh?new e.SkinnedMesh(p,f):new e.Mesh(p,f)).isSkinnedMesh||d.geometry.attributes.skinWeight.normalized||d.normalizeSkinWeights(),h.mode===b?d.geometry=V(d.geometry,e.TriangleStripDrawMode):h.mode===w&&(d.geometry=V(d.geometry,e.TriangleFanDrawMode));else if(h.mode===M)d=new e.LineSegments(p,f);else if(h.mode===R)d=new e.Line(p,f);else if(h.mode===A)d=new e.LineLoop(p,f);else{if(h.mode!==T)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);d=new e.Points(p,f)}Object.keys(d.geometry.morphAttributes).length>0&&G(d,n),d.name=n.name||"mesh_"+t,i.length>1&&(d.name+="_"+l),N(d,n),a.assignFinalMaterial(d),c.push(d)}if(1===c.length)return c[0];var m=new e.Group;for(l=0,u=c.length;l<u;l++)m.add(c[l]);return m}))},j.prototype.loadCamera=function(t){var r,a=this.json.cameras[t],n=a[a.type];if(n)return"perspective"===a.type?r=new e.PerspectiveCamera(e.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===a.type&&(r=new e.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),a.name&&(r.name=a.name),N(r,a),Promise.resolve(r);console.warn("THREE.GLTFLoader: Missing camera parameters.")},j.prototype.loadSkin=function(e){var t=this.json.skins[e],r={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(r):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return r.inverseBindMatrices=e,r}))},j.prototype.loadAnimation=function(t){for(var r=this.json.animations[t],a=[],n=[],s=[],o=[],i=[],c=0,l=r.channels.length;c<l;c++){var u=r.channels[c],d=r.samplers[u.sampler],p=u.target,h=void 0!==p.node?p.node:p.id,f=void 0!==r.parameters?r.parameters[d.input]:d.input,m=void 0!==r.parameters?r.parameters[d.output]:d.output;a.push(this.getDependency("node",h)),n.push(this.getDependency("accessor",f)),s.push(this.getDependency("accessor",m)),o.push(d),i.push(p)}return Promise.all([Promise.all(a),Promise.all(n),Promise.all(s),Promise.all(o),Promise.all(i)]).then((function(a){for(var n=a[0],s=a[1],o=a[2],i=a[3],c=a[4],l=[],u=0,d=n.length;u<d;u++){var p=n[u],h=s[u],f=o[u],m=i[u],g=c[u];if(void 0!==p){var v;switch(p.updateMatrix(),p.matrixAutoUpdate=!0,C[g.path]){case C.weights:v=e.NumberKeyframeTrack;break;case C.rotation:v=e.QuaternionKeyframeTrack;break;default:v=e.VectorKeyframeTrack}var T=p.name?p.name:p.uuid,M=void 0!==m.interpolation?D[m.interpolation]:e.InterpolateLinear,A=[];C[g.path]===C.weights?p.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&A.push(e.name?e.name:e.uuid)})):A.push(T);var R=f.array;if(f.normalized){var S;if(R.constructor===Int8Array)S=1/127;else if(R.constructor===Uint8Array)S=1/255;else if(R.constructor==Int16Array)S=1/32767;else{if(R.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");S=1/65535}for(var b=new Float32Array(R.length),w=0,L=R.length;w<L;w++)b[w]=R[w]*S;R=b}for(w=0,L=A.length;w<L;w++){var _=new v(A[w]+"."+C[g.path],h.array,R,M);"CUBICSPLINE"===m.interpolation&&(_.createInterpolant=function(e){return new y(this.times,this.values,this.getValueSize()/3,e)},_.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(_)}}}var E=r.name?r.name:"animation_"+t;return new e.AnimationClip(E,void 0,l)}))},j.prototype.loadNode=function(t){var r,n=this.json,s=this.extensions,o=this,i=n.meshReferences,c=n.meshUses,l=n.nodes[t];return(r=[],void 0!==l.mesh&&r.push(o.getDependency("mesh",l.mesh).then((function(e){var t;if(i[l.mesh]>1){var r=c[l.mesh]++;(t=e.clone()).name+="_instance_"+r}else t=e;return void 0!==l.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,r=l.weights.length;t<r;t++)e.morphTargetInfluences[t]=l.weights[t]})),t}))),void 0!==l.camera&&r.push(o.getDependency("camera",l.camera)),l.extensions&&l.extensions[a.KHR_LIGHTS_PUNCTUAL]&&void 0!==l.extensions[a.KHR_LIGHTS_PUNCTUAL].light&&r.push(o.getDependency("light",l.extensions[a.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(r)).then((function(r){var a;if((a=!0===l.isBone?new e.Bone:r.length>1?new e.Group:1===r.length?r[0]:new e.Object3D)!==r[0])for(var n=0,i=r.length;n<i;n++)a.add(r[n]);if(l.name&&(a.userData.name=l.name,a.name=e.PropertyBinding.sanitizeNodeName(l.name)),N(a,l),l.extensions&&H(s,a,l),void 0!==l.matrix){var c=new e.Matrix4;c.fromArray(l.matrix),a.applyMatrix4(c)}else void 0!==l.translation&&a.position.fromArray(l.translation),void 0!==l.rotation&&a.quaternion.fromArray(l.rotation),void 0!==l.scale&&a.scale.fromArray(l.scale);return o.associations.set(a,{type:"nodes",index:t}),a}))},j.prototype.loadScene=function(){function t(r,a,n,s){var o=n.nodes[r];return s.getDependency("node",r).then((function(t){return void 0===o.skin?t:s.getDependency("skin",o.skin).then((function(e){for(var t=[],a=0,n=(r=e).joints.length;a<n;a++)t.push(s.getDependency("node",r.joints[a]));return Promise.all(t)})).then((function(a){return t.traverse((function(t){if(t.isMesh){for(var n=[],s=[],o=0,i=a.length;o<i;o++){var c=a[o];if(c){n.push(c);var l=new e.Matrix4;void 0!==r.inverseBindMatrices&&l.fromArray(r.inverseBindMatrices.array,16*o),s.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',r.joints[o])}t.bind(new e.Skeleton(n,s),t.matrixWorld)}})),t}));var r})).then((function(e){a.add(e);var r=[];if(o.children)for(var i=o.children,c=0,l=i.length;c<l;c++){var u=i[c];r.push(t(u,e,n,s))}return Promise.all(r)}))}return function(r){var a=this.json,n=this.extensions,s=this.json.scenes[r],o=new e.Group;s.name&&(o.name=s.name),N(o,s),s.extensions&&H(n,o,s);for(var i=s.nodes||[],c=[],l=0,u=i.length;l<u;l++)c.push(t(i[l],o,a,this));return Promise.all(c).then((function(){return o}))}}(),t}(),o=function(t){e.Loader.call(this,t),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}};o.prototype=Object.assign(Object.create(e.Loader.prototype),{constructor:o,setDecoderPath:function(e){return this.decoderPath=e,this},setDecoderConfig:function(e){return this.decoderConfig=e,this},setWorkerLimit:function(e){return this.workerLimit=e,this},setVerbosity:function(){console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.")},setDrawMode:function(){console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.")},setSkipDequantization:function(){console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.")},load:function(t,r,a,n){var s=new e.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),"use-credentials"===this.crossOrigin&&s.setWithCredentials(!0),s.load(t,(e=>{var t={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,t).then(r).catch(n)}),a,n)},decodeDracoFile:function(e,t,r,a){var n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:a||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,n).then(t)},decodeGeometry:function(e,t){for(var r in t.attributeTypes){var a=t.attributeTypes[r];void 0!==a.BYTES_PER_ELEMENT&&(t.attributeTypes[r]=a.name)}var n,s=JSON.stringify(t);if(o.taskCache.has(e)){var i=o.taskCache.get(e);if(i.key===s)return i.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var c=this.workerNextTaskID++,l=e.byteLength,u=this._getWorker(c,l).then((r=>(n=r,new Promise(((r,a)=>{n._callbacks[c]={resolve:r,reject:a},n.postMessage({type:"decode",id:c,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return u.catch((()=>!0)).then((()=>{n&&c&&this._releaseTask(n,c)})),o.taskCache.set(e,{key:s,promise:u}),u},_createGeometry:function(t){var r=new e.BufferGeometry;t.index&&r.setIndex(new e.BufferAttribute(t.index.array,1));for(var a=0;a<t.attributes.length;a++){var n=t.attributes[a],s=n.name,o=n.array,i=n.itemSize;r.setAttribute(s,new e.BufferAttribute(o,i))}return r},_loadLibrary:function(t,r){var a=new e.FileLoader(this.manager);return a.setPath(this.decoderPath),a.setResponseType(r),new Promise(((e,r)=>{a.load(t,e,void 0,r)}))},preload:function(){return this._initDecoder(),this},_initDecoder:function(){if(this.decoderPending)return this.decoderPending;var e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{var r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);var a=o.DRACOWorker.toString(),n=["/* draco decoder */",r,"","/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n]))})),this.decoderPending},_getWorker:function(e,t){return this._initDecoder().then((()=>{var r;this.workerPool.length<this.workerLimit?((r=new Worker(this.workerSourceURL))._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(e){var t=e.data;switch(t.type){case"decode":r._callbacks[t.id].resolve(t);break;case"error":r._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},this.workerPool.push(r)):this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));return(r=this.workerPool[this.workerPool.length-1])._taskCosts[e]=t,r._taskLoad+=t,r}))},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))},dispose:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}),o.DRACOWorker=function(){var e,t;function r(e,t,r,a,n,s){var o,i,c=s.num_components(),l=r.num_points()*c;switch(n){case Float32Array:o=new e.DracoFloat32Array,t.GetAttributeFloatForAllPoints(r,s,o),i=new Float32Array(l);break;case Int8Array:o=new e.DracoInt8Array,t.GetAttributeInt8ForAllPoints(r,s,o),i=new Int8Array(l);break;case Int16Array:o=new e.DracoInt16Array,t.GetAttributeInt16ForAllPoints(r,s,o),i=new Int16Array(l);break;case Int32Array:o=new e.DracoInt32Array,t.GetAttributeInt32ForAllPoints(r,s,o),i=new Int32Array(l);break;case Uint8Array:o=new e.DracoUInt8Array,t.GetAttributeUInt8ForAllPoints(r,s,o),i=new Uint8Array(l);break;case Uint16Array:o=new e.DracoUInt16Array,t.GetAttributeUInt16ForAllPoints(r,s,o),i=new Uint16Array(l);break;case Uint32Array:o=new e.DracoUInt32Array,t.GetAttributeUInt32ForAllPoints(r,s,o),i=new Uint32Array(l);break;default:throw new Error("THREE.DRACOLoader: Unexpected attribute type.")}for(var u=0;u<l;u++)i[u]=o.GetValue(u);return e.destroy(o),{name:a,array:i,itemSize:c}}onmessage=function(a){var n=a.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var s=n.buffer,o=n.taskConfig;t.then((e=>{var t=e.draco,a=new t.Decoder,i=new t.DecoderBuffer;i.Init(new Int8Array(s),s.byteLength);try{var c=function(e,t,a,n){var s,o,i=n.attributeIDs,c=n.attributeTypes,l=t.GetEncodedGeometryType(a);if(l===e.TRIANGULAR_MESH)s=new e.Mesh,o=t.DecodeBufferToMesh(a,s);else{if(l!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");s=new e.PointCloud,o=t.DecodeBufferToPointCloud(a,s)}if(!o.ok()||0===s.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+o.error_msg());var u={index:null,attributes:[]};for(var d in i){var p,h,f=self[c[d]];if(n.useUniqueIDs)h=i[d],p=t.GetAttributeByUniqueId(s,h);else{if(-1===(h=t.GetAttributeId(s,e[i[d]])))continue;p=t.GetAttribute(s,h)}u.attributes.push(r(e,t,s,d,f,p))}if(l===e.TRIANGULAR_MESH){for(var m=s.num_faces(),g=new Uint32Array(3*m),v=new e.DracoInt32Array,y=0;y<m;++y){t.GetFaceFromMesh(s,y,v);for(var T=0;T<3;++T)g[3*y+T]=v.GetValue(T)}u.index={array:g,itemSize:1},e.destroy(v)}return e.destroy(s),u}(t,a,i,o),l=c.attributes.map((e=>e.array.buffer));c.index&&l.push(c.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:c},l)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{t.destroy(i),t.destroy(a)}}))}}},o.taskCache=new WeakMap,o.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},o.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},o.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},o.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};var i=function(t){e.CompressedTextureLoader.call(this,t)};i.prototype=Object.assign(Object.create(e.CompressedTextureLoader.prototype),{constructor:i,parse:function(t,r){var a={mipmaps:[],width:0,height:0,format:null,mipmapCount:1};function n(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}function s(e,t,r,a){for(var n=r*a*4,s=new Uint8Array(e,t,n),o=new Uint8Array(n),i=0,c=0,l=0;l<a;l++)for(var u=0;u<r;u++){var d=s[c],p=s[++c],h=s[++c],f=s[++c];c++,o[i]=h,o[++i]=p,o[++i]=d,o[++i]=f,i++}return o}var o,i=n("DXT1"),c=n("DXT3"),l=n("DXT5"),u=n("ETC1"),d=new Int32Array(t,0,31);if(542327876!==d[0])return console.error("THREE.DDSLoader.parse: Invalid magic number in DDS header."),a;if(4&!d[20])return console.error("THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code."),a;var p,h=d[21],f=!1;switch(h){case i:o=8,a.format=e.RGB_S3TC_DXT1_Format;break;case c:o=16,a.format=e.RGBA_S3TC_DXT3_Format;break;case l:o=16,a.format=e.RGBA_S3TC_DXT5_Format;break;case u:o=8,a.format=e.RGB_ETC1_Format;break;default:if(!(32===d[22]&&16711680&d[23]&&65280&d[24]&&255&d[25]&&4278190080&d[26]))return console.error("THREE.DDSLoader.parse: Unsupported FourCC code ",(p=h,String.fromCharCode(255&p,p>>8&255,p>>16&255,p>>24&255))),a;f=!0,o=64,a.format=e.RGBAFormat}a.mipmapCount=1,131072&d[2]&&!1!==r&&(a.mipmapCount=Math.max(1,d[7]));var m=d[28];if(a.isCubemap=!!(512&m),a.isCubemap&&(!(1024&m)||!(2048&m)||!(4096&m)||!(8192&m)||!(16384&m)||!(32768&m)))return console.error("THREE.DDSLoader.parse: Incomplete cubemap faces"),a;a.width=d[4],a.height=d[3];for(var g=d[1]+4,v=a.isCubemap?6:1,y=0;y<v;y++)for(var T=a.width,M=a.height,A=0;A<a.mipmapCount;A++){if(f)var R=(S=s(t,g,T,M)).length;else{R=Math.max(4,T)/4*Math.max(4,M)/4*o;var S=new Uint8Array(t,g,R)}var b={data:S,width:T,height:M};a.mipmaps.push(b),g+=R,T=Math.max(T>>1,1),M=Math.max(M>>1,1)}return a}});var c=function(e){function t(t){var a=e.call(this)||this;return a.needsRender=!0,t&&t.children.length&&a.add.apply(a,t.children),a.mixer=new r.AnimationMixer(a),a}return n(t,e),t.prototype.clone=function(){var t=e.prototype.clone.call(this,!0),a=new r.AnimationMixer(t);return t.mixer=a,t.needsRender=!0,t},t}(r.Group),l=function(e){function t(t){var r=e.call(this,t)||this;return r.ddsLoader=new i(t),r.dracoLoader=new o(t),r.dracoLoader.setDecoderPath("https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/"),r}return n(t,e),Object.defineProperty(t,"version",{get:function(){return"6.0.0-alpha.49"},enumerable:!1,configurable:!0}),t.prototype.load=function(t,r,a,n){return e.prototype.load.call(this,t,r,a,n)},t.prototype.parse=function(t,r,a,n){return e.prototype.parse.call(this,t,r,(function(e){var t=new c(e.scene),r=e.scenes.map((function(r){return r===e.scene?t:new c(r)}));a(Object.assign(e,{scene:t,scenes:r}))}),n)},t}(s);exports.DDSLoader=i,exports.DRACOLoader=o,exports.GLTFLoader=l,exports.GLTFObject=c,exports.THREEGLTFLoader=s;
|
package/line/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @realsee/five
|
|
3
3
|
*
|
|
4
|
-
* Generated: 2023-11-
|
|
5
|
-
* Version: 6.0.0-alpha.
|
|
4
|
+
* Generated: 2023-11-23
|
|
5
|
+
* Version: 6.0.0-alpha.49
|
|
6
6
|
*
|
|
7
7
|
* Terms:
|
|
8
8
|
* Realsee SDK License Agreement
|
|
@@ -257,4 +257,4 @@
|
|
|
257
257
|
* Agreement and all related documents shall be drafted in English.
|
|
258
258
|
*/
|
|
259
259
|
|
|
260
|
-
"use strict";function t(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("three")),n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)};function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var r=function(t){function n(){var n=t.call(this)||this;n.type="LineSegmentsGeometry";return n.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),n.setAttribute("position",new e.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),n.setAttribute("uv",new e.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),n}return i(n,t),n.prototype.applyMatrix4=function(t){var e=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),n.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},n.prototype.setPositions=function(t){var n;n=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var i=new e.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceStart",new e.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new e.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},n.prototype.setColors=function(t){var n;n=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var i=new e.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceColorStart",new e.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new e.InterleavedBufferAttribute(i,3,3)),this},n.prototype.fromWireframeGeometry=function(t){return this.setPositions(t.attributes.position.array),this},n.prototype.fromEdgesGeometry=function(t){return this.setPositions(t.attributes.position.array),this},n.prototype.fromMesh=function(t){return this.fromWireframeGeometry(new e.WireframeGeometry(t.geometry)),this},n.prototype.fromLineSegments=function(t){var n=t.geometry;if(n instanceof e.Geometry){var i=(new e.BufferGeometry).fromGeometry(n);this.setPositions(i.attributes.position.array)}else n instanceof e.BufferGeometry&&this.setPositions(n.attributes.position.array);return this},n.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new e.Box3);var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(void 0!==t&&void 0!==n){var i=new e.Box3;this.boundingBox.setFromBufferAttribute(t),i.setFromBufferAttribute(n),this.boundingBox.union(i)}},n.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new e.Sphere),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(void 0!==t&&void 0!==n){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var r=0,o=new e.Vector3,a=0,s=t.count;a<s;a++)o.fromBufferAttribute(t,a),r=Math.max(r,i.distanceToSquared(o)),o.fromBufferAttribute(n,a),r=Math.max(r,i.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},n.prototype.toJSON=function(){},n}(e.InstancedBufferGeometry);Object.assign(r.prototype,{isLineSegmentsGeometry:!0});var o={uniforms:e.UniformsUtils.merge([e.UniformsLib.common,e.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new e.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"},a=function(t){function n(n){var i=t.call(this,{uniforms:e.UniformsUtils.clone(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,clipping:!0})||this;return i.type="LineMaterial",i.dashed=!1,Object.defineProperties(i,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}}}),i.setValues(n),i}return i(n,t),n}(e.ShaderMaterial);Object.assign(a.prototype,{isLineMaterial:!0});var s=function(t){function n(e,n){var i=t.call(this)||this;return i.type="LineSegments2",i.geometry=void 0!==e?e:new r,i.material=void 0!==n?n:new a({color:16777215*Math.random()}),i}return i(n,t),n.prototype.computeLineDistances=function(){for(var t=this.geometry,n=t.attributes.instanceStart,i=t.attributes.instanceEnd,r=new Float32Array(2*n.count),o=new e.Vector3,a=new e.Vector3,s=0,u=0,c=n.count;s<c;s++,u+=2)o.fromBufferAttribute(n,s),a.fromBufferAttribute(i,s),r[u]=0===u?0:r[u-1],r[u+1]=r[u]+o.distanceTo(a);var l=new e.InstancedInterleavedBuffer(r,2,1);return t.setAttribute("instanceDistanceStart",new e.InterleavedBufferAttribute(l,1,0)),t.setAttribute("instanceDistanceEnd",new e.InterleavedBufferAttribute(l,1,1)),this},n.prototype.raycast=function(t,n){null===t.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var i=t.ray,r=t.camera,o=r.projectionMatrix,a=this.geometry,s=this.material,u=s.resolution,c=s.linewidth,l=a.attributes.instanceStart,f=a.attributes.instanceEnd,p=new e.Vector4,d=new e.Vector4,m=new e.Vector4,h=new e.Vector3,v=new e.Matrix4,y=new e.Line3,A=new e.Vector3;i.at(1,m),m.w=1,m.applyMatrix4(r.matrixWorldInverse),m.applyMatrix4(o),m.multiplyScalar(1/m.w),m.x*=u.x/2,m.y*=u.y/2,m.z=0,h.copy(m);var g=this.matrixWorld;v.multiplyMatrices(r.matrixWorldInverse,g);for(var b=0,w=l.count;b<w;b++){p.fromBufferAttribute(l,b),d.fromBufferAttribute(f,b),p.w=1,d.w=1,p.applyMatrix4(v),d.applyMatrix4(v),p.applyMatrix4(o),d.applyMatrix4(o),p.multiplyScalar(1/p.w),d.multiplyScalar(1/d.w);var S=p.z<-1&&d.z<-1,x=p.z>1&&d.z>1;if(!S&&!x){p.x*=u.x/2,p.y*=u.y/2,d.x*=u.x/2,d.y*=u.y/2,y.start.copy(p),y.start.z=0,y.end.copy(d),y.end.z=0;var B=y.closestPointToPointParameter(h,!0);y.at(B,A);var E=e.MathUtils.lerp(p.z,d.z,B),z=E>=-1&&E<=1,M=h.distanceTo(A)<.5*c;if(z&&M){y.start.fromBufferAttribute(l,b),y.end.fromBufferAttribute(f,b),y.start.applyMatrix4(g),y.end.applyMatrix4(g);var P=new e.Vector3,C=new e.Vector3;i.distanceSqToSegment(y.start,y.end,C,P),n.push({point:C,pointOnLine:P,distance:i.origin.distanceTo(C),object:this,faceIndex:b})}}}},n}(e.Mesh);Object.assign(s.prototype,{isLineSegments2:!0});var u=function(t){function e(e,n){var i=t.call(this,e,n)||this;return i.type="Line2",i}return i(e,t),e}(s);Object.assign(u.prototype,{isLine2:!0});var c=function(t){function n(){var e=t.call(this)||this;return e.type="LineGeometry",e}return i(n,t),n.prototype.setPositions=function(e){for(var n=e.length-3,i=new Float32Array(2*n),r=0;r<n;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return t.prototype.setPositions.call(this,i),this},n.prototype.setColors=function(e){for(var n=e.length-3,i=new Float32Array(2*n),r=0;r<n;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return t.prototype.setColors.call(this,i),this},n.prototype.fromLine=function(t){var n=t.geometry;if(n instanceof e.Geometry){var i=(new e.BufferGeometry).fromGeometry(n);this.setPositions(i.attributes.position.array)}else n instanceof e.BufferGeometry&&this.setPositions(n.attributes.position.array);return this},n.prototype.copy=function(){return this},n}(r);Object.assign(c.prototype,{isLineGeometry:!0});var l=14467195,f=null,p=function(t){function n(n,i){void 0===n&&(n=new e.Vector3),void 0===i&&(i=new e.Vector3);var r=t.call(this)||this;r.type="FiveLine",r.needsRender=!0;var o=new c,s=new a({color:l,linewidth:2,dashScale:20,dashed:!1});r.line=new u(o,s);var p=new e.BufferGeometry,d=new e.PointsMaterial({color:l,size:8,map:f||(f=(new e.TextureLoader).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==")),sizeAttenuation:!1,transparent:!0});return r.points=new e.Points(p,d),r.points.renderOrder=11,r.points.frustumCulled=!1,r.setPoints(n,i),r.add(r.line,r.points),r}return i(n,t),Object.defineProperty(n,"version",{get:function(){return"6.0.0-alpha.48"},enumerable:!1,configurable:!0}),n.prototype.setPoints=function(t,n){var i=[].concat(t.toArray(),n.toArray());this.points.geometry.setAttribute("position",new e.BufferAttribute(new Float32Array(i),3)),this.line.geometry.setPositions(i),this.line.computeLineDistances(),this.needsRender=!0},n.prototype.getPoints=function(){var t=this.points.geometry.attributes.position.array;return[new e.Vector3(t[0],t[1],t[2]),new e.Vector3(t[3],t[4],t[5])]},n.prototype.setMaterial=function(t){var e=this.line.material;for(var n in t)if(t.hasOwnProperty(n)){var i=t[n];"dashed"===n?(e.dashed=i,i?e.defines.USE_DASH="":delete e.defines.USE_DASH,e.needsUpdate=!0):e[n]=t[n]}this.needsRender=!0},n.prototype.setResolution=function(t,e){var n=this.line.material.resolution;n.x===t&&n.y===e||(n.set(t,e),this.needsRender=!0)},n}(e.Object3D);Object.assign(p.prototype,{isFiveLine:!0}),exports.Line=p,exports.LineGeometry=c,exports.LineMaterial=a,exports.LineSegmentsGeometry=r,exports.THREE_Line2=u,exports.THREE_LineSegments2=s;
|
|
260
|
+
"use strict";function t(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("three")),n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)};function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var r=function(t){function n(){var n=t.call(this)||this;n.type="LineSegmentsGeometry";return n.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),n.setAttribute("position",new e.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),n.setAttribute("uv",new e.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),n}return i(n,t),n.prototype.applyMatrix4=function(t){var e=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),n.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},n.prototype.setPositions=function(t){var n;n=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var i=new e.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceStart",new e.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new e.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},n.prototype.setColors=function(t){var n;n=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var i=new e.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceColorStart",new e.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new e.InterleavedBufferAttribute(i,3,3)),this},n.prototype.fromWireframeGeometry=function(t){return this.setPositions(t.attributes.position.array),this},n.prototype.fromEdgesGeometry=function(t){return this.setPositions(t.attributes.position.array),this},n.prototype.fromMesh=function(t){return this.fromWireframeGeometry(new e.WireframeGeometry(t.geometry)),this},n.prototype.fromLineSegments=function(t){var n=t.geometry;if(n instanceof e.Geometry){var i=(new e.BufferGeometry).fromGeometry(n);this.setPositions(i.attributes.position.array)}else n instanceof e.BufferGeometry&&this.setPositions(n.attributes.position.array);return this},n.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new e.Box3);var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(void 0!==t&&void 0!==n){var i=new e.Box3;this.boundingBox.setFromBufferAttribute(t),i.setFromBufferAttribute(n),this.boundingBox.union(i)}},n.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new e.Sphere),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(void 0!==t&&void 0!==n){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var r=0,o=new e.Vector3,a=0,s=t.count;a<s;a++)o.fromBufferAttribute(t,a),r=Math.max(r,i.distanceToSquared(o)),o.fromBufferAttribute(n,a),r=Math.max(r,i.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},n.prototype.toJSON=function(){},n}(e.InstancedBufferGeometry);Object.assign(r.prototype,{isLineSegmentsGeometry:!0});var o={uniforms:e.UniformsUtils.merge([e.UniformsLib.common,e.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new e.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"},a=function(t){function n(n){var i=t.call(this,{uniforms:e.UniformsUtils.clone(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,clipping:!0})||this;return i.type="LineMaterial",i.dashed=!1,Object.defineProperties(i,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}}}),i.setValues(n),i}return i(n,t),n}(e.ShaderMaterial);Object.assign(a.prototype,{isLineMaterial:!0});var s=function(t){function n(e,n){var i=t.call(this)||this;return i.type="LineSegments2",i.geometry=void 0!==e?e:new r,i.material=void 0!==n?n:new a({color:16777215*Math.random()}),i}return i(n,t),n.prototype.computeLineDistances=function(){for(var t=this.geometry,n=t.attributes.instanceStart,i=t.attributes.instanceEnd,r=new Float32Array(2*n.count),o=new e.Vector3,a=new e.Vector3,s=0,u=0,c=n.count;s<c;s++,u+=2)o.fromBufferAttribute(n,s),a.fromBufferAttribute(i,s),r[u]=0===u?0:r[u-1],r[u+1]=r[u]+o.distanceTo(a);var l=new e.InstancedInterleavedBuffer(r,2,1);return t.setAttribute("instanceDistanceStart",new e.InterleavedBufferAttribute(l,1,0)),t.setAttribute("instanceDistanceEnd",new e.InterleavedBufferAttribute(l,1,1)),this},n.prototype.raycast=function(t,n){null===t.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var i=t.ray,r=t.camera,o=r.projectionMatrix,a=this.geometry,s=this.material,u=s.resolution,c=s.linewidth,l=a.attributes.instanceStart,f=a.attributes.instanceEnd,p=new e.Vector4,d=new e.Vector4,m=new e.Vector4,h=new e.Vector3,v=new e.Matrix4,y=new e.Line3,A=new e.Vector3;i.at(1,m),m.w=1,m.applyMatrix4(r.matrixWorldInverse),m.applyMatrix4(o),m.multiplyScalar(1/m.w),m.x*=u.x/2,m.y*=u.y/2,m.z=0,h.copy(m);var g=this.matrixWorld;v.multiplyMatrices(r.matrixWorldInverse,g);for(var b=0,w=l.count;b<w;b++){p.fromBufferAttribute(l,b),d.fromBufferAttribute(f,b),p.w=1,d.w=1,p.applyMatrix4(v),d.applyMatrix4(v),p.applyMatrix4(o),d.applyMatrix4(o),p.multiplyScalar(1/p.w),d.multiplyScalar(1/d.w);var S=p.z<-1&&d.z<-1,x=p.z>1&&d.z>1;if(!S&&!x){p.x*=u.x/2,p.y*=u.y/2,d.x*=u.x/2,d.y*=u.y/2,y.start.copy(p),y.start.z=0,y.end.copy(d),y.end.z=0;var B=y.closestPointToPointParameter(h,!0);y.at(B,A);var E=e.MathUtils.lerp(p.z,d.z,B),z=E>=-1&&E<=1,M=h.distanceTo(A)<.5*c;if(z&&M){y.start.fromBufferAttribute(l,b),y.end.fromBufferAttribute(f,b),y.start.applyMatrix4(g),y.end.applyMatrix4(g);var P=new e.Vector3,C=new e.Vector3;i.distanceSqToSegment(y.start,y.end,C,P),n.push({point:C,pointOnLine:P,distance:i.origin.distanceTo(C),object:this,faceIndex:b})}}}},n}(e.Mesh);Object.assign(s.prototype,{isLineSegments2:!0});var u=function(t){function e(e,n){var i=t.call(this,e,n)||this;return i.type="Line2",i}return i(e,t),e}(s);Object.assign(u.prototype,{isLine2:!0});var c=function(t){function n(){var e=t.call(this)||this;return e.type="LineGeometry",e}return i(n,t),n.prototype.setPositions=function(e){for(var n=e.length-3,i=new Float32Array(2*n),r=0;r<n;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return t.prototype.setPositions.call(this,i),this},n.prototype.setColors=function(e){for(var n=e.length-3,i=new Float32Array(2*n),r=0;r<n;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return t.prototype.setColors.call(this,i),this},n.prototype.fromLine=function(t){var n=t.geometry;if(n instanceof e.Geometry){var i=(new e.BufferGeometry).fromGeometry(n);this.setPositions(i.attributes.position.array)}else n instanceof e.BufferGeometry&&this.setPositions(n.attributes.position.array);return this},n.prototype.copy=function(){return this},n}(r);Object.assign(c.prototype,{isLineGeometry:!0});var l=14467195,f=null,p=function(t){function n(n,i){void 0===n&&(n=new e.Vector3),void 0===i&&(i=new e.Vector3);var r=t.call(this)||this;r.type="FiveLine",r.needsRender=!0;var o=new c,s=new a({color:l,linewidth:2,dashScale:20,dashed:!1});r.line=new u(o,s);var p=new e.BufferGeometry,d=new e.PointsMaterial({color:l,size:8,map:f||(f=(new e.TextureLoader).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==")),sizeAttenuation:!1,transparent:!0});return r.points=new e.Points(p,d),r.points.renderOrder=11,r.points.frustumCulled=!1,r.setPoints(n,i),r.add(r.line,r.points),r}return i(n,t),Object.defineProperty(n,"version",{get:function(){return"6.0.0-alpha.49"},enumerable:!1,configurable:!0}),n.prototype.setPoints=function(t,n){var i=[].concat(t.toArray(),n.toArray());this.points.geometry.setAttribute("position",new e.BufferAttribute(new Float32Array(i),3)),this.line.geometry.setPositions(i),this.line.computeLineDistances(),this.needsRender=!0},n.prototype.getPoints=function(){var t=this.points.geometry.attributes.position.array;return[new e.Vector3(t[0],t[1],t[2]),new e.Vector3(t[3],t[4],t[5])]},n.prototype.setMaterial=function(t){var e=this.line.material;for(var n in t)if(t.hasOwnProperty(n)){var i=t[n];"dashed"===n?(e.dashed=i,i?e.defines.USE_DASH="":delete e.defines.USE_DASH,e.needsUpdate=!0):e[n]=t[n]}this.needsRender=!0},n.prototype.setResolution=function(t,e){var n=this.line.material.resolution;n.x===t&&n.y===e||(n.set(t,e),this.needsRender=!0)},n}(e.Object3D);Object.assign(p.prototype,{isFiveLine:!0}),exports.Line=p,exports.LineGeometry=c,exports.LineMaterial=a,exports.LineSegmentsGeometry=r,exports.THREE_Line2=u,exports.THREE_LineSegments2=s;
|
package/package.json
CHANGED
package/react/index.js
CHANGED
package/sticker/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @realsee/five
|
|
3
3
|
*
|
|
4
|
-
* Generated: 2023-11-
|
|
5
|
-
* Version: 6.0.0-alpha.
|
|
4
|
+
* Generated: 2023-11-23
|
|
5
|
+
* Version: 6.0.0-alpha.49
|
|
6
6
|
*
|
|
7
7
|
* Terms:
|
|
8
8
|
* Realsee SDK License Agreement
|
|
@@ -257,4 +257,4 @@
|
|
|
257
257
|
* Agreement and all related documents shall be drafted in English.
|
|
258
258
|
*/
|
|
259
259
|
|
|
260
|
-
"use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("three")),n=function(e,t){return n=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])},n(e,t)};var r=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),i=new Float32Array([0,0,1,0,0,1,1,1]),o=new Uint8Array([0,1,2,1,3,2]),a=new t.BufferGeometry;a.setAttribute("position",new t.BufferAttribute(r,3)),a.setAttribute("uv",new t.BufferAttribute(i,2)),a.setIndex(new t.BufferAttribute(o,1));var s=window,u=s.requestAnimationFrame||s.mozRequestAnimationFrame||s.webkitRequestAnimationFrame||s.msRequestAnimationFrame||function(e){return setTimeout(e,16)},c="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),p="undefined"!=typeof performance?function(){return c+performance.now()}:function(){return Date.now()};function f(e,t){var n=e.dispose;e.dispose=function(){t(),n.call(e)}}var d=function(e){function r(n,r,i){var o,s,c,d,l,m,v=this,g=new t.MeshBasicMaterial;if((v=e.call(this,a,g)||this)._needsRender=!1,v.scale.set(n,r,1),"string"==typeof i){g.transparent=/\.png$/.test(i);var h=new Image;h.src=i,h.crossOrigin="",i=h}if(i instanceof HTMLImageElement){var y=g.map=new t.Texture;y.wrapS=t.ClampToEdgeWrapping,y.wrapT=t.ClampToEdgeWrapping,y.minFilter=t.LinearFilter,y.encoding=t.sRGBEncoding,f(y,function(e,t){e.naturalWidth>0&&u((function(){return t()}));var n=function(){return t()};return e.addEventListener("load",n,!1),function(){return e.removeEventListener("load",n,!1)}}(i,(function(){y.image=i,y.needsUpdate=!0,v._needsRender=!0})))}else if(i instanceof HTMLCanvasElement)g.map=new t.CanvasTexture(i);else if(i instanceof HTMLVideoElement){var w=g.map=new t.VideoTexture(i);w.wrapS=t.ClampToEdgeWrapping,w.wrapT=t.ClampToEdgeWrapping,w.minFilter=t.LinearFilter,w.encoding=t.sRGBEncoding,f(w,(o=i,s=function(){v._needsRender=!0},c=p(),d=!1,l=function(){d=!0,s(),p()-c<3e3?u(l):d=!1},m=function(){c=p(),!1===d&&l()},o.addEventListener("timeupdate",m,!1),function(){o.removeEventListener("timeupdate",m,!1),d=!1}))}return v}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(r,e),Object.defineProperty(r,"version",{get:function(){return"6.0.0-alpha.
|
|
260
|
+
"use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("three")),n=function(e,t){return n=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])},n(e,t)};var r=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),i=new Float32Array([0,0,1,0,0,1,1,1]),o=new Uint8Array([0,1,2,1,3,2]),a=new t.BufferGeometry;a.setAttribute("position",new t.BufferAttribute(r,3)),a.setAttribute("uv",new t.BufferAttribute(i,2)),a.setIndex(new t.BufferAttribute(o,1));var s=window,u=s.requestAnimationFrame||s.mozRequestAnimationFrame||s.webkitRequestAnimationFrame||s.msRequestAnimationFrame||function(e){return setTimeout(e,16)},c="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),p="undefined"!=typeof performance?function(){return c+performance.now()}:function(){return Date.now()};function f(e,t){var n=e.dispose;e.dispose=function(){t(),n.call(e)}}var d=function(e){function r(n,r,i){var o,s,c,d,l,m,v=this,g=new t.MeshBasicMaterial;if((v=e.call(this,a,g)||this)._needsRender=!1,v.scale.set(n,r,1),"string"==typeof i){g.transparent=/\.png$/.test(i);var h=new Image;h.src=i,h.crossOrigin="",i=h}if(i instanceof HTMLImageElement){var y=g.map=new t.Texture;y.wrapS=t.ClampToEdgeWrapping,y.wrapT=t.ClampToEdgeWrapping,y.minFilter=t.LinearFilter,y.encoding=t.sRGBEncoding,f(y,function(e,t){e.naturalWidth>0&&u((function(){return t()}));var n=function(){return t()};return e.addEventListener("load",n,!1),function(){return e.removeEventListener("load",n,!1)}}(i,(function(){y.image=i,y.needsUpdate=!0,v._needsRender=!0})))}else if(i instanceof HTMLCanvasElement)g.map=new t.CanvasTexture(i);else if(i instanceof HTMLVideoElement){var w=g.map=new t.VideoTexture(i);w.wrapS=t.ClampToEdgeWrapping,w.wrapT=t.ClampToEdgeWrapping,w.minFilter=t.LinearFilter,w.encoding=t.sRGBEncoding,f(w,(o=i,s=function(){v._needsRender=!0},c=p(),d=!1,l=function(){d=!0,s(),p()-c<3e3?u(l):d=!1},m=function(){c=p(),!1===d&&l()},o.addEventListener("timeupdate",m,!1),function(){o.removeEventListener("timeupdate",m,!1),d=!1}))}return v}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(r,e),Object.defineProperty(r,"version",{get:function(){return"6.0.0-alpha.49"},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"needsRender",{get:function(){return this._needsRender},set:function(e){this._needsRender=e,!0===e&&this.material.map&&(this.material.map.needsUpdate=!0)},enumerable:!1,configurable:!0}),r.prototype.setSize=function(e,t){this.scale.set(e,t,1),this._needsRender=!0},r.prototype.setTransparent=function(e){this.material.transparent=e,this._needsRender=!0},r.prototype.locationWithIntersection=function(e,t){void 0===t&&(t=.005);var n=e.point,r=e.face;this.position.copy(n),r&&(this.position.add(r.normal.clone().setLength(t)),this.lookAt(n.clone().add(r.normal))),this._needsRender=!0},r.prototype.dispose=function(){var e;null===(e=this.material.map)||void 0===e||e.dispose(),this.material.dispose()},r}(t.Mesh);exports.Sticker=d;
|