@realsee/five 5.0.0-alpha.152 → 5.0.0-alpha.154
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/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.Camera.html +1 -1
- package/docs/classes/five.Clipper.html +1 -1
- package/docs/classes/five.Five.html +1 -1
- package/docs/classes/five.InternalWebGLRenderer.html +1 -1
- package/docs/classes/five.IntersectMesh.html +1 -1
- package/docs/classes/five.LegacyPanoCircleMesh.html +1 -1
- package/docs/classes/five.Model.html +1 -1
- package/docs/classes/five.NetworkSubscribe.html +1 -1
- package/docs/classes/five.PBMContainer.html +1 -1
- package/docs/classes/five.PBMGroup.html +1 -1
- package/docs/classes/five.PBMMaterial.html +1 -1
- package/docs/classes/five.PBMMesh.html +1 -1
- package/docs/classes/five.PanoCircleMesh.html +1 -1
- package/docs/classes/five.PanoCircleMeshDark.html +1 -1
- package/docs/classes/five.PanoCircleMeshSolid.html +1 -1
- package/docs/classes/five.Scene.html +1 -1
- package/docs/classes/five.Subscribe.html +1 -1
- package/docs/classes/five.TextureLoader.html +1 -1
- package/docs/classes/five.Tile3D.html +1 -1
- package/docs/classes/five.Tile3DModel.html +1 -1
- package/docs/classes/five.TileBoundingSphere.html +1 -1
- package/docs/classes/five.TileCacheNode.html +1 -1
- package/docs/classes/five.TileCubeTextureTarget.html +1 -1
- package/docs/classes/five.TileCullingVolume.html +1 -1
- package/docs/classes/five.TileOrientedBoundingBox.html +1 -1
- package/docs/classes/five.TilePlane.html +1 -1
- package/docs/classes/five.TileRequestScheduler.html +1 -1
- package/docs/classes/five.Tileset3D.html +1 -1
- package/docs/classes/five.Tileset3DTraverser.html +1 -1
- package/docs/classes/five.TilesetCache.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/server.BVH.html +1 -1
- package/docs/classes/server.BVHIntersect.html +1 -1
- package/docs/classes/server.BVHNode.html +1 -1
- package/docs/classes/server.BVHVector3.html +1 -1
- package/docs/classes/server.Model.html +1 -1
- package/docs/classes/server.PBMGroup.html +1 -1
- package/docs/classes/server.PBMMesh.html +1 -1
- package/docs/classes/sticker.Sticker.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/five.AddableObject.html +1 -1
- package/docs/interfaces/five.AnimationFrame.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 +1 -1
- package/docs/interfaces/five.FiveInitArgs.html +1 -1
- package/docs/interfaces/five.FloorplanControllerCustomInitArgs.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.IntersectMeshInterface.html +1 -1
- package/docs/interfaces/five.Intersection.html +1 -1
- package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ModelEventCallback.html +1 -1
- package/docs/interfaces/five.MovePanoOptions.html +1 -1
- package/docs/interfaces/five.NetworkOptions.html +1 -1
- package/docs/interfaces/five.PBMPanoPicture.html +1 -1
- package/docs/interfaces/five.PBMParameters.html +1 -1
- package/docs/interfaces/five.PanoCircleMeshInterface.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.Scissor.html +1 -1
- package/docs/interfaces/five.State.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.TextureOptions.html +1 -1
- package/docs/interfaces/five.Tile3DModelLoaderOptions.html +1 -1
- package/docs/interfaces/five.TileBoundingVolume.html +1 -1
- package/docs/interfaces/five.TileContent.html +1 -1
- package/docs/interfaces/five.TileCubeNode.html +1 -1
- package/docs/interfaces/five.TileCubeTree.html +1 -1
- package/docs/interfaces/five.Tileset3dOptions.html +1 -1
- package/docs/interfaces/five.TilesetJSON.html +1 -1
- package/docs/interfaces/five.TilesetJSONNode.html +1 -1
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.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.WorkModelTiles.html +1 -1
- package/docs/interfaces/five.WorkObserver.html +1 -1
- package/docs/interfaces/five.WorkTile.html +1 -1
- package/docs/interfaces/five.WorkVideo.html +1 -1
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.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 +1 -1
- package/docs/interfaces/react.PropTypeOfFiveFeatures.html +1 -1
- package/docs/interfaces/server.Intersection.html +1 -1
- package/docs/interfaces/server.ModelEventCallback.html +1 -1
- package/docs/interfaces/sticker.IntersectionLike.html +1 -1
- package/docs/interfaces/vue.FiveActionVueCallbacks.html +1 -1
- package/docs/modules/five.SubscribeMixinType.html +1 -1
- package/docs/modules/five.html +1 -1
- 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/server.html +1 -1
- package/docs/modules/sticker.html +1 -1
- package/docs/modules/vue.html +1 -1
- package/docs/modules.html +1 -1
- package/five/index.js +3 -3
- package/gltf-loader/index.js +2 -2
- package/line/index.js +2 -2
- package/package.json +1 -1
- package/react/index.d.ts +37 -1
- package/react/index.js +2 -2
- package/server/index.js +1 -1
- package/sticker/index.js +2 -2
- package/umd/five-gltf-loader.js +1 -1
- package/umd/five-line.js +1 -1
- package/umd/five-react.js +1 -1
- package/umd/five-sticker.js +1 -1
- package/umd/five.js +1 -1
- package/vue/index.js +1 -1
package/gltf-loader/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @realsee/five
|
|
3
3
|
*
|
|
4
4
|
* Generated: 2022-09-22
|
|
5
|
-
* Version: 5.0.0-alpha.
|
|
5
|
+
* Version: 5.0.0-alpha.154
|
|
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("tslib"),t=require("three");function r(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 a=r(t),s=function(){function e(e){t.Loader.call(this,e),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={}}}}e.prototype=Object.assign(Object.create(t.Loader.prototype),{constructor:e,load:function(e,r,a,s){var n,o=this;n=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:t.LoaderUtils.extractUrlBase(e),o.manager.itemStart(e);var i=function(t){s?s(t):console.error(t),o.manager.itemError(e),o.manager.itemEnd(e)},l=new t.FileLoader(o.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),"use-credentials"===o.crossOrigin&&l.setWithCredentials(!0),l.load(e,(function(t){try{o.parse(t,n,(function(t){r(t),o.manager.itemEnd(e)}),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(e,r,c,u){var f,v={};if("string"==typeof e)f=e;else if(t.LoaderUtils.decodeText(new Uint8Array(e,0,4))===l){try{v[a.KHR_BINARY_GLTF]=new d(e)}catch(e){return void(u&&u(e))}f=v[a.KHR_BINARY_GLTF].content}else f=t.LoaderUtils.decodeText(new Uint8Array(e));var y=JSON.parse(f);if(void 0===y.asset||y.asset.version[0]<2)u&&u(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{if(y.extensionsUsed)for(var T=0;T<y.extensionsUsed.length;++T){var M=y.extensionsUsed[T],b=y.extensionsRequired||[];switch(M){case a.KHR_LIGHTS_PUNCTUAL:v[M]=new n(y);break;case a.KHR_MATERIALS_CLEARCOAT:v[M]=new i;break;case a.KHR_MATERIALS_UNLIT:v[M]=new o;break;case a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:v[M]=new m;break;case a.KHR_DRACO_MESH_COMPRESSION:v[M]=new p(y,this.dracoLoader);break;case a.MSFT_TEXTURE_DDS:v[M]=new s(this.ddsLoader);break;case a.KHR_TEXTURE_TRANSFORM:v[M]=new h;break;case a.KHR_MESH_QUANTIZATION:v[M]=new g;break;default:b.indexOf(M)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+M+'".')}}var A=new B(y,v,{path:r||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});A.fileLoader.setRequestHeader(this.requestHeader),A.parse(c,u)}}});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_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function s(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 n(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}n.prototype.loadLight=function(e){var r,a=this.lightDefs[e],s=new t.Color(16777215);void 0!==a.color&&s.fromArray(a.color);var n=void 0!==a.range?a.range:0;switch(a.type){case"directional":(r=new t.DirectionalLight(s)).target.position.set(0,0,-1),r.add(r.target);break;case"point":(r=new t.PointLight(s)).distance=n;break;case"spot":(r=new t.SpotLight(s)).distance=n,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_"+e,Promise.resolve(r)},o.prototype.getMaterialType=function(){return t.MeshBasicMaterial},o.prototype.extendParams=function(e,r,a){var s=[];e.color=new t.Color(1,1,1),e.opacity=1;var n=r.pbrMetallicRoughness;if(n){if(Array.isArray(n.baseColorFactor)){var o=n.baseColorFactor;e.color.fromArray(o),e.opacity=o[3]}void 0!==n.baseColorTexture&&s.push(a.assignTexture(e,"map",n.baseColorTexture))}return Promise.all(s)},i.prototype.getMaterialType=function(){return t.MeshPhysicalMaterial},i.prototype.extendParams=function(e,r,a){var s=[],n=r.extensions[this.name];if(void 0!==n.clearcoatFactor&&(e.clearcoat=n.clearcoatFactor),void 0!==n.clearcoatTexture&&s.push(a.assignTexture(e,"clearcoatMap",n.clearcoatTexture)),void 0!==n.clearcoatRoughnessFactor&&(e.clearcoatRoughness=n.clearcoatRoughnessFactor),void 0!==n.clearcoatRoughnessTexture&&s.push(a.assignTexture(e,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture)),void 0!==n.clearcoatNormalTexture&&(s.push(a.assignTexture(e,"clearcoatNormalMap",n.clearcoatNormalTexture)),void 0!==n.clearcoatNormalTexture.scale)){var o=n.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new t.Vector2(o,o)}return Promise.all(s)};var l="glTF",c=1313821514,u=5130562;function d(e){this.name=a.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(e,0,12);if(this.header={magic:t.LoaderUtils.decodeText(new Uint8Array(e.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 s=new DataView(e,12),n=0;n<s.byteLength;){var o=s.getUint32(n,!0);n+=4;var i=s.getUint32(n,!0);if(n+=4,i===c){var d=new Uint8Array(e,12+n,o);this.content=t.LoaderUtils.decodeText(d)}else if(i===u){var p=12+n;this.body=e.slice(p,p+o)}n+=o}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function p(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 h(){this.name=a.KHR_TEXTURE_TRANSFORM}function f(e){t.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"),s=["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"),n=["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 t.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>",s),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_fragment>",n),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(e)}function m(){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 f},extendParams:function(e,r,a){var s=r.extensions[this.name];e.color=new t.Color(1,1,1),e.opacity=1;var n=[];if(Array.isArray(s.diffuseFactor)){var o=s.diffuseFactor;e.color.fromArray(o),e.opacity=o[3]}if(void 0!==s.diffuseTexture&&n.push(a.assignTexture(e,"map",s.diffuseTexture)),e.emissive=new t.Color(0,0,0),e.glossiness=void 0!==s.glossinessFactor?s.glossinessFactor:1,e.specular=new t.Color(1,1,1),Array.isArray(s.specularFactor)&&e.specular.fromArray(s.specularFactor),void 0!==s.specularGlossinessTexture){var i=s.specularGlossinessTexture;n.push(a.assignTexture(e,"glossinessMap",i)),n.push(a.assignTexture(e,"specularMap",i))}return Promise.all(n)},createMaterial:function(e){var r=new f(e);return r.fog=!0,r.color=e.color,r.map=void 0===e.map?null:e.map,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=void 0===e.aoMap?null:e.aoMap,r.aoMapIntensity=1,r.emissive=e.emissive,r.emissiveIntensity=1,r.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,r.bumpMap=void 0===e.bumpMap?null:e.bumpMap,r.bumpScale=1,r.normalMap=void 0===e.normalMap?null:e.normalMap,r.normalMapType=t.TangentSpaceNormalMap,e.normalScale&&(r.normalScale=e.normalScale),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=void 0===e.specularMap?null:e.specularMap,r.specular=e.specular,r.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,r.glossiness=e.glossiness,r.alphaMap=null,r.envMap=void 0===e.envMap?null:e.envMap,r.envMapIntensity=1,r.refractionRatio=.98,r}}}function g(){this.name=a.KHR_MESH_QUANTIZATION}function v(e,r,a,s){t.Interpolant.call(this,e,r,a,s)}p.prototype.decodePrimitive=function(e,t){var r=this.json,a=this.dracoLoader,s=e.extensions[this.name].bufferView,n=e.extensions[this.name].attributes,o={},i={},l={};for(var c in n){var u=E[c]||c.toLowerCase();o[u]=n[c]}for(c in e.attributes){u=E[c]||c.toLowerCase();if(void 0!==n[c]){var d=r.accessors[e.attributes[c]],p=L[d.componentType];l[u]=p,i[u]=!0===d.normalized}}return t.getDependency("bufferView",s).then((function(e){return new Promise((function(t){a.decodeDracoFile(e,(function(e){for(var r in e.attributes){var a=e.attributes[r],s=i[r];void 0!==s&&(a.normalized=s)}t(e)}),o,l)}))}))},h.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},f.prototype=Object.create(t.MeshStandardMaterial.prototype),f.prototype.constructor=f,f.prototype.copy=function(e){return t.MeshStandardMaterial.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},v.prototype=Object.create(t.Interpolant.prototype),v.prototype.constructor=v,v.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,r=this.sampleValues,a=this.valueSize,s=e*a*3+a,n=0;n!==a;n++)t[n]=r[s+n];return t},v.prototype.beforeStart_=v.prototype.copySampleValue_,v.prototype.afterEnd_=v.prototype.copySampleValue_,v.prototype.interpolate_=function(e,t,r,a){for(var s=this.resultBuffer,n=this.sampleValues,o=this.valueSize,i=2*o,l=3*o,c=a-t,u=(r-t)/c,d=u*u,p=d*u,h=e*l,f=h-l,m=-2*p+3*d,g=p-d,v=1-m,y=g-d+u,T=0;T!==o;T++){var M=n[f+T+o],b=n[f+T+i]*c,A=n[h+T+o],R=n[h+T]*c;s[T]=v*M+y*b+m*A+g*R}return s};var y=0,T=1,M=2,b=3,A=4,R=5,w=6,L={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},S={9728:t.NearestFilter,9729:t.LinearFilter,9984:t.NearestMipmapNearestFilter,9985:t.LinearMipmapNearestFilter,9986:t.NearestMipmapLinearFilter,9987:t.LinearMipmapLinearFilter},_={33071:t.ClampToEdgeWrapping,33648:t.MirroredRepeatWrapping,10497:t.RepeatWrapping},x={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},E={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:t.InterpolateLinear,STEP:t.InterpolateDiscrete},I="OPAQUE",P="MASK",O="BLEND",U={"image/png":t.RGBAFormat,"image/jpeg":t.RGBFormat};function F(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 k(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 H(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 s=t.extras.targetNames;if(e.morphTargetInfluences.length===s.length){e.morphTargetDictionary={};for(r=0,a=s.length;r<a;r++)e.morphTargetDictionary[s[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function N(e){for(var t="",r=Object.keys(e).sort(),a=0,s=r.length;a<s;a++)t+=r[a]+":"+e[r[a]]+";";return t}function B(e,a,s){this.json=e||{},this.extensions=a||{},this.options=s||{},this.cache=new r,this.associations=new Map,this.primitiveCache={},this.textureLoader=new t.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new t.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function j(e,r,a){var s=r.attributes,n=[];function o(t,r){return a.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}for(var i in s){var l=E[i]||i.toLowerCase();l in e.attributes||n.push(o(s[i],l))}if(void 0!==r.indices&&!e.index){var c=a.getDependency("accessor",r.indices).then((function(t){e.setIndex(t)}));n.push(c)}return H(e,r),function(e,r,a){var s=r.attributes,n=new t.Box3;if(void 0!==s.POSITION){var o=(h=a.json.accessors[s.POSITION]).min,i=h.max;if(void 0!==o&&void 0!==i){n.set(new t.Vector3(o[0],o[1],o[2]),new t.Vector3(i[0],i[1],i[2]));var l=r.targets;if(void 0!==l){for(var c=new t.Vector3,u=new t.Vector3,d=0,p=l.length;d<p;d++){var h,f=l[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]))),c.max(u)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}n.expandByVector(c)}e.boundingBox=n;var m=new t.Sphere;n.getCenter(m.center),m.radius=n.min.distanceTo(n.max)/2,e.boundingSphere=m}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,r,a),Promise.all(n).then((function(){return void 0!==r.targets?function(e,t,r){for(var a=!1,s=!1,n=0,o=t.length;n<o&&(void 0!==(c=t[n]).POSITION&&(a=!0),void 0!==c.NORMAL&&(s=!0),!a||!s);n++);if(!a&&!s)return Promise.resolve(e);var i=[],l=[];for(n=0,o=t.length;n<o;n++){var c=t[n];if(a){var u=void 0!==c.POSITION?r.getDependency("accessor",c.POSITION):e.attributes.position;i.push(u)}s&&(u=void 0!==c.NORMAL?r.getDependency("accessor",c.NORMAL):e.attributes.normal,l.push(u))}return Promise.all([Promise.all(i),Promise.all(l)]).then((function(t){var r=t[0],n=t[1];return a&&(e.morphAttributes.position=r),s&&(e.morphAttributes.normal=n),e.morphTargetsRelative=!0,e}))}(e,r.targets,a):e}))}function K(e,r){var a=e.getIndex();if(null===a){var s=[],n=e.getAttribute("position");if(void 0===n)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var o=0;o<n.count;o++)s.push(o);e.setIndex(s),a=e.getIndex()}var i=a.count-2,l=[];if(r===t.TriangleFanDrawMode)for(o=1;o<=i;o++)l.push(a.getX(0)),l.push(a.getX(o)),l.push(a.getX(o+1));else for(o=0;o<i;o++)o%2==0?(l.push(a.getX(o)),l.push(a.getX(o+1)),l.push(a.getX(o+2))):(l.push(a.getX(o+2)),l.push(a.getX(o+1)),l.push(a.getX(o)));l.length/3!==i&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var c=e.clone();return c.setIndex(l),c}return B.prototype.parse=function(e,t){var r=this,a=this.json,s=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var n={scene:t[0][a.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:a.asset,parser:r,userData:{}};k(s,n,a),H(n,a),e(n)})).catch(t)},B.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],a={},s={},n=0,o=t.length;n<o;n++)for(var i=t[n].joints,l=0,c=i.length;l<c;l++)e[i[l]].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]=s[p.mesh]=0),a[p.mesh]++,void 0!==p.skin&&(r[p.mesh].isSkinnedMesh=!0))}this.json.meshReferences=a,this.json.meshUses=s},B.prototype.getDependency=function(e,t){var r=e+":"+t,s=this.cache.get(r);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this.loadNode(t);break;case"mesh":s=this.loadMesh(t);break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this.loadBufferView(t);break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this.loadMaterial(t);break;case"texture":s=this.loadTexture(t);break;case"skin":s=this.loadSkin(t);break;case"animation":s=this.loadAnimation(t);break;case"camera":s=this.loadCamera(t);break;case"light":s=this.extensions[a.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,s)}return s},B.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},B.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 s=this.options;return new Promise((function(e,a){r.load(F(t.uri,s.path),e,void 0,(function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},B.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)}))},B.prototype.loadAccessor=function(e){var r=this,a=this.json,s=this.json.accessors[e];if(void 0===s.bufferView&&void 0===s.sparse)return Promise.resolve(null);var n=[];return void 0!==s.bufferView?n.push(this.getDependency("bufferView",s.bufferView)):n.push(null),void 0!==s.sparse&&(n.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),n.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(n).then((function(e){var n,o,i=e[0],l=x[s.type],c=L[s.componentType],u=c.BYTES_PER_ELEMENT,d=u*l,p=s.byteOffset||0,h=void 0!==s.bufferView?a.bufferViews[s.bufferView].byteStride:void 0,f=!0===s.normalized;if(h&&h!==d){var m=Math.floor(p/h),g="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+m+":"+s.count,v=r.cache.get(g);v||(n=new c(i,m*h,s.count*h/u),v=new t.InterleavedBuffer(n,h/u),r.cache.add(g,v)),o=new t.InterleavedBufferAttribute(v,l,p%h/u,f)}else n=null===i?new c(s.count*l):new c(i,p,s.count*l),o=new t.BufferAttribute(n,l,f);if(void 0!==s.sparse){var y=x.SCALAR,T=L[s.sparse.indices.componentType],M=s.sparse.indices.byteOffset||0,b=s.sparse.values.byteOffset||0,A=new T(e[1],M,s.sparse.count*y),R=new c(e[2],b,s.sparse.count*l);null!==i&&(o=new t.BufferAttribute(o.array.slice(),o.itemSize,o.normalized));for(var w=0,S=A.length;w<S;w++){var _=A[w];if(o.setX(_,R[w*l]),l>=2&&o.setY(_,R[w*l+1]),l>=3&&o.setZ(_,R[w*l+2]),l>=4&&o.setW(_,R[w*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o}))},B.prototype.loadTexture=function(e){var r,s=this,n=this.json,o=this.options,i=this.textureLoader,l=self.URL||self.webkitURL,c=n.textures[e],u=c.extensions||{},d=(r=u[a.MSFT_TEXTURE_DDS]?n.images[u[a.MSFT_TEXTURE_DDS].source]:n.images[c.source]).uri,p=!1;return void 0!==r.bufferView&&(d=s.getDependency("bufferView",r.bufferView).then((function(e){p=!0;var t=new Blob([e],{type:r.mimeType});return d=l.createObjectURL(t)}))),Promise.resolve(d).then((function(e){var t=o.manager.getHandler(e);return t||(t=u[a.MSFT_TEXTURE_DDS]?s.extensions[a.MSFT_TEXTURE_DDS].ddsLoader:i),new Promise((function(r,a){t.load(F(e,o.path),r,void 0,a)}))})).then((function(a){!0===p&&l.revokeObjectURL(d),a.flipY=!1,c.name&&(a.name=c.name),r.mimeType in U&&(a.format=U[r.mimeType]);var o=(n.samplers||{})[c.sampler]||{};return a.magFilter=S[o.magFilter]||t.LinearFilter,a.minFilter=S[o.minFilter]||t.LinearMipmapLinearFilter,a.wrapS=_[o.wrapS]||t.RepeatWrapping,a.wrapT=_[o.wrapT]||t.RepeatWrapping,s.associations.set(a,{type:"textures",index:e}),a}))},B.prototype.assignTexture=function(e,r,s){var n=this;return this.getDependency("texture",s.index).then((function(o){if(!o.isCompressedTexture)switch(r){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":o.format=t.RGBFormat}if(void 0===s.texCoord||0==s.texCoord||"aoMap"===r&&1==s.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+s.texCoord+" for texture "+r+" not yet supported."),n.extensions[a.KHR_TEXTURE_TRANSFORM]){var i=void 0!==s.extensions?s.extensions[a.KHR_TEXTURE_TRANSFORM]:void 0;if(i){var l=this.associations.get(o);o=n.extensions[a.KHR_TEXTURE_TRANSFORM].extendTexture(o,i),this.associations.set(o,l)}}e[r]=o}))},B.prototype.assignFinalMaterial=function(e){var r=e.geometry,a=e.material,s=void 0!==r.attributes.tangent,n=void 0!==r.attributes.color,o=void 0===r.attributes.normal,i=!0===e.isSkinnedMesh,l=Object.keys(r.morphAttributes).length>0,c=l&&void 0!==r.morphAttributes.normal;if(e.isPoints){var u="PointsMaterial:"+a.uuid,d=this.cache.get(u);d||(d=new t.PointsMaterial,t.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(e.isLine){u="LineBasicMaterial:"+a.uuid;var p=this.cache.get(u);p||(p=new t.LineBasicMaterial,t.Material.prototype.copy.call(p,a),p.color.copy(a.color),this.cache.add(u,p)),a=p}if(s||n||o||i||l){u="ClonedMaterial:"+a.uuid+":";a.isGLTFSpecularGlossinessMaterial&&(u+="specular-glossiness:"),i&&(u+="skinning:"),s&&(u+="vertex-tangents:"),n&&(u+="vertex-colors:"),o&&(u+="flat-shading:"),l&&(u+="morph-targets:"),c&&(u+="morph-normals:");var h=this.cache.get(u);h||(h=a.clone(),i&&(h.skinning=!0),s&&(h.vertexTangents=!0),n&&(h.vertexColors=!0),o&&(h.flatShading=!0),l&&(h.morphTargets=!0),c&&(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&&!s&&(a.normalScale.y=-a.normalScale.y),a.clearcoatNormalScale&&!s&&(a.clearcoatNormalScale.y=-a.clearcoatNormalScale.y),e.material=a},B.prototype.loadMaterial=function(e){var r,s=this,n=this.json,o=this.extensions,i=n.materials[e],l={},c=i.extensions||{},u=[];if(c[a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var d=o[a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];r=d.getMaterialType(),u.push(d.extendParams(l,i,s))}else if(c[a.KHR_MATERIALS_UNLIT]){var p=o[a.KHR_MATERIALS_UNLIT];r=p.getMaterialType(),u.push(p.extendParams(l,i,s))}else{r=t.MeshStandardMaterial;var h=i.pbrMetallicRoughness||{};if(l.color=new t.Color(1,1,1),l.opacity=1,Array.isArray(h.baseColorFactor)){var m=h.baseColorFactor;l.color.fromArray(m),l.opacity=m[3]}void 0!==h.baseColorTexture&&u.push(s.assignTexture(l,"map",h.baseColorTexture)),l.metalness=void 0!==h.metallicFactor?h.metallicFactor:1,l.roughness=void 0!==h.roughnessFactor?h.roughnessFactor:1,void 0!==h.metallicRoughnessTexture&&(u.push(s.assignTexture(l,"metalnessMap",h.metallicRoughnessTexture)),u.push(s.assignTexture(l,"roughnessMap",h.metallicRoughnessTexture)))}!0===i.doubleSided&&(l.side=t.DoubleSide);var g=i.alphaMode||I;if(g===O?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,g===P&&(l.alphaTest=void 0!==i.alphaCutoff?i.alphaCutoff:.5)),void 0!==i.normalTexture&&r!==t.MeshBasicMaterial&&(u.push(s.assignTexture(l,"normalMap",i.normalTexture)),l.normalScale=new t.Vector2(1,1),void 0!==i.normalTexture.scale&&l.normalScale.set(i.normalTexture.scale,i.normalTexture.scale)),void 0!==i.occlusionTexture&&r!==t.MeshBasicMaterial&&(u.push(s.assignTexture(l,"aoMap",i.occlusionTexture)),void 0!==i.occlusionTexture.strength&&(l.aoMapIntensity=i.occlusionTexture.strength)),void 0!==i.emissiveFactor&&r!==t.MeshBasicMaterial&&(l.emissive=(new t.Color).fromArray(i.emissiveFactor)),void 0!==i.emissiveTexture&&r!==t.MeshBasicMaterial&&u.push(s.assignTexture(l,"emissiveMap",i.emissiveTexture)),c[a.KHR_MATERIALS_CLEARCOAT]){var v=o[a.KHR_MATERIALS_CLEARCOAT];r=v.getMaterialType(),u.push(v.extendParams(l,{extensions:c},s))}return Promise.all(u).then((function(){var n;return n=r===f?o[a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(l):new r(l),i.name&&(n.name=i.name),n.map&&(n.map.encoding=t.sRGBEncoding),n.emissiveMap&&(n.emissiveMap.encoding=t.sRGBEncoding),H(n,i),s.associations.set(n,{type:"materials",index:e}),i.extensions&&k(o,n,i),n}))},B.prototype.loadGeometries=function(e){var r=this,s=this.extensions,n=this.primitiveCache;function o(e){return s[a.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,r).then((function(t){return j(t,e,r)}))}for(var i,l,c=[],u=0,d=e.length;u<d;u++){var p,h=e[u],f=(l=void 0,(l=(i=h).extensions&&i.extensions[a.KHR_DRACO_MESH_COMPRESSION])?"draco:"+l.bufferView+":"+l.indices+":"+N(l.attributes):i.indices+":"+N(i.attributes)+":"+i.mode),m=n[f];if(m)c.push(m.promise);else p=h.extensions&&h.extensions[a.KHR_DRACO_MESH_COMPRESSION]?o(h):j(new t.BufferGeometry,h,r),n[f]={primitive:h,promise:p},c.push(p)}return Promise.all(c)},B.prototype.loadMesh=function(e){for(var r,a=this,s=this.json.meshes[e],n=s.primitives,o=[],i=0,l=n.length;i<l;i++){var c=void 0===n[i].material?(void 0===(r=this.cache).DefaultMaterial&&(r.DefaultMaterial=new t.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:t.FrontSide})),r.DefaultMaterial):this.getDependency("material",n[i].material);o.push(c)}return o.push(a.loadGeometries(n)),Promise.all(o).then((function(r){for(var o=r.slice(0,r.length-1),i=r[r.length-1],l=[],c=0,u=i.length;c<u;c++){var d,p=i[c],h=n[c],f=o[c];if(h.mode===A||h.mode===R||h.mode===w||void 0===h.mode)!0!==(d=!0===s.isSkinnedMesh?new t.SkinnedMesh(p,f):new t.Mesh(p,f)).isSkinnedMesh||d.geometry.attributes.skinWeight.normalized||d.normalizeSkinWeights(),h.mode===R?d.geometry=K(d.geometry,t.TriangleStripDrawMode):h.mode===w&&(d.geometry=K(d.geometry,t.TriangleFanDrawMode));else if(h.mode===T)d=new t.LineSegments(p,f);else if(h.mode===b)d=new t.Line(p,f);else if(h.mode===M)d=new t.LineLoop(p,f);else{if(h.mode!==y)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);d=new t.Points(p,f)}Object.keys(d.geometry.morphAttributes).length>0&&G(d,s),d.name=s.name||"mesh_"+e,i.length>1&&(d.name+="_"+c),H(d,s),a.assignFinalMaterial(d),l.push(d)}if(1===l.length)return l[0];var m=new t.Group;for(c=0,u=l.length;c<u;c++)m.add(l[c]);return m}))},B.prototype.loadCamera=function(e){var r,a=this.json.cameras[e],s=a[a.type];if(s)return"perspective"===a.type?r=new t.PerspectiveCamera(t.MathUtils.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):"orthographic"===a.type&&(r=new t.OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),a.name&&(r.name=a.name),H(r,a),Promise.resolve(r);console.warn("THREE.GLTFLoader: Missing camera parameters.")},B.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}))},B.prototype.loadAnimation=function(e){for(var r=this.json.animations[e],a=[],s=[],n=[],o=[],i=[],l=0,c=r.channels.length;l<c;l++){var u=r.channels[l],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)),s.push(this.getDependency("accessor",f)),n.push(this.getDependency("accessor",m)),o.push(d),i.push(p)}return Promise.all([Promise.all(a),Promise.all(s),Promise.all(n),Promise.all(o),Promise.all(i)]).then((function(a){for(var s=a[0],n=a[1],o=a[2],i=a[3],l=a[4],c=[],u=0,d=s.length;u<d;u++){var p=s[u],h=n[u],f=o[u],m=i[u],g=l[u];if(void 0!==p){var y;switch(p.updateMatrix(),p.matrixAutoUpdate=!0,C[g.path]){case C.weights:y=t.NumberKeyframeTrack;break;case C.rotation:y=t.QuaternionKeyframeTrack;break;default:y=t.VectorKeyframeTrack}var T=p.name?p.name:p.uuid,M=void 0!==m.interpolation?D[m.interpolation]:t.InterpolateLinear,b=[];C[g.path]===C.weights?p.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&b.push(e.name?e.name:e.uuid)})):b.push(T);var A=f.array;if(f.normalized){var R;if(A.constructor===Int8Array)R=1/127;else if(A.constructor===Uint8Array)R=1/255;else if(A.constructor==Int16Array)R=1/32767;else{if(A.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");R=1/65535}for(var w=new Float32Array(A.length),L=0,S=A.length;L<S;L++)w[L]=A[L]*R;A=w}for(L=0,S=b.length;L<S;L++){var _=new y(b[L]+"."+C[g.path],h.array,A,M);"CUBICSPLINE"===m.interpolation&&(_.createInterpolant=function(e){return new v(this.times,this.values,this.getValueSize()/3,e)},_.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(_)}}}var x=r.name?r.name:"animation_"+e;return new t.AnimationClip(x,void 0,c)}))},B.prototype.loadNode=function(e){var r,s=this.json,n=this.extensions,o=this,i=s.meshReferences,l=s.meshUses,c=s.nodes[e];return(r=[],void 0!==c.mesh&&r.push(o.getDependency("mesh",c.mesh).then((function(e){var t;if(i[c.mesh]>1){var r=l[c.mesh]++;(t=e.clone()).name+="_instance_"+r}else t=e;return void 0!==c.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,r=c.weights.length;t<r;t++)e.morphTargetInfluences[t]=c.weights[t]})),t}))),void 0!==c.camera&&r.push(o.getDependency("camera",c.camera)),c.extensions&&c.extensions[a.KHR_LIGHTS_PUNCTUAL]&&void 0!==c.extensions[a.KHR_LIGHTS_PUNCTUAL].light&&r.push(o.getDependency("light",c.extensions[a.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(r)).then((function(r){var a;if((a=!0===c.isBone?new t.Bone:r.length>1?new t.Group:1===r.length?r[0]:new t.Object3D)!==r[0])for(var s=0,i=r.length;s<i;s++)a.add(r[s]);if(c.name&&(a.userData.name=c.name,a.name=t.PropertyBinding.sanitizeNodeName(c.name)),H(a,c),c.extensions&&k(n,a,c),void 0!==c.matrix){var l=new t.Matrix4;l.fromArray(c.matrix),a.applyMatrix4(l)}else void 0!==c.translation&&a.position.fromArray(c.translation),void 0!==c.rotation&&a.quaternion.fromArray(c.rotation),void 0!==c.scale&&a.scale.fromArray(c.scale);return o.associations.set(a,{type:"nodes",index:e}),a}))},B.prototype.loadScene=function(){function e(r,a,s,n){var o=s.nodes[r];return n.getDependency("node",r).then((function(e){return void 0===o.skin?e:n.getDependency("skin",o.skin).then((function(e){for(var t=[],a=0,s=(r=e).joints.length;a<s;a++)t.push(n.getDependency("node",r.joints[a]));return Promise.all(t)})).then((function(a){return e.traverse((function(e){if(e.isMesh){for(var s=[],n=[],o=0,i=a.length;o<i;o++){var l=a[o];if(l){s.push(l);var c=new t.Matrix4;void 0!==r.inverseBindMatrices&&c.fromArray(r.inverseBindMatrices.array,16*o),n.push(c)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',r.joints[o])}e.bind(new t.Skeleton(s,n),e.matrixWorld)}})),e}));var r})).then((function(t){a.add(t);var r=[];if(o.children)for(var i=o.children,l=0,c=i.length;l<c;l++){var u=i[l];r.push(e(u,t,s,n))}return Promise.all(r)}))}return function(r){var a=this.json,s=this.extensions,n=this.json.scenes[r],o=new t.Group;n.name&&(o.name=n.name),H(o,n),n.extensions&&k(s,o,n);for(var i=n.nodes||[],l=[],c=0,u=i.length;c<u;c++)l.push(e(i[c],o,a,this));return Promise.all(l).then((function(){return o}))}}(),e}(),n=function(e){t.Loader.call(this,e),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"}};n.prototype=Object.assign(Object.create(t.Loader.prototype),{constructor:n,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(e,r,a,s){var n=new t.FileLoader(this.manager);n.setPath(this.path),n.setResponseType("arraybuffer"),"use-credentials"===this.crossOrigin&&n.setWithCredentials(!0),n.load(e,(e=>{var t={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,t).then(r).catch(s)}),a,s)},decodeDracoFile:function(e,t,r,a){var s={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:a||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,s).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 s,o=JSON.stringify(t);if(n.taskCache.has(e)){var i=n.taskCache.get(e);if(i.key===o)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 l=this.workerNextTaskID++,c=e.byteLength,u=this._getWorker(l,c).then((r=>(s=r,new Promise(((r,a)=>{s._callbacks[l]={resolve:r,reject:a},s.postMessage({type:"decode",id:l,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return u.catch((()=>!0)).then((()=>{s&&l&&this._releaseTask(s,l)})),n.taskCache.set(e,{key:o,promise:u}),u},_createGeometry:function(e){var r=new t.BufferGeometry;e.index&&r.setIndex(new t.BufferAttribute(e.index.array,1));for(var a=0;a<e.attributes.length;a++){var s=e.attributes[a],n=s.name,o=s.array,i=s.itemSize;r.setAttribute(n,new t.BufferAttribute(o,i))}return r},_loadLibrary:function(e,r){var a=new t.FileLoader(this.manager);return a.setPath(this.decoderPath),a.setResponseType(r),new Promise(((t,r)=>{a.load(e,t,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=n.DRACOWorker.toString(),s=["/* draco decoder */",r,"","/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([s]))})),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}}),n.DRACOWorker=function(){var e,t;function r(e,t,r,a,s,n){var o,i,l=n.num_components(),c=r.num_points()*l;switch(s){case Float32Array:o=new e.DracoFloat32Array,t.GetAttributeFloatForAllPoints(r,n,o),i=new Float32Array(c);break;case Int8Array:o=new e.DracoInt8Array,t.GetAttributeInt8ForAllPoints(r,n,o),i=new Int8Array(c);break;case Int16Array:o=new e.DracoInt16Array,t.GetAttributeInt16ForAllPoints(r,n,o),i=new Int16Array(c);break;case Int32Array:o=new e.DracoInt32Array,t.GetAttributeInt32ForAllPoints(r,n,o),i=new Int32Array(c);break;case Uint8Array:o=new e.DracoUInt8Array,t.GetAttributeUInt8ForAllPoints(r,n,o),i=new Uint8Array(c);break;case Uint16Array:o=new e.DracoUInt16Array,t.GetAttributeUInt16ForAllPoints(r,n,o),i=new Uint16Array(c);break;case Uint32Array:o=new e.DracoUInt32Array,t.GetAttributeUInt32ForAllPoints(r,n,o),i=new Uint32Array(c);break;default:throw new Error("THREE.DRACOLoader: Unexpected attribute type.")}for(var u=0;u<c;u++)i[u]=o.GetValue(u);return e.destroy(o),{name:a,array:i,itemSize:l}}onmessage=function(a){var s=a.data;switch(s.type){case"init":e=s.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var n=s.buffer,o=s.taskConfig;t.then((e=>{var t=e.draco,a=new t.Decoder,i=new t.DecoderBuffer;i.Init(new Int8Array(n),n.byteLength);try{var l=function(e,t,a,s){var n,o,i=s.attributeIDs,l=s.attributeTypes,c=t.GetEncodedGeometryType(a);if(c===e.TRIANGULAR_MESH)n=new e.Mesh,o=t.DecodeBufferToMesh(a,n);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");n=new e.PointCloud,o=t.DecodeBufferToPointCloud(a,n)}if(!o.ok()||0===n.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[l[d]];if(s.useUniqueIDs)h=i[d],p=t.GetAttributeByUniqueId(n,h);else{if(-1===(h=t.GetAttributeId(n,e[i[d]])))continue;p=t.GetAttribute(n,h)}u.attributes.push(r(e,t,n,d,f,p))}if(c===e.TRIANGULAR_MESH){for(var m=n.num_faces(),g=new Uint32Array(3*m),v=new e.DracoInt32Array,y=0;y<m;++y){t.GetFaceFromMesh(n,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(n),u}(t,a,i,o),c=l.attributes.map((e=>e.array.buffer));l.index&&c.push(l.index.array.buffer),self.postMessage({type:"decode",id:s.id,geometry:l},c)}catch(e){console.error(e),self.postMessage({type:"error",id:s.id,error:e.message})}finally{t.destroy(i),t.destroy(a)}}))}}},n.taskCache=new WeakMap,n.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},n.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},n.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},n.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};var o=function(e){t.CompressedTextureLoader.call(this,e)};o.prototype=Object.assign(Object.create(t.CompressedTextureLoader.prototype),{constructor:o,parse:function(e,r){var a={mipmaps:[],width:0,height:0,format:null,mipmapCount:1};function s(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}function n(e,t,r,a){for(var s=r*a*4,n=new Uint8Array(e,t,s),o=new Uint8Array(s),i=0,l=0,c=0;c<a;c++)for(var u=0;u<r;u++){var d=n[l],p=n[++l],h=n[++l],f=n[++l];l++,o[i]=h,o[++i]=p,o[++i]=d,o[++i]=f,i++}return o}var o,i=s("DXT1"),l=s("DXT3"),c=s("DXT5"),u=s("ETC1"),d=new Int32Array(e,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=t.RGB_S3TC_DXT1_Format;break;case l:o=16,a.format=t.RGBA_S3TC_DXT3_Format;break;case c:o=16,a.format=t.RGBA_S3TC_DXT5_Format;break;case u:o=8,a.format=t.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=t.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,b=0;b<a.mipmapCount;b++){if(f)var A=(R=n(e,g,T,M)).length;else{A=Math.max(4,T)/4*Math.max(4,M)/4*o;var R=new Uint8Array(e,g,A)}var w={data:R,width:T,height:M};a.mipmaps.push(w),g+=A,T=Math.max(T>>1,1),M=Math.max(M>>1,1)}return a}});var i=function(t){function r(e){var r=t.call(this)||this;return r.needsRender=!0,e&&e.children.length&&r.add.apply(r,e.children),r.mixer=new a.AnimationMixer(r),r}return e.__extends(r,t),r.prototype.clone=function(){var e=t.prototype.clone.call(this,!0),r=new a.AnimationMixer(e);return e.mixer=r,e.needsRender=!0,e},r}(a.Group),l=function(t){function r(e){var r=t.call(this,e)||this;return r.ddsLoader=new o(e),r.dracoLoader=new n(e),r.dracoLoader.setDecoderPath("https://vr-public.realsee-cdn.cn/release/static/image/release/five/gltf/"),r}return e.__extends(r,t),Object.defineProperty(r,"version",{get:function(){return"5.0.0-alpha.152"},enumerable:!1,configurable:!0}),r.prototype.load=function(e,r,a,s){return t.prototype.load.call(this,e,r,a,s)},r.prototype.parse=function(e,r,a,s){return t.prototype.parse.call(this,e,r,(function(e){var t=new i(e.scene),r=e.scenes.map((function(r){return r===e.scene?t:new i(r)}));a(Object.assign(e,{scene:t,scenes:r}))}),s)},r}(s);exports.DDSLoader=o,exports.DRACOLoader=n,exports.GLTFLoader=l,exports.GLTFObject=i,exports.THREEGLTFLoader=s;
|
|
260
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("three");function r(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 a=r(t),s=function(){function e(e){t.Loader.call(this,e),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={}}}}e.prototype=Object.assign(Object.create(t.Loader.prototype),{constructor:e,load:function(e,r,a,s){var n,o=this;n=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:t.LoaderUtils.extractUrlBase(e),o.manager.itemStart(e);var i=function(t){s?s(t):console.error(t),o.manager.itemError(e),o.manager.itemEnd(e)},l=new t.FileLoader(o.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),"use-credentials"===o.crossOrigin&&l.setWithCredentials(!0),l.load(e,(function(t){try{o.parse(t,n,(function(t){r(t),o.manager.itemEnd(e)}),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(e,r,c,u){var f,v={};if("string"==typeof e)f=e;else if(t.LoaderUtils.decodeText(new Uint8Array(e,0,4))===l){try{v[a.KHR_BINARY_GLTF]=new d(e)}catch(e){return void(u&&u(e))}f=v[a.KHR_BINARY_GLTF].content}else f=t.LoaderUtils.decodeText(new Uint8Array(e));var y=JSON.parse(f);if(void 0===y.asset||y.asset.version[0]<2)u&&u(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{if(y.extensionsUsed)for(var T=0;T<y.extensionsUsed.length;++T){var M=y.extensionsUsed[T],b=y.extensionsRequired||[];switch(M){case a.KHR_LIGHTS_PUNCTUAL:v[M]=new n(y);break;case a.KHR_MATERIALS_CLEARCOAT:v[M]=new i;break;case a.KHR_MATERIALS_UNLIT:v[M]=new o;break;case a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:v[M]=new m;break;case a.KHR_DRACO_MESH_COMPRESSION:v[M]=new p(y,this.dracoLoader);break;case a.MSFT_TEXTURE_DDS:v[M]=new s(this.ddsLoader);break;case a.KHR_TEXTURE_TRANSFORM:v[M]=new h;break;case a.KHR_MESH_QUANTIZATION:v[M]=new g;break;default:b.indexOf(M)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+M+'".')}}var A=new B(y,v,{path:r||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});A.fileLoader.setRequestHeader(this.requestHeader),A.parse(c,u)}}});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_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function s(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 n(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}n.prototype.loadLight=function(e){var r,a=this.lightDefs[e],s=new t.Color(16777215);void 0!==a.color&&s.fromArray(a.color);var n=void 0!==a.range?a.range:0;switch(a.type){case"directional":(r=new t.DirectionalLight(s)).target.position.set(0,0,-1),r.add(r.target);break;case"point":(r=new t.PointLight(s)).distance=n;break;case"spot":(r=new t.SpotLight(s)).distance=n,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_"+e,Promise.resolve(r)},o.prototype.getMaterialType=function(){return t.MeshBasicMaterial},o.prototype.extendParams=function(e,r,a){var s=[];e.color=new t.Color(1,1,1),e.opacity=1;var n=r.pbrMetallicRoughness;if(n){if(Array.isArray(n.baseColorFactor)){var o=n.baseColorFactor;e.color.fromArray(o),e.opacity=o[3]}void 0!==n.baseColorTexture&&s.push(a.assignTexture(e,"map",n.baseColorTexture))}return Promise.all(s)},i.prototype.getMaterialType=function(){return t.MeshPhysicalMaterial},i.prototype.extendParams=function(e,r,a){var s=[],n=r.extensions[this.name];if(void 0!==n.clearcoatFactor&&(e.clearcoat=n.clearcoatFactor),void 0!==n.clearcoatTexture&&s.push(a.assignTexture(e,"clearcoatMap",n.clearcoatTexture)),void 0!==n.clearcoatRoughnessFactor&&(e.clearcoatRoughness=n.clearcoatRoughnessFactor),void 0!==n.clearcoatRoughnessTexture&&s.push(a.assignTexture(e,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture)),void 0!==n.clearcoatNormalTexture&&(s.push(a.assignTexture(e,"clearcoatNormalMap",n.clearcoatNormalTexture)),void 0!==n.clearcoatNormalTexture.scale)){var o=n.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new t.Vector2(o,o)}return Promise.all(s)};var l="glTF",c=1313821514,u=5130562;function d(e){this.name=a.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(e,0,12);if(this.header={magic:t.LoaderUtils.decodeText(new Uint8Array(e.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 s=new DataView(e,12),n=0;n<s.byteLength;){var o=s.getUint32(n,!0);n+=4;var i=s.getUint32(n,!0);if(n+=4,i===c){var d=new Uint8Array(e,12+n,o);this.content=t.LoaderUtils.decodeText(d)}else if(i===u){var p=12+n;this.body=e.slice(p,p+o)}n+=o}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function p(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 h(){this.name=a.KHR_TEXTURE_TRANSFORM}function f(e){t.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"),s=["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"),n=["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 t.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>",s),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_fragment>",n),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(e)}function m(){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 f},extendParams:function(e,r,a){var s=r.extensions[this.name];e.color=new t.Color(1,1,1),e.opacity=1;var n=[];if(Array.isArray(s.diffuseFactor)){var o=s.diffuseFactor;e.color.fromArray(o),e.opacity=o[3]}if(void 0!==s.diffuseTexture&&n.push(a.assignTexture(e,"map",s.diffuseTexture)),e.emissive=new t.Color(0,0,0),e.glossiness=void 0!==s.glossinessFactor?s.glossinessFactor:1,e.specular=new t.Color(1,1,1),Array.isArray(s.specularFactor)&&e.specular.fromArray(s.specularFactor),void 0!==s.specularGlossinessTexture){var i=s.specularGlossinessTexture;n.push(a.assignTexture(e,"glossinessMap",i)),n.push(a.assignTexture(e,"specularMap",i))}return Promise.all(n)},createMaterial:function(e){var r=new f(e);return r.fog=!0,r.color=e.color,r.map=void 0===e.map?null:e.map,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=void 0===e.aoMap?null:e.aoMap,r.aoMapIntensity=1,r.emissive=e.emissive,r.emissiveIntensity=1,r.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,r.bumpMap=void 0===e.bumpMap?null:e.bumpMap,r.bumpScale=1,r.normalMap=void 0===e.normalMap?null:e.normalMap,r.normalMapType=t.TangentSpaceNormalMap,e.normalScale&&(r.normalScale=e.normalScale),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=void 0===e.specularMap?null:e.specularMap,r.specular=e.specular,r.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,r.glossiness=e.glossiness,r.alphaMap=null,r.envMap=void 0===e.envMap?null:e.envMap,r.envMapIntensity=1,r.refractionRatio=.98,r}}}function g(){this.name=a.KHR_MESH_QUANTIZATION}function v(e,r,a,s){t.Interpolant.call(this,e,r,a,s)}p.prototype.decodePrimitive=function(e,t){var r=this.json,a=this.dracoLoader,s=e.extensions[this.name].bufferView,n=e.extensions[this.name].attributes,o={},i={},l={};for(var c in n){var u=E[c]||c.toLowerCase();o[u]=n[c]}for(c in e.attributes){u=E[c]||c.toLowerCase();if(void 0!==n[c]){var d=r.accessors[e.attributes[c]],p=L[d.componentType];l[u]=p,i[u]=!0===d.normalized}}return t.getDependency("bufferView",s).then((function(e){return new Promise((function(t){a.decodeDracoFile(e,(function(e){for(var r in e.attributes){var a=e.attributes[r],s=i[r];void 0!==s&&(a.normalized=s)}t(e)}),o,l)}))}))},h.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},f.prototype=Object.create(t.MeshStandardMaterial.prototype),f.prototype.constructor=f,f.prototype.copy=function(e){return t.MeshStandardMaterial.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},v.prototype=Object.create(t.Interpolant.prototype),v.prototype.constructor=v,v.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,r=this.sampleValues,a=this.valueSize,s=e*a*3+a,n=0;n!==a;n++)t[n]=r[s+n];return t},v.prototype.beforeStart_=v.prototype.copySampleValue_,v.prototype.afterEnd_=v.prototype.copySampleValue_,v.prototype.interpolate_=function(e,t,r,a){for(var s=this.resultBuffer,n=this.sampleValues,o=this.valueSize,i=2*o,l=3*o,c=a-t,u=(r-t)/c,d=u*u,p=d*u,h=e*l,f=h-l,m=-2*p+3*d,g=p-d,v=1-m,y=g-d+u,T=0;T!==o;T++){var M=n[f+T+o],b=n[f+T+i]*c,A=n[h+T+o],R=n[h+T]*c;s[T]=v*M+y*b+m*A+g*R}return s};var y=0,T=1,M=2,b=3,A=4,R=5,w=6,L={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},S={9728:t.NearestFilter,9729:t.LinearFilter,9984:t.NearestMipmapNearestFilter,9985:t.LinearMipmapNearestFilter,9986:t.NearestMipmapLinearFilter,9987:t.LinearMipmapLinearFilter},_={33071:t.ClampToEdgeWrapping,33648:t.MirroredRepeatWrapping,10497:t.RepeatWrapping},x={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},E={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:t.InterpolateLinear,STEP:t.InterpolateDiscrete},I="OPAQUE",P="MASK",O="BLEND",U={"image/png":t.RGBAFormat,"image/jpeg":t.RGBFormat};function F(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 k(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 H(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 s=t.extras.targetNames;if(e.morphTargetInfluences.length===s.length){e.morphTargetDictionary={};for(r=0,a=s.length;r<a;r++)e.morphTargetDictionary[s[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function N(e){for(var t="",r=Object.keys(e).sort(),a=0,s=r.length;a<s;a++)t+=r[a]+":"+e[r[a]]+";";return t}function B(e,a,s){this.json=e||{},this.extensions=a||{},this.options=s||{},this.cache=new r,this.associations=new Map,this.primitiveCache={},this.textureLoader=new t.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new t.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function j(e,r,a){var s=r.attributes,n=[];function o(t,r){return a.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}for(var i in s){var l=E[i]||i.toLowerCase();l in e.attributes||n.push(o(s[i],l))}if(void 0!==r.indices&&!e.index){var c=a.getDependency("accessor",r.indices).then((function(t){e.setIndex(t)}));n.push(c)}return H(e,r),function(e,r,a){var s=r.attributes,n=new t.Box3;if(void 0!==s.POSITION){var o=(h=a.json.accessors[s.POSITION]).min,i=h.max;if(void 0!==o&&void 0!==i){n.set(new t.Vector3(o[0],o[1],o[2]),new t.Vector3(i[0],i[1],i[2]));var l=r.targets;if(void 0!==l){for(var c=new t.Vector3,u=new t.Vector3,d=0,p=l.length;d<p;d++){var h,f=l[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]))),c.max(u)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}n.expandByVector(c)}e.boundingBox=n;var m=new t.Sphere;n.getCenter(m.center),m.radius=n.min.distanceTo(n.max)/2,e.boundingSphere=m}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,r,a),Promise.all(n).then((function(){return void 0!==r.targets?function(e,t,r){for(var a=!1,s=!1,n=0,o=t.length;n<o&&(void 0!==(c=t[n]).POSITION&&(a=!0),void 0!==c.NORMAL&&(s=!0),!a||!s);n++);if(!a&&!s)return Promise.resolve(e);var i=[],l=[];for(n=0,o=t.length;n<o;n++){var c=t[n];if(a){var u=void 0!==c.POSITION?r.getDependency("accessor",c.POSITION):e.attributes.position;i.push(u)}s&&(u=void 0!==c.NORMAL?r.getDependency("accessor",c.NORMAL):e.attributes.normal,l.push(u))}return Promise.all([Promise.all(i),Promise.all(l)]).then((function(t){var r=t[0],n=t[1];return a&&(e.morphAttributes.position=r),s&&(e.morphAttributes.normal=n),e.morphTargetsRelative=!0,e}))}(e,r.targets,a):e}))}function K(e,r){var a=e.getIndex();if(null===a){var s=[],n=e.getAttribute("position");if(void 0===n)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var o=0;o<n.count;o++)s.push(o);e.setIndex(s),a=e.getIndex()}var i=a.count-2,l=[];if(r===t.TriangleFanDrawMode)for(o=1;o<=i;o++)l.push(a.getX(0)),l.push(a.getX(o)),l.push(a.getX(o+1));else for(o=0;o<i;o++)o%2==0?(l.push(a.getX(o)),l.push(a.getX(o+1)),l.push(a.getX(o+2))):(l.push(a.getX(o+2)),l.push(a.getX(o+1)),l.push(a.getX(o)));l.length/3!==i&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var c=e.clone();return c.setIndex(l),c}return B.prototype.parse=function(e,t){var r=this,a=this.json,s=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var n={scene:t[0][a.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:a.asset,parser:r,userData:{}};k(s,n,a),H(n,a),e(n)})).catch(t)},B.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],a={},s={},n=0,o=t.length;n<o;n++)for(var i=t[n].joints,l=0,c=i.length;l<c;l++)e[i[l]].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]=s[p.mesh]=0),a[p.mesh]++,void 0!==p.skin&&(r[p.mesh].isSkinnedMesh=!0))}this.json.meshReferences=a,this.json.meshUses=s},B.prototype.getDependency=function(e,t){var r=e+":"+t,s=this.cache.get(r);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this.loadNode(t);break;case"mesh":s=this.loadMesh(t);break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this.loadBufferView(t);break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this.loadMaterial(t);break;case"texture":s=this.loadTexture(t);break;case"skin":s=this.loadSkin(t);break;case"animation":s=this.loadAnimation(t);break;case"camera":s=this.loadCamera(t);break;case"light":s=this.extensions[a.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,s)}return s},B.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},B.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 s=this.options;return new Promise((function(e,a){r.load(F(t.uri,s.path),e,void 0,(function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},B.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)}))},B.prototype.loadAccessor=function(e){var r=this,a=this.json,s=this.json.accessors[e];if(void 0===s.bufferView&&void 0===s.sparse)return Promise.resolve(null);var n=[];return void 0!==s.bufferView?n.push(this.getDependency("bufferView",s.bufferView)):n.push(null),void 0!==s.sparse&&(n.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),n.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(n).then((function(e){var n,o,i=e[0],l=x[s.type],c=L[s.componentType],u=c.BYTES_PER_ELEMENT,d=u*l,p=s.byteOffset||0,h=void 0!==s.bufferView?a.bufferViews[s.bufferView].byteStride:void 0,f=!0===s.normalized;if(h&&h!==d){var m=Math.floor(p/h),g="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+m+":"+s.count,v=r.cache.get(g);v||(n=new c(i,m*h,s.count*h/u),v=new t.InterleavedBuffer(n,h/u),r.cache.add(g,v)),o=new t.InterleavedBufferAttribute(v,l,p%h/u,f)}else n=null===i?new c(s.count*l):new c(i,p,s.count*l),o=new t.BufferAttribute(n,l,f);if(void 0!==s.sparse){var y=x.SCALAR,T=L[s.sparse.indices.componentType],M=s.sparse.indices.byteOffset||0,b=s.sparse.values.byteOffset||0,A=new T(e[1],M,s.sparse.count*y),R=new c(e[2],b,s.sparse.count*l);null!==i&&(o=new t.BufferAttribute(o.array.slice(),o.itemSize,o.normalized));for(var w=0,S=A.length;w<S;w++){var _=A[w];if(o.setX(_,R[w*l]),l>=2&&o.setY(_,R[w*l+1]),l>=3&&o.setZ(_,R[w*l+2]),l>=4&&o.setW(_,R[w*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o}))},B.prototype.loadTexture=function(e){var r,s=this,n=this.json,o=this.options,i=this.textureLoader,l=self.URL||self.webkitURL,c=n.textures[e],u=c.extensions||{},d=(r=u[a.MSFT_TEXTURE_DDS]?n.images[u[a.MSFT_TEXTURE_DDS].source]:n.images[c.source]).uri,p=!1;return void 0!==r.bufferView&&(d=s.getDependency("bufferView",r.bufferView).then((function(e){p=!0;var t=new Blob([e],{type:r.mimeType});return d=l.createObjectURL(t)}))),Promise.resolve(d).then((function(e){var t=o.manager.getHandler(e);return t||(t=u[a.MSFT_TEXTURE_DDS]?s.extensions[a.MSFT_TEXTURE_DDS].ddsLoader:i),new Promise((function(r,a){t.load(F(e,o.path),r,void 0,a)}))})).then((function(a){!0===p&&l.revokeObjectURL(d),a.flipY=!1,c.name&&(a.name=c.name),r.mimeType in U&&(a.format=U[r.mimeType]);var o=(n.samplers||{})[c.sampler]||{};return a.magFilter=S[o.magFilter]||t.LinearFilter,a.minFilter=S[o.minFilter]||t.LinearMipmapLinearFilter,a.wrapS=_[o.wrapS]||t.RepeatWrapping,a.wrapT=_[o.wrapT]||t.RepeatWrapping,s.associations.set(a,{type:"textures",index:e}),a}))},B.prototype.assignTexture=function(e,r,s){var n=this;return this.getDependency("texture",s.index).then((function(o){if(!o.isCompressedTexture)switch(r){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":o.format=t.RGBFormat}if(void 0===s.texCoord||0==s.texCoord||"aoMap"===r&&1==s.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+s.texCoord+" for texture "+r+" not yet supported."),n.extensions[a.KHR_TEXTURE_TRANSFORM]){var i=void 0!==s.extensions?s.extensions[a.KHR_TEXTURE_TRANSFORM]:void 0;if(i){var l=this.associations.get(o);o=n.extensions[a.KHR_TEXTURE_TRANSFORM].extendTexture(o,i),this.associations.set(o,l)}}e[r]=o}))},B.prototype.assignFinalMaterial=function(e){var r=e.geometry,a=e.material,s=void 0!==r.attributes.tangent,n=void 0!==r.attributes.color,o=void 0===r.attributes.normal,i=!0===e.isSkinnedMesh,l=Object.keys(r.morphAttributes).length>0,c=l&&void 0!==r.morphAttributes.normal;if(e.isPoints){var u="PointsMaterial:"+a.uuid,d=this.cache.get(u);d||(d=new t.PointsMaterial,t.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(e.isLine){u="LineBasicMaterial:"+a.uuid;var p=this.cache.get(u);p||(p=new t.LineBasicMaterial,t.Material.prototype.copy.call(p,a),p.color.copy(a.color),this.cache.add(u,p)),a=p}if(s||n||o||i||l){u="ClonedMaterial:"+a.uuid+":";a.isGLTFSpecularGlossinessMaterial&&(u+="specular-glossiness:"),i&&(u+="skinning:"),s&&(u+="vertex-tangents:"),n&&(u+="vertex-colors:"),o&&(u+="flat-shading:"),l&&(u+="morph-targets:"),c&&(u+="morph-normals:");var h=this.cache.get(u);h||(h=a.clone(),i&&(h.skinning=!0),s&&(h.vertexTangents=!0),n&&(h.vertexColors=!0),o&&(h.flatShading=!0),l&&(h.morphTargets=!0),c&&(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&&!s&&(a.normalScale.y=-a.normalScale.y),a.clearcoatNormalScale&&!s&&(a.clearcoatNormalScale.y=-a.clearcoatNormalScale.y),e.material=a},B.prototype.loadMaterial=function(e){var r,s=this,n=this.json,o=this.extensions,i=n.materials[e],l={},c=i.extensions||{},u=[];if(c[a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var d=o[a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];r=d.getMaterialType(),u.push(d.extendParams(l,i,s))}else if(c[a.KHR_MATERIALS_UNLIT]){var p=o[a.KHR_MATERIALS_UNLIT];r=p.getMaterialType(),u.push(p.extendParams(l,i,s))}else{r=t.MeshStandardMaterial;var h=i.pbrMetallicRoughness||{};if(l.color=new t.Color(1,1,1),l.opacity=1,Array.isArray(h.baseColorFactor)){var m=h.baseColorFactor;l.color.fromArray(m),l.opacity=m[3]}void 0!==h.baseColorTexture&&u.push(s.assignTexture(l,"map",h.baseColorTexture)),l.metalness=void 0!==h.metallicFactor?h.metallicFactor:1,l.roughness=void 0!==h.roughnessFactor?h.roughnessFactor:1,void 0!==h.metallicRoughnessTexture&&(u.push(s.assignTexture(l,"metalnessMap",h.metallicRoughnessTexture)),u.push(s.assignTexture(l,"roughnessMap",h.metallicRoughnessTexture)))}!0===i.doubleSided&&(l.side=t.DoubleSide);var g=i.alphaMode||I;if(g===O?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,g===P&&(l.alphaTest=void 0!==i.alphaCutoff?i.alphaCutoff:.5)),void 0!==i.normalTexture&&r!==t.MeshBasicMaterial&&(u.push(s.assignTexture(l,"normalMap",i.normalTexture)),l.normalScale=new t.Vector2(1,1),void 0!==i.normalTexture.scale&&l.normalScale.set(i.normalTexture.scale,i.normalTexture.scale)),void 0!==i.occlusionTexture&&r!==t.MeshBasicMaterial&&(u.push(s.assignTexture(l,"aoMap",i.occlusionTexture)),void 0!==i.occlusionTexture.strength&&(l.aoMapIntensity=i.occlusionTexture.strength)),void 0!==i.emissiveFactor&&r!==t.MeshBasicMaterial&&(l.emissive=(new t.Color).fromArray(i.emissiveFactor)),void 0!==i.emissiveTexture&&r!==t.MeshBasicMaterial&&u.push(s.assignTexture(l,"emissiveMap",i.emissiveTexture)),c[a.KHR_MATERIALS_CLEARCOAT]){var v=o[a.KHR_MATERIALS_CLEARCOAT];r=v.getMaterialType(),u.push(v.extendParams(l,{extensions:c},s))}return Promise.all(u).then((function(){var n;return n=r===f?o[a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(l):new r(l),i.name&&(n.name=i.name),n.map&&(n.map.encoding=t.sRGBEncoding),n.emissiveMap&&(n.emissiveMap.encoding=t.sRGBEncoding),H(n,i),s.associations.set(n,{type:"materials",index:e}),i.extensions&&k(o,n,i),n}))},B.prototype.loadGeometries=function(e){var r=this,s=this.extensions,n=this.primitiveCache;function o(e){return s[a.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,r).then((function(t){return j(t,e,r)}))}for(var i,l,c=[],u=0,d=e.length;u<d;u++){var p,h=e[u],f=(l=void 0,(l=(i=h).extensions&&i.extensions[a.KHR_DRACO_MESH_COMPRESSION])?"draco:"+l.bufferView+":"+l.indices+":"+N(l.attributes):i.indices+":"+N(i.attributes)+":"+i.mode),m=n[f];if(m)c.push(m.promise);else p=h.extensions&&h.extensions[a.KHR_DRACO_MESH_COMPRESSION]?o(h):j(new t.BufferGeometry,h,r),n[f]={primitive:h,promise:p},c.push(p)}return Promise.all(c)},B.prototype.loadMesh=function(e){for(var r,a=this,s=this.json.meshes[e],n=s.primitives,o=[],i=0,l=n.length;i<l;i++){var c=void 0===n[i].material?(void 0===(r=this.cache).DefaultMaterial&&(r.DefaultMaterial=new t.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:t.FrontSide})),r.DefaultMaterial):this.getDependency("material",n[i].material);o.push(c)}return o.push(a.loadGeometries(n)),Promise.all(o).then((function(r){for(var o=r.slice(0,r.length-1),i=r[r.length-1],l=[],c=0,u=i.length;c<u;c++){var d,p=i[c],h=n[c],f=o[c];if(h.mode===A||h.mode===R||h.mode===w||void 0===h.mode)!0!==(d=!0===s.isSkinnedMesh?new t.SkinnedMesh(p,f):new t.Mesh(p,f)).isSkinnedMesh||d.geometry.attributes.skinWeight.normalized||d.normalizeSkinWeights(),h.mode===R?d.geometry=K(d.geometry,t.TriangleStripDrawMode):h.mode===w&&(d.geometry=K(d.geometry,t.TriangleFanDrawMode));else if(h.mode===T)d=new t.LineSegments(p,f);else if(h.mode===b)d=new t.Line(p,f);else if(h.mode===M)d=new t.LineLoop(p,f);else{if(h.mode!==y)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);d=new t.Points(p,f)}Object.keys(d.geometry.morphAttributes).length>0&&G(d,s),d.name=s.name||"mesh_"+e,i.length>1&&(d.name+="_"+c),H(d,s),a.assignFinalMaterial(d),l.push(d)}if(1===l.length)return l[0];var m=new t.Group;for(c=0,u=l.length;c<u;c++)m.add(l[c]);return m}))},B.prototype.loadCamera=function(e){var r,a=this.json.cameras[e],s=a[a.type];if(s)return"perspective"===a.type?r=new t.PerspectiveCamera(t.MathUtils.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):"orthographic"===a.type&&(r=new t.OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),a.name&&(r.name=a.name),H(r,a),Promise.resolve(r);console.warn("THREE.GLTFLoader: Missing camera parameters.")},B.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}))},B.prototype.loadAnimation=function(e){for(var r=this.json.animations[e],a=[],s=[],n=[],o=[],i=[],l=0,c=r.channels.length;l<c;l++){var u=r.channels[l],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)),s.push(this.getDependency("accessor",f)),n.push(this.getDependency("accessor",m)),o.push(d),i.push(p)}return Promise.all([Promise.all(a),Promise.all(s),Promise.all(n),Promise.all(o),Promise.all(i)]).then((function(a){for(var s=a[0],n=a[1],o=a[2],i=a[3],l=a[4],c=[],u=0,d=s.length;u<d;u++){var p=s[u],h=n[u],f=o[u],m=i[u],g=l[u];if(void 0!==p){var y;switch(p.updateMatrix(),p.matrixAutoUpdate=!0,C[g.path]){case C.weights:y=t.NumberKeyframeTrack;break;case C.rotation:y=t.QuaternionKeyframeTrack;break;default:y=t.VectorKeyframeTrack}var T=p.name?p.name:p.uuid,M=void 0!==m.interpolation?D[m.interpolation]:t.InterpolateLinear,b=[];C[g.path]===C.weights?p.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&b.push(e.name?e.name:e.uuid)})):b.push(T);var A=f.array;if(f.normalized){var R;if(A.constructor===Int8Array)R=1/127;else if(A.constructor===Uint8Array)R=1/255;else if(A.constructor==Int16Array)R=1/32767;else{if(A.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");R=1/65535}for(var w=new Float32Array(A.length),L=0,S=A.length;L<S;L++)w[L]=A[L]*R;A=w}for(L=0,S=b.length;L<S;L++){var _=new y(b[L]+"."+C[g.path],h.array,A,M);"CUBICSPLINE"===m.interpolation&&(_.createInterpolant=function(e){return new v(this.times,this.values,this.getValueSize()/3,e)},_.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(_)}}}var x=r.name?r.name:"animation_"+e;return new t.AnimationClip(x,void 0,c)}))},B.prototype.loadNode=function(e){var r,s=this.json,n=this.extensions,o=this,i=s.meshReferences,l=s.meshUses,c=s.nodes[e];return(r=[],void 0!==c.mesh&&r.push(o.getDependency("mesh",c.mesh).then((function(e){var t;if(i[c.mesh]>1){var r=l[c.mesh]++;(t=e.clone()).name+="_instance_"+r}else t=e;return void 0!==c.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,r=c.weights.length;t<r;t++)e.morphTargetInfluences[t]=c.weights[t]})),t}))),void 0!==c.camera&&r.push(o.getDependency("camera",c.camera)),c.extensions&&c.extensions[a.KHR_LIGHTS_PUNCTUAL]&&void 0!==c.extensions[a.KHR_LIGHTS_PUNCTUAL].light&&r.push(o.getDependency("light",c.extensions[a.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(r)).then((function(r){var a;if((a=!0===c.isBone?new t.Bone:r.length>1?new t.Group:1===r.length?r[0]:new t.Object3D)!==r[0])for(var s=0,i=r.length;s<i;s++)a.add(r[s]);if(c.name&&(a.userData.name=c.name,a.name=t.PropertyBinding.sanitizeNodeName(c.name)),H(a,c),c.extensions&&k(n,a,c),void 0!==c.matrix){var l=new t.Matrix4;l.fromArray(c.matrix),a.applyMatrix4(l)}else void 0!==c.translation&&a.position.fromArray(c.translation),void 0!==c.rotation&&a.quaternion.fromArray(c.rotation),void 0!==c.scale&&a.scale.fromArray(c.scale);return o.associations.set(a,{type:"nodes",index:e}),a}))},B.prototype.loadScene=function(){function e(r,a,s,n){var o=s.nodes[r];return n.getDependency("node",r).then((function(e){return void 0===o.skin?e:n.getDependency("skin",o.skin).then((function(e){for(var t=[],a=0,s=(r=e).joints.length;a<s;a++)t.push(n.getDependency("node",r.joints[a]));return Promise.all(t)})).then((function(a){return e.traverse((function(e){if(e.isMesh){for(var s=[],n=[],o=0,i=a.length;o<i;o++){var l=a[o];if(l){s.push(l);var c=new t.Matrix4;void 0!==r.inverseBindMatrices&&c.fromArray(r.inverseBindMatrices.array,16*o),n.push(c)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',r.joints[o])}e.bind(new t.Skeleton(s,n),e.matrixWorld)}})),e}));var r})).then((function(t){a.add(t);var r=[];if(o.children)for(var i=o.children,l=0,c=i.length;l<c;l++){var u=i[l];r.push(e(u,t,s,n))}return Promise.all(r)}))}return function(r){var a=this.json,s=this.extensions,n=this.json.scenes[r],o=new t.Group;n.name&&(o.name=n.name),H(o,n),n.extensions&&k(s,o,n);for(var i=n.nodes||[],l=[],c=0,u=i.length;c<u;c++)l.push(e(i[c],o,a,this));return Promise.all(l).then((function(){return o}))}}(),e}(),n=function(e){t.Loader.call(this,e),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"}};n.prototype=Object.assign(Object.create(t.Loader.prototype),{constructor:n,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(e,r,a,s){var n=new t.FileLoader(this.manager);n.setPath(this.path),n.setResponseType("arraybuffer"),"use-credentials"===this.crossOrigin&&n.setWithCredentials(!0),n.load(e,(e=>{var t={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,t).then(r).catch(s)}),a,s)},decodeDracoFile:function(e,t,r,a){var s={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:a||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,s).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 s,o=JSON.stringify(t);if(n.taskCache.has(e)){var i=n.taskCache.get(e);if(i.key===o)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 l=this.workerNextTaskID++,c=e.byteLength,u=this._getWorker(l,c).then((r=>(s=r,new Promise(((r,a)=>{s._callbacks[l]={resolve:r,reject:a},s.postMessage({type:"decode",id:l,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return u.catch((()=>!0)).then((()=>{s&&l&&this._releaseTask(s,l)})),n.taskCache.set(e,{key:o,promise:u}),u},_createGeometry:function(e){var r=new t.BufferGeometry;e.index&&r.setIndex(new t.BufferAttribute(e.index.array,1));for(var a=0;a<e.attributes.length;a++){var s=e.attributes[a],n=s.name,o=s.array,i=s.itemSize;r.setAttribute(n,new t.BufferAttribute(o,i))}return r},_loadLibrary:function(e,r){var a=new t.FileLoader(this.manager);return a.setPath(this.decoderPath),a.setResponseType(r),new Promise(((t,r)=>{a.load(e,t,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=n.DRACOWorker.toString(),s=["/* draco decoder */",r,"","/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([s]))})),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}}),n.DRACOWorker=function(){var e,t;function r(e,t,r,a,s,n){var o,i,l=n.num_components(),c=r.num_points()*l;switch(s){case Float32Array:o=new e.DracoFloat32Array,t.GetAttributeFloatForAllPoints(r,n,o),i=new Float32Array(c);break;case Int8Array:o=new e.DracoInt8Array,t.GetAttributeInt8ForAllPoints(r,n,o),i=new Int8Array(c);break;case Int16Array:o=new e.DracoInt16Array,t.GetAttributeInt16ForAllPoints(r,n,o),i=new Int16Array(c);break;case Int32Array:o=new e.DracoInt32Array,t.GetAttributeInt32ForAllPoints(r,n,o),i=new Int32Array(c);break;case Uint8Array:o=new e.DracoUInt8Array,t.GetAttributeUInt8ForAllPoints(r,n,o),i=new Uint8Array(c);break;case Uint16Array:o=new e.DracoUInt16Array,t.GetAttributeUInt16ForAllPoints(r,n,o),i=new Uint16Array(c);break;case Uint32Array:o=new e.DracoUInt32Array,t.GetAttributeUInt32ForAllPoints(r,n,o),i=new Uint32Array(c);break;default:throw new Error("THREE.DRACOLoader: Unexpected attribute type.")}for(var u=0;u<c;u++)i[u]=o.GetValue(u);return e.destroy(o),{name:a,array:i,itemSize:l}}onmessage=function(a){var s=a.data;switch(s.type){case"init":e=s.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var n=s.buffer,o=s.taskConfig;t.then((e=>{var t=e.draco,a=new t.Decoder,i=new t.DecoderBuffer;i.Init(new Int8Array(n),n.byteLength);try{var l=function(e,t,a,s){var n,o,i=s.attributeIDs,l=s.attributeTypes,c=t.GetEncodedGeometryType(a);if(c===e.TRIANGULAR_MESH)n=new e.Mesh,o=t.DecodeBufferToMesh(a,n);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");n=new e.PointCloud,o=t.DecodeBufferToPointCloud(a,n)}if(!o.ok()||0===n.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[l[d]];if(s.useUniqueIDs)h=i[d],p=t.GetAttributeByUniqueId(n,h);else{if(-1===(h=t.GetAttributeId(n,e[i[d]])))continue;p=t.GetAttribute(n,h)}u.attributes.push(r(e,t,n,d,f,p))}if(c===e.TRIANGULAR_MESH){for(var m=n.num_faces(),g=new Uint32Array(3*m),v=new e.DracoInt32Array,y=0;y<m;++y){t.GetFaceFromMesh(n,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(n),u}(t,a,i,o),c=l.attributes.map((e=>e.array.buffer));l.index&&c.push(l.index.array.buffer),self.postMessage({type:"decode",id:s.id,geometry:l},c)}catch(e){console.error(e),self.postMessage({type:"error",id:s.id,error:e.message})}finally{t.destroy(i),t.destroy(a)}}))}}},n.taskCache=new WeakMap,n.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},n.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},n.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},n.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};var o=function(e){t.CompressedTextureLoader.call(this,e)};o.prototype=Object.assign(Object.create(t.CompressedTextureLoader.prototype),{constructor:o,parse:function(e,r){var a={mipmaps:[],width:0,height:0,format:null,mipmapCount:1};function s(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}function n(e,t,r,a){for(var s=r*a*4,n=new Uint8Array(e,t,s),o=new Uint8Array(s),i=0,l=0,c=0;c<a;c++)for(var u=0;u<r;u++){var d=n[l],p=n[++l],h=n[++l],f=n[++l];l++,o[i]=h,o[++i]=p,o[++i]=d,o[++i]=f,i++}return o}var o,i=s("DXT1"),l=s("DXT3"),c=s("DXT5"),u=s("ETC1"),d=new Int32Array(e,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=t.RGB_S3TC_DXT1_Format;break;case l:o=16,a.format=t.RGBA_S3TC_DXT3_Format;break;case c:o=16,a.format=t.RGBA_S3TC_DXT5_Format;break;case u:o=8,a.format=t.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=t.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,b=0;b<a.mipmapCount;b++){if(f)var A=(R=n(e,g,T,M)).length;else{A=Math.max(4,T)/4*Math.max(4,M)/4*o;var R=new Uint8Array(e,g,A)}var w={data:R,width:T,height:M};a.mipmaps.push(w),g+=A,T=Math.max(T>>1,1),M=Math.max(M>>1,1)}return a}});var i=function(t){function r(e){var r=t.call(this)||this;return r.needsRender=!0,e&&e.children.length&&r.add.apply(r,e.children),r.mixer=new a.AnimationMixer(r),r}return e.__extends(r,t),r.prototype.clone=function(){var e=t.prototype.clone.call(this,!0),r=new a.AnimationMixer(e);return e.mixer=r,e.needsRender=!0,e},r}(a.Group),l=function(t){function r(e){var r=t.call(this,e)||this;return r.ddsLoader=new o(e),r.dracoLoader=new n(e),r.dracoLoader.setDecoderPath("https://vr-public.realsee-cdn.cn/release/static/image/release/five/gltf/"),r}return e.__extends(r,t),Object.defineProperty(r,"version",{get:function(){return"5.0.0-alpha.154"},enumerable:!1,configurable:!0}),r.prototype.load=function(e,r,a,s){return t.prototype.load.call(this,e,r,a,s)},r.prototype.parse=function(e,r,a,s){return t.prototype.parse.call(this,e,r,(function(e){var t=new i(e.scene),r=e.scenes.map((function(r){return r===e.scene?t:new i(r)}));a(Object.assign(e,{scene:t,scenes:r}))}),s)},r}(s);exports.DDSLoader=o,exports.DRACOLoader=n,exports.GLTFLoader=l,exports.GLTFObject=i,exports.THREEGLTFLoader=s;
|
package/line/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @realsee/five
|
|
3
3
|
*
|
|
4
4
|
* Generated: 2022-09-22
|
|
5
|
-
* Version: 5.0.0-alpha.
|
|
5
|
+
* Version: 5.0.0-alpha.154
|
|
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 t=require("tslib");function e(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)}var n=e(require("three")),i=function(e){function i(){var t=e.call(this)||this;t.type="LineSegmentsGeometry";return t.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),t.setAttribute("position",new n.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)),t.setAttribute("uv",new n.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),t}return t.__extends(i,e),i.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},i.prototype.setPositions=function(t){var e;e=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var i=new n.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceStart",new n.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new n.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},i.prototype.setColors=function(t){var e;e=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var i=new n.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceColorStart",new n.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new n.InterleavedBufferAttribute(i,3,3)),this},i.prototype.fromWireframeGeometry=function(t){return this.setPositions(t.attributes.position.array),this},i.prototype.fromEdgesGeometry=function(t){return this.setPositions(t.attributes.position.array),this},i.prototype.fromMesh=function(t){return this.fromWireframeGeometry(new n.WireframeGeometry(t.geometry)),this},i.prototype.fromLineSegments=function(t){var e=t.geometry;if(e instanceof n.Geometry){var i=(new n.BufferGeometry).fromGeometry(e);this.setPositions(i.attributes.position.array)}else e instanceof n.BufferGeometry&&this.setPositions(e.attributes.position.array);return this},i.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new n.Box3);var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var i=new n.Box3;this.boundingBox.setFromBufferAttribute(t),i.setFromBufferAttribute(e),this.boundingBox.union(i)}},i.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new n.Sphere),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var r=0,o=new n.Vector3,a=0,s=t.count;a<s;a++)o.fromBufferAttribute(t,a),r=Math.max(r,i.distanceToSquared(o)),o.fromBufferAttribute(e,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)}},i.prototype.toJSON=function(){},i}(n.InstancedBufferGeometry);Object.assign(i.prototype,{isLineSegmentsGeometry:!0});var r={uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new n.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"},o=function(e){function i(t){var i=e.call(this,{uniforms:n.UniformsUtils.clone(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.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(t),i}return t.__extends(i,e),i}(n.ShaderMaterial);Object.assign(o.prototype,{isLineMaterial:!0});var a=function(e){function r(t,n){var r=e.call(this)||this;return r.type="LineSegments2",r.geometry=void 0!==t?t:new i,r.material=void 0!==n?n:new o({color:16777215*Math.random()}),r}return t.__extends(r,e),r.prototype.computeLineDistances=function(){for(var t=this.geometry,e=t.attributes.instanceStart,i=t.attributes.instanceEnd,r=new Float32Array(2*e.count),o=new n.Vector3,a=new n.Vector3,s=0,u=0,c=e.count;s<c;s++,u+=2)o.fromBufferAttribute(e,s),a.fromBufferAttribute(i,s),r[u]=0===u?0:r[u-1],r[u+1]=r[u]+o.distanceTo(a);var l=new n.InstancedInterleavedBuffer(r,2,1);return t.setAttribute("instanceDistanceStart",new n.InterleavedBufferAttribute(l,1,0)),t.setAttribute("instanceDistanceEnd",new n.InterleavedBufferAttribute(l,1,1)),this},r.prototype.raycast=function(t,e){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,d=new n.Vector4,p=new n.Vector4,m=new n.Vector4,h=new n.Vector3,v=new n.Matrix4,y=new n.Line3,A=new n.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,S=l.count;b<S;b++){d.fromBufferAttribute(l,b),p.fromBufferAttribute(f,b),d.w=1,p.w=1,d.applyMatrix4(v),p.applyMatrix4(v),d.applyMatrix4(o),p.applyMatrix4(o),d.multiplyScalar(1/d.w),p.multiplyScalar(1/p.w);var w=d.z<-1&&p.z<-1,x=d.z>1&&p.z>1;if(!w&&!x){d.x*=u.x/2,d.y*=u.y/2,p.x*=u.x/2,p.y*=u.y/2,y.start.copy(d),y.start.z=0,y.end.copy(p),y.end.z=0;var B=y.closestPointToPointParameter(h,!0);y.at(B,A);var E=n.MathUtils.lerp(d.z,p.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 C=new n.Vector3,P=new n.Vector3;i.distanceSqToSegment(y.start,y.end,P,C),e.push({point:P,pointOnLine:C,distance:i.origin.distanceTo(P),object:this,faceIndex:b})}}}},r}(n.Mesh);Object.assign(a.prototype,{isLineSegments2:!0});var s=function(e){function n(t,n){var i=e.call(this,t,n)||this;return i.type="Line2",i}return t.__extends(n,e),n}(a);Object.assign(s.prototype,{isLine2:!0});var u=function(e){function i(){var t=e.call(this)||this;return t.type="LineGeometry",t}return t.__extends(i,e),i.prototype.setPositions=function(t){for(var n=t.length-3,i=new Float32Array(2*n),r=0;r<n;r+=3)i[2*r]=t[r],i[2*r+1]=t[r+1],i[2*r+2]=t[r+2],i[2*r+3]=t[r+3],i[2*r+4]=t[r+4],i[2*r+5]=t[r+5];return e.prototype.setPositions.call(this,i),this},i.prototype.setColors=function(t){for(var n=t.length-3,i=new Float32Array(2*n),r=0;r<n;r+=3)i[2*r]=t[r],i[2*r+1]=t[r+1],i[2*r+2]=t[r+2],i[2*r+3]=t[r+3],i[2*r+4]=t[r+4],i[2*r+5]=t[r+5];return e.prototype.setColors.call(this,i),this},i.prototype.fromLine=function(t){var e=t.geometry;if(e instanceof n.Geometry){var i=(new n.BufferGeometry).fromGeometry(e);this.setPositions(i.attributes.position.array)}else e instanceof n.BufferGeometry&&this.setPositions(e.attributes.position.array);return this},i.prototype.copy=function(){return this},i}(i);Object.assign(u.prototype,{isLineGeometry:!0});var c=null,l=function(e){function i(t,i){void 0===t&&(t=new n.Vector3),void 0===i&&(i=new n.Vector3);var r=e.call(this)||this;r.type="FiveLine",r.needsRender=!0;var a=new u,l=new o({color:14467195,linewidth:2,dashScale:20,dashed:!1});r.line=new s(a,l);var f=new n.BufferGeometry,d=new n.PointsMaterial({color:14467195,size:8,map:c||(c=(new n.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 n.Points(f,d),r.points.renderOrder=11,r.points.frustumCulled=!1,r.setPoints(t,i),r.add(r.line,r.points),r}return t.__extends(i,e),Object.defineProperty(i,"version",{get:function(){return"5.0.0-alpha.152"},enumerable:!1,configurable:!0}),i.prototype.setPoints=function(t,e){var i=[].concat(t.toArray(),e.toArray());this.points.geometry.setAttribute("position",new n.BufferAttribute(new Float32Array(i),3)),this.line.geometry.setPositions(i),this.line.computeLineDistances(),this.needsRender=!0},i.prototype.getPoints=function(){var t=this.points.geometry.attributes.position.array;return[new n.Vector3(t[0],t[1],t[2]),new n.Vector3(t[3],t[4],t[5])]},i.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},i.prototype.setResolution=function(t,e){var n=this.line.material.resolution;n.x===t&&n.y===e||(n.set(t,e),this.needsRender=!0)},i}(n.Object3D);Object.assign(l.prototype,{isFiveLine:!0}),exports.Line=l,exports.LineGeometry=u,exports.LineMaterial=o,exports.LineSegmentsGeometry=i,exports.THREE_Line2=s,exports.THREE_LineSegments2=a;
|
|
260
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib");function e(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)}var n=e(require("three")),i=function(e){function i(){var t=e.call(this)||this;t.type="LineSegmentsGeometry";return t.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),t.setAttribute("position",new n.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)),t.setAttribute("uv",new n.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),t}return t.__extends(i,e),i.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},i.prototype.setPositions=function(t){var e;e=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var i=new n.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceStart",new n.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new n.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},i.prototype.setColors=function(t){var e;e=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var i=new n.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceColorStart",new n.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new n.InterleavedBufferAttribute(i,3,3)),this},i.prototype.fromWireframeGeometry=function(t){return this.setPositions(t.attributes.position.array),this},i.prototype.fromEdgesGeometry=function(t){return this.setPositions(t.attributes.position.array),this},i.prototype.fromMesh=function(t){return this.fromWireframeGeometry(new n.WireframeGeometry(t.geometry)),this},i.prototype.fromLineSegments=function(t){var e=t.geometry;if(e instanceof n.Geometry){var i=(new n.BufferGeometry).fromGeometry(e);this.setPositions(i.attributes.position.array)}else e instanceof n.BufferGeometry&&this.setPositions(e.attributes.position.array);return this},i.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new n.Box3);var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var i=new n.Box3;this.boundingBox.setFromBufferAttribute(t),i.setFromBufferAttribute(e),this.boundingBox.union(i)}},i.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new n.Sphere),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var r=0,o=new n.Vector3,a=0,s=t.count;a<s;a++)o.fromBufferAttribute(t,a),r=Math.max(r,i.distanceToSquared(o)),o.fromBufferAttribute(e,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)}},i.prototype.toJSON=function(){},i}(n.InstancedBufferGeometry);Object.assign(i.prototype,{isLineSegmentsGeometry:!0});var r={uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new n.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"},o=function(e){function i(t){var i=e.call(this,{uniforms:n.UniformsUtils.clone(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.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(t),i}return t.__extends(i,e),i}(n.ShaderMaterial);Object.assign(o.prototype,{isLineMaterial:!0});var a=function(e){function r(t,n){var r=e.call(this)||this;return r.type="LineSegments2",r.geometry=void 0!==t?t:new i,r.material=void 0!==n?n:new o({color:16777215*Math.random()}),r}return t.__extends(r,e),r.prototype.computeLineDistances=function(){for(var t=this.geometry,e=t.attributes.instanceStart,i=t.attributes.instanceEnd,r=new Float32Array(2*e.count),o=new n.Vector3,a=new n.Vector3,s=0,u=0,c=e.count;s<c;s++,u+=2)o.fromBufferAttribute(e,s),a.fromBufferAttribute(i,s),r[u]=0===u?0:r[u-1],r[u+1]=r[u]+o.distanceTo(a);var l=new n.InstancedInterleavedBuffer(r,2,1);return t.setAttribute("instanceDistanceStart",new n.InterleavedBufferAttribute(l,1,0)),t.setAttribute("instanceDistanceEnd",new n.InterleavedBufferAttribute(l,1,1)),this},r.prototype.raycast=function(t,e){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,d=new n.Vector4,p=new n.Vector4,m=new n.Vector4,h=new n.Vector3,v=new n.Matrix4,y=new n.Line3,A=new n.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,S=l.count;b<S;b++){d.fromBufferAttribute(l,b),p.fromBufferAttribute(f,b),d.w=1,p.w=1,d.applyMatrix4(v),p.applyMatrix4(v),d.applyMatrix4(o),p.applyMatrix4(o),d.multiplyScalar(1/d.w),p.multiplyScalar(1/p.w);var w=d.z<-1&&p.z<-1,x=d.z>1&&p.z>1;if(!w&&!x){d.x*=u.x/2,d.y*=u.y/2,p.x*=u.x/2,p.y*=u.y/2,y.start.copy(d),y.start.z=0,y.end.copy(p),y.end.z=0;var B=y.closestPointToPointParameter(h,!0);y.at(B,A);var E=n.MathUtils.lerp(d.z,p.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 C=new n.Vector3,P=new n.Vector3;i.distanceSqToSegment(y.start,y.end,P,C),e.push({point:P,pointOnLine:C,distance:i.origin.distanceTo(P),object:this,faceIndex:b})}}}},r}(n.Mesh);Object.assign(a.prototype,{isLineSegments2:!0});var s=function(e){function n(t,n){var i=e.call(this,t,n)||this;return i.type="Line2",i}return t.__extends(n,e),n}(a);Object.assign(s.prototype,{isLine2:!0});var u=function(e){function i(){var t=e.call(this)||this;return t.type="LineGeometry",t}return t.__extends(i,e),i.prototype.setPositions=function(t){for(var n=t.length-3,i=new Float32Array(2*n),r=0;r<n;r+=3)i[2*r]=t[r],i[2*r+1]=t[r+1],i[2*r+2]=t[r+2],i[2*r+3]=t[r+3],i[2*r+4]=t[r+4],i[2*r+5]=t[r+5];return e.prototype.setPositions.call(this,i),this},i.prototype.setColors=function(t){for(var n=t.length-3,i=new Float32Array(2*n),r=0;r<n;r+=3)i[2*r]=t[r],i[2*r+1]=t[r+1],i[2*r+2]=t[r+2],i[2*r+3]=t[r+3],i[2*r+4]=t[r+4],i[2*r+5]=t[r+5];return e.prototype.setColors.call(this,i),this},i.prototype.fromLine=function(t){var e=t.geometry;if(e instanceof n.Geometry){var i=(new n.BufferGeometry).fromGeometry(e);this.setPositions(i.attributes.position.array)}else e instanceof n.BufferGeometry&&this.setPositions(e.attributes.position.array);return this},i.prototype.copy=function(){return this},i}(i);Object.assign(u.prototype,{isLineGeometry:!0});var c=null,l=function(e){function i(t,i){void 0===t&&(t=new n.Vector3),void 0===i&&(i=new n.Vector3);var r=e.call(this)||this;r.type="FiveLine",r.needsRender=!0;var a=new u,l=new o({color:14467195,linewidth:2,dashScale:20,dashed:!1});r.line=new s(a,l);var f=new n.BufferGeometry,d=new n.PointsMaterial({color:14467195,size:8,map:c||(c=(new n.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 n.Points(f,d),r.points.renderOrder=11,r.points.frustumCulled=!1,r.setPoints(t,i),r.add(r.line,r.points),r}return t.__extends(i,e),Object.defineProperty(i,"version",{get:function(){return"5.0.0-alpha.154"},enumerable:!1,configurable:!0}),i.prototype.setPoints=function(t,e){var i=[].concat(t.toArray(),e.toArray());this.points.geometry.setAttribute("position",new n.BufferAttribute(new Float32Array(i),3)),this.line.geometry.setPositions(i),this.line.computeLineDistances(),this.needsRender=!0},i.prototype.getPoints=function(){var t=this.points.geometry.attributes.position.array;return[new n.Vector3(t[0],t[1],t[2]),new n.Vector3(t[3],t[4],t[5])]},i.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},i.prototype.setResolution=function(t,e){var n=this.line.material.resolution;n.x===t&&n.y===e||(n.set(t,e),this.needsRender=!0)},i}(n.Object3D);Object.assign(l.prototype,{isFiveLine:!0}),exports.Line=l,exports.LineGeometry=u,exports.LineMaterial=o,exports.LineSegmentsGeometry=i,exports.THREE_Line2=s,exports.THREE_LineSegments2=a;
|
package/package.json
CHANGED
package/react/index.d.ts
CHANGED
|
@@ -32,12 +32,48 @@ export declare function createFiveFeature<T extends FiveInjectionFeature>(...fea
|
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
export declare function createFiveProvider(fiveInitArgs?: Omit<FiveInitArgs, "renderer" | "scissor">): {
|
|
35
|
-
new (props: FiveProviderPropTypes): {
|
|
35
|
+
new (props: FiveProviderPropTypes | Readonly<FiveProviderPropTypes>): {
|
|
36
36
|
/**
|
|
37
37
|
* five 实例,可以通过 FiveProvider 的 ref.five 获取得到
|
|
38
38
|
* 在一些外部调用方面可以尝试使用
|
|
39
39
|
*/
|
|
40
40
|
five?: Five;
|
|
41
|
+
unmout: boolean;
|
|
42
|
+
loadWork(work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean): Promise<void>;
|
|
43
|
+
shouldComponentUpdate(nextProps: FiveProviderPropTypes): boolean;
|
|
44
|
+
componentWillUnmount(): void;
|
|
45
|
+
render(): React_2.FunctionComponentElement<React_2.ProviderProps<{
|
|
46
|
+
five: Five;
|
|
47
|
+
loadWork: (work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean) => Promise<void>;
|
|
48
|
+
}>>;
|
|
49
|
+
context: any;
|
|
50
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<FiveProviderPropTypes>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void;
|
|
51
|
+
forceUpdate(callback?: () => void): void;
|
|
52
|
+
readonly props: Readonly<FiveProviderPropTypes> & Readonly<{
|
|
53
|
+
children?: React_2.ReactNode;
|
|
54
|
+
}>;
|
|
55
|
+
state: Readonly<{}>;
|
|
56
|
+
refs: {
|
|
57
|
+
[key: string]: React_2.ReactInstance;
|
|
58
|
+
};
|
|
59
|
+
componentDidMount?(): void;
|
|
60
|
+
componentDidCatch?(error: Error, errorInfo: React_2.ErrorInfo): void;
|
|
61
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<FiveProviderPropTypes>, prevState: Readonly<{}>): any;
|
|
62
|
+
componentDidUpdate?(prevProps: Readonly<FiveProviderPropTypes>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
63
|
+
componentWillMount?(): void;
|
|
64
|
+
UNSAFE_componentWillMount?(): void;
|
|
65
|
+
componentWillReceiveProps?(nextProps: Readonly<FiveProviderPropTypes>, nextContext: any): void;
|
|
66
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<FiveProviderPropTypes>, nextContext: any): void;
|
|
67
|
+
componentWillUpdate?(nextProps: Readonly<FiveProviderPropTypes>, nextState: Readonly<{}>, nextContext: any): void;
|
|
68
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<FiveProviderPropTypes>, nextState: Readonly<{}>, nextContext: any): void;
|
|
69
|
+
};
|
|
70
|
+
new (props: FiveProviderPropTypes, context: any): {
|
|
71
|
+
/**
|
|
72
|
+
* five 实例,可以通过 FiveProvider 的 ref.five 获取得到
|
|
73
|
+
* 在一些外部调用方面可以尝试使用
|
|
74
|
+
*/
|
|
75
|
+
five?: Five;
|
|
76
|
+
unmout: boolean;
|
|
41
77
|
loadWork(work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean): Promise<void>;
|
|
42
78
|
shouldComponentUpdate(nextProps: FiveProviderPropTypes): boolean;
|
|
43
79
|
componentWillUnmount(): void;
|
package/react/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @realsee/five
|
|
3
3
|
*
|
|
4
4
|
* Generated: 2022-09-22
|
|
5
|
-
* Version: 5.0.0-alpha.
|
|
5
|
+
* Version: 5.0.0-alpha.154
|
|
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("tslib"),t=require("react"),n=require("three"),r=require("@realsee/five");function o(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)}var u=o(t),i=o(n),a=[],f=[];var c=u.createContext(null);function s(){var e=u.useContext(c);if(!e)throw new Error("FiveProvider never found.");return e.five}function l(){var e=u.useContext(c);if(!e)throw new Error("FiveProvider never found.");return e.loadWork}var d={display:"inline-block",overflow:"hidden"};function v(e,t){var n=s(),r=[n];void 0!==t&&(r=r.concat(t)),u.useLayoutEffect((function(){return e(n.scene)}),r)}var p=v;function h(t){return e.__assign({},t.state)}function m(e){var t=e.camera.getWorldDirection(new i.Vector3);return new i.Raycaster(e.camera.position,t)}function y(e){return e.camera.getWorldDirection(new i.Vector3)}function g(e){return e.model.empty?"Empty":"Loaded"}function S(e,t){return t.indexOf(e)>=0}function b(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];void 0!==t[o]&&(e[o]=t[o])}}function C(e,t){if(S("loadWork",t))return e}function w(e,t){if(S("setState",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.setState.apply(e,t)}}function k(e,t){if(S("on",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.on.apply(e,t)}}function x(e,t){if(S("on",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.once.apply(e,t)}}function E(e,t){if(S("off",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.off.apply(e,t)}}function L(e,t){if(S("intersectRaycaster",t))return function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return(t=e.model).intersectRaycaster.apply(t,n)}}function F(e,t){if(S("project2d",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.project2d.apply(e,t)}}function _(e,t){if(S("updateCamera",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.updateCamera.apply(e,t)}}function P(e,t){if(S("initBasisLoader",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.initBasisLoader.apply(e,t)}}function R(e,t){if(S("getPixels",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.getPixels.apply(e,t)}}function V(e,t){if(S("render",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.render.apply(e,t)}}function W(e,t){if(S("needsRender",t))return function(){e.needsRender=!0}}function M(e,t){if(S("preloadPano",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.preloadPano.apply(e,t)}}function O(e,t){if(S("showFloor",t))return function(t){"number"==typeof t?e.model.show(t):e.model.show()}}function j(e,t){if(S("toggleHelperVisible",t))return function(t){e.helperVisible=t}}function A(e,t){for(var n={},r=t.length,o=-1;++o<r;){var u=t[o];u in e&&(n[u]=e[u])}return n}function N(e,t){for(var n=0;n<e.length;n++)for(var r=0;r<t.length;r++)if(e[n]===t[r])return!0;return!1}var U=function(){function t(e,t){this.values=e,this.listeners=[],this.onValuesChange=t}return t.prototype.on=function(e,t){var n=this,r=[e,t];return this.listeners.push(r),function(){var e=n.listeners.indexOf(r);e>=0&&n.listeners.splice(e,1)}},t.prototype.getValues=function(e){return A(this.values,e)},t.prototype.setValues=function(t,n){var r,o,u=[];for(var i in n)t.indexOf(i)>=0&&(r=n[i],o=this.values[i],!("number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o)||r===o))&&u.push(i);if(0!==u.length){for(var a=e.__assign({},this.values),f=0,c=u;f<c.length;f++){var s=c[f];this.values[s]=n[s]}this.onValuesChange&&this.onValuesChange(this.values,a);for(var l=0,d=this.listeners;l<d.length;l++){var v=d[l],p=v[0],h=v[1];if(N(p,u)){var m=A(a,p);h(A(this.values,p),m)}}}},t}();exports.FiveCanvas=function(t){var n=t.width,r=t.height,o=s(),i=u.createRef(),a=e.__assign({width:n,height:r},d);return u.useLayoutEffect((function(){if(i.current&&o.renderer){if(null!==o.renderer.domElement.parentNode&&o.renderer.domElement.parentNode!==i.current)throw new Error("There are more than 2 fiveCanvas in this context.");o.renderer.domElement.parentNode!==i.current&&i.current.appendChild(o.renderer.domElement),o.camera.aspect=n/r,o.camera.updateProjectionMatrix(),o.renderer.setSize(n,r),o.needsRender=!0}}),[n,r,i.current]),u.createElement("div",{ref:i,style:a})},exports.INJECTION_PROPNAME="$five",exports.Store=U,exports.createFiveFeature=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e},exports.createFiveProvider=function(t){return void 0===t&&(t={}),function(n){function o(o){var u,c=this;c=n.call(this,o)||this;var s=function(e){var t=void 0===e?{}:e,n=t.backgroundColor,r=void 0===n?1579548:n,o=t.backgroundAlpha,u=void 0===o?1:o,c=t.pixelRatio,s=void 0===c?1:c,l=t.webgl2,d=void 0!==l&&l;if("undefined"!=typeof window){var v=null;if(!(v=d?a.shift():f.shift())){if(d){var p=document.createElement("canvas"),h=p.getContext("webgl2");if(null===h)throw new Error("error occurred when getting webgl2 canvas context");v=new i.WebGLRenderer({antialias:!1,alpha:!0,canvas:p,context:h})}else v=new i.WebGLRenderer({antialias:!1,alpha:!0});v.outputEncoding=i.sRGBEncoding}return v.setPixelRatio(s),v.setClearColor(r,u),v.autoClear=!0,v}}({pixelRatio:1===r.getViewportScale()?window.devicePixelRatio:1,backgroundAlpha:t.backgroundAlpha,backgroundColor:t.backgroundColor,webgl2:null==t?void 0:t.webgl2});return c.five=new r.Five(e.__assign({renderer:s},t)),(o.work||o.initialWork)&&c.five.load(o.work||o.initialWork,o.initialState,void 0,null===(u=o.initialUserAction)||void 0===u||u),c.five.on("load",(function(){var e;c.props.onWorkChange&&c.props.onWorkChange(null===(e=c.five)||void 0===e?void 0:e.work)})),c.five.on("stateChange",(function(e,t){c.props.onStateChange&&c.props.onStateChange(e,t)})),c.five.on("currentStateChange",(function(e,t){c.props.onCurrentStateChange&&c.props.onCurrentStateChange(e,t)})),c.five.on("error",(function(e){c.props.onError?c.props.onError(e):console.warn(e.message)})),c}return e.__extends(o,n),o.prototype.loadWork=function(e,t,n,r){if(void 0===r&&(r=!0),this.props.work)throw new Error("props 'work' is set in fiveProvider, if you need modify work internal, use 'initialWork' instead.");return this.five.load(e,t,n,r)},o.prototype.shouldComponentUpdate=function(e){var t,n;return e.work&&e.work!==(null===(t=this.five)||void 0===t?void 0:t.work)&&(null===(n=this.five)||void 0===n||n.load(e.work,e.initialState)),!0},o.prototype.componentWillUnmount=function(){var e;this.five&&(this.five.dispose(),(e=this.five.renderer)&&(e.capabilities.isWebGL2?-1===f.indexOf(e)&&f.push(e):-1===a.indexOf(e)&&a.push(e)),delete this.five)},o.prototype.render=function(){var e=this;return u.createElement(c.Provider,{value:{five:this.five,loadWork:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.loadWork.apply(e,t)}}},this.props.children)},o}(u.Component)},exports.createStore=function(t){var n=u.createContext(null);return{useStore:function(t){var r=u.useContext(n);if(null===r)throw new Error("StoreProvider never found.");var o=u.useRef(!0),i=u.useState(r.getValues(t)),a=i[0],f=i[1],c=e.__spreadArray([r],t,!0);u.useLayoutEffect((function(){return o.current?o.current=!1:f(r.getValues(t)),r.on(t,(function(e){return f(e)}))}),c);var s=u.useCallback((function(e){return r.setValues(t,e)}),c);return[a,s]},useStoreSetter:function(t){var r=u.useContext(n);if(null===r)throw new Error("StoreProvider never found.");return u.useCallback((function(e){return r.setValues(t,e)}),e.__spreadArray([r],t,!0))},watchStore:function(t,r,o){var i=u.useContext(n);if(null===i)throw new Error("StoreProvider never found.");var a=e.__spreadArray([i],t,!0);void 0!==o&&(a=a.concat(o)),u.useLayoutEffect((function(){return i.on(t,r)}),a)},useStoreAction:function(r){var o=u.useContext(n);if(null===o)throw new Error("StoreProvider never found.");var i=u.useCallback((function(){for(var n=[],u=0;u<arguments.length;u++)n[u]=arguments[u];var i=t[r],a=i[0],f=i.slice(1),c=function(){return o.getValues(f)},s=function(e){return o.setValues(f,e)};return a.apply(void 0,e.__spreadArray([c,s],n,!1))}),[]);return i},StoreProvider:function(t){function r(e){var n=t.call(this,e)||this;return n.store=new U(e.initialValue,(function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];n.props.onValuesChange&&(e=n.props).onValuesChange.apply(e,t)})),n}return e.__extends(r,t),r.prototype.shouldComponentUpdate=function(e){return e.children!==this.props.children},r.prototype.render=function(){return u.createElement(n.Provider,{value:this.store},this.props.children)},r}(u.Component)}},exports.unsafe__useFiveInstance=function(){return s()},exports.useFiveAction=function(){var e=s();return{updateCamera:u.useCallback((function(t,n){return e.updateCamera(t,n)}),[e]),initBasisLoader:u.useCallback((function(t){return e.initBasisLoader(t)}),[e]),getPixels:u.useCallback((function(t,n,r,o,u){return e.getPixels(t,n,r,o,u)}),[e]),render:u.useCallback((function(t){return e.render(t)}),[e]),needsRender:u.useCallback((function(){return e.needsRender=!0}),[e]),preloadPano:u.useCallback((function(t,n){return e.preloadPano(t,n)}),[e])}},exports.useFiveCameraDirection=function(){var e=s(),t=u.useState((function(){return y(e)})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return r(y(e))}))}),[e]),n},exports.useFiveCameraRaycaster=function(){var e=s(),t=u.useState((function(){return m(e)})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return r(m(e))}))}),[e]),n},exports.useFiveCurrentObserver=function(){var e=s(),t=u.useState((function(){return e.getCurrentState()})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return r(e.getCurrentState())}))}),[e]),e.work?e.work.observers[n.panoIndex]:null},exports.useFiveCurrentState=function(){var e=s(),t=u.useState((function(){return e.getCurrentState()})),n=t[0],r=t[1],o=u.useCallback((function(t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!0);var o="function"==typeof t?t(e.getCurrentState()):t;e.setState(o,n,r)}),[e]);return u.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return r(e.getCurrentState())}))}),[e]),[n,o]},exports.useFiveEventCallback=function(e,t,n){var r=s(),o=[r,e];void 0!==n&&(o=o.concat(n)),u.useLayoutEffect((function(){return r.on(e,t)}),o)},exports.useFiveFloor=function(){var e=s(),t=u.useState(e.model.shownFloor),n=t[0],r=t[1],o=u.useState(e.model.floorLength),i=o[0],a=o[1],f=u.useCallback((function(t){"number"==typeof t?e.model.show(t):e.model.show()}),[e]);return u.useLayoutEffect((function(){var t=[];return t.push(e.on("modelShownFloorChange",(function(){return r(e.model.shownFloor)}))),t.push(e.on("modelLoaded",(function(){return a(e.model.floorLength)}))),function(){for(var e;e=t.shift();)e()}}),[e]),[n,i,f]},exports.useFiveHelper=function(){var e=s(),t=u.useState(e.helperVisible),n=t[0],r=t[1],o=u.useCallback((function(t){e.helperVisible=t}),[e]);return u.useLayoutEffect((function(){return e.on("helpersVisibleChange",(function(e){return r(e)}))}),[e]),[n,o]},exports.useFiveModelIntersectRaycaster=function(){var e=s();return u.useCallback((function(t){return e.model.intersectRaycaster(t)}),[e])},exports.useFiveModelReadyState=function(){var e=s(),t=u.useState((function(){return g(e)})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("modelLoaded",(function(){return r(g(e))}))}),[e]),n},exports.useFiveProject2d=function(){var e=s(),t=u.useState((function(){return Symbol()}));t[0];var n=t[1];return u.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return n(Symbol())}))}),[e]),u.useCallback((function(t,n){return e.project2d(t,n)}),[e])},exports.useFiveScene=p,exports.useFiveSceneEffect=v,exports.useFiveState=function(){var e=s(),t=u.useState((function(){return h(e)})),n=t[0],r=t[1],o=u.useCallback((function(t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!0);var o="function"==typeof t?t(e.getCurrentState()):t;e.setState(o,n,r)}),[e]);return u.useLayoutEffect((function(){return e.on("stateChange",(function(){return r(h(e))}))}),[e]),[n,o]},exports.useFiveWork=function(){var e=s(),t=l(),n=u.useState((function(){return e.work})),r=n[0],o=n[1];return u.useLayoutEffect((function(){return e.on("load",(function(){return o(e.work)}))}),[e]),[r,t]},exports.withFive=function(t){return function(n){return u.forwardRef((function(r,o){var a=s(),f=l(),c=function(e,t){return[S("unsafe__fiveInstance",t)?e:void 0]}(a,t)[0],d=function(t,n){var r=S("state",n),o=u.useState(Symbol()),i=o[0],a=o[1],f=u.useMemo((function(){if(r)return e.__assign({},t.state)}),[t,i]);return u.useLayoutEffect((function(){if(r)return t.on("stateChange",(function(){return a(Symbol())}))}),[t]),[f,i]}(a,t),v=d[0],p=d[1],h=function(e,t){var n=S("currentState",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.getCurrentState()}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("currentStateChange",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),m=h[0],y=h[1],g=function(e,t){var n=S("currentObserver",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.getCurrentState()}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("currentStateChange",(function(){return i(Symbol())}))}),[e]),[a?e.work?e.work.observers[a.panoIndex]:null:void 0,o]}(a,t),A=g[0],N=g[1],U=function(e,t){var n=S("work",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.work}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("load",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),D=U[0],I=U[1],B=function(e,t){var n=S("model",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),q=B[0],G=B[1],H=function(e,t){return[S("scene",t)?e.scene:void 0]}(a,t)[0],z=function(e,t){var n=S("cameraDirection",t),r=u.useState(Symbol()),o=r[0],a=r[1],f=u.useMemo((function(){if(n)return e.camera.getWorldDirection(new i.Vector3)}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,o]}(a,t),T=z[0],$=z[1],J=function(e,t){var n=S("cameraRaycaster",t),r=u.useState(Symbol()),o=r[0],a=r[1],f=u.useMemo((function(){if(n){var t=e.camera.getWorldDirection(new i.Vector3);return new i.Raycaster(e.camera.position,t)}}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,o]}(a,t),K=J[0],Q=J[1],X=function(e,t){var n=S("modelReadyState",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model.empty?"Empty":"Loaded"}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),Y=X[0],Z=X[1],ee=function(e,t){var n=S("shownFloor",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model.shownFloor}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelShownFloorChange",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),te=ee[0],ne=ee[1],re=function(e,t){var n=S("totalFloorLength",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model.hasFloors()}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),oe=re[0],ue=re[1],ie=function(e,t){var n=S("helperVisible",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.helperVisible}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("helpersVisibleChange",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),ae=ie[0],fe=ie[1],ce=u.useMemo((function(){var e={};return b(e,{setState:w(a,t),loadWork:C(f,t),on:k(a,t),once:x(a,t),off:E(a,t),intersectRaycaster:L(a,t),project2d:F(a,t),updateCamera:_(a,t),initBasisLoader:P(a,t),getPixels:R(a,t),render:V(a,t),needsRender:W(a,t),preloadPano:M(a,t),showFloor:O(a,t),toggleHelperVisible:j(a,t)}),e}),[a,f]),se=u.useMemo((function(){var t=e.__assign({},ce);return b(t,{unsafe__fiveInstance:c,state:v,currentState:m,currentObserver:A,work:D,model:q,scene:H,cameraDirection:T,cameraRaycaster:K,modelReadyState:Y,shownFloor:te,totalFloorLength:oe,helperVisible:ae}),t}),[a,ce,p,y,N,I,G,$,Q,Z,ne,ue,fe]);return u.createElement(n,e.__assign({ref:o,$five:se},r))}))}};
|
|
260
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react"),n=require("three"),r=require("@realsee/five");function o(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)}var u=o(t),i=o(n),a=[],f=[];var s=u.createContext(null);function c(){var e=u.useContext(s);if(!e)throw new Error("FiveProvider never found.");return e.five}function l(){var e=u.useContext(s);if(!e)throw new Error("FiveProvider never found.");return e.loadWork}var d={display:"inline-block",overflow:"hidden"};function v(e,t){var n=c(),r=[n];void 0!==t&&(r=r.concat(t)),u.useLayoutEffect((function(){return e(n.scene)}),r)}var p=v;function h(t){return e.__assign({},t.state)}function m(e){var t=e.camera.getWorldDirection(new i.Vector3);return new i.Raycaster(e.camera.position,t)}function y(e){return e.camera.getWorldDirection(new i.Vector3)}function g(e){return e.model.empty?"Empty":"Loaded"}function S(e,t){return t.indexOf(e)>=0}function b(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];void 0!==t[o]&&(e[o]=t[o])}}function C(e,t){if(S("loadWork",t))return e}function w(e,t){if(S("setState",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.setState.apply(e,t)}}function k(e,t){if(S("on",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.on.apply(e,t)}}function x(e,t){if(S("on",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.once.apply(e,t)}}function E(e,t){if(S("off",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.off.apply(e,t)}}function L(e,t){if(S("intersectRaycaster",t))return function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return(t=e.model).intersectRaycaster.apply(t,n)}}function F(e,t){if(S("project2d",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.project2d.apply(e,t)}}function _(e,t){if(S("updateCamera",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.updateCamera.apply(e,t)}}function P(e,t){if(S("initBasisLoader",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.initBasisLoader.apply(e,t)}}function R(e,t){if(S("getPixels",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.getPixels.apply(e,t)}}function V(e,t){if(S("render",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.render.apply(e,t)}}function W(e,t){if(S("needsRender",t))return function(){e.needsRender=!0}}function M(e,t){if(S("preloadPano",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.preloadPano.apply(e,t)}}function O(e,t){if(S("showFloor",t))return function(t){"number"==typeof t?e.model.show(t):e.model.show()}}function j(e,t){if(S("toggleHelperVisible",t))return function(t){e.helperVisible=t}}function A(e,t){for(var n={},r=t.length,o=-1;++o<r;){var u=t[o];u in e&&(n[u]=e[u])}return n}function N(e,t){for(var n=0;n<e.length;n++)for(var r=0;r<t.length;r++)if(e[n]===t[r])return!0;return!1}var U=function(){function t(e,t){this.values=e,this.listeners=[],this.onValuesChange=t}return t.prototype.on=function(e,t){var n=this,r=[e,t];return this.listeners.push(r),function(){var e=n.listeners.indexOf(r);e>=0&&n.listeners.splice(e,1)}},t.prototype.getValues=function(e){return A(this.values,e)},t.prototype.setValues=function(t,n){var r,o,u=[];for(var i in n)t.indexOf(i)>=0&&(r=n[i],o=this.values[i],!("number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o)||r===o))&&u.push(i);if(0!==u.length){for(var a=e.__assign({},this.values),f=0,s=u;f<s.length;f++){var c=s[f];this.values[c]=n[c]}this.onValuesChange&&this.onValuesChange(this.values,a);for(var l=0,d=this.listeners;l<d.length;l++){var v=d[l],p=v[0],h=v[1];if(N(p,u)){var m=A(a,p);h(A(this.values,p),m)}}}},t}();exports.FiveCanvas=function(t){var n=t.width,r=t.height,o=c(),i=u.createRef(),a=e.__assign({width:n,height:r},d);return u.useLayoutEffect((function(){if(i.current&&o.renderer){if(null!==o.renderer.domElement.parentNode&&o.renderer.domElement.parentNode!==i.current)throw new Error("There are more than 2 fiveCanvas in this context.");o.renderer.domElement.parentNode!==i.current&&i.current.appendChild(o.renderer.domElement),o.camera.aspect=n/r,o.camera.updateProjectionMatrix(),o.renderer.setSize(n,r),o.needsRender=!0}}),[n,r,i.current]),u.createElement("div",{ref:i,style:a})},exports.INJECTION_PROPNAME="$five",exports.Store=U,exports.createFiveFeature=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e},exports.createFiveProvider=function(t){return void 0===t&&(t={}),function(n){function o(){var e=null!==n&&n.apply(this,arguments)||this;return e.unmout=!1,e}return e.__extends(o,n),o.prototype.loadWork=function(e,t,n,r){if(void 0===r&&(r=!0),this.props.work)throw new Error("props 'work' is set in fiveProvider, if you need modify work internal, use 'initialWork' instead.");return this.five.load(e,t,n,r)},o.prototype.shouldComponentUpdate=function(e){var t,n;return e.work&&e.work!==(null===(t=this.five)||void 0===t?void 0:t.work)&&(null===(n=this.five)||void 0===n||n.load(e.work,e.initialState)),!0},o.prototype.componentWillUnmount=function(){var e;this.unmout=!0,this.five&&(this.five.dispose(),(e=this.five.renderer)&&(e.capabilities.isWebGL2?-1===f.indexOf(e)&&f.push(e):-1===a.indexOf(e)&&a.push(e)),delete this.five)},o.prototype.render=function(){var n,o=this;if(this.unmout)return null;if(!this.five){var c=function(e){var t=void 0===e?{}:e,n=t.backgroundColor,r=void 0===n?1579548:n,o=t.backgroundAlpha,u=void 0===o?1:o,s=t.pixelRatio,c=void 0===s?1:s,l=t.webgl2,d=void 0!==l&&l;if("undefined"!=typeof window){var v=null;if(!(v=d?a.shift():f.shift())){if(d){var p=document.createElement("canvas"),h=p.getContext("webgl2");if(null===h)throw new Error("error occurred when getting webgl2 canvas context");v=new i.WebGLRenderer({antialias:!1,alpha:!0,canvas:p,context:h})}else v=new i.WebGLRenderer({antialias:!1,alpha:!0});v.outputEncoding=i.sRGBEncoding}return v.setPixelRatio(c),v.setClearColor(r,u),v.autoClear=!0,v}}({pixelRatio:1===r.getViewportScale()?window.devicePixelRatio:1,backgroundAlpha:t.backgroundAlpha,backgroundColor:t.backgroundColor,webgl2:null==t?void 0:t.webgl2});this.five=new r.Five(e.__assign({renderer:c},t)),(this.props.work||this.props.initialWork)&&this.five.load(this.props.work||this.props.initialWork,this.props.initialState,void 0,null===(n=this.props.initialUserAction)||void 0===n||n),this.five.on("load",(function(){var e;o.props.onWorkChange&&o.props.onWorkChange(null===(e=o.five)||void 0===e?void 0:e.work)})),this.five.on("stateChange",(function(e,t){o.props.onStateChange&&o.props.onStateChange(e,t)})),this.five.on("currentStateChange",(function(e,t){o.props.onCurrentStateChange&&o.props.onCurrentStateChange(e,t)})),this.five.on("error",(function(e){o.props.onError?o.props.onError(e):console.warn(e.message)}))}return u.createElement(s.Provider,{value:{five:this.five,loadWork:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.loadWork.apply(o,e)}}},this.props.children)},o}(u.Component)},exports.createStore=function(t){var n=u.createContext(null);return{useStore:function(t){var r=u.useContext(n);if(null===r)throw new Error("StoreProvider never found.");var o=u.useRef(!0),i=u.useState(r.getValues(t)),a=i[0],f=i[1],s=e.__spreadArray([r],t,!0);u.useLayoutEffect((function(){return o.current?o.current=!1:f(r.getValues(t)),r.on(t,(function(e){return f(e)}))}),s);var c=u.useCallback((function(e){return r.setValues(t,e)}),s);return[a,c]},useStoreSetter:function(t){var r=u.useContext(n);if(null===r)throw new Error("StoreProvider never found.");return u.useCallback((function(e){return r.setValues(t,e)}),e.__spreadArray([r],t,!0))},watchStore:function(t,r,o){var i=u.useContext(n);if(null===i)throw new Error("StoreProvider never found.");var a=e.__spreadArray([i],t,!0);void 0!==o&&(a=a.concat(o)),u.useLayoutEffect((function(){return i.on(t,r)}),a)},useStoreAction:function(r){var o=u.useContext(n);if(null===o)throw new Error("StoreProvider never found.");var i=u.useCallback((function(){for(var n=[],u=0;u<arguments.length;u++)n[u]=arguments[u];var i=t[r],a=i[0],f=i.slice(1),s=function(){return o.getValues(f)},c=function(e){return o.setValues(f,e)};return a.apply(void 0,e.__spreadArray([s,c],n,!1))}),[]);return i},StoreProvider:function(t){function r(e){var n=t.call(this,e)||this;return n.store=new U(e.initialValue,(function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];n.props.onValuesChange&&(e=n.props).onValuesChange.apply(e,t)})),n}return e.__extends(r,t),r.prototype.shouldComponentUpdate=function(e){return e.children!==this.props.children},r.prototype.render=function(){return u.createElement(n.Provider,{value:this.store},this.props.children)},r}(u.Component)}},exports.unsafe__useFiveInstance=function(){return c()},exports.useFiveAction=function(){var e=c();return{updateCamera:u.useCallback((function(t,n){return e.updateCamera(t,n)}),[e]),initBasisLoader:u.useCallback((function(t){return e.initBasisLoader(t)}),[e]),getPixels:u.useCallback((function(t,n,r,o,u){return e.getPixels(t,n,r,o,u)}),[e]),render:u.useCallback((function(t){return e.render(t)}),[e]),needsRender:u.useCallback((function(){return e.needsRender=!0}),[e]),preloadPano:u.useCallback((function(t,n){return e.preloadPano(t,n)}),[e])}},exports.useFiveCameraDirection=function(){var e=c(),t=u.useState((function(){return y(e)})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return r(y(e))}))}),[e]),n},exports.useFiveCameraRaycaster=function(){var e=c(),t=u.useState((function(){return m(e)})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return r(m(e))}))}),[e]),n},exports.useFiveCurrentObserver=function(){var e=c(),t=u.useState((function(){return e.getCurrentState()})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return r(e.getCurrentState())}))}),[e]),e.work?e.work.observers[n.panoIndex]:null},exports.useFiveCurrentState=function(){var e=c(),t=u.useState((function(){return e.getCurrentState()})),n=t[0],r=t[1],o=u.useCallback((function(t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!0);var o="function"==typeof t?t(e.getCurrentState()):t;e.setState(o,n,r)}),[e]);return u.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return r(e.getCurrentState())}))}),[e]),[n,o]},exports.useFiveEventCallback=function(e,t,n){var r=c(),o=[r,e];void 0!==n&&(o=o.concat(n)),u.useLayoutEffect((function(){return r.on(e,t)}),o)},exports.useFiveFloor=function(){var e=c(),t=u.useState(e.model.shownFloor),n=t[0],r=t[1],o=u.useState(e.model.floorLength),i=o[0],a=o[1],f=u.useCallback((function(t){"number"==typeof t?e.model.show(t):e.model.show()}),[e]);return u.useLayoutEffect((function(){var t=[];return t.push(e.on("modelShownFloorChange",(function(){return r(e.model.shownFloor)}))),t.push(e.on("modelLoaded",(function(){return a(e.model.floorLength)}))),function(){for(var e;e=t.shift();)e()}}),[e]),[n,i,f]},exports.useFiveHelper=function(){var e=c(),t=u.useState(e.helperVisible),n=t[0],r=t[1],o=u.useCallback((function(t){e.helperVisible=t}),[e]);return u.useLayoutEffect((function(){return e.on("helpersVisibleChange",(function(e){return r(e)}))}),[e]),[n,o]},exports.useFiveModelIntersectRaycaster=function(){var e=c();return u.useCallback((function(t){return e.model.intersectRaycaster(t)}),[e])},exports.useFiveModelReadyState=function(){var e=c(),t=u.useState((function(){return g(e)})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("modelLoaded",(function(){return r(g(e))}))}),[e]),n},exports.useFiveProject2d=function(){var e=c(),t=u.useState((function(){return Symbol()}));t[0];var n=t[1];return u.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return n(Symbol())}))}),[e]),u.useCallback((function(t,n){return e.project2d(t,n)}),[e])},exports.useFiveScene=p,exports.useFiveSceneEffect=v,exports.useFiveState=function(){var e=c(),t=u.useState((function(){return h(e)})),n=t[0],r=t[1],o=u.useCallback((function(t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!0);var o="function"==typeof t?t(e.getCurrentState()):t;e.setState(o,n,r)}),[e]);return u.useLayoutEffect((function(){return e.on("stateChange",(function(){return r(h(e))}))}),[e]),[n,o]},exports.useFiveWork=function(){var e=c(),t=l(),n=u.useState((function(){return e.work})),r=n[0],o=n[1];return u.useLayoutEffect((function(){return e.on("load",(function(){return o(e.work)}))}),[e]),[r,t]},exports.withFive=function(t){return function(n){return u.forwardRef((function(r,o){var a=c(),f=l(),s=function(e,t){return[S("unsafe__fiveInstance",t)?e:void 0]}(a,t)[0],d=function(t,n){var r=S("state",n),o=u.useState(Symbol()),i=o[0],a=o[1],f=u.useMemo((function(){if(r)return e.__assign({},t.state)}),[t,i]);return u.useLayoutEffect((function(){if(r)return t.on("stateChange",(function(){return a(Symbol())}))}),[t]),[f,i]}(a,t),v=d[0],p=d[1],h=function(e,t){var n=S("currentState",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.getCurrentState()}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("currentStateChange",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),m=h[0],y=h[1],g=function(e,t){var n=S("currentObserver",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.getCurrentState()}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("currentStateChange",(function(){return i(Symbol())}))}),[e]),[a?e.work?e.work.observers[a.panoIndex]:null:void 0,o]}(a,t),A=g[0],N=g[1],U=function(e,t){var n=S("work",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.work}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("load",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),D=U[0],I=U[1],B=function(e,t){var n=S("model",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),q=B[0],G=B[1],H=function(e,t){return[S("scene",t)?e.scene:void 0]}(a,t)[0],z=function(e,t){var n=S("cameraDirection",t),r=u.useState(Symbol()),o=r[0],a=r[1],f=u.useMemo((function(){if(n)return e.camera.getWorldDirection(new i.Vector3)}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,o]}(a,t),T=z[0],$=z[1],J=function(e,t){var n=S("cameraRaycaster",t),r=u.useState(Symbol()),o=r[0],a=r[1],f=u.useMemo((function(){if(n){var t=e.camera.getWorldDirection(new i.Vector3);return new i.Raycaster(e.camera.position,t)}}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,o]}(a,t),K=J[0],Q=J[1],X=function(e,t){var n=S("modelReadyState",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model.empty?"Empty":"Loaded"}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),Y=X[0],Z=X[1],ee=function(e,t){var n=S("shownFloor",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model.shownFloor}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelShownFloorChange",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),te=ee[0],ne=ee[1],re=function(e,t){var n=S("totalFloorLength",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model.hasFloors()}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),oe=re[0],ue=re[1],ie=function(e,t){var n=S("helperVisible",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.helperVisible}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("helpersVisibleChange",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),ae=ie[0],fe=ie[1],se=u.useMemo((function(){var e={};return b(e,{setState:w(a,t),loadWork:C(f,t),on:k(a,t),once:x(a,t),off:E(a,t),intersectRaycaster:L(a,t),project2d:F(a,t),updateCamera:_(a,t),initBasisLoader:P(a,t),getPixels:R(a,t),render:V(a,t),needsRender:W(a,t),preloadPano:M(a,t),showFloor:O(a,t),toggleHelperVisible:j(a,t)}),e}),[a,f]),ce=u.useMemo((function(){var t=e.__assign({},se);return b(t,{unsafe__fiveInstance:s,state:v,currentState:m,currentObserver:A,work:D,model:q,scene:H,cameraDirection:T,cameraRaycaster:K,modelReadyState:Y,shownFloor:te,totalFloorLength:oe,helperVisible:ae}),t}),[a,se,p,y,N,I,G,$,Q,Z,ne,ue,fe]);return u.createElement(n,e.__assign({ref:o,$five:ce},r))}))}};
|
package/server/index.js
CHANGED
package/sticker/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @realsee/five
|
|
3
3
|
*
|
|
4
4
|
* Generated: 2022-09-22
|
|
5
|
-
* Version: 5.0.0-alpha.
|
|
5
|
+
* Version: 5.0.0-alpha.154
|
|
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("tslib");function t(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)}var n=t(require("three")),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]),a=new Uint8Array([0,1,2,1,3,2]),o=new n.BufferGeometry;o.setAttribute("position",new n.BufferAttribute(r,3)),o.setAttribute("uv",new n.BufferAttribute(i,2)),o.setIndex(new n.BufferAttribute(a,1));var s=window,u=s.requestAnimationFrame||s.mozRequestAnimationFrame||s.webkitRequestAnimationFrame||s.msRequestAnimationFrame||function(e){return setTimeout(e,16)},d="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),p="undefined"!=typeof performance?function(){return d+performance.now()}:function(){return Date.now()};function c(e,t){var n=e.dispose;e.dispose=function(){t(),n.call(e)}}var f=function(t){function r(e,r,i){var a,s,d,f,l,m,g=this,v=new n.MeshBasicMaterial;if((g=t.call(this,o,v)||this)._needsRender=!1,g.scale.set(e,r,1),"string"==typeof i){v.transparent=/\.png$/.test(i);var h=new Image;h.src=i,h.crossOrigin="",i=h}if(i instanceof HTMLImageElement){var w=v.map=new n.Texture;w.wrapS=n.ClampToEdgeWrapping,w.wrapT=n.ClampToEdgeWrapping,w.minFilter=n.LinearFilter,w.encoding=n.sRGBEncoding,c(w,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(){w.image=i,w.needsUpdate=!0,g._needsRender=!0})))}else if(i instanceof HTMLCanvasElement)v.map=new n.CanvasTexture(i);else if(i instanceof HTMLVideoElement){var b=v.map=new n.VideoTexture(i);b.wrapS=n.ClampToEdgeWrapping,b.wrapT=n.ClampToEdgeWrapping,b.minFilter=n.LinearFilter,b.encoding=n.sRGBEncoding,c(b,(a=i,s=function(){g._needsRender=!0},d=p(),f=!1,l=function(){f=!0,s(),p()-d<3e3?u(l):f=!1},m=function(){d=p(),!1===f&&l()},a.addEventListener("timeupdate",m,!1),function(){a.removeEventListener("timeupdate",m,!1),f=!1}))}return g}return e.__extends(r,t),Object.defineProperty(r,"version",{get:function(){return"5.0.0-alpha.
|
|
260
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib");function t(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)}var n=t(require("three")),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]),a=new Uint8Array([0,1,2,1,3,2]),o=new n.BufferGeometry;o.setAttribute("position",new n.BufferAttribute(r,3)),o.setAttribute("uv",new n.BufferAttribute(i,2)),o.setIndex(new n.BufferAttribute(a,1));var s=window,u=s.requestAnimationFrame||s.mozRequestAnimationFrame||s.webkitRequestAnimationFrame||s.msRequestAnimationFrame||function(e){return setTimeout(e,16)},d="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),p="undefined"!=typeof performance?function(){return d+performance.now()}:function(){return Date.now()};function c(e,t){var n=e.dispose;e.dispose=function(){t(),n.call(e)}}var f=function(t){function r(e,r,i){var a,s,d,f,l,m,g=this,v=new n.MeshBasicMaterial;if((g=t.call(this,o,v)||this)._needsRender=!1,g.scale.set(e,r,1),"string"==typeof i){v.transparent=/\.png$/.test(i);var h=new Image;h.src=i,h.crossOrigin="",i=h}if(i instanceof HTMLImageElement){var w=v.map=new n.Texture;w.wrapS=n.ClampToEdgeWrapping,w.wrapT=n.ClampToEdgeWrapping,w.minFilter=n.LinearFilter,w.encoding=n.sRGBEncoding,c(w,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(){w.image=i,w.needsUpdate=!0,g._needsRender=!0})))}else if(i instanceof HTMLCanvasElement)v.map=new n.CanvasTexture(i);else if(i instanceof HTMLVideoElement){var b=v.map=new n.VideoTexture(i);b.wrapS=n.ClampToEdgeWrapping,b.wrapT=n.ClampToEdgeWrapping,b.minFilter=n.LinearFilter,b.encoding=n.sRGBEncoding,c(b,(a=i,s=function(){g._needsRender=!0},d=p(),f=!1,l=function(){f=!0,s(),p()-d<3e3?u(l):f=!1},m=function(){d=p(),!1===f&&l()},a.addEventListener("timeupdate",m,!1),function(){a.removeEventListener("timeupdate",m,!1),f=!1}))}return g}return e.__extends(r,t),Object.defineProperty(r,"version",{get:function(){return"5.0.0-alpha.154"},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}(n.Mesh);exports.Sticker=f;
|