@inweb/viewer-three 27.10.0 → 27.11.0
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/dist/extensions/loaders/GLTFCloudLoader.js +4 -2
- package/dist/extensions/loaders/GLTFCloudLoader.js.map +1 -1
- package/dist/extensions/loaders/GLTFCloudLoader.min.js +1 -1
- package/dist/extensions/loaders/GLTFCloudLoader.module.js +4 -2
- package/dist/extensions/loaders/GLTFCloudLoader.module.js.map +1 -1
- package/dist/extensions/loaders/GLTFFileLoader.js +2 -0
- package/dist/extensions/loaders/GLTFFileLoader.js.map +1 -1
- package/dist/extensions/loaders/GLTFFileLoader.min.js +1 -1
- package/dist/extensions/loaders/GLTFFileLoader.module.js +2 -0
- package/dist/extensions/loaders/GLTFFileLoader.module.js.map +1 -1
- package/dist/extensions/loaders/IFCXLoader.js +6 -2
- package/dist/extensions/loaders/IFCXLoader.js.map +1 -1
- package/dist/extensions/loaders/IFCXLoader.min.js +1 -1
- package/dist/extensions/loaders/IFCXLoader.module.js +6 -2
- package/dist/extensions/loaders/IFCXLoader.module.js.map +1 -1
- package/dist/extensions/loaders/PotreeLoader.js +2 -0
- package/dist/extensions/loaders/PotreeLoader.js.map +1 -1
- package/dist/extensions/loaders/PotreeLoader.min.js +1 -1
- package/dist/extensions/loaders/PotreeLoader.module.js +2 -0
- package/dist/extensions/loaders/PotreeLoader.module.js.map +1 -1
- package/dist/viewer-three.js +880 -258
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +4 -4
- package/dist/viewer-three.module.js +765 -258
- package/dist/viewer-three.module.js.map +1 -1
- package/extensions/loaders/GLTFCloudLoader.ts +5 -3
- package/extensions/loaders/GLTFFileLoader.ts +2 -0
- package/extensions/loaders/IFCX/IFCXCloudLoader.ts +5 -3
- package/extensions/loaders/IFCX/IFCXFileLoader.ts +2 -0
- package/extensions/loaders/Potree/PotreeFileLoader.ts +2 -0
- package/lib/Viewer/Viewer.d.ts +27 -9
- package/lib/Viewer/commands/Deselect.d.ts +2 -0
- package/lib/Viewer/commands/Explode.d.ts +1 -1
- package/lib/Viewer/commands/GetHidden.d.ts +2 -0
- package/lib/Viewer/commands/GetIsolated.d.ts +2 -0
- package/lib/Viewer/commands/GetSelected.d.ts +1 -1
- package/lib/Viewer/commands/Hide.d.ts +2 -0
- package/lib/Viewer/commands/HideAll.d.ts +2 -0
- package/lib/Viewer/commands/Isolate.d.ts +2 -0
- package/lib/Viewer/commands/Select.d.ts +2 -0
- package/lib/Viewer/commands/SetSelected.d.ts +1 -1
- package/lib/Viewer/commands/SetSelected2.d.ts +1 -1
- package/lib/Viewer/commands/Show.d.ts +2 -0
- package/lib/Viewer/commands/ToHandles.d.ts +2 -0
- package/lib/Viewer/commands/ToHandles2.d.ts +2 -0
- package/lib/Viewer/commands/ToggleSelection.d.ts +2 -0
- package/lib/Viewer/commands/Zoom.d.ts +3 -0
- package/lib/Viewer/commands/ZoomExtents.d.ts +2 -0
- package/lib/Viewer/commands/ZoomTo.d.ts +1 -2
- package/lib/Viewer/components/HighlighterComponent.d.ts +4 -3
- package/lib/Viewer/components/SelectionComponent.d.ts +1 -9
- package/lib/Viewer/components/index.d.ts +1 -1
- package/lib/Viewer/draggers/index.d.ts +2 -2
- package/lib/Viewer/loaders/DynamicGltfLoader/DynamicModelImpl.d.ts +10 -8
- package/lib/Viewer/loaders/GLTFCloudDynamicLoader.d.ts +5 -1
- package/lib/Viewer/loaders/GLTFFileDynamicLoader.d.ts +5 -1
- package/lib/Viewer/loaders/index.d.ts +5 -1
- package/lib/Viewer/models/Highlighter.types.d.ts +5 -0
- package/lib/Viewer/models/ModelImpl.d.ts +14 -10
- package/lib/Viewer/models/ModelImpl.types.d.ts +6 -10
- package/package.json +5 -5
- package/src/Viewer/Viewer.ts +131 -26
- package/src/Viewer/commands/ClearSelected.ts +3 -6
- package/src/Viewer/commands/Deselect.ts +35 -0
- package/src/Viewer/commands/Explode.ts +4 -3
- package/src/Viewer/commands/GetHidden.ts +30 -0
- package/src/Viewer/commands/GetIsolated.ts +30 -0
- package/src/Viewer/commands/GetSelected.ts +4 -4
- package/src/Viewer/commands/GetSelected2.ts +4 -7
- package/src/Viewer/commands/Hide.ts +35 -0
- package/src/Viewer/commands/HideAll.ts +32 -0
- package/src/Viewer/commands/HideSelected.ts +1 -11
- package/src/Viewer/commands/Isolate.ts +41 -0
- package/src/Viewer/commands/IsolateSelected.ts +1 -4
- package/src/Viewer/commands/ResetView.ts +1 -1
- package/src/Viewer/commands/Select.ts +36 -0
- package/src/Viewer/commands/SelectModel.ts +4 -8
- package/src/Viewer/commands/SetDefaultViewPosition.ts +2 -2
- package/src/Viewer/commands/SetSelected.ts +8 -11
- package/src/Viewer/commands/SetSelected2.ts +5 -16
- package/src/Viewer/commands/Show.ts +34 -0
- package/src/Viewer/commands/ShowAll.ts +2 -2
- package/src/Viewer/commands/{ZoomToObjects.ts → ToHandles.ts} +7 -10
- package/src/Viewer/commands/ToHandles2.ts +43 -0
- package/src/Viewer/commands/ToggleSelection.ts +40 -0
- package/src/Viewer/commands/Zoom.ts +66 -0
- package/src/Viewer/commands/{ZoomToExtents.ts → ZoomExtents.ts} +3 -3
- package/src/Viewer/commands/ZoomTo.ts +12 -38
- package/src/Viewer/commands/ZoomToSelected.ts +1 -7
- package/src/Viewer/commands/index.ts +24 -5
- package/src/Viewer/components/HighlighterComponent.ts +14 -12
- package/src/Viewer/components/SelectionComponent.ts +12 -76
- package/src/Viewer/components/index.ts +1 -1
- package/src/Viewer/draggers/OrbitDragger.ts +2 -2
- package/src/Viewer/draggers/index.ts +2 -2
- package/src/Viewer/loaders/DynamicGltfLoader/DynamicGltfLoader.js +429 -2
- package/src/Viewer/loaders/DynamicGltfLoader/DynamicModelImpl.ts +26 -35
- package/src/Viewer/loaders/GLTFCloudDynamicLoader.ts +33 -3
- package/src/Viewer/loaders/GLTFFileDynamicLoader.ts +32 -2
- package/src/Viewer/loaders/index.ts +5 -1
- package/src/Viewer/models/Highlighter.types.ts +30 -0
- package/src/Viewer/models/ModelImpl.ts +68 -57
- package/src/Viewer/models/ModelImpl.types.ts +8 -17
- package/lib/Viewer/commands/ZoomToExtents.d.ts +0 -2
- package/lib/Viewer/commands/ZoomToObjects.d.ts +0 -2
|
@@ -21,4 +21,4 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("three"),require("@inweb/viewer-three")):"function"==typeof define&&define.amd?define(["exports","three","@inweb/viewer-three"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).ODA=e.ODA||{},e.ODA.Three=e.ODA.Three||{},e.ODA.Three.Extensions=e.ODA.Three.Extensions||{}),e.THREE,e.ODA.Three)}(this,function(e,t,s){"use strict";function r(e,s){if(s===t.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(s===t.TriangleFanDrawMode||s===t.TriangleStripDrawMode){let r=e.getIndex();if(null===r){const t=[],s=e.getAttribute("position");if(void 0===s)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<s.count;e++)t.push(e);e.setIndex(t),r=e.getIndex()}const n=r.count-2,i=[];if(s===t.TriangleFanDrawMode)for(let e=1;e<=n;e++)i.push(r.getX(0)),i.push(r.getX(e)),i.push(r.getX(e+1));else for(let e=0;e<n;e++)e%2==0?(i.push(r.getX(e)),i.push(r.getX(e+1)),i.push(r.getX(e+2))):(i.push(r.getX(e+2)),i.push(r.getX(e+1)),i.push(r.getX(e)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=e.clone();return o.setIndex(i),o.clearGroups(),o}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",s),e}function n(e){const t=new Map,s=new Map,r=e.clone();return i(e,r,function(e,r){t.set(r,e),s.set(e,r)}),r.traverse(function(e){if(!e.isSkinnedMesh)return;const r=e,n=t.get(e),i=n.skeleton.bones;r.skeleton=n.skeleton.clone(),r.bindMatrix.copy(n.bindMatrix),r.skeleton.bones=i.map(function(e){return s.get(e)}),r.bind(r.skeleton,r.bindMatrix)}),r}function i(e,t,s){s(e,t);for(let r=0;r<e.children.length;r++)i(e.children[r],t.children[r],s)}class o extends t.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new p(e)}),this.register(function(e){return new m(e)}),this.register(function(e){return new w(e)}),this.register(function(e){return new E(e)}),this.register(function(e){return new A(e)}),this.register(function(e){return new g(e)}),this.register(function(e){return new T(e)}),this.register(function(e){return new R(e)}),this.register(function(e){return new x(e)}),this.register(function(e){return new d(e)}),this.register(function(e){return new v(e)}),this.register(function(e){return new f(e)}),this.register(function(e){return new M(e)}),this.register(function(e){return new _(e)}),this.register(function(e){return new u(e)}),this.register(function(e){return new y(e,l.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new y(e,l.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new S(e)})}load(e,s,r,n){const i=this;let o;if(""!==this.resourcePath)o=this.resourcePath;else if(""!==this.path){const s=t.LoaderUtils.extractUrlBase(e);o=t.LoaderUtils.resolveURL(s,this.path)}else o=t.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const a=function(t){n?n(t):console.error(t),i.manager.itemError(e),i.manager.itemEnd(e)},c=new t.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(t){try{i.parse(t,o,function(t){s(t),i.manager.itemEnd(e)},a)}catch(e){a(e)}},r,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s,r){let n;const i={},o={},a=new TextDecoder;if("string"==typeof e)n=JSON.parse(e);else if(e instanceof ArrayBuffer){if(a.decode(new Uint8Array(e,0,4))===L){try{i[l.KHR_BINARY_GLTF]=new C(e)}catch(e){return void(r&&r(e))}n=JSON.parse(i[l.KHR_BINARY_GLTF].content)}else n=JSON.parse(a.decode(e))}else n=e;if(void 0===n.asset||n.asset.version[0]<2)return void(r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const c=new re(n,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](c);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[t.name]=t,i[t.name]=!0}if(n.extensionsUsed)for(let e=0;e<n.extensionsUsed.length;++e){const t=n.extensionsUsed[e],s=n.extensionsRequired||[];switch(t){case l.KHR_MATERIALS_UNLIT:i[t]=new h;break;case l.KHR_DRACO_MESH_COMPRESSION:i[t]=new O(n,this.dracoLoader);break;case l.KHR_TEXTURE_TRANSFORM:i[t]=new N;break;case l.KHR_MESH_QUANTIZATION:i[t]=new P;break;default:s.indexOf(t)>=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}c.setExtensions(i),c.setPlugins(o),c.parse(s,r)}parseAsync(e,t){const s=this;return new Promise(function(r,n){s.parse(e,t,r,n)})}}function a(){let e={};return{get:function(t){return e[t]},add:function(t,s){e[t]=s},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function c(e,t,s){const r=e.json.materials[t];return r.extensions&&r.extensions[s]?r.extensions[s]:null}const l={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_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class u{constructor(e){this.parser=e,this.name=l.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,r=t.length;s<r;s++){const r=t[s];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const s=this.parser,r="light:"+e;let n=s.cache.get(r);if(n)return n;const i=s.json,o=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e];let a;const c=new t.Color(16777215);void 0!==o.color&&c.setRGB(o.color[0],o.color[1],o.color[2],t.LinearSRGBColorSpace);const l=void 0!==o.range?o.range:0;switch(o.type){case"directional":a=new t.DirectionalLight(c),a.target.position.set(0,0,-1),a.add(a.target);break;case"point":a=new t.PointLight(c),a.distance=l;break;case"spot":a=new t.SpotLight(c),a.distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,a.angle=o.spot.outerConeAngle,a.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return a.position.set(0,0,0),J(a,o),void 0!==o.intensity&&(a.intensity=o.intensity),a.name=s.createUniqueName(o.name||"light_"+e),n=Promise.resolve(a),s.cache.add(r,n),n}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,r=s.json.nodes[e],n=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then(function(e){return s._getNodeRef(t.cache,n,e)})}}class h{constructor(){this.name=l.KHR_MATERIALS_UNLIT}getMaterialType(){return t.MeshBasicMaterial}extendParams(e,s,r){const n=[];e.color=new t.Color(1,1,1),e.opacity=1;const i=s.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const s=i.baseColorFactor;e.color.setRGB(s[0],s[1],s[2],t.LinearSRGBColorSpace),e.opacity=s[3]}void 0!==i.baseColorTexture&&n.push(r.assignTexture(e,"map",i.baseColorTexture,t.SRGBColorSpace))}return Promise.all(n)}}class d{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const s=c(this.parser,e,this.name);return null===s||void 0!==s.emissiveStrength&&(t.emissiveIntensity=s.emissiveStrength),Promise.resolve()}}class p{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const r=c(this.parser,e,this.name);if(null===r)return Promise.resolve();const n=[];if(void 0!==r.clearcoatFactor&&(s.clearcoat=r.clearcoatFactor),void 0!==r.clearcoatTexture&&n.push(this.parser.assignTexture(s,"clearcoatMap",r.clearcoatTexture)),void 0!==r.clearcoatRoughnessFactor&&(s.clearcoatRoughness=r.clearcoatRoughnessFactor),void 0!==r.clearcoatRoughnessTexture&&n.push(this.parser.assignTexture(s,"clearcoatRoughnessMap",r.clearcoatRoughnessTexture)),void 0!==r.clearcoatNormalTexture&&(n.push(this.parser.assignTexture(s,"clearcoatNormalMap",r.clearcoatNormalTexture)),void 0!==r.clearcoatNormalTexture.scale)){const e=r.clearcoatNormalTexture.scale;s.clearcoatNormalScale=new t.Vector2(e,e)}return Promise.all(n)}}class m{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_DISPERSION}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=c(this.parser,e,this.name);return null===s||(t.dispersion=void 0!==s.dispersion?s.dispersion:0),Promise.resolve()}}class f{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=c(this.parser,e,this.name);if(null===s)return Promise.resolve();const r=[];return void 0!==s.iridescenceFactor&&(t.iridescence=s.iridescenceFactor),void 0!==s.iridescenceTexture&&r.push(this.parser.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),void 0!==s.iridescenceIor&&(t.iridescenceIOR=s.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==s.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),void 0!==s.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),void 0!==s.iridescenceThicknessTexture&&r.push(this.parser.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class g{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_SHEEN}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const r=c(this.parser,e,this.name);if(null===r)return Promise.resolve();const n=[];if(s.sheenColor=new t.Color(0,0,0),s.sheenRoughness=0,s.sheen=1,void 0!==r.sheenColorFactor){const e=r.sheenColorFactor;s.sheenColor.setRGB(e[0],e[1],e[2],t.LinearSRGBColorSpace)}return void 0!==r.sheenRoughnessFactor&&(s.sheenRoughness=r.sheenRoughnessFactor),void 0!==r.sheenColorTexture&&n.push(this.parser.assignTexture(s,"sheenColorMap",r.sheenColorTexture,t.SRGBColorSpace)),void 0!==r.sheenRoughnessTexture&&n.push(this.parser.assignTexture(s,"sheenRoughnessMap",r.sheenRoughnessTexture)),Promise.all(n)}}class T{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=c(this.parser,e,this.name);if(null===s)return Promise.resolve();const r=[];return void 0!==s.transmissionFactor&&(t.transmission=s.transmissionFactor),void 0!==s.transmissionTexture&&r.push(this.parser.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class R{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_VOLUME}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const r=c(this.parser,e,this.name);if(null===r)return Promise.resolve();const n=[];s.thickness=void 0!==r.thicknessFactor?r.thicknessFactor:0,void 0!==r.thicknessTexture&&n.push(this.parser.assignTexture(s,"thicknessMap",r.thicknessTexture)),s.attenuationDistance=r.attenuationDistance||1/0;const i=r.attenuationColor||[1,1,1];return s.attenuationColor=(new t.Color).setRGB(i[0],i[1],i[2],t.LinearSRGBColorSpace),Promise.all(n)}}class x{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_IOR}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=c(this.parser,e,this.name);return null===s||(t.ior=void 0!==s.ior?s.ior:1.5,0===t.ior&&(t.ior=1e3)),Promise.resolve()}}class v{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_SPECULAR}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const r=c(this.parser,e,this.name);if(null===r)return Promise.resolve();const n=[];s.specularIntensity=void 0!==r.specularFactor?r.specularFactor:1,void 0!==r.specularTexture&&n.push(this.parser.assignTexture(s,"specularIntensityMap",r.specularTexture));const i=r.specularColorFactor||[1,1,1];return s.specularColor=(new t.Color).setRGB(i[0],i[1],i[2],t.LinearSRGBColorSpace),void 0!==r.specularColorTexture&&n.push(this.parser.assignTexture(s,"specularColorMap",r.specularColorTexture,t.SRGBColorSpace)),Promise.all(n)}}class _{constructor(e){this.parser=e,this.name=l.EXT_MATERIALS_BUMP}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=c(this.parser,e,this.name);if(null===s)return Promise.resolve();const r=[];return t.bumpScale=void 0!==s.bumpFactor?s.bumpFactor:1,void 0!==s.bumpTexture&&r.push(this.parser.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(r)}}class M{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=c(this.parser,e,this.name);if(null===s)return Promise.resolve();const r=[];return void 0!==s.anisotropyStrength&&(t.anisotropy=s.anisotropyStrength),void 0!==s.anisotropyRotation&&(t.anisotropyRotation=s.anisotropyRotation),void 0!==s.anisotropyTexture&&r.push(this.parser.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class w{constructor(e){this.parser=e,this.name=l.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,r=s.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const n=r.extensions[this.name],i=t.options.ktx2Loader;if(!i){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,n.source,i)}}class E{constructor(e){this.parser=e,this.name=l.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,s=this.parser,r=s.json,n=r.textures[e];if(!n.extensions||!n.extensions[t])return null;const i=n.extensions[t],o=r.images[i.source];let a=s.textureLoader;if(o.uri){const e=s.options.manager.getHandler(o.uri);null!==e&&(a=e)}return s.loadTextureImage(e,i.source,a)}}class A{constructor(e){this.parser=e,this.name=l.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,s=this.parser,r=s.json,n=r.textures[e];if(!n.extensions||!n.extensions[t])return null;const i=n.extensions[t],o=r.images[i.source];let a=s.textureLoader;if(o.uri){const e=s.options.manager.getHandler(o.uri);null!==e&&(a=e)}return s.loadTextureImage(e,i.source,a)}}class y{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const e=s.extensions[this.name],r=this.parser.getDependency("buffer",e.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(t){const s=e.byteOffset||0,r=e.byteLength||0,i=e.count,o=e.byteStride,a=new Uint8Array(t,s,r);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(i,o,a,e.mode,e.filter).then(function(e){return e.buffer}):n.ready.then(function(){const t=new ArrayBuffer(i*o);return n.decodeGltfBuffer(new Uint8Array(t),i,o,a,e.mode,e.filter),t})})}return null}}class S{constructor(e){this.name=l.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const s=this.parser.json,r=s.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;const n=s.meshes[r.mesh];for(const e of n.primitives)if(e.mode!==D.TRIANGLES&&e.mode!==D.TRIANGLE_STRIP&&e.mode!==D.TRIANGLE_FAN&&void 0!==e.mode)return null;const i=r.extensions[this.name].attributes,o=[],a={};for(const e in i)o.push(this.parser.getDependency("accessor",i[e]).then(t=>(a[e]=t,a[e])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(e=>{const s=e.pop(),r=s.isGroup?s.children:[s],n=e[0].count,i=[];for(const e of r){const s=new t.Matrix4,r=new t.Vector3,o=new t.Quaternion,c=new t.Vector3(1,1,1),l=new t.InstancedMesh(e.geometry,e.material,n);for(let e=0;e<n;e++)a.TRANSLATION&&r.fromBufferAttribute(a.TRANSLATION,e),a.ROTATION&&o.fromBufferAttribute(a.ROTATION,e),a.SCALE&&c.fromBufferAttribute(a.SCALE,e),l.setMatrixAt(e,s.compose(r,o,c));for(const s in a)if("_COLOR_0"===s){const e=a[s];l.instanceColor=new t.InstancedBufferAttribute(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==s&&"ROTATION"!==s&&"SCALE"!==s&&e.geometry.setAttribute(s,a[s]);t.Object3D.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),i.push(l)}return s.isGroup?(s.clear(),s.add(...i),s):i[0]}))}}const L="glTF",I=1313821514,b=5130562;class C{constructor(e){this.name=l.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.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.");const r=this.header.length-12,n=new DataView(e,12);let i=0;for(;i<r;){const t=n.getUint32(i,!0);i+=4;const r=n.getUint32(i,!0);if(i+=4,r===I){const r=new Uint8Array(e,12+i,t);this.content=s.decode(r)}else if(r===b){const s=12+i;this.body=e.slice(s,s+t)}i+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class O{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=l.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,s){const r=this.json,n=this.dracoLoader,i=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},c={},l={};for(const e in o){const t=V[e]||e.toLowerCase();a[t]=o[e]}for(const t in e.attributes){const s=V[t]||t.toLowerCase();if(void 0!==o[t]){const n=r.accessors[e.attributes[t]],i=U[n.componentType];l[s]=i.name,c[s]=!0===n.normalized}}return s.getDependency("bufferView",i).then(function(e){return new Promise(function(s,r){n.decodeDracoFile(e,function(e){for(const t in e.attributes){const s=e.attributes[t],r=c[t];void 0!==r&&(s.normalized=r)}s(e)},a,l,t.LinearSRGBColorSpace,r)})})}}class N{constructor(){this.name=l.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),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),e.needsUpdate=!0,e):e}}class P{constructor(){this.name=l.KHR_MESH_QUANTIZATION}}class H extends t.Interpolant{constructor(e,t,s,r){super(e,t,s,r)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,r=this.valueSize,n=e*r*3+r;for(let e=0;e!==r;e++)t[e]=s[n+e];return t}interpolate_(e,t,s,r){const n=this.resultBuffer,i=this.sampleValues,o=this.valueSize,a=2*o,c=3*o,l=r-t,u=(s-t)/l,h=u*u,d=h*u,p=e*c,m=p-c,f=-2*d+3*h,g=d-h,T=1-f,R=g-h+u;for(let e=0;e!==o;e++){const t=i[m+e+o],s=i[m+e+a]*l,r=i[p+e+o],c=i[p+e]*l;n[e]=T*t+R*s+f*r+g*c}return n}}const k=new t.Quaternion;class F extends H{interpolate_(e,t,s,r){const n=super.interpolate_(e,t,s,r);return k.fromArray(n).normalize().toArray(n),n}}const D={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},U={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},G={9728:t.NearestFilter,9729:t.LinearFilter,9984:t.NearestMipmapNearestFilter,9985:t.LinearMipmapNearestFilter,9986:t.NearestMipmapLinearFilter,9987:t.LinearMipmapLinearFilter},B={33071:t.ClampToEdgeWrapping,33648:t.MirroredRepeatWrapping,10497:t.RepeatWrapping},K={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},V={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},j={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},X={CUBICSPLINE:void 0,LINEAR:t.InterpolateLinear,STEP:t.InterpolateDiscrete},z="OPAQUE",q="MASK",W="BLEND";function Y(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new t.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:t.FrontSide})),e.DefaultMaterial}function Q(e,t,s){for(const r in s.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=s.extensions[r])}function J(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 Z(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let s=0,r=t.weights.length;s<r;s++)e.morphTargetInfluences[s]=t.weights[s];if(t.extras&&Array.isArray(t.extras.targetNames)){const s=t.extras.targetNames;if(e.morphTargetInfluences.length===s.length){e.morphTargetDictionary={};for(let t=0,r=s.length;t<r;t++)e.morphTargetDictionary[s[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function $(e){let t;const s=e.extensions&&e.extensions[l.KHR_DRACO_MESH_COMPRESSION];if(t=s?"draco:"+s.bufferView+":"+s.indices+":"+ee(s.attributes):e.indices+":"+ee(e.attributes)+":"+e.mode,void 0!==e.targets)for(let s=0,r=e.targets.length;s<r;s++)t+=":"+ee(e.targets[s]);return t}function ee(e){let t="";const s=Object.keys(e).sort();for(let r=0,n=s.length;r<n;r++)t+=s[r]+":"+e[s[r]]+";";return t}function te(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const se=new t.Matrix4;class re{constructor(e={},s={}){this.json=e,this.extensions={},this.plugins={},this.options=s,this.cache=new a,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,n=-1,i=!1,o=-1;if("undefined"!=typeof navigator&&void 0!==navigator.userAgent){const e=navigator.userAgent;r=!0===/^((?!chrome|android).)*safari/i.test(e);const t=e.match(/Version\/(\d+)/);n=r&&t?parseInt(t[1],10):-1,i=e.indexOf("Firefox")>-1,o=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||r&&n<17||i&&o<98?this.textureLoader=new t.TextureLoader(this.options.manager):this.textureLoader=new t.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new t.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const s=this,r=this.json,n=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(t){const i={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:s,userData:{}};return Q(n,i,r),J(i,r),Promise.all(s._invokeAll(function(e){return e.afterRoot&&e.afterRoot(i)})).then(function(){for(const e of i.scenes)e.updateMatrixWorld();e(i)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let s=0,r=t.length;s<r;s++){const r=t[s].joints;for(let t=0,s=r.length;t<s;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){const r=e[t];void 0!==r.mesh&&(this._addNodeRef(this.meshCache,r.mesh),void 0!==r.skin&&(s[r.mesh].isSkinnedMesh=!0)),void 0!==r.camera&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,s){if(e.refs[t]<=1)return s;const r=s.clone(),n=(e,t)=>{const s=this.associations.get(e);null!=s&&this.associations.set(t,s);for(const[s,r]of e.children.entries())n(r,t.children[s])};return n(s,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const r=e(t[s]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let r=0;r<t.length;r++){const n=e(t[r]);n&&s.push(n)}return s}getDependency(e,t){const s=e+":"+t;let r=this.cache.get(s);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":r=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e)}this.cache.add(s,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map(function(t,r){return s.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){const s=this.json.buffers[e],r=this.fileLoader;if(s.type&&"arraybuffer"!==s.type)throw new Error("THREE.GLTFLoader: "+s.type+" buffer type is not supported.");if(void 0===s.uri&&0===e)return Promise.resolve(this.extensions[l.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(e,i){r.load(t.LoaderUtils.resolveURL(s.uri,n.path),e,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+s.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){const s=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+s)})}loadAccessor(e){const s=this,r=this.json,n=this.json.accessors[e];if(void 0===n.bufferView&&void 0===n.sparse){const e=K[n.type],s=U[n.componentType],r=!0===n.normalized,i=new s(n.count*e);return Promise.resolve(new t.BufferAttribute(i,e,r))}const i=[];return void 0!==n.bufferView?i.push(this.getDependency("bufferView",n.bufferView)):i.push(null),void 0!==n.sparse&&(i.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(i).then(function(e){const i=e[0],o=K[n.type],a=U[n.componentType],c=a.BYTES_PER_ELEMENT,l=c*o,u=n.byteOffset||0,h=void 0!==n.bufferView?r.bufferViews[n.bufferView].byteStride:void 0,d=!0===n.normalized;let p,m;if(h&&h!==l){const e=Math.floor(u/h),r="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+e+":"+n.count;let l=s.cache.get(r);l||(p=new a(i,e*h,n.count*h/c),l=new t.InterleavedBuffer(p,h/c),s.cache.add(r,l)),m=new t.InterleavedBufferAttribute(l,o,u%h/c,d)}else p=null===i?new a(n.count*o):new a(i,u,n.count*o),m=new t.BufferAttribute(p,o,d);if(void 0!==n.sparse){const s=K.SCALAR,r=U[n.sparse.indices.componentType],c=n.sparse.indices.byteOffset||0,l=n.sparse.values.byteOffset||0,u=new r(e[1],c,n.sparse.count*s),h=new a(e[2],l,n.sparse.count*o);null!==i&&(m=new t.BufferAttribute(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let e=0,t=u.length;e<t;e++){const t=u[e];if(m.setX(t,h[e*o]),o>=2&&m.setY(t,h[e*o+1]),o>=3&&m.setZ(t,h[e*o+2]),o>=4&&m.setW(t,h[e*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=d}return m})}loadTexture(e){const t=this.json,s=this.options,r=t.textures[e].source,n=t.images[r];let i=this.textureLoader;if(n.uri){const e=s.manager.getHandler(n.uri);null!==e&&(i=e)}return this.loadTextureImage(e,r,i)}loadTextureImage(e,s,r){const n=this,i=this.json,o=i.textures[e],a=i.images[s],c=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[c])return this.textureCache[c];const l=this.loadImageSource(s,r).then(function(s){s.flipY=!1,s.name=o.name||a.name||"",""===s.name&&"string"==typeof a.uri&&!1===a.uri.startsWith("data:image/")&&(s.name=a.uri);const r=(i.samplers||{})[o.sampler]||{};return s.magFilter=G[r.magFilter]||t.LinearFilter,s.minFilter=G[r.minFilter]||t.LinearMipmapLinearFilter,s.wrapS=B[r.wrapS]||t.RepeatWrapping,s.wrapT=B[r.wrapT]||t.RepeatWrapping,s.generateMipmaps=!s.isCompressedTexture&&s.minFilter!==t.NearestFilter&&s.minFilter!==t.LinearFilter,n.associations.set(s,{textures:e}),s}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,s){const r=this,n=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());const o=n.images[e],a=self.URL||self.webkitURL;let c=o.uri||"",l=!1;if(void 0!==o.bufferView)c=r.getDependency("bufferView",o.bufferView).then(function(e){l=!0;const t=new Blob([e],{type:o.mimeType});return c=a.createObjectURL(t),c});else if(void 0===o.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(c).then(function(e){return new Promise(function(r,n){let o=r;!0===s.isImageBitmapLoader&&(o=function(e){const s=new t.Texture(e);s.needsUpdate=!0,r(s)}),s.load(t.LoaderUtils.resolveURL(e,i.path),o,void 0,n)})}).then(function(e){var t;return!0===l&&a.revokeObjectURL(c),J(e,o),e.userData.mimeType=o.mimeType||((t=o.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":t.search(/\.ktx2($|\?)/i)>0||0===t.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),e});return this.sourceCache[e]=u,u}assignTexture(e,t,s,r){const n=this;return this.getDependency("texture",s.index).then(function(i){if(!i)return null;if(void 0!==s.texCoord&&s.texCoord>0&&((i=i.clone()).channel=s.texCoord),n.extensions[l.KHR_TEXTURE_TRANSFORM]){const e=void 0!==s.extensions?s.extensions[l.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=n.associations.get(i);i=n.extensions[l.KHR_TEXTURE_TRANSFORM].extendTexture(i,e),n.associations.set(i,t)}}return void 0!==r&&(i.colorSpace=r),e[t]=i,i})}assignFinalMaterial(e){const s=e.geometry;let r=e.material;const n=void 0===s.attributes.tangent,i=void 0!==s.attributes.color,o=void 0===s.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+r.uuid;let s=this.cache.get(e);s||(s=new t.PointsMaterial,t.Material.prototype.copy.call(s,r),s.color.copy(r.color),s.map=r.map,s.sizeAttenuation=!1,this.cache.add(e,s)),r=s}else if(e.isLine){const e="LineBasicMaterial:"+r.uuid;let s=this.cache.get(e);s||(s=new t.LineBasicMaterial,t.Material.prototype.copy.call(s,r),s.color.copy(r.color),s.map=r.map,this.cache.add(e,s)),r=s}if(n||i||o){let e="ClonedMaterial:"+r.uuid+":";n&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),o&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),i&&(t.vertexColors=!0),o&&(t.flatShading=!0),n&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return t.MeshStandardMaterial}loadMaterial(e){const s=this,r=this.json,n=this.extensions,i=r.materials[e];let o;const a={},c=[];if((i.extensions||{})[l.KHR_MATERIALS_UNLIT]){const e=n[l.KHR_MATERIALS_UNLIT];o=e.getMaterialType(),c.push(e.extendParams(a,i,s))}else{const r=i.pbrMetallicRoughness||{};if(a.color=new t.Color(1,1,1),a.opacity=1,Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;a.color.setRGB(e[0],e[1],e[2],t.LinearSRGBColorSpace),a.opacity=e[3]}void 0!==r.baseColorTexture&&c.push(s.assignTexture(a,"map",r.baseColorTexture,t.SRGBColorSpace)),a.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,a.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(c.push(s.assignTexture(a,"metalnessMap",r.metallicRoughnessTexture)),c.push(s.assignTexture(a,"roughnessMap",r.metallicRoughnessTexture))),o=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,a)})))}!0===i.doubleSided&&(a.side=t.DoubleSide);const u=i.alphaMode||z;if(u===W?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===q&&(a.alphaTest=void 0!==i.alphaCutoff?i.alphaCutoff:.5)),void 0!==i.normalTexture&&o!==t.MeshBasicMaterial&&(c.push(s.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new t.Vector2(1,1),void 0!==i.normalTexture.scale)){const e=i.normalTexture.scale;a.normalScale.set(e,e)}if(void 0!==i.occlusionTexture&&o!==t.MeshBasicMaterial&&(c.push(s.assignTexture(a,"aoMap",i.occlusionTexture)),void 0!==i.occlusionTexture.strength&&(a.aoMapIntensity=i.occlusionTexture.strength)),void 0!==i.emissiveFactor&&o!==t.MeshBasicMaterial){const e=i.emissiveFactor;a.emissive=(new t.Color).setRGB(e[0],e[1],e[2],t.LinearSRGBColorSpace)}return void 0!==i.emissiveTexture&&o!==t.MeshBasicMaterial&&c.push(s.assignTexture(a,"emissiveMap",i.emissiveTexture,t.SRGBColorSpace)),Promise.all(c).then(function(){const t=new o(a);return i.name&&(t.name=i.name),J(t,i),s.associations.set(t,{materials:e}),i.extensions&&Q(n,t,i),t})}createUniqueName(e){const s=t.PropertyBinding.sanitizeNodeName(e||"");return s in this.nodeNamesUsed?s+"_"+ ++this.nodeNamesUsed[s]:(this.nodeNamesUsed[s]=0,s)}loadGeometries(e){const s=this,r=this.extensions,n=this.primitiveCache;function i(e){return r[l.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,s).then(function(t){return ne(t,e,s)})}const o=[];for(let r=0,a=e.length;r<a;r++){const a=e[r],c=$(a),u=n[c];if(u)o.push(u.promise);else{let e;e=a.extensions&&a.extensions[l.KHR_DRACO_MESH_COMPRESSION]?i(a):ne(new t.BufferGeometry,a,s),n[c]={primitive:a,promise:e},o.push(e)}}return Promise.all(o)}loadMesh(e){const s=this,n=this.json,i=this.extensions,o=n.meshes[e],a=o.primitives,c=[];for(let e=0,t=a.length;e<t;e++){const t=void 0===a[e].material?Y(this.cache):this.getDependency("material",a[e].material);c.push(t)}return c.push(s.loadGeometries(a)),Promise.all(c).then(function(n){const c=n.slice(0,n.length-1),l=n[n.length-1],u=[];for(let n=0,h=l.length;n<h;n++){const h=l[n],d=a[n];let p;const m=c[n];if(d.mode===D.TRIANGLES||d.mode===D.TRIANGLE_STRIP||d.mode===D.TRIANGLE_FAN||void 0===d.mode)p=!0===o.isSkinnedMesh?new t.SkinnedMesh(h,m):new t.Mesh(h,m),!0===p.isSkinnedMesh&&p.normalizeSkinWeights(),d.mode===D.TRIANGLE_STRIP?p.geometry=r(p.geometry,t.TriangleStripDrawMode):d.mode===D.TRIANGLE_FAN&&(p.geometry=r(p.geometry,t.TriangleFanDrawMode));else if(d.mode===D.LINES)p=new t.LineSegments(h,m);else if(d.mode===D.LINE_STRIP)p=new t.Line(h,m);else if(d.mode===D.LINE_LOOP)p=new t.LineLoop(h,m);else{if(d.mode!==D.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);p=new t.Points(h,m)}Object.keys(p.geometry.morphAttributes).length>0&&Z(p,o),p.name=s.createUniqueName(o.name||"mesh_"+e),J(p,o),d.extensions&&Q(i,p,d),s.assignFinalMaterial(p),u.push(p)}for(let t=0,r=u.length;t<r;t++)s.associations.set(u[t],{meshes:e,primitives:t});if(1===u.length)return o.extensions&&Q(i,u[0],o),u[0];const h=new t.Group;o.extensions&&Q(i,h,o),s.associations.set(h,{meshes:e});for(let e=0,t=u.length;e<t;e++)h.add(u[e]);return h})}loadCamera(e){let s;const r=this.json.cameras[e],n=r[r.type];if(n)return"perspective"===r.type?s=new t.PerspectiveCamera(t.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===r.type&&(s=new t.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(s.name=this.createUniqueName(r.name)),J(s,r),Promise.resolve(s);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const s=this.json.skins[e],r=[];for(let e=0,t=s.joints.length;e<t;e++)r.push(this._loadNodeShallow(s.joints[e]));return void 0!==s.inverseBindMatrices?r.push(this.getDependency("accessor",s.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(e){const r=e.pop(),n=e,i=[],o=[];for(let e=0,a=n.length;e<a;e++){const a=n[e];if(a){i.push(a);const s=new t.Matrix4;null!==r&&s.fromArray(r.array,16*e),o.push(s)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',s.joints[e])}return new t.Skeleton(i,o)})}loadAnimation(e){const s=this.json,r=this,n=s.animations[e],i=n.name?n.name:"animation_"+e,o=[],a=[],c=[],l=[],u=[];for(let e=0,t=n.channels.length;e<t;e++){const t=n.channels[e],s=n.samplers[t.sampler],r=t.target,i=r.node,h=void 0!==n.parameters?n.parameters[s.input]:s.input,d=void 0!==n.parameters?n.parameters[s.output]:s.output;void 0!==r.node&&(o.push(this.getDependency("node",i)),a.push(this.getDependency("accessor",h)),c.push(this.getDependency("accessor",d)),l.push(s),u.push(r))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c),Promise.all(l),Promise.all(u)]).then(function(e){const s=e[0],o=e[1],a=e[2],c=e[3],l=e[4],u=[];for(let e=0,t=s.length;e<t;e++){const t=s[e],n=o[e],i=a[e],h=c[e],d=l[e];if(void 0===t)continue;t.updateMatrix&&t.updateMatrix();const p=r._createAnimationTracks(t,n,i,h,d);if(p)for(let e=0;e<p.length;e++)u.push(p[e])}const h=new t.AnimationClip(i,void 0,u);return J(h,n),h})}createNodeMesh(e){const t=this.json,s=this,r=t.nodes[e];return void 0===r.mesh?null:s.getDependency("mesh",r.mesh).then(function(e){const t=s._getNodeRef(s.meshCache,r.mesh,e);return void 0!==r.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,s=r.weights.length;t<s;t++)e.morphTargetInfluences[t]=r.weights[t]}),t})}loadNode(e){const s=this,r=this.json.nodes[e],n=s._loadNodeShallow(e),i=[],o=r.children||[];for(let e=0,t=o.length;e<t;e++)i.push(s.getDependency("node",o[e]));const a=void 0===r.skin?Promise.resolve(null):s.getDependency("skin",r.skin);return Promise.all([n,Promise.all(i),a]).then(function(e){const s=e[0],r=e[1],n=e[2];null!==n&&s.traverse(function(e){e.isSkinnedMesh&&e.bind(n,se)});for(let e=0,t=r.length;e<t;e++)s.add(r[e]);if(void 0!==s.userData.pivot&&r.length>0){const e=s.userData.pivot,n=r[0];s.pivot=(new t.Vector3).fromArray(e),s.position.x-=e[0],s.position.y-=e[1],s.position.z-=e[2],n.position.set(0,0,0),delete s.userData.pivot}return s})}_loadNodeShallow(e){const s=this.json,r=this.extensions,n=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const i=s.nodes[e],o=i.name?n.createUniqueName(i.name):"",a=[],c=n._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return c&&a.push(c),void 0!==i.camera&&a.push(n.getDependency("camera",i.camera).then(function(e){return n._getNodeRef(n.cameraCache,i.camera,e)})),n._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){a.push(e)}),this.nodeCache[e]=Promise.all(a).then(function(s){let a;if(a=!0===i.isBone?new t.Bone:s.length>1?new t.Group:1===s.length?s[0]:new t.Object3D,a!==s[0])for(let e=0,t=s.length;e<t;e++)a.add(s[e]);if(i.name&&(a.userData.name=i.name,a.name=o),J(a,i),i.extensions&&Q(r,a,i),void 0!==i.matrix){const e=new t.Matrix4;e.fromArray(i.matrix),a.applyMatrix4(e)}else void 0!==i.translation&&a.position.fromArray(i.translation),void 0!==i.rotation&&a.quaternion.fromArray(i.rotation),void 0!==i.scale&&a.scale.fromArray(i.scale);if(n.associations.has(a)){if(void 0!==i.mesh&&n.meshCache.refs[i.mesh]>1){const e=n.associations.get(a);n.associations.set(a,{...e})}}else n.associations.set(a,{});return n.associations.get(a).nodes=e,a}),this.nodeCache[e]}loadScene(e){const s=this.extensions,r=this.json.scenes[e],i=this,o=new t.Group;r.name&&(o.name=i.createUniqueName(r.name)),J(o,r),r.extensions&&Q(s,o,r);const a=r.nodes||[],c=[];for(let e=0,t=a.length;e<t;e++)c.push(i.getDependency("node",a[e]));return Promise.all(c).then(function(e){for(let t=0,s=e.length;t<s;t++){const s=e[t];null!==s.parent?o.add(n(s)):o.add(s)}return i.associations=(e=>{const s=new Map;for(const[e,r]of i.associations)(e instanceof t.Material||e instanceof t.Texture)&&s.set(e,r);return e.traverse(e=>{const t=i.associations.get(e);null!=t&&s.set(e,t)}),s})(o),o})}_createAnimationTracks(e,s,r,n,i){const o=[],a=e.name?e.name:e.uuid,c=[];function l(e){e.morphTargetInfluences&&c.push(e.name?e.name:e.uuid)}let u;switch(j[i.path]===j.weights?(l(e),e.isGroup&&e.children.forEach(l)):c.push(a),j[i.path]){case j.weights:u=t.NumberKeyframeTrack;break;case j.rotation:u=t.QuaternionKeyframeTrack;break;case j.translation:case j.scale:u=t.VectorKeyframeTrack;break;default:if(1===r.itemSize)u=t.NumberKeyframeTrack;else u=t.VectorKeyframeTrack}const h=void 0!==n.interpolation?X[n.interpolation]:t.InterpolateLinear,d=this._getArrayFromAccessor(r);for(let e=0,t=c.length;e<t;e++){const t=new u(c[e]+"."+j[i.path],s.array,d,h);"CUBICSPLINE"===n.interpolation&&this._createCubicSplineTrackInterpolant(t),o.push(t)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=te(t.constructor),s=new Float32Array(t.length);for(let r=0,n=t.length;r<n;r++)s[r]=t[r]*e;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof t.QuaternionKeyframeTrack?F:H)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function ne(e,s,r){const n=s.attributes,i=[];function o(t,s){return r.getDependency("accessor",t).then(function(t){e.setAttribute(s,t)})}for(const t in n){const s=V[t]||t.toLowerCase();s in e.attributes||i.push(o(n[t],s))}if(void 0!==s.indices&&!e.index){const t=r.getDependency("accessor",s.indices).then(function(t){e.setIndex(t)});i.push(t)}return t.ColorManagement.workingColorSpace!==t.LinearSRGBColorSpace&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${t.ColorManagement.workingColorSpace}" not supported.`),J(e,s),function(e,s,r){const n=s.attributes,i=new t.Box3;if(void 0===n.POSITION)return;{const e=r.json.accessors[n.POSITION],s=e.min,o=e.max;if(void 0===s||void 0===o)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(i.set(new t.Vector3(s[0],s[1],s[2]),new t.Vector3(o[0],o[1],o[2])),e.normalized){const t=te(U[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}const o=s.targets;if(void 0!==o){const e=new t.Vector3,s=new t.Vector3;for(let t=0,n=o.length;t<n;t++){const n=o[t];if(void 0!==n.POSITION){const t=r.json.accessors[n.POSITION],i=t.min,o=t.max;if(void 0!==i&&void 0!==o){if(s.setX(Math.max(Math.abs(i[0]),Math.abs(o[0]))),s.setY(Math.max(Math.abs(i[1]),Math.abs(o[1]))),s.setZ(Math.max(Math.abs(i[2]),Math.abs(o[2]))),t.normalized){const e=te(U[t.componentType]);s.multiplyScalar(e)}e.max(s)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(e)}e.boundingBox=i;const a=new t.Sphere;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=a}(e,s,r),Promise.all(i).then(function(){return void 0!==s.targets?function(e,t,s){let r=!1,n=!1,i=!1;for(let e=0,s=t.length;e<s;e++){const s=t[e];if(void 0!==s.POSITION&&(r=!0),void 0!==s.NORMAL&&(n=!0),void 0!==s.COLOR_0&&(i=!0),r&&n&&i)break}if(!r&&!n&&!i)return Promise.resolve(e);const o=[],a=[],c=[];for(let l=0,u=t.length;l<u;l++){const u=t[l];if(r){const t=void 0!==u.POSITION?s.getDependency("accessor",u.POSITION):e.attributes.position;o.push(t)}if(n){const t=void 0!==u.NORMAL?s.getDependency("accessor",u.NORMAL):e.attributes.normal;a.push(t)}if(i){const t=void 0!==u.COLOR_0?s.getDependency("accessor",u.COLOR_0):e.attributes.color;c.push(t)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c)]).then(function(t){const s=t[0],o=t[1],a=t[2];return r&&(e.morphAttributes.position=s),n&&(e.morphAttributes.normal=o),i&&(e.morphAttributes.color=a),e.morphTargetsRelative=!0,e})}(e,s.targets,r):e})}class ie extends s.Loader{constructor(e){super(),this.viewer=e,this.manager=null}dispose(){this.manager&&this.manager.dispose()}isSupport(e,t=""){return("string"==typeof e||e instanceof globalThis.File||e instanceof ArrayBuffer)&&/(gltf|glb)$/i.test(t)}async load(e,t,r={}){this.manager=new s.GLTFLoadingManager(e,r);const n=new o(this.manager);n.setPath(this.manager.path),n.setCrossOrigin(r.crossOrigin||n.crossOrigin),n.setRequestHeader(r.requestHeader||{}),n.setWithCredentials(r.withCredentials||n.withCredentials);const i=await n.loadAsync(this.manager.fileURL,t=>{const{lengthComputable:s,loaded:r,total:n}=t,i=s?r/n:1;this.viewer.emitEvent({type:"geometryprogress",data:i,file:e})});if(!this.viewer.scene)return this;let a=1;i.scene.traverse(e=>{e.userData={handle:a+"",...e.userData},a++});const c=new s.ModelImpl(i.scene);return c.id=r.modelId||this.extractFileName(e),this.viewer.scene.add(i.scene),this.viewer.models.push(c),this.viewer.syncOptions(),this.viewer.syncOverlay(),this.viewer.emitEvent({type:"databasechunk",data:i.scene,file:e}),this.viewer.update(!0),this}}s.loaders.registerLoader("gltf-file",e=>new ie(e)),e.GLTFFileLoader=ie});
|
|
24
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("three"),require("@inweb/viewer-three")):"function"==typeof define&&define.amd?define(["exports","three","@inweb/viewer-three"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).ODA=e.ODA||{},e.ODA.Three=e.ODA.Three||{},e.ODA.Three.Extensions=e.ODA.Three.Extensions||{}),e.THREE,e.ODA.Three)}(this,function(e,t,s){"use strict";function r(e,s){if(s===t.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(s===t.TriangleFanDrawMode||s===t.TriangleStripDrawMode){let r=e.getIndex();if(null===r){const t=[],s=e.getAttribute("position");if(void 0===s)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<s.count;e++)t.push(e);e.setIndex(t),r=e.getIndex()}const n=r.count-2,i=[];if(s===t.TriangleFanDrawMode)for(let e=1;e<=n;e++)i.push(r.getX(0)),i.push(r.getX(e)),i.push(r.getX(e+1));else for(let e=0;e<n;e++)e%2==0?(i.push(r.getX(e)),i.push(r.getX(e+1)),i.push(r.getX(e+2))):(i.push(r.getX(e+2)),i.push(r.getX(e+1)),i.push(r.getX(e)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=e.clone();return o.setIndex(i),o.clearGroups(),o}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",s),e}function n(e){const t=new Map,s=new Map,r=e.clone();return i(e,r,function(e,r){t.set(r,e),s.set(e,r)}),r.traverse(function(e){if(!e.isSkinnedMesh)return;const r=e,n=t.get(e),i=n.skeleton.bones;r.skeleton=n.skeleton.clone(),r.bindMatrix.copy(n.bindMatrix),r.skeleton.bones=i.map(function(e){return s.get(e)}),r.bind(r.skeleton,r.bindMatrix)}),r}function i(e,t,s){s(e,t);for(let r=0;r<e.children.length;r++)i(e.children[r],t.children[r],s)}class o extends t.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new p(e)}),this.register(function(e){return new m(e)}),this.register(function(e){return new w(e)}),this.register(function(e){return new E(e)}),this.register(function(e){return new A(e)}),this.register(function(e){return new g(e)}),this.register(function(e){return new T(e)}),this.register(function(e){return new R(e)}),this.register(function(e){return new x(e)}),this.register(function(e){return new d(e)}),this.register(function(e){return new v(e)}),this.register(function(e){return new f(e)}),this.register(function(e){return new M(e)}),this.register(function(e){return new _(e)}),this.register(function(e){return new u(e)}),this.register(function(e){return new y(e,l.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new y(e,l.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new S(e)})}load(e,s,r,n){const i=this;let o;if(""!==this.resourcePath)o=this.resourcePath;else if(""!==this.path){const s=t.LoaderUtils.extractUrlBase(e);o=t.LoaderUtils.resolveURL(s,this.path)}else o=t.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const a=function(t){n?n(t):console.error(t),i.manager.itemError(e),i.manager.itemEnd(e)},c=new t.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(t){try{i.parse(t,o,function(t){s(t),i.manager.itemEnd(e)},a)}catch(e){a(e)}},r,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s,r){let n;const i={},o={},a=new TextDecoder;if("string"==typeof e)n=JSON.parse(e);else if(e instanceof ArrayBuffer){if(a.decode(new Uint8Array(e,0,4))===L){try{i[l.KHR_BINARY_GLTF]=new C(e)}catch(e){return void(r&&r(e))}n=JSON.parse(i[l.KHR_BINARY_GLTF].content)}else n=JSON.parse(a.decode(e))}else n=e;if(void 0===n.asset||n.asset.version[0]<2)return void(r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const c=new re(n,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](c);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[t.name]=t,i[t.name]=!0}if(n.extensionsUsed)for(let e=0;e<n.extensionsUsed.length;++e){const t=n.extensionsUsed[e],s=n.extensionsRequired||[];switch(t){case l.KHR_MATERIALS_UNLIT:i[t]=new h;break;case l.KHR_DRACO_MESH_COMPRESSION:i[t]=new O(n,this.dracoLoader);break;case l.KHR_TEXTURE_TRANSFORM:i[t]=new N;break;case l.KHR_MESH_QUANTIZATION:i[t]=new P;break;default:s.indexOf(t)>=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}c.setExtensions(i),c.setPlugins(o),c.parse(s,r)}parseAsync(e,t){const s=this;return new Promise(function(r,n){s.parse(e,t,r,n)})}}function a(){let e={};return{get:function(t){return e[t]},add:function(t,s){e[t]=s},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function c(e,t,s){const r=e.json.materials[t];return r.extensions&&r.extensions[s]?r.extensions[s]:null}const l={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_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class u{constructor(e){this.parser=e,this.name=l.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,r=t.length;s<r;s++){const r=t[s];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const s=this.parser,r="light:"+e;let n=s.cache.get(r);if(n)return n;const i=s.json,o=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e];let a;const c=new t.Color(16777215);void 0!==o.color&&c.setRGB(o.color[0],o.color[1],o.color[2],t.LinearSRGBColorSpace);const l=void 0!==o.range?o.range:0;switch(o.type){case"directional":a=new t.DirectionalLight(c),a.target.position.set(0,0,-1),a.add(a.target);break;case"point":a=new t.PointLight(c),a.distance=l;break;case"spot":a=new t.SpotLight(c),a.distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,a.angle=o.spot.outerConeAngle,a.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return a.position.set(0,0,0),J(a,o),void 0!==o.intensity&&(a.intensity=o.intensity),a.name=s.createUniqueName(o.name||"light_"+e),n=Promise.resolve(a),s.cache.add(r,n),n}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,r=s.json.nodes[e],n=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then(function(e){return s._getNodeRef(t.cache,n,e)})}}class h{constructor(){this.name=l.KHR_MATERIALS_UNLIT}getMaterialType(){return t.MeshBasicMaterial}extendParams(e,s,r){const n=[];e.color=new t.Color(1,1,1),e.opacity=1;const i=s.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const s=i.baseColorFactor;e.color.setRGB(s[0],s[1],s[2],t.LinearSRGBColorSpace),e.opacity=s[3]}void 0!==i.baseColorTexture&&n.push(r.assignTexture(e,"map",i.baseColorTexture,t.SRGBColorSpace))}return Promise.all(n)}}class d{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const s=c(this.parser,e,this.name);return null===s||void 0!==s.emissiveStrength&&(t.emissiveIntensity=s.emissiveStrength),Promise.resolve()}}class p{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const r=c(this.parser,e,this.name);if(null===r)return Promise.resolve();const n=[];if(void 0!==r.clearcoatFactor&&(s.clearcoat=r.clearcoatFactor),void 0!==r.clearcoatTexture&&n.push(this.parser.assignTexture(s,"clearcoatMap",r.clearcoatTexture)),void 0!==r.clearcoatRoughnessFactor&&(s.clearcoatRoughness=r.clearcoatRoughnessFactor),void 0!==r.clearcoatRoughnessTexture&&n.push(this.parser.assignTexture(s,"clearcoatRoughnessMap",r.clearcoatRoughnessTexture)),void 0!==r.clearcoatNormalTexture&&(n.push(this.parser.assignTexture(s,"clearcoatNormalMap",r.clearcoatNormalTexture)),void 0!==r.clearcoatNormalTexture.scale)){const e=r.clearcoatNormalTexture.scale;s.clearcoatNormalScale=new t.Vector2(e,e)}return Promise.all(n)}}class m{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_DISPERSION}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=c(this.parser,e,this.name);return null===s||(t.dispersion=void 0!==s.dispersion?s.dispersion:0),Promise.resolve()}}class f{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=c(this.parser,e,this.name);if(null===s)return Promise.resolve();const r=[];return void 0!==s.iridescenceFactor&&(t.iridescence=s.iridescenceFactor),void 0!==s.iridescenceTexture&&r.push(this.parser.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),void 0!==s.iridescenceIor&&(t.iridescenceIOR=s.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==s.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),void 0!==s.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),void 0!==s.iridescenceThicknessTexture&&r.push(this.parser.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class g{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_SHEEN}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const r=c(this.parser,e,this.name);if(null===r)return Promise.resolve();const n=[];if(s.sheenColor=new t.Color(0,0,0),s.sheenRoughness=0,s.sheen=1,void 0!==r.sheenColorFactor){const e=r.sheenColorFactor;s.sheenColor.setRGB(e[0],e[1],e[2],t.LinearSRGBColorSpace)}return void 0!==r.sheenRoughnessFactor&&(s.sheenRoughness=r.sheenRoughnessFactor),void 0!==r.sheenColorTexture&&n.push(this.parser.assignTexture(s,"sheenColorMap",r.sheenColorTexture,t.SRGBColorSpace)),void 0!==r.sheenRoughnessTexture&&n.push(this.parser.assignTexture(s,"sheenRoughnessMap",r.sheenRoughnessTexture)),Promise.all(n)}}class T{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=c(this.parser,e,this.name);if(null===s)return Promise.resolve();const r=[];return void 0!==s.transmissionFactor&&(t.transmission=s.transmissionFactor),void 0!==s.transmissionTexture&&r.push(this.parser.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class R{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_VOLUME}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const r=c(this.parser,e,this.name);if(null===r)return Promise.resolve();const n=[];s.thickness=void 0!==r.thicknessFactor?r.thicknessFactor:0,void 0!==r.thicknessTexture&&n.push(this.parser.assignTexture(s,"thicknessMap",r.thicknessTexture)),s.attenuationDistance=r.attenuationDistance||1/0;const i=r.attenuationColor||[1,1,1];return s.attenuationColor=(new t.Color).setRGB(i[0],i[1],i[2],t.LinearSRGBColorSpace),Promise.all(n)}}class x{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_IOR}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=c(this.parser,e,this.name);return null===s||(t.ior=void 0!==s.ior?s.ior:1.5,0===t.ior&&(t.ior=1e3)),Promise.resolve()}}class v{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_SPECULAR}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const r=c(this.parser,e,this.name);if(null===r)return Promise.resolve();const n=[];s.specularIntensity=void 0!==r.specularFactor?r.specularFactor:1,void 0!==r.specularTexture&&n.push(this.parser.assignTexture(s,"specularIntensityMap",r.specularTexture));const i=r.specularColorFactor||[1,1,1];return s.specularColor=(new t.Color).setRGB(i[0],i[1],i[2],t.LinearSRGBColorSpace),void 0!==r.specularColorTexture&&n.push(this.parser.assignTexture(s,"specularColorMap",r.specularColorTexture,t.SRGBColorSpace)),Promise.all(n)}}class _{constructor(e){this.parser=e,this.name=l.EXT_MATERIALS_BUMP}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=c(this.parser,e,this.name);if(null===s)return Promise.resolve();const r=[];return t.bumpScale=void 0!==s.bumpFactor?s.bumpFactor:1,void 0!==s.bumpTexture&&r.push(this.parser.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(r)}}class M{constructor(e){this.parser=e,this.name=l.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return null!==c(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=c(this.parser,e,this.name);if(null===s)return Promise.resolve();const r=[];return void 0!==s.anisotropyStrength&&(t.anisotropy=s.anisotropyStrength),void 0!==s.anisotropyRotation&&(t.anisotropyRotation=s.anisotropyRotation),void 0!==s.anisotropyTexture&&r.push(this.parser.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class w{constructor(e){this.parser=e,this.name=l.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,r=s.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const n=r.extensions[this.name],i=t.options.ktx2Loader;if(!i){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,n.source,i)}}class E{constructor(e){this.parser=e,this.name=l.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,s=this.parser,r=s.json,n=r.textures[e];if(!n.extensions||!n.extensions[t])return null;const i=n.extensions[t],o=r.images[i.source];let a=s.textureLoader;if(o.uri){const e=s.options.manager.getHandler(o.uri);null!==e&&(a=e)}return s.loadTextureImage(e,i.source,a)}}class A{constructor(e){this.parser=e,this.name=l.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,s=this.parser,r=s.json,n=r.textures[e];if(!n.extensions||!n.extensions[t])return null;const i=n.extensions[t],o=r.images[i.source];let a=s.textureLoader;if(o.uri){const e=s.options.manager.getHandler(o.uri);null!==e&&(a=e)}return s.loadTextureImage(e,i.source,a)}}class y{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const e=s.extensions[this.name],r=this.parser.getDependency("buffer",e.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(t){const s=e.byteOffset||0,r=e.byteLength||0,i=e.count,o=e.byteStride,a=new Uint8Array(t,s,r);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(i,o,a,e.mode,e.filter).then(function(e){return e.buffer}):n.ready.then(function(){const t=new ArrayBuffer(i*o);return n.decodeGltfBuffer(new Uint8Array(t),i,o,a,e.mode,e.filter),t})})}return null}}class S{constructor(e){this.name=l.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const s=this.parser.json,r=s.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;const n=s.meshes[r.mesh];for(const e of n.primitives)if(e.mode!==D.TRIANGLES&&e.mode!==D.TRIANGLE_STRIP&&e.mode!==D.TRIANGLE_FAN&&void 0!==e.mode)return null;const i=r.extensions[this.name].attributes,o=[],a={};for(const e in i)o.push(this.parser.getDependency("accessor",i[e]).then(t=>(a[e]=t,a[e])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(e=>{const s=e.pop(),r=s.isGroup?s.children:[s],n=e[0].count,i=[];for(const e of r){const s=new t.Matrix4,r=new t.Vector3,o=new t.Quaternion,c=new t.Vector3(1,1,1),l=new t.InstancedMesh(e.geometry,e.material,n);for(let e=0;e<n;e++)a.TRANSLATION&&r.fromBufferAttribute(a.TRANSLATION,e),a.ROTATION&&o.fromBufferAttribute(a.ROTATION,e),a.SCALE&&c.fromBufferAttribute(a.SCALE,e),l.setMatrixAt(e,s.compose(r,o,c));for(const s in a)if("_COLOR_0"===s){const e=a[s];l.instanceColor=new t.InstancedBufferAttribute(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==s&&"ROTATION"!==s&&"SCALE"!==s&&e.geometry.setAttribute(s,a[s]);t.Object3D.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),i.push(l)}return s.isGroup?(s.clear(),s.add(...i),s):i[0]}))}}const L="glTF",I=1313821514,b=5130562;class C{constructor(e){this.name=l.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.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.");const r=this.header.length-12,n=new DataView(e,12);let i=0;for(;i<r;){const t=n.getUint32(i,!0);i+=4;const r=n.getUint32(i,!0);if(i+=4,r===I){const r=new Uint8Array(e,12+i,t);this.content=s.decode(r)}else if(r===b){const s=12+i;this.body=e.slice(s,s+t)}i+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class O{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=l.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,s){const r=this.json,n=this.dracoLoader,i=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},c={},l={};for(const e in o){const t=V[e]||e.toLowerCase();a[t]=o[e]}for(const t in e.attributes){const s=V[t]||t.toLowerCase();if(void 0!==o[t]){const n=r.accessors[e.attributes[t]],i=U[n.componentType];l[s]=i.name,c[s]=!0===n.normalized}}return s.getDependency("bufferView",i).then(function(e){return new Promise(function(s,r){n.decodeDracoFile(e,function(e){for(const t in e.attributes){const s=e.attributes[t],r=c[t];void 0!==r&&(s.normalized=r)}s(e)},a,l,t.LinearSRGBColorSpace,r)})})}}class N{constructor(){this.name=l.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),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),e.needsUpdate=!0,e):e}}class P{constructor(){this.name=l.KHR_MESH_QUANTIZATION}}class H extends t.Interpolant{constructor(e,t,s,r){super(e,t,s,r)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,r=this.valueSize,n=e*r*3+r;for(let e=0;e!==r;e++)t[e]=s[n+e];return t}interpolate_(e,t,s,r){const n=this.resultBuffer,i=this.sampleValues,o=this.valueSize,a=2*o,c=3*o,l=r-t,u=(s-t)/l,h=u*u,d=h*u,p=e*c,m=p-c,f=-2*d+3*h,g=d-h,T=1-f,R=g-h+u;for(let e=0;e!==o;e++){const t=i[m+e+o],s=i[m+e+a]*l,r=i[p+e+o],c=i[p+e]*l;n[e]=T*t+R*s+f*r+g*c}return n}}const k=new t.Quaternion;class F extends H{interpolate_(e,t,s,r){const n=super.interpolate_(e,t,s,r);return k.fromArray(n).normalize().toArray(n),n}}const D={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},U={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},G={9728:t.NearestFilter,9729:t.LinearFilter,9984:t.NearestMipmapNearestFilter,9985:t.LinearMipmapNearestFilter,9986:t.NearestMipmapLinearFilter,9987:t.LinearMipmapLinearFilter},B={33071:t.ClampToEdgeWrapping,33648:t.MirroredRepeatWrapping,10497:t.RepeatWrapping},K={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},V={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},j={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},X={CUBICSPLINE:void 0,LINEAR:t.InterpolateLinear,STEP:t.InterpolateDiscrete},z="OPAQUE",q="MASK",W="BLEND";function Y(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new t.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:t.FrontSide})),e.DefaultMaterial}function Q(e,t,s){for(const r in s.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=s.extensions[r])}function J(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 Z(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let s=0,r=t.weights.length;s<r;s++)e.morphTargetInfluences[s]=t.weights[s];if(t.extras&&Array.isArray(t.extras.targetNames)){const s=t.extras.targetNames;if(e.morphTargetInfluences.length===s.length){e.morphTargetDictionary={};for(let t=0,r=s.length;t<r;t++)e.morphTargetDictionary[s[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function $(e){let t;const s=e.extensions&&e.extensions[l.KHR_DRACO_MESH_COMPRESSION];if(t=s?"draco:"+s.bufferView+":"+s.indices+":"+ee(s.attributes):e.indices+":"+ee(e.attributes)+":"+e.mode,void 0!==e.targets)for(let s=0,r=e.targets.length;s<r;s++)t+=":"+ee(e.targets[s]);return t}function ee(e){let t="";const s=Object.keys(e).sort();for(let r=0,n=s.length;r<n;r++)t+=s[r]+":"+e[s[r]]+";";return t}function te(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const se=new t.Matrix4;class re{constructor(e={},s={}){this.json=e,this.extensions={},this.plugins={},this.options=s,this.cache=new a,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,n=-1,i=!1,o=-1;if("undefined"!=typeof navigator&&void 0!==navigator.userAgent){const e=navigator.userAgent;r=!0===/^((?!chrome|android).)*safari/i.test(e);const t=e.match(/Version\/(\d+)/);n=r&&t?parseInt(t[1],10):-1,i=e.indexOf("Firefox")>-1,o=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||r&&n<17||i&&o<98?this.textureLoader=new t.TextureLoader(this.options.manager):this.textureLoader=new t.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new t.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const s=this,r=this.json,n=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(t){const i={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:s,userData:{}};return Q(n,i,r),J(i,r),Promise.all(s._invokeAll(function(e){return e.afterRoot&&e.afterRoot(i)})).then(function(){for(const e of i.scenes)e.updateMatrixWorld();e(i)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let s=0,r=t.length;s<r;s++){const r=t[s].joints;for(let t=0,s=r.length;t<s;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){const r=e[t];void 0!==r.mesh&&(this._addNodeRef(this.meshCache,r.mesh),void 0!==r.skin&&(s[r.mesh].isSkinnedMesh=!0)),void 0!==r.camera&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,s){if(e.refs[t]<=1)return s;const r=s.clone(),n=(e,t)=>{const s=this.associations.get(e);null!=s&&this.associations.set(t,s);for(const[s,r]of e.children.entries())n(r,t.children[s])};return n(s,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const r=e(t[s]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let r=0;r<t.length;r++){const n=e(t[r]);n&&s.push(n)}return s}getDependency(e,t){const s=e+":"+t;let r=this.cache.get(s);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":r=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e)}this.cache.add(s,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map(function(t,r){return s.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){const s=this.json.buffers[e],r=this.fileLoader;if(s.type&&"arraybuffer"!==s.type)throw new Error("THREE.GLTFLoader: "+s.type+" buffer type is not supported.");if(void 0===s.uri&&0===e)return Promise.resolve(this.extensions[l.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(e,i){r.load(t.LoaderUtils.resolveURL(s.uri,n.path),e,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+s.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){const s=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+s)})}loadAccessor(e){const s=this,r=this.json,n=this.json.accessors[e];if(void 0===n.bufferView&&void 0===n.sparse){const e=K[n.type],s=U[n.componentType],r=!0===n.normalized,i=new s(n.count*e);return Promise.resolve(new t.BufferAttribute(i,e,r))}const i=[];return void 0!==n.bufferView?i.push(this.getDependency("bufferView",n.bufferView)):i.push(null),void 0!==n.sparse&&(i.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(i).then(function(e){const i=e[0],o=K[n.type],a=U[n.componentType],c=a.BYTES_PER_ELEMENT,l=c*o,u=n.byteOffset||0,h=void 0!==n.bufferView?r.bufferViews[n.bufferView].byteStride:void 0,d=!0===n.normalized;let p,m;if(h&&h!==l){const e=Math.floor(u/h),r="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+e+":"+n.count;let l=s.cache.get(r);l||(p=new a(i,e*h,n.count*h/c),l=new t.InterleavedBuffer(p,h/c),s.cache.add(r,l)),m=new t.InterleavedBufferAttribute(l,o,u%h/c,d)}else p=null===i?new a(n.count*o):new a(i,u,n.count*o),m=new t.BufferAttribute(p,o,d);if(void 0!==n.sparse){const s=K.SCALAR,r=U[n.sparse.indices.componentType],c=n.sparse.indices.byteOffset||0,l=n.sparse.values.byteOffset||0,u=new r(e[1],c,n.sparse.count*s),h=new a(e[2],l,n.sparse.count*o);null!==i&&(m=new t.BufferAttribute(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let e=0,t=u.length;e<t;e++){const t=u[e];if(m.setX(t,h[e*o]),o>=2&&m.setY(t,h[e*o+1]),o>=3&&m.setZ(t,h[e*o+2]),o>=4&&m.setW(t,h[e*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=d}return m})}loadTexture(e){const t=this.json,s=this.options,r=t.textures[e].source,n=t.images[r];let i=this.textureLoader;if(n.uri){const e=s.manager.getHandler(n.uri);null!==e&&(i=e)}return this.loadTextureImage(e,r,i)}loadTextureImage(e,s,r){const n=this,i=this.json,o=i.textures[e],a=i.images[s],c=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[c])return this.textureCache[c];const l=this.loadImageSource(s,r).then(function(s){s.flipY=!1,s.name=o.name||a.name||"",""===s.name&&"string"==typeof a.uri&&!1===a.uri.startsWith("data:image/")&&(s.name=a.uri);const r=(i.samplers||{})[o.sampler]||{};return s.magFilter=G[r.magFilter]||t.LinearFilter,s.minFilter=G[r.minFilter]||t.LinearMipmapLinearFilter,s.wrapS=B[r.wrapS]||t.RepeatWrapping,s.wrapT=B[r.wrapT]||t.RepeatWrapping,s.generateMipmaps=!s.isCompressedTexture&&s.minFilter!==t.NearestFilter&&s.minFilter!==t.LinearFilter,n.associations.set(s,{textures:e}),s}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,s){const r=this,n=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());const o=n.images[e],a=self.URL||self.webkitURL;let c=o.uri||"",l=!1;if(void 0!==o.bufferView)c=r.getDependency("bufferView",o.bufferView).then(function(e){l=!0;const t=new Blob([e],{type:o.mimeType});return c=a.createObjectURL(t),c});else if(void 0===o.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(c).then(function(e){return new Promise(function(r,n){let o=r;!0===s.isImageBitmapLoader&&(o=function(e){const s=new t.Texture(e);s.needsUpdate=!0,r(s)}),s.load(t.LoaderUtils.resolveURL(e,i.path),o,void 0,n)})}).then(function(e){var t;return!0===l&&a.revokeObjectURL(c),J(e,o),e.userData.mimeType=o.mimeType||((t=o.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":t.search(/\.ktx2($|\?)/i)>0||0===t.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),e});return this.sourceCache[e]=u,u}assignTexture(e,t,s,r){const n=this;return this.getDependency("texture",s.index).then(function(i){if(!i)return null;if(void 0!==s.texCoord&&s.texCoord>0&&((i=i.clone()).channel=s.texCoord),n.extensions[l.KHR_TEXTURE_TRANSFORM]){const e=void 0!==s.extensions?s.extensions[l.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=n.associations.get(i);i=n.extensions[l.KHR_TEXTURE_TRANSFORM].extendTexture(i,e),n.associations.set(i,t)}}return void 0!==r&&(i.colorSpace=r),e[t]=i,i})}assignFinalMaterial(e){const s=e.geometry;let r=e.material;const n=void 0===s.attributes.tangent,i=void 0!==s.attributes.color,o=void 0===s.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+r.uuid;let s=this.cache.get(e);s||(s=new t.PointsMaterial,t.Material.prototype.copy.call(s,r),s.color.copy(r.color),s.map=r.map,s.sizeAttenuation=!1,this.cache.add(e,s)),r=s}else if(e.isLine){const e="LineBasicMaterial:"+r.uuid;let s=this.cache.get(e);s||(s=new t.LineBasicMaterial,t.Material.prototype.copy.call(s,r),s.color.copy(r.color),s.map=r.map,this.cache.add(e,s)),r=s}if(n||i||o){let e="ClonedMaterial:"+r.uuid+":";n&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),o&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),i&&(t.vertexColors=!0),o&&(t.flatShading=!0),n&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return t.MeshStandardMaterial}loadMaterial(e){const s=this,r=this.json,n=this.extensions,i=r.materials[e];let o;const a={},c=[];if((i.extensions||{})[l.KHR_MATERIALS_UNLIT]){const e=n[l.KHR_MATERIALS_UNLIT];o=e.getMaterialType(),c.push(e.extendParams(a,i,s))}else{const r=i.pbrMetallicRoughness||{};if(a.color=new t.Color(1,1,1),a.opacity=1,Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;a.color.setRGB(e[0],e[1],e[2],t.LinearSRGBColorSpace),a.opacity=e[3]}void 0!==r.baseColorTexture&&c.push(s.assignTexture(a,"map",r.baseColorTexture,t.SRGBColorSpace)),a.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,a.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(c.push(s.assignTexture(a,"metalnessMap",r.metallicRoughnessTexture)),c.push(s.assignTexture(a,"roughnessMap",r.metallicRoughnessTexture))),o=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,a)})))}!0===i.doubleSided&&(a.side=t.DoubleSide);const u=i.alphaMode||z;if(u===W?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===q&&(a.alphaTest=void 0!==i.alphaCutoff?i.alphaCutoff:.5)),void 0!==i.normalTexture&&o!==t.MeshBasicMaterial&&(c.push(s.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new t.Vector2(1,1),void 0!==i.normalTexture.scale)){const e=i.normalTexture.scale;a.normalScale.set(e,e)}if(void 0!==i.occlusionTexture&&o!==t.MeshBasicMaterial&&(c.push(s.assignTexture(a,"aoMap",i.occlusionTexture)),void 0!==i.occlusionTexture.strength&&(a.aoMapIntensity=i.occlusionTexture.strength)),void 0!==i.emissiveFactor&&o!==t.MeshBasicMaterial){const e=i.emissiveFactor;a.emissive=(new t.Color).setRGB(e[0],e[1],e[2],t.LinearSRGBColorSpace)}return void 0!==i.emissiveTexture&&o!==t.MeshBasicMaterial&&c.push(s.assignTexture(a,"emissiveMap",i.emissiveTexture,t.SRGBColorSpace)),Promise.all(c).then(function(){const t=new o(a);return i.name&&(t.name=i.name),J(t,i),s.associations.set(t,{materials:e}),i.extensions&&Q(n,t,i),t})}createUniqueName(e){const s=t.PropertyBinding.sanitizeNodeName(e||"");return s in this.nodeNamesUsed?s+"_"+ ++this.nodeNamesUsed[s]:(this.nodeNamesUsed[s]=0,s)}loadGeometries(e){const s=this,r=this.extensions,n=this.primitiveCache;function i(e){return r[l.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,s).then(function(t){return ne(t,e,s)})}const o=[];for(let r=0,a=e.length;r<a;r++){const a=e[r],c=$(a),u=n[c];if(u)o.push(u.promise);else{let e;e=a.extensions&&a.extensions[l.KHR_DRACO_MESH_COMPRESSION]?i(a):ne(new t.BufferGeometry,a,s),n[c]={primitive:a,promise:e},o.push(e)}}return Promise.all(o)}loadMesh(e){const s=this,n=this.json,i=this.extensions,o=n.meshes[e],a=o.primitives,c=[];for(let e=0,t=a.length;e<t;e++){const t=void 0===a[e].material?Y(this.cache):this.getDependency("material",a[e].material);c.push(t)}return c.push(s.loadGeometries(a)),Promise.all(c).then(function(n){const c=n.slice(0,n.length-1),l=n[n.length-1],u=[];for(let n=0,h=l.length;n<h;n++){const h=l[n],d=a[n];let p;const m=c[n];if(d.mode===D.TRIANGLES||d.mode===D.TRIANGLE_STRIP||d.mode===D.TRIANGLE_FAN||void 0===d.mode)p=!0===o.isSkinnedMesh?new t.SkinnedMesh(h,m):new t.Mesh(h,m),!0===p.isSkinnedMesh&&p.normalizeSkinWeights(),d.mode===D.TRIANGLE_STRIP?p.geometry=r(p.geometry,t.TriangleStripDrawMode):d.mode===D.TRIANGLE_FAN&&(p.geometry=r(p.geometry,t.TriangleFanDrawMode));else if(d.mode===D.LINES)p=new t.LineSegments(h,m);else if(d.mode===D.LINE_STRIP)p=new t.Line(h,m);else if(d.mode===D.LINE_LOOP)p=new t.LineLoop(h,m);else{if(d.mode!==D.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);p=new t.Points(h,m)}Object.keys(p.geometry.morphAttributes).length>0&&Z(p,o),p.name=s.createUniqueName(o.name||"mesh_"+e),J(p,o),d.extensions&&Q(i,p,d),s.assignFinalMaterial(p),u.push(p)}for(let t=0,r=u.length;t<r;t++)s.associations.set(u[t],{meshes:e,primitives:t});if(1===u.length)return o.extensions&&Q(i,u[0],o),u[0];const h=new t.Group;o.extensions&&Q(i,h,o),s.associations.set(h,{meshes:e});for(let e=0,t=u.length;e<t;e++)h.add(u[e]);return h})}loadCamera(e){let s;const r=this.json.cameras[e],n=r[r.type];if(n)return"perspective"===r.type?s=new t.PerspectiveCamera(t.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===r.type&&(s=new t.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(s.name=this.createUniqueName(r.name)),J(s,r),Promise.resolve(s);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const s=this.json.skins[e],r=[];for(let e=0,t=s.joints.length;e<t;e++)r.push(this._loadNodeShallow(s.joints[e]));return void 0!==s.inverseBindMatrices?r.push(this.getDependency("accessor",s.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(e){const r=e.pop(),n=e,i=[],o=[];for(let e=0,a=n.length;e<a;e++){const a=n[e];if(a){i.push(a);const s=new t.Matrix4;null!==r&&s.fromArray(r.array,16*e),o.push(s)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',s.joints[e])}return new t.Skeleton(i,o)})}loadAnimation(e){const s=this.json,r=this,n=s.animations[e],i=n.name?n.name:"animation_"+e,o=[],a=[],c=[],l=[],u=[];for(let e=0,t=n.channels.length;e<t;e++){const t=n.channels[e],s=n.samplers[t.sampler],r=t.target,i=r.node,h=void 0!==n.parameters?n.parameters[s.input]:s.input,d=void 0!==n.parameters?n.parameters[s.output]:s.output;void 0!==r.node&&(o.push(this.getDependency("node",i)),a.push(this.getDependency("accessor",h)),c.push(this.getDependency("accessor",d)),l.push(s),u.push(r))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c),Promise.all(l),Promise.all(u)]).then(function(e){const s=e[0],o=e[1],a=e[2],c=e[3],l=e[4],u=[];for(let e=0,t=s.length;e<t;e++){const t=s[e],n=o[e],i=a[e],h=c[e],d=l[e];if(void 0===t)continue;t.updateMatrix&&t.updateMatrix();const p=r._createAnimationTracks(t,n,i,h,d);if(p)for(let e=0;e<p.length;e++)u.push(p[e])}const h=new t.AnimationClip(i,void 0,u);return J(h,n),h})}createNodeMesh(e){const t=this.json,s=this,r=t.nodes[e];return void 0===r.mesh?null:s.getDependency("mesh",r.mesh).then(function(e){const t=s._getNodeRef(s.meshCache,r.mesh,e);return void 0!==r.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,s=r.weights.length;t<s;t++)e.morphTargetInfluences[t]=r.weights[t]}),t})}loadNode(e){const s=this,r=this.json.nodes[e],n=s._loadNodeShallow(e),i=[],o=r.children||[];for(let e=0,t=o.length;e<t;e++)i.push(s.getDependency("node",o[e]));const a=void 0===r.skin?Promise.resolve(null):s.getDependency("skin",r.skin);return Promise.all([n,Promise.all(i),a]).then(function(e){const s=e[0],r=e[1],n=e[2];null!==n&&s.traverse(function(e){e.isSkinnedMesh&&e.bind(n,se)});for(let e=0,t=r.length;e<t;e++)s.add(r[e]);if(void 0!==s.userData.pivot&&r.length>0){const e=s.userData.pivot,n=r[0];s.pivot=(new t.Vector3).fromArray(e),s.position.x-=e[0],s.position.y-=e[1],s.position.z-=e[2],n.position.set(0,0,0),delete s.userData.pivot}return s})}_loadNodeShallow(e){const s=this.json,r=this.extensions,n=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const i=s.nodes[e],o=i.name?n.createUniqueName(i.name):"",a=[],c=n._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return c&&a.push(c),void 0!==i.camera&&a.push(n.getDependency("camera",i.camera).then(function(e){return n._getNodeRef(n.cameraCache,i.camera,e)})),n._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){a.push(e)}),this.nodeCache[e]=Promise.all(a).then(function(s){let a;if(a=!0===i.isBone?new t.Bone:s.length>1?new t.Group:1===s.length?s[0]:new t.Object3D,a!==s[0])for(let e=0,t=s.length;e<t;e++)a.add(s[e]);if(i.name&&(a.userData.name=i.name,a.name=o),J(a,i),i.extensions&&Q(r,a,i),void 0!==i.matrix){const e=new t.Matrix4;e.fromArray(i.matrix),a.applyMatrix4(e)}else void 0!==i.translation&&a.position.fromArray(i.translation),void 0!==i.rotation&&a.quaternion.fromArray(i.rotation),void 0!==i.scale&&a.scale.fromArray(i.scale);if(n.associations.has(a)){if(void 0!==i.mesh&&n.meshCache.refs[i.mesh]>1){const e=n.associations.get(a);n.associations.set(a,{...e})}}else n.associations.set(a,{});return n.associations.get(a).nodes=e,a}),this.nodeCache[e]}loadScene(e){const s=this.extensions,r=this.json.scenes[e],i=this,o=new t.Group;r.name&&(o.name=i.createUniqueName(r.name)),J(o,r),r.extensions&&Q(s,o,r);const a=r.nodes||[],c=[];for(let e=0,t=a.length;e<t;e++)c.push(i.getDependency("node",a[e]));return Promise.all(c).then(function(e){for(let t=0,s=e.length;t<s;t++){const s=e[t];null!==s.parent?o.add(n(s)):o.add(s)}return i.associations=(e=>{const s=new Map;for(const[e,r]of i.associations)(e instanceof t.Material||e instanceof t.Texture)&&s.set(e,r);return e.traverse(e=>{const t=i.associations.get(e);null!=t&&s.set(e,t)}),s})(o),o})}_createAnimationTracks(e,s,r,n,i){const o=[],a=e.name?e.name:e.uuid,c=[];function l(e){e.morphTargetInfluences&&c.push(e.name?e.name:e.uuid)}let u;switch(j[i.path]===j.weights?(l(e),e.isGroup&&e.children.forEach(l)):c.push(a),j[i.path]){case j.weights:u=t.NumberKeyframeTrack;break;case j.rotation:u=t.QuaternionKeyframeTrack;break;case j.translation:case j.scale:u=t.VectorKeyframeTrack;break;default:if(1===r.itemSize)u=t.NumberKeyframeTrack;else u=t.VectorKeyframeTrack}const h=void 0!==n.interpolation?X[n.interpolation]:t.InterpolateLinear,d=this._getArrayFromAccessor(r);for(let e=0,t=c.length;e<t;e++){const t=new u(c[e]+"."+j[i.path],s.array,d,h);"CUBICSPLINE"===n.interpolation&&this._createCubicSplineTrackInterpolant(t),o.push(t)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=te(t.constructor),s=new Float32Array(t.length);for(let r=0,n=t.length;r<n;r++)s[r]=t[r]*e;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof t.QuaternionKeyframeTrack?F:H)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function ne(e,s,r){const n=s.attributes,i=[];function o(t,s){return r.getDependency("accessor",t).then(function(t){e.setAttribute(s,t)})}for(const t in n){const s=V[t]||t.toLowerCase();s in e.attributes||i.push(o(n[t],s))}if(void 0!==s.indices&&!e.index){const t=r.getDependency("accessor",s.indices).then(function(t){e.setIndex(t)});i.push(t)}return t.ColorManagement.workingColorSpace!==t.LinearSRGBColorSpace&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${t.ColorManagement.workingColorSpace}" not supported.`),J(e,s),function(e,s,r){const n=s.attributes,i=new t.Box3;if(void 0===n.POSITION)return;{const e=r.json.accessors[n.POSITION],s=e.min,o=e.max;if(void 0===s||void 0===o)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(i.set(new t.Vector3(s[0],s[1],s[2]),new t.Vector3(o[0],o[1],o[2])),e.normalized){const t=te(U[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}const o=s.targets;if(void 0!==o){const e=new t.Vector3,s=new t.Vector3;for(let t=0,n=o.length;t<n;t++){const n=o[t];if(void 0!==n.POSITION){const t=r.json.accessors[n.POSITION],i=t.min,o=t.max;if(void 0!==i&&void 0!==o){if(s.setX(Math.max(Math.abs(i[0]),Math.abs(o[0]))),s.setY(Math.max(Math.abs(i[1]),Math.abs(o[1]))),s.setZ(Math.max(Math.abs(i[2]),Math.abs(o[2]))),t.normalized){const e=te(U[t.componentType]);s.multiplyScalar(e)}e.max(s)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(e)}e.boundingBox=i;const a=new t.Sphere;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=a}(e,s,r),Promise.all(i).then(function(){return void 0!==s.targets?function(e,t,s){let r=!1,n=!1,i=!1;for(let e=0,s=t.length;e<s;e++){const s=t[e];if(void 0!==s.POSITION&&(r=!0),void 0!==s.NORMAL&&(n=!0),void 0!==s.COLOR_0&&(i=!0),r&&n&&i)break}if(!r&&!n&&!i)return Promise.resolve(e);const o=[],a=[],c=[];for(let l=0,u=t.length;l<u;l++){const u=t[l];if(r){const t=void 0!==u.POSITION?s.getDependency("accessor",u.POSITION):e.attributes.position;o.push(t)}if(n){const t=void 0!==u.NORMAL?s.getDependency("accessor",u.NORMAL):e.attributes.normal;a.push(t)}if(i){const t=void 0!==u.COLOR_0?s.getDependency("accessor",u.COLOR_0):e.attributes.color;c.push(t)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c)]).then(function(t){const s=t[0],o=t[1],a=t[2];return r&&(e.morphAttributes.position=s),n&&(e.morphAttributes.normal=o),i&&(e.morphAttributes.color=a),e.morphTargetsRelative=!0,e})}(e,s.targets,r):e})}class ie extends s.Loader{constructor(e){super(),this.viewer=e,this.manager=null}dispose(){this.manager&&this.manager.dispose()}isSupport(e,t=""){return("string"==typeof e||e instanceof globalThis.File||e instanceof ArrayBuffer)&&/(gltf|glb)$/i.test(t)}async load(e,t,r={}){this.manager=new s.GLTFLoadingManager(e,r);const n=new o(this.manager);n.setPath(this.manager.path),n.setCrossOrigin(r.crossOrigin||n.crossOrigin),n.setRequestHeader(r.requestHeader||{}),n.setWithCredentials(r.withCredentials||n.withCredentials);const i=await n.loadAsync(this.manager.fileURL,t=>{const{lengthComputable:s,loaded:r,total:n}=t,i=s?r/n:1;this.viewer.emitEvent({type:"geometryprogress",data:i,file:e})});if(!this.viewer.scene)return this;let a=1;i.scene.traverse(e=>{e.userData={handle:a+"",...e.userData},a++});const c=new s.ModelImpl(i.scene);return c.id=r.modelId||this.extractFileName(e),c.highlighter=this.viewer.getComponent("HighlighterComponent"),c.initialize(),this.viewer.scene.add(i.scene),this.viewer.models.push(c),this.viewer.syncOptions(),this.viewer.syncOverlay(),this.viewer.emitEvent({type:"databasechunk",data:i.scene,file:e}),this.viewer.update(!0),this}}s.loaders.registerLoader("gltf-file",e=>new ie(e)),e.GLTFFileLoader=ie});
|
|
@@ -60,6 +60,8 @@ class GLTFFileLoader extends Loader {
|
|
|
60
60
|
});
|
|
61
61
|
const modelImpl = new ModelImpl(gltf.scene);
|
|
62
62
|
modelImpl.id = params.modelId || this.extractFileName(file);
|
|
63
|
+
modelImpl.highlighter = this.viewer.getComponent("HighlighterComponent");
|
|
64
|
+
modelImpl.initialize();
|
|
63
65
|
this.viewer.scene.add(gltf.scene);
|
|
64
66
|
this.viewer.models.push(modelImpl);
|
|
65
67
|
this.viewer.syncOptions();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GLTFFileLoader.module.js","sources":["../../../extensions/loaders/GLTFFileLoader.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2026, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2026 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { GLTFLoader } from \"three/examples/jsm/loaders/GLTFLoader.js\";\nimport { GLTFLoadingManager, GLTFLoadParams, Loader, loaders, ModelImpl, Viewer } from \"@inweb/viewer-three\";\n\nexport class GLTFFileLoader extends Loader {\n public viewer: Viewer;\n private manager: GLTFLoadingManager | null;\n\n constructor(viewer: Viewer) {\n super();\n this.viewer = viewer;\n this.manager = null;\n }\n\n override dispose() {\n if (this.manager) this.manager.dispose();\n }\n\n override isSupport(file: any, format = \"\"): boolean {\n return (\n (typeof file === \"string\" || file instanceof globalThis.File || file instanceof ArrayBuffer) &&\n /(gltf|glb)$/i.test(format)\n );\n }\n\n override async load(file: any, format?: string, params: GLTFLoadParams = {}): Promise<this> {\n this.manager = new GLTFLoadingManager(file, params);\n\n const loader = new GLTFLoader(this.manager);\n loader.setPath(this.manager.path);\n loader.setCrossOrigin(params.crossOrigin || loader.crossOrigin);\n loader.setRequestHeader((params.requestHeader as any) || {});\n loader.setWithCredentials(params.withCredentials || loader.withCredentials);\n\n const progress = (event: ProgressEvent) => {\n const { lengthComputable, loaded, total } = event;\n const progress = lengthComputable ? loaded / total : 1;\n this.viewer.emitEvent({ type: \"geometryprogress\", data: progress, file });\n };\n\n const gltf = await loader.loadAsync(this.manager.fileURL, progress);\n if (!this.viewer.scene) return this;\n\n let handle = 1;\n gltf.scene.traverse((object) => {\n object.userData = { handle: handle + \"\", ...object.userData };\n handle++;\n });\n\n const modelImpl = new ModelImpl(gltf.scene);\n modelImpl.id = params.modelId || this.extractFileName(file);\n\n this.viewer.scene.add(gltf.scene);\n this.viewer.models.push(modelImpl);\n\n this.viewer.syncOptions();\n this.viewer.syncOverlay();\n\n this.viewer.emitEvent({ type: \"databasechunk\", data: gltf.scene, file });\n this.viewer.update(true);\n\n return this;\n }\n}\n\nloaders.registerLoader(\"gltf-file\", (viewer: any) => new GLTFFileLoader(viewer));\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BM,MAAO,cAAe,SAAQ,MAAM,CAAA;AAIxC,IAAA,WAAA,CAAY,MAAc,EAAA;AACxB,QAAA,KAAK,EAAE;AACP,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;AACpB,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI;IACrB;IAES,OAAO,GAAA;QACd,IAAI,IAAI,CAAC,OAAO;AAAE,YAAA,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;IAC1C;AAES,IAAA,SAAS,CAAC,IAAS,EAAE,MAAM,GAAG,EAAE,EAAA;AACvC,QAAA,QACE,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,YAAY,UAAU,CAAC,IAAI,IAAI,IAAI,YAAY,WAAW;AAC3F,YAAA,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC;IAE/B;IAES,MAAM,IAAI,CAAC,IAAS,EAAE,MAAe,EAAE,SAAyB,EAAE,EAAA;QACzE,IAAI,CAAC,OAAO,GAAG,IAAI,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC;QAEnD,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;QAC3C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QACjC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW,CAAC;QAC/D,MAAM,CAAC,gBAAgB,CAAE,MAAM,CAAC,aAAqB,IAAI,EAAE,CAAC;QAC5D,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,eAAe,IAAI,MAAM,CAAC,eAAe,CAAC;AAE3E,QAAA,MAAM,QAAQ,GAAG,CAAC,KAAoB,KAAI;YACxC,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK;AACjD,YAAA,MAAM,QAAQ,GAAG,gBAAgB,GAAG,MAAM,GAAG,KAAK,GAAG,CAAC;AACtD,YAAA,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC3E,QAAA,CAAC;AAED,QAAA,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC;AACnE,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;AAAE,YAAA,OAAO,IAAI;QAEnC,IAAI,MAAM,GAAG,CAAC;QACd,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAI;AAC7B,YAAA,MAAM,CAAC,QAAQ,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE;AAC7D,YAAA,MAAM,EAAE;AACV,QAAA,CAAC,CAAC;QAEF,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;AAC3C,QAAA,SAAS,CAAC,EAAE,GAAG,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"GLTFFileLoader.module.js","sources":["../../../extensions/loaders/GLTFFileLoader.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2026, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2026 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { GLTFLoader } from \"three/examples/jsm/loaders/GLTFLoader.js\";\nimport { GLTFLoadingManager, GLTFLoadParams, Loader, loaders, ModelImpl, Viewer } from \"@inweb/viewer-three\";\n\nexport class GLTFFileLoader extends Loader {\n public viewer: Viewer;\n private manager: GLTFLoadingManager | null;\n\n constructor(viewer: Viewer) {\n super();\n this.viewer = viewer;\n this.manager = null;\n }\n\n override dispose() {\n if (this.manager) this.manager.dispose();\n }\n\n override isSupport(file: any, format = \"\"): boolean {\n return (\n (typeof file === \"string\" || file instanceof globalThis.File || file instanceof ArrayBuffer) &&\n /(gltf|glb)$/i.test(format)\n );\n }\n\n override async load(file: any, format?: string, params: GLTFLoadParams = {}): Promise<this> {\n this.manager = new GLTFLoadingManager(file, params);\n\n const loader = new GLTFLoader(this.manager);\n loader.setPath(this.manager.path);\n loader.setCrossOrigin(params.crossOrigin || loader.crossOrigin);\n loader.setRequestHeader((params.requestHeader as any) || {});\n loader.setWithCredentials(params.withCredentials || loader.withCredentials);\n\n const progress = (event: ProgressEvent) => {\n const { lengthComputable, loaded, total } = event;\n const progress = lengthComputable ? loaded / total : 1;\n this.viewer.emitEvent({ type: \"geometryprogress\", data: progress, file });\n };\n\n const gltf = await loader.loadAsync(this.manager.fileURL, progress);\n if (!this.viewer.scene) return this;\n\n let handle = 1;\n gltf.scene.traverse((object) => {\n object.userData = { handle: handle + \"\", ...object.userData };\n handle++;\n });\n\n const modelImpl = new ModelImpl(gltf.scene);\n modelImpl.id = params.modelId || this.extractFileName(file);\n modelImpl.highlighter = this.viewer.getComponent(\"HighlighterComponent\") as any;\n modelImpl.initialize();\n\n this.viewer.scene.add(gltf.scene);\n this.viewer.models.push(modelImpl);\n\n this.viewer.syncOptions();\n this.viewer.syncOverlay();\n\n this.viewer.emitEvent({ type: \"databasechunk\", data: gltf.scene, file });\n this.viewer.update(true);\n\n return this;\n }\n}\n\nloaders.registerLoader(\"gltf-file\", (viewer: any) => new GLTFFileLoader(viewer));\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BM,MAAO,cAAe,SAAQ,MAAM,CAAA;AAIxC,IAAA,WAAA,CAAY,MAAc,EAAA;AACxB,QAAA,KAAK,EAAE;AACP,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;AACpB,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI;IACrB;IAES,OAAO,GAAA;QACd,IAAI,IAAI,CAAC,OAAO;AAAE,YAAA,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;IAC1C;AAES,IAAA,SAAS,CAAC,IAAS,EAAE,MAAM,GAAG,EAAE,EAAA;AACvC,QAAA,QACE,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,YAAY,UAAU,CAAC,IAAI,IAAI,IAAI,YAAY,WAAW;AAC3F,YAAA,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC;IAE/B;IAES,MAAM,IAAI,CAAC,IAAS,EAAE,MAAe,EAAE,SAAyB,EAAE,EAAA;QACzE,IAAI,CAAC,OAAO,GAAG,IAAI,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC;QAEnD,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;QAC3C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QACjC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW,CAAC;QAC/D,MAAM,CAAC,gBAAgB,CAAE,MAAM,CAAC,aAAqB,IAAI,EAAE,CAAC;QAC5D,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,eAAe,IAAI,MAAM,CAAC,eAAe,CAAC;AAE3E,QAAA,MAAM,QAAQ,GAAG,CAAC,KAAoB,KAAI;YACxC,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK;AACjD,YAAA,MAAM,QAAQ,GAAG,gBAAgB,GAAG,MAAM,GAAG,KAAK,GAAG,CAAC;AACtD,YAAA,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC3E,QAAA,CAAC;AAED,QAAA,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC;AACnE,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;AAAE,YAAA,OAAO,IAAI;QAEnC,IAAI,MAAM,GAAG,CAAC;QACd,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAI;AAC7B,YAAA,MAAM,CAAC,QAAQ,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE;AAC7D,YAAA,MAAM,EAAE;AACV,QAAA,CAAC,CAAC;QAEF,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;AAC3C,QAAA,SAAS,CAAC,EAAE,GAAG,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;QAC3D,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,sBAAsB,CAAQ;QAC/E,SAAS,CAAC,UAAU,EAAE;QAEtB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;AAElC,QAAA,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE;AACzB,QAAA,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE;AAEzB,QAAA,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;AACxE,QAAA,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;AAExB,QAAA,OAAO,IAAI;IACb;AACD;AAED,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,MAAW,KAAK,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;;;;"}
|
|
@@ -1277,6 +1277,8 @@
|
|
|
1277
1277
|
});
|
|
1278
1278
|
const modelImpl = new viewerThree.ModelImpl(scene);
|
|
1279
1279
|
modelImpl.id = params.modelId || this.extractFileName(file);
|
|
1280
|
+
modelImpl.highlighter = this.viewer.getComponent("HighlighterComponent");
|
|
1281
|
+
modelImpl.initialize();
|
|
1280
1282
|
this.viewer.scene.add(scene);
|
|
1281
1283
|
this.viewer.models.push(modelImpl);
|
|
1282
1284
|
this.viewer.syncOptions();
|
|
@@ -1298,7 +1300,7 @@
|
|
|
1298
1300
|
typeof file.download === "function" &&
|
|
1299
1301
|
/.ifcx$/i.test(file.type));
|
|
1300
1302
|
}
|
|
1301
|
-
async load(file) {
|
|
1303
|
+
async load(file, format, params = {}) {
|
|
1302
1304
|
const progress = (progress) => {
|
|
1303
1305
|
this.viewer.emitEvent({ type: "geometryprogress", data: progress, file });
|
|
1304
1306
|
};
|
|
@@ -1315,7 +1317,9 @@
|
|
|
1315
1317
|
handle++;
|
|
1316
1318
|
});
|
|
1317
1319
|
const modelImpl = new viewerThree.ModelImpl(scene);
|
|
1318
|
-
modelImpl.id = file.id;
|
|
1320
|
+
modelImpl.id = params.modelId || file.id;
|
|
1321
|
+
modelImpl.highlighter = this.viewer.getComponent("HighlighterComponent");
|
|
1322
|
+
modelImpl.initialize();
|
|
1319
1323
|
this.viewer.scene.add(scene);
|
|
1320
1324
|
this.viewer.models.push(modelImpl);
|
|
1321
1325
|
this.viewer.syncOptions();
|