zincjs 1.20.1 → 2.0.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.
Files changed (50) hide show
  1. package/build/zinc.js +292 -2648
  2. package/build/zinc.js.map +1 -1
  3. package/package.json +17 -20
  4. package/src/controls.js +33 -25
  5. package/src/geometryCSG.js +25 -23
  6. package/src/glyphsetCSG.js +15 -13
  7. package/src/loaders/GLTFToZincJSLoader.js +11 -9
  8. package/src/loaders/JSONLoader.js +14 -14
  9. package/src/loaders/niftiReader.js +0 -3
  10. package/src/loaders/primitivesLoader.js +4 -3
  11. package/src/minimap.js +6 -4
  12. package/src/primitives/augmentShader.js +3 -1
  13. package/src/primitives/geometry.js +16 -14
  14. package/src/primitives/glyph.js +7 -5
  15. package/src/primitives/glyphset.js +9 -7
  16. package/src/primitives/label.js +5 -2
  17. package/src/primitives/lines.js +13 -10
  18. package/src/primitives/lines2.js +8 -9
  19. package/src/primitives/lod.js +9 -9
  20. package/src/primitives/marker.js +22 -16
  21. package/src/primitives/markerCluster.js +14 -12
  22. package/src/primitives/pointset.js +8 -8
  23. package/src/primitives/texturePrimitive.js +7 -6
  24. package/src/primitives/textureSlides.js +8 -6
  25. package/src/primitives/textureVolume.js +8 -6
  26. package/src/primitives/tubeLines.js +14 -13
  27. package/src/primitives/zincObject.js +13 -9
  28. package/src/region.js +65 -66
  29. package/src/renderer.js +8 -5
  30. package/src/scene.js +26 -16
  31. package/src/sceneExporter.js +3 -3
  32. package/src/sceneLoader.js +109 -88
  33. package/src/shaders/rgbVolumeRender.js +8 -7
  34. package/src/shaders/textureArray.js +8 -7
  35. package/src/shaders/textureSlide.js +7 -6
  36. package/src/shaders/volumeRender.js +8 -7
  37. package/src/shaders/volumeRender_old.js +8 -7
  38. package/src/shaders/volumeTexture.js +9 -8
  39. package/src/texture/texture.js +9 -9
  40. package/src/texture/textureArray.js +5 -4
  41. package/src/three/Loader.js +0 -2
  42. package/src/three/Points.js +2 -2
  43. package/src/three-js-csg.js +538 -538
  44. package/src/utilities.js +49 -41
  45. package/src/videoHandler.js +11 -9
  46. package/src/workers/geometryCSG.worker.js +68 -67
  47. package/src/workers/geometryCSGInternal.js +12 -11
  48. package/src/zinc.js +49 -25
  49. package/vite.config.js +29 -0
  50. package/build/zinc.frontend.js +0 -3
package/build/zinc.js CHANGED
@@ -1,2648 +1,292 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory();
4
- else if(typeof define === 'function' && define.amd)
5
- define([], factory);
6
- else if(typeof exports === 'object')
7
- exports["Zinc"] = factory();
8
- else
9
- root["Zinc"] = factory();
10
- })(this, () => {
11
- return /******/ (() => { // webpackBootstrap
12
- /******/ var __webpack_modules__ = ([
13
- /* 0 */
14
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15
-
16
- __webpack_require__(1);var PACKAGE=__webpack_require__(2),version=PACKAGE.version,Zinc=function(){this.Revision=version,this.defaultMaterialColor=16777215,this.defaultOpacity=1,this.modelPrefix=void 0,this.Geometry=(__webpack_require__(3).Geometry),this.Glyph=(__webpack_require__(16).Glyph),this.Glyphset=(__webpack_require__(18).Glyphset),this.Pointset=(__webpack_require__(22).Pointset),this.Label=(__webpack_require__(17).Label),this.Lines=(__webpack_require__(24).Lines),this.TextureArray=(__webpack_require__(25).TextureArray),this.TextureSlides=(__webpack_require__(27).TextureSlides),this.Renderer=(__webpack_require__(30).Renderer),this.Scene=(__webpack_require__(32).Scene),this.GeometryCSG=(__webpack_require__(51).GeometryCSG),this.GlyphsetCSG=(__webpack_require__(57).GlyphsetCSG),this.Viewport=(__webpack_require__(44).Viewport),this.CameraControls=(__webpack_require__(44).CameraControls),this.SmoothCameraTransition=(__webpack_require__(44).SmoothCameraTransition),this.RayCaster=(__webpack_require__(44).RayCaster),this.CameraAutoTumble=(__webpack_require__(44).CameraAutoTumble),this.StereoEffect=(__webpack_require__(44).StereoEffect),this.loadExternalFile=(__webpack_require__(5).loadExternalFile),this.loadExternalFiles=(__webpack_require__(5).loadExternalFiles),this.THREE=__webpack_require__(4)};/**
17
- * Provides a global namespace for the Zinc javascript library and some default parameters for it.
18
- *
19
- * @namespace
20
- * @author Alan Wu
21
- */module.exports=new Zinc;
22
-
23
- /***/ }),
24
- /* 1 */
25
- /***/ ((module) => {
26
-
27
- "use strict";
28
- module.exports = require("url-polyfill");
29
-
30
- /***/ }),
31
- /* 2 */
32
- /***/ ((module) => {
33
-
34
- "use strict";
35
- module.exports = /*#__PURE__*/JSON.parse('{"name":"zincjs","version":"1.20.1","description":"ZincJS (Web-based-Zinc-Visualisation)","main":"build/zinc.js","directories":{"doc":"docs"},"files":["package.json","LICENSE","README.md","src/*","build/zinc.js","build/zinc.frontend.js","build/zinc.js.map","webpack.config.js"],"scripts":{"build-bundle":"webpack --config webpack.frontend.js; webpack --config webpack.backend.js","build-backend":"webpack --config webpack.backend.js","test":"npm --prefix ./test install && npm --prefix ./test run test-ci","changelog":"auto-changelog -p --output CHANGELOG.md --template keepachangelog","jsdoc":"jsdoc -c jsdoc_conf.json","version":"npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs","release:beta":"npm version prerelease --preid=beta; npm publish --tag beta","release:minor":"npm version minor; npm publish","release:patch":"npm version patch; npm publish"},"repository":{"type":"git","url":"git+https://github.com/alan-wu/ZincJS.git"},"keywords":["library","webgl","3d","zincjs"],"author":"Alan Wu <alan.wu@auckland.ac.nz>","license":"MIT","bugs":{"url":"https://github.com/alan-wu/ZincJS/issues"},"homepage":"http://alan-wu.github.io/ZincJS/","devDependencies":{"@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","auto-changelog":"^2.4.0","babel-loader":"^9.1.3","babel-preset-minify":"^0.5.1","file-loader":"^6.2.0","jsdoc":"^4.0.2","raw-loader":"^4.0.2","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"dependencies":{"css-element-queries":"^1.2.2","lodash":"^4.17.19","nifti-reader-js":"^0.8.0","promise-polyfill":"^8.1.3","three":"^0.130.1","three-spritetext":"1.6.2","url-loader":"^4.1.1","url-polyfill":"^1.1.7","webworkify-webpack":"^2.1.5"}}');
36
-
37
- /***/ }),
38
- /* 3 */
39
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
40
-
41
- var THREE=__webpack_require__(4),toBufferGeometry=(__webpack_require__(5).toBufferGeometry),createMeshForGeometry=(geometryIn,materialIn,options)=>{// First copy the geometry
42
- var geometry=toBufferGeometry(geometryIn,options),isTransparent=!1;1>options.opacity&&(isTransparent=!0);var material;if(geometry._video===void 0){var morphTargets=options.localTimeEnabled||options.localMorphColour;materialIn?(material=materialIn,material.morphTargets=morphTargets,material.morphNormals=options.localTimeEnabled):geometry instanceof THREE.BufferGeometry&&geometry.attributes.color===void 0?material=new THREE.MeshPhongMaterial({color:options.colour,morphTargets:morphTargets,morphNormals:options.localTimeEnabled,transparent:isTransparent,opacity:options.opacity,side:THREE.DoubleSide}):material=new THREE.MeshPhongMaterial({color:options.colour,morphTargets:morphTargets,morphNormals:options.localTimeEnabled,vertexColors:THREE.VertexColors,transparent:isTransparent,opacity:options.opacity,side:THREE.DoubleSide}),options.localMorphColour&&geometry.morphAttributes.color&&(material.onBeforeCompile=(__webpack_require__(9).augmentMorphColor)())}else{var videoTexture=geometry._video.createCanvasVideoTexture();material=new THREE.MeshBasicMaterial({morphTargets:options.localTimeEnabled,color:new THREE.Color(1,1,1),transparent:isTransparent,opacity:options.opacity,map:videoTexture,side:THREE.DoubleSide}),this.videoHandler=geometry._video}return new THREE.Mesh(geometry,material);},Geometry=function(){// THREE.Geometry or THREE.BufferGeometry
43
- /**
44
- * Create the mesh for rendering
45
- *
46
- * @param {THREE.Geomtry} geometryIn - Geometry to be rendered.
47
- * @param {THREE.Material} materialIn - Material to be set for the geometry.
48
- * @param {Object} options - Provide various options
49
- * @param {THREE.Color} options.colour - colour to be set for the geometry
50
- * @param {Boolean} options.localTimeEnabled - A flag to indicate either the geometry is
51
- * time dependent.
52
- * @param {Boolean} options.localMorphColour - A flag to indicate either the colour is
53
- * time dependent.
54
- * @param {Number} options.opacity - Opacity to be set for the geometry
55
- *//**
56
- * Calculate the UV for texture rendering.
57
- *//**
58
- * Handle transparent mesh, create a clone for backside rendering if it is
59
- * transparent.
60
- *//**
61
- * Set wireframe display for this geometry.
62
- *
63
- * @param {Boolean} wireframe - Flag to turn on/off wireframe display.
64
- *//**
65
- * Edit Vertice in index.
66
- */(__webpack_require__(10).ZincObject).call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(geometryIn,materialIn,options)=>{//Skip if there is a morph already
67
- if(!(this.morph&&this.morph.geometry&&null!=geometryIn)){var mesh=createMeshForGeometry(geometryIn,materialIn,options);this.setMesh(mesh,options.localTimeEnabled,options.localMorphColour)}},this.calculateUVs=()=>{this.geometry.computeBoundingBox();var max=this.geometry.boundingBox.max,min=this.geometry.boundingBox.min,offset=new THREE.Vector2(0-min.x,0-min.y),range=new THREE.Vector2(max.x-min.x,max.y-min.y);this.geometry.faceVertexUvs[0]=[];for(var i=0;i<this.geometry.faces.length;i++){var v1=this.geometry.vertices[this.geometry.faces[i].a],v2=this.geometry.vertices[this.geometry.faces[i].b],v3=this.geometry.vertices[this.geometry.faces[i].c];geometry.faceVertexUvs[0].push([new THREE.Vector2((v1.x+offset.x)/range.x,(v1.y+offset.y)/range.y),new THREE.Vector2((v2.x+offset.x)/range.x,(v2.y+offset.y)/range.y),new THREE.Vector2((v3.x+offset.x)/range.x,(v3.y+offset.y)/range.y)])}geometry.uvsNeedUpdate=!0},this.checkTransparentMesh=function(){this._lod.checkTransparentMesh()},this.setWireframe=wireframe=>{this.morph.material.wireframe=wireframe},this.editVertices=function(coords,i){if(coords&&coords.length){var mesh=this.getMorph(),attribute=mesh.geometry.getAttribute("position");if(!mesh||0>i)return;var index=3*i;coords.forEach(coord=>{attribute.array[index++]=coord[0],attribute.array[index++]=coord[1],attribute.array[index++]=coord[2]}),attribute.needsUpdate=!0,mesh.geometry.computeBoundingBox(),mesh.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}};/**
68
- * Provides an object which stores geometry and provides method which controls its animations.
69
- * This is created when a valid json file containging geometry is read into a {@link Zinc.Scene}
70
- * object.
71
- *
72
- * @class
73
- * @author Alan Wu
74
- * @return {Geometry}
75
- */Geometry.prototype=Object.create((__webpack_require__(10).ZincObject).prototype),exports.Geometry=Geometry;
76
-
77
- /***/ }),
78
- /* 4 */
79
- /***/ ((module) => {
80
-
81
- "use strict";
82
- module.exports = require("three");
83
-
84
- /***/ }),
85
- /* 5 */
86
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
87
-
88
- var THREE=__webpack_require__(4),THREEGeometry=(__webpack_require__(6).Geometry),SpriteText=(__webpack_require__(7)["default"]);function resolveURL(url){var actualURL=url,prefix=(__webpack_require__(0).modelPrefix);if(prefix){"/"!=prefix[prefix.length-1]&&(prefix+="/");/^(?:[a-z]+:)?\/\//i.test(url)||(actualURL=prefix+url)}return actualURL;}function createNewURL(target,reference){var getNewURL=(target,reference)=>{try{var newURL=new URL(target,reference).href;//Make sure the target url does not contain parameters
89
- if(target&&2>target.split("?").length){var paramsStrings=reference.split("?");//There are parameters, add them to the target
90
- 2===paramsStrings.length&&(newURL=newURL+"?"+paramsStrings[1])}return newURL;}catch(_unused){console.error("There is an issue creating the url link with: ".concat(target,"."))}};if(!Array.isArray(target))return getNewURL(target,reference);var urls=[];return target.forEach(url=>{urls.push(getNewURL(url,reference))}),urls;}/*
91
- * Calculate the bounding box of a mesh, values will be
92
- * set for cachedBox, b1, v1 and v2 and they need to be
93
- * defined.
94
- */function getBoundingBox(mesh,cachedBox,b1,v1,v2){var influences=mesh.morphTargetInfluences,attributes=void 0;mesh.geometry&&(attributes=mesh.geometry.morphAttributes);var found=!1;if(influences&&attributes&&attributes.position){v1.set(0,0,0),v2.set(0,0,0);for(var i=0;i<influences.length;i++)0<influences[i]&&(found=!0,b1.setFromArray(attributes.position[i].array),v1.add(b1.min.multiplyScalar(influences[i])),v2.add(b1.max.multiplyScalar(influences[i])));found&&cachedBox.set(v1,v2)}found||cachedBox.setFromBufferAttribute(mesh.geometry.attributes.position),mesh.updateWorldMatrix(!0,!0),cachedBox.applyMatrix4(mesh.matrixWorld)}//Convenient function
95
- function loadExternalFile(url,data,callback,errorCallback){// Set up an asynchronous request
96
- var request=new XMLHttpRequest;// Hook the event that gets called as the request progresses
97
- request.open("GET",resolveURL(url),!0),request.onreadystatechange=()=>{4==request.readyState&&(200==request.status?callback(request.responseText,data):errorCallback(url))},request.send(null)}function loadExternalFiles(urls,callback,errorCallback){// Callback for a single file
98
- function partialCallback(text,urlIndex){result[urlIndex]=text,numComplete++,numComplete==numUrls&&callback(result)}for(var numUrls=urls.length,numComplete=0,result=[],i=0;i<numUrls;i++)loadExternalFile(urls[i],i,partialCallback,errorCallback);}//Get the colours at index
99
- exports.getColorsRGB=(colors,index)=>{var index_in_colors=Math.floor(index/3),remainder=index%3,hex_value=0;0==remainder?hex_value=colors[index_in_colors].r:1==remainder?hex_value=colors[index_in_colors].g:2==remainder&&(hex_value=colors[index_in_colors].b);var mycolor=new THREE.Color(hex_value);return[mycolor.r,mycolor.g,mycolor.b];},exports.updateMorphColorAttribute=function(targetGeometry,morph){if(morph&&targetGeometry&&targetGeometry.morphAttributes&&targetGeometry.morphAttributes.color){var morphColors=targetGeometry.morphAttributes.color,influences=morph.morphTargetInfluences,length=influences.length;targetGeometry.deleteAttribute("morphColor0"),targetGeometry.deleteAttribute("morphColor1");for(var bound=0,morphArray=[],i=0;1>bound||i<length;i++)0<influences[i]&&(bound++,morphArray.push([i,influences[i]]));2==morphArray.length?(targetGeometry.setAttribute("morphColor0",morphColors[morphArray[0][0]]),targetGeometry.setAttribute("morphColor1",morphColors[morphArray[1][0]])):1==morphArray.length&&(targetGeometry.setAttribute("morphColor0",morphColors[morphArray[0][0]]),targetGeometry.setAttribute("morphColor1",morphColors[morphArray[0][0]]))}},exports.toBufferGeometry=(geometryIn,options)=>{var geometry;return geometryIn instanceof THREEGeometry?(options.localTimeEnabled&&!geometryIn.morphNormalsReady&&(null==geometryIn.morphNormals||0==geometryIn.morphNormals.length)&&geometryIn.computeMorphNormals(),geometry=geometryIn.toIndexedBufferGeometry(),options.localMorphColour&&copyMorphColorsToIndexedBufferGeometry(geometryIn,geometry)):geometryIn instanceof THREE.BufferGeometry&&(geometry=geometryIn.clone()),geometry.colorsNeedUpdate=!0,geometry.computeBoundingBox(),geometry.computeBoundingSphere(),geometryIn._video&&(geometry._video=geometryIn._video),geometry;},exports.copyMorphColorsToBufferGeometry=(geometry,bufferGeometry)=>{if(geometry&&geometry.morphColors&&0<geometry.morphColors.length){for(var array=[],morphColors=geometry.morphColors,getColorsRGB=(__webpack_require__(5).getColorsRGB),i=0,l=morphColors.length;i<l;i++){for(var morphColor=morphColors[i],colorArray=[],j=0;j<geometry.faces.length;j++){var face=geometry.faces[j],color=getColorsRGB(morphColor.colors,face.a);colorArray.push(color[0],color[1],color[2]),color=getColorsRGB(morphColor.colors,face.b),colorArray.push(color[0],color[1],color[2]),color=getColorsRGB(morphColor.colors,face.c),colorArray.push(color[0],color[1],color[2])}var attribute=new THREE.Float32BufferAttribute(3*(3*geometry.faces.length),3);attribute.name=morphColor.name,array.push(attribute.copyArray(colorArray))}bufferGeometry.morphAttributes.color=array}};var copyMorphColorsToIndexedBufferGeometry=(geometry,bufferGeometry)=>{if(geometry&&geometry.morphColors&&0<geometry.morphColors.length){for(var array=[],morphColors=geometry.morphColors,getColorsRGB=(__webpack_require__(5).getColorsRGB),i=0,l=morphColors.length;i<l;i++){for(var color,morphColor=morphColors[i],colorArray=[],j=0;j<3*morphColor.colors.length;j++)color=getColorsRGB(morphColor.colors,j),colorArray.push(color[0],color[1],color[2]);var attribute=new THREE.Float32BufferAttribute(colorArray,3);attribute.name=morphColor.name,array.push(attribute)}bufferGeometry.morphAttributes.color=array}};/**
100
- * Merges a set of attributes into a single instance. All attributes must have compatible properties and types.
101
- * Instances of {@link InterleavedBufferAttribute} are not supported.
102
- *
103
- * @param {Array<BufferAttribute>} attributes - The attributes to merge.
104
- * @return {?BufferAttribute} The merged attribute. Returns `null` if the merge does not succeed.
105
- */function mergeAttributes(attributes){for(var TypedArray,itemSize,normalized,attribute,gpuType=-1,arrayLength=0,i=0;i<attributes.length;++i){if(attribute=attributes[i],void 0===TypedArray&&(TypedArray=attribute.array.constructor),TypedArray!==attribute.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===itemSize&&(itemSize=attribute.itemSize),itemSize!==attribute.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===normalized&&(normalized=attribute.normalized),normalized!==attribute.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===gpuType&&(gpuType=attribute.gpuType),gpuType!==attribute.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;arrayLength+=attribute.count*itemSize}for(var _attribute,array=new TypedArray(arrayLength),result=new THREE.BufferAttribute(array,itemSize,normalized),offset=0,_i=0;_i<attributes.length;++_i){if(_attribute=attributes[_i],_attribute.isInterleavedBufferAttribute)for(var tupleOffset=offset/itemSize,j=0,l=_attribute.count;j<l;j++)for(var value,c=0;c<itemSize;c++)value=_attribute.getComponent(j,c),result.setComponent(j+tupleOffset,c,value);else array.set(_attribute.array,offset);offset+=_attribute.count*itemSize}return void 0!==gpuType&&(result.gpuType=gpuType),result;}/**
106
- * Merges a set of geometries into a single instance. All geometries must have compatible attributes.
107
- *
108
- * @param {Array<BufferGeometry>} geometries - The geometries to merge.
109
- * @param {boolean} [useGroups=false] - Whether to use groups or not.
110
- * @return {?BufferGeometry} The merged geometry. Returns `null` if the merge does not succeed.
111
- */exports.mergeGeometries=function(geometries){for(var useGroups=!!(1<arguments.length&&arguments[1]!==void 0)&&arguments[1],isIndexed=null!==geometries[0].index,attributesUsed=new Set(Object.keys(geometries[0].attributes)),morphAttributesUsed=new Set(Object.keys(geometries[0].morphAttributes)),attributes={},morphAttributes={},morphTargetsRelative=geometries[0].morphTargetsRelative,mergedGeometry=new THREE.BufferGeometry,offset=0,i=0;i<geometries.length;++i){var geometry=geometries[i],attributesCount=0;// ensure that all geometries are indexed, or none
112
- if(isIndexed!==(null!==geometry.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;// gather attributes, exit early if they're different
113
- for(var name in geometry.attributes){if(!attributesUsed.has(name))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". All geometries must have compatible attributes; make sure \""+name+"\" attribute exists among all geometries, or in none of them."),null;attributes[name]===void 0&&(attributes[name]=[]),attributes[name].push(geometry.attributes[name]),attributesCount++}// ensure geometries have the same number of attributes
114
- if(attributesCount!==attributesUsed.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". Make sure all geometries have the same number of attributes."),null;// gather morph attributes, exit early if they're different
115
- if(morphTargetsRelative!==geometry.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(var _name in geometry.morphAttributes){if(!morphAttributesUsed.has(_name))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". .morphAttributes must be consistent throughout all geometries."),null;morphAttributes[_name]===void 0&&(morphAttributes[_name]=[]),morphAttributes[_name].push(geometry.morphAttributes[_name])}if(useGroups){var count=void 0;if(isIndexed)count=geometry.index.count;else if(void 0!==geometry.attributes.position)count=geometry.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". The geometry must have either an index or a position attribute"),null;mergedGeometry.addGroup(offset,count,i),offset+=count}}// merge indices
116
- if(isIndexed){for(var index,indexOffset=0,mergedIndex=[],_i2=0;_i2<geometries.length;++_i2){index=geometries[_i2].index;for(var j=0;j<index.count;++j)mergedIndex.push(index.getX(j)+indexOffset);indexOffset+=geometries[_i2].attributes.position.count}mergedGeometry.setIndex(mergedIndex)}// merge attributes
117
- for(var _name2 in attributes){var mergedAttribute=mergeAttributes(attributes[_name2]);if(!mergedAttribute)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+_name2+" attribute."),null;mergedGeometry.setAttribute(_name2,mergedAttribute)}// merge morph attributes
118
- for(var _name3 in morphAttributes){var numMorphTargets=morphAttributes[_name3][0].length;if(0===numMorphTargets)break;mergedGeometry.morphAttributes=mergedGeometry.morphAttributes||{},mergedGeometry.morphAttributes[_name3]=[];for(var morphAttributesToMerge,_i3=0;_i3<numMorphTargets;++_i3){morphAttributesToMerge=[];for(var _j=0;_j<morphAttributes[_name3].length;++_j)morphAttributesToMerge.push(morphAttributes[_name3][_j][_i3]);var mergedMorphAttribute=mergeAttributes(morphAttributesToMerge);if(!mergedMorphAttribute)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+_name3+" morphAttribute."),null;mergedGeometry.morphAttributes[_name3].push(mergedMorphAttribute)}}return mergedGeometry;},exports.mergeVertices=function(geometry){var tolerance=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1e-4;tolerance=Math.max(tolerance,Number.EPSILON);// next value for triangle indices
119
- // attributes and new attribute arrays
120
- // initialize the arrays
121
- for(var name,hashToIndex={},indices=geometry.getIndex(),positions=geometry.getAttribute("position"),vertexCount=indices?indices.count:positions.count,nextIndex=0,attributeNames=Object.keys(geometry.attributes),attrArrays={},morphAttrsArrays={},newIndices=[],getters=["getX","getY","getZ","getW"],i=0,l=attributeNames.length;i<l;i++){name=attributeNames[i],attrArrays[name]=[];var morphAttr=geometry.morphAttributes[name];morphAttr&&(morphAttrsArrays[name]=Array(morphAttr.length).fill().map(()=>[]))}// convert the error tolerance to an amount of decimal places to truncate to
122
- for(var decimalShift=Math.log10(1/tolerance),shiftMultiplier=Math.pow(10,decimalShift),i=0;i<vertexCount;i++){// Generate a hash for the vertex attributes at the current index 'i'
123
- for(var index=indices?indices.getX(i):i,hash="",j=0,l=attributeNames.length;j<l;j++)for(var name=attributeNames[j],attribute=geometry.getAttribute(name),itemSize=attribute.itemSize,k=0;k<itemSize;k++)// double tilde truncates the decimal value
124
- hash+="".concat(~~(attribute[getters[k]](index)*shiftMultiplier),",");// Add another reference to the vertex if it's already
125
- // used by another index
126
- if(hash in hashToIndex)newIndices.push(hashToIndex[hash]);else{// copy data to the new index in the attribute arrays
127
- for(var j=0,l=attributeNames.length;j<l;j++)for(var getterFunc,name=attributeNames[j],attribute=geometry.getAttribute(name),morphAttr=geometry.morphAttributes[name],itemSize=attribute.itemSize,newarray=attrArrays[name],newMorphArrays=morphAttrsArrays[name],k=0;k<itemSize;k++)if(getterFunc=getters[k],newarray.push(attribute[getterFunc](index)),morphAttr)for(var m=0,ml=morphAttr.length;m<ml;m++)newMorphArrays[m].push(morphAttr[m][getterFunc](index));hashToIndex[hash]=nextIndex,newIndices.push(nextIndex),nextIndex++}}// Generate typed arrays from new attribute arrays and update
128
- // the attributeBuffers
129
- for(var result=geometry.clone(),i=0,l=attributeNames.length;i<l;i++){var attribute,name=attributeNames[i],oldAttribute=geometry.getAttribute(name),buffer=new oldAttribute.array.constructor(attrArrays[name]);// Update the attribute arrays
130
- if(oldAttribute.isInterleavedBufferAttribute?attribute=new THREE.BufferAttribute(buffer,oldAttribute.itemSize,oldAttribute.itemSize):(attribute=geometry.getAttribute(name).clone(),attribute.setArray(buffer)),result.setAttribute(name,attribute),name in morphAttrsArrays)for(var morphAttribute,j=0;j<morphAttrsArrays[name].length;j++)morphAttribute=geometry.morphAttributes[name][j].clone(),morphAttribute.setArray(new morphAttribute.array.constructor(morphAttrsArrays[name][j])),result.morphAttributes[name][j]=morphAttribute;}// Generate an index buffer typed array
131
- var cons=Uint8Array;newIndices.length>=Math.pow(2,8)&&(cons=Uint16Array),newIndices.length>=Math.pow(2,16)&&(cons=Uint32Array);var newIndexBuffer=new cons(newIndices),newIndices=null;return null===indices?newIndices=new THREE.BufferAttribute(newIndexBuffer,1):(newIndices=geometry.getIndex().clone(),newIndices.setArray(newIndexBuffer)),result.setIndex(newIndices),result;};function PhongToToon(materialIn){if(materialIn.isMeshPhongMaterial){var material=new THREE.MeshToonMaterial({color:materialIn.color.clone(),morphTargets:materialIn.morphTargets,morphNormals:materialIn.morphNormals,vertexColors:materialIn.vertexColors,transparent:materialIn.transparent,opacity:materialIn.opacity,side:materialIn.side});return materialIn.map&&(material.map=materialIn.map),material;}return materialIn;}/**
132
- * Create and return a new buffer geometry with the size of length,
133
- * and initial coords.
134
- */function createBufferGeometry(length,coords){if(coords&&length>=coords.length){var geometry=new THREE.BufferGeometry,vertices=new Float32Array(3*length),i=0;return coords.forEach(coord=>{vertices[i++]=coord[0],vertices[i++]=coord[1],vertices[i++]=coord[2]}),geometry.setAttribute("position",new THREE.BufferAttribute(vertices,3)),geometry.setDrawRange(0,coords.length),geometry;}}function getCircularTexture(){var image=new Image;image.src=__webpack_require__(8);var texture=new THREE.Texture;return texture.image=image,texture.needsUpdate=!0,texture;}function createNewSpriteText(text,height,colour,font,pixel,weight){var sprite=new SpriteText(text,height,colour,font,pixel,weight);return sprite.fontFace=font,sprite.fontSize=pixel,sprite.fontWeight=weight,sprite.material.map.generateMipmaps=!1,sprite.material.map.anisotropy=4,sprite.material.sizeAttenuation=!1,sprite.material.alphaTest=.5,sprite.material.transparent=!0,sprite.material.depthWrite=!1,sprite.material.depthTest=!1,sprite.center.set(.5,-1.2),sprite.renderOrder=1e4,sprite;}/*
135
- * Check if the compare path match with the region or/and group.
136
- * comparePath should be in the form of regionPath/Group.
137
- * * can be used as wildcard.
138
- * comparePath will be used to compare both region and group if it
139
- * is a single string without /
140
- */function isRegionGroup(regionPath,groupName,comparePath){if(comparePath){var region=regionPath?regionPath:"",group=groupName?groupName:"",n=comparePath.lastIndexOf("/");if(-1<n){var r=void 0,g=void 0;if(r=comparePath.substring(0,n),g=comparePath.substring(n+1),("*"===r||"**"===r||r.toLowerCase()===region.toLowerCase())&&("*"===g||"**"===g||g.toLowerCase()===group.toLowerCase()))return!0;}else//one single value if one of the region / group matches
141
- if(region.toLowerCase()===comparePath.toLowerCase()||group.toLowerCase()===comparePath.toLowerCase())return!0;}return!1;}function removeVertexAtIndex(geometry,index,maintainLength){var positionAttribute=geometry.getAttribute("position"),normalAttribute=geometry.getAttribute("normal");// Also update other attributes
142
- if(positionAttribute){// e.g., 3 for x, y, z
143
- // Helper to remove elements from a typed array
144
- var itemSize=positionAttribute.itemSize,start=index*itemSize,deleteCount=itemSize,removed=!1,removeElements=(attribute,name)=>{var removed=!1,array=Array.from(attribute.array);if(array.length>=start+deleteCount){array.splice(start,deleteCount),maintainLength&&array.concat(Array(deleteCount).fill(0)),removed=!0;var newArray=new Float32Array(array);geometry.setAttribute(name,new THREE.BufferAttribute(newArray,itemSize)),geometry.getAttribute(name).needsUpdate=!0}// Create new BufferAttribute with the modified array
145
- return removed;};return removed=removeElements(positionAttribute,"position"),normalAttribute&&removeElements(normalAttribute,"normal"),null!==geometry.index&&console.warn("Removing vertices from indexed geometry requires index buffer recalculation."),removed;}}exports.getBoundingBox=getBoundingBox,exports.createNewURL=createNewURL,exports.createBufferGeometry=createBufferGeometry,exports.getCircularTexture=getCircularTexture,exports.resolveURL=resolveURL,exports.loadExternalFile=loadExternalFile,exports.loadExternalFiles=loadExternalFiles,exports.PhongToToon=PhongToToon,exports.createNewSpriteText=createNewSpriteText,exports.isRegionGroup=isRegionGroup,exports.removeVertexAtIndex=removeVertexAtIndex;
146
-
147
- /***/ }),
148
- /* 6 */
149
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
150
-
151
- "use strict";
152
- __webpack_require__.r(__webpack_exports__);
153
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
154
- /* harmony export */ Face3: () => (/* binding */ Face3),
155
- /* harmony export */ Geometry: () => (/* binding */ Geometry)
156
- /* harmony export */ });
157
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
158
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_0__);
159
- var _m1=new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4,_obj=new three__WEBPACK_IMPORTED_MODULE_0__.Object3D,_offset=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_temp=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3;function Geometry(){// update flags
160
- this.uuid=three__WEBPACK_IMPORTED_MODULE_0__.MathUtils.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.normals=[],this.uvs=[],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1,this.morphNormalsReady=!1}Geometry.prototype=Object.assign(Object.create(three__WEBPACK_IMPORTED_MODULE_0__.EventDispatcher.prototype),{constructor:Geometry,isGeometry:!0,applyMatrix4:function applyMatrix4(matrix){for(var vertex,normalMatrix=new three__WEBPACK_IMPORTED_MODULE_0__.Matrix3().getNormalMatrix(matrix),i=0,il=this.vertices.length;i<il;i++)vertex=this.vertices[i],vertex.applyMatrix4(matrix);for(var face,_i=0,_il=this.faces.length;_i<_il;_i++){face=this.faces[_i],face.normal.applyMatrix3(normalMatrix).normalize();for(var j=0,jl=face.vertexNormals.length;j<jl;j++)face.vertexNormals[j].applyMatrix3(normalMatrix).normalize();}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this;},rotateX:function rotateX(angle){return _m1.makeRotationX(angle),this.applyMatrix4(_m1),this;},rotateY:function rotateY(angle){return _m1.makeRotationY(angle),this.applyMatrix4(_m1),this;},rotateZ:function rotateZ(angle){return _m1.makeRotationZ(angle),this.applyMatrix4(_m1),this;},translate:function translate(x,y,z){return _m1.makeTranslation(x,y,z),this.applyMatrix4(_m1),this;},scale:function scale(x,y,z){return _m1.makeScale(x,y,z),this.applyMatrix4(_m1),this;},lookAt:function lookAt(vector){return _obj.lookAt(vector),_obj.updateMatrix(),this.applyMatrix4(_obj.matrix),this;},fromBufferGeometry:function fromBufferGeometry(geometry){function addFace(a,b,c,materialIndex){var vertexColors=void 0===color?[]:[scope.colors[a].clone(),scope.colors[b].clone(),scope.colors[c].clone()],vertexNormals=void 0===normal?[]:[new three__WEBPACK_IMPORTED_MODULE_0__.Vector3().fromBufferAttribute(normal,a),new three__WEBPACK_IMPORTED_MODULE_0__.Vector3().fromBufferAttribute(normal,b),new three__WEBPACK_IMPORTED_MODULE_0__.Vector3().fromBufferAttribute(normal,c)],face=new Face3(a,b,c,vertexNormals,vertexColors,materialIndex);scope.faces.push(face),void 0!==uv&&scope.faceVertexUvs[0].push([new three__WEBPACK_IMPORTED_MODULE_0__.Vector2().fromBufferAttribute(uv,a),new three__WEBPACK_IMPORTED_MODULE_0__.Vector2().fromBufferAttribute(uv,b),new three__WEBPACK_IMPORTED_MODULE_0__.Vector2().fromBufferAttribute(uv,c)]),void 0!==uv2&&scope.faceVertexUvs[1].push([new three__WEBPACK_IMPORTED_MODULE_0__.Vector2().fromBufferAttribute(uv2,a),new three__WEBPACK_IMPORTED_MODULE_0__.Vector2().fromBufferAttribute(uv2,b),new three__WEBPACK_IMPORTED_MODULE_0__.Vector2().fromBufferAttribute(uv2,c)])}var scope=this,index=null===geometry.index?void 0:geometry.index,attributes=geometry.attributes;if(void 0===attributes.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var position=attributes.position,normal=attributes.normal,color=attributes.color,uv=attributes.uv,uv2=attributes.uv2;void 0!==uv2&&(this.faceVertexUvs[1]=[]);for(var i=0;i<position.count;i++)scope.vertices.push(new three__WEBPACK_IMPORTED_MODULE_0__.Vector3().fromBufferAttribute(position,i)),void 0!==color&&scope.colors.push(new three__WEBPACK_IMPORTED_MODULE_0__.Color().fromBufferAttribute(color,i));var groups=geometry.groups;if(0<groups.length)for(var _i2=0;_i2<groups.length;_i2++)for(var group=groups[_i2],start=group.start,count=group.count,j=start,jl=start+count;j<jl;j+=3)void 0===index?addFace(j,j+1,j+2,group.materialIndex):addFace(index.getX(j),index.getX(j+1),index.getX(j+2),group.materialIndex);else if(void 0!==index)for(var _i3=0;_i3<index.count;_i3+=3)addFace(index.getX(_i3),index.getX(_i3+1),index.getX(_i3+2));else for(var _i4=0;_i4<position.count;_i4+=3)addFace(_i4,_i4+1,_i4+2);return this.computeFaceNormals(),null!==geometry.boundingBox&&(this.boundingBox=geometry.boundingBox.clone()),null!==geometry.boundingSphere&&(this.boundingSphere=geometry.boundingSphere.clone()),this;},center:function center(){return this.computeBoundingBox(),this.boundingBox.getCenter(_offset).negate(),this.translate(_offset.x,_offset.y,_offset.z),this;},normalize:function normalize(){this.computeBoundingSphere();var center=this.boundingSphere.center,radius=this.boundingSphere.radius,s=0===radius?1:1/radius,matrix=new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4;return matrix.set(s,0,0,-s*center.x,0,s,0,-s*center.y,0,0,s,-s*center.z,0,0,0,1),this.applyMatrix4(matrix),this;},computeFaceNormals:function computeFaceNormals(){for(var cb=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,ab=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,f=0,fl=this.faces.length;f<fl;f++){var face=this.faces[f],vA=this.vertices[face.a],vB=this.vertices[face.b],vC=this.vertices[face.c];cb.subVectors(vC,vB),ab.subVectors(vA,vB),cb.cross(ab),cb.normalize(),face.normal.copy(cb)}},computeVertexNormals:function computeVertexNormals(){for(var areaWeighted=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],vertices=Array(this.vertices.length),v=0,vl=this.vertices.length;v<vl;v++)vertices[v]=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3;if(areaWeighted)// vertex normals weighted by triangle areas
161
- // http://www.iquilezles.org/www/articles/normals/normals.htm
162
- for(var cb=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,ab=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,f=0,fl=this.faces.length;f<fl;f++){var face=this.faces[f],vA=this.vertices[face.a],vB=this.vertices[face.b],vC=this.vertices[face.c];cb.subVectors(vC,vB),ab.subVectors(vA,vB),cb.cross(ab),vertices[face.a].add(cb),vertices[face.b].add(cb),vertices[face.c].add(cb)}else{this.computeFaceNormals();for(var _face,_f=0,_fl=this.faces.length;_f<_fl;_f++)_face=this.faces[_f],vertices[_face.a].add(_face.normal),vertices[_face.b].add(_face.normal),vertices[_face.c].add(_face.normal);}for(var _v=0,_vl=this.vertices.length;_v<_vl;_v++)vertices[_v].normalize();for(var _f2=0,_fl2=this.faces.length;_f2<_fl2;_f2++){var _face2=this.faces[_f2],vertexNormals=_face2.vertexNormals;3===vertexNormals.length?(vertexNormals[0].copy(vertices[_face2.a]),vertexNormals[1].copy(vertices[_face2.b]),vertexNormals[2].copy(vertices[_face2.c])):(vertexNormals[0]=vertices[_face2.a].clone(),vertexNormals[1]=vertices[_face2.b].clone(),vertexNormals[2]=vertices[_face2.c].clone())}return 0<this.faces.length&&(this.normalsNeedUpdate=!0),vertices;},computeFlatVertexNormals:function computeFlatVertexNormals(){this.computeFaceNormals();for(var f=0,fl=this.faces.length;f<fl;f++){var face=this.faces[f],vertexNormals=face.vertexNormals;3===vertexNormals.length?(vertexNormals[0].copy(face.normal),vertexNormals[1].copy(face.normal),vertexNormals[2].copy(face.normal)):(vertexNormals[0]=face.normal.clone(),vertexNormals[1]=face.normal.clone(),vertexNormals[2]=face.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function computeMorphNormals(){// save original normals
163
- // - create temp variables on first access
164
- // otherwise just copy (for faster repeated calls)
165
- for(var face,f=0,fl=this.faces.length;f<fl;f++){face=this.faces[f],face.__originalFaceNormal?face.__originalFaceNormal.copy(face.normal):face.__originalFaceNormal=face.normal.clone(),face.__originalVertexNormals||(face.__originalVertexNormals=[]);for(var i=0,il=face.vertexNormals.length;i<il;i++)face.__originalVertexNormals[i]?face.__originalVertexNormals[i].copy(face.vertexNormals[i]):face.__originalVertexNormals[i]=face.vertexNormals[i].clone();}// use temp geometry to compute face and vertex normals for each morph
166
- var tmpGeo=new Geometry;tmpGeo.faces=this.faces;for(var _i5=0,_il2=this.morphTargets.length;_i5<_il2;_i5++){// create on first access
167
- if(!this.morphNormals[_i5]){this.morphNormals[_i5]={},this.morphNormals[_i5].faceNormals=[],this.morphNormals[_i5].vertexNormals=[];for(var dstNormalsFace=this.morphNormals[_i5].faceNormals,dstNormalsVertex=this.morphNormals[_i5].vertexNormals,_f3=0,_fl3=this.faces.length;_f3<_fl3;_f3++){var faceNormal=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_vertexNormals={a:new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,b:new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,c:new three__WEBPACK_IMPORTED_MODULE_0__.Vector3};dstNormalsFace.push(faceNormal),dstNormalsVertex.push(_vertexNormals)}}var morphNormals=this.morphNormals[_i5];// set vertices to morph target
168
- tmpGeo.vertices=this.morphTargets[_i5].vertices,tmpGeo.computeFaceNormals();var vertexNormals=tmpGeo.computeVertexNormals();if(vertexNormals&&0<vertexNormals.length){this.morphTargets[_i5].normals=Array(this.vertices.length);for(var v=0;v<vertexNormals.length;v++)this.morphTargets[_i5].normals[v]=vertexNormals[v].clone();}// store morph normals
169
- for(var _f4=0,_fl4=this.faces.length;_f4<_fl4;_f4++){var _face3=this.faces[_f4],_faceNormal=morphNormals.faceNormals[_f4],_vertexNormals2=morphNormals.vertexNormals[_f4];_faceNormal.copy(_face3.normal),_vertexNormals2.a.copy(_face3.vertexNormals[0]),_vertexNormals2.b.copy(_face3.vertexNormals[1]),_vertexNormals2.c.copy(_face3.vertexNormals[2])}}// restore original normals
170
- for(var _face4,_f5=0,_fl5=this.faces.length;_f5<_fl5;_f5++)_face4=this.faces[_f5],_face4.normal=_face4.__originalFaceNormal,_face4.vertexNormals=_face4.__originalVertexNormals;this.morphNormalsReady=!0},computeBoundingBox:function computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new three__WEBPACK_IMPORTED_MODULE_0__.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new three__WEBPACK_IMPORTED_MODULE_0__.Sphere),this.boundingSphere.setFromPoints(this.vertices)},mergeMorph:function mergeMorph(geometry,matrix){var m=this.morphTargets.length,morphTargets1=this.morphTargets,morphTargets2=geometry.morphTargets,n=this.morphColors.length,morphColors1=this.morphColors,morphColors2=geometry.morphColors;if(0<m&&m==morphTargets2.length)for(var i=0,l=morphTargets1.length;i<l;i++){for(var morphTarget1=morphTargets1[i],morphTarget2=morphTargets2[i],k=0,kl=morphTarget2.vertices.length;k<kl;k++){var vertex=morphTarget2.vertices[k],vertexCopy=vertex.clone();void 0!==matrix&&vertexCopy.applyMatrix4(matrix),morphTarget1.vertices.push(vertexCopy)}if(morphTarget1.normals&&morphTarget2.normals)for(var _k=0;_k<morphTarget2.normals.length;_k+=3)_temp.set(morphTarget2.normals2[_k],morphTarget2.normals2[_k+1],morphTarget2.normals2[_k+2]),void 0!==matrix&&_temp.applyMatrix4(matrix),morphTarget1.normals.push(_temp.x,_temp.y,_temp.z);}if(0<n&&n==morphColors2.length)for(var _i6=0,_l=morphColors1.length;_i6<_l;_i6++)for(var morphColor1=morphColors1[_i6],morphColor2=morphColors2[_i6],_k2=0,_kl=morphColor2.colors;_k2<_kl;_k2++)morphColor1.colors.push(morphColor2.colors[_k2].clone());},merge:function merge(geometry,matrix){var materialIndexOffset=2<arguments.length&&arguments[2]!==void 0?arguments[2]:0;if(!(geometry&&geometry.isGeometry))return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",geometry);var normalMatrix,vertexOffset=this.vertices.length,vertices1=this.vertices,vertices2=geometry.vertices,normals2=geometry.normals,faces1=this.faces,faces2=geometry.faces,colors1=this.colors,colors2=geometry.colors;matrix!==void 0&&(normalMatrix=new three__WEBPACK_IMPORTED_MODULE_0__.Matrix3().getNormalMatrix(matrix));// vertices
171
- for(var i=0,il=vertices2.length;i<il;i++){var vertex=vertices2[i],vertexCopy=vertex.clone();matrix!==void 0&&vertexCopy.applyMatrix4(matrix),vertices1.push(vertexCopy)}for(var _i7=0;_i7<normals2.length;_i7+=3)_temp.set(normals2[_i7],normals2[_i7+1],normals2[_i7+2]),void 0!==matrix&&_temp.applyMatrix4(matrix),this.normals.push(_temp.x,_temp.y,_temp.z);// colors
172
- for(var _i8=0,_il3=colors2.length;_i8<_il3;_i8++)"number"==typeof colors2[_i8]?colors1.push(colors2[_i8]):colors1.push(colors2[_i8].clone());// faces
173
- for(var _i9=0,_il4=faces2.length;_i9<_il4;_i9++){var face=faces2[_i9],normal=void 0,color=void 0,faceVertexNormals=face.vertexNormals,faceVertexColors=face.vertexColors,faceCopy=new Face3(face.a+vertexOffset,face.b+vertexOffset,face.c+vertexOffset);faceCopy.normal.copy(face.normal),normalMatrix!==void 0&&faceCopy.normal.applyMatrix3(normalMatrix).normalize();for(var j=0,jl=faceVertexNormals.length;j<jl;j++)normal=faceVertexNormals[j].clone(),void 0!==normalMatrix&&normal.applyMatrix3(normalMatrix).normalize(),faceCopy.vertexNormals.push(normal);faceCopy.color.copy(face.color);for(var _j=0,_jl=faceVertexColors.length;_j<_jl;_j++)color=faceVertexColors[_j],faceCopy.vertexColors.push(color.clone());faceCopy.materialIndex=face.materialIndex+materialIndexOffset,faces1.push(faceCopy)}// uvs
174
- for(var faceVertexUvs2,_i0=0,_il5=geometry.faceVertexUvs.length;_i0<_il5;_i0++){faceVertexUvs2=geometry.faceVertexUvs[_i0],this.faceVertexUvs[_i0]===void 0&&(this.faceVertexUvs[_i0]=[]);for(var _j2=0,_jl2=faceVertexUvs2.length;_j2<_jl2;_j2++){for(var uvs2=faceVertexUvs2[_j2],uvsCopy=[],k=0,kl=uvs2.length;k<kl;k++)uvsCopy.push(uvs2[k].clone());this.faceVertexUvs[_i0].push(uvsCopy)}}this.mergeMorph(geometry,matrix)},mergeMesh:function mergeMesh(mesh){return mesh&&mesh.isMesh?void(mesh.matrixAutoUpdate&&mesh.updateMatrix(),this.merge(mesh.geometry,mesh.matrix)):void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",mesh)},/*
175
- * Checks for duplicate vertices with hashmap.
176
- * Duplicated vertices are removed
177
- * and faces' vertices are updated.
178
- */mergeVertices:function mergeVertices(){// Hashmap for looking up vertices by position coordinates (and making sure they are unique)
179
- for(var precisionPoints=0<arguments.length&&void 0!==arguments[0]?arguments[0]:4,verticesMap={},unique=[],changes=[],precision=Math.pow(10,precisionPoints),i=0,il=this.vertices.length;i<il;i++){var v=this.vertices[i],key=Math.round(v.x*precision)+"_"+Math.round(v.y*precision)+"_"+Math.round(v.z*precision);void 0===verticesMap[key]?(verticesMap[key]=i,unique.push(this.vertices[i]),changes[i]=unique.length-1):changes[i]=changes[verticesMap[key]]}// if faces are completely degenerate after merging vertices, we
180
- // have to remove them from the geometry.
181
- for(var face,faceIndicesToRemove=[],_i1=0,_il6=this.faces.length;_i1<_il6;_i1++){face=this.faces[_i1],face.a=changes[face.a],face.b=changes[face.b],face.c=changes[face.c];// if any duplicate vertices are found in a Face3
182
- // we have to remove the face as nothing can be saved
183
- for(var indices=[face.a,face.b,face.c],n=0;3>n;n++)if(indices[n]===indices[(n+1)%3]){faceIndicesToRemove.push(_i1);break;}}for(var idx,_i10=faceIndicesToRemove.length-1;0<=_i10;_i10--){idx=faceIndicesToRemove[_i10],this.faces.splice(idx,1);for(var j=0,jl=this.faceVertexUvs.length;j<jl;j++)this.faceVertexUvs[j].splice(idx,1);}// Use unique set of vertices
184
- var diff=this.vertices.length-unique.length;return this.vertices=unique,diff;},setFromPoints:function setFromPoints(points){this.vertices=[];for(var point,i=0,l=points.length;i<l;i++)point=points[i],this.vertices.push(new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(point.x,point.y,point.z||0));return this;},sortFacesByMaterialIndex:function sortFacesByMaterialIndex(){// sort faces
185
- // tag faces
186
- for(var faces=this.faces,length=faces.length,i=0;i<length;i++)faces[i]._id=i;faces.sort(function(a,b){return a.materialIndex-b.materialIndex;});// sort uvs
187
- var newUvs1,newUvs2,uvs1=this.faceVertexUvs[0],uvs2=this.faceVertexUvs[1];uvs1&&uvs1.length===length&&(newUvs1=[]),uvs2&&uvs2.length===length&&(newUvs2=[]);for(var id,_i11=0;_i11<length;_i11++)id=faces[_i11]._id,newUvs1&&newUvs1.push(uvs1[id]),newUvs2&&newUvs2.push(uvs2[id]);newUvs1&&(this.faceVertexUvs[0]=newUvs1),newUvs2&&(this.faceVertexUvs[1]=newUvs2)},toJSON:function toJSON(){function setBit(value,position,enabled){return enabled?value|1<<position:value&~(1<<position);}function getNormalIndex(normal){var hash=normal.x.toString()+normal.y.toString()+normal.z.toString();return void 0===normalsHash[hash]?(normalsHash[hash]=normals.length/3,normals.push(normal.x,normal.y,normal.z),normalsHash[hash]):normalsHash[hash]}function getColorIndex(color){var hash=color.r.toString()+color.g.toString()+color.b.toString();return void 0===colorsHash[hash]?(colorsHash[hash]=colors.length,colors.push(color.getHex()),colorsHash[hash]):colorsHash[hash]}function getUvIndex(uv){var hash=uv.x.toString()+uv.y.toString();return void 0===uvsHash[hash]?(uvsHash[hash]=uvs.length/2,uvs.push(uv.x,uv.y),uvsHash[hash]):uvsHash[hash]}var data={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};// standard Geometry serialization
188
- if(data.uuid=this.uuid,data.type=this.type,""!==this.name&&(data.name=this.name),void 0!==this.parameters){var parameters=this.parameters;for(var key in parameters)void 0!==parameters[key]&&(data[key]=parameters[key]);return data;}for(var vertex,vertices=[],i=0;i<this.vertices.length;i++)vertex=this.vertices[i],vertices.push(vertex.x,vertex.y,vertex.z);for(var faces=[],normals=[],normalsHash={},colors=[],colorsHash={},uvs=[],uvsHash={},_i12=0;_i12<this.faces.length;_i12++){var face=this.faces[_i12],hasMaterial=!0,hasFaceUv=!1,hasFaceVertexUv=void 0!==this.faceVertexUvs[0][_i12],hasFaceNormal=0<face.normal.length(),hasFaceVertexNormal=0<face.vertexNormals.length,hasFaceColor=1!==face.color.r||1!==face.color.g||1!==face.color.b,hasFaceVertexColor=0<face.vertexColors.length,faceType=0;// deprecated
189
- if(faceType=setBit(faceType,0,0),faceType=setBit(faceType,1,hasMaterial),faceType=setBit(faceType,2,hasFaceUv),faceType=setBit(faceType,3,hasFaceVertexUv),faceType=setBit(faceType,4,hasFaceNormal),faceType=setBit(faceType,5,hasFaceVertexNormal),faceType=setBit(faceType,6,hasFaceColor),faceType=setBit(faceType,7,hasFaceVertexColor),faces.push(faceType),faces.push(face.a,face.b,face.c),faces.push(face.materialIndex),hasFaceVertexUv){var faceVertexUvs=this.faceVertexUvs[0][_i12];faces.push(getUvIndex(faceVertexUvs[0]),getUvIndex(faceVertexUvs[1]),getUvIndex(faceVertexUvs[2]))}if(hasFaceNormal&&faces.push(getNormalIndex(face.normal)),hasFaceVertexNormal){var vertexNormals=face.vertexNormals;faces.push(getNormalIndex(vertexNormals[0]),getNormalIndex(vertexNormals[1]),getNormalIndex(vertexNormals[2]))}if(hasFaceColor&&faces.push(getColorIndex(face.color)),hasFaceVertexColor){var vertexColors=face.vertexColors;faces.push(getColorIndex(vertexColors[0]),getColorIndex(vertexColors[1]),getColorIndex(vertexColors[2]))}}return data.data={},data.data.vertices=vertices,data.data.normals=normals,0<colors.length&&(data.data.colors=colors),0<uvs.length&&(data.data.uvs=[uvs]),data.data.faces=faces,data;},clone:function clone(){/*
190
- // Handle primitives
191
-
192
- const parameters = this.parameters;
193
-
194
- if ( parameters !== undefined ) {
195
-
196
- const values = [];
197
-
198
- for ( const key in parameters ) {
199
-
200
- values.push( parameters[ key ] );
201
-
202
- }
203
-
204
- const geometry = Object.create( this.constructor.prototype );
205
- this.constructor.apply( geometry, values );
206
- return geometry;
207
-
208
- }
209
-
210
- return new this.constructor().copy( this );
211
- */return new Geometry().copy(this);},copy:function copy(source){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=source.name;for(var vertices=source.vertices,i=0,il=vertices.length;i<il;i++)this.vertices.push(vertices[i].clone());// colors
212
- for(var colors=source.colors,_i13=0,_il7=colors.length;_i13<_il7;_i13++)this.colors.push(colors[_i13].clone());// faces
213
- for(var faces=source.faces,_i14=0,_il8=faces.length;_i14<_il8;_i14++)this.faces.push(faces[_i14].clone());// face vertex uvs
214
- for(var faceVertexUvs,_i15=0,_il9=source.faceVertexUvs.length;_i15<_il9;_i15++){faceVertexUvs=source.faceVertexUvs[_i15],void 0===this.faceVertexUvs[_i15]&&(this.faceVertexUvs[_i15]=[]);for(var j=0,jl=faceVertexUvs.length;j<jl;j++){for(var uv,uvs=faceVertexUvs[j],uvsCopy=[],k=0,kl=uvs.length;k<kl;k++)uv=uvs[k],uvsCopy.push(uv.clone());this.faceVertexUvs[_i15].push(uvsCopy)}}// morph targets
215
- for(var morphTarget,morphTargets=source.morphTargets,_i16=0,_il0=morphTargets.length;_i16<_il0;_i16++){// vertices
216
- if(morphTarget={},morphTarget.name=morphTargets[_i16].name,void 0!==morphTargets[_i16].vertices){morphTarget.vertices=[];for(var _j3=0,_jl3=morphTargets[_i16].vertices.length;_j3<_jl3;_j3++)morphTarget.vertices.push(morphTargets[_i16].vertices[_j3].clone());}// normals
217
- if(void 0!==morphTargets[_i16].normals){morphTarget.normals=[];for(var _j4=0,_jl4=morphTargets[_i16].normals.length;_j4<_jl4;_j4++)morphTarget.normals.push(morphTargets[_i16].normals[_j4].clone());}this.morphTargets.push(morphTarget)}// morph normals
218
- for(var morphNormal,morphNormals=source.morphNormals,_i17=0,_il1=morphNormals.length;_i17<_il1;_i17++){// vertex normals
219
- if(morphNormal={},void 0!==morphNormals[_i17].vertexNormals){morphNormal.vertexNormals=[];for(var _j5=0,_jl5=morphNormals[_i17].vertexNormals.length;_j5<_jl5;_j5++){var srcVertexNormal=morphNormals[_i17].vertexNormals[_j5],destVertexNormal={};destVertexNormal.a=srcVertexNormal.a.clone(),destVertexNormal.b=srcVertexNormal.b.clone(),destVertexNormal.c=srcVertexNormal.c.clone(),morphNormal.vertexNormals.push(destVertexNormal)}}// face normals
220
- if(void 0!==morphNormals[_i17].faceNormals){morphNormal.faceNormals=[];for(var _j6=0,_jl6=morphNormals[_i17].faceNormals.length;_j6<_jl6;_j6++)morphNormal.faceNormals.push(morphNormals[_i17].faceNormals[_j6].clone());}this.morphNormals.push(morphNormal)}// skin weights
221
- for(var skinWeights=source.skinWeights,_i18=0,_il10=skinWeights.length;_i18<_il10;_i18++)this.skinWeights.push(skinWeights[_i18].clone());// skin indices
222
- for(var skinIndices=source.skinIndices,_i19=0,_il11=skinIndices.length;_i19<_il11;_i19++)this.skinIndices.push(skinIndices[_i19].clone());// line distances
223
- for(var lineDistances=source.lineDistances,_i20=0,_il12=lineDistances.length;_i20<_il12;_i20++)this.lineDistances.push(lineDistances[_i20]);// bounding box
224
- var boundingBox=source.boundingBox;null!==boundingBox&&(this.boundingBox=boundingBox.clone());// bounding sphere
225
- var boundingSphere=source.boundingSphere;return null!==boundingSphere&&(this.boundingSphere=boundingSphere.clone()),this.elementsNeedUpdate=source.elementsNeedUpdate,this.verticesNeedUpdate=source.verticesNeedUpdate,this.uvsNeedUpdate=source.uvsNeedUpdate,this.normalsNeedUpdate=source.normalsNeedUpdate,this.colorsNeedUpdate=source.colorsNeedUpdate,this.lineDistancesNeedUpdate=source.lineDistancesNeedUpdate,this.groupsNeedUpdate=source.groupsNeedUpdate,this;},computeGroups(){var group,i,groups=[],materialIndex=void 0,faces=this.faces;for(i=0;i<faces.length;i++){var face=faces[i];// materials
226
- face.materialIndex!==materialIndex&&(materialIndex=face.materialIndex,void 0!==group&&(group.count=3*i-group.start,groups.push(group)),group={start:3*i,materialIndex:materialIndex})}return void 0!==group&&(group.count=3*i-group.start,groups.push(group)),groups;},toBufferGeometry:function toBufferGeometry(){var geometry=new DirectGeometry().fromGeometry(this),buffergeometry=new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry,positions=new Float32Array(3*geometry.vertices.length);if(buffergeometry.setAttribute("position",new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(positions,3).copyVector3sArray(geometry.vertices)),0<geometry.normals.length){var normals=new Float32Array(3*geometry.normals.length);buffergeometry.setAttribute("normal",new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(normals,3).copyVector3sArray(geometry.normals))}if(0<geometry.colors.length){var colors=new Float32Array(3*geometry.colors.length);buffergeometry.setAttribute("color",new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(colors,3).copyColorsArray(geometry.colors))}if(0<geometry.uvs.length){var uvs=new Float32Array(2*geometry.uvs.length);buffergeometry.setAttribute("uv",new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(uvs,2).copyVector2sArray(geometry.uvs))}if(0<geometry.uvs2.length){var uvs2=new Float32Array(2*geometry.uvs2.length);buffergeometry.setAttribute("uv2",new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(uvs2,2).copyVector2sArray(geometry.uvs2))}// groups
227
- // morphs
228
- for(var name in buffergeometry.groups=geometry.groups,geometry.morphTargets){for(var array=[],morphTargets=geometry.morphTargets[name],i=0,l=morphTargets.length;i<l;i++){var morphTarget=morphTargets[i],attribute=new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(3*morphTarget.data.length,3);attribute.name=morphTarget.name,array.push(attribute.copyVector3sArray(morphTarget.data))}buffergeometry.morphAttributes[name]=array}// skinning
229
- if(0<geometry.skinIndices.length){var skinIndices=new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(4*geometry.skinIndices.length,4);buffergeometry.setAttribute("skinIndex",skinIndices.copyVector4sArray(geometry.skinIndices))}if(0<geometry.skinWeights.length){var skinWeights=new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(4*geometry.skinWeights.length,4);buffergeometry.setAttribute("skinWeight",skinWeights.copyVector4sArray(geometry.skinWeights))}//
230
- return null!==geometry.boundingSphere&&(buffergeometry.boundingSphere=geometry.boundingSphere.clone()),null!==geometry.boundingBox&&(buffergeometry.boundingBox=geometry.boundingBox.clone()),buffergeometry;},toIndexedBufferGeometry:function toIndexedBufferGeometry(){//const geometry = new DirectGeometry().fromGeometry( this );
231
- var buffergeometry=new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry,positions=new Float32Array(3*this.vertices.length);if(buffergeometry.setAttribute("position",new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(positions,3).copyVector3sArray(this.vertices)),0<this.normals.length){var normals=new Float32Array(this.normals.length),buffer=new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(normals,3).copyArray(this.normals);buffergeometry.setAttribute("normal",buffer)}if(0<this.uvs.length&&0<this.uvs[0].length){var uvs=new Float32Array(2*this.uvs[0].length);buffergeometry.setAttribute("uv",new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(uvs,2).copyArray(this.uvs[0]))}if(1<this.uvs.length&&0<this.uvs[1].length){var uvs2=new Float32Array(2*this.uvs[1].length);buffergeometry.setAttribute("uv2",new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(uvs2,2).copyArray(this.uvs[1]))}if(0<this.colors.length){for(var colorArray=[],i=0;i<this.colors.length;i++)colorArray.push(new three__WEBPACK_IMPORTED_MODULE_0__.Color(this.colors[i]));var colors=new Float32Array(3*colorArray.length);buffergeometry.setAttribute("color",new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(colors,3).copyColorsArray(colorArray))}else{for(var colorsArray=new Float32Array(3*this.vertices.length),_i21=0;_i21<3*this.vertices.length;_i21++)colorsArray[_i21]=1;buffergeometry.setAttribute("color",new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(colorsArray,3))}if(0<this.faces.length){for(var _colors=[],indices=[],_i22=0;_i22<this.faces.length;_i22++){indices.push(this.faces[_i22].a,this.faces[_i22].b,this.faces[_i22].c);var vertexColors=this.faces[_i22].vertexColors;if(3===vertexColors.length)_colors.push(vertexColors[0],vertexColors[1],vertexColors[2]);else{var color=this.faces[_i22].color;_colors.push(color,color,color)}}// if ( colors.length > 0 ) {
232
- // const colorsArray = new Float32Array( colors.length * 3 );
233
- // buffergeometry.setAttribute( 'color', new BufferAttribute( colorsArray, 3 ).copyColorsArray( colors ) );
234
- // }
235
- buffergeometry.setIndex(indices),buffergeometry.groups=this.computeGroups()}// morphs
236
- if(0<this.morphTargets.length){for(var array=[],normalsArray=[],_i23=0,l=this.morphTargets.length;_i23<l;_i23++){var morphTarget=this.morphTargets[_i23],attribute=new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(3*morphTarget.vertices.length,3);if(attribute.name=morphTarget.name,array.push(attribute.copyVector3sArray(morphTarget.vertices)),morphTarget.normals){var _attribute=new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(3*morphTarget.normals.length,3);_attribute.name=morphTarget.name,normalsArray.push(_attribute.copyVector3sArray(morphTarget.normals))}}buffergeometry.morphAttributes.position=array,buffergeometry.morphAttributes.normal=normalsArray}// skinning
237
- if(0<this.skinIndices.length){var skinIndices=new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(4*this.skinIndices.length,4);buffergeometry.setAttribute("skinIndex",skinIndices.copyVector4sArray(this.skinIndices))}if(0<this.skinWeights.length){var skinWeights=new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(4*this.skinWeights.length,4);buffergeometry.setAttribute("skinWeight",skinWeights.copyVector4sArray(this.skinWeights))}//
238
- return null!==this.boundingSphere&&(buffergeometry.boundingSphere=this.boundingSphere.clone()),null!==this.boundingBox&&(buffergeometry.boundingBox=this.boundingBox.clone()),buffergeometry;},computeTangents:function computeTangents(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function computeLineDistances(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function applyMatrix(matrix){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(matrix);},dispose:function dispose(){this.dispatchEvent({type:"dispose"})}}),Geometry.createBufferGeometryFromObject=function(object){var buffergeometry=new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry,geometry=object.geometry;if(object.isPoints||object.isLine){var positions=new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(3*geometry.vertices.length,3),colors=new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(3*geometry.colors.length,3);if(buffergeometry.setAttribute("position",positions.copyVector3sArray(geometry.vertices)),buffergeometry.setAttribute("color",colors.copyColorsArray(geometry.colors)),geometry.lineDistances&&geometry.lineDistances.length===geometry.vertices.length){var lineDistances=new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(geometry.lineDistances.length,1);buffergeometry.setAttribute("lineDistance",lineDistances.copyArray(geometry.lineDistances))}null!==geometry.boundingSphere&&(buffergeometry.boundingSphere=geometry.boundingSphere.clone()),null!==geometry.boundingBox&&(buffergeometry.boundingBox=geometry.boundingBox.clone())}else object.isMesh&&(buffergeometry=geometry.toBufferGeometry());return buffergeometry;};class DirectGeometry{constructor(){// this.lineDistances = [];
239
- // update flags
240
- this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(geometry){var group,i,groups=[],materialIndex=void 0,faces=geometry.faces;for(i=0;i<faces.length;i++){var face=faces[i];// materials
241
- face.materialIndex!==materialIndex&&(materialIndex=face.materialIndex,group!==void 0&&(group.count=3*i-group.start,groups.push(group)),group={start:3*i,materialIndex:materialIndex})}group!==void 0&&(group.count=3*i-group.start,groups.push(group)),this.groups=groups}fromGeometry(geometry){var morphTargetsPosition,faces=geometry.faces,vertices=geometry.vertices,faceVertexUvs=geometry.faceVertexUvs,hasFaceVertexUv=faceVertexUvs[0]&&0<faceVertexUvs[0].length,hasFaceVertexUv2=faceVertexUvs[1]&&0<faceVertexUvs[1].length,morphTargets=geometry.morphTargets,morphTargetsLength=morphTargets.length;// morphs
242
- if(0<morphTargetsLength){morphTargetsPosition=[];for(var i=0;i<morphTargetsLength;i++)morphTargetsPosition[i]={name:morphTargets[i].name,data:[]};this.morphTargets.position=morphTargetsPosition}var morphTargetsNormal,morphNormals=geometry.morphNormals,morphNormalsLength=morphNormals.length;if(0<morphNormalsLength){morphTargetsNormal=[];for(var _i24=0;_i24<morphNormalsLength;_i24++)morphTargetsNormal[_i24]={name:morphNormals[_i24].name,data:[]};this.morphTargets.normal=morphTargetsNormal}// skins
243
- var skinIndices=geometry.skinIndices,skinWeights=geometry.skinWeights,hasSkinIndices=skinIndices.length===vertices.length,hasSkinWeights=skinWeights.length===vertices.length;0<vertices.length&&0===faces.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(var face,_i25=0;_i25<faces.length;_i25++){face=faces[_i25],this.vertices.push(vertices[face.a],vertices[face.b],vertices[face.c]);var vertexNormals=face.vertexNormals;if(3===vertexNormals.length)this.normals.push(vertexNormals[0],vertexNormals[1],vertexNormals[2]);else{var normal=face.normal;this.normals.push(normal,normal,normal)}var vertexColors=face.vertexColors;if(3===vertexColors.length)this.colors.push(vertexColors[0],vertexColors[1],vertexColors[2]);else{var color=face.color;this.colors.push(color,color,color)}if(!0===hasFaceVertexUv){var vertexUvs=faceVertexUvs[0][_i25];void 0===vertexUvs?(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",_i25),this.uvs.push(new three__WEBPACK_IMPORTED_MODULE_0__.Vector2,new three__WEBPACK_IMPORTED_MODULE_0__.Vector2,new three__WEBPACK_IMPORTED_MODULE_0__.Vector2)):this.uvs.push(vertexUvs[0],vertexUvs[1],vertexUvs[2])}if(!0===hasFaceVertexUv2){var _vertexUvs=faceVertexUvs[1][_i25];void 0===_vertexUvs?(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",_i25),this.uvs2.push(new three__WEBPACK_IMPORTED_MODULE_0__.Vector2,new three__WEBPACK_IMPORTED_MODULE_0__.Vector2,new three__WEBPACK_IMPORTED_MODULE_0__.Vector2)):this.uvs2.push(_vertexUvs[0],_vertexUvs[1],_vertexUvs[2])}// morphs
244
- for(var morphTarget,j=0;j<morphTargetsLength;j++)morphTarget=morphTargets[j].vertices,morphTargetsPosition[j].data.push(morphTarget[face.a],morphTarget[face.b],morphTarget[face.c]);for(var morphNormal,_j7=0;_j7<morphNormalsLength;_j7++)morphNormal=morphNormals[_j7].vertexNormals[_i25],morphTargetsNormal[_j7].data.push(morphNormal.a,morphNormal.b,morphNormal.c);// skins
245
- hasSkinIndices&&this.skinIndices.push(skinIndices[face.a],skinIndices[face.b],skinIndices[face.c]),hasSkinWeights&&this.skinWeights.push(skinWeights[face.a],skinWeights[face.b],skinWeights[face.c])}return this.computeGroups(geometry),this.verticesNeedUpdate=geometry.verticesNeedUpdate,this.normalsNeedUpdate=geometry.normalsNeedUpdate,this.colorsNeedUpdate=geometry.colorsNeedUpdate,this.uvsNeedUpdate=geometry.uvsNeedUpdate,this.groupsNeedUpdate=geometry.groupsNeedUpdate,null!==geometry.boundingSphere&&(this.boundingSphere=geometry.boundingSphere.clone()),null!==geometry.boundingBox&&(this.boundingBox=geometry.boundingBox.clone()),this;}}class Face3{constructor(a,b,c,normal,color){var materialIndex=5<arguments.length&&arguments[5]!==void 0?arguments[5]:0;this.a=a,this.b=b,this.c=c,this.normal=normal&&normal.isVector3?normal:new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,this.vertexNormals=Array.isArray(normal)?normal:[],this.color=color&&color.isColor?color:new three__WEBPACK_IMPORTED_MODULE_0__.Color,this.vertexColors=Array.isArray(color)?color:[],this.materialIndex=materialIndex}clone(){return new this.constructor().copy(this);}copy(source){this.a=source.a,this.b=source.b,this.c=source.c,this.normal.copy(source.normal),this.color.copy(source.color),this.materialIndex=source.materialIndex;for(var i=0,il=source.vertexNormals.length;i<il;i++)this.vertexNormals[i]=source.vertexNormals[i].clone();for(var _i26=0,_il13=source.vertexColors.length;_i26<_il13;_i26++)this.vertexColors[_i26]=source.vertexColors[_i26].clone();return this;}}
246
-
247
- /***/ }),
248
- /* 7 */
249
- /***/ ((module) => {
250
-
251
- "use strict";
252
- module.exports = require("three-spritetext");
253
-
254
- /***/ }),
255
- /* 8 */
256
- /***/ ((module) => {
257
-
258
- module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg=="
259
-
260
- /***/ }),
261
- /* 9 */
262
- /***/ ((__unused_webpack_module, exports) => {
263
-
264
- /**
265
- * Provide additional shaders to render time dependent color.
266
- */exports.augmentMorphColor=function(){return function(shader){shader.vertexShader=shader.vertexShader.replace("#include <color_pars_vertex>",["varying vec3 vColor;","attribute vec3 morphColor0;","attribute vec3 morphColor1;"].join("\n")),shader.vertexShader=shader.vertexShader.replace("#include <color_vertex>",["vColor.xyz = color.xyz;","#ifdef USE_MORPHTARGETS","vColor = morphColor0 * morphTargetInfluences[ 0 ];","vColor += morphColor1 * morphTargetInfluences[ 1 ];","#endif"].join("\n"))};};
267
-
268
- /***/ }),
269
- /* 10 */
270
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
271
-
272
- var THREE=__webpack_require__(4),createBufferGeometry=(__webpack_require__(5).createBufferGeometry),removeVertexAtIndex=(__webpack_require__(5).removeVertexAtIndex),resolveURL=(__webpack_require__(5).resolveURL),uniqueiId=0,getUniqueId=function(){return"pr"+uniqueiId++;},ZincObject=function(){// THREE.Mesh
273
- /**
274
- * Groupname given to this geometry.
275
- *//**
276
- * Total duration of the animation, this value interacts with the
277
- * {@link Renderer#playRate} to produce the actual duration of the
278
- * animation. Actual time in second = duration / playRate.
279
- *///Draw range is only used by primitives added
280
- //programatically with addVertices function
281
- //Default value of colour
282
- this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE.Group,this._lod=new((__webpack_require__(11).LOD))(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.videoHandler=void 0,this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new THREE.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode="inherited",this.uuid=getUniqueId(),this._v1=new THREE.Vector3,this._v2=new THREE.Vector3,this._b1=new THREE.Box3,this.center=new THREE.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1,this.isPickable=!0};/**
283
- * Provides the base object for other primitive types.
284
- * This class contains multiple base methods.
285
- *
286
- * @class
287
- * @author Alan Wu
288
- * @return {ZincObject}
289
- *//**
290
- * Set the duration of the animation of this object.
291
- *
292
- * @param {Number} durationIn - Duration of the animation.
293
- *//**
294
- * Get the duration of the animation of this object.
295
- *
296
- * @return {Number}
297
- *//**
298
- * Set the region this object belongs to.
299
- *
300
- * @param {Region} region
301
- *//**
302
- * Get the region this object belongs to.
303
- *
304
- * @return {Region}
305
- *//**
306
- * Get the threejs object3D.
307
- *
308
- * @return {Object}
309
- *//**
310
- * Get the threejs object3D.
311
- *
312
- * @return {Object}
313
- *//**
314
- * Set the internal threejs object3D.
315
- *//**
316
- * Handle transparent mesh, create a clone for backside rendering if it is
317
- * transparent.
318
- *//**
319
- * Set the mesh function for zincObject.
320
- *
321
- * @param {THREE.Mesh} mesh - Mesh to be set for this zinc object.
322
- * @param {Boolean} localTimeEnabled - A flag to indicate either the mesh is
323
- * time dependent.
324
- * @param {Boolean} localMorphColour - A flag to indicate either the colour is
325
- * time dependent.
326
- *//**
327
- * Set isPickable for this ZincObject.
328
- *
329
- * @param {String} isPickable - Boolean to enable object pick.
330
- *//**
331
- * Set the anatomicalId for this ZincObject.
332
- *
333
- * @param {String} anatomicalId - Id to be set.
334
- *//**
335
- * Set the name for this ZincObject.
336
- *
337
- * @param {String} groupNameIn - Name to be set.
338
- *//**
339
- * Get the local time of this geometry, it returns a value between
340
- * 0 and the duration.
341
- *
342
- * @return {Number}
343
- *//**
344
- * Set the local time of this geometry.
345
- *
346
- * @param {Number} time - Can be any value between 0 to duration.
347
- *//**
348
- * Check if the geometry is time varying.
349
- *
350
- * @return {Boolean}
351
- *//**
352
- * Get the visibility of this Geometry.
353
- *
354
- *//**
355
- * Set the visibility of this Geometry.
356
- *
357
- * @param {Boolean} visible - a boolean flag indicate the visibility to be set
358
- *//**
359
- * Set the opacity of this Geometry. This function will also set the isTransparent
360
- * flag according to the provided alpha value.
361
- *
362
- * @param {Number} alpah - Alpha value to set for this geometry,
363
- * can be any value between from 0 to 1.0.
364
- *//**
365
- * The rendering will be culled if it is outside of the frustrum
366
- * when this flag is set to true, it should be set to false if
367
- * morphing is enabled.
368
- *
369
- * @param {Boolean} flag - Set frustrum culling on/off based on this flag.
370
- *//**
371
- * Set rather a zinc object should be displayed using per vertex colour or
372
- * not.
373
- *
374
- * @param {Boolean} vertexColors - Set display with vertex color on/off.
375
- *//**
376
- * Get the colour of the mesh.
377
- *
378
- * @return {THREE.Color}
379
- *//**
380
- * Set the colour of the mesh.
381
- *
382
- * @param {THREE.Color} colour - Colour to be set for this geometry.
383
- *//**
384
- * Set the colour of the mesh.
385
- *
386
- * @param {THREE.Color} colour - Colour to be set for this geometry.
387
- *//**
388
- * Get the colour of the mesh in hex string form.
389
- *
390
- * @return {String}
391
- *//**
392
- * Set the colour of the mesh using hex in string form.
393
- *
394
- * @param {String} hex - The colour value in hex form.
395
- *//**
396
- * Set the emissive rgb of the mesh using rgb.
397
- *
398
- * @param {String} colour - The colour value in rgb form.
399
- *//**
400
- * Set the material of the geometry.
401
- *
402
- * @param {THREE.Material} material - Material to be set for this geometry.
403
- *//**
404
- * Get the index of the closest vertex to centroid.
405
- *
406
- * @return {Number} - integer index in the array
407
- *//**
408
- * Get the closest vertex to centroid.
409
- *
410
- * @return {THREE.Vector3}
411
- *//**
412
- * Get the bounding box of this geometry.
413
- *
414
- * @return {THREE.Box3}.
415
- *//**
416
- * Clear this geometry and free the memory.
417
- *//**
418
- * Check if marker is enabled based on the objects settings with
419
- * the provided scene options.
420
- *
421
- * @return {Boolean}
422
- *//**
423
- * Update the marker's position and size based on current viewport.
424
- *//**
425
- * Get the windows coordinates.
426
- *
427
- * @return {Object} - position and rather the closest vertex is on screen.
428
- *//**
429
- * Set marker mode for this zinc object which determine rather the
430
- * markers should be displayed or not.
431
- *
432
- * @param {string} mode - There are three options:
433
- * "on" - marker is enabled regardless of settings of scene
434
- * "off" - marker is disabled regardless of settings of scene
435
- * "inherited" - Marker settings on scene will determine the visibility
436
- * of the marker.
437
- *
438
- * @return {Boolean}
439
- *///Update the geometry and colours depending on the morph.
440
- /**
441
- * Add lod from an url into the lod object.
442
- *//**
443
- * Add lod from an url into the lod object.
444
- *//**
445
- * Add lod from an url into the lod object.
446
- *//**
447
- * Set the objects position.
448
- *//**
449
- * Set the objects scale.
450
- */ZincObject.prototype.setDuration=function(durationIn){this.duration=durationIn,this.clipAction&&this.clipAction.setDuration(this.duration)},ZincObject.prototype.getDuration=function(){return this.duration;},ZincObject.prototype.setRegion=function(region){this.region=region},ZincObject.prototype.getRegion=function(){return this.region;},ZincObject.prototype.getMorph=function(){var morph=this._lod.getCurrentMorph();return morph?morph:this.morph;},ZincObject.prototype.getGroup=function(){return this.group;},ZincObject.prototype.setMorph=function(mesh){this.morph=mesh,this.group.add(this.morph);//this is the base level object
451
- var distance=this._lod.calculateDistance("far");this._lod.addLevel(mesh,distance),this._lod.setMaterial(mesh.material)},ZincObject.prototype.checkTransparentMesh=function(){},ZincObject.prototype.setMesh=function(mesh,localTimeEnabled,localMorphColour){this.animationGroup=new THREE.AnimationObjectGroup(mesh),this.mixer=new THREE.AnimationMixer(this.animationGroup);var geometry=mesh.geometry;if(this.geometry=mesh.geometry,this.clipAction=void 0,geometry&&geometry.morphAttributes){var morphAttribute=geometry.morphAttributes.position;morphAttribute||(morphAttribute=geometry.morphAttributes.color?geometry.morphAttributes.color:geometry.morphAttributes.normal),morphAttribute&&(this.animationClip=THREE.AnimationClip.CreateClipsFromMorphTargetSequences(morphAttribute,10,!0),this.animationClip&&null!=this.animationClip[0]&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=THREE.loopOnce,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=localTimeEnabled,this.morphColour=localMorphColour,mesh.userData=this,mesh.matrixAutoUpdate=!1,this.setMorph(mesh),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(geometry.setAttribute("morphTarget0",geometry.getAttribute("position")),geometry.setAttribute("morphTarget1",geometry.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},ZincObject.prototype.setIsPickable=function(isPickable){this.isPickable!==isPickable&&(this.isPickable=isPickable,this.region&&(this.region.pickableUpdateRequired=!0))},ZincObject.prototype.setAnatomicalId=function(anatomicalId){this.anatomicalId=anatomicalId},ZincObject.prototype.setName=function(groupNameIn){this.groupName=groupNameIn,this._lod.setName(groupNameIn)},ZincObject.prototype.getCurrentTime=function(){if(this.clipAction){var ratio=this.clipAction.time/this.clipAction._clip.duration;return this.duration*ratio;}return this.inbuildTime;},ZincObject.prototype.setMorphTime=function(time){var timeChanged=!1;if(this.clipAction){var ratio=time/this.duration,actualDuration=this.clipAction._clip.duration,newTime=ratio*actualDuration;newTime!=this.clipAction.time&&(this.clipAction.time=newTime,timeChanged=!0),timeChanged&&this.isTimeVarying()&&this.mixer.update(0)}else{var _newTime=time;_newTime=time>this.duration?this.duration:0>time?0:time,_newTime!=this.inbuildTime&&(this.inbuildTime=_newTime,timeChanged=!0)}timeChanged&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},ZincObject.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},ZincObject.prototype.getVisibility=function(){return this.visible;},ZincObject.prototype.setVisibility=function(visible){visible!==this.visible&&(this.visible=visible,this.group.visible=visible,this.region&&(this.region.pickableUpdateRequired=!0))},ZincObject.prototype.setAlpha=function(alpha){var material=this._lod._material,isTransparent=!1;1>alpha&&(isTransparent=!0),material.opacity=alpha,material.transparent=isTransparent,this.checkTransparentMesh()},ZincObject.prototype.setFrustumCulled=function(flag){//multilayers - set for all layers
452
- this._lod.setFrustumCulled(flag)},ZincObject.prototype.setVertexColors=function(vertexColors){//multilayers - set for all
453
- this._lod.setVertexColors(vertexColors)},ZincObject.prototype.getColour=function(){return this._lod._material?this._lod._material.color:void 0},ZincObject.prototype.setColour=function(colour){this._lod.setColour(colour)},ZincObject.prototype.setGreyScale=function(flag){if(flag){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour(new THREE.Color().setHex(12303291)),!0;}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1;},ZincObject.prototype.getColourHex=function(){return!this.morphColour&&this._lod._material&&this._lod._material.color?this._lod._material.color.getHexString():void 0},ZincObject.prototype.setColourHex=function(hex){this._lod._material.color.setHex(hex),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(hex)},ZincObject.prototype.setEmissiveRGB=function(colour){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...colour),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...colour)},ZincObject.prototype.setMaterial=function(material){this._lod.setMaterial(material)},ZincObject.prototype.getClosestVertexIndex=function(){var closestIndex=-1,morph=this.getMorph();if(morph&&morph.geometry){var position=morph.geometry.attributes.position;if(position){this._b1.setFromBufferAttribute(position),this._b1.getCenter(this._v1);for(var distance=-1,currentDistance=0,i=0;i<position.count;i++)this._v2.fromArray(position.array,3*i),currentDistance=this._v2.distanceTo(this._v1),-1==distance?distance=currentDistance:distance>currentDistance&&(distance=currentDistance,closestIndex=i);}}return closestIndex;},ZincObject.prototype.getClosestVertex=function(applyMatrixWorld){var position=new THREE.Vector3;-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex());var morph=this.getMorph();if(morph&&morph.geometry&&0<=this.closestVertexIndex){var influences=morph.morphTargetInfluences,attributes=morph.geometry.morphAttributes;if(influences&&attributes&&attributes.position){for(var found=!1,i=0;i<influences.length;i++)0<influences[i]&&(found=!0,this._v1.fromArray(attributes.position[i].array,3*this.closestVertexIndex),position.add(this._v1.multiplyScalar(influences[i])));if(found)return applyMatrixWorld?position.applyMatrix4(morph.matrixWorld):position;}else return position.fromArray(morph.geometry.attributes.position.array,3*this.closestVertexIndex),applyMatrixWorld?position.applyMatrix4(morph.matrixWorld):position;}//Matrix world has already been applied
454
- return this.getBoundingBox(),position.copy(this.center),position;},ZincObject.prototype.getBoundingBox=function(){if(this.visible){var morph=this._lod.getCurrentMorph();if(morph&&morph.visible)return this.boundingBoxUpdateRequired&&((__webpack_require__(5).getBoundingBox)(morph,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),this.boundingBoxUpdateRequired=!1),this.cachedBoundingBox;}},ZincObject.prototype.dispose=function(){//multilayyers
455
- this._lod.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.group=void 0,this.clipAction=void 0,this.groupName=void 0},ZincObject.prototype.markerIsRequired=function(options){return!!(this.visible&&("on"===this.markerMode||options&&options.displayMarkers&&"inherited"===this.markerMode))},ZincObject.prototype.updateMarker=function(playAnimation,options){if(!1==playAnimation&&this.markerIsRequired(options)){var ndcToBeUpdated=options.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new((__webpack_require__(14).Marker))(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){var position=this.getClosestVertex(!1);position&&(this.marker.setPosition(position.x,position.y,position.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(options.markersList&&!(this.marker.uuid in options.markersList)&&(ndcToBeUpdated=!0,options.markersList[this.marker.uuid]=this.marker),this.marker.enable(),this.group.add(this.marker.morph)),this.marker.setNumber(this.markerNumber),this.markerImgURL?this.marker.loadUserSprite(this.markerImgURL):this.marker.setDefaultSprite(),options&&options.camera&&(ndcToBeUpdated||options.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(options.camera.cameraObject),options.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),options.markersList&&this.marker.uuid in options.markersList&&(options.markerCluster.markerUpdateRequired=!0,delete options.markersList[this.marker.uuid])),this.markerUpdateRequired=!0;},ZincObject.prototype.processMarkerVisual=function(min,max){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(min,max)},ZincObject.prototype.initiateMorphColor=function(){1==this.morphColour&&this._lod.updateMorphColorAttribute(!1)},ZincObject.prototype.setRenderOrder=function(renderOrder){//multiilayers
456
- this._lod.setRenderOrder(renderOrder)},ZincObject.prototype.getClosestVertexDOMElementCoords=function(scene){if(scene&&scene.camera){var inView=!0,position=this.getClosestVertex(!0);return position.project(scene.camera),position.z=Math.min(Math.max(position.z,0),1),(1<position.x||-1>position.x||1<position.y||-1>position.y)&&(inView=!1),scene.getZincCameraControls().getRelativeCoordsFromNDC(position.x,position.y,position),{position,inView};}},ZincObject.prototype.setMarkerMode=function(mode,options){mode!==this.markerMode&&(this.markerMode="on"===mode||"off"===mode?mode:"inherited",this.region&&(this.region.pickableUpdateRequired=!0)),options&&(this.markerNumber=options.number,this.markerImgURL=options.imgURL)},ZincObject.prototype.render=function(delta,playAnimation,cameraControls,options){if(this.visible&&!(this.timeEnabled&&playAnimation)&&this._lod.update(cameraControls,this.center),!0==playAnimation){if(this.clipAction&&this.isTimeVarying())this.mixer.update(delta);else{var targetTime=this.inbuildTime+delta;targetTime>this.duration&&(targetTime-=this.duration),this.inbuildTime=targetTime}//multilayers
457
- this.visible&&0!=delta&&(this.boundingBoxUpdateRequired=!0,1==this.morphColour&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(playAnimation,options)},ZincObject.prototype.addLOD=function(loader,level,url,index,preload){this._lod.addLevelFromURL(loader,level,url,index,preload)},ZincObject.prototype.addVertices=function(coords){var mesh=this.getMorph(),geometry=void 0;if(!mesh)geometry=createBufferGeometry(500,coords),this.drawRange=coords.length;else if(-1<this.drawRange){var positionAttribute=mesh.geometry.getAttribute("position");coords.forEach(coord=>{positionAttribute.setXYZ(this.drawRange,coord[0],coord[1],coord[2]),++this.drawRange}),positionAttribute.needsUpdate=!0,mesh.geometry.setDrawRange(0,this.drawRange),mesh.geometry.computeBoundingBox(),mesh.geometry.computeBoundingSphere(),geometry=mesh.geoemtry,this.boundingBoxUpdateRequired=!0}return geometry;},ZincObject.prototype.deleteVertices=function(index){var mesh=this.getMorph();return!!(null!==mesh&&void 0!==mesh&&mesh.geometry&&this.drawRange>=index&&removeVertexAtIndex(mesh.geometry,index,!0))&&(--this.drawRange,mesh.geometry.setDrawRange(0,this.drawRange),mesh.geometry.computeBoundingBox(),mesh.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0,!0)},ZincObject.prototype.setPosition=function(x,y,z){var group=this.getGroup();group&&(group.position.set(x,y,z),group.matrixWorldNeedsUpdate=!0,group.updateMatrix(),group.updateWorldMatrix(!0,!0),this.boundingBoxUpdateRequired=!0)},ZincObject.prototype.loadAdditionalSources=function(primitivesLoader){primitivesLoader.load(resolveURL(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},ZincObject.prototype.setScaleAll=function(scale){var group=this.getGroup();group&&(group.scale.set(scale,scale,scale),group.updateMatrix(),this.boundingBoxUpdateRequired=!0)},exports.ZincObject=ZincObject;
458
-
459
- /***/ }),
460
- /* 11 */
461
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
462
-
463
- var THREE=__webpack_require__(4),updateMorphColorAttribute=(__webpack_require__(5).updateMorphColorAttribute),toBufferGeometry=(__webpack_require__(5).toBufferGeometry),LOD=function(parent){this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=parent,this.addLevel=(object,distanceIn)=>{if(object){var l,distance=Math.abs(distanceIn);for(l=0;l<this.levels.length&&!(distance<this.levels[l].distance);l++);this.levels.splice(l,0,{distance:distance,morph:object,loaded:!0,loading:!1,url:""}),object.renderOrder=this._renderOrder}},this.levelLoaded=(object,distanceIn)=>{if(object){for(var distance=Math.abs(distanceIn),l=0;l<this.levels.length;l++)if(distance===this.levels[l].distance){this._parent.group.add(object),this.levels[l].morph=object,this.levels[l].loaded=!0,this.levels[l].loading=!1;break;}this.checkTransparentMesh()}},this.addLevelFromURL=(loader,level,url,index,preload)=>{this._loader=loader;var l,distance=this.calculateDistance(level);for(l=0;l<this.levels.length&&!(distance<this.levels[l].distance);l++);this.levels.splice(l,0,{distance:distance,morph:void 0,loaded:!1,loading:!1,url:url,index:index}),preload&&this.loadLevel(l)},this.loadLevel=index=>{var level=this.levels[index];return level.morph||level.loaded||level.loading||(level.loading=!0,this._loader.load(level.url,this.lodLoader(level.distance),void 0,void 0,{index:level.index})),void 0===level.morph;},this.calculateDistance=function(level){this._parent.getBoundingBox();var radius=this._parent.radius,distance=0;return"far"===level?distance=4.5*radius:"medium"===level?distance=2.5*radius:"close"==level&&(distance=0),distance;},this.containsLevels=()=>!!(this.levels&&1<this.levels.length),this.checkTransparentMesh=()=>{var level=this.levels[this._currentLevel];this._material&&(this._material.transparent?(!this._secondaryMaterial&&(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=THREE.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,this._secondaryMaterial.emissive&&this._secondaryMaterial.emissive.copy(this._material.emissive),this._secondaryMaterial.needsUpdate=!0,!level.secondaryMesh&&(level.secondaryMesh=new THREE.Mesh(level.morph.geometry,this._secondaryMaterial),level.secondaryMesh.renderOrder=level.morph.renderOrder+1,level.secondaryMesh.userData=level.morph.userData,level.secondaryMesh.name=level.morph.name),this._material.side=THREE.BackSide,this._material.needsUpdate=!0,!level.secondaryMesh.parent&&(level.morph.add(level.secondaryMesh),this._parent.animationGroup&&this._parent.animationGroup.add(level.secondaryMesh))):(level.secondaryMesh&&(level.morph.remove(level.secondaryMesh),this._parent.animationGroup&&(this._parent.animationGroup.uncache(level.secondaryMesh),this._parent.animationGroup.remove(level.secondaryMesh))),this._material.side=THREE.DoubleSide,this._material.needsUpdate=!0))},this.dispose=()=>{this.levels.forEach(level=>{level.morph&&level.morph.geometry&&level.morph.geometry.dispose()}),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{var level=this.levels[this._currentLevel];return level&&level.morph?level.morph:this._parent.morph},this.lodLoader=function(distance){return geometryIn=>{var material=this._material,options={localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour},geometry=toBufferGeometry(geometryIn,options),mesh=void 0;this._parent.isGeometry?mesh=new THREE.Mesh(geometry,material):this._parent.isLines&&(mesh=new((__webpack_require__(12).LineSegments))(geometry,material)),mesh.userData=this._parent,mesh.renderOrder=this._renderOrder,geometryIn.dispose(),this.levelLoaded(mesh,distance)};},this.updateMorphColorAttribute=currentOnly=>{//Multilayers - set all
464
- if(this._material&&(this._material.vertexColors==THREE.VertexColors||!0==this._material.vertexColors))if(currentOnly){var morph=this.getCurrentMorph();updateMorphColorAttribute(morph.geometry,morph)}else this.levels.forEach(level=>{level.morph&&level.morph.geometry&&updateMorphColorAttribute(level.morph.geometry,level.morph)});},this.setColour=colour=>{this._material.color=colour,this._secondaryMaterial&&(this._secondaryMaterial.color=colour),updateGeometryColour()},this.setFrustumCulled=flag=>{this.levels.forEach(level=>{level.morph&&(level.morph.frustumCulled=flag),level.secondaryMesh&&(level.secondaryMesh.frustumCulled=flag)})},this.setMaterial=material=>{material&&(!this._material||this._material.id!==material.id)&&(this._material=material,this._secondaryMaterial&&this._secondaryMaterial.dispose(),this._secondaryMaterial=material.clone(),this._secondaryMaterial.side=THREE.FrontSide,this._secondaryMaterial.transparent=!0,this.levels.forEach(level=>{level.morph&&(level.morph.material=this._material,level.morph.geometry&&(level.morph.geometry.colorsNeedUpdate=!0)),level.secondaryMesh&&(level.secondaryMesh.material=this._secondaryMaterial)}))},this.setName=name=>{this.levels.forEach(level=>{level.morph&&(level.morph.name=name),level.secondaryMesh&&(level.secondaryMesh.name=name)})},this.setRenderOrder=order=>{this._renderOrder=order,this.levels.forEach(level=>{level.morph&&(level.morph.renderOrder=order),level.secondaryMesh&&(level.secondaryMesh.renderOrder=order)})},this.setVertexColors=vertexColors=>{this._material.vertexColors=vertexColors,updateGeometryColour(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=vertexColors)},this.update=(camera,center)=>{var levels=this.levels;if(1<levels.length){var i,l,distance=camera.cameraObject.position.distanceTo(center),visibleIndex=-1,optimalIndex=-1;//Found a visible index that is within range of the LOD
465
- for(i=0,l=levels.length;i<l&&distance>=levels[i].distance;i++)levels[i].morph?(-1<visibleIndex&&levels[visibleIndex].morph&&(levels[visibleIndex].morph.visible=!1),visibleIndex=i,levels[i].morph.visible=!0,optimalIndex=-1):optimalIndex=i;for(-1<optimalIndex&&this.loadLevel(optimalIndex);i<l;i++)levels[i].morph&&(-1<visibleIndex?levels[i].morph.visible=!1:(levels[i].morph.visible=!0,visibleIndex=i));this._currentLevel!=visibleIndex&&(this._currentLevel=visibleIndex,this.checkTransparentMesh())}},this.toggleMarker=(marker,flag)=>{this.levels.forEach(level=>{level.morph&&(flag?level.morph.add(marker):level.morph.remove(marker))})};var updateGeometryColour=()=>{this.levels.forEach(level=>{level.morph&&level.morph.geometry&&(level.morph.geometry.colorsNeedUpdate=!0)})};};/**
466
- * Provides an object which stores meshes at different levels based
467
- * on specified distance.
468
- * This object is ued by zincObject to provide mesh at different LODs.
469
- * A layer is displayed when the distance from the camera is greater
470
- * than its specified distance and closest compared to other layers.
471
- * This is intended to be an internal object used only by Zinc Object.
472
- *
473
- * This object assumes the centroid and bounding box are consistent between
474
- * different level of layers.
475
- *
476
- * @class
477
- * @author Alan Wu
478
- * @return {LOD}
479
- */exports.LOD=LOD;
480
-
481
- /***/ }),
482
- /* 12 */
483
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
484
-
485
- "use strict";
486
- __webpack_require__.r(__webpack_exports__);
487
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
488
- /* harmony export */ LineSegments: () => (/* binding */ LineSegments)
489
- /* harmony export */ });
490
- /* harmony import */ var _Line_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13);
491
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
492
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__);
493
- var _start=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_1__.Vector3,_end=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_1__.Vector3;class LineSegments extends _Line_js__WEBPACK_IMPORTED_MODULE_0__.Line{constructor(geometry,material){super(geometry,material),this.type="LineSegments"}computeLineDistances(){var geometry=this.geometry;if(!geometry.isBufferGeometry)geometry.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");else// we assume non-indexed geometry
494
- if(null===geometry.index){for(var positionAttribute=geometry.attributes.position,lineDistances=[],i=0,l=positionAttribute.count;i<l;i+=2)_start.fromBufferAttribute(positionAttribute,i),_end.fromBufferAttribute(positionAttribute,i+1),lineDistances[i]=0==i?0:lineDistances[i-1],lineDistances[i+1]=lineDistances[i]+_start.distanceTo(_end);geometry.setAttribute("lineDistance",new three__WEBPACK_IMPORTED_MODULE_1__.Float32BufferAttribute(lineDistances,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this;}}LineSegments.prototype.isLineSegments=!0;
495
-
496
- /***/ }),
497
- /* 13 */
498
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
499
-
500
- "use strict";
501
- __webpack_require__.r(__webpack_exports__);
502
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
503
- /* harmony export */ Line: () => (/* binding */ Line)
504
- /* harmony export */ });
505
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
506
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_0__);
507
- var _start=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_end=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_inverseMatrix=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4,_ray=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__.Ray,_sphere=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__.Sphere,_morphA=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_morphB=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_tempA=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_tempB=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__.Vector3;class Line extends three__WEBPACK_IMPORTED_MODULE_0__.Object3D{constructor(){var geometry=0<arguments.length&&arguments[0]!==void 0?arguments[0]:new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry,material=1<arguments.length&&arguments[1]!==void 0?arguments[1]:new three__WEBPACK_IMPORTED_MODULE_0__.LineBasicMaterial;super(),this.type="Line",this.geometry=geometry,this.material=material,this.updateMorphTargets()}copy(source){return super.copy(source),this.material=source.material,this.geometry=source.geometry,this;}computeLineDistances(){var geometry=this.geometry;if(!geometry.isBufferGeometry)geometry.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");else// we assume non-indexed geometry
508
- if(null===geometry.index){for(var positionAttribute=geometry.attributes.position,lineDistances=[0],i=1,l=positionAttribute.count;i<l;i++)_start.fromBufferAttribute(positionAttribute,i-1),_end.fromBufferAttribute(positionAttribute,i),lineDistances[i]=lineDistances[i-1],lineDistances[i]+=_start.distanceTo(_end);geometry.setAttribute("lineDistance",new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(lineDistances,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this;}raycast(raycaster,intersects){var geometry=this.geometry,matrixWorld=this.matrixWorld,threshold=raycaster.params.Line.threshold,drawRange=geometry.drawRange,morphPosition=geometry.morphAttributes.position;// Checking boundingSphere distance to ray
509
- if(null===geometry.boundingSphere&&geometry.computeBoundingSphere(),_sphere.copy(geometry.boundingSphere),_sphere.applyMatrix4(matrixWorld),_sphere.radius+=threshold,!1!==raycaster.ray.intersectsSphere(_sphere)){_inverseMatrix.copy(matrixWorld).invert(),_ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix);var localThreshold=threshold/((this.scale.x+this.scale.y+this.scale.z)/3),localThresholdSq=localThreshold*localThreshold,vStart=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,vEnd=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,interSegment=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,interRay=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,step=this.isLineSegments?2:1;if(geometry.isBufferGeometry){var index=geometry.index,attributes=geometry.attributes,positionAttribute=attributes.position;if(null!==index)for(var start=Math.max(0,drawRange.start),end=Math.min(index.count,drawRange.start+drawRange.count),i=start;i<end-1;i+=step){var a=index.getX(i),b=index.getX(i+1);calculatePosition(vStart,vEnd,this,positionAttribute,morphPosition,a,b);var distSq=_ray.distanceSqToSegment(vStart,vEnd,interRay,interSegment);if(!(distSq>localThresholdSq)){interRay.applyMatrix4(this.matrixWorld);//Move back to world space for distance calculation
510
- var distance=raycaster.ray.origin.distanceTo(interRay);distance<raycaster.near||distance>raycaster.far||intersects.push({distance:distance,// What do we want? intersection point on the ray or on the segment??
511
- // point: raycaster.ray.at( distance ),
512
- point:interSegment.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else for(var _start2=Math.max(0,drawRange.start),_end2=Math.min(positionAttribute.count,drawRange.start+drawRange.count),_i=_start2;_i<_end2-1;_i+=step){calculatePosition(vStart,vEnd,this,positionAttribute,morphPosition,_i,_i+1);var _distSq=_ray.distanceSqToSegment(vStart,vEnd,interRay,interSegment);if(!(_distSq>localThresholdSq)){interRay.applyMatrix4(this.matrixWorld);//Move back to world space for distance calculation
513
- var _distance=raycaster.ray.origin.distanceTo(interRay);_distance<raycaster.near||_distance>raycaster.far||intersects.push({distance:_distance,// What do we want? intersection point on the ray or on the segment??
514
- // point: raycaster.ray.at( distance ),
515
- point:interSegment.clone().applyMatrix4(this.matrixWorld),index:_i,face:null,faceIndex:null,object:this})}}}else geometry.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");}//
516
- }updateMorphTargets(){var geometry=this.geometry;if(geometry.isBufferGeometry){var morphAttributes=geometry.morphAttributes,keys=Object.keys(morphAttributes);if(0<keys.length){var morphAttribute=morphAttributes[keys[0]];if(morphAttribute!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var name,m=0,ml=morphAttribute.length;m<ml;m++)name=morphAttribute[m].name||m+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[name]=m;}}}else{var morphTargets=geometry.morphTargets;morphTargets!==void 0&&0<morphTargets.length&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function calculatePosition(vStart,vEnd,object,position,morphPosition,a,b){vStart.fromBufferAttribute(position,a),vEnd.fromBufferAttribute(position,b);var morphInfluences=object.morphTargetInfluences;if(object.material.morphTargets&&morphPosition&&morphInfluences){_morphA.set(0,0,0),_morphB.set(0,0,0);for(var i=0,il=morphPosition.length;i<il;i++){var influence=morphInfluences[i],morphAttribute=morphPosition[i];0!==influence&&(_tempA.fromBufferAttribute(morphAttribute,a),_tempB.fromBufferAttribute(morphAttribute,b),_morphA.addScaledVector(_tempA.sub(vStart),influence),_morphB.addScaledVector(_tempB.sub(vEnd),influence))}vStart.add(_morphA),vEnd.add(_morphB)}}Line.prototype.isLine=!0;
517
-
518
- /***/ }),
519
- /* 14 */
520
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
521
-
522
- var THREE=__webpack_require__(4),markerImage=new Image(128,128);markerImage.src=__webpack_require__(15);var texture=new THREE.Texture;texture.image=markerImage,texture.needsUpdate=!0;var size=[.02,.03,1],spriteMaterial=new THREE.SpriteMaterial({map:texture,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),createNewSpriteText=(__webpack_require__(5).createNewSpriteText),Marker=function(zincObject){(__webpack_require__(10).ZincObject).call(this),this.texture=texture;var sprite=void 0,userTexture=void 0,userMaterial=void 0,userSprite=void 0,userUrl=void 0,defaultDisplay=!0;this.morph=new THREE.Group,this.group=this.morph,this.parent=zincObject,this.isMarker=!0;var enabled=!1;this.ndc=new THREE.Vector3;var number=void 0,label=void 0,initialise=()=>{sprite=new THREE.Sprite(spriteMaterial),sprite.center.set(.5,0),this.morph.add(sprite),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,sprite.scale.set(size[0],size[1],size[2]),sprite.userData=this};/**
523
- * Set the position of the marker.
524
- *
525
- * @param {Number} x - x coordinate to be set.
526
- * @param {Number} y - y coordinate to be set.
527
- * @param {Number} z - z coordinate to be set.
528
- *//**
529
- * Set the size of the marker.
530
- *
531
- * @param {Number} size - size to be set.
532
- *//**
533
- * Clean up this object,
534
- *//**
535
- * Set the visibility of this Geometry.
536
- *
537
- * @param {Boolean} visible - a boolean flag indicate the visibility to be set
538
- *//**
539
- * Enable and visualise the marker.
540
- *//**
541
- * Disable and hide the marker.
542
- */this.updateVisual=(min,max)=>{var scale=1,porportion=0;min!==max&&(porportion=1-(this.ndc.z-min)/(max-min),scale=.6+.4*porportion),this.setSpriteSize(scale)},this.updateNDC=camera=>(this.ndc.copy(this.morph.position),this.ndc.project(camera),this.ndc.z=Math.min(Math.max(this.ndc.z,0),1),this.ndc),this.setPosition=(x,y,z)=>{this.morph.position.set(x,y,z)},this.setSpriteSize=size=>{sprite.scale.set(.015,.02,1),sprite.scale.multiplyScalar(size)},this.setUserSprite=()=>{userSprite&&(this.morph.add(userSprite),defaultDisplay&&(this.morph.remove(sprite),label&&this.morph.remove(label),defaultDisplay=!1))},this.setImageForUserSprite=(image,size)=>{userSprite&&(this.morph.remove(userSprite),userSprite=void 0),userTexture&&userTexture.dispose(),userMaterial&&userMaterial.dispose(),userTexture=new THREE.Texture,userTexture.image=image,userTexture.needsUpdate=!0,userMaterial=new THREE.SpriteMaterial({map:userTexture,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),size||(size=[.05,.05,1]),userSprite=new THREE.Sprite(userMaterial),userSprite.center.set(.5,0),userSprite.scale.set(size[0],size[1],size[2]),userSprite.userData=this,this.setUserSprite()},this.setDefaultSprite=()=>{defaultDisplay||(defaultDisplay=!0,this.morph.add(sprite),userSprite&&this.morph.remove(userSprite),label&&this.morph.add(label))},this.loadUserSprite=(url,size)=>{if(url)if(url!==userUrl){userUrl=url;var userImage=new Image(128,128);userImage.crossOrigin="anonymous",userImage.onload=()=>{this.setImageForUserSprite(userImage,size)},userImage.src=url}else this.setUserSprite();},this.dispose=()=>{this.morph&&this.morph.clear(),sprite&&(sprite.clear(),sprite=void 0),label&&(label.material.map.dispose(),label.material.dispose(),label=void 0)},this.isEnabled=()=>enabled,this.setNumber=numberIn=>{(!numberIn||number!=numberIn)&&label&&(this.morph.remove(label),label.material.map.dispose(),label.material.dispose(),label=void 0),!label&&numberIn&&(label=createNewSpriteText(numberIn,.012,"black","Asap",120,700),this.morph.add(label)),number=numberIn},this.getNumber=()=>number?number:1,this.setVisibility=function(visible){visible!==this.visible&&(this.visible=visible,this.group.visible=visible,this.parent.region&&(this.parent.region.pickableUpdateRequired=!0))},this.enable=()=>{enabled=!0,this.morph.visible=!0,this.visible=!0},this.disable=()=>{enabled=!1,this.morph.visible=!1,this.visible=!1},initialise()};/**
543
- * A special graphics type with a tear drop shape.
544
- * It is currently used to mark the location of a
545
- * {@link zincObject}.
546
- *
547
- * @class
548
- * @author Alan Wu
549
- * @return {Marker}
550
- */Marker.prototype=Object.create((__webpack_require__(10).ZincObject).prototype),exports.Marker=Marker;
551
-
552
- /***/ }),
553
- /* 15 */
554
- /***/ ((module) => {
555
-
556
- module.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgdmlld0JveD0iMCAwIDM2NSA1NjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4NCjxkZWZzPg0KPC9kZWZzPg0KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCAwKSIgaWQ9IjgwOGVkMjgzLTI1MjQtNDQwZi04OGFlLTNiZGI0N2JiNTc0OSIgID4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4NCjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItMTgyLjUiIHk9Ii0yODAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIC8+DQo8L2c+DQo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+DQo8ZyBzdHlsZT0iIiAgID4NCjwvZz4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCA5Ny41KSIgID4NCjxnIHN0eWxlPSIiICAgPg0KPC9nPg0KPC9nPg0KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMC45OSAwIDAgMC45OSAxODIuNSAyODApIiAgPg0KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii01NDAiIHk9Ii01NDAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjEwODAiIGhlaWdodD0iMTA4MCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHBhdGggc3R5bGU9InN0cm9rZTogcmdiKDAsMCwwKTsgc3Ryb2tlLXdpZHRoOiAwOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMCw4OSwxMTYpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB0cmFuc2Zvcm09IiB0cmFuc2xhdGUoLTE4Mi45LCAtMjc5Ljg1KSIgZD0iTSAxODIuOSA1NTEuNyBDIDE4Mi45IDU1MS44MDAwMDAwMDAwMDAxIDE4My4xIDU1MiAxODMuMSA1NTIgQyAxODMuMSA1NTIgMzU4LjMgMjgzIDM1OC4zIDE5NC42IEMgMzU4LjMgNjQuNSAyNjkuNSA3LjkwMDAwMDAwMDAwMDAwNiAxODIuOSA3LjY5OTk5OTk5OTk5OTk4OSBDIDk2LjMgNy45IDcuNSA2NC41IDcuNSAxOTQuNiBDIDcuNSAyODMgMTgyLjggNTUyIDE4Mi44IDU1MiBDIDE4Mi44IDU1MiAxODIuOSA1NTEuNyAxODIuOSA1NTEuNyB6IE0gMTIyLjIgMTg3LjIgQyAxMjIuMiAxNTMuNiAxNDkuNCAxMjYuMzk5OTk5OTk5OTk5OTkgMTgzIDEyNi4zOTk5OTk5OTk5OTk5OSBDIDIxNi42IDEyNi4zOTk5OTk5OTk5OTk5OSAyNDMuOCAxNTMuNiAyNDMuOCAxODcuMiBDIDI0My44IDIyMC43OTk5OTk5OTk5OTk5OCAyMTYuNSAyNDggMTgyLjkgMjQ4IEMgMTQ5LjQgMjQ4IDEyMi4yIDIyMC44IDEyMi4yIDE4Ny4yIHoiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPg0KPGNpcmNsZSBzdHlsZT0ic3Ryb2tlOiByZ2IoMCwwLDApOyBzdHJva2Utd2lkdGg6IDA7IHN0cm9rZS1kYXNoYXJyYXk6IG5vbmU7IHN0cm9rZS1saW5lY2FwOiBidXR0OyBzdHJva2UtZGFzaG9mZnNldDogMDsgc3Ryb2tlLWxpbmVqb2luOiBtaXRlcjsgc3Ryb2tlLW1pdGVybGltaXQ6IDQ7IGZpbGw6IHJnYigyNTUsMjU1LDI1NSk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIGN4PSIwIiBjeT0iMCIgcj0iMzUiIC8+DQo8L2c+DQo8L2c+DQo8L2c+DQo8L3N2Zz4="
557
-
558
- /***/ }),
559
- /* 16 */
560
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
561
-
562
- var THREE=__webpack_require__(4),Glyph=function(geometry,materialIn,idIn,glyphsetIn){(__webpack_require__(10).ZincObject).call(this);var material;materialIn&&(material=materialIn.clone(),material.vertexColors=THREE.FaceColors);this.id=idIn;var label=void 0,labelString=void 0;this.isGlyph=!0;var _position=[0,0,0];/**
563
- * Create a glyph using mesh
564
- * @param {THREE.Mesh} meshIn - Mesh to create the glyph from
565
- *
566
- * @returns {Boolean} true if successful
567
- *//**
568
- * Get the {Glyphset} containing this glyph.
569
- *
570
- * @returns {Boolean} true if successful
571
- *//**
572
- * Set and update the text containing this glyph.
573
- * @param {String} text - Label to be set for this instance
574
- *//**
575
- * Display label with the choosen colour. It will replace the current
576
- * label.
577
- * @param {THREE.Color} colour - Colour for the label.
578
- *//**
579
- * Hide label with the choosen colour.
580
- *//**
581
- * Get the label of this glyph
582
- * @return {Label}
583
- *//**
584
- * Get the mesh of this glyph.
585
- * @return {THREE.Mesh}
586
- *//**
587
- * Set the transformation of this glyph.
588
- * @param {Array} position - Three components vectors containing position of the
589
- * transformation.
590
- * @param {Array} axis1 - Three components vectors containing axis1 rotation of the
591
- * transformation.
592
- * @param {Array} axis2 - Three components vectors containing axis2 rotation of the
593
- * transformation.
594
- * @param {Array} position - Three components vectors containing axis3 rotation of the
595
- * transformation.
596
- *//**
597
- * Set the color of the glyph and its label.
598
- *
599
- * @param {THREE.Color} color - Colour to be set.
600
- *//**
601
- * Clear and free its memory.
602
- */this.fromMesh=meshIn=>!!(meshIn&&meshIn.isMesh)&&(this.morph=meshIn.clone(),this.morph.userData=this,this.group.add(this.morph),!0),geometry&&material&&this.fromMesh(new THREE.Mesh(geometry,material)),this.getGlyphset=function(){return glyphsetIn;},this.setLabel=text=>{text&&("string"==typeof text||text instanceof String)&&(labelString=text,this.morph&&(this.morph.name=text))},this.showLabel=colour=>{if(label&&(_position=label.getPosition(),this.group.remove(label.getSprite()),label.dispose(),label=void 0),labelString&&("string"==typeof labelString||labelString instanceof String)){label=new((__webpack_require__(17).Label))(labelString,colour),label.setPosition(_position[0],_position[1],_position[2]);var sprite=label.getSprite();sprite.material.alphaTest=.5,sprite.material.transparent=!0,sprite.material.depthWrite=!1,this.group.add(label.getSprite())}},this.hideLabel=()=>{label&&(_position=label.getPosition(),this.group.remove(label.getSprite()),label.dispose(),label=void 0)},this.getLabel=()=>labelString,this.getMesh=()=>this.morph,this.setTransformation=(position,axis1,axis2,axis3)=>{this.morph&&(this.morph.matrix.elements[0]=axis1[0],this.morph.matrix.elements[1]=axis1[1],this.morph.matrix.elements[2]=axis1[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=axis2[0],this.morph.matrix.elements[5]=axis2[1],this.morph.matrix.elements[6]=axis2[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=axis3[0],this.morph.matrix.elements[9]=axis3[1],this.morph.matrix.elements[10]=axis3[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=position[0],this.morph.matrix.elements[13]=position[1],this.morph.matrix.elements[14]=position[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),_position=[...position],label&&label.setPosition(position[0],position[1],position[2])},this.setColour=color=>{label&&label.setColour(color),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry&&(this.geometry.colorsNeedUpdate=!0)},this.dispose=()=>{this.material&&this.material.dispose(),this.morph=void 0}};/**
603
- * Zinc representation of glyph graphic, it contains the colours,
604
- * geometry and transformation of the glyph.
605
- *
606
- * @param {THREE.Geometry} geometry - Geometry of the glyph .
607
- * @param {THREE.Material} materialIn - Material of the glyph.
608
- * @param {Number} idIn - Id of the glyph.
609
- *
610
- * @class
611
- * @author Alan Wu
612
- * @return {Glyph}
613
- */Glyph.prototype=Object.create((__webpack_require__(10).ZincObject).prototype),exports.Glyph=Glyph;
614
-
615
- /***/ }),
616
- /* 17 */
617
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
618
-
619
- var SpriteText=(__webpack_require__(7)["default"]);/**
620
- * Bitmap labels, this is used with {@link Glyph} to
621
- * provide labels.
622
- *
623
- * @param {String} textIn - Text to be displayed dwith the label.
624
- * @param {THREE.Color} colour - Colour to be set for the label.
625
- *
626
- * @class
627
- * @author Alan Wu
628
- * @return {Label}
629
- */exports.Label=function(textIn,colourIn){var text=textIn,sprite=void 0,position=[0,0,0],colour=colourIn,size=1,fontWeight=500;sprite=colourIn?new SpriteText(text,.012,colourIn.getStyle()):new SpriteText(text,.012),sprite.fontFace="Asap",sprite.fontWeight=fontWeight,sprite.material.map.generateMipmaps=!1,sprite.material.sizeAttenuation=!1,sprite.center.x=-.05,sprite.center.y=0;var originalScale=[sprite.scale.x,sprite.scale.y];/**
630
- * Get the current position in an array containing the x, y and z
631
- * coordinates.
632
- *
633
- * @return {Array}
634
- *//**
635
- * Set the position of the label in 3D coordinates.
636
- *
637
- * @param {Number} x - x coordinate to be set.
638
- * @param {Number} y - y coordinate to be set.
639
- * @param {Number} z - z coordinate to be set.
640
- *//**
641
- * Set the colour of the label
642
- *
643
- * @param {THREE.Color} colour - colour to be set
644
- *//**
645
- * Scale the label.
646
- *
647
- * @param {Number} scaling - Scale to be set.
648
- *//**
649
- * Set depth test for sprite object.
650
- *
651
- * @param {Boolean} flag - Enable/disable depth test
652
- *//**
653
- * Set a new text for the label.
654
- *
655
- * @param {Number} scaling - Scale to be set.
656
- *//**
657
- * Set a new text for the label.
658
- *
659
- * @param {Number} scaling - Scale to be set.
660
- *//**
661
- * Set a new text for the label.
662
- *
663
- * @param {Number} scaling - Scale to be set.
664
- *//**
665
- * Set visibility of the label.
666
- *
667
- * @param {Boolean} flag - Visibility to set
668
- *//**
669
- * Free up the memory
670
- *//**
671
- * Get the intrnal sprite.
672
- *
673
- * @return {THREE.Sprite}
674
- *//**
675
- * Get the text.
676
- *
677
- * @return {String}
678
- */this.getPosition=()=>sprite?[sprite.position.x,sprite.position.y,sprite.position.z]:[0,0,0],this.setPosition=(x,y,z)=>{position[0]=x,position[1]=y,position[2]=z,sprite&&sprite.position.set(x,y,z)},this.setColour=colourIn=>{colourIn&&(sprite.color=colourIn.getStyle(),colour=colourIn)},this.setScale=scaling=>{sprite&&0<scaling&&sprite.scale.set(scaling,scaling,1)},this.setDepthTest=flag=>{flag&&flag!==sprite.material.depthTest&&(sprite.material.depthTest=flag)},this.setSize=sizeIn=>{0<sizeIn&&(sprite.scale.x=originalScale[0]*sizeIn,sprite.scale.y=originalScale[1]*sizeIn,size=sizeIn)},this.setFontWeight=fontWeightIn=>{fontWeightIn&&fontWeightIn!==fontWeight&&(sprite.fontWeight=fontWeightIn,fontWeight=fontWeightIn)},this.setText=textIn=>{textIn&&textIn!==sprite.text&&(sprite.text=textIn,text=textIn)},this.setVisibility=flag=>{sprite.visible=flag},this.dispose=()=>{//sprite.dispose();
679
- },this.getSprite=()=>sprite,this.getString=()=>text};
680
-
681
- /***/ }),
682
- /* 18 */
683
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
684
-
685
- var THREE=__webpack_require__(4),JSONLoader=(__webpack_require__(19).JSONLoader),Glyphset=function(){(__webpack_require__(10).ZincObject).call(this);var glyphList=[],axis1s=void 0,axis2s=void 0,axis3s=void 0,positions=void 0,scales=void 0,colors=void 0,labels=void 0,numberOfTimeSteps=0,numberOfVertices=0,baseSize=[0,0,0],offset=[0,0,0],scaleFactors=[0,0,0],repeat_mode="NONE";this.ready=!1;var morphColours=!1,morphVertices=!1;this.isGlyphset=!0;var _transformMatrix=new THREE.Matrix4,_bot_colour=new THREE.Color,_top_colour=new THREE.Color,_boundingBox1=new THREE.Box3,_boundingBox2=new THREE.Box3,_boundingBox3=new THREE.Box3,_points=[],_current_positions=[],_current_axis1s=[],_current_axis2s=[],_current_axis3s=[],_current_scales=[],_current_colors=[],_glyph_axis_array=[];this.globalScale=1;for(var i=0;8>i;i++)_points[i]=new THREE.Vector3;/**
686
- * Copy glyphset data into this glyphset then load the glyph's geoemtry
687
- * with the provided glyphURL. FinishCallback will be called once
688
- * glyph is loaded.
689
- *
690
- * @param {Array} glyphsetData - contains the informations about the glyphs.
691
- * @param {String} glyphURL - URL to the geometry which will be applied to all
692
- * all the glyphs in the glyphset once loaded.
693
- * @param {Function} finishCallback - User's function to be called once glyph's
694
- * geometry is loaded.
695
- */this.load=(glyphsetData,glyphURL,finishCallback,isInline,displayLabels)=>{axis1s=glyphsetData.axis1,axis2s=glyphsetData.axis2,axis3s=glyphsetData.axis3,positions=glyphsetData.positions,scales=glyphsetData.scale,colors=glyphsetData.colors,labels=glyphsetData.label,morphColours=glyphsetData.metadata.MorphColours,morphVertices=glyphsetData.metadata.MorphVertices,numberOfTimeSteps=glyphsetData.metadata.number_of_time_steps,repeat_mode=glyphsetData.metadata.repeat_mode,numberOfVertices=glyphsetData.metadata.number_of_vertices,"AXES_2D"==repeat_mode||"MIRROR"==repeat_mode?numberOfVertices*=2:"AXES_3D"==repeat_mode&&(numberOfVertices*=3),baseSize=glyphsetData.metadata.base_size,offset=glyphsetData.metadata.offset,scaleFactors=glyphsetData.metadata.scale_factors;var loader=new JSONLoader;this.geometry=new THREE.BufferGeometry;var instancedMesh=new THREE.InstancedMesh(this.geometry,void 0,numberOfVertices);if(this.setMorph(instancedMesh),isInline){var object=loader.parse(glyphURL);meshloader(finishCallback,displayLabels)(object.geometry,object.materials),object.geometry.dispose()}else loader.crossOrigin="Anonymous",loader.load(glyphURL,meshloader(finishCallback,displayLabels));};/**
696
- * Calculate the actual transformation value that can be applied
697
- * to the transformation matrix.
698
- *
699
- * @returns {Array}
700
- */var resolve_glyph_axes=(point,axis1,axis2,axis3,scale,return_arrays)=>{if("NONE"==repeat_mode||"MIRROR"==repeat_mode){for(var sign,axis_scale=[0,0,0],final_axis1=[0,0,0],final_axis2=[0,0,0],final_axis3=[0,0,0],final_point=[0,0,0],mirrored_axis1=[0,0,0],mirrored_axis2=[0,0,0],mirrored_axis3=[0,0,0],mirrored_point=[0,0,0],j=0;3>j;j++)sign=0>scale[j]?-1:1,axis_scale[j]=(sign*baseSize[j]+scale[j]*scaleFactors[j])*this.globalScale;for(var j=0;3>j;j++)final_axis1[j]=axis1[j]*axis_scale[0],final_axis2[j]=axis2[j]*axis_scale[1],final_axis3[j]=axis3[j]*axis_scale[2],final_point[j]=point[j]+offset[0]*final_axis1[j]+offset[1]*final_axis2[j]+offset[2]*final_axis3[j],"MIRROR"==repeat_mode&&(mirrored_axis1[j]=-final_axis1[j],mirrored_axis2[j]=-final_axis2[j],mirrored_axis3[j]=-final_axis3[j],mirrored_point[j]=final_point[j],0>scale[0]&&(final_point[j]-=final_axis1[j],mirrored_point[j]-=mirrored_axis1[j]));/* if required, reverse axis3 to maintain right-handed coordinate system */0>final_axis3[0]*(final_axis1[1]*final_axis2[2]-final_axis1[2]*final_axis2[1])+final_axis3[1]*(final_axis1[2]*final_axis2[0]-final_axis1[0]*final_axis2[2])+final_axis3[2]*(final_axis1[0]*final_axis2[1]-final_axis1[1]*final_axis2[0])&&(final_axis3[0]=-final_axis3[0],final_axis3[1]=-final_axis3[1],final_axis3[2]=-final_axis3[2]),return_arrays[0]=[final_point,final_axis1,final_axis2,final_axis3],"MIRROR"==repeat_mode&&(0>mirrored_axis3[0]*(mirrored_axis1[1]*mirrored_axis2[2]-mirrored_axis1[2]*mirrored_axis2[1])+mirrored_axis3[1]*(mirrored_axis1[2]*mirrored_axis2[0]-mirrored_axis1[0]*mirrored_axis2[2])+mirrored_axis3[2]*(mirrored_axis1[0]*mirrored_axis2[1]-mirrored_axis1[1]*mirrored_axis2[0])&&(mirrored_axis3[0]=-mirrored_axis3[0],mirrored_axis3[1]=-mirrored_axis3[1],mirrored_axis3[2]=-mirrored_axis3[2]),return_arrays[1]=[mirrored_point,mirrored_axis1,mirrored_axis2,mirrored_axis3])}else if("AXES_2D"==repeat_mode||"AXES_3D"==repeat_mode){for(var sign,_axis_scale=[0,0,0],_final_point=[0,0,0],j=0;3>j;j++)sign=0>scale[j]?-1:1,_axis_scale[j]=(sign*baseSize[0]+scale[j]*scaleFactors[0])*this.globalScale;for(var j=0;3>j;j++)_final_point[j]=point[j]+offset[0]*_axis_scale[0]*axis1[j]+offset[1]*_axis_scale[1]*axis2[j]+offset[2]*_axis_scale[2]*axis3[j];for(var number_of_glyphs="AXES_2D"==glyph_repeat_mode?2:3,k=0;k<number_of_glyphs;k++){var use_axis1=void 0,use_axis2=void 0,use_scale=scale[k],_final_axis=[0,0,0],_final_axis2=[0,0,0],_final_axis3=[0,0,0];0==k?(use_axis1=axis1,use_axis2=axis2):1==k?(use_axis1=axis2,use_axis2="AXES_2D"==glyph_repeat_mode?axis1:axis3):(use_axis1=axis3,use_axis2=axis1);var final_scale1=(baseSize[0]+use_scale*scaleFactors[0])*this.globalScale;_final_axis[0]=use_axis1[0]*final_scale1,_final_axis[1]=use_axis1[1]*final_scale1,_final_axis[2]=use_axis1[2]*final_scale1,_final_axis3[0]=_final_axis[1]*use_axis2[2]-use_axis2[1]*_final_axis[2],_final_axis3[1]=_final_axis[2]*use_axis2[0]-use_axis2[2]*_final_axis[0],_final_axis3[2]=_final_axis[0]*use_axis2[1]-_final_axis[1]*use_axis2[0];var magnitude=Math.sqrt(_final_axis3[0]*_final_axis3[0]+_final_axis3[1]*_final_axis3[1]+_final_axis3[2]*_final_axis3[2]);if(0<magnitude){var _scaling=(baseSize[2]+use_scale*scaleFactors[2])*this.globalScale/magnitude;"AXES_2D"==repeat_mode&&0<k&&(_scaling*=-1),_final_axis3[0]*=_scaling,_final_axis3[1]*=_scaling,_final_axis3[2]*=_scaling}if(_final_axis2[0]=_final_axis3[1]*_final_axis[2]-_final_axis[1]*_final_axis3[2],_final_axis2[1]=_final_axis3[2]*_final_axis[0]-_final_axis[2]*_final_axis3[0],_final_axis2[2]=_final_axis3[0]*_final_axis[1]-_final_axis3[1]*_final_axis[0],magnitude=Math.sqrt(_final_axis2[0]*_final_axis2[0]+_final_axis2[1]*_final_axis2[1]+_final_axis2[2]*_final_axis2[2]),0<magnitude){var scaling=(baseSize[1]+use_scale*scaleFactors[1])*this.globalScale/magnitude;_final_axis2[0]*=scaling,_final_axis2[1]*=scaling,_final_axis2[2]*=scaling}return_arrays[k]=[_final_point,_final_axis,_final_axis2,_final_axis3]}}return return_arrays;},updateGlyphsetTransformation=(current_positions,current_axis1s,current_axis2s,current_axis3s,current_scales)=>{var numberOfGlyphs=1;"AXES_2D"==repeat_mode||"MIRROR"==repeat_mode?numberOfGlyphs=2:"AXES_3D"==repeat_mode&&(numberOfGlyphs=3);var numberOfPositions=current_positions.length/3,current_glyph_index=0;_glyph_axis_array.length=numberOfGlyphs;for(var _i=0;_i<numberOfPositions;_i++){var current_index=3*_i,current_position=[current_positions[current_index],current_positions[current_index+1],current_positions[current_index+2]],current_axis1=[current_axis1s[current_index],current_axis1s[current_index+1],current_axis1s[current_index+2]],current_axis2=[current_axis2s[current_index],current_axis2s[current_index+1],current_axis2s[current_index+2]],current_axis3=[current_axis3s[current_index],current_axis3s[current_index+1],current_axis3s[current_index+2]],current_scale=[current_scales[current_index],current_scales[current_index+1],current_scales[current_index+2]],arrays=resolve_glyph_axes(current_position,current_axis1,current_axis2,current_axis3,current_scale,_glyph_axis_array);if(arrays.length==numberOfGlyphs)for(var j=0;j<numberOfGlyphs;j++){_transformMatrix.elements[0]=arrays[j][1][0],_transformMatrix.elements[1]=arrays[j][1][1],_transformMatrix.elements[2]=arrays[j][1][2],_transformMatrix.elements[3]=0,_transformMatrix.elements[4]=arrays[j][2][0],_transformMatrix.elements[5]=arrays[j][2][1],_transformMatrix.elements[6]=arrays[j][2][2],_transformMatrix.elements[7]=0,_transformMatrix.elements[8]=arrays[j][3][0],_transformMatrix.elements[9]=arrays[j][3][1],_transformMatrix.elements[10]=arrays[j][3][2],_transformMatrix.elements[11]=0,_transformMatrix.elements[12]=arrays[j][0][0],_transformMatrix.elements[13]=arrays[j][0][1],_transformMatrix.elements[14]=arrays[j][0][2],_transformMatrix.elements[15]=1,this.morph.setMatrixAt(current_glyph_index,_transformMatrix);var glyph=glyphList[current_glyph_index];glyph&&glyph.setTransformation(arrays[j][0],arrays[j][1],arrays[j][2],arrays[j][3]),current_glyph_index++}}this.morph.instanceMatrix.needsUpdate=!0},updateGlyphsetHexColors=current_colors=>{var numberOfGlyphs=1;"AXES_2D"==repeat_mode||"MIRROR"==repeat_mode?numberOfGlyphs=2:"AXES_3D"==repeat_mode&&(numberOfGlyphs=3);for(var hex_values,numberOfColours=current_colors.length,current_glyph_index=0,_i2=0;_i2<numberOfColours;_i2++){hex_values=current_colors[_i2];for(var j=0;j<numberOfGlyphs;j++){_bot_colour.setHex(hex_values),this.morph.setColorAt(current_glyph_index,_bot_colour);var glyph=glyphList[current_glyph_index];glyph&&glyph.setColour(_bot_colour),current_glyph_index++}}this.morph.instanceColor.needsUpdate=!0},updateMorphGlyphsets=()=>{var current_positions=_current_positions,current_axis1s=_current_axis1s,current_axis2s=_current_axis2s,current_axis3s=_current_axis3s,current_scales=_current_scales,current_colors=_current_colors,current_time=this.inbuildTime/this.duration*(numberOfTimeSteps-1),bottom_frame=Math.floor(current_time),proportion=1-(current_time-bottom_frame),top_frame=Math.ceil(current_time);if(morphVertices){var bottom_positions=positions[bottom_frame.toString()],top_positions=positions[top_frame.toString()],bottom_axis1=axis1s[bottom_frame.toString()],top_axis1=axis1s[top_frame.toString()],bottom_axis2=axis2s[bottom_frame.toString()],top_axis2=axis2s[top_frame.toString()],bottom_axis3=axis3s[bottom_frame.toString()],top_axis3=axis3s[top_frame.toString()],bottom_scale=scales[bottom_frame.toString()],top_scale=scales[top_frame.toString()];_current_positions.length=bottom_positions.length,_current_axis1s.length=bottom_positions.length,_current_axis2s.length=bottom_positions.length,_current_axis3s.length=bottom_positions.length,_current_scales.length=bottom_positions.length;for(var _i3=0;_i3<bottom_positions.length;_i3++)current_positions[_i3]=proportion*bottom_positions[_i3]+(1-proportion)*top_positions[_i3],current_axis1s[_i3]=proportion*bottom_axis1[_i3]+(1-proportion)*top_axis1[_i3],current_axis2s[_i3]=proportion*bottom_axis2[_i3]+(1-proportion)*top_axis2[_i3],current_axis3s[_i3]=proportion*bottom_axis3[_i3]+(1-proportion)*top_axis3[_i3],current_scales[_i3]=proportion*bottom_scale[_i3]+(1-proportion)*top_scale[_i3];}else current_positions=positions[0],current_axis1s=axis1s[0],current_axis2s=axis2s[0],current_axis3s=axis3s[0],current_scales=scales[0];if(updateGlyphsetTransformation(current_positions,current_axis1s,current_axis2s,current_axis3s,current_scales),this.boundingBoxUpdateRequired=!0,null!=colors){if(morphColours){var bottom_colors=colors[bottom_frame.toString()],top_colors=colors[top_frame.toString()];current_colors.length=bottom_colors.length;for(var _i4=0;_i4<bottom_colors.length;_i4++)_bot_colour.setHex(bottom_colors[_i4]),_top_colour.setHex(top_colors[_i4]),_bot_colour.setRGB(_bot_colour.r*proportion+_top_colour.r*(1-proportion),_bot_colour.g*proportion+_top_colour.g*(1-proportion),_bot_colour.b*proportion+_top_colour.b*(1-proportion)),current_colors[_i4]=_bot_colour.getHex();/*
701
- for (var i = 0; i < bottom_colors.length; i++) {
702
- current_colors.push(proportion * bottom_colors[i] + (1.0 - proportion) * top_colors[i]);
703
- }
704
- */}else current_colors=colors[0];updateGlyphsetHexColors(current_colors)}};/**
705
- * Update transformation for each of the glyph in this glyphset.
706
- *//**
707
- * Update colour for each of the glyph in this glyphset.
708
- *//**
709
- * Update the current states of the glyphs in this glyphset, this includes transformation and
710
- * colour for each of them. This is called when glyphset and glyphs are initialised and whenever
711
- * the internal time has been updated.
712
- *//**
713
- * Get the assigned label for instance at index
714
- */this.getLabel=index=>labels&&labels.length>index?labels[index]:void 0,this.showLabel=()=>{for(var _i5=0;_i5<glyphList.length;_i5++)glyphList[_i5].showLabel(this.morph.material?this.morph.material.color:void 0);},this.hideLabel=()=>{for(var _i6=0;_i6<glyphList.length;_i6++)glyphList[_i6].hideLabel();};/**
715
- * Create the glyphs in the glyphset.
716
- *
717
- * @param {Boolean} displayLabels -Flag to determine either the labels should be display or not.
718
- */var createGlyphs=displayLabels=>{for(var _i7=0;_i7<numberOfVertices;_i7++){var glyph=new((__webpack_require__(16).Glyph))(void 0,void 0,_i7,this),label=labels?labels[_i7]:void 0;label=label?label:this.groupName,label&&glyph.setLabel(label),0<numberOfTimeSteps&&glyph.setFrustumCulled(!1),glyphList[_i7]=glyph,this.morph.add(glyph.getGroup())}//Update the transformation of the glyphs.
719
- displayLabels&&this.showLabel(),updateGlyphsetTransformation(positions[0],axis1s[0],axis2s[0],axis3s[0],scales[0]),colors!=null&&updateGlyphsetHexColors(colors[0]),this.ready=!0,this.boundingBoxUpdateRequired=!0};/**
720
- * Add a custom {@link Glyph} to this {@link Glyphset}.
721
- *
722
- * @param {Glyph} Glyph to be added.
723
- */this.addCustomGlyph=glyph=>{glyph.isGlyph&&glyphList.push(glyph),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(mesh,id)=>{if(mesh.isMesh){var glyph=new((__webpack_require__(16).Glyph))(void 0,void 0,id,this);return glyph.fromMesh(mesh),glyphList.push(glyph),this.morph.add(glyph.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,glyph;}},this.forEachGlyph=callbackFunction=>{for(var _i8=0;_i8<glyphList.length;_i8++)callbackFunction(glyphList[_i8]);};var meshloader=(finishCallback,displayLabels)=>(geometry,materials)=>{var tempGeometry=geometry.toBufferGeometry();this.geometry.copy(tempGeometry),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),tempGeometry.dispose(),materials&&materials[0]&&(this.morph.material=materials[0]),createGlyphs(displayLabels),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),geometry.dispose(),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(this)};/**
724
- * Get the index of the closest vertex to centroid.
725
- *//**
726
- * Get the closest vertex to centroid.
727
- *//**
728
- * Get the bounding box for the whole set of glyphs.
729
- *
730
- * @return {Three.Box3};
731
- *//**
732
- * Set the local time of this glyphset.
733
- *
734
- * @param {Number} time - Can be any value between 0 to duration.
735
- *//**
736
- * Check if the glyphset is time varying.
737
- *
738
- * @return {Boolean}
739
- *//**
740
- * Get the current inbuild time of the
741
- *
742
- * @return {Number}
743
- *//**
744
- * Set the objects scale.
745
- *
746
- * @return {THREE.Box3}.
747
- *//**
748
- * Clear this glyphset and its list of glyphs which will release them from the memory.
749
- *//**
750
- * Update the glyphsets if required the render.
751
- */this.getClosestVertexIndex=function(){var closestIndex=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);for(var current_index,current_positions=positions[0],numberOfPositions=current_positions.length/3,distance=-1,currentDistance=0,_i9=0;_i9<numberOfPositions;_i9++)current_index=3*_i9,this._v2.set(current_positions[current_index],current_positions[current_index+1],current_positions[current_index+2]),currentDistance=this._v1.distanceTo(this._v2),-1==distance?(distance=currentDistance,closestIndex=_i9):distance>currentDistance&&(distance=currentDistance,closestIndex=_i9);}return closestIndex;},this.getClosestVertex=function(){if(-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex()),0<=this.closestVertexIndex&&this.morph)/*
752
- if (glyphList && glyphList[this.closestVertexIndex]) {
753
- glyphList[this.closestVertexIndex].getBoundingBox().getCenter(position);
754
- }
755
- */{var position=new THREE.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,_transformMatrix),position.setFromMatrixPosition(_transformMatrix),position;}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){_boundingBox1.setFromBufferAttribute(this.morph.geometry.attributes.position);for(var _i0=0;_i0<numberOfVertices;_i0++)this.morph.getMatrixAt(_i0,_transformMatrix),_boundingBox2.copy(_boundingBox1).applyMatrix4(_transformMatrix),0==_i0?_boundingBox3.copy(_boundingBox2):_boundingBox3.union(_boundingBox2);if(_boundingBox3)this.cachedBoundingBox.copy(_boundingBox3),this.morph.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1;else return;}return this.cachedBoundingBox;}},this.setMorphTime=time=>{this.inbuildTime=time>this.duration?this.duration:0>time?0:time,(morphColours||morphVertices)&&(updateMorphGlyphsets(),morphVertices&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!!((!1===this.ready||0<numberOfTimeSteps)&&(morphColours||morphVertices)),this.getCurrentTime=()=>this.inbuildTime,this.setScaleAll=function(scale){this.globalScale=scale,updateMorphGlyphsets()},this.dispose=()=>{for(var _i1=glyphList.length-1;0<=_i1;_i1--)glyphList[_i1].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),axis1s=void 0,axis2s=void 0,axis3s=void 0,positions=void 0,scales=void 0,colors=void 0,this.ready=!1,this.groupName=void 0},this.render=(delta,playAnimation,options)=>{if(!0==playAnimation){var targetTime=this.inbuildTime+delta;targetTime>this.duration&&(targetTime-=this.duration),this.inbuildTime=targetTime,(morphColours||morphVertices)&&updateMorphGlyphsets()}this.updateMarker(playAnimation,options)}};/**
756
- * This is a container of {@link Glyph} and their graphical properties
757
- * including transformations, colors, number of time steps, duration of animations
758
- * and group name. Please note that all glyphs in the glyphset share the same geometry
759
- * however they may have different transformations.
760
- *
761
- * @class
762
- * @author Alan Wu
763
- * @return {Glyphset}
764
- */Glyphset.prototype=Object.create((__webpack_require__(10).ZincObject).prototype),exports.Glyphset=Glyphset;
765
-
766
- /***/ }),
767
- /* 19 */
768
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
769
-
770
- "use strict";
771
- __webpack_require__.r(__webpack_exports__);
772
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
773
- /* harmony export */ JSONLoader: () => (/* binding */ JSONLoader)
774
- /* harmony export */ });
775
- var THREE=__webpack_require__(4),Loader=(__webpack_require__(20).Loader),LoaderUtils=THREE.LoaderUtils,AnimationClip=THREE.AnimationClip,Vector3=THREE.Vector3,Vector4=THREE.Vector4,Color=THREE.Color,Vector2=THREE.Vector2,Face3=(__webpack_require__(6).Face3),Geometry=(__webpack_require__(6).Geometry),FileLoader=THREE.FileLoader,DefaultLoadingManager=THREE.DefaultLoadingManager,VideoHandler=(__webpack_require__(21).VideoHandler);/**
776
- * @author mrdoob / http://mrdoob.com/
777
- * @author alteredq / http://alteredqualia.com/
778
- */function JSONLoader(manager){"boolean"==typeof manager&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),manager=void 0),this.manager=manager===void 0?DefaultLoadingManager:manager,this.withCredentials=!1,this.paramsString=""}Object.assign(JSONLoader.prototype,{load:function load(url,onLoad,onProgress,onError){var scope=this,texturePath=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:LoaderUtils.extractUrlBase(url),loader=new FileLoader(this.manager),params=url.split("?");//There are parameters, add them to the target
779
- this.paramsString=2===url.length?paramsStrings[1]:"",loader.setWithCredentials(this.withCredentials),loader.load(url,function(text){var json;try{json=JSON.parse(text)}catch(e){if(console.error("The loader has encountered an error while parsing the content of a resource."),onError)return void onError({responseURL:url});}var metadata=json.metadata;if(metadata!==void 0){var type=metadata.type;if(type!==void 0&&"object"===type.toLowerCase())return void console.error("THREE.JSONLoader: "+url+" should be loaded with THREE.ObjectLoader instead.");}if(scope&&scope.parse)try{var object=scope.parse(json,texturePath);onLoad(object.geometry,object.materials)}catch(e){if(console.error("The loader has encountered aon loading the geometry"),console.error(e),onError)return void onError({responseURL:url});}},onProgress,onError)},setTexturePath:function setTexturePath(value){this.texturePath=value},parse:function(){function parseModel(json,geometry){function isBitSet(value,position){return value&1<<position;}var i,j,fi,offset,zLength,colorIndex,normalIndex,uvIndex,materialIndex,type,isQuad,hasMaterial,hasFaceVertexUv,hasFaceNormal,hasFaceVertexNormal,hasFaceColor,hasFaceVertexColor,vertex,face,faceA,faceB,hex,normal,uvLayer,uv,u,v,faces=json.faces,vertices=json.vertices,normals=json.normals,colors=json.colors,scale=json.scale,nUvLayers=0;if(void 0!==json.uvs){// disregard empty arrays
780
- for(i=0;i<json.uvs.length;i++)json.uvs[i].length&&nUvLayers++;for(i=0;i<nUvLayers;i++)geometry.faceVertexUvs[i]=[];}for(offset=0,zLength=vertices.length;offset<zLength;)vertex=new Vector3,vertex.x=vertices[offset++]*scale,vertex.y=vertices[offset++]*scale,vertex.z=vertices[offset++]*scale,geometry.vertices.push(vertex);if(offset=0,zLength=faces.length,json.uvs)for(i=0;i<json.uvs.length;i++){geometry.uvs[i]=[];for(var k=0;k<json.uvs[i].length;k++)geometry.uvs[i][k]=json.uvs[i][k];}if(normals)for(i=0;i<normals.length;i++)geometry.normals[i]=normals[i];if(colors)for(i=0;i<colors.length;i++)geometry.colors[i]=colors[i];for(;offset<zLength;)// console.log("type", type, "bits", isQuad, hasMaterial, hasFaceVertexUv, hasFaceNormal, hasFaceVertexNormal, hasFaceColor, hasFaceVertexColor);
781
- if(type=faces[offset++],isQuad=isBitSet(type,0),hasMaterial=isBitSet(type,1),hasFaceVertexUv=isBitSet(type,3),hasFaceNormal=isBitSet(type,4),hasFaceVertexNormal=isBitSet(type,5),hasFaceColor=isBitSet(type,6),hasFaceVertexColor=isBitSet(type,7),isQuad){if(faceA=new Face3,faceA.a=faces[offset],faceA.b=faces[offset+1],faceA.c=faces[offset+3],faceB=new Face3,faceB.a=faces[offset+1],faceB.b=faces[offset+2],faceB.c=faces[offset+3],offset+=4,hasMaterial&&(materialIndex=faces[offset++],faceA.materialIndex=materialIndex,faceB.materialIndex=materialIndex),fi=geometry.faces.length,hasFaceVertexUv)for(i=0;i<nUvLayers;i++)for(uvLayer=json.uvs[i],geometry.faceVertexUvs[i][fi]=[],geometry.faceVertexUvs[i][fi+1]=[],j=0;4>j;j++)uvIndex=faces[offset++],u=uvLayer[2*uvIndex],v=uvLayer[2*uvIndex+1],uv=new Vector2(u,v),2!==j&&geometry.faceVertexUvs[i][fi].push(uv),0!==j&&geometry.faceVertexUvs[i][fi+1].push(uv);if(hasFaceNormal&&(normalIndex=3*faces[offset++],faceA.normal.set(normals[normalIndex++],normals[normalIndex++],normals[normalIndex]),faceB.normal.copy(faceA.normal)),hasFaceVertexNormal)for(i=0;4>i;i++)normalIndex=3*faces[offset++],normal=new Vector3(normals[normalIndex++],normals[normalIndex++],normals[normalIndex]),2!==i&&faceA.vertexNormals.push(normal),0!==i&&faceB.vertexNormals.push(normal);if(hasFaceColor&&(colorIndex=faces[offset++],hex=colors[colorIndex],faceA.color.setHex(hex),faceB.color.setHex(hex)),hasFaceVertexColor)for(i=0;4>i;i++)colorIndex=faces[offset++],hex=colors[colorIndex],2!==i&&faceA.vertexColors.push(new Color(hex)),0!==i&&faceB.vertexColors.push(new Color(hex));geometry.faces.push(faceA),geometry.faces.push(faceB)}else{if(face=new Face3,face.a=faces[offset++],face.b=faces[offset++],face.c=faces[offset++],face.b||(face.b=face.a),face.c||(face.c=face.b),hasMaterial&&(materialIndex=faces[offset++],face.materialIndex=materialIndex),fi=geometry.faces.length,hasFaceVertexUv)for(i=0;i<nUvLayers;i++)for(uvLayer=json.uvs[i],geometry.faceVertexUvs[i][fi]=[],j=0;3>j;j++)uvIndex=faces[offset++],u=uvLayer[2*uvIndex],v=uvLayer[2*uvIndex+1],uv=new Vector2(u,v),geometry.faceVertexUvs[i][fi].push(uv);if(hasFaceNormal&&(normalIndex=3*faces[offset++],face.normal.set(normals[normalIndex++],normals[normalIndex++],normals[normalIndex])),hasFaceVertexNormal)for(i=0;3>i;i++)normalIndex=3*faces[offset++],normal=new Vector3(normals[normalIndex++],normals[normalIndex++],normals[normalIndex]),face.vertexNormals.push(normal);if(hasFaceColor&&(colorIndex=faces[offset++],face.color.setHex(colors[colorIndex])),hasFaceVertexColor)for(i=0;3>i;i++)colorIndex=faces[offset++],face.vertexColors.push(new Color(colors[colorIndex]));geometry.faces.push(face)}}function parseSkin(json,geometry){var influencesPerVertex=json.influencesPerVertex===void 0?2:json.influencesPerVertex;if(json.skinWeights)for(var i=0,l=json.skinWeights.length;i<l;i+=influencesPerVertex){var x=json.skinWeights[i],y=1<influencesPerVertex?json.skinWeights[i+1]:0,z=2<influencesPerVertex?json.skinWeights[i+2]:0,w=3<influencesPerVertex?json.skinWeights[i+3]:0;geometry.skinWeights.push(new Vector4(x,y,z,w))}if(json.skinIndices)for(var i=0,l=json.skinIndices.length;i<l;i+=influencesPerVertex){var a=json.skinIndices[i],b=1<influencesPerVertex?json.skinIndices[i+1]:0,c=2<influencesPerVertex?json.skinIndices[i+2]:0,d=3<influencesPerVertex?json.skinIndices[i+3]:0;geometry.skinIndices.push(new Vector4(a,b,c,d))}geometry.bones=json.bones,geometry.bones&&0<geometry.bones.length&&(geometry.skinWeights.length!==geometry.skinIndices.length||geometry.skinIndices.length!==geometry.vertices.length)&&console.warn("When skinning, number of vertices ("+geometry.vertices.length+"), skinIndices ("+geometry.skinIndices.length+"), and skinWeights ("+geometry.skinWeights.length+") should match.")}function parseMorphing(json,geometry){var scale=json.scale;if(json.morphTargets!==void 0)for(var i=0,l=json.morphTargets.length;i<l;i++){geometry.morphTargets[i]={},geometry.morphTargets[i].name=json.morphTargets[i].name,geometry.morphTargets[i].vertices=[];for(var vertex,dstVertices=geometry.morphTargets[i].vertices,srcVertices=json.morphTargets[i].vertices,v=0,vl=srcVertices.length;v<vl;v+=3)vertex=new Vector3,vertex.x=srcVertices[v]*scale,vertex.y=srcVertices[v+1]*scale,vertex.z=srcVertices[v+2]*scale,dstVertices.push(vertex);}if(void 0!==json.morphNormals)for(var i=0,l=json.morphNormals.length;i<l;i++)if(geometry.morphTargets[i]){geometry.morphTargets[i].normals=[];for(var normals,dstNormals=geometry.morphTargets[i].normals,srcNormals=json.morphNormals[i].normals,v=0,vl=srcNormals.length;v<vl;v+=3)normals=new Vector3,normals.x=srcNormals[v],normals.y=srcNormals[v+1],normals.z=srcNormals[v+2],dstNormals.push(normals);geometry.morphNormalsReady=!0}if(void 0!==json.morphColors){var i,l,c,cl,dstColors,srcColors,color;for(i=0,l=json.morphColors.length;i<l;i++)for(geometry.morphColors[i]={},geometry.morphColors[i].name=json.morphColors[i].name,geometry.morphColors[i].colors=[],dstColors=geometry.morphColors[i].colors,srcColors=json.morphColors[i].colors,c=0,cl=srcColors.length;c<cl;c+=3)color=new THREE.Color(16755200),color.setRGB(srcColors[c],srcColors[c+1],srcColors[c+2]),dstColors.push(color);}}function parseAnimations(json,geometry){var outputAnimations=[],animations=[];// parse old style Bone/Hierarchy animations
782
- json.animation!==void 0&&animations.push(json.animation),json.animations!==void 0&&(json.animations.length?animations=animations.concat(json.animations):animations.push(json.animations));for(var clip,i=0;i<animations.length;i++)clip=AnimationClip.parseAnimation(animations[i],geometry.bones),clip&&outputAnimations.push(clip);// parse implicit morph animations
783
- if(geometry.morphTargets){// TODO: Figure out what an appropraite FPS is for morph target animations -- defaulting to 10, but really it is completely arbitrary.
784
- var morphAnimationClips=AnimationClip.CreateClipsFromMorphTargetSequences(geometry.morphTargets,10);outputAnimations=outputAnimations.concat(morphAnimationClips)}0<outputAnimations.length&&(geometry.animations=outputAnimations)}return function(json,texturePath){void 0!==json.data&&(json=json.data),json.scale=void 0===json.scale?1:1/json.scale;var geometry=new Geometry;if(geometry.morphColors=[],parseModel(json,geometry),parseSkin(json,geometry),parseMorphing(json,geometry),parseAnimations(json,geometry),geometry.computeFaceNormals(),geometry.computeBoundingSphere(),void 0===json.materials||0===json.materials.length)return{geometry:geometry};var materials=Loader.prototype.initMaterials(json.materials,texturePath,"Anonymous");if(json.materials[0].video){var fullPath=texturePath+json.materials[0].video;this.paramsString&&(fullPath+="?".concat(this.paramsString));var videoHandler=new VideoHandler(fullPath);geometry._video=videoHandler}return materials&&0<materials.length&&(materials[0].side=json.materials[0].singleSided?THREE.FrontSide:json.materials[0].flipSided?THREE.BackSide:THREE.DoubleSide,json.materials[0].specularCoef&&(materials[0].shininess=Math.floor(json.materials[0].specularCoef/3))),{geometry:geometry,materials:materials};};}()});
785
-
786
- /***/ }),
787
- /* 20 */
788
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
789
-
790
- "use strict";
791
- __webpack_require__.r(__webpack_exports__);
792
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
793
- /* harmony export */ Loader: () => (/* binding */ Loader)
794
- /* harmony export */ });
795
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
796
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_0__);
797
- var THREE=__webpack_require__(4);/**
798
- * @author alteredq / http://alteredqualia.com/
799
- */function Loader(){}Loader.Handlers={handlers:[],add:function add(regex,loader){this.handlers.push(regex,loader)},get:function get(file){for(var handlers=this.handlers,i=0,l=handlers.length;i<l;i+=2){var regex=handlers[i],loader=handlers[i+1];if(regex.test(file))return loader;}return null;}},Object.assign(Loader.prototype,{crossOrigin:"anonymous",onLoadStart:function onLoadStart(){},onLoadProgress:function onLoadProgress(){},onLoadComplete:function onLoadComplete(){},initMaterials:function initMaterials(materials,texturePath,crossOrigin){for(var array=[],i=0;i<materials.length;++i)array[i]=this.createMaterial(materials[i],texturePath,crossOrigin);return array;},createMaterial:function(){var BlendingMode={NoBlending:three__WEBPACK_IMPORTED_MODULE_0__.NoBlending,NormalBlending:three__WEBPACK_IMPORTED_MODULE_0__.NormalBlending,AdditiveBlending:three__WEBPACK_IMPORTED_MODULE_0__.AdditiveBlending,SubtractiveBlending:three__WEBPACK_IMPORTED_MODULE_0__.SubtractiveBlending,MultiplyBlending:three__WEBPACK_IMPORTED_MODULE_0__.MultiplyBlending,CustomBlending:three__WEBPACK_IMPORTED_MODULE_0__.CustomBlending},color=new three__WEBPACK_IMPORTED_MODULE_0__.Color,textureLoader=new three__WEBPACK_IMPORTED_MODULE_0__.TextureLoader,materialLoader=new three__WEBPACK_IMPORTED_MODULE_0__.MaterialLoader;return function(m,texturePath,crossOrigin){function loadTexture(path,repeat,offset,wrap,anisotropy){var texture,fullPath=texturePath+path,loader=Loader.Handlers.get(fullPath);null===loader?(textureLoader.setCrossOrigin(crossOrigin),texture=textureLoader.load(fullPath)):texture=loader.load(fullPath),void 0!==repeat&&(texture.repeat.fromArray(repeat),1!==repeat[0]&&(texture.wrapS=three__WEBPACK_IMPORTED_MODULE_0__.RepeatWrapping),1!==repeat[1]&&(texture.wrapT=three__WEBPACK_IMPORTED_MODULE_0__.RepeatWrapping)),void 0!==offset&&texture.offset.fromArray(offset),void 0!==wrap&&("repeat"===wrap[0]&&(texture.wrapS=three__WEBPACK_IMPORTED_MODULE_0__.RepeatWrapping),"mirror"===wrap[0]&&(texture.wrapS=three__WEBPACK_IMPORTED_MODULE_0__.MirroredRepeatWrapping),"repeat"===wrap[1]&&(texture.wrapT=three__WEBPACK_IMPORTED_MODULE_0__.RepeatWrapping),"mirror"===wrap[1]&&(texture.wrapT=three__WEBPACK_IMPORTED_MODULE_0__.MirroredRepeatWrapping)),void 0!==anisotropy&&(texture.anisotropy=anisotropy);var uuid=three__WEBPACK_IMPORTED_MODULE_0__.MathUtils.generateUUID();return textures[uuid]=texture,uuid;}//
800
- // convert from old material format
801
- var textures={},json={uuid:three__WEBPACK_IMPORTED_MODULE_0__.MathUtils.generateUUID(),type:"MeshLambertMaterial"};for(var name in m){var value=m[name];switch(name){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":json.name=value;break;case"blending":json.blending=BlendingMode[value];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",name,"is no longer supported.");break;case"colorDiffuse":json.color=color.fromArray(value).getHex();break;case"colorSpecular":json.specular=color.fromArray(value).getHex();break;case"colorEmissive":json.emissive=color.fromArray(value).getHex();break;case"specularCoef":json.shininess=value;break;case"shading":"basic"===value.toLowerCase()&&(json.type="MeshBasicMaterial"),"phong"===value.toLowerCase()&&(json.type="MeshPhongMaterial"),"standard"===value.toLowerCase()&&(json.type="MeshStandardMaterial");break;case"mapDiffuse":json.map=loadTexture(value,m.mapDiffuseRepeat,m.mapDiffuseOffset,m.mapDiffuseWrap,m.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":json.emissiveMap=loadTexture(value,m.mapEmissiveRepeat,m.mapEmissiveOffset,m.mapEmissiveWrap,m.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":json.lightMap=loadTexture(value,m.mapLightRepeat,m.mapLightOffset,m.mapLightWrap,m.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":json.aoMap=loadTexture(value,m.mapAORepeat,m.mapAOOffset,m.mapAOWrap,m.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":json.bumpMap=loadTexture(value,m.mapBumpRepeat,m.mapBumpOffset,m.mapBumpWrap,m.mapBumpAnisotropy);break;case"mapBumpScale":json.bumpScale=value;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":json.normalMap=loadTexture(value,m.mapNormalRepeat,m.mapNormalOffset,m.mapNormalWrap,m.mapNormalAnisotropy);break;case"mapNormalFactor":json.normalScale=value;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":json.specularMap=loadTexture(value,m.mapSpecularRepeat,m.mapSpecularOffset,m.mapSpecularWrap,m.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":json.metalnessMap=loadTexture(value,m.mapMetalnessRepeat,m.mapMetalnessOffset,m.mapMetalnessWrap,m.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":json.roughnessMap=loadTexture(value,m.mapRoughnessRepeat,m.mapRoughnessOffset,m.mapRoughnessWrap,m.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":json.alphaMap=loadTexture(value,m.mapAlphaRepeat,m.mapAlphaOffset,m.mapAlphaWrap,m.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":json.side=three__WEBPACK_IMPORTED_MODULE_0__.BackSide;break;case"doubleSided":json.side=three__WEBPACK_IMPORTED_MODULE_0__.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),json.opacity=value;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":json[name]=value;break;case"vertexColors":!0===value&&(json.vertexColors=three__WEBPACK_IMPORTED_MODULE_0__.VertexColors),"face"===value&&(json.vertexColors=three__WEBPACK_IMPORTED_MODULE_0__.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",name,value);}}return"MeshBasicMaterial"===json.type&&delete json.emissive,"MeshPhongMaterial"!==json.type&&delete json.specular,1>json.opacity&&(json.transparent=!0),materialLoader.setTextures(textures),materialLoader.parse(json);};}()});
802
-
803
- /***/ }),
804
- /* 21 */
805
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
806
-
807
- var THREE=__webpack_require__(4);/**
808
- * Provide basic functionality to display video as texture.
809
- * VideoTexture is used for creating and updating a video projected onto a Three.js texture
810
- *
811
- * @class
812
- * @param {Object} containerIn - Container to create the renderer on.
813
- * @author Alan Wu
814
- * @return {VideoHandler}
815
- */exports.VideoHandler=function(srcIn){var _this=this;this.video=void 0,this.videoTexture=void 0;var lastPlayPos=0,currentPlayPos=0,bufferingDetected=!1;// videoPlaneLoaded connects the video to the video texture once it has loaded
816
- //this should be handle by scene... check the sync at
817
- this.setMorphTime=function(time,duration){var actualTime=time/duration*_this.video.duration;_this.video.currentTime=actualTime},this.getVideoDuration=function(){return _this.video.duration;},this.createCanvasVideoTexture=function(){return _this.videoTexture=new THREE.VideoTexture(_this.video),_this.videoTexture.minFilter=THREE.LinearFilter,_this.videoTexture.magFilter=THREE.LinearFilter,_this.videoTexture.format=THREE.RGBFormat,_this.video.currentTime=0,_this.videoTexture;},this.getCurrentTime=function(duration){return _this.video?duration*(_this.video.currentTime/_this.video.duration):0},this.isReadyToPlay=function(){// video.readyState 3 means we have data to load for the current time and foreseeable future
818
- return!!(_this.video&&3<=_this.video.readyState)},function initialise(){document&&(_this.video=document.createElement("video"),_this.video.crossOrigin="anonymous",_this.video.src=srcIn,_this.video.load(),_this.video.loop=!0)}()};
819
-
820
- /***/ }),
821
- /* 22 */
822
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
823
-
824
- var THREE=__webpack_require__(4),Points=(__webpack_require__(23).Points),toBufferGeometry=(__webpack_require__(5).toBufferGeometry),getCircularTexture=(__webpack_require__(5).getCircularTexture),Label=(__webpack_require__(17).Label),Pointset=function(){(__webpack_require__(10).ZincObject).call(this),this.isPointset=!0;var labelSets=[],labelSize=1,labelDepthTest=!1,fontWeight=500,labelVisibility=!0;/**
825
- * Create the pointsets using geometry and material.
826
- *
827
- * @param {THREE.Geomtry} geometryIn - Geometry of points to be rendered.
828
- * @param {THREE.Material} materialIn - Material to be set for the lines.
829
- * @param {Object} options - Provide various options
830
- * @param {Boolean} options.localTimeEnabled - A flag to indicate either the lines is
831
- * time dependent.
832
- * @param {Boolean} options.localMorphColour - A flag to indicate either the colour is
833
- * time dependent.
834
- */this.createMesh=(geometryIn,materialIn,options)=>{if(geometryIn&&materialIn){var geometry=toBufferGeometry(geometryIn,options),texture=getCircularTexture();materialIn.map=texture;var point=new Points(geometry,materialIn);this.setMesh(point,options.localTimeEnabled,options.localMorphColour)}};var addLabel=(index,coord,labelText,colourHex)=>{if(labelText){var colour=new THREE.Color(colourHex),label=new Label(labelText,colour);label.setPosition(coord[0],coord[1],coord[2]);var sprite=label.getSprite();sprite.material.sizeAttenuation=!1,sprite.material.alphaTest=.5,sprite.material.transparent=!0,sprite.material.depthWrite=!1,sprite.material.depthTest=labelDepthTest,label.setFontWeight(fontWeight),label.setSize(labelSize),label.setVisibility(labelVisibility),this.group.add(sprite),labelSets[index]=label}},removeLabel=index=>{var label=labelSets[index];if(label){var sprite=label.getSprite();this.group.remove(sprite),label.dispose(),labelSets.splice(index,1)}};/**
835
- * Add points to existing mesh if it exists, otherwise
836
- * create a new one and add to it.
837
- * @param {Array} coords -An array of three components coordinates.
838
- * @param {Array|String} labels - An array of strings, these are only added
839
- * if the number of coords equals to the number labels provided.
840
- * @param {Number} colour - A hex value of the colour for the points
841
- *//**
842
- * Set the colour of the pointset and its label using the hex value
843
- *
844
- * @param {Number} hex - hex value of color to be set
845
- *//**
846
- * Set the colour of the pointset and its label
847
- *
848
- * @param {THREE.Color} colour - colour to be set
849
- *//**
850
- * Turn size attenuation on/off based on the flag.
851
- *
852
- * @param {Boolean} flag - Determin either size attenuation
853
- * should be on or off.
854
- *//**
855
- * Turn size attenuation on/off based on the flag.
856
- *
857
- * @param {Number} fontWeightIn - Default value is 700
858
- *//**
859
- * Set the size of the label
860
- *
861
- * @param {Number} size - Size to set, default
862
- * value is 1.
863
- *//**
864
- * Set visibility of Labels
865
- *
866
- * @param {boolean} flag - default value is true
867
- *//**
868
- * Set the size of the points.
869
- *
870
- * @param {Number} size - size to be set.
871
- *//**
872
- * Turn size attenuation on/off based on the flag.
873
- *
874
- * @param {Boolean} flag - Determin either size attenuation
875
- * should be on or off.
876
- *//**
877
- * Get vertices at index
878
- *//**
879
- * Edit Vertice in index.
880
- *//**
881
- * Delete a vertex in index.
882
- *//**
883
- * Set the name for this ZincObject.
884
- *
885
- * @param {String} groupNameIn - Name to be set.
886
- *//**
887
- * Turn size attenuation on/off based on the flag.
888
- *
889
- * @param {Boolean} flag - Determin either size attenuation
890
- * should be on or off.
891
- */this.addPoints=(coords,labels,colour)=>{if(coords&&0<coords.length){var current=this.drawRange;-1===current&&(current=0);var geometry=this.addVertices(coords),mesh=this.getMorph();if(!mesh){var material=new THREE.PointsMaterial({alphaTest:.5,size:10,color:colour,sizeAttenuation:!1}),options={localTimeEnabled:!1,localMorphColour:!1};geometry.colorsNeedUpdate=!0,this.createMesh(geometry,material,options)}var end=current+coords.length,index=0;if(Array.isArray(labels)&&labels.length===coords.length||"string"==typeof labels){var size=labelSets.length;for(current;current+index<end;){var labelText="string"==typeof labels?labels:labels[index];addLabel(current+index,coords[index],labelText,this._lod._material.color),index++}}this.region&&(this.region.pickableUpdateRequired=!0)}},this.setColourHex=function(hex){this._lod._material.color.setHex(hex),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(hex);for(var i=0;i<labelSets.length;i++)labelSets[i]&&labelSets[i].setColour(this._lod._material.color);},this.setColour=colour=>{this._lod.setColour(colour);for(var i=0;i<labelSets.length;i++)labelSets[i]&&labelSets[i].setColour(this._lod._material.color);},this.setLabelDepthTest=flag=>{labelDepthTest=flag;for(var i=0;i<labelSets.length;i++)labelSets[i]&&labelSets[i].setDepthTest(flag);},this.setLabelFontWeight=fontWeightIn=>{fontWeight=fontWeightIn;for(var i=0;i<labelSets.length;i++)labelSets[i]&&labelSets[i].setFontWeight(fontWeightIn);},this.setLabelSize=size=>{labelSize=size;for(var i=0;i<labelSets.length;i++)labelSets[i]&&labelSets[i].setSize(labelSize);},this.displayLabels=flag=>{labelVisibility=flag;for(var i=0;i<labelSets.length;i++)labelSets[i]&&labelSets[i].setVisibility(labelVisibility);},this.setSize=size=>{this.morph&&this.morph.material&&(this.morph.material.size=size,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=flag=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=flag,this.morph.material.needsUpdate=!0)},this.getVerticesByIndex=function(index){if(0<=index&&this.drawRange>index){var positionAttribute=this.getMorph().geometry.getAttribute("position");return[positionAttribute.getX(index),positionAttribute.getY(index),positionAttribute.getZ(index)];}},this.editVertices=function(coords,i){if(coords&&coords.length){var mesh=this.getMorph(),maxIndex=i+coords.length-1;if(!mesh||0>i||maxIndex>=this.drawRange)return;var positionAttribute=mesh.geometry.getAttribute("position"),index=i;coords.forEach(coord=>{var label=labelSets[index];label&&label.setPosition(coord[0],coord[1],coord[2]),positionAttribute.setXYZ(index++,coord[0],coord[1],coord[2])}),positionAttribute.needsUpdate=!0,mesh.geometry.computeBoundingBox(),mesh.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}},this.deleteVertices=function(index){var removed=Pointset.prototype.deleteVertices.call(this,index);return removed&&removeLabel(index),this.drawRange;},this.setName=function(groupNameIn){var oldName=this.groupName;Pointset.prototype.setName.call(this,groupNameIn),labelSets.forEach(label=>{label.getString()===oldName&&(null===label||void 0===label||label.setText(groupNameIn))})},this.render=(delta,playAnimation,cameraControls,options)=>{this.morph&&cameraControls&&(this.morph.sizePerPixel=cameraControls.pixelHeight),Pointset.prototype.render.call(this,delta,playAnimation,cameraControls,options)}};/**
892
- * Provides an object which stores points and provides method which controls its position.
893
- * This is created when a valid json file containing point is read into a {@link Zinc.Scene}
894
- * object.
895
- *
896
- * @class
897
- * @author Alan Wu
898
- * @return {Pointset}
899
- */Pointset.prototype=Object.create((__webpack_require__(10).ZincObject).prototype),exports.Pointset=Pointset;
900
-
901
- /***/ }),
902
- /* 23 */
903
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
904
-
905
- "use strict";
906
- __webpack_require__.r(__webpack_exports__);
907
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
908
- /* harmony export */ Points: () => (/* binding */ Points)
909
- /* harmony export */ });
910
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
911
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_0__);
912
- var _inverseMatrix=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4,_ray=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__.Ray,_sphere=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__.Sphere,_position=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_morphA=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_tempA=/*@__PURE__*/new three__WEBPACK_IMPORTED_MODULE_0__.Vector3;class Points extends three__WEBPACK_IMPORTED_MODULE_0__.Object3D{constructor(){var geometry=0<arguments.length&&arguments[0]!==void 0?arguments[0]:new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry,material=1<arguments.length&&arguments[1]!==void 0?arguments[1]:new three__WEBPACK_IMPORTED_MODULE_0__.PointsMaterial;super(),this.type="Points",this.geometry=geometry,this.material=material,this.sizePerPixel=1,this.updateMorphTargets()}copy(source){return super.copy(source),this.material=source.material,this.geometry=source.geometry,this;}raycast(raycaster,intersects){var geometry=this.geometry,matrixWorld=this.matrixWorld,threshold=raycaster.params.Points.threshold,drawRange=geometry.drawRange;// Checking boundingSphere distance to ray
913
- if(null===geometry.boundingSphere&&geometry.computeBoundingSphere(),_sphere.copy(geometry.boundingSphere),_sphere.applyMatrix4(matrixWorld),_sphere.radius+=threshold,!1!==raycaster.ray.intersectsSphere(_sphere)){_inverseMatrix.copy(matrixWorld).invert(),_ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix);var localThreshold=threshold/((this.scale.x+this.scale.y+this.scale.z)/3)*this.material.size*this.sizePerPixel,localThresholdSq=localThreshold*localThreshold;if(geometry.isBufferGeometry){var index=geometry.index,attributes=geometry.attributes,positionAttribute=attributes.position,morphPosition=geometry.morphAttributes.position;if(null!==index)for(var a,start=Math.max(0,drawRange.start),end=Math.min(index.count,drawRange.start+drawRange.count),i=start;i<end;i++)a=index.getX(i),calculatePosition(this,positionAttribute,morphPosition,a),testPoint(_position,a,localThresholdSq,matrixWorld,raycaster,intersects,this);else for(var _start=Math.max(0,drawRange.start),_end=Math.min(positionAttribute.count,drawRange.start+drawRange.count),_i=_start;_i<_end;_i++)calculatePosition(this,positionAttribute,morphPosition,_i),testPoint(_position,_i,localThresholdSq,matrixWorld,raycaster,intersects,this);}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");}//
914
- }updateMorphTargets(){var geometry=this.geometry;if(geometry.isBufferGeometry){var morphAttributes=geometry.morphAttributes,keys=Object.keys(morphAttributes);if(0<keys.length){var morphAttribute=morphAttributes[keys[0]];if(morphAttribute!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var name,m=0,ml=morphAttribute.length;m<ml;m++)name=morphAttribute[m].name||m+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[name]=m;}}}else{var morphTargets=geometry.morphTargets;morphTargets!==void 0&&0<morphTargets.length&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Points.prototype.isPoints=!0;function testPoint(point,index,localThresholdSq,matrixWorld,raycaster,intersects,object){var rayPointDistanceSq=_ray.distanceSqToPoint(point);if(rayPointDistanceSq<localThresholdSq){var intersectPoint=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3;_ray.closestPointToPoint(point,intersectPoint),intersectPoint.applyMatrix4(matrixWorld);var distance=raycaster.ray.origin.distanceTo(intersectPoint);if(distance<raycaster.near||distance>raycaster.far)return;intersects.push({distance:distance,distanceToRay:Math.sqrt(rayPointDistanceSq),point:intersectPoint,index:index,face:null,object:object})}}function calculatePosition(object,position,morphPosition,a){_position.fromBufferAttribute(position,a);var morphInfluences=object.morphTargetInfluences;if(object.material.morphTargets&&morphPosition&&morphInfluences){_morphA.set(0,0,0);for(var i=0,il=morphPosition.length;i<il;i++){var influence=morphInfluences[i],morphAttribute=morphPosition[i];0!==influence&&(_tempA.fromBufferAttribute(morphAttribute,a),_morphA.addScaledVector(_tempA.sub(_position),influence))}_position.add(_morphA)}}
915
-
916
- /***/ }),
917
- /* 24 */
918
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
919
-
920
- var THREE=__webpack_require__(4),toBufferGeometry=(__webpack_require__(5).toBufferGeometry),Lines=function(){/**
921
- * Create the line segements using geometry and material.
922
- *
923
- * @param {THREE.Geomtry} geometryIn - Geometry of lines to be rendered.
924
- * @param {THREE.Material} materialIn - Material to be set for the lines.
925
- * @param {Object} options - Provide various options
926
- * @param {Boolean} options.localTimeEnabled - A flag to indicate either the lines is
927
- * time dependent.
928
- * @param {Boolean} options.localMorphColour - A flag to indicate either the colour is
929
- * time dependent.
930
- *//**
931
- * Set the width for the lines.
932
- *
933
- * @param {Number} width - Width of the lines.
934
- *//**
935
- * Add new lines to existing lines if it exists, otherwise
936
- * create a new one and add to it.
937
- * @param {Array} coords -An array of three components coordinates.
938
-
939
- * @param {Number} colour - A hex value of the colour for the points
940
- */(__webpack_require__(10).ZincObject).call(this),this.isLines=!0,this.createLineSegment=(geometryIn,materialIn,options)=>{if(geometryIn&&materialIn){var geometry=toBufferGeometry(geometryIn,options);options.localMorphColour&&geometry.morphAttributes.color&&(materialIn.onBeforeCompile=(__webpack_require__(9).augmentMorphColor)());var line=new((__webpack_require__(12).LineSegments))(geometry,materialIn);this.setMesh(line,options.localTimeEnabled,options.localMorphColour)}},this.setWidth=width=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=width,this.morph.material.needsUpdate=!0)},this.addLines=(coords,colour)=>{if(coords&&0<coords.length){var geometry=this.addVertices(coords),mesh=this.getMorph();if(!mesh){var material=new THREE.LineBasicMaterial({color:colour});geometry.colorsNeedUpdate=!0,this.createLineSegment(geometry,material,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}}};/**
941
- * Provides an object which stores lines.
942
- * This is created when a valid json file containing lines is read into a {@link Zinc.Scene}
943
- * object.
944
- *
945
- * @class
946
- * @author Alan Wu
947
- * @return {Lines}
948
- */Lines.prototype=Object.create((__webpack_require__(10).ZincObject).prototype),exports.Lines=Lines;
949
-
950
- /***/ }),
951
- /* 25 */
952
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
953
-
954
- function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){return void e(n)}i.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n)}var a=n.apply(t,e);_next(void 0)})}}var THREE=__webpack_require__(4),TextureArray=function(){var _this=this;/**
955
- * Read images from an array containg src locations.
956
- *
957
- * @async
958
- * @param {Array} srcArrays - List of source location of the images.
959
- *//**
960
- * Get and create the material containing shaders and the textures.
961
- * The texture must be read and ready before calling this function.
962
- *
963
- *
964
- * @param {Object} options - Customise the material with the options object.
965
- * @param {String} options.fs - string of the fragment shader used for
966
- * visualisation.
967
- * @param {String} options.vs - string of the vertex shader used for
968
- * visualisation.
969
- * @param {Object} options.uniforms - Containing the data to be passed into the shaders.
970
- * @param {String} options.glslVersion - Version of glsl used for compile this shader.
971
- *
972
- */(__webpack_require__(26).Texture).call(this),this.isTextureArray=!0,this.loadFromImages=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(srcArrays){var w=1,h=1,d=0;if(srcArrays&&srcArrays.length){_this.isLoading=!0;var image=new Image;image.crossOrigin="Anonymous";for(var data,canvas=document.createElement("canvas"),length=0,dataStacks=Array(srcArrays.length),i=0;i<srcArrays.length;i++)data=yield _this.imageToUint8Array(_this,image,srcArrays[i],canvas),data&&data.array&&(w=data.width,h=data.height,dataStacks[d]=data.array,length+=dataStacks[d].length,d++);var fullArray=new Uint8Array(length);length=0,dataStacks.forEach(data=>{fullArray.set(data,length),length+=data.length}),_this.impl=new THREE.DataTexture2DArray(fullArray,w,h,d),_this.size={width:w,height:h,depth:d},_this.isLoading=!1,_this.impl.needsUpdate=!0}});return function(){return _ref.apply(this,arguments)}}(),this.getMaterial=options=>{if(this.impl){var material;if(!options)material=new THREE.MeshBasicMaterial({color:new THREE.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:THREE.DoubleSide});else if(options.vs&&options.fs){var transparent=!0;"transparent"in options&&(transparent=options.transparent);var side=THREE.FrontSide;options.side&&(side=options.side),material=new THREE.ShaderMaterial({transparent,uniforms:options.uniforms,vertexShader:options.vs,fragmentShader:options.fs,side}),options.glslVersion&&(material.glslVersion=options.glslVersion)}if(material)return material.needsUpdate=!0,material;}}};/**
973
- * Texture array object for holding array of images into
974
- * texures unit that can be used by other texture primitives.
975
- *
976
- * @class
977
- * @author Alan Wu
978
- * @return {TextureArray}
979
- */TextureArray.prototype=Object.create((__webpack_require__(26).Texture).prototype),exports.TextureArray=TextureArray;
980
-
981
- /***/ }),
982
- /* 26 */
983
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
984
-
985
- function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){return void e(n)}i.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n)}var a=n.apply(t,e);_next(void 0)})}}var THREE=__webpack_require__(4),Texture=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};/**
986
- * Base texture object for importing images and turning them into
987
- * texures unit that can be used by other texture primitives.
988
- *
989
- * @class
990
- * @author Alan Wu
991
- * @return {Texture}
992
- *//**
993
- * Read an image from src.
994
- *
995
- * @async
996
- * @param {Image} img - An image object.
997
- * @param {String} src - Source location of the image.
998
- *
999
- * @return {Promise} img on resolve.
1000
- *//**
1001
- @typedef IMAGE_UINT8_RETURN
1002
- @type {Set}
1003
- @property {Uint8Array} array - Array containing the uint8 image value.
1004
- @property {Number} width - Phyiscal image width.
1005
- @property {Number} height - Phyiscal image height.
1006
- *//**
1007
- * Read an image from src and turn it into Uint8Array.
1008
- *
1009
- * @async
1010
- * @param {Image} img - An image object.
1011
- * @param {String} src - Source location of the image.
1012
- * @param {Canvas} canvas - Canvas html element used for the conversion.
1013
- *
1014
- * @return {IMAGE_UNIT8_RETURN}
1015
- *//**
1016
- * Return true if the texture is ready for consumption.
1017
- *
1018
- * @return {Boolean}
1019
- *//**
1020
- * Return true if the texture is ready for consumption, otherwise false.
1021
- *
1022
- * @return {Boolean}
1023
- */Texture.prototype.loadImage=function(img,src){return new Promise((resolve,reject)=>{img.onload=()=>resolve(img),img.onerror=reject,img.src=src});},Texture.prototype.imageToUint8Array=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(instance,img,src,canvas){yield instance.loadImage(img,src),canvas.width=img.width,canvas.height=img.height;var ctx=canvas.getContext("2d");return ctx.drawImage(img,0,0),{array:new Uint8Array(ctx.getImageData(0,0,canvas.width,canvas.height).data.buffer),width:canvas.width,height:canvas.height};});return function(){return _ref.apply(this,arguments)}}(),Texture.prototype.loadFromImages=/*#__PURE__*/function(){var _ref2=_asyncToGenerator(function*(){});return function(){return _ref2.apply(this,arguments)}}(),Texture.prototype.isReady=function(){return!(!this.impl||this.isLoading)},Texture.prototype.getMaterial=function(){if(this.impl)return new THREE.MeshBasicMaterial({color:new THREE.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:THREE.DoubleSide});},exports.Texture=Texture;
1024
-
1025
- /***/ }),
1026
- /* 27 */
1027
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1028
-
1029
- function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(e){for(var t,r=1;r<arguments.length;r++)t=null==arguments[r]?{}:arguments[r],r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))});return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==typeof i?i:i+""}function _toPrimitive(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}var THREE=__webpack_require__(4),shader=__webpack_require__(28),TextureSlides=function(textureIn){(__webpack_require__(29).TexturePrimitive).call(this,textureIn),this.isTextureSlides=!0;var textureSettings=[],idTextureMap={};this.morph=new THREE.Group,this.group=this.morph,this.morph.userData=this;var edgesLine=void 0,flipY=!0,flipZ=!1,brightness=0,contrast=1,nChannels=1,maskTexture=void 0,maskEnabled=!1,discardAlpha=!0,lt0=0,lt1=0,prevTime=-.1;/**
1030
- @typedef SLIDE_SETTINGS
1031
- @type {Set}
1032
- @property {String} direction - the value must be x, y or z, specify the
1033
- direction the slide should be facing.
1034
- @property {Number} value - Normalised value of the location on direction.
1035
- @property {String} id - ID of the mesh, it is only available if the settings
1036
- is returned from {@link TextureSlides.createSlide} or
1037
- {@link TextureSlides.getTextureSettings}.
1038
- *//**
1039
- * Create the slides required for visualisation based on the slide settings.
1040
- * The slides themselves are {THREE.PlanGeometry} objects.
1041
- *
1042
- * @param {SLIDE_SETTINGS} slideSettings - An array to each slide settings.
1043
- */this.createSlides=slideSettings=>{slideSettings.forEach(slide=>this.createSlide(slide))};/**
1044
- * Set the value of the uniforms for a specific mesh in this
1045
- * texture slide object.
1046
- *
1047
- * @param {THREE.Mesh} mesh - Mesh to be modified
1048
- * @param {SLIDE_SETTINGS} slideSettings - Slide settings.
1049
- */var setUniformSlideSettingsOfMesh=(mesh,settings)=>{var material=mesh.material,uniforms=material.uniforms;switch(mesh.rotation.x=0,mesh.rotation.y=0,mesh.rotation.z=0,mesh.position.x=0,mesh.position.y=0,mesh.position.z=0,settings.direction){case"x":var rotation=-Math.PI/2;mesh.rotation.y=rotation,uniforms.direction.value=1,uniforms.slide.value.set(settings.value,0,0),mesh.position.x=settings.value;break;case"y":mesh.rotation.x=Math.PI/2,uniforms.direction.value=2,uniforms.slide.value.set(0,settings.value,0),mesh.position.y=settings.value;break;case"z":uniforms.direction.value=3,uniforms.slide.value.set(0,0,settings.value),mesh.position.z=settings.value;break;default:}material.needsUpdate=!0,this.boundingBoxUpdateRequired=!0};/**
1050
- * Modify the mesh based on a setting
1051
- *
1052
- * @param {SLIDE_SETTINGS} settings - s.
1053
- */this.modifySlideSettings=settings=>{settings&&settings.id&&settings.id in idTextureMap&&idTextureMap[settings.id]&&setUniformSlideSettingsOfMesh(idTextureMap[settings.id],settings)},this.createSlide=settings=>{if(this.texture&&this.texture.isTextureArray&&this.texture.isReady()&&settings&&settings.direction&&void 0!==settings.value){var geometry=new THREE.PlaneGeometry(1,1);geometry.translate(.5,.5,0);var uniforms=shader.getUniforms();uniforms.brightness.value=brightness,uniforms.contrast.value=contrast,uniforms.diffuse0.value=this.texture.impl,uniforms.diffuse1.value=this.texture.impl,uniforms.discardAlpha.value=discardAlpha,uniforms.depth.value=this.texture.size.depth,uniforms.flipY.value=flipY,uniforms.flipZ.value=flipZ,uniforms.mask.value=maskTexture,uniforms.maskEnabled.value=maskEnabled,uniforms.nChannels.value=nChannels;var options={fs:shader.fs,vs:shader.vs,uniforms:uniforms,glslVersion:shader.glslVersion,side:THREE.DoubleSide,transparent:!1},material=this.texture.getMaterial(options);material.needsUpdate=!0;var mesh=new THREE.Mesh(geometry,material);mesh.name=this.groupName,mesh.userData=this;var slideSettings={value:settings.value,direction:settings.direction,id:mesh.id};return textureSettings.push(slideSettings),setUniformSlideSettingsOfMesh(mesh,slideSettings),idTextureMap[mesh.id]=mesh,this.morph.add(mesh),this.boundingBoxUpdateRequired=!0,this.updateTimeTexture(),slideSettings;}},this.getTextureSettings=()=>[...textureSettings],this.getTextureSettingsWithId=id=>{for(var i=0;i<textureSettings.length;i++)if(id===textureSettings[i].id)return _objectSpread({},textureSettings[i]);},this.getSlides=()=>this.morph?[...this.morph.children]:[],this.removeSlide=slide=>{slide&&this.removeSlideWithId(slide.id)},this.removeSlideWithId=id=>{if(this.morph&&id in idTextureMap&&idTextureMap[id]){if(this.morph.getObjectById(id)){var slide=idTextureMap[id];this.morph.remove(slide),slide.clear(),slide.geometry&&slide.geometry.dispose(),slide.material&&slide.material.dispose(),this.boundingBoxUpdateRequired=!0}var index=textureSettings.findIndex(item=>item.id===id);-1<index&&textureSettings.splice(index,1)}},this.dispose=()=>{this.morph.children.forEach(slide=>{slide.geometry&&slide.geometry.dispose(),slide.material&&slide.material.dispose()}),(__webpack_require__(29).TexturePrimitive).prototype.dispose.call(this),this.boundingBoxUpdateRequired=!0};//Expand the boundingbox with slide settings
1054
- var expandBoxWithSettings=(box,settings,vector)=>{if(settings)switch(settings.direction.value){case 1:vector.copy(settings.slide.value),box.expandByPoint(vector),vector.setY(1),vector.setZ(1),box.expandByPoint(vector);break;case 2:vector.copy(settings.slide.value),box.expandByPoint(vector),vector.setX(1),vector.setZ(1),box.expandByPoint(vector);break;case 3:vector.copy(settings.slide.value),box.expandByPoint(vector),vector.setX(1),vector.setY(1),box.expandByPoint(vector);break;default:}};/**
1055
- * Get the bounding box of this slides.
1056
- * It uses the max and min of the slides position and the
1057
- * transformation to calculate the position of the box.
1058
- *
1059
- * @return {THREE.Box3}.
1060
- *//**
1061
- * Update the glyphsets if required the render.
1062
- *//**
1063
- * Update the glyphsets if required the render.
1064
- */this.getBoundingBox=()=>{if(this.morph&&this.morph.children&&this.morph.visible&&this.boundingBoxUpdateRequired){this.cachedBoundingBox.makeEmpty();var vector=new THREE.Vector3(0,0,0);this.morph.children.forEach(slide=>{expandBoxWithSettings(this.cachedBoundingBox,slide.material.uniforms,vector)}),this.morph.updateMatrixWorld(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox;},this.applyTransformation=(rotation,position,scale)=>{var matrix=new THREE.Matrix4;matrix.set(rotation[0],rotation[1],rotation[2],0,rotation[3],rotation[4],rotation[5],0,rotation[6],rotation[7],rotation[8],0,0,0,0,0);var quaternion=new THREE.Quaternion().setFromRotationMatrix(matrix);this.morph.position.set(...position),this.morph.quaternion.copy(quaternion),this.morph.scale.set(...scale),this.morph.updateMatrix(),this.boundingBoxUpdateRequired=!0},this.setRenderOrder=order=>{//multiilayers
1065
- this.morph.renderOrder=order},this.initialise=(textureData,finishCallback)=>{if(textureData){var locations=textureData.locations;locations&&0<locations.length&&(this.applyTransformation(locations[0].orientation,locations[0].position,locations[0].scale),"flipY"in locations[0]&&(flipY=locations[0].flipY),"flipZ"in locations[0]&&(flipZ=locations[0].flipZ)),this.createSlides(textureData.settings.slides),finishCallback!=null&&"function"==typeof finishCallback&&finishCallback(this)}},this.showEdges=color=>{if(!edgesLine){var geometry=new THREE.BoxGeometry(1,1,1);geometry.translate(.5,.5,.5);var edges=new THREE.EdgesGeometry(geometry);edgesLine=new THREE.LineSegments(edges,new THREE.LineBasicMaterial({color})),this.group.add(edgesLine)}else edgesLine.material.color=color;edgesLine.visible=!0},this.setUniformsValue=(name,val)=>{this.morph.children.forEach(mesh=>{var material=mesh.material;if("ShaderMaterial"===material.type){var uniforms=material.uniforms;uniforms[name].value=val,material.needsUpdate=!0}})},this.isAlphaPixelDiscarded=()=>discardAlpha,this.discardAlphaPixel=flag=>{discardAlpha=flag,this.setUniformsValue("discardAlpha",discardAlpha)},this.getBrightness=()=>brightness,this.setBrightness=brightnessIn=>{brightness=brightnessIn,this.setUniformsValue("brightness",brightness)},this.getContrast=()=>contrast,this.setContrast=contrastIn=>{0<=contrast&&(contrast=contrastIn,this.setUniformsValue("contrast",contrast))},this.getNumberOfChannels=()=>nChannels,this.setNumberOfChannels=numbersIn=>{nChannels=numbersIn,this.setUniformsValue("nChannels",nChannels)},this.getMask=()=>maskTexture,this.setMask=maskTextureIn=>{maskTexture=maskTextureIn,maskEnabled=!!maskTexture,this.setUniformsValue("mask",maskTexture),this.setUniformsValue("maskEnabled",maskEnabled)},this.hideEdges=()=>{edgesLine&&(edgesLine.visible=!1)},this.updateTimeTexture=()=>{var maxIndex=this.textureList.length-1,normalisedTime=this.inbuildTime/this.duration;if(this.timeEnabled&&0<maxIndex&&prevTime!==normalisedTime){var iTime=normalisedTime*maxIndex,t0=Math.floor(iTime),t1=Math.ceil(iTime);this.morph.children.forEach(mesh=>{var material=mesh.material;if("ShaderMaterial"===material.type){var uniforms=material.uniforms;lt0!==t0&&(uniforms.diffuse0.value=this.textureList[t0].impl),lt1!==t1&&(uniforms.diffuse1.value=this.textureList[t1].impl),uniforms.time.value=iTime-t0,material.needsUpdate=!0}}),lt0=t0,lt1=t1,prevTime=normalisedTime}},this.setMorphTime=time=>{var newTime=time;newTime=time>this.duration?this.duration:0>time?0:time,newTime!=this.inbuildTime&&(this.inbuildTime=newTime,this.updateTimeTexture())},this.render=(delta,playAnimation)=>{//console.log("render", delta, playAnimation, this.textureList)
1066
- if(!0==playAnimation&&this.timeEnabled&&1<this.textureList.length){var targetTime=this.inbuildTime+delta;targetTime>this.duration&&(targetTime-=this.duration),this.inbuildTime=targetTime,this.updateTimeTexture()}}};/**
1067
- * Provides a class which create a texture stacks in a block
1068
- * with shaders allowing slices of texture to be displayed.
1069
- *
1070
- * @param {TextureArray} textureIn - An object of texture array
1071
- * holding texture information.
1072
- *
1073
- * @class
1074
- * @author Alan Wu
1075
- * @return {TextureSlides}
1076
- */TextureSlides.prototype=Object.create((__webpack_require__(29).TexturePrimitive).prototype),TextureSlides.prototype.constructor=TextureSlides,exports.TextureSlides=TextureSlides;
1077
-
1078
- /***/ }),
1079
- /* 28 */
1080
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1081
-
1082
- var THREE=__webpack_require__(4),glslVersion=THREE.GLSL3,fs="\nprecision highp float;\nprecision highp int;\nprecision highp sampler2DArray;\n\nuniform sampler2DArray diffuse0;\nuniform sampler2DArray diffuse1;\nuniform sampler2DArray mask;\nuniform bool discardAlpha;\nuniform bool maskEnabled;\nuniform float brightness;\nuniform float contrast;\nuniform float time;\nuniform int nChannels;\nin vec3 vUw;\n\nout vec4 outColor;\n\nvoid main() {\n\n float color0 = texture( diffuse0, vUw ).r;\n float color1 = texture( diffuse1, vUw ).r;\n float color = mix(color0, color1, time);\n // discard if alpha is zero\n if (maskEnabled && discardAlpha) {\n float mask = texture(mask, vUw).r;\n if (mask == 0.0) discard;\n }\n\n // discard if alpha is zero\n //if (discardAlpha && color.a == 0.0) discard;\n // Apply brightness\n vec3 brightenedColor = vec3(color) + vec3(brightness);\n // Apply contrast\n vec3 contrastedColor = (brightenedColor - vec3(0.5)) * contrast + vec3(0.5);\n outColor = vec4(contrastedColor, 1.0);\n}\n",vs="\nout vec3 vUw;\nuniform float depth;\nuniform vec3 slide;\nuniform int direction;\nuniform bool flipY;\nuniform bool flipZ;\n\nvoid main() {\n\n vec3 slidePos = position.xyz;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position.xyz, 1.0 );\n\n if (direction == 1)\n slidePos = vec3(slide.x, position.y, position.x);\n if (direction == 2)\n slidePos = vec3(position.x, slide.y, position.y);\n if (direction == 3)\n slidePos = vec3(position.x, position.y, slide.z);\n\n if (flipY)\n slidePos.y = 1.0 - slidePos.y;\n if (flipZ)\n slidePos.z = 1.0 - slidePos.z;\n\n vUw.xyz = vec3(slidePos.x, slidePos.y, slidePos.z * depth);\n\n}\n",getUniforms=function(){return{brightness:{value:0},contrast:{value:1},depth:{value:1},discardAlpha:{value:!0},diffuse0:{value:void 0},diffuse1:{value:void 0},direction:{value:1},flipY:{value:!0},flipZ:{value:!1},nChannels:{value:1},mask:{value:void 0},maskEnabled:{value:!1},slide:{value:new THREE.Vector3(0,0,1)},time:{value:0}};};exports.fs=fs,exports.vs=vs,exports.glslVersion=glslVersion,exports.getUniforms=getUniforms;
1083
-
1084
- /***/ }),
1085
- /* 29 */
1086
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1087
-
1088
- var THREE=__webpack_require__(4),resolveURL=(__webpack_require__(5).resolveURL),TexturePrimitive=function(textureIn){//List of textureArray object, which is used for
1089
- //time variation for textureSlides object
1090
- /**
1091
- * Load texture data into this primitves.
1092
- *
1093
- * @param {Object} textureData - contains the informations about the textures.
1094
- * @param {Function} finishCallback - User's function to be called once texture's
1095
- * is loaded.
1096
- *//**
1097
- * Initialise a texture based on the provided textureData, this should be used
1098
- * internally only.
1099
- *
1100
- * @param {Object} textureData - contains the informations about the textures.
1101
- * @param {Function} finishCallback - User's function to be called once texture's
1102
- * is loaded.
1103
- */(__webpack_require__(10).ZincObject).call(this),this.isTexturePrimitive=!0,this.texture=textureIn,this.textureList=[],this.texture&&this.textureList.push(this.texture),this.load=(textureData,finishCallback)=>{if(textureData&&textureData.images&&textureData.images.source){var texture=new((__webpack_require__(25).TextureArray)),imgArray=[];textureData.images.source.forEach(img=>{imgArray.push(resolveURL(img))});var _this=this;texture.loadFromImages(imgArray).then(()=>{_this.texture=texture,_this.textureList.push(this.texture),_this.initialise(textureData,finishCallback)})}},this.addTextureArray=tArray=>{0===this.textureList.length&&this.texture&&this.textureList.push(this.texture),tArray&&tArray.isTextureArray&&this.textureList.push(tArray)},this.initialise=(textureData,finishCallback)=>{finishCallback!=null&&"function"==typeof finishCallback&&finishCallback(this)}};/**
1104
- * Provides a base class object which stores textures and rendering object.
1105
- *
1106
- * @class
1107
- * @author Alan Wu
1108
- * @return {TexturePrimitive}
1109
- */TexturePrimitive.prototype=Object.create((__webpack_require__(10).ZincObject).prototype),TexturePrimitive.prototype.constructor=TexturePrimitive,exports.TexturePrimitive=TexturePrimitive;
1110
-
1111
- /***/ }),
1112
- /* 30 */
1113
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1114
-
1115
- var THREE=__webpack_require__(4),ResizeSensor=__webpack_require__(31);/**
1116
- * Create a Zinc 3D renderer in the container provided.
1117
- * The primary function of a Zinc 3D renderer is to display the current
1118
- * scene (@link Scene} set to the renderer and each scene may contain as
1119
- * many geometries, glyphset and other primitives as the system can support.
1120
- * Zinc.Renderer also allows additional scenes to be displayed.
1121
- *
1122
- * @param {Object} containerIn - Container to create the renderer on.
1123
- * @class
1124
- * @author Alan Wu
1125
- * @return {Renderer}
1126
- */exports.Renderer=function(containerIn){var container=containerIn,renderer=void 0,currentScene=void 0,clock=new THREE.Clock(!1);//myGezincGeometriestains a tuple of the threejs mesh, timeEnabled, morphColour flag, unique id and morph
1127
- this.playAnimation=!0;/* default animation update rate, rate is 1000 and duration
1128
- is default to 6000, 6s to finish a full animation */var playRate=1e3,preRenderCallbackFunctions={},preRenderCallbackFunctions_id=0,postRenderCallbackFunctions={},postRenderCallbackFunctions_id=0,contextLostCallbackFunctions={},contextLostCallbackFunctions_id=0,contextRestoredCallbackFunctions={},contextRestoredCallbackFunctions_id=0,animated_id=void 0,cameraOrtho=void 0,sceneOrtho=void 0,logoSprite=void 0,sceneMap=[],additionalActiveScenes=[],scenesGroup=new THREE.Group,canvas=void 0,sensor=void 0,isRendering=!1,isInitialised=!1,currentSize=[0,0],currentOffset=[0,0];this.getDrawingWidth=()=>{if(container)return container.clientWidth;return canvas?"undefined"==typeof canvas.clientWidth?Math.round(canvas.width):Math.round(canvas.clientWidth):0},this.getDrawingHeight=()=>{if(container)return container.clientHeight;return canvas?"undefined"==typeof canvas.clientHeight?Math.round(canvas.height):Math.round(canvas.clientHeight):0},this.onWindowResize=()=>{currentScene.onWindowResize();var width=this.getDrawingWidth(),height=this.getDrawingHeight();if(renderer!=null){var localRect;container?(localRect=container.getBoundingClientRect(),renderer.setSize(width,height)):canvas&&("undefined"==typeof canvas.getBoundingClientRect?renderer.setSize(width,height,!1):(localRect=canvas.getBoundingClientRect(),canvas.width=width,canvas.height=height,renderer.setSize(width,height,!1))),localRect&&(currentOffset[0]=localRect.left,currentOffset[1]=localRect.top);var target=new THREE.Vector2;renderer.getSize(target),currentSize[0]=target.x,currentSize[1]=target.y}},this.initialiseVisualisation=parameters=>{if(!isInitialised){if(parameters=parameters||{},void 0===parameters.antialias){var onMobile=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(onMobile=!0)}catch(err){onMobile=!1}parameters.antialias=!onMobile}parameters.canvas&&(container=void 0,canvas=parameters.canvas),renderer=new THREE.WebGLRenderer(parameters),void 0!==container&&container.appendChild(renderer.domElement),renderer.setClearColor(16777215,1),canvas&&canvas.style&&(canvas.style.height="100%",canvas.style.width="100%");var domCanvas=renderer.domElement;domCanvas.addEventListener("webglcontextlost",onContextLost,!1),domCanvas.addEventListener("webglcontextrestored",onContextRestored,!1),renderer.autoClear=!1;var scene=this.createScene("default");this.setCurrentScene(scene),isInitialised=!0}};var onContextLost=event=>{event.preventDefault();for(var key of Object.keys(preRenderCallbackFunctions))contextLostCallbackFunctions.hasOwnProperty(key)&&contextLostCallbackFunctions[key].call();},onContextRestored=event=>{event.preventDefault();for(var key of Object.keys(preRenderCallbackFunctions))contextRestoredCallbackFunctions.hasOwnProperty(key)&&contextRestoredCallbackFunctions[key].call();};/**
1129
- * Get the current scene on display.
1130
- * @return {Zinc.Scene};
1131
- */this.getCurrentScene=()=>currentScene,this.setCurrentScene=sceneIn=>{if(sceneIn){this.removeActiveScene(sceneIn);var oldScene=currentScene;currentScene=sceneIn,oldScene&&oldScene.setInteractiveControlEnable(!1),currentScene.setInteractiveControlEnable(!0),currentScene.setAdditionalScenesGroup(scenesGroup),this.onWindowResize()}},this.getSceneByName=name=>sceneMap[name],this.createScene=name=>{if(null==sceneMap[name]){var new_scene;return new_scene=canvas?new((__webpack_require__(32).Scene))(canvas,renderer):new((__webpack_require__(32).Scene))(container,renderer),sceneMap[name]=new_scene,new_scene.sceneName=name,new_scene;}};/**
1132
- * Reset the viewport of the current scene to its original state.
1133
- */this.resetView=()=>{currentScene.resetView()},this.viewAll=()=>{if(currentScene){var boundingBox=currentScene.getBoundingBox();if(boundingBox){for(var boundingBox2,i=0;i<additionalActiveScenes.length;i++)boundingBox2=additionalActiveScenes[i].getBoundingBox(),boundingBox2&&boundingBox.union(boundingBox2);currentScene.viewAllWithBoundingBox(boundingBox)}}},this.loadModelsURL=(urls,colours,opacities,timeEnabled,morphColour,finishCallback)=>{currentScene.loadModelsURL(urls,colours,opacities,timeEnabled,morphColour,finishCallback)};/**
1134
- * Load the viewport from an external location provided by the url. This should be
1135
- * called from {@link Zinc.Scene};
1136
- * @param {String} URL - address to the file containing viewport information.
1137
- * @deprecated
1138
- */this.loadViewURL=url=>{currentScene.loadViewURL(url)},this.loadFromViewURL=(jsonFilePrefix,finishCallback)=>{currentScene.loadFromViewURL(jsonFilePrefix,finishCallback)},this.updateDirectionalLight=()=>{currentScene.updateDirectionalLight()};var runAnimation=()=>{isRendering?(animated_id=requestAnimationFrame(runAnimation),this.render()):(cancelAnimationFrame(animated_id),animated_id=void 0)};/**
1139
- * Stop the animation and renderer to get into the render loop.
1140
- */this.stopAnimate=()=>{isRendering&&(clock.stop(),isRendering=!1)},this.animate=()=>{isRendering||(clock.start(),isRendering=!0,runAnimation())};Date.now();/**
1141
- * Add a callback function which will be called when the gl context is lost.
1142
- * @param {Function} callbackFunction - callbackFunction to be added.
1143
- *
1144
- * @return {Number}
1145
- */this.addContextLostCallbackFunction=callbackFunction=>(++contextLostCallbackFunctions_id,contextLostCallbackFunctions[contextLostCallbackFunctions_id]=callbackFunction,contextLostCallbackFunctions_id),this.removeContextLostCallbackFunction=id=>{id in contextLostCallbackFunctions&&delete contextLostCallbackFunctions[id]},this.addContextRestoredCallbackFunction=callbackFunction=>(++contextRestoredCallbackFunctions_id,contextRestoredCallbackFunctions[contextRestoredCallbackFunctions_id]=callbackFunction,contextRestoredCallbackFunctions_id),this.removeContextRestoredCallbackFunction=id=>{id in contextRestoredCallbackFunctions_id&&delete contextRestoredCallbackFunctions_id[id]},this.addPreRenderCallbackFunction=callbackFunction=>(++preRenderCallbackFunctions_id,preRenderCallbackFunctions[preRenderCallbackFunctions_id]=callbackFunction,preRenderCallbackFunctions_id),this.removePreRenderCallbackFunction=id=>{id in preRenderCallbackFunctions&&delete preRenderCallbackFunctions[id]},this.addPostRenderCallbackFunction=callbackFunction=>(++postRenderCallbackFunctions_id,postRenderCallbackFunctions[postRenderCallbackFunctions_id]=callbackFunction,postRenderCallbackFunctions_id),this.removePostRenderCallbackFunction=id=>{id in postRenderCallbackFunctions&&delete postRenderCallbackFunctions[id]},this.getPlayRate=()=>playRate,this.setPlayRate=playRateIn=>{playRate=playRateIn},this.getCurrentTime=()=>currentScene.getCurrentTime(),this.setMorphsTime=time=>{currentScene.setMorphsTime(time)},this.getZincGeometryByID=id=>currentScene.getZincGeometryByID(id),this.addToScene=object=>{currentScene.addObject(object)},this.addToOrthoScene=object=>{if(null==sceneOrtho&&(sceneOrtho=new THREE.Scene),null==cameraOrtho){var width=this.getDrawingWidth(),height=this.getDrawingHeight();cameraOrtho=new THREE.OrthographicCamera(-width/2,width/2,height/2,-height/2,1,10),cameraOrtho.position.z=10}sceneOrtho.add(object)};var createHUDSprites=logoSprite=>texture=>{texture.needsUpdate=!0;var material=new THREE.SpriteMaterial({map:texture}),imagewidth=material.map.image.width,imageheight=material.map.image.height;logoSprite.material=material,logoSprite.scale.set(imagewidth,imageheight,1);var width=this.getDrawingWidth(),height=this.getDrawingHeight();logoSprite.position.set((width-imagewidth)/2,(-height+imageheight)/2,1),this.addToOrthoScene(logoSprite)};/**
1146
- * Render the current and all additional scenes. It will first update all geometries and glyphsets
1147
- * in scenes, clear depth buffer and render the ortho scene, call the preRenderCallbackFunctions stack
1148
- * , render the scenes then postRenderCallback.
1149
- *//**
1150
- * Get the internal {@link Three.Renderer}, to gain access to ThreeJS APIs.
1151
- *//**
1152
- * Check if a scene is currently active.
1153
- * @param {Zinc.Scene} sceneIn - Scene to check if it is currently
1154
- * rendered.
1155
- *//**
1156
- * Add additional active scene for rendering, this scene will also be rendered but
1157
- * viewport of the currentScene will be used.
1158
- * @param {Zinc.Scene} additionalScene - Scene to be added to the rendering.
1159
- *//**
1160
- * Remove a currenrtly active scene from the renderer, this scene will also be rendered but
1161
- * viewport of the currentScene will be used.
1162
- * @param {Zinc.Scene} additionalScene - Scene to be removed from rendering.
1163
- *//**
1164
- * Clear all additional scenes from rendering except for curentScene.
1165
- *//**
1166
- * Dispose all memory allocated, this will effetively destroy all scenes.
1167
- *//**
1168
- * Transition from the current viewport to the endingScene's viewport in the specified duration.
1169
- *
1170
- * @param {Zinc.Scene} endingScene - Viewport of this scene will be used as the destination.
1171
- * @param {Number} duration - Amount of time to transition from current viewport to the
1172
- * endingScene's viewport.
1173
- */this.addLogo=()=>{logoSprite=new THREE.Sprite;THREE.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png",void 0,createHUDSprites(logoSprite))},this.render=()=>{sensor||(container?0<container.clientWidth&&0<container.clientHeight&&(sensor=new ResizeSensor(container,this.onWindowResize)):canvas&&0<canvas.width&&0<canvas.height&&(sensor=new ResizeSensor(canvas,this.onWindowResize)));var delta=clock.getDelta();currentScene.renderGeometries(playRate,delta,this.playAnimation);for(var sceneItem,i=0;i<additionalActiveScenes.length;i++)sceneItem=additionalActiveScenes[i],sceneItem.renderGeometries(playRate,delta,this.playAnimation);cameraOrtho!=null&&sceneOrtho!=null&&(renderer.clearDepth(),renderer.render(sceneOrtho,cameraOrtho));for(var key of Object.keys(preRenderCallbackFunctions))preRenderCallbackFunctions.hasOwnProperty(key)&&preRenderCallbackFunctions[key].call();currentScene.render(renderer);for(var _key of Object.keys(postRenderCallbackFunctions))postRenderCallbackFunctions.hasOwnProperty(_key)&&postRenderCallbackFunctions[_key].call();},this.forceContextLoss=()=>{renderer.forceContextLoss()},this.forceContextRestore=()=>{renderer.forceContextRestore()},this.getThreeJSRenderer=()=>renderer,this.isSceneActive=sceneIn=>{if(currentScene===sceneIn)return!0;for(var sceneItem,i=0;i<additionalActiveScenes.length;i++)if(sceneItem=additionalActiveScenes[i],sceneItem===sceneIn)return!0;return!1;},this.addActiveScene=additionalScene=>{this.isSceneActive(additionalScene)||(additionalActiveScenes.push(additionalScene),scenesGroup.add(additionalScene.getThreeJSScene()))},this.removeActiveScene=additionalScene=>{for(var sceneItem,i=0;i<additionalActiveScenes.length;i++)if(sceneItem=additionalActiveScenes[i],sceneItem===additionalScene)return additionalActiveScenes.splice(i,1),void scenesGroup.remove(additionalScene.getThreeJSScene());},this.clearAllActiveScene=()=>{for(var i=0;i<additionalActiveScenes.length;i++)scenesGroup.remove(additionalActiveScenes[i].getThreeJSScene());additionalActiveScenes.splice(0,additionalActiveScenes.length)},this.dispose=()=>{var _renderer;for(var key in isRendering&&cancelAnimationFrame(animated_id),sceneMap)sceneMap.hasOwnProperty(key)&&sceneMap[key].clearAll();sceneMap=[],additionalActiveScenes=[],scenesGroup=new THREE.Group,this.stopAnimate(),preRenderCallbackFunctions={},preRenderCallbackFunctions_id=0,postRenderCallbackFunctions={},postRenderCallbackFunctions=0,contextLostCallbackFunctions={},contextLostCallbackFunctions_id=0,contextRestoredCallbackFunctions={},contextRestoredCallbackFunctions_id=0,cameraOrtho=void 0,sceneOrtho=void 0,logoSprite=void 0;var scene=this.createScene("default");this.setCurrentScene(scene),sensor=void 0,null===(_renderer=renderer)||void 0===_renderer||_renderer.dispose()},this.transitionScene=(endingScene,duration)=>{if(currentScene){var currentCamera=currentScene.getZincCameraControls(),boundingBox=endingScene.getBoundingBox();if(boundingBox){var radius=boundingBox.min.distanceTo(boundingBox.max)/2,centreX=(boundingBox.min.x+boundingBox.max.x)/2,centreY=(boundingBox.min.y+boundingBox.max.y)/2,centreZ=(boundingBox.min.z+boundingBox.max.z)/2,endingViewport=currentCamera.getViewportFromCentreAndRadius(centreX,centreY,centreZ,radius,40,radius*4),startingViewport=currentCamera.getCurrentViewport();currentCamera.cameraTransition(startingViewport,endingViewport,duration),currentCamera.enableCameraTransition()}}},this.isWebGL2=()=>!!renderer&&renderer.capabilities.isWebGL2};
1174
-
1175
- /***/ }),
1176
- /* 31 */
1177
- /***/ ((module) => {
1178
-
1179
- "use strict";
1180
- module.exports = require("css-element-queries/src/ResizeSensor");
1181
-
1182
- /***/ }),
1183
- /* 32 */
1184
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1185
-
1186
- function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}var THREE=__webpack_require__(4),MarkerCluster=(__webpack_require__(33).MarkerCluster),SceneLoader=(__webpack_require__(35).SceneLoader),SceneExporter=(__webpack_require__(42).SceneExporter),Viewport=(__webpack_require__(44).Viewport),createBufferGeometry=(__webpack_require__(5).createBufferGeometry),getCircularTexture=(__webpack_require__(5).getCircularTexture),createNewSpriteText=(__webpack_require__(5).createNewSpriteText),uniqueiId=0,getUniqueId=function(){return"sc"+uniqueiId++;},defaultMetadata=function(){return{Duration:"6 secs",OriginalDuration:"-",TimeStamps:{}};},defaultDuration=6e3;/**
1187
- * A Scene contains {@link Region},and
1188
- * {@link CameraControls} which controls the viewport and additional features.
1189
- * It is the main object used for controlling what is and what is not displayed
1190
- * on the renderer.
1191
- *
1192
- * @class
1193
- * @param {Object} containerIn - Container to create the renderer on.
1194
- * @author Alan Wu
1195
- * @return {Scene}
1196
- */exports.Scene=function(containerIn,rendererIn){var _this=this,container=containerIn,cameraHelper=void 0,videoHandler=void 0,sceneLoader=new SceneLoader(this),minimap=void 0,zincObjectAddedCallbacks={},zincObjectAddedCallbacks_id=0,zincObjectRemovedCallbacks={},zincObjectRemovedCallbacks_id=0,scene=new THREE.Scene,miniAxesScene=new THREE.Scene,rootRegion=new((__webpack_require__(45).Region))(void 0,this);scene.add(rootRegion.getGroup());var tempGroup=new THREE.Group;scene.add(tempGroup),this.directionalLight=void 0,this.ambient=void 0,this.camera=void 0;var duration=6e3,zincCameraControls=void 0;this.sceneName=void 0;var stereoEffectFlag=!1,stereoEffect=void 0;this.autoClearFlag=!0,this.displayMarkers=!1,this.displayMinimap=!1,this.displayMiniAxes=!1,this.minimapScissor={x_offset:16,y_offset:16,width:128,height:128,align:"top-right",updateRequired:!0};var scissor={x:0,y:0},metadata=defaultMetadata(),_markerTarget=new THREE.Vector2,pickableObjectsList=[];this.forcePickableObjectsUpdate=!1,this.uuid=getUniqueId();var markerCluster=new MarkerCluster(this);markerCluster.disable(),scene.add(markerCluster.group);var axisDisplay={main:[],mini:[]},_v3=new THREE.Vector3(0,0,0),getDrawingWidth=()=>container?"undefined"==typeof container.clientWidth?container.width:container.clientWidth:0,getDrawingHeight=()=>container?"undefined"==typeof container.clientHeight?container.height:container.clientHeight:0;/**
1197
- * This function returns a three component array, which contains
1198
- * [totalsize, totalLoaded and errorDownload] of all the downloads happening
1199
- * in this scene.
1200
- * @returns {Array}
1201
- */this.getDownloadProgress=()=>sceneLoader.getDownloadProgress(),this.onWindowResize=()=>{var wHeight=getDrawingHeight();this.camera.aspect=getDrawingWidth()/wHeight,this.camera.updateProjectionMatrix(),this.minimapScissor.updateRequired=!0,zincCameraControls.onResize(),zincCameraControls.calculateHeightPerPixelAtZeroDepth(wHeight)},this.resetView=()=>{this.onWindowResize(),zincCameraControls.resetView()},this.changeZoomByScrollRateUnit=unit=>{zincCameraControls.changeZoomByScrollRateUnit(unit)};//Setup the camera for this scene, it also initialise the lighting
1202
- var setupCamera=()=>{this.camera=new THREE.PerspectiveCamera(40,getDrawingWidth()/getDrawingHeight(),0,10),this.ambient=new THREE.AmbientLight(16777215,.2),scene.add(this.ambient),this.directionalLight=new THREE.DirectionalLight(16777215,.8),scene.add(this.directionalLight),zincCameraControls=new((__webpack_require__(44).CameraControls))(this.camera,rendererIn.domElement,rendererIn,this),zincCameraControls.setDirectionalLight(this.directionalLight),zincCameraControls.resetView(),minimap=new((__webpack_require__(50).Minimap))(this)};setupCamera(),this.loadView=settings=>{var viewPort=new Viewport;return viewPort.setFromObject(settings),zincCameraControls.setCurrentCameraSettings(viewPort),!0;},this.setupMultipleViews=(defaultView,entries)=>{for(var _ref3 of Object.entries(entries)){var _ref2=_slicedToArray(_ref3,2),name=_ref2[0],settings=_ref2[1],viewport=new Viewport;viewport.setFromObject(settings),zincCameraControls.addViewport(name,viewport)}zincCameraControls.setDefaultViewport(defaultView)},this.getBoundingBox=()=>rootRegion.getBoundingBox(!0),this.viewAllWithBoundingBox=boundingBox=>{if(boundingBox){var viewport=zincCameraControls.getViewportFromBoundingBox(boundingBox,1);zincCameraControls.setCurrentCameraSettings(viewport),zincCameraControls.calculateHeightPerPixelAtZeroDepth(getDrawingHeight()),markerCluster.markerUpdateRequired=!0}},this.viewAll=()=>{var boundingBox=this.getBoundingBox();this.viewAllWithBoundingBox(boundingBox),markerCluster.markerUpdateRequired=!0},this.forEachGeometry=callbackFunction=>{rootRegion.forEachGeometry(callbackFunction,!0)},this.forEachGlyphset=callbackFunction=>{rootRegion.forEachGlyphset(callbackFunction,!0)},this.forEachPointset=callbackFunction=>{rootRegion.forEachPointset(callbackFunction,!0)},this.forEachLine=callbackFunction=>{rootRegion.forEachLine(callbackFunction,!0)},this.findGeometriesWithGroupName=GroupName=>rootRegion.findGeometriesWithGroupName(GroupName,!0),this.findPointsetsWithGroupName=GroupName=>rootRegion.findPointsetsWithGroupName(GroupName,!0),this.findGlyphsetsWithGroupName=GroupName=>rootRegion.findGlyphsetsWithGroupName(GroupName,!0),this.findLinesWithGroupName=GroupName=>rootRegion.findLinesWithGroupName(GroupName,!0),this.findObjectsWithGroupName=GroupName=>rootRegion.findObjectsWithGroupName(GroupName,!0),this.findObjectsWithAnatomicalId=anatomicalId=>rootRegion.findObjectsWithAnatomicalId(anatomicalId,!0),this.getBoundingBoxOfZincObjects=objectsArray=>{for(var box,boundingBox=void 0,i=0;i<objectsArray.length;i++)box=objectsArray[i].getBoundingBox(),box&&(boundingBox?boundingBox.union(box):boundingBox=box);return boundingBox;},this.vectorToScreenXY=point=>{point.project(this.camera);var width=getDrawingWidth(),height=getDrawingHeight(),widthHalf=width/2,heightHalf=height/2;return point.x=point.x*widthHalf+widthHalf,point.y=-(point.y*heightHalf)+heightHalf,point;},this.getObjectsScreenXY=zincObjects=>{if(zincObjects&&0<zincObjects.length){var boundingBox=this.getBoundingBoxOfZincObjects(zincObjects),center=new THREE.Vector3;return boundingBox.getCenter(center),this.vectorToScreenXY(center);}},this.getNamedObjectsScreenXY=name=>{var zincObjects=this.findObjectsWithGroupName(name);return this.getObjectsScreenXY(zincObjects);},this.addZincObject=zincObject=>{zincObject&&(rootRegion.addZincObject(zincObject),zincCameraControls&&zincCameraControls.calculateMaxAllowedDistance(this))},this.loadGlyphsetURL=(metaurl,glyphurl,groupName,finishCallback)=>{sceneLoader.loadGlyphsetURL(rootRegion,metaurl,glyphurl,groupName,finishCallback)},this.loadPointsetURL=(url,timeEnabled,morphColour,groupName,finishCallback)=>{sceneLoader.loadPointsetURL(rootRegion,url,timeEnabled,morphColour,groupName,finishCallback)},this.loadLinesURL=(url,timeEnabled,morphColour,groupName,finishCallback)=>{sceneLoader.loadLinesURL(rootRegion,url,timeEnabled,morphColour,groupName,finishCallback)},this.loadSTL=(url,groupName,finishCallback)=>{sceneLoader.loadSTL(rootRegion,url,groupName,finishCallback)},this.loadOBJ=(url,groupName,finishCallback)=>{sceneLoader.loadOBJ(rootRegion,url,groupName,finishCallback)},this.loadMetadataURL=(url,finishCallback,allCompletedCallback,options)=>{sceneLoader.loadMetadataURL(rootRegion,url,finishCallback,allCompletedCallback,options)},this.loadModelsURL=(urls,colours,opacities,timeEnabled,morphColour,finishCallback)=>{sceneLoader.loadModelsURL(rootRegion.urls,colours,opacities,timeEnabled,morphColour,finishCallback)},this.loadViewURL=url=>{sceneLoader.loadViewURL(url)},this.loadFromViewURL=(jsonFilePrefix,finishCallback)=>{sceneLoader.loadFromViewURL(jsonFilePrefix,finishCallback)},this.loadGLTF=(url,finishCallback,allCompletedCallback,options)=>{sceneLoader.loadGLTF(rootRegion,url,finishCallback,allCompletedCallback,options)},this.updateDirectionalLight=()=>{zincCameraControls.updateDirectionalLight()},this.addObject=object=>{scene.add(object)},this.removeObject=object=>{scene.remove(object)},this.getCurrentTime=()=>{if(videoHandler!=null)return videoHandler.getCurrentTime(duration);var time=rootRegion.getCurrentTime();return-1===time?0:time},this.setMorphsTime=time=>{videoHandler!=null&&videoHandler.setMorphTime(time,duration),rootRegion.setMorphTime(time,!0)},this.isTimeVarying=()=>!!(videoHandler&&videoHandler.video&&!videoHandler.video.error)||rootRegion.isTimeVarying(),this.renderGeometries=(playRate,delta,playAnimation)=>{// Let video dictates the progress if one is present
1203
- var options={};if(options.camera=zincCameraControls,options.displayMarkers=this.displayMarkers,options.markerCluster=markerCluster,options.markersList=markerCluster.markers,options.ndcToBeUpdated=!1,playAnimation&&(options.markerCluster.markerUpdateRequired=!0),!videoHandler)0==sceneLoader.toBeDownloaded?(options.ndcToBeUpdated=zincCameraControls.update(delta),options.ndcToBeUpdated&&zincCameraControls.calculateHeightPerPixelAtZeroDepth(getDrawingHeight()),rootRegion.renderGeometries(playRate,delta,playAnimation,zincCameraControls,options,!0)):zincCameraControls.update(0);else if(videoHandler.isReadyToPlay()){playAnimation?videoHandler.video.play():videoHandler.video.pause();var currentTime=videoHandler.video.currentTime/videoHandler.getVideoDuration()*duration;0==sceneLoader.toBeDownloaded?(zincCameraControls.setTime(currentTime),options.ndcToBeUpdated=zincCameraControls.update(0),options.ndcToBeUpdated&&zincCameraControls.calculateHeightPerPixelAtZeroDepth(getDrawingHeight()),rootRegion.setMorphTime(currentTime,!0),rootRegion.renderGeometries(0,0,playAnimation,zincCameraControls,options,!0)):zincCameraControls.update(0)}else myPlayRate=0;},this.getThreeJSScene=()=>scene,this.setVideoHandler=videoHandlerIn=>{videoHandler||(videoHandler=videoHandlerIn)},this.setAdditionalScenesGroup=scenesGroup=>{scene.add(scenesGroup)};var getWindowsPosition=(align,x_offset,y_offset,width,height,renderer_width,renderer_height)=>{var x=0,y=0;return y=align.includes("top")?renderer_height-height-y_offset:align.includes("bottom")?y_offset:Math.floor((renderer_height-height)/2),x=align.includes("left")?x_offset:align.includes("right")?renderer_width-x_offset-width:Math.floor((renderer_width-width)/2),{x:x,y:y};},renderMinimap=renderer=>{(this.displayMinimap||this.displayMiniAxes)&&(renderer.setScissorTest(!0),renderer.getSize(_markerTarget),this.minimapScissor.updateRequired&&(scissor=getWindowsPosition(this.minimapScissor.align,this.minimapScissor.x_offset,this.minimapScissor.y_offset,this.minimapScissor.width,this.minimapScissor.height,_markerTarget.x,_markerTarget.y),this.minimapScissor.updateRequired=!1),renderer.setScissor(scissor.x,scissor.y,this.minimapScissor.width,this.minimapScissor.height),renderer.setViewport(scissor.x,scissor.y,this.minimapScissor.width,this.minimapScissor.height),minimap.updateCamera(),this.displayMiniAxes?renderer.render(miniAxesScene,minimap.camera):(scene.add(minimap.mask),renderer.render(scene,minimap.camera),scene.remove(minimap.mask)),renderer.setScissorTest(!1),renderer.setViewport(0,0,_markerTarget.x,_markerTarget.y))};/**
1204
- * Render the scene.
1205
- * @private
1206
- */this.render=renderer=>{this.autoClearFlag&&renderer.clear(),stereoEffectFlag&&stereoEffect?stereoEffect.render(scene,this.camera):(renderer.render(scene,this.camera),renderMinimap(renderer))},this.setInteractiveControlEnable=flag=>{!0==flag?zincCameraControls.enable():zincCameraControls.disable()},this.getZincCameraControls=()=>zincCameraControls,this.getThreeJSScene=()=>scene,this.setDuration=durationIn=>{rootRegion.setDuration(durationIn),duration=durationIn,zincCameraControls.setPathDuration(durationIn),sceneLoader.duration=durationIn},this.getDuration=()=>duration,this.setStereoEffectEnable=stereoFlag=>{!0!=stereoFlag||stereoEffect||(stereoEffect=new __webpack_require__(44).StereoEffect(rendererIn)),rendererIn.setSize(getDrawingWidth(),getDrawingHeight()),this.camera.updateProjectionMatrix(),stereoEffectFlag=stereoFlag},this.objectIsInScene=zincObject=>rootRegion.objectIsInRegion(zincObject,!0),this.alignBoundingBoxToCameraView=(boundingBox,transitionTime)=>{if(boundingBox){boundingBox.getCenter(_v3);var viewport=this.getZincCameraControls().getCurrentViewport(),target=new THREE.Vector3(viewport.targetPosition[0],viewport.targetPosition[1],viewport.targetPosition[2]),eyePosition=new THREE.Vector3(viewport.eyePosition[0],viewport.eyePosition[1],viewport.eyePosition[2]),newVec1=new THREE.Vector3,newVec2=new THREE.Vector3;newVec1.subVectors(target,eyePosition).normalize(),newVec2.subVectors(target,_v3).normalize();var newVec3=new THREE.Vector3;newVec3.crossVectors(newVec1,newVec2);var angle=newVec1.angleTo(newVec2);0<transitionTime?(this.getZincCameraControls().rotateCameraTransition(newVec3,angle,transitionTime),this.getZincCameraControls().enableCameraTransition()):this.getZincCameraControls().rotateAboutLookAtpoint(newVec3,angle),markerCluster.markerUpdateRequired=!0}},this.translateBoundingBoxToCameraView=(boundingBox,scaleRadius,transitionTime)=>{if(boundingBox){var oldViewport=this.getZincCameraControls().getCurrentViewport(),viewport=this.getZincCameraControls().getViewportFromBoundingBox(boundingBox,scaleRadius);0<transitionTime&&(this.getZincCameraControls().cameraTransition(oldViewport,viewport,transitionTime),this.getZincCameraControls().enableCameraTransition()),markerCluster.markerUpdateRequired=!0}},this.alignObjectToCameraView=(zincObject,transitionTime)=>{if(this.objectIsInScene(zincObject)){var boundingBox=zincObject.getBoundingBox();this.alignBoundingBoxToCameraView(boundingBox,transitionTime)}},this.setCameraTargetToObject=zincObject=>{if(this.objectIsInScene(zincObject)){var boundingBox=zincObject.getBoundingBox(),viewport=this.getZincCameraControls().getCurrentViewport();boundingBox.getCenter(_v3);var target=new THREE.Vector3(viewport.targetPosition[0],viewport.targetPosition[1],viewport.targetPosition[2]),eyePosition=new THREE.Vector3(viewport.eyePosition[0],viewport.eyePosition[1],viewport.eyePosition[2]),newVec1=new THREE.Vector3,newVec2=new THREE.Vector3;newVec1.subVectors(eyePosition,target),newVec2.addVectors(_v3,newVec1),viewport.eyePosition[0]=newVec2.x,viewport.eyePosition[1]=newVec2.y,viewport.eyePosition[2]=newVec2.z,viewport.targetPosition[0]=_v3.x,viewport.targetPosition[1]=_v3.y,viewport.targetPosition[2]=_v3.z,this.getZincCameraControls().setCurrentCameraSettings(viewport),markerCluster.markerUpdateRequired=!0}},this.isStereoEffectEnable=()=>stereoEffectFlag,this.removeZincObject=zincObject=>{rootRegion.removeZincObject(zincObject),zincCameraControls&&zincCameraControls.calculateMaxAllowedDistance(this),markerCluster.markerUpdateRequired=!0},this.updatePickableThreeJSObjects=()=>{pickableObjectsList.length=0,markerCluster.isEnabled&&pickableObjectsList.push(markerCluster.group),rootRegion.getPickableThreeJSObjects(pickableObjectsList,!0),this.forcePickableObjectsUpdate=!1},this.getPickableThreeJSObjects=()=>((this.forcePickableObjectsUpdate||rootRegion.checkPickableUpdateRequred(!0))&&this.updatePickableThreeJSObjects(),pickableObjectsList),this.getNormalisedMinimapCoordinates=(renderer,event)=>{if(this.displayMinimap){var target=new THREE.Vector2;renderer.getSize(target);var offsetY=target.y-event.clientY;if(scissor.x+this.minimapScissor.width>event.clientX&&event.clientX>scissor.x&&scissor.y+this.minimapScissor.height>offsetY&&offsetY>scissor.y){var x=2*((event.clientX-scissor.x)/this.minimapScissor.width)-1,y=2*((offsetY-scissor.y)/this.minimapScissor.height)-1;return{x:x,y:y};}}},this.getMinimapDiffFromNormalised=(x,y)=>minimap?minimap.getDiffFromNormalised(x,y):void 0,this.isWebGL2=()=>rendererIn.isWebGL2(),this.clearAll=()=>{markerCluster.clear(),rootRegion.clear(!0),this.clearZincObjectAddedCallbacks(),this.clearZincObjectRemovedCallbacks(),sceneLoader.toBeDwonloaded=0,zincCameraControls&&zincCameraControls.calculateMaxAllowedDistance(this),markerCluster.markerUpdateRequired=!0},this.addMetadataTimeStamp=(key,time)=>{metadata.TimeStamps[key]=convertDurationObjectTomSec(time)},this.getMetadataTag=key=>metadata[key],this.getMetadata=()=>metadata,this.setMetadataTag=(key,value)=>{metadata[key]=value},this.removeMetadataTag=key=>{delete metadata[key]},this.resetMetadata=()=>{metadata=defaultMetadata()},this.resetDuration=()=>{this.setDuration(defaultDuration)};// Turn the object into a readable string {years: years,months: months,
1207
- // weeks: weeks, days: days, hours: hours, mins: mins, secs: secs }
1208
- var convertDurationObjectToString=duration=>[...(duration.years?["".concat(duration.years,"years")]:[]),...(duration.months?["".concat(duration.months,"months")]:[]),...(duration.weeks?["".concat(duration.weeks,"weeks")]:[]),...(duration.days?["".concat(duration.days,"days")]:[]),...(duration.hours?["".concat(duration.hours,"hours")]:[]),...(duration.mins?["".concat(duration.mins,"mins")]:[]),...(duration.secs?["".concat(duration.secs,"secs")]:[])].join(" "),convertDurationObjectTomSec=duration=>duration.years?31536e6*duration.years:0+duration.months?2592e6*duration.months:0+duration.weeks?6048e5*duration.weeks:0+duration.days?864e5*duration.days:0+duration.hours?36e5*duration.hours:0+duration.mins?6e4*duration.mins:0+duration.secs?1e3*duration.secs:0;// Turn the object into a number representing milliesecond {years: years,months: months,
1209
- // weeks: weeks, days: days, hours: hours, mins: mins, secs: secs }
1210
- // Set the readable duration and timer using an object
1211
- // with the following format {years: years,months: months, weeks: weeks, days: days,
1212
- // hours: hours, mins: mins, secs: secs }
1213
- // Set the readable original duration using an object
1214
- // with the following format {years: years,months: months, weeks: weeks, days: days,
1215
- // hours: hours, mins: mins, secs: secs }
1216
- /**
1217
- * Export the scene in GLTF format, it can either return it in
1218
- * string or binary form.
1219
- *
1220
- * @param {Boolean} binary - Indicate it should be exported as binary or
1221
- * text.
1222
- *
1223
- * @return {Promise} The exported data if the promise resolve successfully
1224
- *//**
1225
- * Get the root region of the scene.
1226
- *
1227
- * @return {Region} Return the root region of the scene
1228
- *//**
1229
- * Create points in region specified in the path
1230
- *
1231
- *//**
1232
- * Create points in region specified in the path
1233
- *
1234
- *//**
1235
- * Add a callback function which will be called everytime zinc object is added.
1236
- * @param {Function} callbackFunction - callbackFunction to be added.
1237
- *
1238
- * @return {Number}
1239
- *//**
1240
- * Add a callback function which will be called everytime zinc object is removed.
1241
- * @param {Function} callbackFunction - callbackFunction to be added.
1242
- *
1243
- * @return {Number}
1244
- *//**
1245
- * Remove a callback function that is previously added to the scene.
1246
- * @param {Number} id - identifier of the previously added callback function.
1247
- *//**
1248
- * Remove a callback function that is previously added to the scene.
1249
- * @param {Number} id - identifier of the previously added callback function.
1250
- *//**
1251
- * Clear all zinc object callback function
1252
- *//**
1253
- * Clear all zinc object callback function
1254
- *//**
1255
- * Used to trigger zinc object added callback
1256
- *//**
1257
- * Used to trigger zinc object removed callback
1258
- *//*
1259
- * Add temporary points to the scene which can be removed
1260
- * with clearTemporaryPrimitives method.
1261
- *//*
1262
- * Add temporary lines to the scene which can be removed
1263
- * with clearTemporaryPrimitives method.
1264
- *//*
1265
- * Display frustum
1266
- *//*
1267
- * Hide frustum
1268
- *//*
1269
- * Remove object from temporary objects list
1270
- *//*
1271
- * Remove all temporary primitives.
1272
- * Return number of primitives removed;
1273
- *//*
1274
- * Create primitive based on the bounding box of scene and
1275
- * add to specify region and group name.
1276
- *//*
1277
- * Create primitive based on the bounding box of scene and
1278
- * add to specify region and group name.
1279
- *//*
1280
- * Enable marker cluster to work with markers
1281
- *//*
1282
- * Destory static axis display object
1283
- *//*
1284
- * Create static axis display object
1285
- *//*
1286
- * Enable static axis display, createAxisDisplay must be called
1287
- * before the axis can be display.
1288
- */this.setDurationFromObject=duration=>{var string=convertDurationObjectToString(duration),millisec=convertDurationObjectTomSec(duration);this.setMetadataTag("Duration",string),this.setDuration(millisec)},this.setOriginalDurationFromObject=duration=>{var string=convertDurationObjectToString(duration);this.setMetadataTag("OriginalDuration",string)},this.exportGLTF=binary=>{var exporter=new SceneExporter(this);return exporter.exportGLTF(binary);},this.getRootRegion=()=>rootRegion,this.createLines=(regionPath,groupName,coords,colour)=>{var region=rootRegion.findChildFromPath(regionPath);return void 0===region&&(region=rootRegion.createChildFromPath(regionPath)),region.createLines(groupName,coords,colour);},this.createPoints=(regionPath,groupName,coords,labels,colour)=>{var region=rootRegion.findChildFromPath(regionPath);return void 0===region&&(region=rootRegion.createChildFromPath(regionPath)),region.createPoints(groupName,coords,labels,colour);},this.addZincObjectAddedCallbacks=callbackFunction=>(++zincObjectAddedCallbacks_id,zincObjectAddedCallbacks[zincObjectAddedCallbacks_id]=callbackFunction,zincObjectAddedCallbacks_id),this.addZincObjectRemovedCallbacks=callbackFunction=>(++zincObjectRemovedCallbacks_id,zincObjectRemovedCallbacks[zincObjectRemovedCallbacks_id]=callbackFunction,zincObjectRemovedCallbacks_id),this.removeZincObjectAddedCallbacks=id=>{id in zincObjectAddedCallbacks_id&&delete zincObjectAddedCallbacks[id]},this.removeZincObjectRemovedCallbacks=id=>{id in zincObjectRemovedCallbacks_id&&delete zincObjectRemovedCallbacks[id]},this.clearZincObjectAddedCallbacks=()=>{zincObjectAddedCallbacks={},zincObjectAddedCallbacks_id=0},this.clearZincObjectRemovedCallbacks=()=>{zincObjectRemovedCallbacks={},zincObjectRemovedCallbacks_id=0},this.triggerObjectAddedCallback=zincObject=>{for(var key in zincObjectAddedCallbacks)zincObjectAddedCallbacks.hasOwnProperty(key)&&zincObjectAddedCallbacks[key](zincObject);},this.triggerObjectRemovedCallback=zincObject=>{for(var key in zincObjectRemovedCallbacks)zincObjectRemovedCallbacks.hasOwnProperty(key)&&zincObjectRemovedCallbacks[key](zincObject);},this.addTemporaryPoints=(coords,colour)=>{var geometry=createBufferGeometry(coords.length,coords),material=new THREE.PointsMaterial({alphaTest:.5,size:15,color:colour,sizeAttenuation:!1}),texture=getCircularTexture();material.map=texture;var point=new((__webpack_require__(23).Points))(geometry,material);return tempGroup.add(point),point;},this.addTemporaryLines=(coords,colour)=>{var geometry=createBufferGeometry(coords.length,coords),material=new THREE.LineBasicMaterial({color:colour}),line=new((__webpack_require__(12).LineSegments))(geometry,material);return tempGroup.add(line),line;},this.enableFrustumDisplay=()=>{this.camera&&!cameraHelper&&(cameraHelper=new THREE.CameraHelper(this.camera),scene.add(cameraHelper))},this.disableFrustumDisplay=()=>{cameraHelper&&(scene.remove(cameraHelper),cameraHelper.dispose(),cameraHelper=void 0)},this.removeTemporaryPrimitive=object=>{tempGroup.remove(object),object.geometry.dispose(),object.material.dispose()},this.clearTemporaryPrimitives=()=>{var i=0,children=tempGroup.children;return children.forEach(child=>{child.geometry.dispose(),child.material.dispose(),i++}),tempGroup.clear(),i;},this.addBoundingBoxPrimitive=function(regionPath,group,colour,opacity,visibility){var boundingBox=5<arguments.length&&void 0!==arguments[5]?arguments[5]:void 0,region=rootRegion.findChildFromPath(regionPath);void 0===region&&(region=rootRegion.createChildFromPath(regionPath));var box=boundingBox?boundingBox:_this.getBoundingBox();_v3.set(0,0,0);var dim=_v3.subVectors(box.max,box.min),boxGeo=new THREE.BoxGeometry(dim.x,dim.y,dim.z),primitive=region.createGeometryFromThreeJSGeometry(group,boxGeo,colour,opacity,visibility,1e4);return dim.addVectors(box.min,box.max).multiplyScalar(.5),primitive.setPosition(dim.x,dim.y,dim.z),primitive;},this.addSlicesPrimitive=function(regionPath,groups,colours,opacity,visibility){var boundingBox=5<arguments.length&&arguments[5]!==void 0?arguments[5]:void 0;if(groups&&3<=groups.length&&colours&&3<=colours.length){var region=rootRegion.findChildFromPath(regionPath);void 0===region&&(region=rootRegion.createChildFromPath(regionPath));var box=boundingBox?boundingBox:_this.getBoundingBox();_v3.set(0,0,0);var dim=_v3.subVectors(box.max,box.min),primitives=[],index=0;return["x","y","z"].forEach(direction=>{var planeGeo;switch(direction){//YZ plane
1289
- case"x":planeGeo=new THREE.PlaneGeometry(dim.z,dim.y),planeGeo.rotateY(Math.PI/2);// code block
1290
- break;//XZ plane
1291
- case"y":planeGeo=new THREE.PlaneGeometry(dim.x,dim.z),planeGeo.rotateX(Math.PI/2);// code block
1292
- break;//XY plane
1293
- case"z":planeGeo=new THREE.PlaneGeometry(dim.x,dim.y);// code block
1294
- break;default:}var primitive=region.createGeometryFromThreeJSGeometry(groups[index],planeGeo,colours[index],opacity,visibility,10001);primitives.push(primitive),index++}),dim.addVectors(box.min,box.max).multiplyScalar(.5),primitives.forEach(primitive=>{primitive.setPosition(dim.x,dim.y,dim.z)}),primitives;}},this.enableMarkerCluster=flag=>{flag?(markerCluster.markerUpdateRequired=!0,markerCluster.enable()):(markerCluster.markerUpdateRequired=!1,markerCluster.disable()),this.forcePickableObjectsUpdate=!0},this.destroyAxisDisplay=()=>{this.displayMiniAxes=!1,axisDisplay.main&&(this.enableAxisDisplay(!1,!1),axisDisplay.main.forEach(axis=>{axis.dispose&&axis.dispose()})),axisDisplay.mini&&(this.enableAxisDisplay(!1,!0),axisDisplay.mini.forEach(axis=>{axis.dispose&&axis.dispose()})),axisDisplay={main:[],mini:[]}},this.createAxisDisplay=function(){var fitBoundingBox=!!(0<arguments.length&&arguments[0]!==void 0)&&arguments[0];_this.destroyAxisDisplay();var XYZ=[{name:"x",dir:new THREE.Vector3(1,0,0),colour:"red",hex:16733525},{name:"y",dir:new THREE.Vector3(0,1,0),colour:"green",hex:5635925},{name:"z",dir:new THREE.Vector3(0,0,1),colour:"blue",hex:5592575}],boundingBox=_this.getBoundingBox(),size=boundingBox.min.distanceTo(boundingBox.max),origin=new THREE.Vector3(0,0,0);fitBoundingBox&&origin.copy(boundingBox.min),XYZ.forEach(xyzObj=>{var arrowHelper=new THREE.ArrowHelper(xyzObj.dir,origin,size,xyzObj.hex);axisDisplay.main.push(arrowHelper);var miniArrowHelper=new THREE.ArrowHelper(xyzObj.dir,boundingBox.getCenter(_v3),size/2,xyzObj.hex);axisDisplay.mini.push(miniArrowHelper);/*
1295
- const miniLabel = createNewSpriteText(xyzObj.name, 0.1, xyzObj.colour, "Asap", 120, 400);
1296
- const miniPosition = xyzObj.dir.clone().multiplyScalar(size/2).add(_v3[xyzObj.name]);
1297
- miniLabel.position.set(miniPosition.x, miniPosition.y, miniPosition.z);
1298
- axisDisplay.mini.push(miniLabel);
1299
- */var axesLabel=createNewSpriteText(xyzObj.name,.036,xyzObj.colour,"Asap",120,700),position=xyzObj.dir.clone().multiplyScalar(size).add(origin);axesLabel.position.set(position.x,position.y,position.z),axisDisplay.main.push(axesLabel)})},this.enableAxisDisplay=function(enable){var _axisDisplay,miniaxes=!!(1<arguments.length&&arguments[1]!==void 0)&&arguments[1];miniaxes&&null!==(_axisDisplay=axisDisplay)&&void 0!==_axisDisplay&&null!==(_axisDisplay=_axisDisplay.mini)&&void 0!==_axisDisplay&&_axisDisplay.length?(_this.displayMiniAxes=enable,axisDisplay.mini.forEach(axis=>{enable?miniAxesScene.add(axis):miniAxesScene.remove(axis)})):!miniaxes&&axisDisplay.main&&axisDisplay.main.forEach(axis=>{enable?scene.add(axis):scene.remove(axis)})}};
1300
-
1301
- /***/ }),
1302
- /* 33 */
1303
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1304
-
1305
- function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(e){for(var t,r=1;r<arguments.length;r++)t=null==arguments[r]?{}:arguments[r],r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))});return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==typeof i?i:i+""}function _toPrimitive(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}var THREE=__webpack_require__(4),markerImage=new Image(128,128);markerImage.src=__webpack_require__(34);var texture=new THREE.Texture;texture.image=markerImage,texture.needsUpdate=!0;var size=[.02,.03,1],spriteMaterial=new THREE.SpriteMaterial({map:texture,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),createNewSpriteText=(__webpack_require__(5).createNewSpriteText),MarkerCluster=function(sceneIn){(__webpack_require__(10).ZincObject).call(this),this.texture=texture;var sprite=void 0;this.morph=new THREE.Group,this.group=this.morph,this.isMarkerCluster=!0;var enabled=!0,sprites=[];this.markers={};var _v21=new THREE.Vector2,_v22=new THREE.Vector2,start=Date.now();/**
1306
- * Set the size of the marker.
1307
- *
1308
- * @param {Number} size - size to be set.
1309
- */this.setSpriteSize=size=>{sprite.scale.set(.015,.02,1),sprite.scale.multiplyScalar(size)},this.clear=()=>{this.group.clear(),this.markers={}},this.dispose=()=>{this.clear(),this.morph&&this.morph.clear()};var createNewSprite=index=>{//Group is needed to set the position after scaling
1310
- //the sprite
1311
- var localGroup=new THREE.Group,sprite=new THREE.Sprite(spriteMaterial);return sprite.clusterIndex=index,sprite.center.set(.5,0),sprite.position.set(0,0,0),sprite.renderOrder=1e4,sprite.scale.set(size[0],size[1],size[2]),sprite.userData=this,localGroup.add(sprite),this.group.add(localGroup),{group:localGroup,marker:sprite,label:void 0,number:0,min:[0,0,0],max:[1,1,1]};},activateSpriteForCluster=(sprite,cluster,number)=>{sprite.group.visible=!0,sprite.group.position.set(cluster.coords[0],cluster.coords[1],cluster.coords[2]),(sprite.label===void 0||number!==sprite.number)&&(sprite.label&&(sprite.group.remove(sprite.label),sprite.label.material.map.dispose(),sprite.label.material.dispose()),sprite.label=createNewSpriteText(number,.012,"black","Asap",120,700),sprite.number=number,sprite.group.add(sprite.label)),sprite.min=cluster.min,sprite.max=cluster.max},drawClusters=clusters=>{var currentIndex=0;for(clusters.forEach(cluster=>{var length=cluster.members.length,number=0;1===length?cluster.members[0].setVisibility(!0):(cluster.members.forEach(marker=>{number+=marker.getNumber(),marker.setVisibility(!1)}),!sprites[currentIndex]&&sprites.push(createNewSprite(currentIndex)),activateSpriteForCluster(sprites[currentIndex],cluster,number),currentIndex++)}),currentIndex;currentIndex<sprites.length;currentIndex++)sprites[currentIndex].group.visible=!1;},getCluster=(markersObj,clusters)=>{var first=!0,newCluster={members:[],coords:[0,0,0],min:[0,0,0],max:[1,1,1]},dist=0;for(var prop in markersObj)first?(_v21.set(markersObj[prop].ndc.x,markersObj[prop].ndc.y),this._b1.setFromPoints([markersObj[prop].morph.position]),first=!1,newCluster.members.push(markersObj[prop]),newCluster.coords=[markersObj[prop].morph.position.x,markersObj[prop].morph.position.y,markersObj[prop].morph.position.z],clusters.push(newCluster),delete markersObj[prop]):(_v22.set(markersObj[prop].ndc.x,markersObj[prop].ndc.y),dist=_v21.distanceTo(_v22),.1>dist&&(newCluster.members.push(markersObj[prop]),this._b1.expandByPoint(markersObj[prop].morph.position),delete markersObj[prop]));newCluster.min=[this._b1.min.x,this._b1.min.y,this._b1.min.z],newCluster.max=[this._b1.max.x,this._b1.max.y,this._b1.max.z],!0!=first&&getCluster(markersObj,clusters)};//Get clusters based on the ndc coordinate for each cluster.
1312
- /**
1313
- * Enable and visualise the marker.
1314
- *//**
1315
- * Disable and hide the marker.
1316
- */this.calculate=()=>{if(enabled){var current=Date.now();if(500<current-start){var clusters=[];getCluster(_objectSpread({},this.markers),clusters),drawClusters(clusters),start=Date.now(),this.markerUpdateRequired=!1}}},this.isEnabled=()=>enabled,this.enable=()=>{enabled=!0,this.morph.visible=!0},this.disable=()=>{//turn all markers back on
1317
- for(var prop in enabled=!1,this.morph.visible=!1,this.markers){var _this$markers$prop;null!==(_this$markers$prop=this.markers[prop])&&void 0!==_this$markers$prop&&_this$markers$prop.isMarker&&this.markers[prop].isEnabled()&&this.markers[prop].setVisibility(!0)}},this.zoomToCluster=index=>!!(void 0!==index&&-1<index&&(this._v1.set(...sprites[index].min),this._v2.set(...sprites[index].max),Math.abs(0<this._v1.distanceTo(this._v2))))&&(this._b1.set(this._v1,this._v2),sceneIn.translateBoundingBoxToCameraView(this._b1,3,300),this.markerUpdateRequired=!0,!0),this.clusterIsVisible=index=>{if(index!==void 0&&-1<index&&sprites[index]){var _sprites$index$group;return null===(_sprites$index$group=sprites[index].group)||void 0===_sprites$index$group?void 0:_sprites$index$group.visible;}return!1;}};/**
1318
- * A special graphics type with a tear drop shape.
1319
- * It forms a cluster a marker based on distance.
1320
- *
1321
- * @class
1322
- * @author Alan Wu
1323
- * @return {Marker}
1324
- */MarkerCluster.prototype=Object.create((__webpack_require__(10).ZincObject).prototype),exports.MarkerCluster=MarkerCluster;
1325
-
1326
- /***/ }),
1327
- /* 34 */
1328
- /***/ ((module) => {
1329
-
1330
- module.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIHZpZXdCb3g9IjAgMCAzNjUgNTYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4KPGRlZnM+CjwvZGVmcz4KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDApIiBpZD0iODA4ZWQyODMtMjUyNC00NDBmLTg4YWUtM2JkYjQ3YmI1NzQ5IiAgPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii0xODIuNSIgeT0iLTI4MCIgcng9IjAiIHJ5PSIwIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgLz4KPC9nPgo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+CjxnIHN0eWxlPSIiICAgPgo8L2c+CjwvZz4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDk3LjUpIiAgPgo8ZyBzdHlsZT0iIiAgID4KPC9nPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDAuOTkgMCAwIDAuOTkgMTgyLjUgMjgwKSIgID4KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItNTQwIiB5PSItNTQwIiByeD0iMCIgcnk9IjAiIHdpZHRoPSIxMDgwIiBoZWlnaHQ9IjEwODAiIC8+CjwvZz4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxwYXRoIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwxNjUsMCk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHRyYW5zZm9ybT0iIHRyYW5zbGF0ZSgtMTgyLjksIC0yNzkuODUpIiBkPSJNIDE4Mi45IDU1MS43IEMgMTgyLjkgNTUxLjgwMDAwMDAwMDAwMDEgMTgzLjEgNTUyIDE4My4xIDU1MiBDIDE4My4xIDU1MiAzNTguMyAyODMgMzU4LjMgMTk0LjYgQyAzNTguMyA2NC41IDI2OS41IDcuOTAwMDAwMDAwMDAwMDA2IDE4Mi45IDcuNjk5OTk5OTk5OTk5OTg5IEMgOTYuMyA3LjkgNy41IDY0LjUgNy41IDE5NC42IEMgNy41IDI4MyAxODIuOCA1NTIgMTgyLjggNTUyIEMgMTgyLjggNTUyIDE4Mi45IDU1MS43IDE4Mi45IDU1MS43IHogTSAxMjIuMiAxODcuMiBDIDEyMi4yIDE1My42IDE0OS40IDEyNi4zOTk5OTk5OTk5OTk5OSAxODMgMTI2LjM5OTk5OTk5OTk5OTk5IEMgMjE2LjYgMTI2LjM5OTk5OTk5OTk5OTk5IDI0My44IDE1My42IDI0My44IDE4Ny4yIEMgMjQzLjggMjIwLjc5OTk5OTk5OTk5OTk4IDIxNi41IDI0OCAxODIuOSAyNDggQyAxNDkuNCAyNDggMTIyLjIgMjIwLjggMTIyLjIgMTg3LjIgeiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiAvPgo8L2c+CgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPgo8Y2lyY2xlIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgY3g9IjAiIGN5PSIwIiByPSIzNSIgLz4KPC9nPgo8L2c+CjwvZz4KPC9zdmc+"
1331
-
1332
- /***/ }),
1333
- /* 35 */
1334
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1335
-
1336
- function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}var THREE=__webpack_require__(4),resolveURL=(__webpack_require__(5).resolveURL),createNewURL=(__webpack_require__(5).createNewURL),isRegionGroup=(__webpack_require__(5).isRegionGroup),STLLoader=(__webpack_require__(36).STLLoader),OBJLoader=(__webpack_require__(37).OBJLoader),PrimitivesLoader=(__webpack_require__(38).PrimitivesLoader);/**
1337
- * A helper class to help with reading / importing primitives and
1338
- * settings into a {@link Scene}.
1339
- *
1340
- * @class
1341
- * @param {Object} containerIn - Container to create the renderer on.
1342
- * @author Alan Wu
1343
- * @return {SceneLoader}
1344
- */exports.SceneLoader=function(sceneIn){var scene=sceneIn;this.toBeDownloaded=0,this.progressMap={};var viewLoaded=!1,errorDownload=!1,primitivesLoader=new PrimitivesLoader;/**
1345
- * This function returns a three component array, which contains
1346
- * [totalsize, totalLoaded and errorDownload] of all the downloads happening
1347
- * in this scene.
1348
- * @returns {Array}
1349
- */this.getDownloadProgress=()=>{var totalSize=0,totalLoaded=0,unknownFound=!1;for(var key in this.progressMap){var progress=this.progressMap[key];totalSize+=progress[1],totalLoaded+=progress[0],0==progress[1]&&(unknownFound=!0)}return unknownFound&&(totalSize=0),[totalSize,totalLoaded,errorDownload];},this.onProgress=id=>xhr=>{this.progressMap[id]=[xhr.loaded,xhr.total]},this.onError=finishCallback=>xhr=>{--this.toBeDownloaded,errorDownload=!0,console.error("There is an issue with external resource ".concat(null!==xhr&&void 0!==xhr&&xhr.responseURL?": "+(null===xhr||void 0===xhr?void 0:xhr.responseURL):"","."));finishCallback&&finishCallback({type:"Error",xhr})};var loadMultipleViews=(referenceURL,views)=>{var defaultView=views.Default;if(views.Inline)scene.setupMultipleViews(defaultView,views.Entries);else{var _ref2,promises=[],_loop=function _loop(){_ref2=_slicedToArray(_ref3,2);var key=_ref2[0],value=_ref2[1];referenceURL&&(newURL=createNewURL(value,referenceURL),promises.push(new Promise((resolve,reject)=>{// Add parameters if we are sent them
1350
- fetch(newURL).then(response=>response.json()).then(data=>resolve({key:key,data:data})).catch(data=>reject(data))})))};for(var _ref3 of Object.entries(views.Entries))_loop();Promise.all(promises).then(values=>{var entries={};values.forEach(entry=>{entries[entry.key]=entry.data}),scene.setupMultipleViews(defaultView,entries);var zincCameraControls=scene.getZincCameraControls();zincCameraControls&&zincCameraControls.setCurrentViewport(defaultView),viewLoaded=!0})}};/**
1351
- * Load the viewport from an external location provided by the url.
1352
- * @param {String} URL - address to the file containing viewport information.
1353
- */this.loadViewURL=(url,finishCallback)=>{this.toBeDownloaded+=1;var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=()=>{if(4==xmlhttp.readyState)if(200==xmlhttp.status){var viewData=JSON.parse(xmlhttp.responseText);scene.setupMultipleViews("default",{default:viewData}),scene.resetView(),viewLoaded=!0,--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback()}else this.onError(finishCallback)({responseURL:url});};var requestURL=resolveURL(url);xmlhttp.open("GET",requestURL,!0),xmlhttp.send()},this.loadModelsURL=(region,urls,colours,opacities,timeEnabled,morphColour,finishCallback)=>{var number=urls.length;this.toBeDownloaded+=number;for(var i=0;i<number;i++){var filename=urls[i],colour=(__webpack_require__(0).defaultMaterialColor),opacity=(__webpack_require__(0).defaultOpacity);colours!=null&&colours[i]!=null&&(colour=!!colours[i]),opacities!=null&&opacities[i]!=null&&(opacity=opacities[i]);var localTimeEnabled=0;timeEnabled!=null&&timeEnabled[i]!=null&&(localTimeEnabled=!!timeEnabled[i]);var localMorphColour=0;morphColour!=null&&morphColour[i]!=null&&(localMorphColour=!!morphColour[i]),primitivesLoader.load(resolveURL(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))}},this.loadFromViewURL=(targetRegion,jsonFilePrefix,finishCallback)=>{var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){var viewData=JSON.parse(xmlhttp.responseText);scene.loadView(viewData);for(var filename,urls=[],filename_prefix=jsonFilePrefix+"_",i=0;i<viewData.numberOfResources;i++)filename=filename_prefix+(i+1)+".json",urls.push(filename);this.loadModelsURL(targetRegion,urls,viewData.colour,viewData.opacity,viewData.timeEnabled,viewData.morphColour,finishCallback)}};var requestURL=resolveURL(jsonFilePrefix+"_view.json");xmlhttp.open("GET",requestURL,!0),xmlhttp.send()};//Internal loader for a regular zinc geometry.
1354
- var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,lod,tubeLines,finishCallback)=>(geometry,materials)=>{var newLines=tubeLines?new((__webpack_require__(39).TubeLines)):new((__webpack_require__(24).Lines)),material=void 0;materials&&materials[0]&&(material=new THREE.LineBasicMaterial({color:materials[0].color.clone()}),1>materials[0].opacity&&(material.transparent=!0),material.opacity=materials[0].opacity,material.morphTargets=localTimeEnabled,material.vertexColors=materials[0].vertexColors);var options={localTimeEnabled:localTimeEnabled,localMorphColour:localMorphColour};if(newLines&&(newLines.createLineSegment(geometry,material,options),newLines.setName(groupName),newLines.setAnatomicalId(anatomicalId),newLines.setRenderOrder(renderOrder),region.addZincObject(newLines),newLines.setDuration(scene.getDuration()),lod&&lod.levels))for(var _ref6 of Object.entries(lod.levels)){var _ref5=_slicedToArray(_ref6,2),key=_ref5[0],value=_ref5[1];newLines.addLOD(primitivesLoader,key,value.URL,value.Index,lod.preload)}--this.toBeDownloaded,geometry.dispose(),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newLines)};/**
1355
- * Load lines into this scene object.
1356
- *
1357
- * @param {Boolean} timeEnabled - Indicate if morphing is enabled.
1358
- * @param {Boolean} morphColour - Indicate if color morphing is enabled.
1359
- * @param {STRING} groupName - name to assign the pointset's groupname to.
1360
- * @param {Function} finishCallback - Callback function which will be called
1361
- * once the glyphset is succssfully load in.
1362
- */this.loadLinesURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{var localTimeEnabled=0;this.toBeDownloaded+=1;var isInline=!!(null!==options&&void 0!==options&&options.isInline)&&options.isInline,anatomicalId=null!==options&&void 0!==options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&"renderOrder"in options?options.renderOrder:void 0;timeEnabled!=null&&(localTimeEnabled=!!timeEnabled);var localMorphColour=0;morphColour!=null&&(localMorphColour=!!morphColour);var tubeLines=options.tubeLines&&!localTimeEnabled&&!localMorphColour;if(isInline){var object=primitivesLoader.parse(url);linesloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options.lod,tubeLines,finishCallback)(object.geometry,object.materials)}else primitivesLoader.load(url,linesloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options.lod,tubeLines,finishCallback),this.onProgress(url),this.onError(finishCallback),options.loaderOptions);};var glyphsetloader=(region,glyphurl,groupName,finishCallback,options)=>data=>{var glyphsetData=data;("string"==typeof glyphsetData||glyphsetData instanceof String)&&(glyphsetData=JSON.parse(data));var isInline=options&&options.isInline?options.isInline:void 0,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,displayLabels=options&&options.displayLabels?options.displayLabels:void 0,renderOrder=options&&"renderOrder"in options?options.renderOrder:void 0,newGlyphset=new((__webpack_require__(18).Glyphset));newGlyphset.setDuration(scene.getDuration()),newGlyphset.groupName=groupName;var myCallback=()=>{--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newGlyphset)};++this.toBeDownloaded,isInline?newGlyphset.load(glyphsetData,glyphurl,myCallback,isInline,displayLabels):newGlyphset.load(glyphsetData,resolveURL(glyphurl),myCallback,isInline,displayLabels),newGlyphset.setAnatomicalId(anatomicalId),newGlyphset.setRenderOrder(renderOrder),region.addZincObject(newGlyphset)};//Load a glyphset into this scene.
1363
- /**
1364
- * Load a glyphset into this scene object.
1365
- *
1366
- * @param {String} metaurl - Provide informations such as transformations, colours
1367
- * and others for each of the glyph in the glyphsset.
1368
- * @param {String} glyphurl - regular json model file providing geometry of the glyph.
1369
- * @param {String} groupName - name to assign the glyphset's groupname to.
1370
- * @param {Function} finishCallback - Callback function which will be called
1371
- * once the glyphset is succssfully load in.
1372
- */this.loadGlyphsetURL=(region,metaurl,glyphurl,groupName,finishCallback,options)=>{var isInline=!!(options&&options.isInline)&&options.isInline;isInline?glyphsetloader(region,glyphurl,groupName,finishCallback,options)(metaurl):primitivesLoader.load(metaurl,glyphsetloader(region,glyphurl,groupName,finishCallback,options),this.onProgress(metaurl),this.onError(finishCallback),options.loaderOptions)};//Internal loader for zinc pointset.
1373
- var pointsetloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback)=>(geometry,materials)=>{var newPointset=new((__webpack_require__(22).Pointset)),material=new THREE.PointsMaterial({alphaTest:.5,size:10,sizeAttenuation:!1});materials&&materials[0]&&(1>materials[0].opacity&&(material.transparent=!0),material.opacity=materials[0].opacity,material.color=materials[0].color,material.morphTargets=localTimeEnabled,material.vertexColors=materials[0].vertexColors);var options={};options.localTimeEnabled=localTimeEnabled,options.localMorphColour=localMorphColour,newPointset&&(newPointset.createMesh(geometry,material,options),newPointset.setName(groupName),newPointset.setAnatomicalId(anatomicalId),region.addZincObject(newPointset),newPointset.setDuration(scene.getDuration()),newPointset.setRenderOrder(renderOrder)),geometry.dispose(),--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newPointset)};/**
1374
- * Read a STL file into this scene, the geometry will be presented as
1375
- * {@link Zinc.Geometry}.
1376
- *
1377
- * @param {STRING} url - location to the STL file.
1378
- * @param {STRING} groupName - name to assign the geometry's groupname to.
1379
- * @param {Function} finishCallback - Callback function which will be called
1380
- * once the STL geometry is succssfully loaded.
1381
- */this.loadSTL=(region,url,groupName,finishCallback)=>{this.toBeDownloaded+=1;var colour=(__webpack_require__(0).defaultMaterialColor),opacity=(__webpack_require__(0).defaultOpacity),loader=new STLLoader;loader.crossOrigin="Anonymous",loader.load(resolveURL(url),meshloader(region,colour,opacity,!1,!1,groupName,void 0,void 0,void 0,finishCallback))},this.loadOBJ=(region,url,groupName,finishCallback)=>{this.toBeDownloaded+=1;var colour=(__webpack_require__(0).defaultMaterialColor),opacity=(__webpack_require__(0).defaultOpacity),loader=new OBJLoader;loader.crossOrigin="Anonymous",loader.load(resolveURL(url),meshloader(region,colour,opacity,!1,!1,groupName,void 0,void 0,void 0,finishCallback))};/**
1382
- * Load a geometry into this scene, this is a subsequent called from
1383
- * {@link Zinc.Scene#loadMetadataURL}, although it can be used to read
1384
- * in geometry into the scene externally.
1385
- *
1386
- * @param {String} url - regular json model file providing geometry.
1387
- * @param {Boolean} timeEnabled - Indicate if geometry morphing is enabled.
1388
- * @param {Boolean} morphColour - Indicate if color morphing is enabled.
1389
- * @param {STRING} groupName - name to assign the geometry's groupname to.
1390
- * @param {STRING} fileFormat - name supported formats are STL, OBJ and JSON.
1391
- * @param {Function} finishCallback - Callback function which will be called
1392
- * once the geometry is succssfully loaded in.
1393
- */var loadSurfaceURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{this.toBeDownloaded+=1;var colour=(__webpack_require__(0).defaultMaterialColor),opacity=(__webpack_require__(0).defaultOpacity),localTimeEnabled=0,isInline=!!(options&&options.isInline)&&options.isInline,fileFormat=options&&options.fileFormat?options.fileFormat:void 0,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&"renderOrder"in options?options.renderOrder:void 0;timeEnabled!=null&&(localTimeEnabled=!!timeEnabled);var localMorphColour=0;morphColour!=null&&(localMorphColour=!!morphColour);var loader=primitivesLoader;if(fileFormat!==void 0)if("STL"==fileFormat)loader=new STLLoader;else if("OBJ"==fileFormat)return loader=new OBJLoader,loader.crossOrigin="Anonymous",void loader.load(url,objloader(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,finishCallback),this.onProgress(url),this.onError,options.loaderOptions);if(isInline){var object=primitivesLoader.parse(url);meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options,finishCallback)(object.geometry,object.materials)}else loader.crossOrigin="Anonymous",primitivesLoader.load(url,meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options,finishCallback),this.onProgress(url),this.onError(finishCallback),options.loaderOptions);},metaFinishCallback=function metaFinishCallback(numberOfDownloaded,finishCallback,allCompletedCallback){var downloadedItem=0;return zincObject=>{if(++downloadedItem,zincObject&&null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(zincObject),downloadedItem==numberOfDownloaded&&(!1==viewLoaded&&scene.viewAll(),null!=allCompletedCallback&&"function"==typeof allCompletedCallback)){allCompletedCallback();var zincCameraControls=scene.getZincCameraControls();zincCameraControls&&zincCameraControls.calculateMaxAllowedDistance(scene)}};};//Object to keep track of number of items downloaded and when all items are downloaded
1394
- //allCompletedCallback is called
1395
- /**
1396
- * Load a pointset into this scene object.
1397
- *
1398
- * @param {Boolean} timeEnabled - Indicate if morphing is enabled.
1399
- * @param {Boolean} morphColour - Indicate if color morphing is enabled.
1400
- * @param {STRING} groupName - name to assign the pointset's groupname to.
1401
- * @param {Function} finishCallback - Callback function which will be called
1402
- * once the glyphset is succssfully load in.
1403
- */this.loadPointsetURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{var localTimeEnabled=0;this.toBeDownloaded+=1,timeEnabled!=null&&(localTimeEnabled=!!timeEnabled);var localMorphColour=0;morphColour!=null&&(localMorphColour=!!morphColour);var isInline=!!(options&&options.isInline)&&options.isInline,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&"renderOrder"in options?options.renderOrder:void 0;if(isInline){var object=primitivesLoader.parse(url);pointsetloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback)(object.geometry,object.materials)}else primitivesLoader.load(url,pointsetloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback),this.onProgress(url),this.onError(finishCallback),options.loaderOptions);};var loadTexture=(region,referenceURL,textureData,groupName,finishCallback,options)=>{var isInline=options&&options.isInline?options.isInline:void 0,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&"renderOrder"in options?options.renderOrder:void 0,newTexture=void 0;if(textureData){if(referenceURL&&textureData.images&&textureData.images.source)for(var _newURL,source=textureData.images.source,i=0;i<source.length;i++)_newURL=createNewURL(source[i],referenceURL),textureData.images.source[i]=_newURL;if("slides"===textureData.type&&(newTexture=new((__webpack_require__(27).TextureSlides))),newTexture){newTexture.groupName=groupName;var myCallback=()=>{region.addZincObject(newTexture),--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newTexture)};++this.toBeDownloaded,newTexture.load(textureData,myCallback,isInline),newTexture.setAnatomicalId(anatomicalId),newTexture.setRenderOrder(renderOrder)}}},onLoadTextureReady=(region,xmlhttp,groupName,finishCallback,options)=>()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){var textureData=JSON.parse(xmlhttp.responseText);loadTexture(region,xmlhttp.responseURL,textureData,groupName,finishCallback,options)}};//Load a glyphset into this scene.
1404
- /**
1405
- * Load a texture into this scene object.
1406
- *
1407
- * @param {STRING} groupName - name to assign the pointset's groupname to.
1408
- * @param {Function} finishCallback - Callback function which will be called
1409
- * once the glyphset is succssfully load in.
1410
- */this.loadTextureURL=(region,url,groupName,finishCallback,options)=>{var isInline=!!(options&&options.isInline)&&options.isInline;if(isInline)loadTexture(region,void 0,url,groupName,finishCallback,options);else{var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=onLoadTextureReady(region,xmlhttp,groupName,finishCallback,options),xmlhttp.open("GET",resolveURL(url),!0),xmlhttp.send()}};/**
1411
- * Add a user provided {THREE.Geometry} into the scene as zinc geometry.
1412
- *
1413
- * @param {Three.Geometry} geometry - The threejs geometry to be added as {@link Zinc.Geometry}.
1414
- * @param {THREE.Color} color - Colour to be assigned to this geometry, overrided if materialIn is provided.
1415
- * @param {Number} opacity - Opacity to be set for this geometry, overrided if materialIn is provided.
1416
- * @param {Boolean} localTimeEnabled - Set this to true if morph geometry is present, overrided if materialIn is provided.
1417
- * @param {Boolean} localMorphColour - Set this to true if morph colour is present, overrided if materialIn is provided.
1418
- * @param {Boolean} external - Set this to true if morph geometry is present, overrided if materialIn is provided.
1419
- * @param {Function} finishCallback - Callback once the geometry has been added succssfully.
1420
- * @param {THREE.Material} materialIn - Material to be set for this geometry if it is present.
1421
- *
1422
- * @returns {Zinc.Geometry}
1423
- */var addZincGeometry=(region,geometryIn,colour,opacity,localTimeEnabled,localMorphColour,finishCallback,materialIn,groupName,renderOrder,anatomicalId)=>{var options={colour:colour,opacity:opacity,localTimeEnabled:localTimeEnabled,localMorphColour:localMorphColour},newGeometry=new((__webpack_require__(3).Geometry));return newGeometry.createMesh(geometryIn,materialIn,options),newGeometry.getMorph()?(newGeometry.setName(groupName),newGeometry.setRenderOrder(renderOrder),newGeometry.setAnatomicalId(anatomicalId),region&&region.addZincObject(newGeometry),newGeometry.setDuration(scene.getDuration()),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newGeometry),newGeometry.videoHandler&&scene.setVideoHandler(newGeometry.videoHandler),newGeometry):void 0},meshloader=(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options,finishCallback)=>(geometry,materials)=>{var material;materials&&materials[0]&&(material=materials[0]);var zincGeometry=addZincGeometry(region,geometry,colour,opacity,localTimeEnabled,localMorphColour,void 0,material,groupName,renderOrder,anatomicalId);if(options.lod&&options.lod.levels)for(var _ref9 of Object.entries(options.lod.levels)){var _ref8=_slicedToArray(_ref9,2),key=_ref8[0],value=_ref8[1];zincGeometry.addLOD(primitivesLoader,key,value.URL,value.Index,options.lod.preload)}--this.toBeDownloaded,geometry.dispose(),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(zincGeometry)},parseDuration=durationString=>{var regex=/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/,_durationString$match=durationString.match(regex),_durationString$match2=_slicedToArray(_durationString$match,8),years=_durationString$match2[1],months=_durationString$match2[2],weeks=_durationString$match2[3],days=_durationString$match2[4],hours=_durationString$match2[5],mins=_durationString$match2[6],secs=_durationString$match2[7];return{years:years,months:months,weeks:weeks,days:days,hours:hours,mins:mins,secs:secs};};//Internal loader for a regular zinc geometry.
1424
- //Turn ISO 8601 duration string into an array.
1425
- //Load settings from metadata item.
1426
- this.loadSettings=item=>{if(item){//duration uses the ISO 8601 standard - PnYnMnDTnHnMnS
1427
- if(item.Duration){var duration=parseDuration(item.Duration);scene.setDurationFromObject(duration)}if(item.OriginalDuration){var _duration=parseDuration(item.OriginalDuration);scene.setOriginalDurationFromObject(_duration)}if(item.TimeStamps)for(var key in item.TimeStamps){var time=parseDuration(item.TimeStamps[key]);scene.addMetadataTimeStamp(key,time)}}};//Function to process each of the graphical metadata item except for view and
1428
- //settings.
1429
- var readPrimitivesItem=(region,referenceURL,item,order,finishCallback)=>{if(item){var _newURL2=void 0,isInline=!1;item.URL?(_newURL2=item.URL,referenceURL&&(_newURL2=createNewURL(_newURL2,referenceURL))):item.Inline&&(_newURL2=item.Inline.URL,isInline=!0);var lod={};if(item.LOD&&item.LOD.Levels){lod.preload=!!item.LOD.Preload,lod.levels={};for(var _ref10 of Object.entries(item.LOD.Levels)){var _ref1=_slicedToArray(_ref10,2),key=_ref1[0],value=_ref1[1];lod.levels[key]={},lod.levels[key].URL=createNewURL(value.URL,referenceURL),lod.levels[key].Index=value.Index}}var groupName=item.GroupName;(groupName===void 0||""===groupName)&&(groupName="_Unnamed");var options={loaderOptions:{index:item.Index},isInline:isInline,fileFormat:item.FileFormat,anatomicalId:item.AnatomicalId,compression:item.compression,tubeLines:item.tubeLines,lod:lod,renderOrder:order};switch(item.Type){case"Surfaces":loadSurfaceURL(region,_newURL2,item.MorphVertices,item.MorphColours,groupName,finishCallback,options);break;case"Glyph":var newGeometryURL;isInline?newGeometryURL=item.Inline.GlyphGeometriesURL:(newGeometryURL=item.GlyphGeometriesURL,newGeometryURL=createNewURL(item.GlyphGeometriesURL,referenceURL)),item.DisplayLabels&&(options.displayLabels=!0),options.loaderOptions.isGlyphsets=!0,this.loadGlyphsetURL(region,_newURL2,newGeometryURL,groupName,finishCallback,options);break;case"Points":this.loadPointsetURL(region,_newURL2,item.MorphVertices,item.MorphColours,groupName,finishCallback,options);break;case"Lines":this.loadLinesURL(region,_newURL2,item.MorphVertices,item.MorphColours,groupName,finishCallback,options);break;case"Texture":this.loadTextureURL(region,_newURL2,groupName,finishCallback,options);break;default:}}},readViewAndSettingsItem=(referenceURL,item,finishCallback)=>{if(item){var _newURL3=void 0,isInline=!1;switch(item.URL?(_newURL3=item.URL,referenceURL&&(_newURL3=createNewURL(item.URL,referenceURL))):item.Inline&&(_newURL3=item.Inline.URL,isInline=!0),item.Type){case"View":isInline?(scene.setupMultipleViews("default",{default:_newURL3}),viewLoaded=!0,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback()):this.loadViewURL(_newURL3,finishCallback);break;case"Settings":this.loadSettings(item);break;default:}}};//Function to read the view item first
1430
- /**
1431
- * Load GLTF into this scene object.
1432
- *
1433
- * @param {String} url - URL to the GLTF file
1434
- * @param {Function} finishCallback - Callback function which will be called
1435
- * once the glyphset is succssfully load in.
1436
- */this.loadGLTF=(region,url,finishCallback,allCompletedCallback,options)=>{var GLTFToZincJSLoader=new((__webpack_require__(40).GLTFToZincJSLoader));GLTFToZincJSLoader.load(scene,region,url,finishCallback,allCompletedCallback,options)};var loadRegions=(currentRegion,referenceURL,regions,callback)=>{if(regions.Primitives&&regions.Primitives.forEach(primitive=>{var order=1;primitive.Order&&(order=primitive.Order),readPrimitivesItem(currentRegion,referenceURL,primitive,order,callback)}),regions.Transformation&&currentRegion.setTransformation(regions.Transformation),regions.Children)for(var _ref13 of Object.entries(regions.Children)){var _ref12=_slicedToArray(_ref13,2),regionName=_ref12[0],value=_ref12[1],childRegion=currentRegion.findOrCreateChildFromPath(regionName);childRegion&&loadRegions(childRegion,referenceURL,value,callback)}},supplementPrimitivesArray=(array,options)=>{var _options$enabled,_options$enabled2,newArray=array,include=null===options||void 0===options||null===(_options$enabled=options.enabled)||void 0===_options$enabled?void 0:_options$enabled.include,exclude=null===options||void 0===options||null===(_options$enabled2=options.enabled)||void 0===_options$enabled2?void 0:_options$enabled2.exclude,tubeLines=null===options||void 0===options?void 0:options.tubeLines;return(null!==include&&void 0!==include&&include.length||null!==exclude&&void 0!==exclude&&exclude.length)&&(include&&(newArray=array.filter(item=>{if("View"===item.Type)return!0;for(var i=0;i<include.length;i++)if(isRegionGroup(item.RegionPath,item.GroupName,include[i]))return!0;return!1;})),exclude&&(newArray=newArray.filter(item=>{if("View"===item.Type)return!0;for(var i=0;i<exclude.length;i++)if(isRegionGroup(item.RegionPath,item.GroupName,exclude[i]))return!1;return!0;}))),tubeLines&&newArray.forEach(item=>{"Lines"===item.Type&&(item.tubeLines=!0)}),newArray;},supplementMetadataInArray=(metadata,options)=>Array.isArray(metadata)?supplementPrimitivesArray(metadata,options):metadata,getNumberOfDownloadsInArray=(array,includeViews)=>{if(Array.isArray(array)){for(var count=0,i=0;i<array.length;i++)array[i].Type&&(includeViews&&"View"===array[i].Type||"Surfaces"===array[i].Type||"Glyph"===array[i].Type||"Points"===array[i].Type||"Lines"===array[i].Type||"Texture"===array[i].Type)&&count++;return count;}return 0;},getNumberOfObjectsInRegions=regionJson=>{var counts=regionJson.Primitives?getNumberOfDownloadsInArray(regionJson.Primitives,!1):0;return regionJson.Children&&Object.values(regionJson.Children).forEach(childRegion=>{counts+=getNumberOfObjectsInRegions(childRegion)}),counts;},getNumberOfObjects=metadata=>{if(Array.isArray(metadata))return getNumberOfDownloadsInArray(metadata,!0);return"object"==typeof metadata&&null!==metadata&&"2.0"===metadata.Version?getNumberOfObjectsInRegions(metadata.Regions):void 0},readVersionOneRegionPath=(region,referenceURL,item,order,callback)=>{var targetRegion=region;//Render order is set to i * 2 to account for front and back rendering
1437
- item.RegionPath&&""!==item.RegionPath&&(targetRegion=region.findOrCreateChildFromPath(item.RegionPath)),readPrimitivesItem(targetRegion,referenceURL,item,2*order,callback)},loadVersionOne=(targetRegion,metadata,referenceURL,finishCallback,allCompletedCallback,options)=>{// view file does not receive callback
1438
- // Prioritise the view file and settings before loading anything else
1439
- for(var filteredMetada=supplementMetadataInArray(metadata,options),numberOfObjects=getNumberOfObjects(filteredMetada),callback=new metaFinishCallback(numberOfObjects,finishCallback,allCompletedCallback),i=0;i<metadata.length;i++)readViewAndSettingsItem(referenceURL,filteredMetada[i],callback);for(var _i=0;_i<metadata.length;_i++)readVersionOneRegionPath(targetRegion,referenceURL,filteredMetada[_i],_i,callback);},loadVersionTwo=(targetRegion,metadata,referenceURL,finishCallback,allCompletedCallback)=>{var numberOfObjects=getNumberOfObjects(metadata),callback=new metaFinishCallback(numberOfObjects,finishCallback,allCompletedCallback);// view file does not receive callback
1440
- metadata.Settings&&this.loadSettings(metadata.Settings),metadata.Views&&loadMultipleViews(referenceURL,metadata.Views,referenceURL),metadata.Regions&&loadRegions(targetRegion,referenceURL,metadata.Regions,callback)};/**
1441
- * Load a metadata file from the provided URL into this scene. Once
1442
- * succssful scene proceeds to read each items into scene for visualisations.
1443
- *
1444
- * @param {String} url - Location of the metadata file
1445
- * @param {Function} finishCallback - Callback function which will be called
1446
- * @param {options} Optional settings, it can be used to ignore some regions/groups
1447
- * in the metadata file. Only supports version 1 at this moment.
1448
- * for each glyphset and geometry that has been written in.
1449
- */this.loadMetadataURL=(targetRegion,url,finishCallback,allCompletedCallback,options)=>{var xmlhttp=new XMLHttpRequest,requestURL=resolveURL(url);xmlhttp.onreadystatechange=()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){scene.resetMetadata(),scene.resetDuration(),viewLoaded=!1;var referenceURL=xmlhttp.responseURL;referenceURL===void 0&&(referenceURL=new URL(requestURL).href);var metadata=JSON.parse(xmlhttp.responseText);Array.isArray(metadata)?loadVersionOne(targetRegion,metadata,referenceURL,finishCallback,allCompletedCallback,options):"object"==typeof metadata&&null!==metadata&&"2.0"==metadata.Version&&loadVersionTwo(targetRegion,metadata,referenceURL,finishCallback,allCompletedCallback)}},xmlhttp.open("GET",requestURL,!0),xmlhttp.send()}};
1450
-
1451
- /***/ }),
1452
- /* 36 */
1453
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1454
-
1455
- "use strict";
1456
- __webpack_require__.r(__webpack_exports__);
1457
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1458
- /* harmony export */ STLLoader: () => (/* binding */ STLLoader)
1459
- /* harmony export */ });
1460
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
1461
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_0__);
1462
- /**
1463
- * Description: A THREE loader for STL ASCII files, as created by Solidworks and other CAD programs.
1464
- *
1465
- * Supports both binary and ASCII encoded files, with automatic detection of type.
1466
- *
1467
- * The loader returns a non-indexed buffer geometry.
1468
- *
1469
- * Limitations:
1470
- * Binary decoding supports "Magics" color format (http://en.wikipedia.org/wiki/STL_(file_format)#Color_in_binary_STL).
1471
- * There is perhaps some question as to how valid it is to always assume little-endian-ness.
1472
- * ASCII decoding assumes file is UTF-8.
1473
- *
1474
- * Usage:
1475
- * const loader = new STLLoader();
1476
- * loader.load( './models/stl/slotted_disk.stl', function ( geometry ) {
1477
- * scene.add( new THREE.Mesh( geometry ) );
1478
- * });
1479
- *
1480
- * For binary STLs geometry might contain colors for vertices. To use it:
1481
- * // use the same code to load STL as above
1482
- * if (geometry.hasColors) {
1483
- * material = new THREE.MeshPhongMaterial({ opacity: geometry.alpha, vertexColors: true });
1484
- * } else { .... }
1485
- * const mesh = new THREE.Mesh( geometry, material );
1486
- *
1487
- * For ASCII STLs containing multiple solids, each solid is assigned to a different group.
1488
- * Groups can be used to assign a different color by defining an array of materials with the same length of
1489
- * geometry.groups and passing it to the Mesh constructor:
1490
- *
1491
- * const mesh = new THREE.Mesh( geometry, material );
1492
- *
1493
- * For example:
1494
- *
1495
- * const materials = [];
1496
- * const nGeometryGroups = geometry.groups.length;
1497
- *
1498
- * const colorMap = ...; // Some logic to index colors.
1499
- *
1500
- * for (let i = 0; i < nGeometryGroups; i++) {
1501
- *
1502
- * const material = new THREE.MeshPhongMaterial({
1503
- * color: colorMap[i],
1504
- * wireframe: false
1505
- * });
1506
- *
1507
- * }
1508
- *
1509
- * materials.push(material);
1510
- * const mesh = new THREE.Mesh(geometry, materials);
1511
- */class STLLoader extends three__WEBPACK_IMPORTED_MODULE_0__.Loader{constructor(manager){super(manager)}load(url,onLoad,onProgress,onError){var scope=this,loader=new three__WEBPACK_IMPORTED_MODULE_0__.FileLoader(this.manager);loader.setPath(this.path),loader.setResponseType("arraybuffer"),loader.setRequestHeader(this.requestHeader),loader.setWithCredentials(this.withCredentials),loader.load(url,function(text){try{onLoad(scope.parse(text))}catch(e){onError?onError(e):console.error(e),scope.manager.itemError(url)}},onProgress,onError)}parse(data){function matchDataViewAt(query,reader,offset){// Check if each byte in query matches the corresponding byte from the current offset
1512
- for(var i=0,il=query.length;i<il;i++)if(query[i]!==reader.getUint8(offset+i,!1))return!1;return!0;}// start
1513
- var binData=function(buffer){if("string"==typeof buffer){for(var array_buffer=new Uint8Array(buffer.length),i=0;i<buffer.length;i++)array_buffer[i]=255&buffer.charCodeAt(i);// implicitly assumes little-endian
1514
- return array_buffer.buffer||array_buffer;}return buffer;}(data);return function(data){var reader=new DataView(data),n_faces=reader.getUint32(80,!0);if(80+32/8+n_faces*(3*(32/8)+3*(3*(32/8))+16/8)===reader.byteLength)return!0;// An ASCII STL data must begin with 'solid ' as the first six bytes.
1515
- // However, ASCII STLs lacking the SPACE after the 'd' are known to be
1516
- // plentiful. So, check the first 5 bytes for 'solid'.
1517
- // Several encodings, such as UTF-8, precede the text with up to 5 bytes:
1518
- // https://en.wikipedia.org/wiki/Byte_order_mark#Byte_order_marks_by_encoding
1519
- // Search for "solid" to start anywhere after those prefixes.
1520
- // US-ASCII ordinal values for 's', 'o', 'l', 'i', 'd'
1521
- for(var solid=[115,111,108,105,100],off=0;5>off;off++)// If "solid" text is matched to the current offset, declare it to be an ASCII STL.
1522
- if(matchDataViewAt(solid,reader,off))return!1;// Couldn't find "solid" text at the beginning; it is binary STL.
1523
- return!0;}(binData)?function(data){// process STL header
1524
- // check for default color in header ("COLOR=rgba" sequence).
1525
- for(var r,g,b,colors,defaultR,defaultG,defaultB,alpha,reader=new DataView(data),faces=reader.getUint32(80,!0),hasColors=!1,index=0;index<80-10;index++)1129270351==reader.getUint32(index,!1)/*COLO*/&&82==reader.getUint8(index+4)/*'R'*/&&61==reader.getUint8(index+5)/*'='*/&&(hasColors=!0,colors=new Float32Array(3*(3*faces)),defaultR=reader.getUint8(index+6)/255,defaultG=reader.getUint8(index+7)/255,defaultB=reader.getUint8(index+8)/255,alpha=reader.getUint8(index+9)/255);for(var geometry=new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry,vertices=new Float32Array(3*(3*faces)),normals=new Float32Array(3*(3*faces)),face=0;face<faces;face++){var start=84+face*(12*4+2),normalX=reader.getFloat32(start,!0),normalY=reader.getFloat32(start+4,!0),normalZ=reader.getFloat32(start+8,!0);if(hasColors){var packedColor=reader.getUint16(start+48,!0);0==(32768&packedColor)?(r=(31&packedColor)/31,g=(31&packedColor>>5)/31,b=(31&packedColor>>10)/31):(r=defaultR,g=defaultG,b=defaultB)}for(var i=1;3>=i;i++){var vertexstart=start+12*i,componentIdx=3*(3*face)+3*(i-1);vertices[componentIdx]=reader.getFloat32(vertexstart,!0),vertices[componentIdx+1]=reader.getFloat32(vertexstart+4,!0),vertices[componentIdx+2]=reader.getFloat32(vertexstart+8,!0),normals[componentIdx]=normalX,normals[componentIdx+1]=normalY,normals[componentIdx+2]=normalZ,hasColors&&(colors[componentIdx]=r,colors[componentIdx+1]=g,colors[componentIdx+2]=b)}}return geometry.setAttribute("position",new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(vertices,3)),geometry.setAttribute("normal",new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(normals,3)),hasColors&&(geometry.setAttribute("color",new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(colors,3)),geometry.hasColors=!0,geometry.alpha=alpha),geometry;}(binData):function(data){for(var result,geometry=new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry,patternSolid=/solid([\s\S]*?)endsolid/g,patternFace=/facet([\s\S]*?)endfacet/g,faceCounter=0,patternFloat=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,patternVertex=new RegExp("vertex"+patternFloat+patternFloat+patternFloat,"g"),patternNormal=new RegExp("normal"+patternFloat+patternFloat+patternFloat,"g"),vertices=[],normals=[],normal=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,groupCount=0,startVertex=0,endVertex=0;null!==(result=patternSolid.exec(data));){startVertex=endVertex;for(var solid=result[0];null!==(result=patternFace.exec(solid));){for(var vertexCountPerFace=0,normalCountPerFace=0,text=result[0];null!==(result=patternNormal.exec(text));)normal.x=parseFloat(result[1]),normal.y=parseFloat(result[2]),normal.z=parseFloat(result[3]),normalCountPerFace++;for(;null!==(result=patternVertex.exec(text));)vertices.push(parseFloat(result[1]),parseFloat(result[2]),parseFloat(result[3])),normals.push(normal.x,normal.y,normal.z),vertexCountPerFace++,endVertex++;// every face have to own ONE valid normal
1526
- 1!==normalCountPerFace&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+faceCounter),3!==vertexCountPerFace&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+faceCounter),faceCounter++}var start=startVertex,count=endVertex-startVertex;geometry.addGroup(start,count,groupCount),groupCount++}return geometry.setAttribute("position",new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(vertices,3)),geometry.setAttribute("normal",new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(normals,3)),geometry;}(function(buffer){return"string"==typeof buffer?buffer:three__WEBPACK_IMPORTED_MODULE_0__.LoaderUtils.decodeText(new Uint8Array(buffer))}(data));}}
1527
-
1528
- /***/ }),
1529
- /* 37 */
1530
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1531
-
1532
- "use strict";
1533
- __webpack_require__.r(__webpack_exports__);
1534
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1535
- /* harmony export */ OBJLoader: () => (/* binding */ OBJLoader)
1536
- /* harmony export */ });
1537
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
1538
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_0__);
1539
- // o object_name | g group_name
1540
- var _object_pattern=/^[og]\s*(.+)?/,_material_library_pattern=/^mtllib /,_material_use_pattern=/^usemtl /,_map_use_pattern=/^usemap /,_vA=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_vB=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_vC=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_ab=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_cb=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3;// mtllib file_reference
1541
- // usemtl material_name
1542
- // usemap map_name
1543
- function ParserState(){var state={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function startObject(name,fromDeclaration){// If the current object (initial from reset) is not from a g/o declaration in the parsed
1544
- // file. We need to use it for the first parsed g/o to keep things in sync.
1545
- if(this.object&&!1===this.object.fromDeclaration)return this.object.name=name,void(this.object.fromDeclaration=!1!==fromDeclaration);var previousMaterial=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;// Inherit previous objects material.
1546
- // Spec tells us that a declared material must be set to all objects until a new material is declared.
1547
- // If a usemtl declaration is encountered while this new object is being parsed, it will
1548
- // overwrite the inherited material. Exception being that there was already face declarations
1549
- // to the inherited material, then it will be preserved for proper MultiMaterial continuation.
1550
- if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:name||"",fromDeclaration:!1!==fromDeclaration,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function startMaterial(name,libraries){var previous=this._finalize(!1);// New usemtl declaration overwrites an inherited material, except if faces were declared
1551
- // after the material, then it must be preserved for proper MultiMaterial continuation.
1552
- previous&&(previous.inherited||0>=previous.groupCount)&&this.materials.splice(previous.index,1);var material={index:this.materials.length,name:name||"",mtllib:Array.isArray(libraries)&&0<libraries.length?libraries[libraries.length-1]:"",smooth:void 0===previous?this.smooth:previous.smooth,groupStart:void 0===previous?0:previous.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function clone(index){var cloned={index:"number"==typeof index?index:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return cloned.clone=this.clone.bind(cloned),cloned;}};return this.materials.push(material),material;},currentMaterial:function currentMaterial(){return 0<this.materials.length?this.materials[this.materials.length-1]:void 0},_finalize:function _finalize(end){var lastMultiMaterial=this.currentMaterial();// Ignore objects tail materials if no face declarations followed them before a new o/g started.
1553
- if(lastMultiMaterial&&-1===lastMultiMaterial.groupEnd&&(lastMultiMaterial.groupEnd=this.geometry.vertices.length/3,lastMultiMaterial.groupCount=lastMultiMaterial.groupEnd-lastMultiMaterial.groupStart,lastMultiMaterial.inherited=!1),end&&1<this.materials.length)for(var mi=this.materials.length-1;0<=mi;mi--)0>=this.materials[mi].groupCount&&this.materials.splice(mi,1);// Guarantee at least one empty material, this makes the creation later more straight forward.
1554
- return end&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),lastMultiMaterial;}},previousMaterial&&previousMaterial.name&&"function"==typeof previousMaterial.clone){var declared=previousMaterial.clone(0);declared.inherited=!0,this.object.materials.push(declared)}this.objects.push(this.object)},finalize:function finalize(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function parseVertexIndex(value,len){var index=parseInt(value,10);return 3*(0<=index?index-1:index+len/3);},parseNormalIndex:function parseNormalIndex(value,len){var index=parseInt(value,10);return 3*(0<=index?index-1:index+len/3);},parseUVIndex:function parseUVIndex(value,len){var index=parseInt(value,10);return 2*(0<=index?index-1:index+len/2);},addVertex:function addVertex(a,b,c){var src=this.vertices,dst=this.object.geometry.vertices;dst.push(src[a+0],src[a+1],src[a+2]),dst.push(src[b+0],src[b+1],src[b+2]),dst.push(src[c+0],src[c+1],src[c+2])},addVertexPoint:function addVertexPoint(a){var src=this.vertices,dst=this.object.geometry.vertices;dst.push(src[a+0],src[a+1],src[a+2])},addVertexLine:function addVertexLine(a){var src=this.vertices,dst=this.object.geometry.vertices;dst.push(src[a+0],src[a+1],src[a+2])},addNormal:function addNormal(a,b,c){var src=this.normals,dst=this.object.geometry.normals;dst.push(src[a+0],src[a+1],src[a+2]),dst.push(src[b+0],src[b+1],src[b+2]),dst.push(src[c+0],src[c+1],src[c+2])},addFaceNormal:function addFaceNormal(a,b,c){var src=this.vertices,dst=this.object.geometry.normals;_vA.fromArray(src,a),_vB.fromArray(src,b),_vC.fromArray(src,c),_cb.subVectors(_vC,_vB),_ab.subVectors(_vA,_vB),_cb.cross(_ab),_cb.normalize(),dst.push(_cb.x,_cb.y,_cb.z),dst.push(_cb.x,_cb.y,_cb.z),dst.push(_cb.x,_cb.y,_cb.z)},addColor:function addColor(a,b,c){var src=this.colors,dst=this.object.geometry.colors;void 0!==src[a]&&dst.push(src[a+0],src[a+1],src[a+2]),void 0!==src[b]&&dst.push(src[b+0],src[b+1],src[b+2]),void 0!==src[c]&&dst.push(src[c+0],src[c+1],src[c+2])},addUV:function addUV(a,b,c){var src=this.uvs,dst=this.object.geometry.uvs;dst.push(src[a+0],src[a+1]),dst.push(src[b+0],src[b+1]),dst.push(src[c+0],src[c+1])},addDefaultUV:function addDefaultUV(){var dst=this.object.geometry.uvs;dst.push(0,0),dst.push(0,0),dst.push(0,0)},addUVLine:function addUVLine(a){var src=this.uvs,dst=this.object.geometry.uvs;dst.push(src[a+0],src[a+1])},addFace:function addFace(a,b,c,ua,ub,uc,na,nb,nc){var vLen=this.vertices.length,ia=this.parseVertexIndex(a,vLen),ib=this.parseVertexIndex(b,vLen),ic=this.parseVertexIndex(c,vLen);// normals
1555
- if(this.addVertex(ia,ib,ic),this.addColor(ia,ib,ic),void 0!==na&&""!==na){var nLen=this.normals.length;ia=this.parseNormalIndex(na,nLen),ib=this.parseNormalIndex(nb,nLen),ic=this.parseNormalIndex(nc,nLen),this.addNormal(ia,ib,ic)}else this.addFaceNormal(ia,ib,ic);// uvs
1556
- if(void 0!==ua&&""!==ua){var uvLen=this.uvs.length;ia=this.parseUVIndex(ua,uvLen),ib=this.parseUVIndex(ub,uvLen),ic=this.parseUVIndex(uc,uvLen),this.addUV(ia,ib,ic),this.object.geometry.hasUVIndices=!0}else// add placeholder values (for inconsistent face definitions)
1557
- this.addDefaultUV();},addPointGeometry:function addPointGeometry(vertices){this.object.geometry.type="Points";for(var index,vLen=this.vertices.length,vi=0,l=vertices.length;vi<l;vi++)index=this.parseVertexIndex(vertices[vi],vLen),this.addVertexPoint(index),this.addColor(index);},addLineGeometry:function addLineGeometry(vertices,uvs){this.object.geometry.type="Line";for(var vLen=this.vertices.length,uvLen=this.uvs.length,vi=0,l=vertices.length;vi<l;vi++)this.addVertexLine(this.parseVertexIndex(vertices[vi],vLen));for(var uvi=0,_l=uvs.length;uvi<_l;uvi++)this.addUVLine(this.parseUVIndex(uvs[uvi],uvLen));}};return state.startObject("",!1),state;}//
1558
- class OBJLoader extends three__WEBPACK_IMPORTED_MODULE_0__.Loader{constructor(manager){super(manager),this.materials=null}load(url,onLoad,onProgress,onError){var scope=this,loader=new three__WEBPACK_IMPORTED_MODULE_0__.FileLoader(this.manager);loader.setPath(this.path),loader.setRequestHeader(this.requestHeader),loader.setWithCredentials(this.withCredentials),loader.load(url,function(text){try{onLoad(scope.parse(text))}catch(e){onError?onError(e):console.error(e),scope.manager.itemError(url)}},onProgress,onError)}setMaterials(materials){return this.materials=materials,this;}parse(text){var state=new ParserState;-1!==text.indexOf("\r\n")&&(text=text.replace(/\r\n/g,"\n")),-1!==text.indexOf("\\\n")&&(text=text.replace(/\\\n/g,""));// Faster to just trim left side of the line. Use if available.
1559
- for(var lines=text.split("\n"),line="",lineFirstChar="",lineLength=0,result=[],trimLeft="function"==typeof"".trimLeft,i=0,l=lines.length;i<l;i++)if(line=lines[i],line=trimLeft?line.trimLeft():line.trim(),lineLength=line.length,0!==lineLength&&(lineFirstChar=line.charAt(0),"#"!==lineFirstChar))// @todo invoke passed in handler if any
1560
- if("v"===lineFirstChar){var data=line.split(/\s+/);switch(data[0]){case"v":state.vertices.push(parseFloat(data[1]),parseFloat(data[2]),parseFloat(data[3])),7<=data.length?state.colors.push(parseFloat(data[4]),parseFloat(data[5]),parseFloat(data[6])):state.colors.push(void 0,void 0,void 0);break;case"vn":state.normals.push(parseFloat(data[1]),parseFloat(data[2]),parseFloat(data[3]));break;case"vt":state.uvs.push(parseFloat(data[1]),parseFloat(data[2]));}}else if("f"===lineFirstChar){// Parse the face vertex data into an easy to work with format
1561
- for(var vertex,lineData=line.substr(1).trim(),vertexData=lineData.split(/\s+/),faceVertices=[],j=0,jl=vertexData.length;j<jl;j++)if(vertex=vertexData[j],0<vertex.length){var vertexParts=vertex.split("/");faceVertices.push(vertexParts)}// Draw an edge between the first vertex and all subsequent vertices to form an n-gon
1562
- for(var v1=faceVertices[0],_j=1,_jl=faceVertices.length-1;_j<_jl;_j++){var v2=faceVertices[_j],v3=faceVertices[_j+1];state.addFace(v1[0],v2[0],v3[0],v1[1],v2[1],v3[1],v1[2],v2[2],v3[2])}}else if("l"===lineFirstChar){var lineParts=line.substring(1).trim().split(" "),lineVertices=[],lineUVs=[];if(-1===line.indexOf("/"))lineVertices=lineParts;else for(var parts,li=0,llen=lineParts.length;li<llen;li++)parts=lineParts[li].split("/"),""!==parts[0]&&lineVertices.push(parts[0]),""!==parts[1]&&lineUVs.push(parts[1]);state.addLineGeometry(lineVertices,lineUVs)}else if("p"===lineFirstChar){var _lineData=line.substr(1).trim(),pointData=_lineData.split(" ");state.addPointGeometry(pointData)}else if(null!==(result=_object_pattern.exec(line))){// o object_name
1563
- // or
1564
- // g group_name
1565
- // WORKAROUND: https://bugs.chromium.org/p/v8/issues/detail?id=2869
1566
- // let name = result[ 0 ].substr( 1 ).trim();
1567
- var name=(" "+result[0].substr(1).trim()).substr(1);state.startObject(name)}else if(_material_use_pattern.test(line))// material
1568
- state.object.startMaterial(line.substring(7).trim(),state.materialLibraries);else if(_material_library_pattern.test(line))// mtl file
1569
- state.materialLibraries.push(line.substring(7).trim());else if(_map_use_pattern.test(line))// the line is parsed but ignored since the loader assumes textures are defined MTL files
1570
- // (according to https://www.okino.com/conv/imp_wave.htm, 'usemap' is the old-style Wavefront texture reference method)
1571
- console.warn("THREE.OBJLoader: Rendering identifier \"usemap\" not supported. Textures must be defined in MTL files.");else if("s"===lineFirstChar){// smooth shading
1572
- // @todo Handle files that have varying smooth values for a set of faces inside one geometry,
1573
- // but does not define a usemtl for each face set.
1574
- // This should be detected and a dummy material created (later MultiMaterial and geometry groups).
1575
- // This requires some care to not create extra material on each smooth value for "normal" obj files.
1576
- // where explicit usemtl defines geometry groups.
1577
- // Example asset: examples/models/obj/cerberus/Cerberus.obj
1578
- /*
1579
- * http://paulbourke.net/dataformats/obj/
1580
- * or
1581
- * http://www.cs.utah.edu/~boulos/cs3505/obj_spec.pdf
1582
- *
1583
- * From chapter "Grouping" Syntax explanation "s group_number":
1584
- * "group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off.
1585
- * Polygonal elements use group numbers to put elements in different smoothing groups. For free-form
1586
- * surfaces, smoothing groups are either turned on or off; there is no difference between values greater
1587
- * than 0."
1588
- */if(result=line.split(" "),1<result.length){var value=result[1].trim().toLowerCase();state.object.smooth="0"!==value&&"off"!==value}else// ZBrush can produce "s" lines #11707
1589
- state.object.smooth=!0;var material=state.object.currentMaterial();material&&(material.smooth=state.object.smooth)}else{// Handle null terminated files without exception
1590
- if("\0"===line)continue;console.warn("THREE.OBJLoader: Unexpected line: \""+line+"\"")}state.finalize();var container=new three__WEBPACK_IMPORTED_MODULE_0__.Group;container.materialLibraries=[].concat(state.materialLibraries);var hasPrimitives=1!==state.objects.length||0!==state.objects[0].geometry.vertices.length;if(!0==hasPrimitives)for(var _i=0,_l2=state.objects.length;_i<_l2;_i++){var object=state.objects[_i],geometry=object.geometry,materials=object.materials,isLine="Line"===geometry.type,isPoints="Points"===geometry.type,hasVertexColors=!1;// Skip o/g line declarations that did not follow with any faces
1591
- if(0!==geometry.vertices.length){var buffergeometry=new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry;buffergeometry.setAttribute("position",new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(geometry.vertices,3)),0<geometry.normals.length&&buffergeometry.setAttribute("normal",new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(geometry.normals,3)),0<geometry.colors.length&&(hasVertexColors=!0,buffergeometry.setAttribute("color",new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(geometry.colors,3))),!0===geometry.hasUVIndices&&buffergeometry.setAttribute("uv",new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(geometry.uvs,2));for(var createdMaterials=[],mi=0,miLen=materials.length;mi<miLen;mi++){var sourceMaterial=materials[mi],materialHash=sourceMaterial.name+"_"+sourceMaterial.smooth+"_"+hasVertexColors,_material=state.materials[materialHash];if(null!==this.materials)// mtl etc. loaders probably can't create line materials correctly, copy properties to a line material.
1592
- if(_material=this.materials.create(sourceMaterial.name),isLine&&_material&&!(_material instanceof three__WEBPACK_IMPORTED_MODULE_0__.LineBasicMaterial)){var materialLine=new three__WEBPACK_IMPORTED_MODULE_0__.LineBasicMaterial;three__WEBPACK_IMPORTED_MODULE_0__.Material.prototype.copy.call(materialLine,_material),materialLine.color.copy(_material.color),_material=materialLine}else if(isPoints&&_material&&!(_material instanceof three__WEBPACK_IMPORTED_MODULE_0__.PointsMaterial)){var materialPoints=new three__WEBPACK_IMPORTED_MODULE_0__.PointsMaterial({size:10,sizeAttenuation:!1});three__WEBPACK_IMPORTED_MODULE_0__.Material.prototype.copy.call(materialPoints,_material),materialPoints.color.copy(_material.color),materialPoints.map=_material.map,_material=materialPoints}void 0===_material&&(_material=isLine?new three__WEBPACK_IMPORTED_MODULE_0__.LineBasicMaterial:isPoints?new three__WEBPACK_IMPORTED_MODULE_0__.PointsMaterial({size:1,sizeAttenuation:!1}):new three__WEBPACK_IMPORTED_MODULE_0__.MeshPhongMaterial,_material.name=sourceMaterial.name,_material.flatShading=!sourceMaterial.smooth,_material.vertexColors=hasVertexColors,state.materials[materialHash]=_material),createdMaterials.push(_material)}// Create mesh
1593
- var mesh=void 0;if(1<createdMaterials.length){for(var _sourceMaterial,_mi=0,_miLen=materials.length;_mi<_miLen;_mi++)_sourceMaterial=materials[_mi],buffergeometry.addGroup(_sourceMaterial.groupStart,_sourceMaterial.groupCount,_mi);mesh=isLine?new three__WEBPACK_IMPORTED_MODULE_0__.LineSegments(buffergeometry,createdMaterials):isPoints?new three__WEBPACK_IMPORTED_MODULE_0__.Points(buffergeometry,createdMaterials):new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(buffergeometry,createdMaterials)}else mesh=isLine?new three__WEBPACK_IMPORTED_MODULE_0__.LineSegments(buffergeometry,createdMaterials[0]):isPoints?new three__WEBPACK_IMPORTED_MODULE_0__.Points(buffergeometry,createdMaterials[0]):new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(buffergeometry,createdMaterials[0]);mesh.name=object.name,container.add(mesh)}// Create materials
1594
- }else// if there is only the default parser state object with no geometry data, interpret data as point cloud
1595
- if(0<state.vertices.length){var _material2=new three__WEBPACK_IMPORTED_MODULE_0__.PointsMaterial({size:1,sizeAttenuation:!1}),_buffergeometry=new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry;_buffergeometry.setAttribute("position",new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(state.vertices,3)),0<state.colors.length&&void 0!==state.colors[0]&&(_buffergeometry.setAttribute("color",new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(state.colors,3)),_material2.vertexColors=!0);var points=new three__WEBPACK_IMPORTED_MODULE_0__.Points(_buffergeometry,_material2);container.add(points)}return container;}}
1596
-
1597
- /***/ }),
1598
- /* 38 */
1599
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1600
-
1601
- function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(e){for(var t,r=1;r<arguments.length;r++)t=null==arguments[r]?{}:arguments[r],r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))});return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==typeof i?i:i+""}function _toPrimitive(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}var JSONLoader=(__webpack_require__(19).JSONLoader),THREE=__webpack_require__(4),FileLoader=THREE.FileLoader,mergeGlyphData=glyphData=>{var merge=(glyphData1,glyphData2)=>{glyphData1.metadata.number_of_vertices+=glyphData2.metadata.number_of_vertices,"labels"in glyphData1&&glyphData1.labels.push(...glyphData1.labels);var fields=["axis1","axis2","axis3","colors","positions","scale"];fields.forEach(field=>{field in glyphData1&&Object.keys(glyphData1[field]).forEach(step=>{for(var len=glyphData2[field][step].length,i=0;i<len;i++)glyphData1[field][step].push(glyphData2[field][step][i]);})})};if(glyphData&&0<glyphData.length)for(;1<glyphData.length;){var glyphData2=glyphData.splice(1,1);merge(glyphData[0],glyphData2[0])}},mergeGeometries=geometries=>{var merge=(geometry1,geometry2)=>{geometry1.merge(geometry2)};if(geometries&&0<geometries.length){for(;1<geometries.length;){var geometry2=geometries.splice(1,1);merge(geometries[0],geometry2[0])}return geometries[0];}},IndexedSourcesHandler=function IndexedSourcesHandler(urlIn,crossOrigin,onDownloadedCallback){var fileLoader=new FileLoader,jsonLoader=new JSONLoader;fileLoader.crossOrigin=crossOrigin;var url=urlIn,onDownloaded=onDownloadedCallback,data=void 0,downloading=!1,finished=!1,error=void 0,items=[],processItemDownloaded=item=>{var modelData=data[item.index];if(!modelData)processItemError(item,{responseURL:url});else if("GlyphGeometriesURL"in modelData)item.onLoad(modelData);else{var obj=jsonLoader.parse(modelData);item.onLoad(obj.geometry,obj.materials)}},processItemError=item=>{item.onError&&(!error&&(error={responseURL:url}),item.onError(error))};this.downloadCompleted=args=>{try{data=JSON.parse(args[0]),downloading=!1,finished=!0,Array.isArray(data)?items.forEach(item=>processItemDownloaded(item)):items.forEach(item=>processItemError(item))}catch(_unused){items.forEach(item=>processItemError(item))}};var errorHandling=()=>xhr=>{error=xhr,finished=!0,downloading=!1,items.forEach(item=>{processItemError(item)})},progressHandling=()=>xhr=>{items.forEach(item=>{item.onProgress&&item.onProgress(xhr)})};this.load=(index,onLoad,onProgress,onError)=>{var item={index,onLoad,onProgress,onError};finished?data?processItemDownloaded(item):processItemError(error):downloading?items.push(item):(items.push(item),downloading=!0,fileLoader.load(url,onDownloaded,progressHandling,errorHandling))}},MultiSourcesHandler=function MultiSourcesHandler(numberIn,onLoadCallback,options){var allData=[],number=numberIn,onLoad=onLoadCallback,totalDownloaded=0,isGlyphData=options.isGlyphsets;this.itemDownloaded=(order,args)=>{if(allData[order]=args,totalDownloaded++,totalDownloaded==number&&0<allData.length)//Assume when item length is one then it is a glyphset otherwise geometry
1602
- if(!isGlyphData){//All geometries will be merged into the first one
1603
- for(var materials=allData[0][1],geometries=allData.map(data=>data[0]),geometry=mergeGeometries(geometries),i=1;i<number;i++)allData[order][0].dispose(),allData[order][1].forEach(material=>material.dispose());onLoad(geometry,materials)}else{var glyphData=allData.map(item=>JSON.parse(item[0]));mergeGlyphData(glyphData),onLoad(glyphData[0])}}};exports.PrimitivesLoader=function(){var concurrentDownloads=0,MAX_DOWNLOAD=20;this.crossOrigin="Anonymous";var jsonloader=new JSONLoader,fileloader=new FileLoader;fileloader.crossOrigin="Anonymous";var waitingList=[],indexedLoaders={},loadFromMultipleSources=(urls,onLoad,onProgress,onError,options)=>{var number=urls.length,msHandler=new MultiSourcesHandler(number,onLoad,options),order=0;//The order here will give us hint on the sequence on merging the primitives
1604
- urls.forEach(url=>{var newOptions=options?_objectSpread({},options):{};newOptions.msHandler=msHandler,newOptions.order=order,order++,loadFromSingleSource(url,onLoad,onProgress,onError,newOptions)})},handleIndexedSource=(url,onLoad,onProgress,onError,options)=>{var newOptions=options?_objectSpread({},options):{},indexedLoader=indexedLoaders[url];if(!indexedLoader)if(MAX_DOWNLOAD>concurrentDownloads){var onLoadCallback=new onFinally(void 0,this,newOptions);++concurrentDownloads,indexedLoader=new IndexedSourcesHandler(url,this.crossOrigin,onLoadCallback),indexedLoaders[url]=indexedLoader}else waitingList.push({url,onLoad,onProgress,onError,options});indexedLoader&&(newOptions.isHandler=indexedLoader,indexedLoader.load(options.index,onLoad,onProgress,onError))},loadFromSingleSource=(url,onLoad,onProgress,onError,options)=>{if(options&&options.index!==void 0)handleIndexedSource(url,onLoad,onProgress,onError,options);else//Standard loading
1605
- if(MAX_DOWNLOAD>concurrentDownloads){++concurrentDownloads;var onLoadCallback=new onFinally(onLoad,this,options),onErrorCallback=new onFinally(onError,this,options);options.isGlyphsets?fileloader.load(url,onLoadCallback,onProgress,onErrorCallback):(jsonloader.crossOrigin=this.crossOrigin,jsonloader.load(url,onLoadCallback,onProgress,onErrorCallback))}else waitingList.push({url,onLoad,onProgress,onError,options});};//URL to loader pair
1606
- //Load the first file then the rest will be handled separately
1607
- this.load=(url,onLoad,onProgress,onError,options)=>{Array.isArray(url)?loadFromMultipleSources(url,onLoad,onProgress,onError,options):loadFromSingleSource(url,onLoad,onProgress,onError,options)},this.loadFromWaitingList=()=>{for(;MAX_DOWNLOAD>concurrentDownloads;){var item=waitingList.shift();if(item)this.load(item.url,item.onLoad,item.onProgress,item.onError,item.options);else return;}},this.itemRemainingCheck=()=>{if(0===waitingList.length&&0==concurrentDownloads)for(var key in indexedLoaders)indexedLoaders.hasOwnProperty(key)&&delete indexedLoaders[key];};var onFinally=function onFinally(callback,loader,options){return function(){--concurrentDownloads;for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];null!==options&&void 0!==options&&options.msHandler?options.msHandler.itemDownloaded(options.order,args):null!==options&&void 0!==options&&options.isHandler?options.isHandler.downloadCompleted(args):callback&&callback(...args),loader.loadFromWaitingList(),loader.itemRemainingCheck()};};this.parse=data=>loader.parse(data)};
1608
-
1609
- /***/ }),
1610
- /* 39 */
1611
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1612
-
1613
- var THREE=__webpack_require__(4),mergeGeometries=(__webpack_require__(5).mergeGeometries),TubeLines=function(){(__webpack_require__(10).ZincObject).call(this),this.isTubeLines=!0;var dataIn={},geometryConfig={radius:1,radialSegments:8,smooth:!1};/**
1614
- * Create the line segements using geometry and material.
1615
- *
1616
- * @param {THREE.Geomtry} geometryIn - Geometry of lines to be rendered.
1617
- * @param {THREE.Material} materialIn - Material to be set for the lines.
1618
- * @param {Object} options - Provide various options
1619
- * @param {Boolean} options.localTimeEnabled - A flag to indicate either the lines is
1620
- * time dependent.
1621
- * @param {Boolean} options.localMorphColour - A flag to indicate either the colour is
1622
- * time dependent.
1623
- */this.createLineSegment=(geometryIn,materialIn,options)=>{if(geometryIn&&materialIn){dataIn={geometryIn,materialIn,options};var geometry=getTubeLinesGeometry(geometryIn.vertices),material=new THREE.MeshStandardMaterial({color:materialIn.color}),mesh=new THREE.Mesh(geometry,material);this.setMesh(mesh,options.localTimeEnabled,options.localMorphColour)}},this.setWidth=width=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=width,this.morph.material.needsUpdate=!0)},this.setAlpha=function(alpha){var mesh=this.getMorph();mesh.material.opacity=alpha,mesh.material.transparent=1>alpha,mesh.material.depthWrite=.5<alpha},this.setWireframe=wireframe=>{var mesh=this.getMorph();mesh.material.wireframe=wireframe},this.setTubeLines=(radius,radialSegments)=>{if(radius&&radialSegments){var _dataIn=dataIn,geometryIn=_dataIn.geometryIn,mesh=this.getMorph();mesh.geometry.dispose(),geometryConfig=Object.assign(geometryConfig,{radius,radialSegments}),mesh.geometry=getTubeLinesGeometry(geometryIn.vertices)}};/**
1624
- * Get merged geometry from list of geometry vertices
1625
- *
1626
- * @param {Array} vertices - An array of THREE.Vector3 vertices.
1627
- * @returns {Object}
1628
- */var getTubeLinesGeometry=vertices=>{var finalGeometry,_geometryConfig=geometryConfig,radius=_geometryConfig.radius,radialSegments=_geometryConfig.radialSegments,smooth=_geometryConfig.smooth;if(smooth){var curve=new THREE.CatmullRomCurve3(vertices);finalGeometry=new THREE.TubeGeometry(curve,vertices.length,radius,radialSegments,!1)}else{for(var geometries=[],i=0;i+1<vertices.length;i+=2){var _curve=new THREE.LineCurve3(vertices[i],vertices[i+1]),tubeGeometry=new THREE.TubeGeometry(_curve,1,radius,radialSegments,!1);geometries.push(tubeGeometry)}finalGeometry=mergeGeometries(geometries,!0),geometries.forEach(g=>g.dispose())}return finalGeometry;};};/**
1629
- * Provides an object which stores lines.
1630
- * This is created when a valid json file containing lines is read into a {@link Zinc.Scene}
1631
- * object.
1632
- *
1633
- * @class
1634
- * @author Alan Wu
1635
- * @return {TubeLines}
1636
- */TubeLines.prototype=Object.create((__webpack_require__(10).ZincObject).prototype),exports.TubeLines=TubeLines;
1637
-
1638
- /***/ }),
1639
- /* 40 */
1640
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1641
-
1642
- var THREE=__webpack_require__(4),GLTFLoader=(__webpack_require__(41).GLTFLoader),GLTFToZincJSLoader=function(){var _this=this;/**
1643
- * Load GLTF into this scene object.
1644
- *
1645
- * @param {String} url - URL to the GLTF file
1646
- * @param {Function} finishCallback - Callback function which will be called
1647
- * once the glyphset is succssfully load in.
1648
- */this.parseGLTFObjects=(object,region,depth,finishCallback)=>{var childRegion=region;if(0!==depth)if("Object3D"!==object.type){var zincGeometry;if("Mesh"===object.type?zincGeometry=new((__webpack_require__(3).Geometry)):"LineSegments"===object.type?zincGeometry=new((__webpack_require__(24).Lines)):"Points"===object.type&&(zincGeometry=new((__webpack_require__(22).Pointset))),zincGeometry){var localTimeEnabled=!1,localMorphColour=!1;object.geometry&&object.geometry.morphAttributes&&(localTimeEnabled=!!object.geometry.morphAttributes.position,localMorphColour=!!object.geometry.morphAttributes.color),zincGeometry.setMesh(object.clone(),localTimeEnabled,localMorphColour);var morph=zincGeometry.getMorph();zincGeometry.groupName=morph.name,morph.matrixAutoUpdate=!0,region.addZincObject(zincGeometry),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(zincGeometry)}}else if(""!==object.name&&(region&&(childRegion=region.findOrCreateChildFromPath(object.name)),childRegion)){var group=childRegion.getGroup();group.position.copy(object.position),group.rotation.copy(object.rotation),group.quaternion.copy(object.quaternion),group.matrixAutoUpdate=!0}depth++,object.children.forEach(child=>{_this.parseGLTFObjects(child,childRegion,depth,finishCallback)})},this.setCamera=scene=>{scene.viewAll();var cameraControls=scene.getZincCameraControls(),viewport=cameraControls.getCurrentViewport();cameraControls.addViewport("default",viewport),cameraControls.setDefaultViewport("default")},this.load=(scene,region,url,finishCallback,allCompletedCallback)=>{var path=url.substring(0,url.lastIndexOf("/")+1),filename=url.substring(url.lastIndexOf("/")+1,url.length),loader=new GLTFLoader().setPath(path);loader.load(filename,function(gltf){console.log(gltf),_this.parseGLTFObjects(gltf.scene,region,0,finishCallback),_this.setCamera(scene),allCompletedCallback!=null&&"function"==typeof allCompletedCallback&&allCompletedCallback()})}};exports.GLTFToZincJSLoader=GLTFToZincJSLoader;
1649
-
1650
- /***/ }),
1651
- /* 41 */
1652
- /***/ ((module) => {
1653
-
1654
- "use strict";
1655
- module.exports = require("three/examples/jsm/loaders/GLTFLoader");
1656
-
1657
- /***/ }),
1658
- /* 42 */
1659
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1660
-
1661
- var GLTFExporter=(__webpack_require__(43).GLTFExporter),SceneExporter=function(sceneIn){var scene=sceneIn;this.exportGLTF=binary=>{var rootRegion=scene.getRootRegion(),zincObjects=rootRegion.getAllObjects(!0),animations=[];zincObjects.forEach(zincObject=>{zincObject.animationClip&&animations.push({clip:zincObject.animationClip[0],mesh:zincObject.getMorph()})});var exporter=new GLTFExporter,options={binary,animations};return new Promise(resolve=>{exporter.parse(scene.getThreeJSScene(),function(gltf){resolve(gltf)},options)});}};/**
1662
- * Provides an object which uses for exporting the scene
1663
- *
1664
- * @class
1665
- * @author Alan Wu
1666
- * @return {SceneExporter}
1667
- */exports.SceneExporter=SceneExporter;
1668
-
1669
- /***/ }),
1670
- /* 43 */
1671
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1672
-
1673
- "use strict";
1674
- __webpack_require__.r(__webpack_exports__);
1675
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1676
- /* harmony export */ GLTFExporter: () => (/* binding */ GLTFExporter)
1677
- /* harmony export */ });
1678
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
1679
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_0__);
1680
- class GLTFExporter{constructor(){this.pluginCallbacks=[],this.register(function(writer){return new GLTFLightExtension(writer);}),this.register(function(writer){return new GLTFMaterialsUnlitExtension(writer);}),this.register(function(writer){return new GLTFMaterialsPBRSpecularGlossiness(writer);})}register(callback){return-1===this.pluginCallbacks.indexOf(callback)&&this.pluginCallbacks.push(callback),this;}unregister(callback){return-1!==this.pluginCallbacks.indexOf(callback)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(callback),1),this;}/**
1681
- * Parse scenes and generate GLTF output
1682
- * @param {Scene or [THREE.Scenes]} input Scene or Array of THREE.Scenes
1683
- * @param {Function} onDone Callback on completed
1684
- * @param {Object} options options
1685
- */parse(input,onDone,options){for(var writer=new GLTFWriter,plugins=[],i=0,il=this.pluginCallbacks.length;i<il;i++)plugins.push(this.pluginCallbacks[i](writer));writer.setPlugins(plugins),writer.write(input,onDone,options)}}//------------------------------------------------------------------------------
1686
- // Constants
1687
- //------------------------------------------------------------------------------
1688
- var WEBGL_CONSTANTS={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,FLOAT:5126,UNSIGNED_INT:5125,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},THREE_TO_WEBGL={};THREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_0__.NearestFilter]=WEBGL_CONSTANTS.NEAREST,THREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_0__.NearestMipmapNearestFilter]=WEBGL_CONSTANTS.NEAREST_MIPMAP_NEAREST,THREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_0__.NearestMipmapLinearFilter]=WEBGL_CONSTANTS.NEAREST_MIPMAP_LINEAR,THREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_0__.LinearFilter]=WEBGL_CONSTANTS.LINEAR,THREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_0__.LinearMipmapNearestFilter]=WEBGL_CONSTANTS.LINEAR_MIPMAP_NEAREST,THREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_0__.LinearMipmapLinearFilter]=WEBGL_CONSTANTS.LINEAR_MIPMAP_LINEAR,THREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_0__.ClampToEdgeWrapping]=WEBGL_CONSTANTS.CLAMP_TO_EDGE,THREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_0__.RepeatWrapping]=WEBGL_CONSTANTS.REPEAT,THREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_0__.MirroredRepeatWrapping]=WEBGL_CONSTANTS.MIRRORED_REPEAT;var PATH_PROPERTIES={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},GLB_HEADER_BYTES=12,GLB_HEADER_MAGIC=1179937895,GLB_VERSION=2,GLB_CHUNK_PREFIX_BYTES=8,GLB_CHUNK_TYPE_JSON=1313821514,GLB_CHUNK_TYPE_BIN=5130562;// GLB constants
1689
- // https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#glb-file-format-specification
1690
- //------------------------------------------------------------------------------
1691
- // Utility functions
1692
- //------------------------------------------------------------------------------
1693
- /**
1694
- * Compare two arrays
1695
- * @param {Array} array1 Array 1 to compare
1696
- * @param {Array} array2 Array 2 to compare
1697
- * @return {Boolean} Returns true if both arrays are equal
1698
- */function equalArray(array1,array2){return array1.length===array2.length&&array1.every(function(element,index){return element===array2[index];});}/**
1699
- * Converts a string to an ArrayBuffer.
1700
- * @param {string} text
1701
- * @return {ArrayBuffer}
1702
- */function stringToArrayBuffer(text){if(window.TextEncoder!==void 0)return new TextEncoder().encode(text).buffer;for(var value,array=new Uint8Array(new ArrayBuffer(text.length)),i=0,il=text.length;i<il;i++)// Replacing multi-byte character with space(0x20).
1703
- value=text.charCodeAt(i),array[i]=255<value?32:value;return array.buffer;}/**
1704
- * Is identity matrix
1705
- *
1706
- * @param {Matrix4} matrix
1707
- * @returns {Boolean} Returns true, if parameter is identity matrix
1708
- */function isIdentityMatrix(matrix){return equalArray(matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);}/**
1709
- * Get the min and max vectors from the given attribute
1710
- * @param {BufferAttribute} attribute Attribute to find the min/max in range from start to start + count
1711
- * @param {Integer} start
1712
- * @param {Integer} count
1713
- * @return {Object} Object containing the `min` and `max` values (As an array of attribute.itemSize components)
1714
- */function getMinMax(attribute,start,count){for(var output={min:Array(attribute.itemSize).fill(Number.POSITIVE_INFINITY),max:Array(attribute.itemSize).fill(Number.NEGATIVE_INFINITY)},i=start;i<start+count;i++)for(var value,a=0;a<attribute.itemSize;a++)value=void 0,4<attribute.itemSize?value=attribute.array[i*attribute.itemSize+a]:0===a?value=attribute.getX(i):1===a?value=attribute.getY(i):2===a?value=attribute.getZ(i):3==a&&(value=attribute.getW(i)),output.min[a]=Math.min(output.min[a],value),output.max[a]=Math.max(output.max[a],value);return output;}/**
1715
- * Get the required size + padding for a buffer, rounded to the next 4-byte boundary.
1716
- * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#data-alignment
1717
- *
1718
- * @param {Integer} bufferSize The size the original buffer.
1719
- * @returns {Integer} new buffer size with required padding.
1720
- *
1721
- */function getPaddedBufferSize(bufferSize){return 4*Math.ceil(bufferSize/4);}/**
1722
- * Returns a buffer aligned to 4-byte boundary.
1723
- *
1724
- * @param {ArrayBuffer} arrayBuffer Buffer to pad
1725
- * @param {Integer} paddingByte (Optional)
1726
- * @returns {ArrayBuffer} The same buffer if it's already aligned to 4-byte boundary or a new buffer
1727
- */function getPaddedArrayBuffer(arrayBuffer){var paddingByte=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0,paddedLength=getPaddedBufferSize(arrayBuffer.byteLength);if(paddedLength!==arrayBuffer.byteLength){var array=new Uint8Array(paddedLength);if(array.set(new Uint8Array(arrayBuffer)),0!==paddingByte)for(var i=arrayBuffer.byteLength;i<paddedLength;i++)array[i]=paddingByte;return array.buffer;}return arrayBuffer;}var cachedCanvas=null;/**
1728
- * Writer
1729
- */class GLTFWriter{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(plugins){this.plugins=plugins}/**
1730
- * Parse scenes and generate GLTF output
1731
- * @param {Scene or [THREE.Scenes]} input Scene or Array of THREE.Scenes
1732
- * @param {Function} onDone Callback on completed
1733
- * @param {Object} options options
1734
- */write(input,onDone,options){this.options=Object.assign({},{// default options
1735
- binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},options),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(input);var writer=this;Promise.all(this.pending).then(function(){var buffers=writer.buffers,json=writer.json,options=writer.options,extensionsUsed=writer.extensionsUsed,blob=new Blob(buffers,{type:"application/octet-stream"}),extensionsUsedList=Object.keys(extensionsUsed);// Merge buffers.
1736
- // Declare extensions.
1737
- if(0<extensionsUsedList.length&&(json.extensionsUsed=extensionsUsedList),json.buffers&&0<json.buffers.length&&(json.buffers[0].byteLength=blob.size),!0===options.binary){// https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#glb-file-format-specification
1738
- var reader=new window.FileReader;reader.readAsArrayBuffer(blob),reader.onloadend=function(){// Binary chunk.
1739
- var binaryChunk=getPaddedArrayBuffer(reader.result),binaryChunkPrefix=new DataView(new ArrayBuffer(GLB_CHUNK_PREFIX_BYTES));binaryChunkPrefix.setUint32(0,binaryChunk.byteLength,!0),binaryChunkPrefix.setUint32(4,GLB_CHUNK_TYPE_BIN,!0);// JSON chunk.
1740
- var jsonChunk=getPaddedArrayBuffer(stringToArrayBuffer(JSON.stringify(json)),32),jsonChunkPrefix=new DataView(new ArrayBuffer(GLB_CHUNK_PREFIX_BYTES));jsonChunkPrefix.setUint32(0,jsonChunk.byteLength,!0),jsonChunkPrefix.setUint32(4,GLB_CHUNK_TYPE_JSON,!0);// GLB header.
1741
- var header=new ArrayBuffer(GLB_HEADER_BYTES),headerView=new DataView(header);headerView.setUint32(0,GLB_HEADER_MAGIC,!0),headerView.setUint32(4,GLB_VERSION,!0);var totalByteLength=GLB_HEADER_BYTES+jsonChunkPrefix.byteLength+jsonChunk.byteLength+binaryChunkPrefix.byteLength+binaryChunk.byteLength;headerView.setUint32(8,totalByteLength,!0);var glbBlob=new Blob([header,jsonChunkPrefix,jsonChunk,binaryChunkPrefix,binaryChunk],{type:"application/octet-stream"}),glbReader=new window.FileReader;glbReader.readAsArrayBuffer(glbBlob),glbReader.onloadend=function(){onDone(glbReader.result)}}}else if(json.buffers&&0<json.buffers.length){var _reader=new window.FileReader;_reader.readAsDataURL(blob),_reader.onloadend=function(){var base64data=_reader.result;json.buffers[0].uri=base64data,onDone(json)}}else onDone(json);})}/**
1742
- * Serializes a userData.
1743
- *
1744
- * @param {THREE.Object3D|THREE.Material} object
1745
- * @param {Object} objectDef
1746
- */serializeUserData(object,objectDef){if(!(object.userData&&object.userData.isZincObject)&&0!==Object.keys(object.userData).length){var options=this.options,extensionsUsed=this.extensionsUsed;try{var json=JSON.parse(JSON.stringify(object.userData));if(options.includeCustomExtensions&&json.gltfExtensions){for(var extensionName in void 0===objectDef.extensions&&(objectDef.extensions={}),json.gltfExtensions)objectDef.extensions[extensionName]=json.gltfExtensions[extensionName],extensionsUsed[extensionName]=!0;delete json.gltfExtensions}0<Object.keys(json).length&&(objectDef.extras=json)}catch(error){console.warn("THREE.GLTFExporter: userData of '"+object.name+"' "+"won't be serialized because of JSON.stringify error - "+error.message)}}}/**
1747
- * Assign and return a temporal unique id for an object
1748
- * especially which doesn't have .uuid
1749
- * @param {Object} object
1750
- * @return {Integer}
1751
- */getUID(object){return this.uids.has(object)||this.uids.set(object,this.uid++),this.uids.get(object);}/**
1752
- * Checks if normal attribute values are normalized.
1753
- *
1754
- * @param {BufferAttribute} normal
1755
- * @returns {Boolean}
1756
- */isNormalizedNormalAttribute(normal){var cache=this.cache;if(cache.attributesNormalized.has(normal))return!1;for(var v=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,i=0,il=normal.count;i<il;i++)// 0.0005 is from glTF-validator
1757
- if(5e-4<Math.abs(v.fromBufferAttribute(normal,i).length()-1))return!1;return!0;}/**
1758
- * Creates normalized normal buffer attribute.
1759
- *
1760
- * @param {BufferAttribute} normal
1761
- * @returns {BufferAttribute}
1762
- *
1763
- */createNormalizedNormalAttribute(normal){var cache=this.cache;if(cache.attributesNormalized.has(normal))return cache.attributesNormalized.get(normal);for(var attribute=normal.clone(),v=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,i=0,il=attribute.count;i<il;i++)v.fromBufferAttribute(attribute,i),0===v.x&&0===v.y&&0===v.z?v.setX(1):v.normalize(),attribute.setXYZ(i,v.x,v.y,v.z);return cache.attributesNormalized.set(normal,attribute),attribute;}/**
1764
- * Applies a texture transform, if present, to the map definition. Requires
1765
- * the KHR_texture_transform extension.
1766
- *
1767
- * @param {Object} mapDef
1768
- * @param {THREE.Texture} texture
1769
- */applyTextureTransform(mapDef,texture){var didTransform=!1,transformDef={};(0!==texture.offset.x||0!==texture.offset.y)&&(transformDef.offset=texture.offset.toArray(),didTransform=!0),0!==texture.rotation&&(transformDef.rotation=texture.rotation,didTransform=!0),(1!==texture.repeat.x||1!==texture.repeat.y)&&(transformDef.scale=texture.repeat.toArray(),didTransform=!0),didTransform&&(mapDef.extensions=mapDef.extensions||{},mapDef.extensions.KHR_texture_transform=transformDef,this.extensionsUsed.KHR_texture_transform=!0)}/**
1770
- * Process a buffer to append to the default one.
1771
- * @param {ArrayBuffer} buffer
1772
- * @return {Integer}
1773
- */processBuffer(buffer){var json=this.json,buffers=this.buffers;return json.buffers||(json.buffers=[{byteLength:0}]),buffers.push(buffer),0;}/**
1774
- * Process and generate a BufferView
1775
- * @param {BufferAttribute} attribute
1776
- * @param {number} componentType
1777
- * @param {number} start
1778
- * @param {number} count
1779
- * @param {number} target (Optional) Target usage of the BufferView
1780
- * @return {Object}
1781
- */processBufferView(attribute,componentType,start,count,target){var json=this.json;json.bufferViews||(json.bufferViews=[]);// Create a new dataview and dump the attribute's array into it
1782
- var componentSize=componentType===WEBGL_CONSTANTS.UNSIGNED_BYTE?1:componentType===WEBGL_CONSTANTS.UNSIGNED_SHORT?2:4;for(var byteLength=getPaddedBufferSize(count*attribute.itemSize*componentSize),dataView=new DataView(new ArrayBuffer(byteLength)),offset=0,i=start;i<start+count;i++)for(var value,a=0;a<attribute.itemSize;a++)value=void 0,4<attribute.itemSize?value=attribute.array[i*attribute.itemSize+a]:0===a?value=attribute.getX(i):1===a?value=attribute.getY(i):2===a?value=attribute.getZ(i):3==a&&(value=attribute.getW(i)),componentType===WEBGL_CONSTANTS.FLOAT?dataView.setFloat32(offset,value,!0):componentType===WEBGL_CONSTANTS.UNSIGNED_INT?dataView.setUint32(offset,value,!0):componentType===WEBGL_CONSTANTS.UNSIGNED_SHORT?dataView.setUint16(offset,value,!0):componentType===WEBGL_CONSTANTS.UNSIGNED_BYTE&&dataView.setUint8(offset,value),offset+=componentSize;var bufferViewDef={buffer:this.processBuffer(dataView.buffer),byteOffset:this.byteOffset,byteLength:byteLength};target!==void 0&&(bufferViewDef.target=target),target===WEBGL_CONSTANTS.ARRAY_BUFFER&&(bufferViewDef.byteStride=attribute.itemSize*componentSize),this.byteOffset+=byteLength,json.bufferViews.push(bufferViewDef);// @TODO Merge bufferViews where possible.
1783
- var output={id:json.bufferViews.length-1,byteLength:0};return output;}/**
1784
- * Process and generate a BufferView from an image Blob.
1785
- * @param {Blob} blob
1786
- * @return {Promise<Integer>}
1787
- */processBufferViewImage(blob){var writer=this,json=writer.json;return json.bufferViews||(json.bufferViews=[]),new Promise(function(resolve){var reader=new window.FileReader;reader.readAsArrayBuffer(blob),reader.onloadend=function(){var buffer=getPaddedArrayBuffer(reader.result),bufferViewDef={buffer:writer.processBuffer(buffer),byteOffset:writer.byteOffset,byteLength:buffer.byteLength};writer.byteOffset+=buffer.byteLength,resolve(json.bufferViews.push(bufferViewDef)-1)}});}/**
1788
- * Process attribute to generate an accessor
1789
- * @param {BufferAttribute} attribute Attribute to process
1790
- * @param {THREE.BufferGeometry} geometry (Optional) Geometry used for truncated draw range
1791
- * @param {Integer} start (Optional)
1792
- * @param {Integer} count (Optional)
1793
- * @return {Integer|null} Index of the processed accessor on the "accessors" array
1794
- */processAccessor(attribute,geometry,start,count){var componentType,options=this.options,json=this.json;// Detect the component type of the attribute array (float, uint or ushort)
1795
- if(attribute.array.constructor===Float32Array)componentType=WEBGL_CONSTANTS.FLOAT;else if(attribute.array.constructor===Uint32Array)componentType=WEBGL_CONSTANTS.UNSIGNED_INT;else if(attribute.array.constructor===Uint16Array)componentType=WEBGL_CONSTANTS.UNSIGNED_SHORT;else if(attribute.array.constructor===Uint8Array)componentType=WEBGL_CONSTANTS.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");// @TODO Indexed buffer geometry with drawRange not supported yet
1796
- if(void 0===start&&(start=0),void 0===count&&(count=attribute.count),options.truncateDrawRange&&void 0!==geometry&&null===geometry.index){var end=start+count,end2=geometry.drawRange.count===1/0?attribute.count:geometry.drawRange.start+geometry.drawRange.count;start=Math.max(start,geometry.drawRange.start),count=Math.min(end,end2)-start,0>count&&(count=0)}// Skip creating an accessor if the attribute doesn't have data to export
1797
- if(0===count)return null;var bufferViewTarget,minMax=getMinMax(attribute,start,count);void 0!==geometry&&(bufferViewTarget=attribute===geometry.index?WEBGL_CONSTANTS.ELEMENT_ARRAY_BUFFER:WEBGL_CONSTANTS.ARRAY_BUFFER);var bufferView=this.processBufferView(attribute,componentType,start,count,bufferViewTarget),accessorDef={bufferView:bufferView.id,byteOffset:bufferView.byteOffset,componentType:componentType,count:count,max:minMax.max,min:minMax.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[attribute.itemSize]};return!0===attribute.normalized&&(accessorDef.normalized=!0),json.accessors||(json.accessors=[]),json.accessors.push(accessorDef)-1;}/**
1798
- * Process image
1799
- * @param {Image} image to process
1800
- * @param {Integer} format of the image (e.g. RGBFormat, RGBAFormat etc)
1801
- * @param {Boolean} flipY before writing out the image
1802
- * @return {Integer} Index of the processed texture in the "images" array
1803
- */processImage(image,format,flipY){var writer=this,cache=writer.cache,json=writer.json,options=writer.options,pending=writer.pending;cache.images.has(image)||cache.images.set(image,{});var cachedImages=cache.images.get(image),mimeType=format===three__WEBPACK_IMPORTED_MODULE_0__.RGBAFormat?"image/png":"image/jpeg",key=mimeType+":flipY/"+flipY.toString();if(void 0!==cachedImages[key])return cachedImages[key];json.images||(json.images=[]);var imageDef={mimeType:mimeType};if(options.embedImages){var canvas=cachedCanvas=cachedCanvas||document.createElement("canvas");canvas.width=Math.min(image.width,options.maxTextureSize),canvas.height=Math.min(image.height,options.maxTextureSize);var ctx=canvas.getContext("2d");if(!0===flipY&&(ctx.translate(0,canvas.height),ctx.scale(1,-1)),"undefined"!=typeof HTMLImageElement&&image instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&image instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&image instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&image instanceof ImageBitmap)ctx.drawImage(image,0,0,canvas.width,canvas.height);else{format!==three__WEBPACK_IMPORTED_MODULE_0__.RGBAFormat&&format!==three__WEBPACK_IMPORTED_MODULE_0__.RGBFormat&&console.error("GLTFExporter: Only RGB and RGBA formats are supported."),(image.width>options.maxTextureSize||image.height>options.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",image);var data=new Uint8ClampedArray(4*(image.height*image.width));if(format===three__WEBPACK_IMPORTED_MODULE_0__.RGBAFormat)for(var i=0;i<data.length;i+=4)data[i+0]=image.data[i+0],data[i+1]=image.data[i+1],data[i+2]=image.data[i+2],data[i+3]=image.data[i+3];else for(var _i=0,j=0;_i<data.length;_i+=4,j+=3)data[_i+0]=image.data[j+0],data[_i+1]=image.data[j+1],data[_i+2]=image.data[j+2],data[_i+3]=255;ctx.putImageData(new ImageData(data,image.width,image.height),0,0)}!0===options.binary?pending.push(new Promise(function(resolve){canvas.toBlob(function(blob){writer.processBufferViewImage(blob).then(function(bufferViewIndex){imageDef.bufferView=bufferViewIndex,resolve()})},mimeType)})):imageDef.uri=canvas.toDataURL(mimeType)}else imageDef.uri=image.src;var index=json.images.push(imageDef)-1;return cachedImages[key]=index,index;}/**
1804
- * Process sampler
1805
- * @param {Texture} map Texture to process
1806
- * @return {Integer} Index of the processed texture in the "samplers" array
1807
- */processSampler(map){var json=this.json;json.samplers||(json.samplers=[]);var samplerDef={magFilter:THREE_TO_WEBGL[map.magFilter],minFilter:THREE_TO_WEBGL[map.minFilter],wrapS:THREE_TO_WEBGL[map.wrapS],wrapT:THREE_TO_WEBGL[map.wrapT]};return json.samplers.push(samplerDef)-1;}/**
1808
- * Process texture
1809
- * @param {Texture} map Map to process
1810
- * @return {Integer} Index of the processed texture in the "textures" array
1811
- */processTexture(map){var cache=this.cache,json=this.json;if(cache.textures.has(map))return cache.textures.get(map);json.textures||(json.textures=[]);var textureDef={sampler:this.processSampler(map),source:this.processImage(map.image,map.format,map.flipY)};map.name&&(textureDef.name=map.name),this._invokeAll(function(ext){ext.writeTexture&&ext.writeTexture(map,textureDef)});var index=json.textures.push(textureDef)-1;return cache.textures.set(map,index),index;}/**
1812
- * Process material
1813
- * @param {THREE.Material} material Material to process
1814
- * @return {Integer|null} Index of the processed material in the "materials" array
1815
- */processMaterial(material){var cache=this.cache,json=this.json;if(cache.materials.has(material))return cache.materials.get(material);if(material.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;json.materials||(json.materials=[]);// @QUESTION Should we avoid including any attribute that has the default value?
1816
- var materialDef={pbrMetallicRoughness:{}};!0!==material.isMeshStandardMaterial&&!0!==material.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");// pbrMetallicRoughness.baseColorFactor
1817
- var color=material.color.toArray().concat([material.opacity]);// pbrMetallicRoughness.metallicRoughnessTexture
1818
- if(equalArray(color,[1,1,1,1])||(materialDef.pbrMetallicRoughness.baseColorFactor=color),material.isMeshStandardMaterial?(materialDef.pbrMetallicRoughness.metallicFactor=material.metalness,materialDef.pbrMetallicRoughness.roughnessFactor=material.roughness):(materialDef.pbrMetallicRoughness.metallicFactor=.5,materialDef.pbrMetallicRoughness.roughnessFactor=.5),material.metalnessMap||material.roughnessMap)if(material.metalnessMap===material.roughnessMap){var metalRoughMapDef={index:this.processTexture(material.metalnessMap)};this.applyTextureTransform(metalRoughMapDef,material.metalnessMap),materialDef.pbrMetallicRoughness.metallicRoughnessTexture=metalRoughMapDef}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");// pbrMetallicRoughness.baseColorTexture or pbrSpecularGlossiness diffuseTexture
1819
- if(material.map){var baseColorMapDef={index:this.processTexture(material.map)};this.applyTextureTransform(baseColorMapDef,material.map),materialDef.pbrMetallicRoughness.baseColorTexture=baseColorMapDef}if(material.emissive){// note: emissive components are limited to stay within the 0 - 1 range to accommodate glTF spec. see #21849 and #22000.
1820
- var emissive=material.emissive.clone().multiplyScalar(material.emissiveIntensity),maxEmissiveComponent=Math.max(emissive.r,emissive.g,emissive.b);// emissiveTexture
1821
- if(1<maxEmissiveComponent&&(emissive.multiplyScalar(1/maxEmissiveComponent),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<maxEmissiveComponent&&(materialDef.emissiveFactor=emissive.toArray()),material.emissiveMap){var emissiveMapDef={index:this.processTexture(material.emissiveMap)};this.applyTextureTransform(emissiveMapDef,material.emissiveMap),materialDef.emissiveTexture=emissiveMapDef}}// normalTexture
1822
- if(material.normalMap){var normalMapDef={index:this.processTexture(material.normalMap)};material.normalScale&&-1!==material.normalScale.x&&(material.normalScale.x!==material.normalScale.y&&console.warn("THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X."),normalMapDef.scale=material.normalScale.x),this.applyTextureTransform(normalMapDef,material.normalMap),materialDef.normalTexture=normalMapDef}// occlusionTexture
1823
- if(material.aoMap){var occlusionMapDef={index:this.processTexture(material.aoMap),texCoord:1};1!==material.aoMapIntensity&&(occlusionMapDef.strength=material.aoMapIntensity),this.applyTextureTransform(occlusionMapDef,material.aoMap),materialDef.occlusionTexture=occlusionMapDef}// alphaMode
1824
- material.transparent?materialDef.alphaMode="BLEND":0<material.alphaTest&&(materialDef.alphaMode="MASK",materialDef.alphaCutoff=material.alphaTest),material.side===three__WEBPACK_IMPORTED_MODULE_0__.DoubleSide&&(materialDef.doubleSided=!0),""!==material.name&&(materialDef.name=material.name),this.serializeUserData(material,materialDef),this._invokeAll(function(ext){ext.writeMaterial&&ext.writeMaterial(material,materialDef)});var index=json.materials.push(materialDef)-1;return cache.materials.set(material,index),index;}/**
1825
- * Process mesh
1826
- * @param {THREE.Mesh} mesh Mesh to process
1827
- * @return {Integer|null} Index of the processed mesh in the "meshes" array
1828
- */processMesh(mesh){var cache=this.cache,json=this.json,meshCacheKeyParts=[mesh.geometry.uuid];if(Array.isArray(mesh.material))for(var i=0,l=mesh.material.length;i<l;i++)meshCacheKeyParts.push(mesh.material[i].uuid);else meshCacheKeyParts.push(mesh.material.uuid);var meshCacheKey=meshCacheKeyParts.join(":");if(cache.meshes.has(meshCacheKey))return cache.meshes.get(meshCacheKey);var mode,geometry=mesh.geometry;// Use the correct mode
1829
- if(mode=mesh.isLineSegments?WEBGL_CONSTANTS.LINES:mesh.isLineLoop?WEBGL_CONSTANTS.LINE_LOOP:mesh.isLine?WEBGL_CONSTANTS.LINE_STRIP:mesh.isPoints?WEBGL_CONSTANTS.POINTS:mesh.material.wireframe?WEBGL_CONSTANTS.LINES:WEBGL_CONSTANTS.TRIANGLES,!0!==geometry.isBufferGeometry)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");var meshDef={},attributes={},primitives=[],targets=[],nameConversion={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},originalNormal=geometry.getAttribute("normal");// Conversion between attributes names in threejs and gltf spec
1830
- void 0===originalNormal||this.isNormalizedNormalAttribute(originalNormal)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),geometry.setAttribute("normal",this.createNormalizedNormalAttribute(originalNormal)));// @QUESTION Detect if .vertexColors = true?
1831
- // For every attribute create an accessor
1832
- var modifiedAttribute=null;for(var attributeName in geometry.attributes)// Ignore morph target attributes, which are exported later.
1833
- if("morph"!==attributeName.substr(0,5)){var attribute=geometry.attributes[attributeName];attributeName=nameConversion[attributeName]||attributeName.toUpperCase();// Prefix all geometry attributes except the ones specifically
1834
- // listed in the spec; non-spec attributes are considered custom.
1835
- var validVertexAttributes=/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/;if(validVertexAttributes.test(attributeName)||(attributeName="_"+attributeName),cache.attributes.has(this.getUID(attribute))){attributes[attributeName]=cache.attributes.get(this.getUID(attribute));continue;}// JOINTS_0 must be UNSIGNED_BYTE or UNSIGNED_SHORT.
1836
- modifiedAttribute=null;var array=attribute.array;"JOINTS_0"!==attributeName||array instanceof Uint16Array||array instanceof Uint8Array||(console.warn("GLTFExporter: Attribute \"skinIndex\" converted to type UNSIGNED_SHORT."),modifiedAttribute=new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(new Uint16Array(array),attribute.itemSize,attribute.normalized));var accessor=this.processAccessor(modifiedAttribute||attribute,geometry);null!==accessor&&(attributes[attributeName]=accessor,cache.attributes.set(this.getUID(attribute),accessor))}// Skip if no exportable attributes found
1837
- if(void 0!==originalNormal&&geometry.setAttribute("normal",originalNormal),0===Object.keys(attributes).length)return null;// Morph targets
1838
- if(void 0!==mesh.morphTargetInfluences&&0<mesh.morphTargetInfluences.length){var weights=[],targetNames=[],reverseDictionary={};if(void 0!==mesh.morphTargetDictionary)for(var key in mesh.morphTargetDictionary)reverseDictionary[mesh.morphTargetDictionary[key]]=key;for(var _i2=0;_i2<mesh.morphTargetInfluences.length;++_i2){var target={},warned=!1;for(var _attributeName in geometry.morphAttributes){// glTF 2.0 morph supports only POSITION/NORMAL/TANGENT.
1839
- // Three.js doesn't support TANGENT yet.
1840
- if("position"!=_attributeName&&"normal"!==_attributeName&&"color"!==_attributeName){warned||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),warned=!0);continue;}var _attribute=geometry.morphAttributes[_attributeName][_i2],gltfAttributeName=_attributeName.toUpperCase();nameConversion[_attributeName]&&(gltfAttributeName=nameConversion[_attributeName]);// Three.js morph attribute has absolute values while the one of glTF has relative values.
1841
- //
1842
- // glTF 2.0 Specification:
1843
- // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#morph-targets
1844
- var baseAttribute=geometry.attributes[_attributeName];if(cache.attributes.has(this.getUID(_attribute))){target[gltfAttributeName]=cache.attributes.get(this.getUID(_attribute));continue;}// Clones attribute not to override
1845
- var relativeAttribute=baseAttribute.clone();if(!geometry.morphTargetsRelative)if(baseAttribute)for(var j=0,jl=_attribute.count;j<jl;j++)baseAttribute.count>j&&relativeAttribute.setXYZ(j,_attribute.getX(j)-baseAttribute.getX(j),_attribute.getY(j)-baseAttribute.getY(j),_attribute.getZ(j)-baseAttribute.getZ(j));else for(var _j=0,_jl=_attribute.count;_j<_jl;_j++)relativeAttribute.setXYZ(_j,0,0,0);target[gltfAttributeName]=this.processAccessor(relativeAttribute,geometry),cache.attributes.set(this.getUID(baseAttribute),target[gltfAttributeName])}targets.push(target),weights.push(mesh.morphTargetInfluences[_i2]),void 0!==mesh.morphTargetDictionary&&targetNames.push(reverseDictionary[_i2])}meshDef.weights=weights,0<targetNames.length&&(meshDef.extras={},meshDef.extras.targetNames=targetNames)}var isMultiMaterial=Array.isArray(mesh.material);if(isMultiMaterial&&0===geometry.groups.length)return null;for(var primitive,materials=isMultiMaterial?mesh.material:[mesh.material],groups=isMultiMaterial?geometry.groups:[{materialIndex:0,start:void 0,count:void 0}],_i3=0,il=groups.length;_i3<il;_i3++){if(primitive={mode:mode,attributes:attributes},this.serializeUserData(geometry,primitive),0<targets.length&&(primitive.targets=targets),null!==geometry.index){var cacheKey=this.getUID(geometry.index);(void 0!==groups[_i3].start||void 0!==groups[_i3].count)&&(cacheKey+=":"+groups[_i3].start+":"+groups[_i3].count),cache.attributes.has(cacheKey)?primitive.indices=cache.attributes.get(cacheKey):(primitive.indices=this.processAccessor(geometry.index,geometry,groups[_i3].start,groups[_i3].count),cache.attributes.set(cacheKey,primitive.indices)),null===primitive.indices&&delete primitive.indices}var material=this.processMaterial(materials[groups[_i3].materialIndex]);null!==material&&(primitive.material=material),primitives.push(primitive)}meshDef.primitives=primitives,json.meshes||(json.meshes=[]),this._invokeAll(function(ext){ext.writeMesh&&ext.writeMesh(mesh,meshDef)});var index=json.meshes.push(meshDef)-1;return cache.meshes.set(meshCacheKey,index),index;}/**
1846
- * Process camera
1847
- * @param {THREE.Camera} camera Camera to process
1848
- * @return {Integer} Index of the processed mesh in the "camera" array
1849
- */processCamera(camera){var json=this.json;json.cameras||(json.cameras=[]);var isOrtho=camera.isOrthographicCamera,cameraDef={type:isOrtho?"orthographic":"perspective"};return isOrtho?cameraDef.orthographic={xmag:2*camera.right,ymag:2*camera.top,zfar:0>=camera.far?.001:camera.far,znear:0>camera.near?0:camera.near}:cameraDef.perspective={aspectRatio:camera.aspect,yfov:three__WEBPACK_IMPORTED_MODULE_0__.MathUtils.degToRad(camera.fov),zfar:0>=camera.far?.001:camera.far,znear:0>camera.near?0:camera.near},""!==camera.name&&(cameraDef.name=camera.type),json.cameras.push(cameraDef)-1;}/**
1850
- * Creates glTF animation entry from AnimationClip object.
1851
- *
1852
- * Status:
1853
- * - Only properties listed in PATH_PROPERTIES may be animated.
1854
- *
1855
- * @param {THREE.AnimationClip} clip
1856
- * @param {THREE.Object3D} root
1857
- * @return {number|null}
1858
- */processAnimation(clip,root){var json=this.json,nodeMap=this.nodeMap;json.animations||(json.animations=[]),clip=GLTFExporter.Utils.mergeMorphTargetTracks(clip.clone(),root);for(var tracks=clip.tracks,channels=[],samplers=[],i=0;i<tracks.length;++i){var track=tracks[i],trackBinding=three__WEBPACK_IMPORTED_MODULE_0__.PropertyBinding.parseTrackName(track.name),trackNode=three__WEBPACK_IMPORTED_MODULE_0__.PropertyBinding.findNode(root,trackBinding.nodeName),trackProperty=PATH_PROPERTIES[trackBinding.propertyName];if("bones"===trackBinding.objectName&&(!0===trackNode.isSkinnedMesh?trackNode=trackNode.skeleton.getBoneByName(trackBinding.objectIndex):trackNode=void 0),!trackNode||!trackProperty)return console.warn("THREE.GLTFExporter: Could not export animation track \"%s\".",track.name),null;var inputItemSize=1,outputItemSize=track.values.length/track.times.length;trackProperty===PATH_PROPERTIES.morphTargetInfluences&&(outputItemSize/=trackNode.morphTargetInfluences.length);var interpolation=void 0;// @TODO export CubicInterpolant(InterpolateSmooth) as CUBICSPLINE
1859
- // Detecting glTF cubic spline interpolant by checking factory method's special property
1860
- // GLTFCubicSplineInterpolant is a custom interpolant and track doesn't return
1861
- // valid value from .getInterpolation().
1862
- !0===track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(interpolation="CUBICSPLINE",outputItemSize/=3):track.getInterpolation()===three__WEBPACK_IMPORTED_MODULE_0__.InterpolateDiscrete?interpolation="STEP":interpolation="LINEAR",samplers.push({input:this.processAccessor(new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(track.times,inputItemSize)),output:this.processAccessor(new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(track.values,outputItemSize)),interpolation:interpolation}),channels.push({sampler:samplers.length-1,target:{node:nodeMap.get(trackNode),path:trackProperty}})}return json.animations.push({name:clip.name||"clip_"+json.animations.length,samplers:samplers,channels:channels}),json.animations.length-1;}/**
1863
- * @param {THREE.Object3D} object
1864
- * @return {number|null}
1865
- */processSkin(object){var json=this.json,nodeMap=this.nodeMap,node=json.nodes[nodeMap.get(object)],skeleton=object.skeleton;if(skeleton===void 0)return null;var rootJoint=object.skeleton.bones[0];if(rootJoint===void 0)return null;for(var joints=[],inverseBindMatrices=new Float32Array(16*skeleton.bones.length),temporaryBoneInverse=new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4,i=0;i<skeleton.bones.length;++i)joints.push(nodeMap.get(skeleton.bones[i])),temporaryBoneInverse.copy(skeleton.boneInverses[i]),temporaryBoneInverse.multiply(object.bindMatrix).toArray(inverseBindMatrices,16*i);json.skins===void 0&&(json.skins=[]),json.skins.push({inverseBindMatrices:this.processAccessor(new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(inverseBindMatrices,16)),joints:joints,skeleton:nodeMap.get(rootJoint)});var skinIndex=node.skin=json.skins.length-1;return skinIndex;}/**
1866
- * Process Object3D node
1867
- * @param {THREE.Object3D} node Object3D to processNode
1868
- * @return {Integer} Index of the node in the nodes list
1869
- */processNode(object){var json=this.json,options=this.options,nodeMap=this.nodeMap;json.nodes||(json.nodes=[]);var nodeDef={};if(options.trs){var rotation=object.quaternion.toArray(),position=object.position.toArray(),scale=object.scale.toArray();equalArray(rotation,[0,0,0,1])||(nodeDef.rotation=rotation),equalArray(position,[0,0,0])||(nodeDef.translation=position),equalArray(scale,[1,1,1])||(nodeDef.scale=scale)}else object.matrixAutoUpdate&&object.updateMatrix(),!1===isIdentityMatrix(object.matrix)&&(nodeDef.matrix=object.matrix.elements);// We don't export empty strings name because it represents no-name in Three.js.
1870
- if(""!==object.name&&(nodeDef.name=object.name+""),this.serializeUserData(object,nodeDef),object.isMesh||object.isLine||object.isPoints){var meshIndex=this.processMesh(object);null!==meshIndex&&(nodeDef.mesh=meshIndex)}else object.isCamera&&(nodeDef.camera=this.processCamera(object));if(object.isSkinnedMesh&&this.skins.push(object),0<object.children.length){for(var child,children=[],i=0,l=object.children.length;i<l;i++)if(child=object.children[i],child.visible||!1===options.onlyVisible){var _nodeIndex=this.processNode(child);null!==_nodeIndex&&children.push(_nodeIndex)}0<children.length&&(nodeDef.children=children)}this._invokeAll(function(ext){ext.writeNode&&ext.writeNode(object,nodeDef)});var nodeIndex=json.nodes.push(nodeDef)-1;return nodeMap.set(object,nodeIndex),nodeIndex;}/**
1871
- * Process Scene
1872
- * @param {Scene} node Scene to process
1873
- */processScene(scene){var json=this.json,options=this.options;json.scenes||(json.scenes=[],json.scene=0);var sceneDef={};""!==scene.name&&(sceneDef.name=scene.name),json.scenes.push(sceneDef);for(var child,nodes=[],i=0,l=scene.children.length;i<l;i++)if(child=scene.children[i],child.visible||!1===options.onlyVisible){var nodeIndex=this.processNode(child);null!==nodeIndex&&nodes.push(nodeIndex)}0<nodes.length&&(sceneDef.nodes=nodes),this.serializeUserData(scene,sceneDef)}/**
1874
- * Creates a Scene to hold a list of objects and parse it
1875
- * @param {Array} objects List of objects to process
1876
- */processObjects(objects){var scene=new three__WEBPACK_IMPORTED_MODULE_0__.Scene;scene.name="AuxScene";for(var i=0;i<objects.length;i++)// We push directly to children instead of calling `add` to prevent
1877
- // modify the .parent and break its original scene and hierarchy
1878
- scene.children.push(objects[i]);this.processScene(scene)}/**
1879
- * @param {THREE.Object3D|Array<THREE.Object3D>} input
1880
- */processInput(input){var options=this.options;input=input instanceof Array?input:[input],this._invokeAll(function(ext){ext.beforeParse&&ext.beforeParse(input)});for(var objectsWithoutScene=[],i=0;i<input.length;i++)input[i]instanceof three__WEBPACK_IMPORTED_MODULE_0__.Scene?this.processScene(input[i]):objectsWithoutScene.push(input[i]);0<objectsWithoutScene.length&&this.processObjects(objectsWithoutScene);for(var _i4=0;_i4<this.skins.length;++_i4)this.processSkin(this.skins[_i4]);for(var _i5=0;_i5<options.animations.length;++_i5)this.processAnimation(options.animations[_i5].clip,options.animations[_i5].mesh);this._invokeAll(function(ext){ext.afterParse&&ext.afterParse(input)})}_invokeAll(func){for(var i=0,il=this.plugins.length;i<il;i++)func(this.plugins[i]);}}/**
1881
- * Punctual Lights Extension
1882
- *
1883
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual
1884
- */class GLTFLightExtension{constructor(writer){this.writer=writer,this.name="KHR_lights_punctual"}writeNode(light,nodeDef){if(light.isLight){if(!light.isDirectionalLight&&!light.isPointLight&&!light.isSpotLight)return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",light);var writer=this.writer,json=writer.json,extensionsUsed=writer.extensionsUsed,lightDef={};light.name&&(lightDef.name=light.name),lightDef.color=light.color.toArray(),lightDef.intensity=light.intensity,light.isDirectionalLight?lightDef.type="directional":light.isPointLight?(lightDef.type="point",0<light.distance&&(lightDef.range=light.distance)):light.isSpotLight&&(lightDef.type="spot",0<light.distance&&(lightDef.range=light.distance),lightDef.spot={},lightDef.spot.innerConeAngle=-1*((light.penumbra-1)*light.angle),lightDef.spot.outerConeAngle=light.angle),void 0!==light.decay&&2!==light.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, "+"and expects light.decay=2."),light.target&&(light.target.parent!==light||0!==light.target.position.x||0!==light.target.position.y||-1!==light.target.position.z)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, "+"make light.target a child of the light with position 0,0,-1."),extensionsUsed[this.name]||(json.extensions=json.extensions||{},json.extensions[this.name]={lights:[]},extensionsUsed[this.name]=!0);var lights=json.extensions[this.name].lights;lights.push(lightDef),nodeDef.extensions=nodeDef.extensions||{},nodeDef.extensions[this.name]={light:lights.length-1}}}}/**
1885
- * Unlit Materials Extension
1886
- *
1887
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit
1888
- */class GLTFMaterialsUnlitExtension{constructor(writer){this.writer=writer,this.name="KHR_materials_unlit"}writeMaterial(material,materialDef){if(material.isMeshBasicMaterial){var writer=this.writer,extensionsUsed=writer.extensionsUsed;materialDef.extensions=materialDef.extensions||{},materialDef.extensions[this.name]={},extensionsUsed[this.name]=!0,materialDef.pbrMetallicRoughness.metallicFactor=0,materialDef.pbrMetallicRoughness.roughnessFactor=.9}}}/**
1889
- * Specular-Glossiness Extension
1890
- *
1891
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness
1892
- */class GLTFMaterialsPBRSpecularGlossiness{constructor(writer){this.writer=writer,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(material,materialDef){if(material.isGLTFSpecularGlossinessMaterial){var writer=this.writer,extensionsUsed=writer.extensionsUsed,extensionDef={};materialDef.pbrMetallicRoughness.baseColorFactor&&(extensionDef.diffuseFactor=materialDef.pbrMetallicRoughness.baseColorFactor);var specularFactor=[1,1,1];if(material.specular.toArray(specularFactor,0),extensionDef.specularFactor=specularFactor,extensionDef.glossinessFactor=material.glossiness,materialDef.pbrMetallicRoughness.baseColorTexture&&(extensionDef.diffuseTexture=materialDef.pbrMetallicRoughness.baseColorTexture),material.specularMap){var specularMapDef={index:writer.processTexture(material.specularMap)};writer.applyTextureTransform(specularMapDef,material.specularMap),extensionDef.specularGlossinessTexture=specularMapDef}materialDef.extensions=materialDef.extensions||{},materialDef.extensions[this.name]=extensionDef,extensionsUsed[this.name]=!0}}}/**
1893
- * Static utility functions
1894
- */GLTFExporter.Utils={insertKeyframe:function insertKeyframe(track,time){var index,tolerance=.001,valueSize=track.getValueSize(),times=new track.TimeBufferType(track.times.length+1),values=new track.ValueBufferType(track.values.length+valueSize),interpolant=track.createInterpolant(new track.ValueBufferType(valueSize));// 1ms
1895
- if(0===track.times.length){times[0]=time;for(var i=0;i<valueSize;i++)values[i]=0;index=0}else if(time<track.times[0]){if(Math.abs(track.times[0]-time)<tolerance)return 0;times[0]=time,times.set(track.times,1),values.set(interpolant.evaluate(time),0),values.set(track.values,valueSize),index=0}else if(time>track.times[track.times.length-1]){if(Math.abs(track.times[track.times.length-1]-time)<tolerance)return track.times.length-1;times[times.length-1]=time,times.set(track.times,0),values.set(track.values,0),values.set(interpolant.evaluate(time),track.values.length),index=times.length-1}else for(var _i6=0;_i6<track.times.length;_i6++){if(Math.abs(track.times[_i6]-time)<tolerance)return _i6;if(track.times[_i6]<time&&track.times[_i6+1]>time){times.set(track.times.slice(0,_i6+1),0),times[_i6+1]=time,times.set(track.times.slice(_i6+1),_i6+2),values.set(track.values.slice(0,(_i6+1)*valueSize),0),values.set(interpolant.evaluate(time),(_i6+1)*valueSize),values.set(track.values.slice((_i6+1)*valueSize),(_i6+2)*valueSize),index=_i6+1;break;}}return track.times=times,track.values=values,index;},mergeMorphTargetTracks:function mergeMorphTargetTracks(clip,root){for(var tracks=[],mergedTracks={},sourceTracks=clip.tracks,i=0;i<sourceTracks.length;++i){var sourceTrack=sourceTracks[i],sourceTrackBinding=three__WEBPACK_IMPORTED_MODULE_0__.PropertyBinding.parseTrackName(sourceTrack.name),sourceTrackNode=three__WEBPACK_IMPORTED_MODULE_0__.PropertyBinding.findNode(root,sourceTrackBinding.nodeName);if("morphTargetInfluences"!==sourceTrackBinding.propertyName||void 0===sourceTrackBinding.propertyIndex){tracks.push(sourceTrack);continue;}if(sourceTrack.createInterpolant!==sourceTrack.InterpolantFactoryMethodDiscrete&&sourceTrack.createInterpolant!==sourceTrack.InterpolantFactoryMethodLinear){if(sourceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)// This should never happen, because glTF morph target animations
1896
- // affect all targets already.
1897
- throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),sourceTrack=sourceTrack.clone(),sourceTrack.setInterpolation(three__WEBPACK_IMPORTED_MODULE_0__.InterpolateLinear)}var targetCount=sourceTrackNode.morphTargetInfluences.length,targetIndex=sourceTrackNode.morphTargetDictionary[sourceTrackBinding.propertyIndex];if(void 0===targetIndex)throw new Error("THREE.GLTFExporter: Morph target name not found: "+sourceTrackBinding.propertyIndex);var mergedTrack=void 0;// If this is the first time we've seen this object, create a new
1898
- // track to store merged keyframe data for each morph target.
1899
- if(void 0===mergedTracks[sourceTrackNode.uuid]){mergedTrack=sourceTrack.clone();for(var values=new mergedTrack.ValueBufferType(targetCount*mergedTrack.times.length),j=0;j<mergedTrack.times.length;j++)values[j*targetCount+targetIndex]=mergedTrack.values[j];// We need to take into consideration the intended target node
1900
- // of our original un-merged morphTarget animation.
1901
- mergedTrack.name=(sourceTrackBinding.nodeName||"")+".morphTargetInfluences",mergedTrack.values=values,mergedTracks[sourceTrackNode.uuid]=mergedTrack,tracks.push(mergedTrack);continue;}var sourceInterpolant=sourceTrack.createInterpolant(new sourceTrack.ValueBufferType(1));mergedTrack=mergedTracks[sourceTrackNode.uuid];// For every existing keyframe of the merged track, write a (possibly
1902
- // interpolated) value from the source track.
1903
- for(var _j2=0;_j2<mergedTrack.times.length;_j2++)mergedTrack.values[_j2*targetCount+targetIndex]=sourceInterpolant.evaluate(mergedTrack.times[_j2]);// For every existing keyframe of the source track, write a (possibly
1904
- // new) keyframe to the merged track. Values from the previous loop may
1905
- // be written again, but keyframes are de-duplicated.
1906
- for(var keyframeIndex,_j3=0;_j3<sourceTrack.times.length;_j3++)keyframeIndex=this.insertKeyframe(mergedTrack,sourceTrack.times[_j3]),mergedTrack.values[keyframeIndex*targetCount+targetIndex]=sourceTrack.values[_j3];}return clip.tracks=tracks,clip;}};
1907
-
1908
- /***/ }),
1909
- /* 44 */
1910
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1911
-
1912
- var THREE=__webpack_require__(4),resolveURL=(__webpack_require__(5).resolveURL),Viewport=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];var _this=this;this.setFromObject=_ref=>{var nearPlane=_ref.nearPlane,farPlane=_ref.farPlane,eyePosition=_ref.eyePosition,targetPosition=_ref.targetPosition,upVector=_ref.upVector;_this.nearPlane=nearPlane,_this.farPlane=farPlane,_this.eyePosition=eyePosition,_this.targetPosition=targetPosition,_this.upVector=upVector}},CameraControls=function(object,domElement,renderer,scene){var MODE={NONE:-1,DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,ROTATE_TRANSITION:4,MINIMAP:5,SYNC_CONTROL:6},STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,SCROLL:6,KEYBOARD_ZOOM:7,KEYBOARD_ROTATE:8,KEYBOARD_PAN:9},ROTATE_DIRECTION={NONE:-1,FREE:1,HORIZONTAL:2,VERTICAL:3},KEYBOARD={ARROWLEFT:37,ARROWUP:38,ARROWRIGHT:39,ARROWDOWN:40,NUMPADADD:107,NUMPADSUBTRACT:109,EQUAL:187,MINUS:189},CLICK_ACTION={};/**
1913
- * Actions states.
1914
- * Available states are NONE, ROTATE, ZOOM, PAN, TOUCH_ROTATE, TOUCH_ZOOM, TOUCH_PAN and SCROLL.
1915
- * @property {Object}
1916
- *//**
1917
- * Available click actions are MAIN, AUXILIARY and SECONARY.
1918
- * @property {Object}
1919
- */CLICK_ACTION.MAIN=STATE.ROTATE,CLICK_ACTION.AUXILIARY=STATE.ZOOM,CLICK_ACTION.SECONDARY=STATE.PAN,this.cameraObject=object,this.domElement=domElement===void 0?document:domElement,this.renderer=renderer,this.scene=scene,this.tumble_rate=1.5,this.pointer_x=0,this.pointer_y=0,this.pointer_x_start=0,this.pointer_y_start=0,this.previous_pointer_x=0,this.previous_pointer_y=0,this.near_plane_fly_debt=0,this.touchZoomDistanceStart=0,this.touchZoomDistanceEnd=0,this.directionalLight=0,this.zoomRate=50,this.rotateRate=50,this.panRate=100,this.pixelHeight=1;var duration=6e3,enabled=!0,inbuildTime=0,cameraPath=void 0,numberOfCameraPoint=void 0,updateLightWithPathFlag=!1,playRate=500,deviceOrientationControl=void 0,defaultViewport="default",currentMode=MODE.DEFAULT,smoothCameraTransitionObject=void 0,rotateCameraTransitionObject=void 0,cameraAutoTumbleObject=void 0,zoomSize=0,rotateMode=ROTATE_DIRECTION.FREE;this._state=STATE.NONE;var zincRayCaster;this.targetTouchId=-1;var rect=void 0,_a=new THREE.Vector3,_b=new THREE.Vector3,_c=new THREE.Vector3,_new_b=new THREE.Vector3,_new_c=new THREE.Vector3,_axis=new THREE.Vector3,_v=new THREE.Vector3,_rel_eye=new THREE.Vector3,sceneSphere=new THREE.Sphere,_tempEye=new THREE.Vector3,hasUpdated=!1,ndcControl=void 0,maxDist=0,viewports={default:new Viewport};viewports.default.nearPlane=.1,viewports.default.farPlane=2e3,viewports.default.eyePosition=[0,0,0],viewports.default.targetPosition=[0,0,-1],viewports.default.upVector=[0,1,0],this.cameraObject.target===void 0&&(this.cameraObject.target=new THREE.Vector3(...viewports.default.targetPosition)),this.calculateMaxAllowedDistance=scene=>{var box=scene.getBoundingBox();if(box){box.getBoundingSphere(sceneSphere),maxDist=6*sceneSphere.radius;var currentDist=0;this.cameraObject&&(currentDist=this.cameraObject.position.distanceTo(sceneSphere.center)),maxDist=currentDist>maxDist?1.5*currentDist:maxDist}else maxDist=0;};var updateNearAndFarPlane=travalDist=>{var ratio=.001;_a.copy(this.cameraObject.position);var length=_a.sub(this.cameraObject.target).length();this.cameraObject.near=Math.max(1e-4,length*ratio),this.cameraObject.far=1e4*this.cameraObject.near};/**
1920
- * Add a viewport to the list of available named viewports.
1921
- *
1922
- * @param {String} name - Name of the viewport
1923
- * @param {Viewport} viewportName - Viewport to be added
1924
- */this.addViewport=(viewportName,viewport)=>{viewportName&&viewport&&(viewports[viewportName]=viewport)},this.setDefaultViewport=defaultName=>!!(defaultName&&defaultName in viewports)&&(defaultViewport=defaultName,!0),this.getDefaultViewport=()=>defaultViewport,this.getViewportOfName=name=>viewports[name],this.setCurrentViewport=name=>!!(name in viewports)&&(this.setCurrentCameraSettings(viewports[name]),!0),this.setRotationMode=mode=>{switch(mode){case"none":rotateMode=ROTATE_DIRECTION.NONE;break;case"horizontal":rotateMode=ROTATE_DIRECTION.HORIZONTAL;break;case"vertical":rotateMode=ROTATE_DIRECTION.VERTICAL;break;case"free":default:rotateMode=ROTATE_DIRECTION.FREE;}},this.onResize=()=>{rect&&(rect=void 0),ndcControl&&ndcControl.setCurrentCameraSettings(this.cameraObject,viewports[defaultViewport])},this.getVisibleHeightAtZDepth=depth=>{// compensate for cameras not positioned at z=0
1925
- var cameraOffset=this.cameraObject.position.distanceTo(this.cameraObject.target);depth<cameraOffset?depth-=cameraOffset:depth+=cameraOffset;// vertical fov in radians
1926
- var vFOV=this.cameraObject.fov*Math.PI/180;// Math.abs to ensure the result is always positive
1927
- return 2*Math.tan(vFOV/2)*Math.abs(depth);},this.calculateHeightPerPixelAtZeroDepth=wHeight=>{var height=this.getVisibleHeightAtZDepth(0);return this.pixelHeight=height/wHeight,this.pixelHeight;},this.getNDCFromDocumentCoords=(x,y,positionIn)=>{updateRect(!1);var position=positionIn?positionIn:new THREE.Vector2,out_x=2*((x-rect.left)/rect.width)-1,out_y=2*-((y-rect.top)/rect.height)+1;return position.set(out_x,out_y);},this.getRelativeCoordsFromNDC=(x,y,positionIn)=>{updateRect(!1);var position=positionIn?positionIn:new THREE.Vector2;return position.x=(x+1)*rect.width/2,position.y=(1-y)*rect.height/2,position;},this.setMouseButtonAction=(buttonName,actionName)=>{CLICK_ACTION[buttonName]=STATE[actionName]};/**
1928
- *
1929
- * @param {HTML} element
1930
- * @param {Number} index
1931
- */var setCanvasTabindex=(element,index)=>{element instanceof HTMLCanvasElement&&(element.tabIndex=index)},checkTravelDistance=()=>{if(0<maxDist){var newDist=_tempEye.distanceTo(sceneSphere.center);return maxDist>newDist||this.cameraObject.position.distanceTo(sceneSphere.center)>newDist;}return!0;},translateViewport=translation=>{_tempEye.copy(this.cameraObject.position).add(translation),checkTravelDistance()&&(this.cameraObject.target.add(translation),this.cameraObject.position.add(translation),this.updateDirectionalLight())},onDocumentMouseDown=event=>{updateRect(!1);// Check if mouse event hapens inside the minimap
1932
- var minimapCoordinates;if(currentMode===MODE.DEFAULT&&(minimapCoordinates=this.scene.getNormalisedMinimapCoordinates(this.renderer,event)),!minimapCoordinates)0==event.button?event.ctrlKey?this._state=CLICK_ACTION.AUXILIARY:event.shiftKey?this._state=CLICK_ACTION.SECONDARY:this._state=CLICK_ACTION.MAIN:1==event.button?(event.preventDefault(),this._state=CLICK_ACTION.AUXILIARY):2==event.button&&(this._state=CLICK_ACTION.SECONDARY),this.pointer_x=event.clientX-rect.left,this.pointer_y=event.clientY-rect.top,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y;else{currentMode=MODE.MINIMAP;var translation=this.scene.getMinimapDiffFromNormalised(minimapCoordinates.x,minimapCoordinates.y);translateViewport(translation)}},onDocumentMouseMove=event=>{if(updateRect(!1),rect)if(this.pointer_x=event.clientX-rect.left,this.pointer_y=event.clientY-rect.top,currentMode===MODE.MINIMAP){var minimapCoordinates=this.scene.getNormalisedMinimapCoordinates(this.renderer,event);if(minimapCoordinates){var translation=this.scene.getMinimapDiffFromNormalised(minimapCoordinates.x,minimapCoordinates.y);translateViewport(translation)}}else this._state===STATE.NONE&&void 0!==zincRayCaster&&zincRayCaster.move(this,event.clientX,event.clientY,this.renderer);},onDocumentMouseUp=event=>{this._state=STATE.NONE,currentMode==MODE.MINIMAP&&(currentMode=MODE.DEFAULT),zincRayCaster!==void 0&&this.pointer_x_start==event.clientX-rect.left&&this.pointer_y_start==event.clientY-rect.top&&zincRayCaster.pick(this,event.clientX,event.clientY,this.renderer)},onDocumentMouseLeave=event=>{this._state=STATE.NONE},onDocumentTouchStart=event=>{updateRect(!1);var len=event.touches.length;if(1==len){var _rect,_rect2;this._state=STATE.TOUCH_ROTATE,this.pointer_x=event.touches[0].clientX-(null===(_rect=rect)||void 0===_rect?void 0:_rect.left),this.pointer_y=event.touches[0].clientY-(null===(_rect2=rect)||void 0===_rect2?void 0:_rect2.top),this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y}else if(2==len){this._state=STATE.TOUCH_ZOOM;var dx=event.touches[0].clientX-event.touches[1].clientX,dy=event.touches[0].clientY-event.touches[1].clientY;this.touchZoomDistanceEnd=this.touchZoomDistanceStart=Math.sqrt(dx*dx+dy*dy)}else if(3==len){var _rect3,_rect4;this._state=STATE.TOUCH_PAN,this.targetTouchId=event.touches[0].identifier,this.pointer_x=event.touches[0].clientX-(null===(_rect3=rect)||void 0===_rect3?void 0:_rect3.left),this.pointer_y=event.touches[0].clientY-(null===(_rect4=rect)||void 0===_rect4?void 0:_rect4.top),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y}},onDocumentTouchMove=event=>{event.preventDefault(),event.stopPropagation();var len=event.touches.length;if(1==len)this.pointer_x=event.touches[0].clientX-rect.left,this.pointer_y=event.touches[0].clientY-rect.top;else if(2==len){if(this._state===STATE.TOUCH_ZOOM){var dx=event.touches[0].clientX-event.touches[1].clientX,dy=event.touches[0].clientY-event.touches[1].clientY;this.touchZoomDistanceEnd=Math.sqrt(dx*dx+dy*dy)}}else if(3==len&&this._state===STATE.TOUCH_PAN)for(var i=0;3>i;i++)event.touches[i].identifier==this.targetTouchId&&(this.pointer_x=event.touches[0].clientX-rect.left,this.pointer_y=event.touches[0].clientY-rect.top);},onDocumentTouchEnd=event=>{var len=event.touches.length;this.touchZoomDistanceStart=this.touchZoomDistanceEnd=0,this.targetTouchId=-1,this._state=STATE.NONE,1==len&&zincRayCaster!==void 0&&this.pointer_x_start==event.touches[0].clientX-rect.left&&this.pointer_y_start==event.touches[0].clientY-rect.top&&zincRayCaster.pick(this.cameraObject,event.touches[0].clientX,event.touches[0].clientY,this.renderer)},onDocumentEnter=()=>{updateRect(!0)},updateRect=forced=>{//Use intersectionObserver to reset the rect for ray tracing.
1933
- if(forced||rect===void 0){var observer=new IntersectionObserver(entries=>{for(var entry of entries)rect=entry.boundingClientRect;observer.disconnect()});observer.observe(this.domElement)}},onDocumentWheelEvent=event=>{updateRect(!1),this._state=STATE.SCROLL;var changes=0;0<event.deltaY?changes=this.zoomRate:0>event.deltaY&&(changes=-1*this.zoomRate),zoomSize+=changes,event.preventDefault(),event.stopImmediatePropagation()},onDocumentKeydownEvent=event=>{updateRect(!1);var changes=0;if(event.keyCode===KEYBOARD.EQUAL||event.keyCode===KEYBOARD.MINUS||event.keyCode===KEYBOARD.NUMPADADD||event.keyCode===KEYBOARD.NUMPADSUBTRACT){this._state=STATE.KEYBOARD_ZOOM;var unit=1;event.shiftKey&&(unit*=2),event.keyCode===KEYBOARD.EQUAL||event.keyCode===KEYBOARD.NUMPADADD?changes=-1*(this.zoomRate*unit):(event.keyCode===KEYBOARD.MINUS||event.keyCode===KEYBOARD.NUMPADSUBTRACT)&&(changes=this.zoomRate*unit),zoomSize+=changes}else(event.keyCode===KEYBOARD.ARROWLEFT||event.keyCode===KEYBOARD.ARROWUP||event.keyCode===KEYBOARD.ARROWRIGHT||event.keyCode===KEYBOARD.ARROWDOWN)&&(event.shiftKey?(this._state=STATE.KEYBOARD_ROTATE,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,changes=this.rotateRate):(this._state=STATE.KEYBOARD_PAN,changes=this.panRate),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,event.keyCode===KEYBOARD.ARROWLEFT?this.pointer_x-=changes:event.keyCode===KEYBOARD.ARROWUP?this.pointer_y-=changes:event.keyCode===KEYBOARD.ARROWRIGHT?this.pointer_x+=changes:event.keyCode===KEYBOARD.ARROWDOWN&&(this.pointer_y+=changes));Object.values(KEYBOARD).includes(event.keyCode)&&event.preventDefault()},onDocumentKeyupEvent=event=>{this._state=STATE.NONE},translate=()=>{if("undefined"!=typeof this.cameraObject){var height=rect.height,distance=this.cameraObject.position.distanceTo(this.cameraObject.target),fact=0;this.cameraObject.far>this.cameraObject.near&&distance>=this.cameraObject.near&&distance<=this.cameraObject.far&&(fact=(distance-this.cameraObject.near)/(this.cameraObject.far-this.cameraObject.near)),_b.set(this.previous_pointer_x,height-this.previous_pointer_y,0),_c.set(this.previous_pointer_x,height-this.previous_pointer_y,1),_new_b.set(this.pointer_x,height-this.pointer_y,0),_new_c.set(this.pointer_x,height-this.pointer_y,1),_b.unproject(this.cameraObject),_c.unproject(this.cameraObject),_new_b.unproject(this.cameraObject),_new_c.unproject(this.cameraObject);var translate_rate=-.002;_new_b.sub(_b).multiplyScalar(1-fact),_new_c.sub(_c).multiplyScalar(fact),_new_b.add(_new_c).multiplyScalar(translate_rate),translateViewport(_new_b)}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y};//Make sure the camera does not travel beyond limit
1934
- this.getVectorsFromRotateAboutLookAtPoints=(axis,angle)=>{axis.normalize(),_v.copy(this.cameraObject.position).sub(this.cameraObject.target),_rel_eye.copy(_v),_v.normalize(),.8<Math.abs(_v.dot(axis))&&_v.copy(this.cameraObject.up),_b.crossVectors(axis,_v).normalize(),_c.crossVectors(axis,_b);var rel_eyea=axis.dot(_rel_eye),rel_eyeb=_b.dot(_rel_eye),rel_eyec=_c.dot(_rel_eye),upa=axis.dot(this.cameraObject.up),upb=_b.dot(this.cameraObject.up),upc=_c.dot(this.cameraObject.up),cos_angle=Math.cos(angle),sin_angle=Math.sin(angle);return _new_b.set(cos_angle*_b.x+sin_angle*_c.x,cos_angle*_b.y+sin_angle*_c.y,cos_angle*_b.z+sin_angle*_c.z),_new_c.set(cos_angle*_c.x-sin_angle*_b.x,cos_angle*_c.y-sin_angle*_b.y,cos_angle*_c.z-sin_angle*_b.z),_v.copy(this.cameraObject.target),_v.x=_v.x+axis.x*rel_eyea+_new_b.x*rel_eyeb+_new_c.x*rel_eyec,_v.y=_v.y+axis.y*rel_eyea+_new_b.y*rel_eyeb+_new_c.y*rel_eyec,_v.z=_v.z+axis.z*rel_eyea+_new_b.z*rel_eyeb+_new_c.z*rel_eyec,_a.set(axis.x*upa+_new_b.x*upb+_new_c.x*upc,axis.y*upa+_new_b.y*upb+_new_c.y*upc,axis.z*upa+_new_b.z*upb+_new_c.z*upc),{position:_v,up:_a};},this.rotateAboutLookAtpoint=(axis,angle)=>{var returned_values=this.getVectorsFromRotateAboutLookAtPoints(axis,angle);this.cameraObject.position.copy(returned_values.position),this.updateDirectionalLight(),this.cameraObject.up.copy(returned_values.up)};var tumble=()=>{if("undefined"!=typeof this.cameraObject){var _rect5,_rect6,width=null===(_rect5=rect)||void 0===_rect5?void 0:_rect5.width,height=null===(_rect6=rect)||void 0===_rect6?void 0:_rect6.height;if(0<width&&0<height){var radius=.25*(width+height),delta_x=0,delta_y=0;(rotateMode===ROTATE_DIRECTION.FREE||rotateMode===ROTATE_DIRECTION.HORIZONTAL)&&(delta_x=this.pointer_x-this.previous_pointer_x),(rotateMode===ROTATE_DIRECTION.FREE||rotateMode===ROTATE_DIRECTION.VERTICAL)&&(delta_y=this.previous_pointer_y-this.pointer_y);var tangent_dist=Math.sqrt(delta_x*delta_x+delta_y*delta_y);if(0<tangent_dist){var dx=1*-delta_y/tangent_dist,dy=1*delta_x/tangent_dist,d=0;// Do not allow rotation on other direction around the origin if rotateMode is not free
1935
- if(rotateMode===ROTATE_DIRECTION.FREE){var _d=dx*(this.pointer_x-.5*(width-1))+dy*(.5*(height-1)-this.pointer_y);_d>radius?_d=radius:_d<-radius&&(_d=-radius)}var phi=Math.acos(d/radius)-.5*Math.PI,angle=this.tumble_rate*tangent_dist/radius;_a.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(),_b.copy(this.cameraObject.up).normalize(),_c.copy(_b).cross(_a).normalize().multiplyScalar(dx),_b.multiplyScalar(dy),_axis.addVectors(_c,_b).multiplyScalar(Math.cos(phi)),_a.multiplyScalar(Math.sin(phi)),_axis.add(_a),this.rotateAboutLookAtpoint(_axis,-angle)}}}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},calculateZoomDelta=()=>{var delta=0;return this._state===STATE.ZOOM?delta=this.previous_pointer_y-this.pointer_y:this._state===STATE.SCROLL||this._state===STATE.KEYBOARD_ZOOM?delta=zoomSize:(delta=-1*(this.touchZoomDistanceEnd-this.touchZoomDistanceStart),this.touchZoomDistanceStart=this.touchZoomDistanceEnd),delta;};this.changeZoomByScrollRateUnit=unit=>{var delta_y=unit*this.zoomRate;this.changeZoomByValue(delta_y)},this.changeZoomByValue=delta_y=>{if("undefined"!=typeof this.cameraObject){var height=rect.height,a=this.cameraObject.position.clone();a.sub(this.cameraObject.target);var dist=a.length(),dy=1.5*delta_y/height,travalDist=dist*dy;.01<dist+travalDist&&(a.normalize(),_tempEye.copy(this.cameraObject.position),_tempEye.x+=a.x*travalDist,_tempEye.y+=a.y*travalDist,_tempEye.z+=a.z*travalDist,checkTravelDistance()&&(this.cameraObject.position.copy(_tempEye),this.updateDirectionalLight(),updateNearAndFarPlane(travalDist),hasUpdated=!0))}};var flyZoom=()=>{var delta_y=calculateZoomDelta();this.changeZoomByValue(delta_y),this._state===STATE.ZOOM&&(this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y),(this._state===STATE.SCROLL||this._state===STATE.KEYBOARD_ZOOM)&&(zoomSize=0,this._state=STATE.NONE)};this.setDirectionalLight=directionalLightIn=>{this.directionalLight=directionalLightIn},this.updateDirectionalLight=()=>{0!=this.directionalLight&&this.directionalLight.position.set(this.cameraObject.position.x,this.cameraObject.position.y,this.cameraObject.position.z)},this.enable=function(){enabled=!0,this.domElement&&this.domElement.addEventListener&&(setCanvasTabindex(this.domElement,0),this.domElement.addEventListener("mousedown",onDocumentMouseDown,!1),this.domElement.addEventListener("mousemove",onDocumentMouseMove,!1),this.domElement.addEventListener("mouseup",onDocumentMouseUp,!1),this.domElement.addEventListener("mouseleave",onDocumentMouseLeave,!1),this.domElement.addEventListener("touchstart",onDocumentTouchStart,!1),this.domElement.addEventListener("touchmove",onDocumentTouchMove,!1),this.domElement.addEventListener("touchend",onDocumentTouchEnd,!1),this.domElement.addEventListener("wheel",onDocumentWheelEvent,!1),this.domElement.addEventListener("mouseenter",onDocumentEnter,!1),this.domElement.addEventListener("contextmenu",event=>{event.preventDefault()},!1),this.domElement.addEventListener("keydown",onDocumentKeydownEvent,!1),this.domElement.addEventListener("keyup",onDocumentKeyupEvent,!1))},this.disable=function(){enabled=!1,this.domElement&&this.domElement.removeEventListener&&(this.domElement.removeEventListener("mousedown",onDocumentMouseDown,!1),this.domElement.removeEventListener("mousemove",onDocumentMouseMove,!1),this.domElement.removeEventListener("mouseup",onDocumentMouseUp,!1),this.domElement.removeEventListener("mouseleave",onDocumentMouseLeave,!1),this.domElement.removeEventListener("touchstart",onDocumentTouchStart,!1),this.domElement.removeEventListener("touchmove",onDocumentTouchMove,!1),this.domElement.removeEventListener("touchend",onDocumentTouchEnd,!1),this.domElement.removeEventListener("wheel",onDocumentWheelEvent,!1),this.domElement.removeEventListener("mouseenter",onDocumentEnter,!1),this.domElement.removeEventListener("contextmenu",event=>{event.preventDefault()},!1),this.domElement.removeEventListener("keydown",onDocumentKeydownEvent,!1),this.domElement.removeEventListener("keyup",onDocumentKeyupEvent,!1),setCanvasTabindex(this.domElement,-1))},this.loadPath=pathData=>{cameraPath=pathData.CameraPath,numberOfCameraPoint=pathData.NumberOfPoints},this.loadPathURL=(path_url,finishCallback)=>{var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){var pathData=JSON.parse(xmlhttp.responseText);this.loadPath(pathData),finishCallback!=null&&"function"==typeof finishCallback&&finishCallback()}};var requestURL=resolveURL(path_url);xmlhttp.open("GET",requestURL,!0),xmlhttp.send()},this.setPathDuration=durationIn=>{duration=durationIn,smoothCameraTransitionObject&&smoothCameraTransitionObject.setDuration(duration),rotateCameraTransitionObject&&rotateCameraTransitionObject.setDuration(duration)},this.getPlayRate=()=>playRate,this.setPlayRate=playRateIn=>{playRate=playRateIn};/**
1936
- * Update the internal timer by the set amount, this can
1937
- * be used to force a time update by setting delta to zero.
1938
- *
1939
- * @param {Number} delta - The amount of time to increment
1940
- * the time by.
1941
- */var updateTime=delta=>{var targetTime=inbuildTime+delta;targetTime>duration&&(targetTime-=duration),inbuildTime=targetTime};/**
1942
- * Get the current inbuild time,
1943
- *
1944
- * @return {Number}
1945
- */this.getTime=()=>inbuildTime,this.setTime=timeIn=>{inbuildTime=timeIn>duration?duration:0>timeIn?0:timeIn},this.getNumberOfTimeFrame=()=>numberOfCameraPoint,this.getCurrentTimeFrame=()=>{if(2<numberOfCameraPoint){var current_time=inbuildTime/duration*(numberOfCameraPoint-1),bottom_frame=Math.floor(current_time),proportion=1-(current_time-bottom_frame),top_frame=Math.ceil(current_time);return bottom_frame==top_frame?bottom_frame==numberOfCameraPoint-1?[bottom_frame-1,top_frame,0]:[bottom_frame,top_frame+1,1]:[bottom_frame,top_frame,proportion]}return 1==numberOfCameraPoint?[0,0,0]:void 0},this.setCurrentTimeFrame=targetTimeFrame=>{2<numberOfCameraPoint&&(inbuildTime=duration*targetTimeFrame/(numberOfCameraPoint-1),0>inbuildTime&&(inbuildTime=0),inbuildTime>duration&&(inbuildTime=duration))};/**
1946
- * Update the progress on the path by the specified amount - delta.
1947
- *
1948
- * @param {Number} delta - The amount of time to increment
1949
- */var updatePath=delta=>{if(currentMode===MODE.PATH&&(updateTime(delta),cameraPath)){for(var time_frame=this.getCurrentTimeFrame(),bottom_frame=time_frame[0],top_frame=time_frame[1],proportion=time_frame[2],bot_pos=[cameraPath[3*bottom_frame],cameraPath[3*bottom_frame+1],cameraPath[3*bottom_frame+2]],top_pos=[cameraPath[3*top_frame],cameraPath[3*top_frame+1],cameraPath[3*top_frame+2]],current_positions=[],i=0;i<bot_pos.length;i++)current_positions.push(proportion*bot_pos[i]+(1-proportion)*top_pos[i]);this.cameraObject.position.set(current_positions[0],current_positions[1],current_positions[2]),this.cameraObject.target.set(top_pos[0],top_pos[1],top_pos[2]),deviceOrientationControl&&this.cameraObject.lookAt(this.cameraObject.target),updateLightWithPathFlag&&(this.directionalLight.position.set(current_positions[0],current_positions[1],current_positions[2]),this.directionalLight.target.position.set(top_pos[0],top_pos[1],top_pos[2]))}};/**
1950
- * Force recalculation of the current path.
1951
- */this.calculatePathNow=()=>{updatePath(0)};// handle synchronised control based on information in the idc
1952
- var handleSyncControl=()=>{this._state===STATE.ROTATE||this._state===STATE.TOUCH_ROTATE||this._state===STATE.KEYBOARD_ROTATE?tumble():this._state===STATE.PAN||this._state===STATE.TOUCH_PAN||this._state===STATE.KEYBOARD_PAN?(translate(),ndcControl.triggerCallback()):(this._state===STATE.ZOOM||this._state===STATE.TOUCH_ZOOM||this._state===STATE.SCROLL||this._state===STATE.KEYBOARD_ZOOM)&&(ndcControl.zoom(calculateZoomDelta()),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,(this._state===STATE.SCROLL||this._state===STATE.KEYBOARD_ZOOM)&&(this._state=STATE.NONE),zoomSize=0,ndcControl.triggerCallback())};/**
1953
- * Update all controls related changes - including calculation of the viewport.
1954
- *
1955
- * @param {Number} timeChanged - Time eclipse since last called.
1956
- *//**
1957
- * Switch to path mode and begin traveling through the camera path.
1958
- *//**
1959
- * Stop playing path and switch back to normal control.
1960
- *//**
1961
- * Check rather the control is currently in path mode.
1962
- *
1963
- * @return {Boolean}
1964
- *//**
1965
- * Enable directional light update as the camera
1966
- * is traveling through path.
1967
- *
1968
- * @param {Boolean} flag
1969
- *//**
1970
- * Enable rotation using the devices's accelerometer.
1971
- *//**
1972
- * Disable rotation using the devices's accelerometer.
1973
- *//**
1974
- * Check rather device orientation based on accelerometer is on.
1975
- *//**
1976
- * Reset the viewport settings to the one provided by default viewport.
1977
- *//**
1978
- * Set the current camera settings with the provided viewport.
1979
- *
1980
- * @param {Viewport} newViewport - viewport settings.
1981
- *//**
1982
- * Get the viewport based on centre, radius, view_angle and clip distance.
1983
- *
1984
- * @param {Number} centreX - x coordinate of the centre.
1985
- * @param {Number} centreY - y coordinate of the centre.
1986
- * @param {Number} centreZ - z coordinate of the centre.
1987
- * @param {Number} radius - radius if the viewport.
1988
- * @param {Number} view_angle - view angle.
1989
- * @param {Number} clip_distance - clip_distance between the near and far plane.
1990
- *
1991
- * @return {Viewport}
1992
- *//**
1993
- * Get the viewport for the boudning box
1994
- *
1995
- * @param {Number} boundingBox - y coordinate of the centre.
1996
- * @return {Viewport}
1997
- *//**
1998
- * Get the current camera viewport.
1999
- *
2000
- * @return {Viewport}
2001
- *//**
2002
- * Setup a smooth transition object which transition the camera from one
2003
- * viewport to the other in the specified duration. This will not work if
2004
- * {@link rotateCameraTransition} is active.
2005
- * To use this object, the transition must be enabled using
2006
- * {@link enableCameraTransition}.
2007
- *
2008
- * @param {Viewport} startingViewport - the starting viewport
2009
- * @param {Viewport} endingViewport - the viewport ti end the transistion with.
2010
- * @param {Number} durationIn - duration of the smooth transition.
2011
- *//**
2012
- * Setup a rotate camera transition object which rotate the
2013
- * camera by the specified the angle in the specified
2014
- * duration. This will not work if {@link cameraTransition}
2015
- * is active.
2016
- * To use this object, the transition must be enabled using
2017
- * {@link enableCameraTransition}.
2018
- *
2019
- * @param {THREE.Vector3} axis - the starting viewport
2020
- * @param {Number} angle - the viewport ti end the transistion with.
2021
- * @param {Number} duration - duration of the smooth transition.
2022
- *//**
2023
- * Enable camera transition, {@link rotateCameraTransition} amd
2024
- * {@link cameraTransition} must be called before camera transition can
2025
- * be enabled.
2026
- *//**
2027
- * Pause the camera transition.
2028
- *//**
2029
- * Stop the camera transition and remove camera transition
2030
- * and rotate camera transition.
2031
- *//**
2032
- * Check if camera transition is active.
2033
- *//**
2034
- * Setup auto tumble object of the camera which will rotate the camera
2035
- * around the target as if the user is rotating the camera by mouse/touch
2036
- * interaction.
2037
- * The tumbling will only be enabled with {@link enabelAutoTumble}.
2038
- *
2039
- * @param {Array} tumbleDirectionIn - direction of the mouse/touch.
2040
- * @param {Number} tumbleRateIn - Speed of the tumbling.
2041
- * @param {Boolean} stopOnCameraInputIn - Disable the tumbling once the user
2042
- * start interacting with the scene.
2043
- *//**
2044
- * Enable autotumble.
2045
- *//**
2046
- * Disable the autotumble.
2047
- *//**
2048
- * Update the autotumble object.
2049
- *//**
2050
- * Check rather autotumble is active.
2051
- *
2052
- * @return {Boolean}
2053
- *//**
2054
- * Create an internal raycaster object and enable it for picking.
2055
- *
2056
- * @param {Scene} sceneIn - The scene to pick from, it can be different from the
2057
- * camera's scene.
2058
- * @param {requestCallback} callbackFunctionIn - The callback for pick event.
2059
- * @param {requestCallback} hoverCallbackFunctionIn - The callback for hover
2060
- * over event.
2061
- *//**
2062
- * Disable raycaster and remove the internal ray caster object.
2063
- *//**
2064
- * Check rather the camera is in syncControl mode.
2065
- *
2066
- * @return {Boolean}
2067
- *//**
2068
- * Enable syncControl.
2069
- *//**
2070
- * Disable syncControl.
2071
- */this.update=timeChanged=>{var delta=timeChanged*playRate,controlEnabled=enabled,updated=!0;return currentMode===MODE.PATH?updatePath(delta):currentMode===MODE.SMOOTH_CAMERA_TRANSITION&&smoothCameraTransitionObject?(smoothCameraTransitionObject.update(delta),smoothCameraTransitionObject.isTransitionCompleted()&&(null==smoothCameraTransitionObject,currentMode=MODE.DEFAULT),controlEnabled=!1):currentMode===MODE.ROTATE_CAMERA_TRANSITION&&rotateCameraTransitionObject?(rotateCameraTransitionObject.update(delta),rotateCameraTransitionObject.isTransitionCompleted()&&(null==rotateCameraTransitionObject,currentMode=MODE.DEFAULT),controlEnabled=!1):currentMode===MODE.AUTO_TUMBLE&&cameraAutoTumbleObject?cameraAutoTumbleObject.update(delta):currentMode===MODE.SYNC_CONTROL&&ndcControl?(handleSyncControl(),controlEnabled=!1):updated=!1,controlEnabled&&(this._state!==STATE.NONE&&(updated=!0),this._state===STATE.ROTATE||this._state===STATE.TOUCH_ROTATE||this._state===STATE.KEYBOARD_ROTATE?tumble():this._state===STATE.PAN||this._state===STATE.TOUCH_PAN||this._state===STATE.KEYBOARD_PAN?translate():(this._state===STATE.ZOOM||this._state===STATE.TOUCH_ZOOM||this._state===STATE.SCROLL||this._state===STATE.KEYBOARD_ZOOM)&&flyZoom(),this._state!==STATE.NONE&&currentMode===MODE.AUTO_TUMBLE&&cameraAutoTumbleObject&&cameraAutoTumbleObject.stopOnCameraInput,this._state===STATE.SCROLL&&(this._state=STATE.NONE)),deviceOrientationControl?(updated=!0,deviceOrientationControl.update()):this.cameraObject.lookAt(this.cameraObject.target),updated=updated||hasUpdated,hasUpdated=!1,updated;},this.playPath=()=>{currentMode=MODE.PATH},this.stopPath=()=>{currentMode=MODE.DEFAULT},this.isPlayingPath=()=>currentMode===MODE.PATH,this.enableDirectionalLightUpdateWithPath=flag=>{updateLightWithPathFlag=flag},this.enableDeviceOrientation=()=>{deviceOrientationControl||(deviceOrientationControl=new ModifiedDeviceOrientationControls(this.cameraObject))},this.disableDeviceOrientation=()=>{deviceOrientationControl&&(deviceOrientationControl.dispose(),deviceOrientationControl=void 0)},this.isDeviceOrientationEnabled=()=>!!deviceOrientationControl,this.resetView=()=>{var viewport=viewports[defaultViewport];this.cameraObject.near=viewport.nearPlane,this.cameraObject.far=viewport.farPlane,this.cameraObject.position.set(viewport.eyePosition[0],viewport.eyePosition[1],viewport.eyePosition[2]),this.cameraObject.target.set(viewport.targetPosition[0],viewport.targetPosition[1],viewport.targetPosition[2]),this.cameraObject.up.set(viewport.upVector[0],viewport.upVector[1],viewport.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight()},this.setCurrentCameraSettings=newViewport=>{newViewport.nearPlane&&(this.cameraObject.near=newViewport.nearPlane),newViewport.farPlane&&(this.cameraObject.far=newViewport.farPlane),newViewport.eyePosition&&this.cameraObject.position.set(newViewport.eyePosition[0],newViewport.eyePosition[1],newViewport.eyePosition[2]),newViewport.targetPosition&&this.cameraObject.target.set(newViewport.targetPosition[0],newViewport.targetPosition[1],newViewport.targetPosition[2]),newViewport.upVector&&this.cameraObject.up.set(newViewport.upVector[0],newViewport.upVector[1],newViewport.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight(),hasUpdated=!0},this.getViewportFromCentreAndRadius=(centreX,centreY,centreZ,radius,view_angle,clip_distance)=>{_a.copy(this.cameraObject.position),_a.sub(this.cameraObject.target),_a.normalize();/* look at the centre of the sphere */var localTargetPosition=[centreX,centreY,centreZ],eye_distance=radius/Math.tan(view_angle*Math.PI/360),localEyePosition=[centreX+_a.x*eye_distance,centreY+_a.y*eye_distance,centreZ+_a.z*eye_distance],localFarPlane=eye_distance+clip_distance,localNearPlane=0,nearClippingFactor=.95;/* shift the eye position to achieve the desired view_angle */localNearPlane=clip_distance>nearClippingFactor*eye_distance?(1-nearClippingFactor)*eye_distance:eye_distance-clip_distance;var newViewport=new Viewport;return newViewport.nearPlane=localNearPlane,newViewport.farPlane=localFarPlane,newViewport.eyePosition=localEyePosition,newViewport.targetPosition=localTargetPosition,newViewport.upVector=[this.cameraObject.up.x,this.cameraObject.up.y,this.cameraObject.up.z],newViewport;},this.getViewportFromBoundingBox=(boundingBox,radiusScale)=>{var radius=boundingBox.min.distanceTo(boundingBox.max)/2*radiusScale,centreX=(boundingBox.min.x+boundingBox.max.x)/2,centreY=(boundingBox.min.y+boundingBox.max.y)/2,centreZ=(boundingBox.min.z+boundingBox.max.z)/2,clip_factor=4,viewport=this.getViewportFromCentreAndRadius(centreX,centreY,centreZ,radius,40,radius*clip_factor);return viewport;},this.getCurrentViewport=()=>{var currentViewport=new Viewport;return currentViewport.nearPlane=this.cameraObject.near,currentViewport.farPlane=this.cameraObject.far,currentViewport.eyePosition[0]=this.cameraObject.position.x,currentViewport.eyePosition[1]=this.cameraObject.position.y,currentViewport.eyePosition[2]=this.cameraObject.position.z,currentViewport.targetPosition[0]=this.cameraObject.target.x,currentViewport.targetPosition[1]=this.cameraObject.target.y,currentViewport.targetPosition[2]=this.cameraObject.target.z,currentViewport.upVector[0]=this.cameraObject.up.x,currentViewport.upVector[1]=this.cameraObject.up.y,currentViewport.upVector[2]=this.cameraObject.up.z,currentViewport;},this.getDefaultEyePosition=()=>eyePosition,this.getDefaultTargetPosition=()=>targetPosition,this.cameraTransition=(startingViewport,endingViewport,durationIn)=>{rotateCameraTransitionObject==null&&(smoothCameraTransitionObject=new SmoothCameraTransition(startingViewport,endingViewport,this,durationIn))},this.rotateCameraTransition=(axis,angle,duration)=>{smoothCameraTransitionObject==null&&(rotateCameraTransitionObject=new RotateCameraTransition(axis,angle,this,duration))},this.enableCameraTransition=()=>{smoothCameraTransitionObject&&(currentMode=MODE.SMOOTH_CAMERA_TRANSITION),rotateCameraTransitionObject&&(currentMode=MODE.ROTATE_CAMERA_TRANSITION)},this.pauseCameraTransition=()=>{currentMode=MODE.DEFAULT},this.stopCameraTransition=()=>{currentMode=MODE.DEFAULT,smoothCameraTransitionObject=void 0,rotateCameraTransitionObject=void 0},this.isTransitioningCamera=()=>currentMode===MODE.SMOOTH_CAMERA_TRANSITION||currentMode===MODE.ROTATE_CAMERA_TRANSITION,this.autoTumble=(tumbleDirectionIn,tumbleRateIn,stopOnCameraInputIn)=>{cameraAutoTumbleObject=new CameraAutoTumble(tumbleDirectionIn,tumbleRateIn,stopOnCameraInputIn,this)},this.enableAutoTumble=()=>{currentMode=MODE.AUTO_TUMBLE},this.stopAutoTumble=()=>{currentMode=MODE.DEFAULT,cameraAutoTumbleObject=void 0},this.updateAutoTumble=()=>{cameraAutoTumbleObject&&(cameraAutoTumbleObject.requireUpdate=!0)},this.isAutoTumble=()=>currentMode===MODE.AUTO_TUMBLE,this.enableRaycaster=(sceneIn,callbackFunctionIn,hoverCallbackFunctionIn)=>{zincRayCaster==null&&(zincRayCaster=new RayCaster(sceneIn,this.scene,callbackFunctionIn,hoverCallbackFunctionIn,this.renderer))},this.disableRaycaster=()=>{zincRayCaster.disable(),zincRayCaster=void 0},this.isSyncControl=()=>currentMpde===MODE.SYNC_CONTROL,this.enableSyncControl=()=>(currentMode=MODE.SYNC_CONTROL,ndcControl||(ndcControl=new NDCCameraControl),ndcControl.setCurrentCameraSettings(this.cameraObject,viewports[defaultViewport]),ndcControl),this.disableSyncControl=()=>{currentMode=MODE.DEFAULT,this.cameraObject.zoom=1,this.cameraObject.updateProjectionMatrix()},this.enable()},SmoothCameraTransition=function SmoothCameraTransition(startingViewport,endingViewport,targetCameraIn,durationIn){var startingEyePosition=startingViewport.eyePosition,startingTargetPosition=startingViewport.targetPosition,startingUp=startingViewport.upVector,endingEyePosition=endingViewport.eyePosition,endingTargetPosition=endingViewport.targetPosition,endingUp=endingViewport.upVector,targetCamera=targetCameraIn,duration=durationIn,inbuildTime=0,enabled=!0,updateLightWithPathFlag=!0,completed=!1;targetCamera.near=Math.min(startingViewport.nearPlane,endingViewport.nearPlane),targetCamera.far=Math.max(startingViewport.farPlane,endingViewport.farPlane),targetCamera.cameraObject.up.set(endingViewport.upVector[0],endingViewport.upVector[1],endingViewport.upVector[2]),this.setDuration=newDuration=>{duration=newDuration};var updateTime=delta=>{var targetTime=inbuildTime+delta;targetTime>duration&&(targetTime=duration),inbuildTime=targetTime},updateCameraSettings=()=>{var ratio=inbuildTime/duration,eyePosition=[startingEyePosition[0]*(1-ratio)+endingEyePosition[0]*ratio,startingEyePosition[1]*(1-ratio)+endingEyePosition[1]*ratio,startingEyePosition[2]*(1-ratio)+endingEyePosition[2]*ratio],targetPosition=[startingTargetPosition[0]*(1-ratio)+endingTargetPosition[0]*ratio,startingTargetPosition[1]*(1-ratio)+endingTargetPosition[1]*ratio,startingTargetPosition[2]*(1-ratio)+endingTargetPosition[2]*ratio],upVector=[startingUp[0]*(1-ratio)+endingUp[0]*ratio,startingUp[1]*(1-ratio)+endingUp[1]*ratio,startingUp[2]*(1-ratio)+endingUp[2]*ratio];targetCamera.cameraObject.position.set(eyePosition[0],eyePosition[1],eyePosition[2]),targetCamera.cameraObject.target.set(targetPosition[0],targetPosition[1],targetPosition[2])};this.update=delta=>{!1===this.enabled||(updateTime(delta),updateCameraSettings(),inbuildTime==duration&&(completed=!0))},this.isTransitionCompleted=()=>completed},RotateCameraTransition=function RotateCameraTransition(axisIn,angleIn,targetCameraIn,durationIn){var axis=axisIn,angle=angleIn,targetCamera=targetCameraIn,duration=durationIn,inbuildTime=0,enabled=!0,ratio=inbuildTime/duration,completed=!1;this.setDuration=newDuration=>{duration=newDuration};var updateCameraSettings=delta=>{var previousTime=inbuildTime,targetTime=inbuildTime+delta;targetTime>duration&&(targetTime=duration),inbuildTime=targetTime;var actualDelta=inbuildTime-previousTime,ratio=actualDelta/duration,alpha=ratio*angle;targetCamera.rotateAboutLookAtpoint(axis,alpha)};this.update=delta=>{!1===this.enabled||(updateCameraSettings(delta),inbuildTime==duration&&(completed=!0))},this.isTransitionCompleted=()=>completed},RayCaster=function RayCaster(sceneIn,hostSceneIn,callbackFunctionIn,hoverCallbackFunctionIn,rendererIn){var scene=sceneIn,hostScene=hostSceneIn,renderer=rendererIn,callbackFunction=callbackFunctionIn,hoverCallbackFunction=hoverCallbackFunctionIn,enabled=!0,raycaster=new THREE.Raycaster;raycaster.params.Line.threshold=.1,raycaster.params.Points.threshold=1;var mouse=new THREE.Vector2,awaiting=!1,lastHoveredDate=new Date,lastHoveredEmpty=!1,timeDiff=0,pickedObjects=[],lastPosition={zincCamera:void 0,x:-1,y:-1},pickableObjects=void 0;this.enable=()=>{enable=!0},this.disable=()=>{enable=!1},this.getIntersectsObject=zincCamera=>{if(hostScene!==scene){var threejsScene=scene.getThreeJSScene();renderer.render(threejsScene,zincCamera.cameraObject)}var objects=pickableObjects?pickableObjects:scene.getPickableThreeJSObjects();//Reset pickedObjects array
2072
- return pickedObjects.length=0,raycaster.intersectObjects(objects,!0,pickedObjects);},this.setPickableObjects=zincObjects=>{zincObjects===void 0?pickableObjects=void 0:(pickableObjects=[],zincObjects.forEach(zincObject=>{zincObject.getGroup()&&zincObject.getGroup().visible&&pickableObjects.push(zincObject.getGroup())}))},this.getIntersectsObjectWithOrigin=(zincCamera,origin,direction)=>(raycaster.set(origin,direction),this.getIntersectsObject(zincCamera)),this.getIntersectsObjectWithCamera=(zincCamera,x,y)=>(zincCamera.getNDCFromDocumentCoords(x,y,mouse),raycaster.setFromCamera(mouse,zincCamera.cameraObject),this.getIntersectsObject(zincCamera)),this.pick=(zincCamera,x,y)=>{if(enabled&&renderer&&scene&&zincCamera&&callbackFunction){this.getIntersectsObjectWithCamera(zincCamera,x,y);for(var zincObject,length=pickedObjects.length,i=0;i<length;i++)if(zincObject=pickedObjects[i].object?pickedObjects[i].object.userData:void 0,zincObject&&zincObject.isMarkerCluster&&zincObject.visible&&zincObject.clusterIsVisible(pickedObjects[i].object.clusterIndex)&&zincObject.zoomToCluster(pickedObjects[i].object.clusterIndex))//Can zoom into cluster
2073
- return;callbackFunction(pickedObjects,x,y)}};var hovered=(zincCamera,x,y)=>{if(enabled&&renderer&&scene&&zincCamera&&hoverCallbackFunction){if(this.getIntersectsObjectWithCamera(zincCamera,x,y),lastHoveredDate.setTime(Date.now()),0===pickedObjects.length){//skip hovered callback if the previous one is empty
2074
- if(lastHoveredEmpty)return;lastHoveredEmpty=!0}else lastHoveredEmpty=!1;hoverCallbackFunction(pickedObjects,x,y)}};this.move=(zincCamera,x,y)=>{enabled&&renderer&&scene&&zincCamera&&hoverCallbackFunction&&(scene.displayMarkers?hovered(zincCamera,x,y):(lastPosition.zincCamera=zincCamera,lastPosition.x=x,lastPosition.y=y,!awaiting&&(timeDiff=lastHoveredDate?Date.now()-lastHoveredDate.getTime():250,250<=timeDiff?hovered(zincCamera,x,y):(awaiting=!0,setTimeout(awaitMove(lastPosition),timeDiff)))))};var awaitMove=lastPosition=>function(){awaiting=!1,hovered(lastPosition.zincCamera,lastPosition.x,lastPosition.y)};},CameraAutoTumble=function CameraAutoTumble(tumbleDirectionIn,tumbleRateIn,stopOnCameraInputIn,targetCameraIn){var tumbleAxis=new THREE.Vector3,angle=-tumbleRateIn,targetCamera=targetCameraIn,enabled=!0,updateLightWithPathFlag=!0,tumbleDirection=tumbleDirectionIn;this.stopOnCameraInput=stopOnCameraInputIn,this.requireUpdate=!0;var b=new THREE.Vector3,c=new THREE.Vector3,computeTumbleAxisAngle=tumbleDirection=>{var tangent_dist=Math.sqrt(tumbleDirection[0]*tumbleDirection[0]+tumbleDirection[1]*tumbleDirection[1]),width=4*Math.abs(tumbleDirection[0]),height=4*Math.abs(tumbleDirection[1]),radius=.25*(width+height),dx=-tumbleDirection[1]/tangent_dist,dy=tumbleDirection[0]/tangent_dist,d=dx*tumbleDirection[0]+dy*-tumbleDirection[1];d>radius?d=radius:d<-radius&&(d=-radius);var phi=Math.acos(d/radius)-.5*Math.PI;/* get axis to rotate about */tumbleAxis.copy(targetCamera.cameraObject.position).sub(targetCamera.cameraObject.target).normalize(),b.copy(targetCamera.cameraObject.up).normalize(),c.crossVectors(b,tumbleAxis).normalize().multiplyScalar(dx),b.multiplyScalar(dy),b.add(c).multiplyScalar(Math.cos(phi)),tumbleAxis.multiplyScalar(Math.sin(phi)).add(b)};this.update=delta=>{!1===this.enabled||(this.requireUpdate&&(computeTumbleAxisAngle(tumbleDirection),this.requireUpdate=!1),targetCamera.rotateAboutLookAtpoint(tumbleAxis,angle*delta/1e3))}},StereoCameraZoomFixed=function StereoCameraZoomFixed(){this.type="StereoCamera",this.aspect=1,this.cameraL=new THREE.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new THREE.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1};/**
2075
- * Object with containg viewport information used in ZincJS.
2076
- *
2077
- * @class
2078
- * @author Alan Wu
2079
- * @return {Viewport}
2080
- *//**
2081
- * Provides the basic controls for a scene.
2082
- *
2083
- * @class
2084
- * @author Alan Wu
2085
- * @return {CameraControls}
2086
- *//**
2087
- * @author mrdoob / http://mrdoob.com/
2088
- */Object.assign(StereoCameraZoomFixed.prototype,{update:(()=>{var focus,fov,aspect,near,far,zoom,eyeRight=new THREE.Matrix4,eyeLeft=new THREE.Matrix4;return function update(camera){var needsUpdate=focus!==camera.focus||fov!==camera.fov||aspect!==camera.aspect*this.aspect||near!==camera.near||far!==camera.far||zoom!==camera.zoom;if(needsUpdate){focus=camera.focus,fov=camera.fov,aspect=camera.aspect*this.aspect,near=camera.near,far=camera.far,zoom=camera.zoom;// Off-axis stereoscopic effect based on
2089
- // http://paulbourke.net/stereographics/stereorender/
2090
- var xmin,xmax,projectionMatrix=camera.projectionMatrix.clone(),eyeSep=.064/2,eyeSepOnProjection=eyeSep*near/focus,ymax=near*Math.tan(.5*(THREE.Math.DEG2RAD*fov))/camera.zoom;// translate xOffset
2091
- // for left eye
2092
- // for right eye
2093
- eyeLeft.elements[12]=-eyeSep,eyeRight.elements[12]=eyeSep,xmin=-ymax*aspect+eyeSepOnProjection,xmax=ymax*aspect+eyeSepOnProjection,projectionMatrix.elements[0]=2*near/(xmax-xmin),projectionMatrix.elements[8]=(xmax+xmin)/(xmax-xmin),this.cameraL.projectionMatrix.copy(projectionMatrix),xmin=-ymax*aspect-eyeSepOnProjection,xmax=ymax*aspect-eyeSepOnProjection,projectionMatrix.elements[0]=2*near/(xmax-xmin),projectionMatrix.elements[8]=(xmax+xmin)/(xmax-xmin),this.cameraR.projectionMatrix.copy(projectionMatrix)}this.cameraL.matrixWorld.copy(camera.matrixWorld).multiply(eyeLeft),this.cameraR.matrixWorld.copy(camera.matrixWorld).multiply(eyeRight)};})()});/** the following StereoEffect is written by third party *//**
2094
- * @author alteredq / http://alteredqualia.com/
2095
- * @authod mrdoob / http://mrdoob.com/
2096
- * @authod arodic / http://aleksandarrodic.com/
2097
- * @authod fonserbc / http://fonserbc.github.io/
2098
- */var StereoEffect=function StereoEffect(renderer){var _stereo=new StereoCameraZoomFixed;_stereo.aspect=.5,this.setSize=(width,height)=>{renderer.setSize(width,height)},this.render=(scene,camera)=>{scene.updateMatrixWorld(),null===camera.parent&&camera.updateMatrixWorld(),_stereo.update(camera);var size=renderer.getSize();renderer.setScissorTest(!0),renderer.clear(),renderer.setScissor(0,0,size.width/2,size.height),renderer.setViewport(0,0,size.width/2,size.height),renderer.render(scene,_stereo.cameraL),renderer.setScissor(size.width/2,0,size.width/2,size.height),renderer.setViewport(size.width/2,0,size.width/2,size.height),renderer.render(scene,_stereo.cameraR),renderer.setScissorTest(!1)}},ModifiedDeviceOrientationControls=function ModifiedDeviceOrientationControls(object){var scope=this;this.object=object,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;var onDeviceOrientationChangeEvent=event=>{scope.deviceOrientation=event},onScreenOrientationChangeEvent=()=>{"undefined"!=typeof window&&(scope.screenOrientation=window.orientation||0)},setObjectQuaternion=(()=>{var zee=new THREE.Vector3(0,0,1),euler=new THREE.Euler,q0=new THREE.Quaternion,q1=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));// - PI/2 around the x-axis
2099
- return(cameraObject,alpha,beta,gamma,orient)=>{var vector=new THREE.Vector3(0,0,1);vector.subVectors(cameraObject.target,cameraObject.position),euler.set(beta,alpha,-gamma,"YXZ");// 'ZXY' for the device, but 'YXZ' for us
2100
- var quaternion=new THREE.Quaternion;// orient the device
2101
- // camera looks out the back of the device, not the top
2102
- // adjust for screen orientation
2103
- quaternion.setFromEuler(euler),quaternion.multiply(q1),quaternion.multiply(q0.setFromAxisAngle(zee,-orient)),vector.applyQuaternion(quaternion),vector.addVectors(cameraObject.position,vector),cameraObject.lookAt(vector)};})();// The angles alpha, beta and gamma form a set of intrinsic Tait-Bryan angles of type Z-X'-Y''
2104
- this.connect=()=>{onScreenOrientationChangeEvent(),"undefined"!=typeof window&&(window.addEventListener("orientationchange",onScreenOrientationChangeEvent,!1),window.addEventListener("deviceorientation",onDeviceOrientationChangeEvent,!1)),scope.enabled=!0},this.disconnect=()=>{"undefined"!=typeof window&&(window.removeEventListener("orientationchange",onScreenOrientationChangeEvent,!1),window.removeEventListener("deviceorientation",onDeviceOrientationChangeEvent,!1)),scope.enabled=!1},this.update=()=>{if(!1!==scope.enabled){// Z
2105
- // X'
2106
- // Y''
2107
- // O
2108
- var alpha=scope.deviceOrientation.alpha?THREE.Math.degToRad(scope.deviceOrientation.alpha):0,beta=scope.deviceOrientation.beta?THREE.Math.degToRad(scope.deviceOrientation.beta):0,gamma=scope.deviceOrientation.gamma?THREE.Math.degToRad(scope.deviceOrientation.gamma):0,orient=scope.screenOrientation?THREE.Math.degToRad(scope.screenOrientation):0;setObjectQuaternion(scope.object,alpha,beta,gamma,orient)}},this.dispose=function(){this.disconnect()},this.connect()},NDCCameraControl=function NDCCameraControl(){var camera=void 0,targetCamera=void 0,defaultViewport=void 0,position=new THREE.Vector3,target=new THREE.Vector3,v1=new THREE.Vector3,v2=new THREE.Vector3,eventCallback=void 0;//return top left and size
2109
- this.setCurrentCameraSettings=(cameraIn,defaultViewportIn)=>{0==this.near_plane_fly_debt,camera=cameraIn.clone(),targetCamera=cameraIn,defaultViewport=defaultViewportIn,camera.near=defaultViewport.nearPlane,defaultViewport.farPlane&&(camera.far=defaultViewport.farPlane),defaultViewport.eyePosition&&camera.position.set(defaultViewport.eyePosition[0],defaultViewport.eyePosition[1],defaultViewport.eyePosition[2]),defaultViewport.upVector&&camera.up.set(defaultViewport.upVector[0],defaultViewport.upVector[1],defaultViewport.upVector[2]),defaultViewport.targetPosition&&(camera.target=new THREE.Vector3(defaultViewport.targetPosition[0],defaultViewport.targetPosition[1],defaultViewport.targetPosition[2]),camera.lookAt(camera.target)),camera.updateProjectionMatrix(),position.copy(camera.position).project(camera),target.copy(camera.target).project(camera)},this.getCurrentPosition=()=>(target.copy(targetCamera.target).project(camera),[target.x,target.y]),this.zoom=delta=>{var scaledDelta=.002*delta,zoom=Math.max(targetCamera.zoom-scaledDelta,1);targetCamera.zoom=zoom,targetCamera.updateProjectionMatrix()},this.zoomToBox=(box,zoom)=>{box.getCenter(v1),v1.project(camera),this.setCenterZoom([v1.x,v1.y],zoom)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:targetCamera.zoom}),this.setCenterZoom=(center,zoom)=>{v1.set(center[0],center[1],target.z).unproject(camera),v2.copy(v1).sub(targetCamera.target),targetCamera.target.copy(v1),targetCamera.lookAt(targetCamera.target),targetCamera.position.add(v2),targetCamera.zoom=zoom,targetCamera.updateProjectionMatrix()},this.setEventCallback=callback=>{(callback===void 0||"function"==typeof callback)&&(eventCallback=callback)},this.triggerCallback=()=>{eventCallback!==void 0&&"function"==typeof eventCallback&&eventCallback()}};/**
2110
- * @author richt / http://richt.me
2111
- * @author WestLangley / http://github.com/WestLangley
2112
- *
2113
- * W3C Device Orientation control (http://w3c.github.io/deviceorientation/spec-source-orientation.html)
2114
- */exports.Viewport=Viewport,exports.CameraControls=CameraControls,exports.SmoothCameraTransition=SmoothCameraTransition,exports.RotateCameraTransition=RotateCameraTransition,exports.RayCaster=RayCaster,exports.CameraAutoTumble=CameraAutoTumble,exports.StereoEffect=StereoEffect,exports.NDCCameraControl=NDCCameraControl;
2115
-
2116
- /***/ }),
2117
- /* 45 */
2118
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2119
-
2120
- var _require=__webpack_require__(4),Group=_require.Group,Matrix4=_require.Matrix4,Pointset=(__webpack_require__(22).Pointset),Lines=(__webpack_require__(24).Lines),Lines2=(__webpack_require__(46).Lines2),Geometry=(__webpack_require__(3).Geometry),THREE=__webpack_require__(4),uniqueiId=0,getUniqueId=function(){return"re"+uniqueiId++;},Region=function(parentIn,sceneIn){var parent=parentIn,group=new Group;group.matrixAutoUpdate=!1,group.userData=this;var children=[],name="",zincObjects=[],scene=sceneIn,tMatrix=new Matrix4,duration=3e3;/**
2121
- * Hide all primitives belong to this region.
2122
- *//**
2123
- * Show all primitives belong to this region.
2124
- *//**
2125
- * Set the visibility and propagate it down the hierarchies
2126
- * depending on the flag.
2127
- *
2128
- * @param {Boolean} flag - A flag indicating either the visibilty to be on/off.
2129
- *//**
2130
- * Get the visibility of the region and its children.
2131
- *
2132
- * @return {Boolean}
2133
- *//**
2134
- * Get the {THREE.Group} containing all child regions and their
2135
- * primitives.
2136
- *
2137
- * @return {THREE.Group}
2138
- *//**
2139
- * Set the transformation with a {THREE.Matrix4} matrix, this will affect
2140
- * all primitives in this and its child regions
2141
- *
2142
- * @param {THREE.Matrix4} transformation - The transformation matrix
2143
- * used for the transformation.
2144
- *//**
2145
- * Set the name of this region.
2146
- *
2147
- * @param {String} nameIn - Name to be set for this region. It must be defined
2148
- * and non-empty.
2149
- *//**
2150
- * Get the name of this region.
2151
- *
2152
- * @return {String}
2153
- *//**
2154
- * Get the parent region.
2155
- *
2156
- * @return {Region}
2157
- *//**
2158
- * Get the array of each hierarachy from the root region to this region.
2159
- *
2160
- * @return {Array}
2161
- *//**
2162
- * Get the full paths from the root region to this region.
2163
- *
2164
- * @return {String}
2165
- *//**
2166
- * Create a new child region with the provided name.
2167
- * @param {String} nameIn - Name to be set for the new child region.
2168
- *
2169
- * @return {Region}
2170
- *//**
2171
- * Get the child region with matching childName.
2172
- * @param {String} childName - Name to be matched.
2173
- *
2174
- * @return {Region}
2175
- *//**
2176
- * Find a child region using the path array.
2177
- * @param {Array} pathArray - Array containing regions' name at each
2178
- * hierarchy to match.
2179
- *
2180
- * @return {Region}
2181
- *//**
2182
- * Find the region using the provided relative path.
2183
- *
2184
- * @param {String} path - Relative paths from this region
2185
- * to the child region.
2186
- *
2187
- * @return {Region}
2188
- *//**
2189
- * Create a new child using the path array. All required new regions
2190
- * down the path will be created.
2191
- *
2192
- * @param {Array} pathArray - Array containing regions' name, new regions
2193
- * will be created along the path if not found.
2194
- *
2195
- * @return {Region}
2196
- *//**
2197
- * Create a new child using the path. All required new regions
2198
- * down the path will be created.
2199
- *
2200
- * @param {String} path - Relative paths from the region
2201
- * to the child region.
2202
- *
2203
- * @return {Region}
2204
- *//**
2205
- * Return existing region if it exists, otherwise, create a new
2206
- * region with the provided path.
2207
- *
2208
- * @param {String} path - Relative paths from the region
2209
- * to the child region.
2210
- *
2211
- * @return {Region}
2212
- *//**
2213
- * Add a zinc object into this region, the morph will be added
2214
- * to the group.
2215
- *
2216
- * @param {ZincObject} zincObject - Zinc object to be added into
2217
- * this region.
2218
- *//**
2219
- * Remove a ZincObject from this region if it presents. This will eventually
2220
- * destroy the object and free up the memory.
2221
- *
2222
- * @param {ZincObject} zincObject - object to be removed from this region.
2223
- *//**
2224
- * Return true if pickable objects require an update.
2225
- *
2226
- * @param {Boolean} transverse - Check child regions as well
2227
- * if this is set to true.
2228
- *
2229
- * @return {Boolean}
2230
- *//**
2231
- * Get all pickable objects.
2232
- *//**
2233
- * Set the default duration value for all zinc objects
2234
- * that are to be loaded into this region.
2235
- *
2236
- * @param {Number} durationIn - duration of the scene.
2237
- *//**
2238
- * Get the default duration value.
2239
- * returns {Number}
2240
- *//**
2241
- * Get the bounding box of all the object in this and child regions only.
2242
- * Do not include the matrix transformation here, it is done at the primitives
2243
- * level.
2244
- *
2245
- * @returns {THREE.Box3}
2246
- *//**
2247
- * Clear and dispose all objects belong to this region.
2248
- *
2249
- * @param {Boolean} transverse - Clear and dispose child regions as well
2250
- * if this is set to true.
2251
- *//**
2252
- * Check if a zincObject is a member of this region.
2253
- *
2254
- * @param {ZincObject} zincObject - The ZincObject to be checked.
2255
- * @param {Boolean} transverse - Also check the child regions.
2256
- *
2257
- * @return {Boolean}
2258
- *//**
2259
- * A function which iterates through the list of geometries and call the callback
2260
- * function with the geometries as the argument.
2261
- *
2262
- * @param {Function} callbackFunction - Callback function with the geometry
2263
- * as an argument.
2264
- * @param {Boolean} transverse - Also perform the same callback function for
2265
- * all child regions if this is set to be true.
2266
- *//**
2267
- * A function which iterates through the list of glyphsets and call the callback
2268
- * function with the glyphset as the argument.
2269
- *
2270
- * @param {Function} callbackFunction - Callback function with the glyphset
2271
- * as an argument.
2272
- * @param {Boolean} transverse - Also perform the same callback function for
2273
- * all child regions if this is set to be true.
2274
- *//**
2275
- * A function which iterates through the list of pointsets and call the callback
2276
- * function with the pointset as the argument.
2277
- *
2278
- * @param {Function} callbackFunction - Callback function with the pointset
2279
- * as an argument.
2280
- * @param {Boolean} transverse - Also perform the same callback function for
2281
- * all child regions if this is set to be true.
2282
- *//**
2283
- * A function which iterates through the list of lines and call the callback
2284
- * function with the lines as the argument.
2285
- *
2286
- * @param {Function} callbackFunction - Callback function with the lines
2287
- * as an argument.
2288
- * @param {Boolean} transverse - Also perform the same callback function for
2289
- * all child regions if this is set to be true.
2290
- *//**
2291
- * Find and return all zinc objects in this and child regions with
2292
- * the matching GroupName.
2293
- *
2294
- * @param {String} groupName - Groupname to match with.
2295
- * @param {Boolean} transverse - Also look for the object with groupName
2296
- * in child regions if set to true.
2297
- * @returns {Array}
2298
- *//**
2299
- * Find and return all geometries in this and child regions with
2300
- * the matching GroupName.
2301
- *
2302
- * @param {String} groupName - Groupname to match with.
2303
- * @param {Boolean} transverse - Also look for the object with groupName
2304
- * in child regions if set to true.
2305
- * @returns {Array}
2306
- *//**
2307
- * Find and return all pointsets in this and child regions with
2308
- * the matching groupName.
2309
- *
2310
- * @param {String} groupName - Groupname to match with.
2311
- * @param {Boolean} transverse - Also look for the object with groupName
2312
- * in child regions if set to true.
2313
- * @returns {Array}
2314
- *//**
2315
- * Find and return all glyphsets in this and child regions with
2316
- * the matching groupName.
2317
- *
2318
- * @param {String} groupName - Groupname to match with.
2319
- * @param {Boolean} transverse - Also look for the object with groupName
2320
- * in child regions if set to true.
2321
- * @returns {Array}
2322
- *//**
2323
- * Find and return all lines in this and child regions with
2324
- * the matching groupName.
2325
- *
2326
- * @param {String} groupName - Groupname to match with.
2327
- * @param {Boolean} transverse - Also look for the object with groupName
2328
- * in child regions if set to true.
2329
- * @returns {Array}
2330
- *//**
2331
- * Get all zinc objects in this region.
2332
- *
2333
- * @param {Boolean} transverse - Include zinc objects in child regions if this is
2334
- * set to true.
2335
- * @returns {Array}
2336
- *//**
2337
- * Get all child regions.
2338
- *
2339
- * @param {Boolean} transverse - Include all regions which are descendants of
2340
- * this reigon when this is set to true.
2341
- * @returns {Array}
2342
- *//**
2343
- * Get the current time of the region.
2344
- * Return -1 if no graphics in the region.
2345
- *
2346
- * @return {Number}
2347
- *//**
2348
- * Set the current time of all the objects of this region.
2349
- *
2350
- * @param {Number} time - Value to set the time to.
2351
- * @param {Boolean} transverse - Set the time for chidl regions if
2352
- * this is set to true.
2353
- *//**
2354
- * Check if any object in this region is time varying.
2355
- *
2356
- * @return {Boolean}
2357
- *//**
2358
- * Update geometries and glyphsets based on the calculated time.
2359
- * @private
2360
- *//**
2361
- * Update geometries and glyphsets based on the calculated time.
2362
- *//**
2363
- * Update geometries and glyphsets based on the calculated time.
2364
- *//**
2365
- * Add a new geometry
2366
- */tMatrix.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this.pickableUpdateRequired=!0,this.isRegion=!0,this.uuid=getUniqueId(),this.hideAllPrimitives=()=>{children.forEach(child=>child.hideAllPrimitives()),zincObjects.forEach(zincObject=>zincObject.setVisibility(!1))},this.showAllPrimitives=()=>{children.forEach(child=>child.showAllPrimitives()),zincObjects.forEach(zincObject=>zincObject.setVisibility(!0))},this.setVisibility=flag=>{flag!=group.visible&&(group.visible=flag,this.pickableUpdateRequired=!0)},this.getVisibility=()=>group.visible,this.getGroup=()=>group,this.setTransformation=transformation=>{tMatrix.set(...transformation),group.matrix.copy(tMatrix),group.updateMatrixWorld()},this.setName=nameIn=>{nameIn&&""!==nameIn&&(name=nameIn)},this.getName=()=>name,this.getParent=()=>parent,this.getFullSeparatedPath=()=>{var paths=[];if(""!==name){paths.push(name);for(var parentName,p=parent;p!==void 0;)parentName=p.getName(),""!==parentName&&paths.unshift(parentName),p=p.getParent();}return paths;},this.getFullPath=()=>{var paths=this.getFullSeparatedPath();if(0<paths.length){var fullPath=paths.shift();return paths.forEach(path=>{fullPath=fullPath.concat("/",path)}),fullPath;}return"";},this.createChild=nameIn=>{var childRegion=new Region(this,scene);return childRegion.setName(nameIn),children.push(childRegion),group.add(childRegion.getGroup()),childRegion;},this.getChildWithName=childName=>{if(childName)for(var lowerChildName=childName.toLowerCase(),i=0;i<children.length;i++)if(children[i].getName().toLowerCase()===lowerChildName)return children[i];},this.findChildFromSeparatedPath=pathArray=>{if(pathArray&&0<pathArray.length&&""===pathArray[0]&&pathArray.shift(),pathArray&&0<pathArray.length){var childRegion=this.getChildWithName(pathArray[0]);return childRegion?(pathArray.shift(),childRegion.findChildFromSeparatedPath(pathArray)):void 0}return this;},this.findChildFromPath=path=>{var pathArray=path.split("/");return this.findChildFromSeparatedPath(pathArray);},this.createChildFromSeparatedPath=pathArray=>{if(0<pathArray.length&&""===pathArray[0]&&pathArray.shift(),0<pathArray.length){var childRegion=this.getChildWithName(pathArray[0]);return childRegion||(childRegion=this.createChild(pathArray[0])),pathArray.shift(),childRegion.createChildFromSeparatedPath(pathArray);}return this;},this.createChildFromPath=path=>{var pathArray=path.split("/");return this.createChildFromSeparatedPath(pathArray);},this.findOrCreateChildFromPath=path=>{var childRegion=this.findChildFromPath(path);return childRegion||(childRegion=this.createChildFromPath(path)),childRegion;},this.addZincObject=zincObject=>{zincObject&&(zincObject.setRegion(this),group.add(zincObject.getGroup()),zincObjects.push(zincObject),this.pickableUpdateRequired=!0,scene&&scene.triggerObjectAddedCallback(zincObject))},this.removeZincObject=zincObject=>{for(var i=0;i<zincObjects.length;i++)if(zincObject===zincObjects[i])return group.remove(zincObject.getGroup()),zincObjects.splice(i,1),scene&&scene.triggerObjectRemovedCallback(zincObject),zincObject.dispose(),void(this.pickableUpdateRequired=!0);},this.checkPickableUpdateRequred=transverse=>{if(this.pickableUpdateRequired)return!0;if(transverse)for(var flag=!1,i=0;i<children.length;i++)if(flag=children[i].checkPickableUpdateRequred(transverse),flag)return!0;return!1;},this.getPickableThreeJSObjects=(objectsList,transverse)=>(group.visible&&(zincObjects.forEach(zincObject=>{if(zincObject.isPickable&&zincObject.getGroup()&&zincObject.getGroup().visible){var marker=zincObject.marker;marker&&marker.isEnabled()&&objectsList.push(marker.getMorph()),objectsList.push(zincObject.getGroup())}}),transverse&&children.forEach(childRegion=>{childRegion.getPickableThreeJSObjects(objectsList,transverse)}),this.pickableUpdateRequired=!1),objectsList),this.setDuration=durationIn=>{duration=durationIn,zincObjects.forEach(zincObject=>zincObject.setDuration(durationIn)),children.forEach(childRegion=>childRegion.setDuration(durationIn))},this.getDuration=()=>duration,this.getBoundingBox=transverse=>{var boundingBox1,boundingBox2;return zincObjects.forEach(zincObject=>{boundingBox2=zincObject.getBoundingBox(),boundingBox2&&(null==boundingBox1?boundingBox1=boundingBox2.clone():boundingBox1.union(boundingBox2))}),transverse&&children.forEach(childRegion=>{boundingBox2=childRegion.getBoundingBox(transverse),boundingBox2&&(null==boundingBox1?boundingBox1=boundingBox2.clone():boundingBox1.union(boundingBox2))}),boundingBox1;},this.clear=transverse=>{transverse&&children.forEach(childRegion=>childRegion.clear(transverse)),zincObjects.forEach(zincObject=>{group.remove(zincObject.getGroup()),zincObject.dispose()}),children=[],zincObjects=[]},this.objectIsInRegion=(zincObject,transverse)=>{for(var i=0;i<zincObjects.length;i++)if(zincObject===zincObjects[i])return!0;if(transverse)for(var _i=0;_i<children.length;_i++)if(children[_i].objectIsInRegion(zincObject,transverse))return!0;return!1;},this.forEachGeometry=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isGeometry&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachGeometry(callbackFunction,transverse))},this.forEachGlyphset=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isGlyphset&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachGlyphset(callbackFunction,transverse))},this.forEachPointset=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isPointset&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachPointset(callbackFunction,transverse))},this.forEachLine=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isLines&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachLine(callbackFunction,transverse))},this.findObjectsWithAnatomicalId=(anatomicalId,transverse)=>{var objectsArray=[];return zincObjects.forEach(zincObject=>{zincObject.anatomicalId===anatomicalId&&objectsArray.push(zincObject)}),transverse&&children.forEach(childRegion=>{var childObjects=childRegion.findObjectsWithAnatomicalId(anatomicalId,transverse);objectsArray.push(...childObjects)}),objectsArray;},this.findObjectsWithGroupName=(groupName,transverse)=>{var objectsArray=[];return zincObjects.forEach(zincObject=>{var lowerObjectName=zincObject.groupName?zincObject.groupName.toLowerCase():zincObject.groupName,lowerGroupName=groupName?groupName.toLowerCase():groupName;lowerObjectName===lowerGroupName&&objectsArray.push(zincObject)}),transverse&&children.forEach(childRegion=>{var childObjects=childRegion.findObjectsWithGroupName(groupName,transverse);objectsArray.push(...childObjects)}),objectsArray;},this.findGeometriesWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),geometriesArray=primitivesArray.filter(primitive=>primitive.isGeometry);return geometriesArray;},this.findPointsetsWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),pointsetsArray=primitivesArray.filter(primitive=>primitive.isPointset);return pointsetsArray;},this.findGlyphsetsWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),glyphsetsArray=primitivesArray.filter(primitive=>primitive.isGlyphset);return glyphsetsArray;},this.findLinesWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),linesArray=primitivesArray.filter(primitive=>primitive.isLines);return linesArray;},this.getAllObjects=transverse=>{var objectsArray=[...zincObjects];return transverse&&children.forEach(childRegion=>{var childObjects=childRegion.getAllObjects(transverse);objectsArray.push(...childObjects)}),objectsArray;},this.getChildRegions=transverse=>{var objectsArray=[...children];return transverse&&children.forEach(childRegion=>{var childObjects=childRegion.getChildRegions(transverse);objectsArray.push(...childObjects)}),objectsArray;},this.getCurrentTime=()=>{if(zincObjects[0]!=null)return zincObjects[0].getCurrentTime();for(var time,i=0;i<children.length;i++)if(time=children[i].getCurrentTime(),-1!==time)return time;return-1;},this.setMorphTime=(time,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.setMorphTime(time)}),transverse&&children.forEach(childRegion=>{childRegion.setMorphTime(time)})},this.isTimeVarying=()=>{for(var i=0;i<zincObjects.length;i++)if(zincObjects[i].isTimeVarying())return!0;for(var _i2=0;_i2<children.length;_i2++)if(children[_i2].isTimeVarying())return!0;return!1;},this.renderGeometries=(playRate,delta,playAnimation,cameraControls,options,transverse)=>{var _options$markerCluste,allObjects=this.getAllObjects(transverse);// Let video dictates the progress if one is present
2367
- allObjects.forEach(zincObject=>{zincObject.render(playRate*delta,playAnimation,cameraControls,options)}),options&&!1===playAnimation&&null!==(_options$markerCluste=options.markerCluster)&&void 0!==_options$markerCluste&&_options$markerCluste.markerUpdateRequired&&options.markerCluster.calculate()},this.createPoints=(groupName,coords,labels,colour)=>{var isNew=!1,zincObjects=this.findObjectsWithGroupName(groupName,!1),index=zincObjects.findIndex(zincObject=>zincObject.isPointset),pointset=-1<index?zincObjects[index]:new Pointset;return pointset.addPoints(coords,labels,colour),-1===index?(pointset.setName(groupName),this.addZincObject(pointset),isNew=!0):this.pickableUpdateRequired=!0,{zincObject:pointset,isNew};},this.createLines=(groupName,coords,colour)=>{var isNew=!1,zincObjects=this.findObjectsWithGroupName(groupName,!1),index=zincObjects.findIndex(zincObject=>zincObject.isLines),lines=-1<index?zincObjects[index]:new Lines2;return lines.addLines(coords,colour),-1===index?(lines.setName(groupName),this.addZincObject(lines),isNew=!0):this.pickableUpdateRequired=!0,{zincObject:lines,isNew};},this.createGeometryFromThreeJSGeometry=(groupName,geometry,colour,opacity,visibility,renderOrder)=>{var zincGeometry=new Geometry,material=new THREE.MeshPhongMaterial({color:colour,morphTargets:!1,morphNormals:!1,transparent:!0,opacity:opacity,side:THREE.DoubleSide});return zincGeometry.createMesh(geometry,material,{localTimeEnabled:!1,localMorphColour:!1}),zincGeometry.getMorph()?(zincGeometry.setVisibility(!1),zincGeometry.setName(groupName),zincGeometry.setRenderOrder(renderOrder),this.addZincObject(zincGeometry),zincGeometry):void 0}};/**
2368
- * Provides a hierachical structure to objects, Each region
2369
- * may contain multiple child regions and {@link ZincObject}.
2370
- *
2371
- * @class
2372
- * @author Alan Wu
2373
- * @return {Region}
2374
- */exports.Region=Region;
2375
-
2376
- /***/ }),
2377
- /* 46 */
2378
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2379
-
2380
- var THREE=__webpack_require__(4),toBufferGeometry=(__webpack_require__(5).toBufferGeometry),LineSegments2=(__webpack_require__(47).LineSegments2),LineMaterial=(__webpack_require__(49).LineMaterial),LineSegmentsGeometry=(__webpack_require__(48).LineSegmentsGeometry),Lines2=function(){(__webpack_require__(24).Lines).call(this),this.isLines2=!0;var positions=Array(300);/**
2381
- * Create the line segements using geometry and material.
2382
- *
2383
- * @param {Array} arrayIn - Geometry of lines to be rendered.
2384
- * @param {THREE.Material} materialIn - Material to be set for the lines.
2385
- * @param {Object} options - Provide various options
2386
- * @param {Boolean} options.localTimeEnabled - A flag to indicate either the lines is
2387
- * time dependent.
2388
- * @param {Boolean} options.localMorphColour - A flag to indicate either the colour is
2389
- * time dependent.
2390
- *//**
2391
- * Set the width for the lines.
2392
- *
2393
- * @param {Number} width - Width of the lines.
2394
- *//**
2395
- * Add new vertices into the array
2396
- *//**
2397
- * Get the vertices by face index
2398
- *//**
2399
- * Edit Vertice in index.
2400
- *//**
2401
- * Add new lines to existing lines if it exists, otherwise
2402
- * create a new one and add to it.
2403
- * @param {Array} coords -An array of three components coordinates.
2404
-
2405
- * @param {Number} colour - A hex value of the colour for the points
2406
- */this.createLineSegment=(arrayIn,materialIn,options)=>{if(arrayIn&&materialIn){var linesGeometry=new LineSegmentsGeometry;linesGeometry.setPositions(arrayIn),linesGeometry.colorsNeedUpdate=!0;var line=new LineSegments2(linesGeometry,materialIn);line.scale.set(1,1,1),line.computeLineDistances(),this.setMesh(line,options.localTimeEnabled,options.localMorphColour)}},this.setWidth=width=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=width,this.morph.material.needsUpdate=!0)},this.addVertices=function(coords){if(coords&&coords.length){var mesh=this.getMorph();mesh||(this.drawRange=0);var index=3*this.drawRange;//fill the rest of the array.
2407
- if(coords.forEach(coord=>{positions[index++]=coord[0],positions[index++]=coord[1],positions[index++]=coord[2],this.drawRange++}),!mesh)for(;300>index;)positions[index++]=coords[0][0],positions[index++]=coords[0][1],positions[index++]=coords[0][2];mesh&&(mesh.geometry.setPositions(positions),mesh.computeLineDistances(),mesh.geometry.computeBoundingBox(),mesh.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0)}return positions;},this.getVerticesByFaceIndex=function(faceIndex){var vIndex=3*(2*faceIndex),mesh=this.getMorph();if(mesh&&3*this.drawRange>vIndex){var position=mesh.geometry.getAttribute("instanceStart");return[[position.data.array[vIndex],position.data.array[++vIndex],position.data.array[++vIndex]],[position.data.array[++vIndex],position.data.array[++vIndex],position.data.array[++vIndex]]];}return[];},this.editVertices=function(coords,i){if(coords&&coords.length){var mesh=this.getMorph(),maxIndex=i+coords.length-1;if(!mesh||0>i||maxIndex>=this.drawRange)return;var index=3*i;for(coords.forEach(coord=>{positions[index++]=coord[0],positions[index++]=coord[1],positions[index++]=coord[2]}),index=3*this.drawRange;300>index;)positions[index++]=coords[0][0],positions[index++]=coords[0][1],positions[index++]=coords[0][2];mesh.geometry.setPositions(positions),mesh.computeLineDistances(),mesh.geometry.computeBoundingBox(),mesh.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}return positions;},this.addLines=(coords,colour)=>{if(coords&&0<coords.length){this.addVertices(coords);var mesh=this.getMorph();if(!mesh){var material=new LineMaterial({color:colour,linewidth:1,vertexColors:!1,worldUnits:!1});material.resolution.set(window.innerWidth,window.innerHeight);this.createLineSegment(positions,material,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}},this.render=()=>{var material=this.getMorph().material;material.resolution.set(window.innerWidth,window.innerHeight)}};/**
2408
- * Provides an object which stores lines.
2409
- * This is created when a valid json file containing lines is read into a {@link Zinc.Scene}
2410
- * object.
2411
- *
2412
- * @class
2413
- * @author Alan Wu
2414
- * @return {Lines}
2415
- */Lines2.prototype=Object.create((__webpack_require__(24).Lines).prototype),Lines2.prototype.constructor=Lines2,exports.Lines2=Lines2;
2416
-
2417
- /***/ }),
2418
- /* 47 */
2419
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2420
-
2421
- "use strict";
2422
- __webpack_require__.r(__webpack_exports__);
2423
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2424
- /* harmony export */ LineSegments2: () => (/* binding */ LineSegments2)
2425
- /* harmony export */ });
2426
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
2427
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_0__);
2428
- /* harmony import */ var _LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(48);
2429
- /* harmony import */ var _LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(49);
2430
- var _start=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_end=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_start4=new three__WEBPACK_IMPORTED_MODULE_0__.Vector4,_end4=new three__WEBPACK_IMPORTED_MODULE_0__.Vector4,_ssOrigin=new three__WEBPACK_IMPORTED_MODULE_0__.Vector4,_ssOrigin3=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_mvMatrix=new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4,_line=new three__WEBPACK_IMPORTED_MODULE_0__.Line3,_closestPoint=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,_box=new three__WEBPACK_IMPORTED_MODULE_0__.Box3,_sphere=new three__WEBPACK_IMPORTED_MODULE_0__.Sphere,_clipToWorldVector=new three__WEBPACK_IMPORTED_MODULE_0__.Vector4;class LineSegments2 extends three__WEBPACK_IMPORTED_MODULE_0__.Mesh{constructor(){var geometry=0<arguments.length&&arguments[0]!==void 0?arguments[0]:new _LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_1__.LineSegmentsGeometry,material=1<arguments.length&&arguments[1]!==void 0?arguments[1]:new _LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__.LineMaterial({color:16777215*Math.random()});super(geometry,material),this.type="LineSegments2"}// for backwards-compatability, but could be a method of LineSegmentsGeometry...
2431
- computeLineDistances(){for(var geometry=this.geometry,instanceStart=geometry.attributes.instanceStart,instanceEnd=geometry.attributes.instanceEnd,lineDistances=new Float32Array(2*instanceStart.count),i=0,j=0,l=instanceStart.count;i<l;i++,j+=2)_start.fromBufferAttribute(instanceStart,i),_end.fromBufferAttribute(instanceEnd,i),lineDistances[j]=0==j?0:lineDistances[j-1],lineDistances[j+1]=lineDistances[j]+_start.distanceTo(_end);var instanceDistanceBuffer=new three__WEBPACK_IMPORTED_MODULE_0__.InstancedInterleavedBuffer(lineDistances,2,1);// d0, d1
2432
- // d1
2433
- return geometry.setAttribute("instanceDistanceStart",new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute(instanceDistanceBuffer,1,0)),geometry.setAttribute("instanceDistanceEnd",new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute(instanceDistanceBuffer,1,1)),this;}raycast(raycaster,intersects){null===raycaster.camera&&console.error("LineSegments2: \"Raycaster.camera\" needs to be set in order to raycast against LineSegments2.");var threshold=void 0===raycaster.params.Line2?0:raycaster.params.Line2.threshold||0,ray=raycaster.ray,camera=raycaster.camera,projectionMatrix=camera.projectionMatrix,matrixWorld=this.matrixWorld,geometry=this.geometry,material=this.material,resolution=material.resolution,lineWidth=material.linewidth+threshold,instanceStart=geometry.attributes.instanceStart,instanceEnd=geometry.attributes.instanceEnd,near=-camera.near,ssMaxWidth=2*Math.max(lineWidth/resolution.width,lineWidth/resolution.height);// camera forward is negative
2434
- // clip space is [ - 1, 1 ] so multiply by two to get the full
2435
- // width in clip space
2436
- null===geometry.boundingSphere&&geometry.computeBoundingSphere(),_sphere.copy(geometry.boundingSphere).applyMatrix4(matrixWorld);var distanceToSphere=Math.max(camera.near,_sphere.distanceToPoint(ray.origin));// get the w component to scale the world space line width
2437
- _clipToWorldVector.set(0,0,-distanceToSphere,1).applyMatrix4(camera.projectionMatrix),_clipToWorldVector.multiplyScalar(1/_clipToWorldVector.w),_clipToWorldVector.applyMatrix4(camera.projectionMatrixInverse);// increase the sphere bounds by the worst case line screen space width
2438
- var sphereMargin=.5*Math.abs(ssMaxWidth/_clipToWorldVector.w);if(_sphere.radius+=sphereMargin,!1!==raycaster.ray.intersectsSphere(_sphere)){null===geometry.boundingBox&&geometry.computeBoundingBox(),_box.copy(geometry.boundingBox).applyMatrix4(matrixWorld);var distanceToBox=Math.max(camera.near,_box.distanceToPoint(ray.origin));// get the w component to scale the world space line width
2439
- _clipToWorldVector.set(0,0,-distanceToBox,1).applyMatrix4(camera.projectionMatrix),_clipToWorldVector.multiplyScalar(1/_clipToWorldVector.w),_clipToWorldVector.applyMatrix4(camera.projectionMatrixInverse);// increase the sphere bounds by the worst case line screen space width
2440
- var boxMargin=.5*Math.abs(ssMaxWidth/_clipToWorldVector.w);if(_box.max.x+=boxMargin,_box.max.y+=boxMargin,_box.max.z+=boxMargin,_box.min.x-=boxMargin,_box.min.y-=boxMargin,_box.min.z-=boxMargin,!1!==raycaster.ray.intersectsBox(_box)){ray.at(1,_ssOrigin),_ssOrigin.w=1,_ssOrigin.applyMatrix4(camera.matrixWorldInverse),_ssOrigin.applyMatrix4(projectionMatrix),_ssOrigin.multiplyScalar(1/_ssOrigin.w),_ssOrigin.x*=resolution.x/2,_ssOrigin.y*=resolution.y/2,_ssOrigin.z=0,_ssOrigin3.copy(_ssOrigin),_mvMatrix.multiplyMatrices(camera.matrixWorldInverse,matrixWorld);for(var i=0,l=instanceStart.count;i<l;i++){_start4.fromBufferAttribute(instanceStart,i),_end4.fromBufferAttribute(instanceEnd,i),_start4.w=1,_end4.w=1,_start4.applyMatrix4(_mvMatrix),_end4.applyMatrix4(_mvMatrix);// skip the segment if it's entirely behind the camera
2441
- var isBehindCameraNear=_start4.z>near&&_end4.z>near;if(!isBehindCameraNear){// trim the segment if it extends behind camera near
2442
- if(_start4.z>near){var deltaDist=_start4.z-_end4.z,t=(_start4.z-near)/deltaDist;_start4.lerp(_end4,t)}else if(_end4.z>near){var _deltaDist=_end4.z-_start4.z,_t=(_end4.z-near)/_deltaDist;_end4.lerp(_start4,_t)}// clip space
2443
- _start4.applyMatrix4(projectionMatrix),_end4.applyMatrix4(projectionMatrix),_start4.multiplyScalar(1/_start4.w),_end4.multiplyScalar(1/_end4.w),_start4.x*=resolution.x/2,_start4.y*=resolution.y/2,_end4.x*=resolution.x/2,_end4.y*=resolution.y/2,_line.start.copy(_start4),_line.start.z=0,_line.end.copy(_end4),_line.end.z=0;// get closest point on ray to segment
2444
- var param=_line.closestPointToPointParameter(_ssOrigin3,!0);_line.at(param,_closestPoint);// check if the intersection point is within clip space
2445
- var zPos=three__WEBPACK_IMPORTED_MODULE_0__.MathUtils.lerp(_start4.z,_end4.z,param),isInClipSpace=-1<=zPos&&1>=zPos,isInside=_ssOrigin3.distanceTo(_closestPoint)<.5*lineWidth;if(isInClipSpace&&isInside){_line.start.fromBufferAttribute(instanceStart,i),_line.end.fromBufferAttribute(instanceEnd,i),_line.start.applyMatrix4(matrixWorld),_line.end.applyMatrix4(matrixWorld);var pointOnLine=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3,point=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3;ray.distanceSqToSegment(_line.start,_line.end,point,pointOnLine),intersects.push({point:point,pointOnLine:pointOnLine,distance:ray.origin.distanceTo(point),object:this,face:null,faceIndex:i,uv:null,uv2:null})}}}}//
2446
- // pick a point 1 unit out along the ray to avoid the ray origin
2447
- // sitting at the camera origin which will cause "w" to be 0 when
2448
- // applying the projection matrix.
2449
- }//
2450
- // check if we intersect the box bounds
2451
- }}LineSegments2.prototype.LineSegments2=!0;
2452
-
2453
- /***/ }),
2454
- /* 48 */
2455
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2456
-
2457
- "use strict";
2458
- __webpack_require__.r(__webpack_exports__);
2459
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2460
- /* harmony export */ LineSegmentsGeometry: () => (/* binding */ LineSegmentsGeometry)
2461
- /* harmony export */ });
2462
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
2463
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_0__);
2464
- var _box=new three__WEBPACK_IMPORTED_MODULE_0__.Box3,_vector=new three__WEBPACK_IMPORTED_MODULE_0__.Vector3;class LineSegmentsGeometry extends three__WEBPACK_IMPORTED_MODULE_0__.InstancedBufferGeometry{constructor(){super(),this.type="LineSegmentsGeometry";this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(matrix){var start=this.attributes.instanceStart,end=this.attributes.instanceEnd;return void 0!==start&&(start.applyMatrix4(matrix),end.applyMatrix4(matrix),start.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this;}setPositions(array){var lineSegments;array instanceof Float32Array?lineSegments=array:Array.isArray(array)&&(lineSegments=new Float32Array(array));var instanceBuffer=new three__WEBPACK_IMPORTED_MODULE_0__.InstancedInterleavedBuffer(lineSegments,6,1);// xyz, xyz
2465
- return this.setAttribute("instanceStart",new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute(instanceBuffer,3,0)),this.setAttribute("instanceEnd",new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute(instanceBuffer,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this;}setColors(array){var colors;array instanceof Float32Array?colors=array:Array.isArray(array)&&(colors=new Float32Array(array));var instanceColorBuffer=new three__WEBPACK_IMPORTED_MODULE_0__.InstancedInterleavedBuffer(colors,6,1);// rgb, rgb
2466
- // rgb
2467
- return this.setAttribute("instanceColorStart",new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute(instanceColorBuffer,3,0)),this.setAttribute("instanceColorEnd",new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute(instanceColorBuffer,3,3)),this;}fromWireframeGeometry(geometry){return this.setPositions(geometry.attributes.position.array),this;}fromEdgesGeometry(geometry){return this.setPositions(geometry.attributes.position.array),this;}fromMesh(mesh){// set colors, maybe
2468
- return this.fromWireframeGeometry(new three__WEBPACK_IMPORTED_MODULE_0__.WireframeGeometry(mesh.geometry)),this;}fromLineSegments(lineSegments){var geometry=lineSegments.geometry;return geometry.isGeometry?void console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead."):(geometry.isBufferGeometry&&this.setPositions(geometry.attributes.position.array),this);// set colors, maybe
2469
- }computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new three__WEBPACK_IMPORTED_MODULE_0__.Box3);var start=this.attributes.instanceStart,end=this.attributes.instanceEnd;start!==void 0&&end!==void 0&&(this.boundingBox.setFromBufferAttribute(start),_box.setFromBufferAttribute(end),this.boundingBox.union(_box))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new three__WEBPACK_IMPORTED_MODULE_0__.Sphere),null===this.boundingBox&&this.computeBoundingBox();var start=this.attributes.instanceStart,end=this.attributes.instanceEnd;if(start!==void 0&&end!==void 0){var center=this.boundingSphere.center;this.boundingBox.getCenter(center);for(var maxRadiusSq=0,i=0,il=start.count;i<il;i++)_vector.fromBufferAttribute(start,i),maxRadiusSq=Math.max(maxRadiusSq,center.distanceToSquared(_vector)),_vector.fromBufferAttribute(end,i),maxRadiusSq=Math.max(maxRadiusSq,center.distanceToSquared(_vector));this.boundingSphere.radius=Math.sqrt(maxRadiusSq),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){// todo
2470
- }applyMatrix(matrix){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(matrix);}}LineSegmentsGeometry.prototype.isLineSegmentsGeometry=!0;
2471
-
2472
- /***/ }),
2473
- /* 49 */
2474
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2475
-
2476
- "use strict";
2477
- __webpack_require__.r(__webpack_exports__);
2478
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2479
- /* harmony export */ LineMaterial: () => (/* binding */ LineMaterial)
2480
- /* harmony export */ });
2481
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
2482
- /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_0__);
2483
- /**
2484
- * parameters = {
2485
- * color: <hex>,
2486
- * linewidth: <float>,
2487
- * dashed: <boolean>,
2488
- * dashScale: <float>,
2489
- * dashSize: <float>,
2490
- * dashOffset: <float>,
2491
- * gapSize: <float>,
2492
- * resolution: <Vector2>, // to be set by renderer
2493
- * }
2494
- */three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.line={linewidth:{value:1},resolution:{value:new three__WEBPACK_IMPORTED_MODULE_0__.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},dashOffset:{value:0},gapSize:{value:1},// todo FIX - maybe change to totalSize
2495
- opacity:{value:1}},three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib.line={uniforms:three__WEBPACK_IMPORTED_MODULE_0__.UniformsUtils.merge([three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.common,three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.fog,three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.line]),vertexShader:/* glsl */"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}",fragmentShader:/* glsl */"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef ALPHA_TO_COVERAGE\n\n\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\tfloat a = vUv.x;\n\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\tfloat len2 = a * a + b * b;\n\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t}\n\n\t\t\t#else\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}"};class LineMaterial extends three__WEBPACK_IMPORTED_MODULE_0__.ShaderMaterial{constructor(parameters){super({type:"LineMaterial",uniforms:three__WEBPACK_IMPORTED_MODULE_0__.UniformsUtils.clone(three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib.line.uniforms),vertexShader:three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib.line.vertexShader,fragmentShader:three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib.line.fragmentShader,clipping:!0// required for clipping support
2496
- }),Object.defineProperties(this,{color:{enumerable:!0,get:function get(){return this.uniforms.diffuse.value;},set:function set(value){this.uniforms.diffuse.value=value}},linewidth:{enumerable:!0,get:function get(){return this.uniforms.linewidth.value;},set:function set(value){this.uniforms.linewidth.value=value}},dashed:{enumerable:!0,get:function get(){return!!("USE_DASH"in this.defines);},set(value){!!value!==!!("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===value?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function get(){return this.uniforms.dashScale.value;},set:function set(value){this.uniforms.dashScale.value=value}},dashSize:{enumerable:!0,get:function get(){return this.uniforms.dashSize.value;},set:function set(value){this.uniforms.dashSize.value=value}},dashOffset:{enumerable:!0,get:function get(){return this.uniforms.dashOffset.value;},set:function set(value){this.uniforms.dashOffset.value=value}},gapSize:{enumerable:!0,get:function get(){return this.uniforms.gapSize.value;},set:function set(value){this.uniforms.gapSize.value=value}},opacity:{enumerable:!0,get:function get(){return this.uniforms.opacity.value;},set:function set(value){this.uniforms.opacity.value=value}},resolution:{enumerable:!0,get:function get(){return this.uniforms.resolution.value;},set:function set(value){this.uniforms.resolution.value.copy(value)}},alphaToCoverage:{enumerable:!0,get:function get(){return!!("ALPHA_TO_COVERAGE"in this.defines);},set:function set(value){!!value!==!!("ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===value?(this.defines.ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(parameters)}}LineMaterial.prototype.isLineMaterial=!0;
2497
-
2498
- /***/ }),
2499
- /* 50 */
2500
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2501
-
2502
- var THREE=__webpack_require__(4);/**
2503
- * This provide a full scale minimap. It will always
2504
- * display the whole map.
2505
- *
2506
- * @class
2507
- * @author Alan Wu
2508
- * @return {Minimap}
2509
- */exports.Minimap=function(sceneIn){var targetScene=sceneIn;this.camera=new THREE.OrthographicCamera(-.5,.5,.5,-.5,.01,10),this.helper=void 0;var geometry=new THREE.BufferGeometry,vertices=new Float32Array([-1,-1,1,1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,1]),positionAttributes=new THREE.BufferAttribute(vertices,3);geometry.setAttribute("position",positionAttributes);var material=new THREE.MeshBasicMaterial({color:3355443,depthTest:!1,depthWrite:!1,opacity:.5,transparent:!0});this.mask=new THREE.Mesh(geometry,material);var _box=new THREE.Box3,_center=new THREE.Vector3;this.getDiffFromNormalised=(x,y)=>{_box.setFromBufferAttribute(positionAttributes).getCenter(_center);var coord=_center.clone().project(this.camera),new_coord=new THREE.Vector3(x,y,coord.z).unproject(this.camera);return new_coord.sub(_center);};var setCurrentCameraSettings=(diameter,newViewport)=>{targetScene.camera.near&&(this.camera.near=targetScene.camera.near),newViewport.farPlane&&(this.camera.far=newViewport.farPlane),newViewport.eyePosition&&this.camera.position.set(newViewport.eyePosition[0],newViewport.eyePosition[1],newViewport.eyePosition[2]),newViewport.upVector&&this.camera.up.set(newViewport.upVector[0],newViewport.upVector[1],newViewport.upVector[2]),newViewport.targetPosition&&this.camera.lookAt(new THREE.Vector3(newViewport.targetPosition[0],newViewport.targetPosition[1],newViewport.targetPosition[2])),this.camera.zoom=1/diameter,this.camera.updateProjectionMatrix()};this.getBoundary=()=>{var target=new THREE.Vector3().copy(targetScene.camera.target).project(targetScene.camera),v1=new THREE.Vector3(-1,-1,target.z).unproject(targetScene.camera),v2=new THREE.Vector3(1,-1,target.z).unproject(targetScene.camera),v3=new THREE.Vector3(1,1,target.z).unproject(targetScene.camera),v4=new THREE.Vector3(-1,1,target.z).unproject(targetScene.camera);positionAttributes.copyVector3sArray([v1,v2,v3,v3,v4,v1]),positionAttributes.needsUpdate=!0},this.updateCamera=()=>{this.getBoundary();var cameraControl=targetScene.getZincCameraControls(),boundingBox=targetScene.getBoundingBox();if(boundingBox){// enlarge radius to keep image within edge of window
2510
- var diameter=boundingBox.min.distanceTo(boundingBox.max),radius=diameter/2,centreX=(boundingBox.min.x+boundingBox.max.x)/2,centreY=(boundingBox.min.y+boundingBox.max.y)/2,centreZ=(boundingBox.min.z+boundingBox.max.z)/2,viewport=cameraControl.getViewportFromCentreAndRadius(centreX,centreY,centreZ,radius,40,radius*4);setCurrentCameraSettings(diameter,viewport)}}};
2511
-
2512
- /***/ }),
2513
- /* 51 */
2514
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2515
-
2516
- var THREE=__webpack_require__(4),ThreeBSP=__webpack_require__(52)(THREE),Geometry=(__webpack_require__(3).Geometry),work=__webpack_require__(53),Promise=(__webpack_require__(54)["default"]),JSONLoader=THREE.BufferGeometryLoader,GeometryCSG=function(hostIn){//ZincGeoemtry of the main geometry
2517
- var host;hostIn&&hostIn.isGeometry&&(host=hostIn);var core=void 0,worker=void 0,onProgress=!1,myResolve=void 0,createGeometryFromJSON=json=>{var material=host.getMorph().material.clone();material.morphTargets=!1;var newGeometry=new Geometry,JSONParser=new JSONLoader,geometry=JSONParser.parse(json),mesh=new THREE.Mesh(geometry.geometry,material);return newGeometry.geometry=mesh.geometry,mesh.userData=newGeometry,newGeometry.setMorph(mesh),newGeometry;},workerEventHandler=ev=>{switch(ev.data.action){case"message":console.log(ev.data.message);break;case"result":var csg=new GeometryCSG(createGeometryFromJSON(ev.data.object));myResolve&&myResolve(csg),myResolve=void 0,onProgress=!1;break;default:throw"Cannot handle specified action.";}},initialise=hostIn=>{if(void 0!==work&&(worker=work(/*require.resolve*/(55))),!worker)core=new((__webpack_require__(56).GeometryCSGInternal))(hostIn);else if(hostIn&&hostIn.isGeometry){var mesh=hostIn.getMorph(),json=mesh.geometry.clone().applyMatrix(mesh.matrix).toJSON();worker.addEventListener("message",function(ev){workerEventHandler(ev)}),worker.postMessage({action:"initialise",object:json})}};this.getHostGeometry=()=>{var tempCSG=new ThreeBSP(host.getMorph());return new createZincGeometry(tempCSG);},this.getGeometry=()=>host;var createZincGeometry=csgMesh=>{var material=host.getMorph().material.clone();material.morphTargets=!1;var newMesh=csgMesh.toMesh(material),newGeometry=new Geometry;return newGeometry.geometry=newMesh.geometry,newMesh.userData=newGeometry,newGeometry.setMorph(newMesh),newGeometry;};this.setCSG=CSG=>{core.setCSG(CSG)};var sendToWork=(guestGeometry,action,resolve,reject)=>{if(!onProgress){var mesh=guestGeometry.getMorph(),json=mesh.geometry.clone().applyMatrix(mesh.matrix).toJSON();myResolve=resolve,onProgress=!0,worker.postMessage({action:action,object:json})}else reject("On progress");};this.intersect=guestGeometry=>new Promise((resolve,reject)=>{if(worker)sendToWork(guestGeometry,"intersect",resolve,reject);else{var result=core.intersect(guestGeometry),newCSG=new GeometryCSG(createZincGeometry(result));newCSG.setCSG(result),resolve(newCSG)}}),this.subtract=guestGeometry=>new Promise((resolve,reject)=>{if(worker)sendToWork(guestGeometry,"intersect",resolve,reject);else{var result=core.subtract(guestGeometry),newCSG=new GeometryCSG(createZincGeometry(result));newCSG.setCSG(result),resolve(newCSG)}}),this.union=guestGeometry=>new Promise((resolve,reject)=>{if(worker)sendToWork(guestGeometry,"intersect",resolve,reject);else{var result=core.union(guestGeometry),newCSG=new GeometryCSG(createZincGeometry(result));newCSG.setCSG(result),resolve(newCSG)}}),this.terminateWorker=()=>{worker&&worker.terminate()},initialise(hostIn)};//const work = undefined;
2518
- exports.GeometryCSG=GeometryCSG;
2519
-
2520
- /***/ }),
2521
- /* 52 */
2522
- /***/ ((module) => {
2523
-
2524
- "use strict";
2525
- var ThreeBSP,EPSILON=1e-5,COPLANAR=0,FRONT=1,BACK=2,SPANNING=3;module.exports=function(THREE){var ThreeBSP=function(geometry){// Convert THREE.Geometry to ThreeBSP
2526
- var i,_length_i,face,vertex,faceVertexUvs,uvs,polygon,polygons=[];if(geometry.isBufferGeometry&&(geometry=new THREE.Geometry().fromBufferGeometry(geometry)),geometry instanceof THREE.Geometry)this.matrix=new THREE.Matrix4;else if(geometry.isMesh)geometry.updateMatrix(),this.matrix=geometry.matrix.clone(),geometry=geometry.geometry,geometry.isBufferGeometry&&(geometry=new THREE.Geometry().fromBufferGeometry(geometry)),geometry.mergeVertices(),geometry.computeVertexNormals(!1);else{if(geometry instanceof ThreeBSP.Node)return this.tree=geometry,this.matrix=new THREE.Matrix4,this;throw"ThreeBSP: Given geometry is unsupported";}for(i=0,_length_i=geometry.faces.length;i<_length_i;i++){if(face=geometry.faces[i],faceVertexUvs=geometry.faceVertexUvs[0][i],polygon=new ThreeBSP.Polygon,face instanceof THREE.Face3)vertex=geometry.vertices[face.a],uvs=faceVertexUvs?new THREE.Vector2(faceVertexUvs[0].x,faceVertexUvs[0].y):null,vertex=new ThreeBSP.Vertex(vertex.x,vertex.y,vertex.z,face.vertexNormals[0],uvs),vertex.applyMatrix4(this.matrix),polygon.vertices.push(vertex),vertex=geometry.vertices[face.b],uvs=faceVertexUvs?new THREE.Vector2(faceVertexUvs[1].x,faceVertexUvs[1].y):null,vertex=new ThreeBSP.Vertex(vertex.x,vertex.y,vertex.z,face.vertexNormals[2],uvs),vertex.applyMatrix4(this.matrix),polygon.vertices.push(vertex),vertex=geometry.vertices[face.c],uvs=faceVertexUvs?new THREE.Vector2(faceVertexUvs[2].x,faceVertexUvs[2].y):null,vertex=new ThreeBSP.Vertex(vertex.x,vertex.y,vertex.z,face.vertexNormals[2],uvs),vertex.applyMatrix4(this.matrix),polygon.vertices.push(vertex);else if(typeof THREE.Face4)vertex=geometry.vertices[face.a],uvs=faceVertexUvs?new THREE.Vector2(faceVertexUvs[0].x,faceVertexUvs[0].y):null,vertex=new ThreeBSP.Vertex(vertex.x,vertex.y,vertex.z,face.vertexNormals[0],uvs),vertex.applyMatrix4(this.matrix),polygon.vertices.push(vertex),vertex=geometry.vertices[face.b],uvs=faceVertexUvs?new THREE.Vector2(faceVertexUvs[1].x,faceVertexUvs[1].y):null,vertex=new ThreeBSP.Vertex(vertex.x,vertex.y,vertex.z,face.vertexNormals[1],uvs),vertex.applyMatrix4(this.matrix),polygon.vertices.push(vertex),vertex=geometry.vertices[face.c],uvs=faceVertexUvs?new THREE.Vector2(faceVertexUvs[2].x,faceVertexUvs[2].y):null,vertex=new ThreeBSP.Vertex(vertex.x,vertex.y,vertex.z,face.vertexNormals[2],uvs),vertex.applyMatrix4(this.matrix),polygon.vertices.push(vertex),vertex=geometry.vertices[face.d],uvs=faceVertexUvs?new THREE.Vector2(faceVertexUvs[3].x,faceVertexUvs[3].y):null,vertex=new ThreeBSP.Vertex(vertex.x,vertex.y,vertex.z,face.vertexNormals[3],uvs),vertex.applyMatrix4(this.matrix),polygon.vertices.push(vertex);else throw"Invalid face type at index "+i;polygon.calculateProperties(),polygons.push(polygon)}this.tree=new ThreeBSP.Node(polygons)};return ThreeBSP.prototype.subtract=function(other_tree){var a=this.tree.clone(),b=other_tree.tree.clone();return a.invert(),a.clipTo(b),b.clipTo(a),b.invert(),b.clipTo(a),b.invert(),a.build(b.allPolygons()),a.invert(),a=new ThreeBSP(a),a.matrix=this.matrix,a;},ThreeBSP.prototype.union=function(other_tree){var a=this.tree.clone(),b=other_tree.tree.clone();return a.clipTo(b),b.clipTo(a),b.invert(),b.clipTo(a),b.invert(),a.build(b.allPolygons()),a=new ThreeBSP(a),a.matrix=this.matrix,a;},ThreeBSP.prototype.intersect=function(other_tree){var a=this.tree.clone(),b=other_tree.tree.clone();return a.invert(),b.clipTo(a),b.invert(),a.clipTo(b),b.clipTo(a),a.build(b.allPolygons()),a.invert(),a=new ThreeBSP(a),a.matrix=this.matrix,a;},ThreeBSP.prototype.toGeometry=function(){var i,j,polygon,polygon_vertice_count,vertex_idx_a,vertex_idx_b,vertex_idx_c,vertex,face,verticeUvs,matrix=new THREE.Matrix4().getInverse(this.matrix),geometry=new THREE.Geometry,polygons=this.tree.allPolygons(),polygon_count=polygons.length,vertice_dict={};for(i=0;i<polygon_count;i++)for(polygon=polygons[i],polygon_vertice_count=polygon.vertices.length,j=2;j<polygon_vertice_count;j++)verticeUvs=[],vertex=polygon.vertices[0],verticeUvs.push(new THREE.Vector2(vertex.uv.x,vertex.uv.y)),vertex=new THREE.Vector3(vertex.x,vertex.y,vertex.z),vertex.applyMatrix4(matrix),"undefined"==typeof vertice_dict[vertex.x+","+vertex.y+","+vertex.z]?(geometry.vertices.push(vertex),vertex_idx_a=vertice_dict[vertex.x+","+vertex.y+","+vertex.z]=geometry.vertices.length-1):vertex_idx_a=vertice_dict[vertex.x+","+vertex.y+","+vertex.z],vertex=polygon.vertices[j-1],verticeUvs.push(new THREE.Vector2(vertex.uv.x,vertex.uv.y)),vertex=new THREE.Vector3(vertex.x,vertex.y,vertex.z),vertex.applyMatrix4(matrix),"undefined"==typeof vertice_dict[vertex.x+","+vertex.y+","+vertex.z]?(geometry.vertices.push(vertex),vertex_idx_b=vertice_dict[vertex.x+","+vertex.y+","+vertex.z]=geometry.vertices.length-1):vertex_idx_b=vertice_dict[vertex.x+","+vertex.y+","+vertex.z],vertex=polygon.vertices[j],verticeUvs.push(new THREE.Vector2(vertex.uv.x,vertex.uv.y)),vertex=new THREE.Vector3(vertex.x,vertex.y,vertex.z),vertex.applyMatrix4(matrix),"undefined"==typeof vertice_dict[vertex.x+","+vertex.y+","+vertex.z]?(geometry.vertices.push(vertex),vertex_idx_c=vertice_dict[vertex.x+","+vertex.y+","+vertex.z]=geometry.vertices.length-1):vertex_idx_c=vertice_dict[vertex.x+","+vertex.y+","+vertex.z],face=new THREE.Face3(vertex_idx_a,vertex_idx_b,vertex_idx_c,new THREE.Vector3(polygon.normal.x,polygon.normal.y,polygon.normal.z)),geometry.faces.push(face),geometry.faceVertexUvs[0].push(verticeUvs);return geometry;},ThreeBSP.prototype.toBufferGeometry=function(){var geometry=this.toGeometry(),bufferGeometry=new THREE.BufferGeometry().fromGeometry(geometry);return bufferGeometry;},ThreeBSP.prototype.toMesh=function(material){var geometry=this.toBufferGeometry(),mesh=new THREE.Mesh(geometry,material);return mesh.position.setFromMatrixPosition(this.matrix),mesh.rotation.setFromRotationMatrix(this.matrix),mesh;},ThreeBSP.Polygon=function(vertices){vertices instanceof Array||(vertices=[]),this.vertices=vertices,0<vertices.length?this.calculateProperties():this.normal=this.w=void 0},ThreeBSP.Polygon.prototype.calculateProperties=function(){var a=this.vertices[0],b=this.vertices[1],c=this.vertices[2];return this.normal=b.clone().subtract(a).cross(c.clone().subtract(a)).normalize(),this.w=this.normal.clone().dot(a),this;},ThreeBSP.Polygon.prototype.clone=function(){var i,vertice_count,polygon=new ThreeBSP.Polygon;for(i=0,vertice_count=this.vertices.length;i<vertice_count;i++)polygon.vertices.push(this.vertices[i].clone());return polygon.calculateProperties(),polygon;},ThreeBSP.Polygon.prototype.flip=function(){var i,vertices=[];for(this.normal.multiplyScalar(-1),this.w*=-1,i=this.vertices.length-1;0<=i;i--)vertices.push(this.vertices[i]);return this.vertices=vertices,this;},ThreeBSP.Polygon.prototype.classifyVertex=function(vertex){var side_value=this.normal.dot(vertex)-this.w;return side_value<-EPSILON?BACK:side_value>EPSILON?FRONT:COPLANAR},ThreeBSP.Polygon.prototype.classifySide=function(polygon){var i,vertex,classification,num_positive=0,num_negative=0,vertice_count=polygon.vertices.length;for(i=0;i<vertice_count;i++)vertex=polygon.vertices[i],classification=this.classifyVertex(vertex),classification===FRONT?num_positive++:classification===BACK&&num_negative++;return 0<num_positive&&0===num_negative?FRONT:0===num_positive&&0<num_negative?BACK:0===num_positive&&0===num_negative?COPLANAR:SPANNING},ThreeBSP.Polygon.prototype.splitPolygon=function(polygon,coplanar_front,coplanar_back,front,back){var classification=this.classifySide(polygon);if(classification===COPLANAR)(0<this.normal.dot(polygon.normal)?coplanar_front:coplanar_back).push(polygon);else if(classification===FRONT)front.push(polygon);else if(classification===BACK)back.push(polygon);else{var vertice_count,i,j,ti,tj,vi,vj,t,v,f=[],b=[];for(i=0,vertice_count=polygon.vertices.length;i<vertice_count;i++)j=(i+1)%vertice_count,vi=polygon.vertices[i],vj=polygon.vertices[j],ti=this.classifyVertex(vi),tj=this.classifyVertex(vj),ti!=BACK&&f.push(vi),ti!=FRONT&&b.push(vi),(ti|tj)==SPANNING&&(t=(this.w-this.normal.dot(vi))/this.normal.dot(vj.clone().subtract(vi)),v=vi.interpolate(vj,t),f.push(v),b.push(v));3<=f.length&&front.push(new ThreeBSP.Polygon(f).calculateProperties()),3<=b.length&&back.push(new ThreeBSP.Polygon(b).calculateProperties())}},ThreeBSP.Vertex=function(x,y,z,normal,uv){this.x=x,this.y=y,this.z=z,this.normal=normal||new THREE.Vector3,this.uv=uv||new THREE.Vector2},ThreeBSP.Vertex.prototype.clone=function(){return new ThreeBSP.Vertex(this.x,this.y,this.z,this.normal.clone(),this.uv.clone());},ThreeBSP.Vertex.prototype.add=function(vertex){return this.x+=vertex.x,this.y+=vertex.y,this.z+=vertex.z,this;},ThreeBSP.Vertex.prototype.subtract=function(vertex){return this.x-=vertex.x,this.y-=vertex.y,this.z-=vertex.z,this;},ThreeBSP.Vertex.prototype.multiplyScalar=function(scalar){return this.x*=scalar,this.y*=scalar,this.z*=scalar,this;},ThreeBSP.Vertex.prototype.cross=function(vertex){var x=this.x,y=this.y,z=this.z;return this.x=y*vertex.z-z*vertex.y,this.y=z*vertex.x-x*vertex.z,this.z=x*vertex.y-y*vertex.x,this;},ThreeBSP.Vertex.prototype.normalize=function(){var length=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);return this.x/=length,this.y/=length,this.z/=length,this;},ThreeBSP.Vertex.prototype.dot=function(vertex){return this.x*vertex.x+this.y*vertex.y+this.z*vertex.z;},ThreeBSP.Vertex.prototype.lerp=function(a,t){return this.add(a.clone().subtract(this).multiplyScalar(t)),this.normal.add(a.normal.clone().sub(this.normal).multiplyScalar(t)),this.uv.add(a.uv.clone().sub(this.uv).multiplyScalar(t)),this;},ThreeBSP.Vertex.prototype.interpolate=function(other,t){return this.clone().lerp(other,t);},ThreeBSP.Vertex.prototype.applyMatrix4=function(m){// input: THREE.Matrix4 affine matrix
2527
- var x=this.x,y=this.y,z=this.z,e=m.elements;return this.x=e[0]*x+e[4]*y+e[8]*z+e[12],this.y=e[1]*x+e[5]*y+e[9]*z+e[13],this.z=e[2]*x+e[6]*y+e[10]*z+e[14],this;},ThreeBSP.Node=function(polygons){var i,polygon_count,front=[],back=[];if(this.polygons=[],this.front=this.back=void 0,polygons instanceof Array&&0!==polygons.length){for(this.divider=polygons[0].clone(),i=0,polygon_count=polygons.length;i<polygon_count;i++)this.divider.splitPolygon(polygons[i],this.polygons,this.polygons,front,back);0<front.length&&(this.front=new ThreeBSP.Node(front)),0<back.length&&(this.back=new ThreeBSP.Node(back))}},ThreeBSP.Node.isConvex=function(polygons){var i,j;for(i=0;i<polygons.length;i++)for(j=0;j<polygons.length;j++)if(i!==j&&polygons[i].classifySide(polygons[j])!==BACK)return!1;return!0;},ThreeBSP.Node.prototype.build=function(polygons){var i,polygon_count,front=[],back=[];for(this.divider||(this.divider=polygons[0].clone()),i=0,polygon_count=polygons.length;i<polygon_count;i++)this.divider.splitPolygon(polygons[i],this.polygons,this.polygons,front,back);0<front.length&&(!this.front&&(this.front=new ThreeBSP.Node),this.front.build(front)),0<back.length&&(!this.back&&(this.back=new ThreeBSP.Node),this.back.build(back))},ThreeBSP.Node.prototype.allPolygons=function(){var polygons=this.polygons.slice();return this.front&&(polygons=polygons.concat(this.front.allPolygons())),this.back&&(polygons=polygons.concat(this.back.allPolygons())),polygons;},ThreeBSP.Node.prototype.clone=function(){var node=new ThreeBSP.Node;return node.divider=this.divider.clone(),node.polygons=this.polygons.map(function(polygon){return polygon.clone();}),node.front=this.front&&this.front.clone(),node.back=this.back&&this.back.clone(),node;},ThreeBSP.Node.prototype.invert=function(){var i,polygon_count,temp;for(i=0,polygon_count=this.polygons.length;i<polygon_count;i++)this.polygons[i].flip();return this.divider.flip(),this.front&&this.front.invert(),this.back&&this.back.invert(),temp=this.front,this.front=this.back,this.back=temp,this;},ThreeBSP.Node.prototype.clipPolygons=function(polygons){var i,polygon_count,front,back;if(!this.divider)return polygons.slice();for(front=[],back=[],i=0,polygon_count=polygons.length;i<polygon_count;i++)this.divider.splitPolygon(polygons[i],front,back,front,back);return this.front&&(front=this.front.clipPolygons(front)),back=this.back?this.back.clipPolygons(back):[],front.concat(back);},ThreeBSP.Node.prototype.clipTo=function(node){this.polygons=node.clipPolygons(this.polygons),this.front&&this.front.clipTo(node),this.back&&this.back.clipTo(node)},ThreeBSP;};
2528
-
2529
- /***/ }),
2530
- /* 53 */
2531
- /***/ ((module) => {
2532
-
2533
- "use strict";
2534
- module.exports = require("webworkify-webpack");
2535
-
2536
- /***/ }),
2537
- /* 54 */
2538
- /***/ ((module) => {
2539
-
2540
- "use strict";
2541
- module.exports = require("promise-polyfill");
2542
-
2543
- /***/ }),
2544
- /* 55 */
2545
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2546
-
2547
- var Geometry=(__webpack_require__(3).Geometry),THREE=__webpack_require__(4),JSONLoader=THREE.BufferGeometryLoader;module.exports=function(self){var core=void 0,geometryFromJSON=function geometryFromJSON(object){var JSONParser=new JSONLoader,geometry=JSONParser.parse(object),material=new THREE.MeshPhongMaterial,mesh=new THREE.Mesh(geometry.geometry,material),host=new Geometry;return host.setMorph(mesh),host;},initialise=function initialise(object){var host=geometryFromJSON(object);core=new((__webpack_require__(56).GeometryCSGInternal))(host),self.postMessage({action:"message",message:"Initialised"})},intersect=function intersect(object){if(core){var guest=geometryFromJSON(object),result=core.intersect(guest),json=result.toBufferGeometry().toJSON();self.postMessage({action:"result",object:json})}},subtract=function subtract(object){if(core){var guest=geometryFromJSON(object),result=core.subtract(guest),json=result.toBufferGeometry().toJSON();self.postMessage({action:"result",object:json})}},union=function union(object){if(core){var guest=geometryFromJSON(object),result=core.union(guest),json=result.toBufferGeometry().toJSON();self.postMessage({action:"result",object:json})}};self.addEventListener("message",function(ev){switch(ev.data.action){case"initialise":initialise(ev.data.object);break;case"intersect":intersect(ev.data.object);break;case"subtract":subtract(ev.data.object);break;case"union":union(ev.data.object);break;default:throw"Cannot handle specified action.";}})};
2548
-
2549
- /***/ }),
2550
- /* 56 */
2551
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2552
-
2553
- var THREE=__webpack_require__(4),ThreeBSP=__webpack_require__(52)(THREE),Geometry=(__webpack_require__(3).Geometry),GeometryCSG=(__webpack_require__(51).GeometryCSG),GeometryCSGInternal=function(hostIn){//ZincGeoemtry of the main geometry
2554
- var host;hostIn&&hostIn.isGeometry&&(host=hostIn);var hostCSG;this.setGeometry=hostIn=>{hostIn&&hostIn.isGeometry&&(host=hostIn),hostCSG=void 0},this.setCSG=csg=>{hostCSG=csg};var prepareCSG=guestGeometry=>{if(host&&host.morph&&guestGeometry&&guestGeometry.morph){hostCSG===void 0&&(hostCSG=new ThreeBSP(host.morph));var guestCSG=new ThreeBSP(guestGeometry.morph);return guestCSG;}};this.intersect=guestGeometry=>{var guestCSG=prepareCSG(guestGeometry);return hostCSG&&guestCSG?hostCSG.intersect(guestCSG):void 0},this.subtract=guestGeometry=>{var guestCSG=prepareCSG(guestGeometry);return hostCSG&&guestCSG?hostCSG.subtract(guestCSG):void 0},this.union=guestGeometry=>{var guestCSG=prepareCSG(guestGeometry);return hostCSG&&guestCSG?hostCSG.union(guestCSG):void 0}};exports.GeometryCSGInternal=GeometryCSGInternal;
2555
-
2556
- /***/ }),
2557
- /* 57 */
2558
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2559
-
2560
- var THREE=__webpack_require__(4),ThreeBSP=__webpack_require__(52)(THREE),Glyphset=(__webpack_require__(18).Glyphset),GlyphsetCSG=function(hostIn){var host;hostIn&&hostIn.isGlyphset&&(host=hostIn);var hostCSGs=[];this.setGlyphset=hostIn=>{hostIn&&hostIn.isGlyphset&&(host=hostIn),hostCSG=void 0},this.getGlyphset=()=>host;var prepareCSGForGlyphs=()=>glyph=>{var mesh=glyph.getMesh(),label=glyph.getLabel();if(mesh){var csg=new ThreeBSP(mesh.geometry.clone().applyMatrix(mesh.matrix)),store=[];store.csg=csg,store.label=label,mesh.material&&(store.material=mesh.material.clone()),hostCSGs.push(store)}},prepareCSG=guestGeometry=>{if(host&&guestGeometry&&guestGeometry.getMorph()){0==hostCSGs.length&&host.forEachGlyph(prepareCSGForGlyphs());var guestCSG=new ThreeBSP(guestGeometry.getMorph());return guestCSG;}};this.intersect=guestGeometry=>{var guestCSG=prepareCSG(guestGeometry);if(0<hostCSGs.length&&guestCSG){for(var glyphset=new((__webpack_require__(18).Glyphset)),i=0;i<hostCSGs.length;i++){var _hostCSG=hostCSGs[i],intersect=_hostCSG.csg.intersect(guestCSG),mesh=intersect.toMesh();if(mesh&&mesh.geometry&&0<mesh.geometry.vertices.length){_hostCSG.material&&(mesh.material=_hostCSG.material,mesh.material.side=THREE.DoubleSide,mesh.material.clippingPlanes=null);var glyph=glyphset.addMeshAsGlyph(mesh,i+1);glyph.setLabel(_hostCSG.label)}}var newCSG=new GlyphsetCSG(glyphset);return newCSG;}}};/**
2561
- * Provides an object which takes in a glyphset, convert it into a CSG and further
2562
- * action such as intersect with another geometry may be performed.
2563
- *
2564
- * @class
2565
- * @author Alan Wu
2566
- * @return {GlyphsetCSG}
2567
- */exports.GlyphsetCSG=GlyphsetCSG;
2568
-
2569
- /***/ })
2570
- /******/ ]);
2571
- /************************************************************************/
2572
- /******/ // The module cache
2573
- /******/ var __webpack_module_cache__ = {};
2574
- /******/
2575
- /******/ // The require function
2576
- /******/ function __webpack_require__(moduleId) {
2577
- /******/ // Check if module is in cache
2578
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
2579
- /******/ if (cachedModule !== undefined) {
2580
- /******/ return cachedModule.exports;
2581
- /******/ }
2582
- /******/ // Create a new module (and put it into the cache)
2583
- /******/ var module = __webpack_module_cache__[moduleId] = {
2584
- /******/ // no module.id needed
2585
- /******/ // no module.loaded needed
2586
- /******/ exports: {}
2587
- /******/ };
2588
- /******/
2589
- /******/ // Execute the module function
2590
- /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
2591
- /******/
2592
- /******/ // Return the exports of the module
2593
- /******/ return module.exports;
2594
- /******/ }
2595
- /******/
2596
- /************************************************************************/
2597
- /******/ /* webpack/runtime/compat get default export */
2598
- /******/ (() => {
2599
- /******/ // getDefaultExport function for compatibility with non-harmony modules
2600
- /******/ __webpack_require__.n = (module) => {
2601
- /******/ var getter = module && module.__esModule ?
2602
- /******/ () => (module['default']) :
2603
- /******/ () => (module);
2604
- /******/ __webpack_require__.d(getter, { a: getter });
2605
- /******/ return getter;
2606
- /******/ };
2607
- /******/ })();
2608
- /******/
2609
- /******/ /* webpack/runtime/define property getters */
2610
- /******/ (() => {
2611
- /******/ // define getter functions for harmony exports
2612
- /******/ __webpack_require__.d = (exports, definition) => {
2613
- /******/ for(var key in definition) {
2614
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
2615
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
2616
- /******/ }
2617
- /******/ }
2618
- /******/ };
2619
- /******/ })();
2620
- /******/
2621
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
2622
- /******/ (() => {
2623
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
2624
- /******/ })();
2625
- /******/
2626
- /******/ /* webpack/runtime/make namespace object */
2627
- /******/ (() => {
2628
- /******/ // define __esModule on exports
2629
- /******/ __webpack_require__.r = (exports) => {
2630
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
2631
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2632
- /******/ }
2633
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
2634
- /******/ };
2635
- /******/ })();
2636
- /******/
2637
- /************************************************************************/
2638
- /******/
2639
- /******/ // startup
2640
- /******/ // Load entry module and return exports
2641
- /******/ // This entry module is referenced by other modules so it can't be inlined
2642
- /******/ var __webpack_exports__ = __webpack_require__(0);
2643
- /******/
2644
- /******/ return __webpack_exports__;
2645
- /******/ })()
2646
- ;
2647
- });
2648
- //# sourceMappingURL=zinc.js.map
1
+ (function(v,Oe){typeof exports=="object"&&typeof module<"u"?module.exports=Oe(require("three"),require("three-spritetext"),require("css-element-queries"),require("three/examples/jsm/loaders/GLTFLoader")):typeof define=="function"&&define.amd?define(["three","three-spritetext","css-element-queries","three/examples/jsm/loaders/GLTFLoader"],Oe):(v=typeof globalThis<"u"?globalThis:v||self,v.Zinc=Oe(v.THREE,v.SpriteText,v.cssElememtQueries,v.GLTFLoader))})(this,function(v,Oe,Ot,Bi){"use strict";function Ui(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const S=Ui(v),Ni={version:"2.0.0"},we=new v.Matrix4,rt=new v.Object3D,qe=new v.Vector3,Ae=new v.Vector3;function Be(){this.uuid=v.MathUtils.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.normals=[],this.uvs=[],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1,this.morphNormalsReady=!1}Be.prototype=Object.assign(Object.create(v.EventDispatcher.prototype),{constructor:Be,isGeometry:!0,applyMatrix4:function(n){const e=new v.Matrix3().getNormalMatrix(n);for(let t=0,s=this.vertices.length;t<s;t++)this.vertices[t].applyMatrix4(n);for(let t=0,s=this.faces.length;t<s;t++){const i=this.faces[t];i.normal.applyMatrix3(e).normalize();for(let r=0,o=i.vertexNormals.length;r<o;r++)i.vertexNormals[r].applyMatrix3(e).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(n){return we.makeRotationX(n),this.applyMatrix4(we),this},rotateY:function(n){return we.makeRotationY(n),this.applyMatrix4(we),this},rotateZ:function(n){return we.makeRotationZ(n),this.applyMatrix4(we),this},translate:function(n,e,t){return we.makeTranslation(n,e,t),this.applyMatrix4(we),this},scale:function(n,e,t){return we.makeScale(n,e,t),this.applyMatrix4(we),this},lookAt:function(n){return rt.lookAt(n),rt.updateMatrix(),this.applyMatrix4(rt.matrix),this},fromBufferGeometry:function(n){const e=this,t=n.index!==null?n.index:void 0,s=n.attributes;if(s.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;const i=s.position,r=s.normal,o=s.color,a=s.uv,u=s.uv2;u!==void 0&&(this.faceVertexUvs[1]=[]);for(let c=0;c<i.count;c++)e.vertices.push(new v.Vector3().fromBufferAttribute(i,c)),o!==void 0&&e.colors.push(new v.Color().fromBufferAttribute(o,c));function f(c,d,h,p){const w=o===void 0?[]:[e.colors[c].clone(),e.colors[d].clone(),e.colors[h].clone()],y=r===void 0?[]:[new v.Vector3().fromBufferAttribute(r,c),new v.Vector3().fromBufferAttribute(r,d),new v.Vector3().fromBufferAttribute(r,h)],g=new De(c,d,h,y,w,p);e.faces.push(g),a!==void 0&&e.faceVertexUvs[0].push([new v.Vector2().fromBufferAttribute(a,c),new v.Vector2().fromBufferAttribute(a,d),new v.Vector2().fromBufferAttribute(a,h)]),u!==void 0&&e.faceVertexUvs[1].push([new v.Vector2().fromBufferAttribute(u,c),new v.Vector2().fromBufferAttribute(u,d),new v.Vector2().fromBufferAttribute(u,h)])}const l=n.groups;if(l.length>0)for(let c=0;c<l.length;c++){const d=l[c],h=d.start,p=d.count;for(let w=h,y=h+p;w<y;w+=3)t!==void 0?f(t.getX(w),t.getX(w+1),t.getX(w+2),d.materialIndex):f(w,w+1,w+2,d.materialIndex)}else if(t!==void 0)for(let c=0;c<t.count;c+=3)f(t.getX(c),t.getX(c+1),t.getX(c+2));else for(let c=0;c<i.count;c+=3)f(c,c+1,c+2);return this.computeFaceNormals(),n.boundingBox!==null&&(this.boundingBox=n.boundingBox.clone()),n.boundingSphere!==null&&(this.boundingSphere=n.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(qe).negate(),this.translate(qe.x,qe.y,qe.z),this},normalize:function(){this.computeBoundingSphere();const n=this.boundingSphere.center,e=this.boundingSphere.radius,t=e===0?1:1/e,s=new v.Matrix4;return s.set(t,0,0,-t*n.x,0,t,0,-t*n.y,0,0,t,-t*n.z,0,0,0,1),this.applyMatrix4(s),this},computeFaceNormals:function(){const n=new v.Vector3,e=new v.Vector3;for(let t=0,s=this.faces.length;t<s;t++){const i=this.faces[t],r=this.vertices[i.a],o=this.vertices[i.b],a=this.vertices[i.c];n.subVectors(a,o),e.subVectors(r,o),n.cross(e),n.normalize(),i.normal.copy(n)}},computeVertexNormals:function(n=!0){const e=new Array(this.vertices.length);for(let t=0,s=this.vertices.length;t<s;t++)e[t]=new v.Vector3;if(n){const t=new v.Vector3,s=new v.Vector3;for(let i=0,r=this.faces.length;i<r;i++){const o=this.faces[i],a=this.vertices[o.a],u=this.vertices[o.b],f=this.vertices[o.c];t.subVectors(f,u),s.subVectors(a,u),t.cross(s),e[o.a].add(t),e[o.b].add(t),e[o.c].add(t)}}else{this.computeFaceNormals();for(let t=0,s=this.faces.length;t<s;t++){const i=this.faces[t];e[i.a].add(i.normal),e[i.b].add(i.normal),e[i.c].add(i.normal)}}for(let t=0,s=this.vertices.length;t<s;t++)e[t].normalize();for(let t=0,s=this.faces.length;t<s;t++){const i=this.faces[t],r=i.vertexNormals;r.length===3?(r[0].copy(e[i.a]),r[1].copy(e[i.b]),r[2].copy(e[i.c])):(r[0]=e[i.a].clone(),r[1]=e[i.b].clone(),r[2]=e[i.c].clone())}return this.faces.length>0&&(this.normalsNeedUpdate=!0),e},computeFlatVertexNormals:function(){this.computeFaceNormals();for(let n=0,e=this.faces.length;n<e;n++){const t=this.faces[n],s=t.vertexNormals;s.length===3?(s[0].copy(t.normal),s[1].copy(t.normal),s[2].copy(t.normal)):(s[0]=t.normal.clone(),s[1]=t.normal.clone(),s[2]=t.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(let e=0,t=this.faces.length;e<t;e++){const s=this.faces[e];s.__originalFaceNormal?s.__originalFaceNormal.copy(s.normal):s.__originalFaceNormal=s.normal.clone(),s.__originalVertexNormals||(s.__originalVertexNormals=[]);for(let i=0,r=s.vertexNormals.length;i<r;i++)s.__originalVertexNormals[i]?s.__originalVertexNormals[i].copy(s.vertexNormals[i]):s.__originalVertexNormals[i]=s.vertexNormals[i].clone()}const n=new Be;n.faces=this.faces;for(let e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];const r=this.morphNormals[e].faceNormals,o=this.morphNormals[e].vertexNormals;for(let a=0,u=this.faces.length;a<u;a++){const f=new v.Vector3,l={a:new v.Vector3,b:new v.Vector3,c:new v.Vector3};r.push(f),o.push(l)}}const s=this.morphNormals[e];n.vertices=this.morphTargets[e].vertices,n.computeFaceNormals();let i=n.computeVertexNormals();if(i&&i.length>0){this.morphTargets[e].normals=new Array(this.vertices.length);for(let r=0;r<i.length;r++)this.morphTargets[e].normals[r]=i[r].clone()}for(let r=0,o=this.faces.length;r<o;r++){const a=this.faces[r],u=s.faceNormals[r],f=s.vertexNormals[r];u.copy(a.normal),f.a.copy(a.vertexNormals[0]),f.b.copy(a.vertexNormals[1]),f.c.copy(a.vertexNormals[2])}}for(let e=0,t=this.faces.length;e<t;e++){const s=this.faces[e];s.normal=s.__originalFaceNormal,s.vertexNormals=s.__originalVertexNormals}this.morphNormalsReady=!0},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new v.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new v.Sphere),this.boundingSphere.setFromPoints(this.vertices)},mergeMorph:function(n,e){const t=this.morphTargets.length,s=this.morphTargets,i=n.morphTargets,r=this.morphColors.length,o=this.morphColors,a=n.morphColors;if(t>0&&t==i.length)for(let u=0,f=s.length;u<f;u++){const l=s[u],c=i[u];for(let d=0,h=c.vertices.length;d<h;d++){const w=c.vertices[d].clone();e!==void 0&&w.applyMatrix4(e),l.vertices.push(w)}if(l.normals&&c.normals)for(let d=0;d<c.normals.length;d=d+3)Ae.set(c.normals2[d],c.normals2[d+1],c.normals2[d+2]),e!==void 0&&Ae.applyMatrix4(e),l.normals.push(Ae.x,Ae.y,Ae.z)}if(r>0&&r==a.length)for(let u=0,f=o.length;u<f;u++){const l=o[u],c=a[u];for(let d=0,h=c.colors;d<h;d++)l.colors.push(c.colors[d].clone())}},merge:function(n,e,t=0){if(!(n&&n.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",n);return}let s;const i=this.vertices.length,r=this.vertices,o=n.vertices,a=n.normals,u=this.faces,f=n.faces,l=this.colors,c=n.colors;e!==void 0&&(s=new v.Matrix3().getNormalMatrix(e));for(let d=0,h=o.length;d<h;d++){const w=o[d].clone();e!==void 0&&w.applyMatrix4(e),r.push(w)}for(let d=0;d<a.length;d=d+3)Ae.set(a[d],a[d+1],a[d+2]),e!==void 0&&Ae.applyMatrix4(e),this.normals.push(Ae.x,Ae.y,Ae.z);for(let d=0,h=c.length;d<h;d++)typeof c[d]=="number"?l.push(c[d]):l.push(c[d].clone());for(let d=0,h=f.length;d<h;d++){const p=f[d];let w,y;const g=p.vertexNormals,_=p.vertexColors,A=new De(p.a+i,p.b+i,p.c+i);A.normal.copy(p.normal),s!==void 0&&A.normal.applyMatrix3(s).normalize();for(let N=0,I=g.length;N<I;N++)w=g[N].clone(),s!==void 0&&w.applyMatrix3(s).normalize(),A.vertexNormals.push(w);A.color.copy(p.color);for(let N=0,I=_.length;N<I;N++)y=_[N],A.vertexColors.push(y.clone());A.materialIndex=p.materialIndex+t,u.push(A)}for(let d=0,h=n.faceVertexUvs.length;d<h;d++){const p=n.faceVertexUvs[d];this.faceVertexUvs[d]===void 0&&(this.faceVertexUvs[d]=[]);for(let w=0,y=p.length;w<y;w++){const g=p[w],_=[];for(let A=0,N=g.length;A<N;A++)_.push(g[A].clone());this.faceVertexUvs[d].push(_)}}this.mergeMorph(n,e)},mergeMesh:function(n){if(!(n&&n.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",n);return}n.matrixAutoUpdate&&n.updateMatrix(),this.merge(n.geometry,n.matrix)},mergeVertices:function(n=4){const e={},t=[],s=[],i=Math.pow(10,n);for(let a=0,u=this.vertices.length;a<u;a++){const f=this.vertices[a],l=Math.round(f.x*i)+"_"+Math.round(f.y*i)+"_"+Math.round(f.z*i);e[l]===void 0?(e[l]=a,t.push(this.vertices[a]),s[a]=t.length-1):s[a]=s[e[l]]}const r=[];for(let a=0,u=this.faces.length;a<u;a++){const f=this.faces[a];f.a=s[f.a],f.b=s[f.b],f.c=s[f.c];const l=[f.a,f.b,f.c];for(let c=0;c<3;c++)if(l[c]===l[(c+1)%3]){r.push(a);break}}for(let a=r.length-1;a>=0;a--){const u=r[a];this.faces.splice(u,1);for(let f=0,l=this.faceVertexUvs.length;f<l;f++)this.faceVertexUvs[f].splice(u,1)}const o=this.vertices.length-t.length;return this.vertices=t,o},setFromPoints:function(n){this.vertices=[];for(let e=0,t=n.length;e<t;e++){const s=n[e];this.vertices.push(new v.Vector3(s.x,s.y,s.z||0))}return this},sortFacesByMaterialIndex:function(){const n=this.faces,e=n.length;for(let a=0;a<e;a++)n[a]._id=a;function t(a,u){return a.materialIndex-u.materialIndex}n.sort(t);const s=this.faceVertexUvs[0],i=this.faceVertexUvs[1];let r,o;s&&s.length===e&&(r=[]),i&&i.length===e&&(o=[]);for(let a=0;a<e;a++){const u=n[a]._id;r&&r.push(s[u]),o&&o.push(i[u])}r&&(this.faceVertexUvs[0]=r),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){const n={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.parameters!==void 0){const h=this.parameters;for(const p in h)h[p]!==void 0&&(n[p]=h[p]);return n}const e=[];for(let h=0;h<this.vertices.length;h++){const p=this.vertices[h];e.push(p.x,p.y,p.z)}const t=[],s=[],i={},r=[],o={},a=[],u={};for(let h=0;h<this.faces.length;h++){const p=this.faces[h],w=!0,y=!1,g=this.faceVertexUvs[0][h]!==void 0,_=p.normal.length()>0,A=p.vertexNormals.length>0,N=p.color.r!==1||p.color.g!==1||p.color.b!==1,I=p.vertexColors.length>0;let D=0;if(D=f(D,0,0),D=f(D,1,w),D=f(D,2,y),D=f(D,3,g),D=f(D,4,_),D=f(D,5,A),D=f(D,6,N),D=f(D,7,I),t.push(D),t.push(p.a,p.b,p.c),t.push(p.materialIndex),g){const F=this.faceVertexUvs[0][h];t.push(d(F[0]),d(F[1]),d(F[2]))}if(_&&t.push(l(p.normal)),A){const F=p.vertexNormals;t.push(l(F[0]),l(F[1]),l(F[2]))}if(N&&t.push(c(p.color)),I){const F=p.vertexColors;t.push(c(F[0]),c(F[1]),c(F[2]))}}function f(h,p,w){return w?h|1<<p:h&~(1<<p)}function l(h){const p=h.x.toString()+h.y.toString()+h.z.toString();return i[p]!==void 0||(i[p]=s.length/3,s.push(h.x,h.y,h.z)),i[p]}function c(h){const p=h.r.toString()+h.g.toString()+h.b.toString();return o[p]!==void 0||(o[p]=r.length,r.push(h.getHex())),o[p]}function d(h){const p=h.x.toString()+h.y.toString();return u[p]!==void 0||(u[p]=a.length/2,a.push(h.x,h.y)),u[p]}return n.data={},n.data.vertices=e,n.data.normals=s,r.length>0&&(n.data.colors=r),a.length>0&&(n.data.uvs=[a]),n.data.faces=t,n},clone:function(){return new Be().copy(this)},copy:function(n){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=n.name;const e=n.vertices;for(let c=0,d=e.length;c<d;c++)this.vertices.push(e[c].clone());const t=n.colors;for(let c=0,d=t.length;c<d;c++)this.colors.push(t[c].clone());const s=n.faces;for(let c=0,d=s.length;c<d;c++)this.faces.push(s[c].clone());for(let c=0,d=n.faceVertexUvs.length;c<d;c++){const h=n.faceVertexUvs[c];this.faceVertexUvs[c]===void 0&&(this.faceVertexUvs[c]=[]);for(let p=0,w=h.length;p<w;p++){const y=h[p],g=[];for(let _=0,A=y.length;_<A;_++){const N=y[_];g.push(N.clone())}this.faceVertexUvs[c].push(g)}}const i=n.morphTargets;for(let c=0,d=i.length;c<d;c++){const h={};if(h.name=i[c].name,i[c].vertices!==void 0){h.vertices=[];for(let p=0,w=i[c].vertices.length;p<w;p++)h.vertices.push(i[c].vertices[p].clone())}if(i[c].normals!==void 0){h.normals=[];for(let p=0,w=i[c].normals.length;p<w;p++)h.normals.push(i[c].normals[p].clone())}this.morphTargets.push(h)}const r=n.morphNormals;for(let c=0,d=r.length;c<d;c++){const h={};if(r[c].vertexNormals!==void 0){h.vertexNormals=[];for(let p=0,w=r[c].vertexNormals.length;p<w;p++){const y=r[c].vertexNormals[p],g={};g.a=y.a.clone(),g.b=y.b.clone(),g.c=y.c.clone(),h.vertexNormals.push(g)}}if(r[c].faceNormals!==void 0){h.faceNormals=[];for(let p=0,w=r[c].faceNormals.length;p<w;p++)h.faceNormals.push(r[c].faceNormals[p].clone())}this.morphNormals.push(h)}const o=n.skinWeights;for(let c=0,d=o.length;c<d;c++)this.skinWeights.push(o[c].clone());const a=n.skinIndices;for(let c=0,d=a.length;c<d;c++)this.skinIndices.push(a[c].clone());const u=n.lineDistances;for(let c=0,d=u.length;c<d;c++)this.lineDistances.push(u[c]);const f=n.boundingBox;f!==null&&(this.boundingBox=f.clone());const l=n.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.elementsNeedUpdate=n.elementsNeedUpdate,this.verticesNeedUpdate=n.verticesNeedUpdate,this.uvsNeedUpdate=n.uvsNeedUpdate,this.normalsNeedUpdate=n.normalsNeedUpdate,this.colorsNeedUpdate=n.colorsNeedUpdate,this.lineDistancesNeedUpdate=n.lineDistancesNeedUpdate,this.groupsNeedUpdate=n.groupsNeedUpdate,this},computeGroups(){const n=[];let e,t,s;const i=this.faces;for(t=0;t<i.length;t++){const r=i[t];r.materialIndex!==s&&(s=r.materialIndex,e!==void 0&&(e.count=t*3-e.start,n.push(e)),e={start:t*3,materialIndex:s})}return e!==void 0&&(e.count=t*3-e.start,n.push(e)),n},toBufferGeometry:function(){const n=new Pi().fromGeometry(this),e=new v.BufferGeometry,t=new Float32Array(n.vertices.length*3);if(e.setAttribute("position",new v.BufferAttribute(t,3).copyVector3sArray(n.vertices)),n.normals.length>0){const s=new Float32Array(n.normals.length*3);e.setAttribute("normal",new v.BufferAttribute(s,3).copyVector3sArray(n.normals))}if(n.colors.length>0){const s=new Float32Array(n.colors.length*3);e.setAttribute("color",new v.BufferAttribute(s,3).copyColorsArray(n.colors))}if(n.uvs.length>0){const s=new Float32Array(n.uvs.length*2);e.setAttribute("uv",new v.BufferAttribute(s,2).copyVector2sArray(n.uvs))}if(n.uvs2.length>0){const s=new Float32Array(n.uvs2.length*2);e.setAttribute("uv2",new v.BufferAttribute(s,2).copyVector2sArray(n.uvs2))}e.groups=n.groups;for(const s in n.morphTargets){const i=[],r=n.morphTargets[s];for(let o=0,a=r.length;o<a;o++){const u=r[o],f=new v.Float32BufferAttribute(u.data.length*3,3);f.name=u.name,i.push(f.copyVector3sArray(u.data))}e.morphAttributes[s]=i}if(n.skinIndices.length>0){const s=new v.Float32BufferAttribute(n.skinIndices.length*4,4);e.setAttribute("skinIndex",s.copyVector4sArray(n.skinIndices))}if(n.skinWeights.length>0){const s=new v.Float32BufferAttribute(n.skinWeights.length*4,4);e.setAttribute("skinWeight",s.copyVector4sArray(n.skinWeights))}return n.boundingSphere!==null&&(e.boundingSphere=n.boundingSphere.clone()),n.boundingBox!==null&&(e.boundingBox=n.boundingBox.clone()),e},toIndexedBufferGeometry:function(){const n=new v.BufferGeometry,e=new Float32Array(this.vertices.length*3);if(n.setAttribute("position",new v.BufferAttribute(e,3).copyVector3sArray(this.vertices)),this.normals.length>0){const t=new Float32Array(this.normals.length);let s=new v.BufferAttribute(t,3).copyArray(this.normals);n.setAttribute("normal",s)}if(this.uvs.length>0&&this.uvs[0].length>0){const t=new Float32Array(this.uvs[0].length*2);n.setAttribute("uv",new v.BufferAttribute(t,2).copyArray(this.uvs[0]))}if(this.uvs.length>1&&this.uvs[1].length>0){const t=new Float32Array(this.uvs[1].length*2);n.setAttribute("uv2",new v.BufferAttribute(t,2).copyArray(this.uvs[1]))}if(this.colors.length>0){const t=[];for(let i=0;i<this.colors.length;i++)t.push(new v.Color(this.colors[i]));const s=new Float32Array(t.length*3);n.setAttribute("color",new v.BufferAttribute(s,3).copyColorsArray(t))}else{const t=new Float32Array(this.vertices.length*3);for(let s=0;s<this.vertices.length*3;s++)t[s]=1;n.setAttribute("color",new v.BufferAttribute(t,3))}if(this.faces.length>0){let t=[],s=[];for(let i=0;i<this.faces.length;i++){s.push(this.faces[i].a,this.faces[i].b,this.faces[i].c);const r=this.faces[i].vertexColors;if(r.length===3)t.push(r[0],r[1],r[2]);else{const o=this.faces[i].color;t.push(o,o,o)}}n.setIndex(s),n.groups=this.computeGroups()}if(this.morphTargets.length>0){const t=[],s=[];for(let i=0,r=this.morphTargets.length;i<r;i++){const o=this.morphTargets[i],a=new v.Float32BufferAttribute(o.vertices.length*3,3);if(a.name=o.name,t.push(a.copyVector3sArray(o.vertices)),o.normals){const u=new v.Float32BufferAttribute(o.normals.length*3,3);u.name=o.name,s.push(u.copyVector3sArray(o.normals))}}n.morphAttributes.position=t,n.morphAttributes.normal=s}if(this.skinIndices.length>0){const t=new v.Float32BufferAttribute(this.skinIndices.length*4,4);n.setAttribute("skinIndex",t.copyVector4sArray(this.skinIndices))}if(this.skinWeights.length>0){const t=new v.Float32BufferAttribute(this.skinWeights.length*4,4);n.setAttribute("skinWeight",t.copyVector4sArray(this.skinWeights))}return this.boundingSphere!==null&&(n.boundingSphere=this.boundingSphere.clone()),this.boundingBox!==null&&(n.boundingBox=this.boundingBox.clone()),n},computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(n){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(n)},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Be.createBufferGeometryFromObject=function(n){let e=new v.BufferGeometry;const t=n.geometry;if(n.isPoints||n.isLine){const s=new v.Float32BufferAttribute(t.vertices.length*3,3),i=new v.Float32BufferAttribute(t.colors.length*3,3);if(e.setAttribute("position",s.copyVector3sArray(t.vertices)),e.setAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){const r=new v.Float32BufferAttribute(t.lineDistances.length,1);e.setAttribute("lineDistance",r.copyArray(t.lineDistances))}t.boundingSphere!==null&&(e.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(e.boundingBox=t.boundingBox.clone())}else n.isMesh&&(e=t.toBufferGeometry());return e};class Pi{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){const t=[];let s,i,r;const o=e.faces;for(i=0;i<o.length;i++){const a=o[i];a.materialIndex!==r&&(r=a.materialIndex,s!==void 0&&(s.count=i*3-s.start,t.push(s)),s={start:i*3,materialIndex:r})}s!==void 0&&(s.count=i*3-s.start,t.push(s)),this.groups=t}fromGeometry(e){const t=e.faces,s=e.vertices,i=e.faceVertexUvs,r=i[0]&&i[0].length>0,o=i[1]&&i[1].length>0,a=e.morphTargets,u=a.length;let f;if(u>0){f=[];for(let g=0;g<u;g++)f[g]={name:a[g].name,data:[]};this.morphTargets.position=f}const l=e.morphNormals,c=l.length;let d;if(c>0){d=[];for(let g=0;g<c;g++)d[g]={name:l[g].name,data:[]};this.morphTargets.normal=d}const h=e.skinIndices,p=e.skinWeights,w=h.length===s.length,y=p.length===s.length;s.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let g=0;g<t.length;g++){const _=t[g];this.vertices.push(s[_.a],s[_.b],s[_.c]);const A=_.vertexNormals;if(A.length===3)this.normals.push(A[0],A[1],A[2]);else{const I=_.normal;this.normals.push(I,I,I)}const N=_.vertexColors;if(N.length===3)this.colors.push(N[0],N[1],N[2]);else{const I=_.color;this.colors.push(I,I,I)}if(r===!0){const I=i[0][g];I!==void 0?this.uvs.push(I[0],I[1],I[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",g),this.uvs.push(new v.Vector2,new v.Vector2,new v.Vector2))}if(o===!0){const I=i[1][g];I!==void 0?this.uvs2.push(I[0],I[1],I[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",g),this.uvs2.push(new v.Vector2,new v.Vector2,new v.Vector2))}for(let I=0;I<u;I++){const D=a[I].vertices;f[I].data.push(D[_.a],D[_.b],D[_.c])}for(let I=0;I<c;I++){const D=l[I].vertexNormals[g];d[I].data.push(D.a,D.b,D.c)}w&&this.skinIndices.push(h[_.a],h[_.b],h[_.c]),y&&this.skinWeights.push(p[_.a],p[_.b],p[_.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}}class De{constructor(e,t,s,i,r,o=0){this.a=e,this.b=t,this.c=s,this.normal=i&&i.isVector3?i:new v.Vector3,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new v.Color,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=o}clone(){return new this.constructor().copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,s=e.vertexNormals.length;t<s;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,s=e.vertexColors.length;t<s;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}}const Vi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",ki=Oe.default||Oe;function ye(n){let e=n,t=Se.modelPrefix;return t&&(t[t.length-1]!="/"&&(t=t+"/"),new RegExp("^(?:[a-z]+:)?//","i").test(n)||(e=t+n)),e}function Pe(n,e){const t=(s,i)=>{try{let r=new URL(s,i).href;if(s&&s.split("?").length<2){const o=i.split("?");o.length===2&&(r=r+"?"+o[1])}return r}catch{console.error(`There is an issue creating the url link with: ${s}.`)}};if(Array.isArray(n)){const s=[];return n.forEach(i=>{s.push(t(i,e))}),s}else return t(n,e)}function Ii(n,e,t,s,i){let r=n.morphTargetInfluences,o;n.geometry&&(o=n.geometry.morphAttributes);let a=!1;if(r&&o&&o.position){s.set(0,0,0),i.set(0,0,0);for(let u=0;u<r.length;u++)r[u]>0&&(a=!0,t.setFromArray(o.position[u].array),s.add(t.min.multiplyScalar(r[u])),i.add(t.max.multiplyScalar(r[u])));a&&e.set(s,i)}a||e.setFromBufferAttribute(n.geometry.attributes.position),n.updateWorldMatrix(!0,!0),e.applyMatrix4(n.matrixWorld)}function Tt(n,e,t,s){fetch(ye(n)).then(i=>{if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return i.text()}).then(i=>{t(i,e)}).catch(i=>{console.error(`Fetch string payload retrieval failed for: ${requestURL}`,i),s(n)})}function Ri(n,e,t){const s=n.length;let i=0;const r=[];function o(a,u){r[u]=a,i++,i==s&&e(r)}for(let a=0;a<s;a++)Tt(n[a],a,o,t)}const Di=(n,e)=>{const t=Math.floor(e/3),s=e%3;let i=0;s==0?i=n[t].r:s==1?i=n[t].g:s==2&&(i=n[t].b);const r=new S.Color(i);return[r.r,r.g,r.b]},Lt=function(n,e){if(e&&n&&n.morphAttributes&&n.morphAttributes.color){const t=n.morphAttributes.color,s=e.morphTargetInfluences,i=s.length;n.deleteAttribute("morphColor0"),n.deleteAttribute("morphColor1");let r=0,o=[];for(let a=0;1>r||a<i;a++)s[a]>0&&(r++,o.push([a,s[a]]));o.length==2?(n.setAttribute("morphColor0",t[o[0][0]]),n.setAttribute("morphColor1",t[o[1][0]])):o.length==1&&(n.setAttribute("morphColor0",t[o[0][0]]),n.setAttribute("morphColor1",t[o[0][0]]))}},Ze=(n,e)=>{let t;return n instanceof Be?(e.localTimeEnabled&&!n.morphNormalsReady&&(n.morphNormals==null||n.morphNormals.length==0)&&n.computeMorphNormals(),t=n.toIndexedBufferGeometry(),e.localMorphColour&&Fi(n,t)):n instanceof S.BufferGeometry&&(t=n.clone()),t.colorsNeedUpdate=!0,t.computeBoundingBox(),t.computeBoundingSphere(),n._video&&(t._video=n._video),t},Fi=(n,e)=>{if(n&&n.morphColors&&n.morphColors.length>0){let t=[],s=n.morphColors;for(let i=0,r=s.length;i<r;i++){const o=s[i],a=[];for(let f=0;f<o.colors.length*3;f++){let l=Di(o.colors,f);a.push(l[0],l[1],l[2])}const u=new S.Float32BufferAttribute(a,3);u.name=o.name,t.push(u)}e.morphAttributes.color=t}};function Bt(n){let e,t,s,i=-1,r=0;for(let f=0;f<n.length;++f){const l=n[f];if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(s===void 0&&(s=l.normalized),s!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(i===-1&&(i=l.gpuType),i!==l.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;r+=l.count*t}const o=new e(r),a=new S.BufferAttribute(o,t,s);let u=0;for(let f=0;f<n.length;++f){const l=n[f];if(l.isInterleavedBufferAttribute){const c=u/t;for(let d=0,h=l.count;d<h;d++)for(let p=0;p<t;p++){const w=l.getComponent(d,p);a.setComponent(d+c,p,w)}}else o.set(l.array,u);u+=l.count*t}return i!==void 0&&(a.gpuType=i),a}const Gi=(n,e=!1)=>{const t=n[0].index!==null,s=new Set(Object.keys(n[0].attributes)),i=new Set(Object.keys(n[0].morphAttributes)),r={},o={},a=n[0].morphTargetsRelative,u=new S.BufferGeometry;let f=0;for(let l=0;l<n.length;++l){const c=n[l];let d=0;if(t!==(c.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const h in c.attributes){if(!s.has(h))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+'. All geometries must have compatible attributes; make sure "'+h+'" attribute exists among all geometries, or in none of them.'),null;r[h]===void 0&&(r[h]=[]),r[h].push(c.attributes[h]),d++}if(d!==s.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". Make sure all geometries have the same number of attributes."),null;if(a!==c.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const h in c.morphAttributes){if(!i.has(h))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". .morphAttributes must be consistent throughout all geometries."),null;o[h]===void 0&&(o[h]=[]),o[h].push(c.morphAttributes[h])}if(e){let h;if(t)h=c.index.count;else if(c.attributes.position!==void 0)h=c.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". The geometry must have either an index or a position attribute"),null;u.addGroup(f,h,l),f+=h}}if(t){let l=0;const c=[];for(let d=0;d<n.length;++d){const h=n[d].index;for(let p=0;p<h.count;++p)c.push(h.getX(p)+l);l+=n[d].attributes.position.count}u.setIndex(c)}for(const l in r){const c=Bt(r[l]);if(!c)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+l+" attribute."),null;u.setAttribute(l,c)}for(const l in o){const c=o[l][0].length;if(c===0)break;u.morphAttributes=u.morphAttributes||{},u.morphAttributes[l]=[];for(let d=0;d<c;++d){const h=[];for(let w=0;w<o[l].length;++w)h.push(o[l][w][d]);const p=Bt(h);if(!p)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+l+" morphAttribute."),null;u.morphAttributes[l].push(p)}}return u};function nt(n,e){if(e&&n>=e.length){const t=new S.BufferGeometry,s=new Float32Array(n*3);let i=0;return e.forEach(r=>{s[i++]=r[0],s[i++]=r[1],s[i++]=r[2]}),t.setAttribute("position",new S.BufferAttribute(s,3)),t.setDrawRange(0,e.length),t}}function Ut(){const n=new Image;n.src=Vi;const e=new S.Texture;return e.image=n,e.needsUpdate=!0,e}function ot(n,e,t,s,i,r){const o=new ki(n,e,t,s,i,r);return o.fontFace=s,o.fontSize=i,o.fontWeight=r,o.material.map.generateMipmaps=!1,o.material.map.anisotropy=4,o.material.sizeAttenuation=!1,o.material.alphaTest=.5,o.material.transparent=!0,o.material.depthWrite=!1,o.material.depthTest=!1,o.center.set(.5,-1.2),o.renderOrder=1e4,o}function Nt(n,e,t){if(t){const s=n||"",i=e||"",r=t.lastIndexOf("/");if(r>-1){let o,a;if(o=t.substring(0,r),a=t.substring(r+1),(o==="*"||o==="**"||o.toLowerCase()===s.toLowerCase())&&(a==="*"||a==="**"||a.toLowerCase()===i.toLowerCase()))return!0}else if(s.toLowerCase()===t.toLowerCase()||i.toLowerCase()===t.toLowerCase())return!0}return!1}function ji(n,e,t){const s=n.getAttribute("position"),i=n.getAttribute("normal");if(!s)return;const r=s.itemSize,o=e*r,a=r;let u=!1;const f=(l,c)=>{let d=!1;const h=Array.from(l.array);if(h.length>=o+a){h.splice(o,a),h.concat(new Array(a).fill(0)),d=!0;const p=new Float32Array(h);n.setAttribute(c,new S.BufferAttribute(p,r)),n.getAttribute(c).needsUpdate=!0}return d};return u=f(s,"position"),i&&f(i,"normal"),n.index!==null&&console.warn("Removing vertices from indexed geometry requires index buffer recalculation."),u}const Pt=function(){return function(n){n.vertexShader=n.vertexShader.replace("#include <color_pars_vertex>",["varying vec3 vColor;","attribute vec3 morphColor0;","attribute vec3 morphColor1;"].join(`
2
+ `)),n.vertexShader=n.vertexShader.replace("#include <color_vertex>",["vColor.xyz = color.xyz;","#ifdef USE_MORPHTARGETS","vColor = morphColor0 * morphTargetInfluences[ 0 ];","vColor += morphColor1 * morphTargetInfluences[ 1 ];","#endif"].join(`
3
+ `))}},Vt=new v.Vector3,kt=new v.Vector3,It=new v.Matrix4,at=new v.Ray,Ye=new v.Sphere,lt=new v.Vector3,ct=new v.Vector3,Rt=new v.Vector3,Dt=new v.Vector3;class Ft extends v.Object3D{constructor(e=new v.BufferGeometry,t=new v.LineBasicMaterial){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,s=[0];for(let i=1,r=t.count;i<r;i++)Vt.fromBufferAttribute(t,i-1),kt.fromBufferAttribute(t,i),s[i]=s[i-1],s[i]+=Vt.distanceTo(kt);e.setAttribute("lineDistance",new v.Float32BufferAttribute(s,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){const s=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,o=s.drawRange,a=s.morphAttributes.position;if(s.boundingSphere===null&&s.computeBoundingSphere(),Ye.copy(s.boundingSphere),Ye.applyMatrix4(i),Ye.radius+=r,e.ray.intersectsSphere(Ye)===!1)return;It.copy(i).invert(),at.copy(e.ray).applyMatrix4(It);const u=r/((this.scale.x+this.scale.y+this.scale.z)/3),f=u*u,l=new v.Vector3,c=new v.Vector3,d=new v.Vector3,h=new v.Vector3,p=this.isLineSegments?2:1;if(s.isBufferGeometry){const w=s.index,g=s.attributes.position;if(w!==null){const _=Math.max(0,o.start),A=Math.min(w.count,o.start+o.count);for(let N=_,I=A-1;N<I;N+=p){const D=w.getX(N),F=w.getX(N+1);if(Gt(l,c,this,g,a,D,F),at.distanceSqToSegment(l,c,h,d)>f)continue;h.applyMatrix4(this.matrixWorld);const G=e.ray.origin.distanceTo(h);G<e.near||G>e.far||t.push({distance:G,point:d.clone().applyMatrix4(this.matrixWorld),index:N,face:null,faceIndex:null,object:this})}}else{const _=Math.max(0,o.start),A=Math.min(g.count,o.start+o.count);for(let N=_,I=A-1;N<I;N+=p){if(Gt(l,c,this,g,a,N,N+1),at.distanceSqToSegment(l,c,h,d)>f)continue;h.applyMatrix4(this.matrixWorld);const F=e.ray.origin.distanceTo(h);F<e.near||F>e.far||t.push({distance:F,point:d.clone().applyMatrix4(this.matrixWorld),index:N,face:null,faceIndex:null,object:this})}}}else s.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function Gt(n,e,t,s,i,r,o){n.fromBufferAttribute(s,r),e.fromBufferAttribute(s,o);var a=t.morphTargetInfluences;if(t.material.morphTargets&&i&&a){lt.set(0,0,0),ct.set(0,0,0);for(var u=0,f=i.length;u<f;u++){var l=a[u],c=i[u];l!==0&&(Rt.fromBufferAttribute(c,r),Dt.fromBufferAttribute(c,o),lt.addScaledVector(Rt.sub(n),l),ct.addScaledVector(Dt.sub(e),l))}n.add(lt),e.add(ct)}}Ft.prototype.isLine=!0;const jt=new v.Vector3,Et=new v.Vector3;class Xe extends Ft{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,s=[];for(let i=0,r=t.count;i<r;i+=2)jt.fromBufferAttribute(t,i),Et.fromBufferAttribute(t,i+1),s[i]=i===0?0:s[i-1],s[i+1]=s[i]+jt.distanceTo(Et);e.setAttribute("lineDistance",new v.Float32BufferAttribute(s,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}Xe.prototype.isLineSegments=!0;const Ei=function(n){this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=n,this.addLevel=(t,s)=>{if(t){const i=Math.abs(s);let r;for(r=0;r<this.levels.length&&!(i<this.levels[r].distance);r++);const o={distance:i,morph:t,loaded:!0,loading:!1,url:""};this.levels.splice(r,0,o),t.renderOrder=this._renderOrder}},this.levelLoaded=(t,s)=>{if(t){const i=Math.abs(s);for(let r=0;r<this.levels.length;r++)if(i===this.levels[r].distance){this._parent.group.add(t),this.levels[r].morph=t,this.levels[r].loaded=!0,this.levels[r].loading=!1;break}this.checkTransparentMesh()}},this.addLevelFromURL=(t,s,i,r,o)=>{this._loader=t;const a=this.calculateDistance(s),u={distance:a,morph:void 0,loaded:!1,loading:!1,url:i,index:r};let f;for(f=0;f<this.levels.length&&!(a<this.levels[f].distance);f++);this.levels.splice(f,0,u),o&&this.loadLevel(f)},this.loadLevel=t=>{const s=this.levels[t];return!s.morph&&!s.loaded&&!s.loading&&(s.loading=!0,this._loader.load(s.url,this.lodLoader(s.distance),void 0,void 0,{index:s.index})),s.morph===void 0},this.calculateDistance=function(t){this._parent.getBoundingBox();const s=this._parent.radius;let i=0;return t==="far"?i=s*4.5:t==="medium"?i=s*2.5:t==="close"&&(i=0),i},this.containsLevels=()=>!!(this.levels&&this.levels.length>1),this.checkTransparentMesh=()=>{const t=this.levels[this._currentLevel];this._material&&(this._material.transparent?(this._secondaryMaterial||(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=S.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,this._secondaryMaterial.emissive&&this._secondaryMaterial.emissive.copy(this._material.emissive),this._secondaryMaterial.needsUpdate=!0,t.secondaryMesh||(t.secondaryMesh=new S.Mesh(t.morph.geometry,this._secondaryMaterial),t.secondaryMesh.renderOrder=t.morph.renderOrder+1,t.secondaryMesh.userData=t.morph.userData,t.secondaryMesh.name=t.morph.name),this._material.side=S.BackSide,this._material.needsUpdate=!0,t.secondaryMesh.parent||(t.morph.add(t.secondaryMesh),this._parent.animationGroup&&this._parent.animationGroup.add(t.secondaryMesh))):(t.secondaryMesh&&(t.morph.remove(t.secondaryMesh),this._parent.animationGroup&&(this._parent.animationGroup.uncache(t.secondaryMesh),this._parent.animationGroup.remove(t.secondaryMesh))),this._material.side=S.DoubleSide,this._material.needsUpdate=!0))},this.dispose=()=>{this.levels.forEach(t=>{t.morph&&t.morph.geometry&&t.morph.geometry.dispose()}),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{const t=this.levels[this._currentLevel];return t&&t.morph?t.morph:this._parent.morph},this.lodLoader=function(t){return s=>{const i=this._material,r={localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour},o=Ze(s,r);let a;this._parent.isGeometry?a=new S.Mesh(o,i):this._parent.isLines&&(a=new Xe(o,i)),a.userData=this._parent,a.renderOrder=this._renderOrder,s.dispose(),this.levelLoaded(a,t)}},this.updateMorphColorAttribute=t=>{if(this._material&&(this._material.vertexColors==S.VertexColors||this._material.vertexColors==!0))if(t){const s=this.getCurrentMorph();Lt(s.geometry,s)}else this.levels.forEach(s=>{s.morph&&s.morph.geometry&&Lt(s.morph.geometry,s.morph)})},this.setColour=t=>{this._material.color=t,this._secondaryMaterial&&(this._secondaryMaterial.color=t),e()},this.setFrustumCulled=t=>{this.levels.forEach(s=>{s.morph&&(s.morph.frustumCulled=t),s.secondaryMesh&&(s.secondaryMesh.frustumCulled=t)})},this.setMaterial=t=>{t&&(!this._material||this._material.id!==t.id)&&(this._material=t,this._secondaryMaterial&&this._secondaryMaterial.dispose(),this._secondaryMaterial=t.clone(),this._secondaryMaterial.side=S.FrontSide,this._secondaryMaterial.transparent=!0,this.levels.forEach(s=>{s.morph&&(s.morph.material=this._material,s.morph.geometry&&(s.morph.geometry.colorsNeedUpdate=!0)),s.secondaryMesh&&(s.secondaryMesh.material=this._secondaryMaterial)}))},this.setName=t=>{this.levels.forEach(s=>{s.morph&&(s.morph.name=t),s.secondaryMesh&&(s.secondaryMesh.name=t)})},this.setRenderOrder=t=>{this._renderOrder=t,this.levels.forEach(s=>{s.morph&&(s.morph.renderOrder=t),s.secondaryMesh&&(s.secondaryMesh.renderOrder=t)})},this.setVertexColors=t=>{this._material.vertexColors=t,e(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=t)},this.update=(t,s)=>{const i=this.levels;if(i.length>1){const r=t.cameraObject.position.distanceTo(s);let o=-1,a=-1,u,f;for(u=0,f=i.length;u<f&&r>=i[u].distance;u++)i[u].morph?(o>-1&&i[o].morph&&(i[o].morph.visible=!1),o=u,i[u].morph.visible=!0,a=-1):a=u;for(a>-1&&this.loadLevel(a);u<f;u++)i[u].morph&&(o>-1?i[u].morph.visible=!1:(i[u].morph.visible=!0,o=u));this._currentLevel!=o&&(this._currentLevel=o,this.checkTransparentMesh())}},this.toggleMarker=(t,s)=>{this.levels.forEach(i=>{i.morph&&(s?i.morph.add(t):i.morph.remove(t))})};const e=()=>{this.levels.forEach(t=>{t.morph&&t.morph.geometry&&(t.morph.geometry.colorsNeedUpdate=!0)})}},zi="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'%20?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20width='365'%20height='560'%20viewBox='0%200%20365%20560'%20xml:space='preserve'%3e%3cdesc%3eCreated%20with%20Fabric.js%205.2.4%3c/desc%3e%3cdefs%3e%3c/defs%3e%3crect%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20fill='transparent'%3e%3c/rect%3e%3cg%20transform='matrix(0%200%200%200%200%200)'%20id='808ed283-2524-440f-88ae-3bdb47bb5749'%20%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%20182.5%20280)'%20id='db30413d-5bff-4b98-ab59-464497ee199e'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-182.5'%20y='-280'%20rx='0'%20ry='0'%20width='365'%20height='560'%20/%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0.99%200%200%200.99%20182.5%20280)'%20%3e%3cg%20style=''%20vector-effect='non-scaling-stroke'%20%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-540'%20y='-540'%20rx='0'%20ry='0'%20width='1080'%20height='1080'%20/%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3cpath%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(0,89,116);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20transform='%20translate(-182.9,%20-279.85)'%20d='M%20182.9%20551.7%20C%20182.9%20551.8000000000001%20183.1%20552%20183.1%20552%20C%20183.1%20552%20358.3%20283%20358.3%20194.6%20C%20358.3%2064.5%20269.5%207.900000000000006%20182.9%207.699999999999989%20C%2096.3%207.9%207.5%2064.5%207.5%20194.6%20C%207.5%20283%20182.8%20552%20182.8%20552%20C%20182.8%20552%20182.9%20551.7%20182.9%20551.7%20z%20M%20122.2%20187.2%20C%20122.2%20153.6%20149.4%20126.39999999999999%20183%20126.39999999999999%20C%20216.6%20126.39999999999999%20243.8%20153.6%20243.8%20187.2%20C%20243.8%20220.79999999999998%20216.5%20248%20182.9%20248%20C%20149.4%20248%20122.2%20220.8%20122.2%20187.2%20z'%20stroke-linecap='round'%20/%3e%3c/g%3e%3cg%20transform='matrix(3.82%200%200%203.82%200%20-100.77)'%20%3e%3ccircle%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20cx='0'%20cy='0'%20r='35'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",zt=new Image(128,128);zt.src=zi;const Je=new S.Texture;Je.image=zt,Je.needsUpdate=!0;const ht=[.02,.03,1],Wi=new S.SpriteMaterial({map:Je,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),Wt=function(n){Object.getPrototypeOf(this)!==Y.prototype&&Object.setPrototypeOf(Wt.prototype,Y.prototype),Y.call(this),this.texture=Je;let e,t,s,i,r,o=!0;this.morph=new S.Group,this.group=this.morph,this.parent=n,this.isMarker=!0;let a=!1;this.ndc=new S.Vector3;let u,f,l=()=>{e=new S.Sprite(Wi),e.center.set(.5,0),this.morph.add(e),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,e.scale.set(ht[0],ht[1],ht[2]),e.userData=this};this.updateVisual=(c,d)=>{let h=1,p=0;c!==d&&(p=1-(this.ndc.z-c)/(d-c),h=.6+p*.4),this.setSpriteSize(h)},this.updateNDC=c=>(this.ndc.copy(this.morph.position),this.ndc.project(c),this.ndc.z=Math.min(Math.max(this.ndc.z,0),1),this.ndc),this.setPosition=(c,d,h)=>{this.morph.position.set(c,d,h)},this.setSpriteSize=c=>{e.scale.set(.015,.02,1),e.scale.multiplyScalar(c)},this.setUserSprite=()=>{i&&(this.morph.add(i),o&&(this.morph.remove(e),f&&this.morph.remove(f),o=!1))},this.setImageForUserSprite=(c,d)=>{i&&(this.morph.remove(i),i=void 0),t&&t.dispose(),s&&s.dispose(),t=new S.Texture,t.image=c,t.needsUpdate=!0,s=new S.SpriteMaterial({map:t,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),d||(d=[.05,.05,1]),i=new S.Sprite(s),i.center.set(.5,0),i.scale.set(d[0],d[1],d[2]),i.userData=this,this.setUserSprite()},this.setDefaultSprite=()=>{o||(o=!0,this.morph.add(e),i&&this.morph.remove(i),f&&this.morph.add(f))},this.loadUserSprite=(c,d)=>{if(c)if(c!==r){r=c;const h=new Image(128,128);h.crossOrigin="anonymous",h.onload=()=>{this.setImageForUserSprite(h,d)},h.src=c}else this.setUserSprite()},this.dispose=()=>{this.morph&&this.morph.clear(),e&&(e.clear(),e=void 0),f&&(f.material.map.dispose(),f.material.dispose(),f=void 0)},this.isEnabled=()=>a,this.setNumber=c=>{(!c||u!=c)&&f&&(this.morph.remove(f),f.material.map.dispose(),f.material.dispose(),f=void 0),!f&&c&&(f=ot(c,.012,"black","Asap",120,700),this.morph.add(f)),u=c},this.getNumber=()=>u||1,this.setVisibility=function(c){c!==this.visible&&(this.visible=c,this.group.visible=c,this.parent.region&&(this.parent.region.pickableUpdateRequired=!0))},this.enable=()=>{a=!0,this.morph.visible=!0,this.visible=!0},this.disable=()=>{a=!1,this.morph.visible=!1,this.visible=!1},l()};let qi=0;const Zi=function(){return"pr"+qi++},Y=function(){this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new S.Group,this._lod=new Ei(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.videoHandler=void 0,this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new S.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode="inherited",this.uuid=Zi(),this._v1=new S.Vector3,this._v2=new S.Vector3,this._b1=new S.Box3,this.center=new S.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1,this.isPickable=!0};Y.prototype.setDuration=function(n){this.duration=n,this.clipAction&&this.clipAction.setDuration(this.duration)},Y.prototype.getDuration=function(){return this.duration},Y.prototype.setRegion=function(n){this.region=n},Y.prototype.getRegion=function(){return this.region},Y.prototype.getMorph=function(){const n=this._lod.getCurrentMorph();return n||this.morph},Y.prototype.getGroup=function(){return this.group},Y.prototype.setMorph=function(n){this.morph=n,this.group.add(this.morph);const e=this._lod.calculateDistance("far");this._lod.addLevel(n,e),this._lod.setMaterial(n.material)},Y.prototype.checkTransparentMesh=function(){},Y.prototype.setMesh=function(n,e,t){this.animationGroup=new S.AnimationObjectGroup(n),this.mixer=new S.AnimationMixer(this.animationGroup);const s=n.geometry;if(this.geometry=n.geometry,this.clipAction=void 0,s&&s.morphAttributes){let i=s.morphAttributes.position;i||(i=s.morphAttributes.color?s.morphAttributes.color:s.morphAttributes.normal),i&&(this.animationClip=S.AnimationClip.CreateClipsFromMorphTargetSequences(i,10,!0),this.animationClip&&this.animationClip[0]!=null&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=S.loopOnce,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=e,this.morphColour=t,n.userData=this,n.matrixAutoUpdate=!1,this.setMorph(n),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(s.setAttribute("morphTarget0",s.getAttribute("position")),s.setAttribute("morphTarget1",s.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},Y.prototype.setIsPickable=function(n){this.isPickable!==n&&(this.isPickable=n,this.region&&(this.region.pickableUpdateRequired=!0))},Y.prototype.setAnatomicalId=function(n){this.anatomicalId=n},Y.prototype.setName=function(n){this.groupName=n,this._lod.setName(n)},Y.prototype.getCurrentTime=function(){if(this.clipAction){const n=this.clipAction.time/this.clipAction._clip.duration;return this.duration*n}else return this.inbuildTime},Y.prototype.setMorphTime=function(n){let e=!1;if(this.clipAction){const t=n/this.duration,s=this.clipAction._clip.duration;let i=t*s;i!=this.clipAction.time&&(this.clipAction.time=i,e=!0),e&&this.isTimeVarying()&&this.mixer.update(0)}else{let t=n;n>this.duration?t=this.duration:0>n?t=0:t=n,t!=this.inbuildTime&&(this.inbuildTime=t,e=!0)}e&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},Y.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},Y.prototype.getVisibility=function(){return this.visible},Y.prototype.setVisibility=function(n){n!==this.visible&&(this.visible=n,this.group.visible=n,this.region&&(this.region.pickableUpdateRequired=!0))},Y.prototype.setAlpha=function(n){const e=this._lod._material;let t=!1;n<1&&(t=!0),e.opacity=n,e.transparent=t,this.checkTransparentMesh()},Y.prototype.setFrustumCulled=function(n){this._lod.setFrustumCulled(n)},Y.prototype.setVertexColors=function(n){this._lod.setVertexColors(n)},Y.prototype.getColour=function(){if(this._lod._material)return this._lod._material.color},Y.prototype.setColour=function(n){this._lod.setColour(n)},Y.prototype.setGreyScale=function(n){if(n){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour(new S.Color().setHex(12303291)),!0}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},Y.prototype.getColourHex=function(){if(!this.morphColour&&this._lod._material&&this._lod._material.color)return this._lod._material.color.getHexString()},Y.prototype.setColourHex=function(n){this._lod._material.color.setHex(n),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(n)},Y.prototype.setEmissiveRGB=function(n){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...n),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...n)},Y.prototype.setMaterial=function(n){this._lod.setMaterial(n)},Y.prototype.getClosestVertexIndex=function(){let n=-1;const e=this.getMorph();if(e&&e.geometry){let t=e.geometry.attributes.position;if(t){this._b1.setFromBufferAttribute(t),this._b1.getCenter(this._v1);let s=-1,i=0;for(let r=0;r<t.count;r++)this._v2.fromArray(t.array,r*3),i=this._v2.distanceTo(this._v1),s==-1?s=i:s>i&&(s=i,n=r)}}return n},Y.prototype.getClosestVertex=function(n){let e=new S.Vector3;this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex());const t=this.getMorph();if(t&&t.geometry&&this.closestVertexIndex>=0){let s=t.morphTargetInfluences,i=t.geometry.morphAttributes;if(s&&i&&i.position){let r=!1;for(let o=0;o<s.length;o++)s[o]>0&&(r=!0,this._v1.fromArray(i.position[o].array,this.closestVertexIndex*3),e.add(this._v1.multiplyScalar(s[o])));if(r)return n?e.applyMatrix4(t.matrixWorld):e}else return e.fromArray(t.geometry.attributes.position.array,this.closestVertexIndex*3),n?e.applyMatrix4(t.matrixWorld):e}return this.getBoundingBox(),e.copy(this.center),e},Y.prototype.getBoundingBox=function(){if(this.visible){let n=this._lod.getCurrentMorph();if(n&&n.visible)return this.boundingBoxUpdateRequired&&(Ii(n,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),this.boundingBoxUpdateRequired=!1),this.cachedBoundingBox}},Y.prototype.dispose=function(){this._lod.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.group=void 0,this.clipAction=void 0,this.groupName=void 0},Y.prototype.markerIsRequired=function(n){return!!(this.visible&&(this.markerMode==="on"||n&&n.displayMarkers&&this.markerMode==="inherited"))},Y.prototype.updateMarker=function(n,e){if(n==!1&&this.markerIsRequired(e)){let t=e.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new Wt(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){let s=this.getClosestVertex(!1);s&&(this.marker.setPosition(s.x,s.y,s.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(e.markersList&&!(this.marker.uuid in e.markersList)&&(t=!0,e.markersList[this.marker.uuid]=this.marker),this.marker.enable(),this.group.add(this.marker.morph)),this.marker.setNumber(this.markerNumber),this.markerImgURL?this.marker.loadUserSprite(this.markerImgURL):this.marker.setDefaultSprite(),e&&e.camera&&(t||e.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(e.camera.cameraObject),e.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),e.markersList&&this.marker.uuid in e.markersList&&(e.markerCluster.markerUpdateRequired=!0,delete e.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},Y.prototype.processMarkerVisual=function(n,e){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(n,e)},Y.prototype.initiateMorphColor=function(){this.morphColour==1&&this._lod.updateMorphColorAttribute(!1)},Y.prototype.setRenderOrder=function(n){this._lod.setRenderOrder(n)},Y.prototype.getClosestVertexDOMElementCoords=function(n){if(n&&n.camera){let e=!0;const t=this.getClosestVertex(!0);return t.project(n.camera),t.z=Math.min(Math.max(t.z,0),1),(t.x>1||t.x<-1||t.y>1||t.y<-1)&&(e=!1),n.getZincCameraControls().getRelativeCoordsFromNDC(t.x,t.y,t),{position:t,inView:e}}else return},Y.prototype.setMarkerMode=function(n,e){n!==this.markerMode&&(n==="on"||n==="off"?this.markerMode=n:this.markerMode="inherited",this.region&&(this.region.pickableUpdateRequired=!0)),e&&(this.markerNumber=e.number,this.markerImgURL=e.imgURL)},Y.prototype.render=function(n,e,t,s){if(this.visible&&!(this.timeEnabled&&e)&&this._lod.update(t,this.center),e==!0){if(this.clipAction&&this.isTimeVarying())this.mixer.update(n);else{let i=this.inbuildTime+n;i>this.duration&&(i=i-this.duration),this.inbuildTime=i}this.visible&&n!=0&&(this.boundingBoxUpdateRequired=!0,this.morphColour==1&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(e,s)},Y.prototype.addLOD=function(n,e,t,s,i){this._lod.addLevelFromURL(n,e,t,s,i)},Y.prototype.addVertices=function(n){let e=this.getMorph(),t;if(!e)t=nt(500,n),this.drawRange=n.length;else if(this.drawRange>-1){const s=e.geometry.getAttribute("position");n.forEach(i=>{s.setXYZ(this.drawRange,i[0],i[1],i[2]),++this.drawRange}),s.needsUpdate=!0,e.geometry.setDrawRange(0,this.drawRange),e.geometry.computeBoundingBox(),e.geometry.computeBoundingSphere(),t=e.geoemtry,this.boundingBoxUpdateRequired=!0}return t},Y.prototype.deleteVertices=function(n){let e=this.getMorph();return e!=null&&e.geometry&&this.drawRange>=n&&ji(e.geometry,n)?(--this.drawRange,e.geometry.setDrawRange(0,this.drawRange),e.geometry.computeBoundingBox(),e.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0,!0):!1},Y.prototype.setPosition=function(n,e,t){const s=this.getGroup();s&&(s.position.set(n,e,t),s.matrixWorldNeedsUpdate=!0,s.updateMatrix(),s.updateWorldMatrix(!0,!0),this.boundingBoxUpdateRequired=!0)},Y.prototype.loadAdditionalSources=function(n,e){n.load(ye(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},Y.prototype.setScaleAll=function(n){const e=this.getGroup();e&&(e.scale.set(n,n,n),e.updateMatrix(),this.boundingBoxUpdateRequired=!0)};const Yi=(n,e,t)=>{let s=Ze(n,t),i=!1;1>t.opacity&&(i=!0);let r;if(s._video===void 0){const o=t.localTimeEnabled||t.localMorphColour;e?(r=e,r.morphTargets=o,r.morphNormals=t.localTimeEnabled):s instanceof S.BufferGeometry&&s.attributes.color===void 0?r=new S.MeshPhongMaterial({color:t.colour,morphTargets:o,morphNormals:t.localTimeEnabled,transparent:i,opacity:t.opacity,side:S.DoubleSide}):r=new S.MeshPhongMaterial({color:t.colour,morphTargets:o,morphNormals:t.localTimeEnabled,vertexColors:S.VertexColors,transparent:i,opacity:t.opacity,side:S.DoubleSide}),t.localMorphColour&&s.morphAttributes.color&&(r.onBeforeCompile=Pt())}else{let o=s._video.createCanvasVideoTexture();r=new S.MeshBasicMaterial({morphTargets:t.localTimeEnabled,color:new S.Color(1,1,1),transparent:i,opacity:t.opacity,map:o,side:S.DoubleSide}),(void 0).videoHandler=s._video}return new S.Mesh(s,r)},Fe=function(){Y.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(n,e,t)=>{if(this.morph&&this.morph.geometry&&n!=null)return;const s=Yi(n,e,t);this.setMesh(s,t.localTimeEnabled,t.localMorphColour)},this.calculateUVs=()=>{this.geometry.computeBoundingBox();const n=this.geometry.boundingBox.max,e=this.geometry.boundingBox.min,t=new S.Vector2(0-e.x,0-e.y),s=new S.Vector2(n.x-e.x,n.y-e.y);this.geometry.faceVertexUvs[0]=[];for(let i=0;i<this.geometry.faces.length;i++){const r=this.geometry.vertices[this.geometry.faces[i].a],o=this.geometry.vertices[this.geometry.faces[i].b],a=this.geometry.vertices[this.geometry.faces[i].c];geometry.faceVertexUvs[0].push([new S.Vector2((r.x+t.x)/s.x,(r.y+t.y)/s.y),new S.Vector2((o.x+t.x)/s.x,(o.y+t.y)/s.y),new S.Vector2((a.x+t.x)/s.x,(a.y+t.y)/s.y)])}geometry.uvsNeedUpdate=!0},this.checkTransparentMesh=function(){this._lod.checkTransparentMesh()},this.setWireframe=n=>{this.morph.material.wireframe=n},this.editVertices=function(n,e){if(n&&n.length){let t=this.getMorph();const s=t.geometry.getAttribute("position");if(!t||0>e)return;{let i=e*3;n.forEach(r=>{s.array[i++]=r[0],s.array[i++]=r[1],s.array[i++]=r[2]}),s.needsUpdate=!0,t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}}};Fe.prototype=Object.create(Y.prototype);const qt=Oe.default||Oe,ut=function(n,e){let t=n,s,i=500;e?s=new qt(t,.012,e.getStyle()):s=new qt(t,.012),s.fontFace="Asap",s.fontWeight=i,s.material.map.generateMipmaps=!1,s.material.sizeAttenuation=!1,s.center.x=-.05,s.center.y=0;const r=[s.scale.x,s.scale.y];this.getPosition=()=>s?[s.position.x,s.position.y,s.position.z]:[0,0,0],this.setPosition=(o,a,u)=>{s&&s.position.set(o,a,u)},this.setColour=o=>{o&&(s.color=o.getStyle())},this.setScale=o=>{s&&o>0&&s.scale.set(o,o,1)},this.setDepthTest=o=>{o&&o!==s.material.depthTest&&(s.material.depthTest=o)},this.setSize=o=>{o>0&&(s.scale.x=r[0]*o,s.scale.y=r[1]*o)},this.setFontWeight=o=>{o&&o!==i&&(s.fontWeight=o,i=o)},this.setText=o=>{o&&o!==s.text&&(s.text=o,t=o)},this.setVisibility=o=>{s.visible=o},this.dispose=()=>{},this.getSprite=()=>s,this.getString=()=>t},Ke=function(n,e,t,s){Y.call(this);let i;e&&(i=e.clone(),i.vertexColors=S.FaceColors);const r=s;this.id=t;let o,a;this.isGlyph=!0;let u=[0,0,0];this.fromMesh=f=>f&&f.isMesh?(this.morph=f.clone(),this.morph.userData=this,this.group.add(this.morph),!0):!1,n&&i&&this.fromMesh(new S.Mesh(n,i)),this.getGlyphset=function(){return r},this.setLabel=f=>{f&&(typeof f=="string"||f instanceof String)&&(a=f,this.morph&&(this.morph.name=f))},this.showLabel=f=>{if(o&&(u=o.getPosition(),this.group.remove(o.getSprite()),o.dispose(),o=void 0),a&&(typeof a=="string"||a instanceof String)){o=new ut(a,f),o.setPosition(u[0],u[1],u[2]);const l=o.getSprite();l.material.alphaTest=.5,l.material.transparent=!0,l.material.depthWrite=!1,this.group.add(o.getSprite())}},this.hideLabel=()=>{o&&(u=o.getPosition(),this.group.remove(o.getSprite()),o.dispose(),o=void 0)},this.getLabel=()=>a,this.getMesh=()=>this.morph,this.setTransformation=(f,l,c,d)=>{this.morph&&(this.morph.matrix.elements[0]=l[0],this.morph.matrix.elements[1]=l[1],this.morph.matrix.elements[2]=l[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=c[0],this.morph.matrix.elements[5]=c[1],this.morph.matrix.elements[6]=c[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=d[0],this.morph.matrix.elements[9]=d[1],this.morph.matrix.elements[10]=d[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=f[0],this.morph.matrix.elements[13]=f[1],this.morph.matrix.elements[14]=f[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),u=[...f],o&&o.setPosition(f[0],f[1],f[2])},this.setColour=f=>{o&&o.setColour(f),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry&&(this.geometry.colorsNeedUpdate=!0)},this.dispose=()=>{this.material&&this.material.dispose(),this.morph=void 0}};Ke.prototype=Object.create(Y.prototype);function $e(){}$e.Handlers={handlers:[],add:function(n,e){this.handlers.push(n,e)},get:function(n){for(var e=this.handlers,t=0,s=e.length;t<s;t+=2){var i=e[t],r=e[t+1];if(i.test(n))return r}return null}},Object.assign($e.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(n,e,t){for(var s=[],i=0;i<n.length;++i)s[i]=this.createMaterial(n[i],e,t);return s},createMaterial:function(){var n={NoBlending:v.NoBlending,NormalBlending:v.NormalBlending,AdditiveBlending:v.AdditiveBlending,SubtractiveBlending:v.SubtractiveBlending,MultiplyBlending:v.MultiplyBlending,CustomBlending:v.CustomBlending},e=new v.Color,t=new v.TextureLoader,s=new v.MaterialLoader;return function(r,o,a){var u={};function f(h,p,w,y,g){var _=o+h,A=$e.Handlers.get(_),N;A!==null?N=A.load(_):(t.setCrossOrigin(a),N=t.load(_)),p!==void 0&&(N.repeat.fromArray(p),p[0]!==1&&(N.wrapS=v.RepeatWrapping),p[1]!==1&&(N.wrapT=v.RepeatWrapping)),w!==void 0&&N.offset.fromArray(w),y!==void 0&&(y[0]==="repeat"&&(N.wrapS=v.RepeatWrapping),y[0]==="mirror"&&(N.wrapS=v.MirroredRepeatWrapping),y[1]==="repeat"&&(N.wrapT=v.RepeatWrapping),y[1]==="mirror"&&(N.wrapT=v.MirroredRepeatWrapping)),g!==void 0&&(N.anisotropy=g);var I=v.MathUtils.generateUUID();return u[I]=N,I}var l={uuid:v.MathUtils.generateUUID(),type:"MeshLambertMaterial"};for(var c in r){var d=r[c];switch(c){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":l.name=d;break;case"blending":l.blending=n[d];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",c,"is no longer supported.");break;case"colorDiffuse":l.color=e.fromArray(d).getHex();break;case"colorSpecular":l.specular=e.fromArray(d).getHex();break;case"colorEmissive":l.emissive=e.fromArray(d).getHex();break;case"specularCoef":l.shininess=d;break;case"shading":d.toLowerCase()==="basic"&&(l.type="MeshBasicMaterial"),d.toLowerCase()==="phong"&&(l.type="MeshPhongMaterial"),d.toLowerCase()==="standard"&&(l.type="MeshStandardMaterial");break;case"mapDiffuse":l.map=f(d,r.mapDiffuseRepeat,r.mapDiffuseOffset,r.mapDiffuseWrap,r.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":l.emissiveMap=f(d,r.mapEmissiveRepeat,r.mapEmissiveOffset,r.mapEmissiveWrap,r.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":l.lightMap=f(d,r.mapLightRepeat,r.mapLightOffset,r.mapLightWrap,r.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":l.aoMap=f(d,r.mapAORepeat,r.mapAOOffset,r.mapAOWrap,r.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":l.bumpMap=f(d,r.mapBumpRepeat,r.mapBumpOffset,r.mapBumpWrap,r.mapBumpAnisotropy);break;case"mapBumpScale":l.bumpScale=d;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":l.normalMap=f(d,r.mapNormalRepeat,r.mapNormalOffset,r.mapNormalWrap,r.mapNormalAnisotropy);break;case"mapNormalFactor":l.normalScale=d;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":l.specularMap=f(d,r.mapSpecularRepeat,r.mapSpecularOffset,r.mapSpecularWrap,r.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":l.metalnessMap=f(d,r.mapMetalnessRepeat,r.mapMetalnessOffset,r.mapMetalnessWrap,r.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":l.roughnessMap=f(d,r.mapRoughnessRepeat,r.mapRoughnessOffset,r.mapRoughnessWrap,r.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":l.alphaMap=f(d,r.mapAlphaRepeat,r.mapAlphaOffset,r.mapAlphaWrap,r.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":l.side=v.BackSide;break;case"doubleSided":l.side=v.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),l.opacity=d;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":l[c]=d;break;case"vertexColors":d===!0&&(l.vertexColors=v.VertexColors),d==="face"&&(l.vertexColors=v.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",c,d);break}}return l.type==="MeshBasicMaterial"&&delete l.emissive,l.type!=="MeshPhongMaterial"&&delete l.specular,l.opacity<1&&(l.transparent=!0),s.setTextures(u),s.parse(l)}}()});const Xi=function(n){var e=this;this.video=void 0,this.videoTexture=void 0;var t=n,s=function(){document&&(e.video=document.createElement("video"),e.video.crossOrigin="anonymous",e.video.src=t,e.video.load(),e.video.loop=!0)};this.setMorphTime=function(i,r){var o=i/r*e.video.duration;e.video.currentTime=o},this.getVideoDuration=function(){return e.video.duration},this.createCanvasVideoTexture=function(){return e.videoTexture=new S.VideoTexture(e.video),e.videoTexture.minFilter=S.LinearFilter,e.videoTexture.magFilter=S.LinearFilter,e.videoTexture.format=S.RGBFormat,e.video.currentTime=0,e.videoTexture},this.getCurrentTime=function(i){return e.video?i*(e.video.currentTime/e.video.duration):0},this.isReadyToPlay=function(){return!!(e.video&&e.video.readyState>=3)},s()},Zt=S.AnimationClip,dt=S.Color,Ji=S.DefaultLoadingManager,Ki=S.FileLoader,$i=S.LoaderUtils,Yt=S.Vector2,Ge=S.Vector3,Xt=S.Vector4;function Qe(n){typeof n=="boolean"&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),n=void 0),this.manager=n!==void 0?n:Ji,this.withCredentials=!1,this.paramsString=""}Object.assign(Qe.prototype,{load:function(n,e,t,s){var i=this,r=this.texturePath&&typeof this.texturePath=="string"?this.texturePath:$i.extractUrlBase(n),o=new Ki(this.manager);n.split("?"),n.length===2?this.paramsString=paramsStrings[1]:this.paramsString="",o.setWithCredentials(this.withCredentials),o.load(n,function(a){var u=void 0;try{u=JSON.parse(a)}catch{if(console.error("The loader has encountered an error while parsing the content of a resource."),s){s({responseURL:n});return}}var f=u.metadata;if(f!==void 0){var l=f.type;if(l!==void 0&&l.toLowerCase()==="object"){console.error("THREE.JSONLoader: "+n+" should be loaded with THREE.ObjectLoader instead.");return}}if(i&&i.parse)try{var c=i.parse(u,r);e(c.geometry,c.materials)}catch(d){if(console.error("The loader has encountered aon loading the geometry"),console.error(d),s){s({responseURL:n});return}}},t,s)},setTexturePath:function(n){this.texturePath=n},parse:function(){function n(i,r){function o(Z,E){return Z&1<<E}var a,u,f,l,c,d,h,p,w,y,g,_,A,N,I,D,F,q,G,T,C,U,M,O,k,P,m,L=i.faces,b=i.vertices,B=i.normals,V=i.colors,R=i.scale,z=0;if(i.uvs!==void 0){for(a=0;a<i.uvs.length;a++)i.uvs[a].length&&z++;for(a=0;a<z;a++)r.faceVertexUvs[a]=[]}for(l=0,c=b.length;l<c;)q=new Ge,q.x=b[l++]*R,q.y=b[l++]*R,q.z=b[l++]*R,r.vertices.push(q);if(l=0,c=L.length,i.uvs)for(a=0;a<i.uvs.length;a++){r.uvs[a]=[];for(let Z=0;Z<i.uvs[a].length;Z++)r.uvs[a][Z]=i.uvs[a][Z]}if(B)for(a=0;a<B.length;a++)r.normals[a]=B[a];if(V)for(a=0;a<V.length;a++)r.colors[a]=V[a];for(;l<c;)if(y=L[l++],g=o(y,0),_=o(y,1),A=o(y,3),N=o(y,4),I=o(y,5),D=o(y,6),F=o(y,7),g){if(T=new De,T.a=L[l],T.b=L[l+1],T.c=L[l+3],C=new De,C.a=L[l+1],C.b=L[l+2],C.c=L[l+3],l+=4,_&&(w=L[l++],T.materialIndex=w,C.materialIndex=w),f=r.faces.length,A)for(a=0;a<z;a++)for(O=i.uvs[a],r.faceVertexUvs[a][f]=[],r.faceVertexUvs[a][f+1]=[],u=0;u<4;u++)p=L[l++],P=O[p*2],m=O[p*2+1],k=new Yt(P,m),u!==2&&r.faceVertexUvs[a][f].push(k),u!==0&&r.faceVertexUvs[a][f+1].push(k);if(N&&(h=L[l++]*3,T.normal.set(B[h++],B[h++],B[h]),C.normal.copy(T.normal)),I)for(a=0;a<4;a++)h=L[l++]*3,M=new Ge(B[h++],B[h++],B[h]),a!==2&&T.vertexNormals.push(M),a!==0&&C.vertexNormals.push(M);if(D&&(d=L[l++],U=V[d],T.color.setHex(U),C.color.setHex(U)),F)for(a=0;a<4;a++)d=L[l++],U=V[d],a!==2&&T.vertexColors.push(new dt(U)),a!==0&&C.vertexColors.push(new dt(U));r.faces.push(T),r.faces.push(C)}else{if(G=new De,G.a=L[l++],G.b=L[l++],G.c=L[l++],G.b||(G.b=G.a),G.c||(G.c=G.b),_&&(w=L[l++],G.materialIndex=w),f=r.faces.length,A)for(a=0;a<z;a++)for(O=i.uvs[a],r.faceVertexUvs[a][f]=[],u=0;u<3;u++)p=L[l++],P=O[p*2],m=O[p*2+1],k=new Yt(P,m),r.faceVertexUvs[a][f].push(k);if(N&&(h=L[l++]*3,G.normal.set(B[h++],B[h++],B[h])),I)for(a=0;a<3;a++)h=L[l++]*3,M=new Ge(B[h++],B[h++],B[h]),G.vertexNormals.push(M);if(D&&(d=L[l++],G.color.setHex(V[d])),F)for(a=0;a<3;a++)d=L[l++],G.vertexColors.push(new dt(V[d]));r.faces.push(G)}}function e(i,r){var o=i.influencesPerVertex!==void 0?i.influencesPerVertex:2;if(i.skinWeights)for(var a=0,u=i.skinWeights.length;a<u;a+=o){var f=i.skinWeights[a],l=o>1?i.skinWeights[a+1]:0,c=o>2?i.skinWeights[a+2]:0,d=o>3?i.skinWeights[a+3]:0;r.skinWeights.push(new Xt(f,l,c,d))}if(i.skinIndices)for(var a=0,u=i.skinIndices.length;a<u;a+=o){var h=i.skinIndices[a],p=o>1?i.skinIndices[a+1]:0,w=o>2?i.skinIndices[a+2]:0,y=o>3?i.skinIndices[a+3]:0;r.skinIndices.push(new Xt(h,p,w,y))}r.bones=i.bones,r.bones&&r.bones.length>0&&(r.skinWeights.length!==r.skinIndices.length||r.skinIndices.length!==r.vertices.length)&&console.warn("When skinning, number of vertices ("+r.vertices.length+"), skinIndices ("+r.skinIndices.length+"), and skinWeights ("+r.skinWeights.length+") should match.")}function t(i,r){var o=i.scale;if(i.morphTargets!==void 0)for(var a=0,u=i.morphTargets.length;a<u;a++){r.morphTargets[a]={},r.morphTargets[a].name=i.morphTargets[a].name,r.morphTargets[a].vertices=[];for(var f=r.morphTargets[a].vertices,l=i.morphTargets[a].vertices,c=0,d=l.length;c<d;c+=3){var h=new Ge;h.x=l[c]*o,h.y=l[c+1]*o,h.z=l[c+2]*o,f.push(h)}}if(i.morphNormals!==void 0){for(var a=0,u=i.morphNormals.length;a<u;a++)if(r.morphTargets[a]){r.morphTargets[a].normals=[];for(var p=r.morphTargets[a].normals,w=i.morphNormals[a].normals,c=0,d=w.length;c<d;c+=3){var y=new Ge;y.x=w[c],y.y=w[c+1],y.z=w[c+2],p.push(y)}r.morphNormalsReady=!0}}if(i.morphColors!==void 0){var a,u,g,_,A,N,I;for(a=0,u=i.morphColors.length;a<u;a++)for(r.morphColors[a]={},r.morphColors[a].name=i.morphColors[a].name,r.morphColors[a].colors=[],A=r.morphColors[a].colors,N=i.morphColors[a].colors,g=0,_=N.length;g<_;g+=3)I=new S.Color(16755200),I.setRGB(N[g],N[g+1],N[g+2]),A.push(I)}}function s(i,r){var o=[],a=[];i.animation!==void 0&&a.push(i.animation),i.animations!==void 0&&(i.animations.length?a=a.concat(i.animations):a.push(i.animations));for(var u=0;u<a.length;u++){var f=Zt.parseAnimation(a[u],r.bones);f&&o.push(f)}if(r.morphTargets){var l=Zt.CreateClipsFromMorphTargetSequences(r.morphTargets,10);o=o.concat(l)}o.length>0&&(r.animations=o)}return function(r,o){r.data!==void 0&&(r=r.data),r.scale!==void 0?r.scale=1/r.scale:r.scale=1;var a=new Be;if(a.morphColors=[],n(r,a),e(r,a),t(r,a),s(r,a),a.computeFaceNormals(),a.computeBoundingSphere(),r.materials===void 0||r.materials.length===0)return{geometry:a};var u=$e.prototype.initMaterials(r.materials,o,"Anonymous");if(r.materials[0].video){var f=o+r.materials[0].video;this.paramsString&&(f=f+`?${this.paramsString}`);const l=new Xi(f);a._video=l}return u&&u.length>0&&(r.materials[0].singleSided?u[0].side=S.FrontSide:r.materials[0].flipSided?u[0].side=S.BackSide:u[0].side=S.DoubleSide,r.materials[0].specularCoef&&(u[0].shininess=Math.floor(r.materials[0].specularCoef/3))),{geometry:a,materials:u}}}()});const ft=function(){Y.call(this);const n=[];let e,t,s,i,r,o,a,u=0,f=0,l=[0,0,0],c=[0,0,0],d=[0,0,0],h="NONE";this.ready=!1;let p=!1,w=!1;this.isGlyphset=!0;let y=new S.Matrix4;const g=new S.Color,_=new S.Color,A=new S.Box3,N=new S.Box3,I=new S.Box3,D=[],F=[],q=[],G=[],T=[],C=[],U=[];this.globalScale=1;for(let b=0;b<8;b++)new S.Vector3;this.load=(b,B,V,R,z)=>{e=b.axis1,t=b.axis2,s=b.axis3,i=b.positions,r=b.scale,o=b.colors,a=b.label,p=b.metadata.MorphColours,w=b.metadata.MorphVertices,u=b.metadata.number_of_time_steps,h=b.metadata.repeat_mode,f=b.metadata.number_of_vertices,h=="AXES_2D"||h=="MIRROR"?f=f*2:h=="AXES_3D"&&(f=f*3),l=b.metadata.base_size,c=b.metadata.offset,d=b.metadata.scale_factors;const Z=new Qe;this.geometry=new S.BufferGeometry;const E=new S.InstancedMesh(this.geometry,void 0,f);if(this.setMorph(E),R){var $=Z.parse(B);L(V,z)($.geometry,$.materials),$.geometry.dispose()}else Z.crossOrigin="Anonymous",Z.load(B,L(V,z))};const M=(b,B,V,R,z,Z)=>{if(h=="NONE"||h=="MIRROR"){let K=[0,0,0],ee=[0,0,0],re=[0,0,0],Q=[0,0,0],ue=[0,0,0];const ne=[0,0,0],te=[0,0,0],J=[0,0,0],ie=[0,0,0];for(var E=0;E<3;E++){var $=z[E]<0?-1:1;K[E]=($*l[E]+z[E]*d[E])*this.globalScale}for(var E=0;E<3;E++)ee[E]=B[E]*K[0],re[E]=V[E]*K[1],Q[E]=R[E]*K[2],ue[E]=b[E]+c[0]*ee[E]+c[1]*re[E]+c[2]*Q[E],h=="MIRROR"&&(ne[E]=-ee[E],te[E]=-re[E],J[E]=-Q[E],ie[E]=ue[E],z[0]<0&&(ue[E]-=ee[E],ie[E]-=ne[E]));0>Q[0]*(ee[1]*re[2]-ee[2]*re[1])+Q[1]*(ee[2]*re[0]-ee[0]*re[2])+Q[2]*(ee[0]*re[1]-ee[1]*re[0])&&(Q[0]=-Q[0],Q[1]=-Q[1],Q[2]=-Q[2]),Z[0]=[ue,ee,re,Q],h=="MIRROR"&&(0>J[0]*(ne[1]*te[2]-ne[2]*te[1])+J[1]*(ne[2]*te[0]-ne[0]*te[2])+J[2]*(ne[0]*te[1]-ne[1]*te[0])&&(J[0]=-J[0],J[1]=-J[1],J[2]=-J[2]),Z[1]=[ie,ne,te,J])}else if(h=="AXES_2D"||h=="AXES_3D"){let K=[0,0,0],ee=[0,0,0];for(var E=0;E<3;E++){var $=z[E]<0?-1:1;K[E]=($*l[0]+z[E]*d[0])*this.globalScale}for(var E=0;E<3;E++)ee[E]=b[E]+c[0]*K[0]*B[E]+c[1]*K[1]*V[E]+c[2]*K[2]*R[E];const re=glyph_repeat_mode=="AXES_2D"?2:3;for(let Q=0;Q<re;Q++){let ue,ne;const te=z[Q];let J=[0,0,0],ie=[0,0,0],ae=[0,0,0];Q==0?(ue=B,ne=V):Q==1?(ue=V,ne=glyph_repeat_mode=="AXES_2D"?B:R):(ue=R,ne=B);const Le=(l[0]+te*d[0])*this.globalScale;J[0]=ue[0]*Le,J[1]=ue[1]*Le,J[2]=ue[2]*Le,ae[0]=J[1]*ne[2]-ne[1]*J[2],ae[1]=J[2]*ne[0]-ne[2]*J[0],ae[2]=J[0]*ne[1]-J[1]*ne[0];let oe=Math.sqrt(ae[0]*ae[0]+ae[1]*ae[1]+ae[2]*ae[2]);if(0<oe){let Ne=(l[2]+te*d[2])*this.globalScale/oe;h=="AXES_2D"&&Q>0&&(Ne*=-1),ae[0]*=Ne,ae[1]*=Ne,ae[2]*=Ne}if(ie[0]=ae[1]*J[2]-J[1]*ae[2],ie[1]=ae[2]*J[0]-J[2]*ae[0],ie[2]=ae[0]*J[1]-ae[1]*J[0],oe=Math.sqrt(ie[0]*ie[0]+ie[1]*ie[1]+ie[2]*ie[2]),0<oe){var H=(l[1]+te*d[1])*this.globalScale/oe;ie[0]*=H,ie[1]*=H,ie[2]*=H}Z[Q]=[ee,J,ie,ae]}}return Z},O=(b,B,V,R,z)=>{let Z=1;h=="AXES_2D"||h=="MIRROR"?Z=2:h=="AXES_3D"&&(Z=3);const E=b.length/3;let $=0;U.length=Z;for(let H=0;H<E;H++){const K=H*3,ee=[b[K],b[K+1],b[K+2]],re=[B[K],B[K+1],B[K+2]],Q=[V[K],V[K+1],V[K+2]],ue=[R[K],R[K+1],R[K+2]],ne=[z[K],z[K+1],z[K+2]],te=M(ee,re,Q,ue,ne,U);if(te.length==Z)for(let J=0;J<Z;J++){y.elements[0]=te[J][1][0],y.elements[1]=te[J][1][1],y.elements[2]=te[J][1][2],y.elements[3]=0,y.elements[4]=te[J][2][0],y.elements[5]=te[J][2][1],y.elements[6]=te[J][2][2],y.elements[7]=0,y.elements[8]=te[J][3][0],y.elements[9]=te[J][3][1],y.elements[10]=te[J][3][2],y.elements[11]=0,y.elements[12]=te[J][0][0],y.elements[13]=te[J][0][1],y.elements[14]=te[J][0][2],y.elements[15]=1,this.morph.setMatrixAt($,y);const ie=n[$];ie&&ie.setTransformation(te[J][0],te[J][1],te[J][2],te[J][3]),$++}}this.morph.instanceMatrix.needsUpdate=!0},k=b=>{let B=1;h=="AXES_2D"||h=="MIRROR"?B=2:h=="AXES_3D"&&(B=3);const V=b.length;let R=0;for(let z=0;z<V;z++){const Z=b[z];for(let E=0;E<B;E++){g.setHex(Z),this.morph.setColorAt(R,g);const $=n[R];$&&$.setColour(g),R++}}this.morph.instanceColor.needsUpdate=!0},P=()=>{let b=D,B=F,V=q,R=G,z=T,Z=C;const E=this.inbuildTime/this.duration*(u-1),$=Math.floor(E),H=1-(E-$),K=Math.ceil(E);if(w){const ee=i[$.toString()],re=i[K.toString()],Q=e[$.toString()],ue=e[K.toString()],ne=t[$.toString()],te=t[K.toString()],J=s[$.toString()],ie=s[K.toString()],ae=r[$.toString()],Le=r[K.toString()];D.length=ee.length,F.length=ee.length,q.length=ee.length,G.length=ee.length,T.length=ee.length;for(let oe=0;oe<ee.length;oe++)b[oe]=H*ee[oe]+(1-H)*re[oe],B[oe]=H*Q[oe]+(1-H)*ue[oe],V[oe]=H*ne[oe]+(1-H)*te[oe],R[oe]=H*J[oe]+(1-H)*ie[oe],z[oe]=H*ae[oe]+(1-H)*Le[oe]}else b=i[0],B=e[0],V=t[0],R=s[0],z=r[0];if(O(b,B,V,R,z),this.boundingBoxUpdateRequired=!0,o!=null){if(p){const ee=o[$.toString()],re=o[K.toString()];Z.length=ee.length;for(let Q=0;Q<ee.length;Q++)g.setHex(ee[Q]),_.setHex(re[Q]),g.setRGB(g.r*H+_.r*(1-H),g.g*H+_.g*(1-H),g.b*H+_.b*(1-H)),Z[Q]=g.getHex()}else Z=o[0];k(Z)}};this.getLabel=b=>{if(a&&a.length>b)return a[b]},this.showLabel=()=>{for(let b=0;b<n.length;b++)n[b].showLabel(this.morph.material?this.morph.material.color:void 0)},this.hideLabel=()=>{for(let b=0;b<n.length;b++)n[b].hideLabel()};const m=b=>{for(let B=0;B<f;B++){const V=new Ke(void 0,void 0,B,this);let R=a?a[B]:void 0;R=R||this.groupName,R&&V.setLabel(R),u>0&&V.setFrustumCulled(!1),n[B]=V,this.morph.add(V.getGroup())}b&&this.showLabel(),O(i[0],e[0],t[0],s[0],r[0]),o!=null&&k(o[0]),this.ready=!0,this.boundingBoxUpdateRequired=!0};this.addCustomGlyph=b=>{b.isGlyph&&n.push(b),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(b,B)=>{if(b.isMesh){const V=new Ke(void 0,void 0,B,this);return V.fromMesh(b),n.push(V),this.morph.add(V.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,V}},this.forEachGlyph=b=>{for(let B=0;B<n.length;B++)b(n[B])};var L=(b,B)=>(V,R)=>{const z=V.toBufferGeometry();this.geometry.copy(z),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),z.dispose(),R&&R[0]&&(this.morph.material=R[0]),m(B),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),V.dispose(),b!=null&&typeof b=="function"&&b(this)};this.getClosestVertexIndex=function(){let b=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);let B=i[0];const V=B.length/3;let R=-1,z=0;for(let Z=0;Z<V;Z++){const E=Z*3;this._v2.set(B[E],B[E+1],B[E+2]),z=this._v1.distanceTo(this._v2),(R==-1||R>z)&&(R=z,b=Z)}}return b},this.getClosestVertex=function(){if(this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex()),this.closestVertexIndex>=0&&this.morph){let b=new S.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,y),b.setFromMatrixPosition(y),b}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){A.setFromBufferAttribute(this.morph.geometry.attributes.position);for(let b=0;b<f;b++)this.morph.getMatrixAt(b,y),N.copy(A).applyMatrix4(y),b==0?I.copy(N):I.union(N);if(I)this.cachedBoundingBox.copy(I),this.morph.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1;else return}return this.cachedBoundingBox}},this.setMorphTime=b=>{b>this.duration?this.inbuildTime=this.duration:0>b?this.inbuildTime=0:this.inbuildTime=b,(p||w)&&(P(),w&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!!((this.ready===!1||u>0)&&(p||w)),this.getCurrentTime=()=>this.inbuildTime,this.setScaleAll=function(b){this.globalScale=b,P()},this.dispose=()=>{for(let b=n.length-1;b>=0;b--)n[b].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),e=void 0,t=void 0,s=void 0,i=void 0,r=void 0,o=void 0,this.ready=!1,this.groupName=void 0},this.render=(b,B,V)=>{if(B==!0){let R=this.inbuildTime+b;R>this.duration&&(R=R-this.duration),this.inbuildTime=R,(p||w)&&P()}this.updateMarker(B,V)}};ft.prototype=Object.create(Y.prototype);const Jt=new v.Matrix4,pt=new v.Ray,He=new v.Sphere,je=new v.Vector3,mt=new v.Vector3,Kt=new v.Vector3;class gt extends v.Object3D{constructor(e=new v.BufferGeometry,t=new v.PointsMaterial){super(),this.type="Points",this.geometry=e,this.material=t,this.sizePerPixel=1,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const s=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,o=s.drawRange;if(s.boundingSphere===null&&s.computeBoundingSphere(),He.copy(s.boundingSphere),He.applyMatrix4(i),He.radius+=r,e.ray.intersectsSphere(He)===!1)return;Jt.copy(i).invert(),pt.copy(e.ray).applyMatrix4(Jt);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3)*this.material.size*this.sizePerPixel,u=a*a;if(s.isBufferGeometry){const f=s.index,c=s.attributes.position,d=s.morphAttributes.position;if(f!==null){const h=Math.max(0,o.start),p=Math.min(f.count,o.start+o.count);for(let w=h,y=p;w<y;w++){const g=f.getX(w);Qt(this,c,d,g),$t(je,g,u,i,e,t,this)}}else{const h=Math.max(0,o.start),p=Math.min(c.count,o.start+o.count);for(let w=h,y=p;w<y;w++)Qt(this,c,d,w),$t(je,w,u,i,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}gt.prototype.isPoints=!0;function $t(n,e,t,s,i,r,o){const a=pt.distanceSqToPoint(n);if(a<t){const u=new v.Vector3;pt.closestPointToPoint(n,u),u.applyMatrix4(s);const f=i.ray.origin.distanceTo(u);if(f<i.near||f>i.far)return;r.push({distance:f,distanceToRay:Math.sqrt(a),point:u,index:e,face:null,object:o})}}function Qt(n,e,t,s){je.fromBufferAttribute(e,s);const i=n.morphTargetInfluences;if(n.material.morphTargets&&t&&i){mt.set(0,0,0);for(var r=0,o=t.length;r<o;r++){const a=i[r],u=t[r];a!==0&&(Kt.fromBufferAttribute(u,s),mt.addScaledVector(Kt.sub(je),a))}je.add(mt)}}const Te=function(){Y.call(this),this.isPointset=!0;const n=[];let e=1,t=!1,s=500,i=!0;this.createMesh=(a,u,f)=>{if(a&&u){let l=Ze(a,f);const c=Ut();u.map=c;let d=new gt(l,u);this.setMesh(d,f.localTimeEnabled,f.localMorphColour)}};const r=(a,u,f,l)=>{if(f){const c=new S.Color(l),d=new ut(f,c);d.setPosition(u[0],u[1],u[2]);const h=d.getSprite();h.material.sizeAttenuation=!1,h.material.alphaTest=.5,h.material.transparent=!0,h.material.depthWrite=!1,h.material.depthTest=t,d.setFontWeight(s),d.setSize(e),d.setVisibility(i),this.group.add(h),n[a]=d}},o=a=>{const u=n[a];if(u){const f=u.getSprite();this.group.remove(f),u.dispose(),n.splice(a,1)}};this.addPoints=(a,u,f)=>{if(a&&a.length>0){let l=this.drawRange;l===-1&&(l=0);const c=this.addVertices(a);if(!this.getMorph()){let w=new S.PointsMaterial({alphaTest:.5,size:10,color:f,sizeAttenuation:!1});const y={localTimeEnabled:!1,localMorphColour:!1};c.colorsNeedUpdate=!0,this.createMesh(c,w,y)}let h=l+a.length,p=0;if(Array.isArray(u)&&u.length===a.length||typeof u=="string")for(n.length,l;l+p<h;){const w=typeof u=="string"?u:u[p];r(l+p,a[p],w,this._lod._material.color),p++}this.region&&(this.region.pickableUpdateRequired=!0)}},this.setColourHex=function(a){this._lod._material.color.setHex(a),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(a);for(let u=0;u<n.length;u++)n[u]&&n[u].setColour(this._lod._material.color)},this.setColour=a=>{this._lod.setColour(a);for(let u=0;u<n.length;u++)n[u]&&n[u].setColour(this._lod._material.color)},this.setLabelDepthTest=a=>{t=a;for(let u=0;u<n.length;u++)n[u]&&n[u].setDepthTest(a)},this.setLabelFontWeight=a=>{s=a;for(let u=0;u<n.length;u++)n[u]&&n[u].setFontWeight(a)},this.setLabelSize=a=>{e=a;for(let u=0;u<n.length;u++)n[u]&&n[u].setSize(e)},this.displayLabels=a=>{i=a;for(let u=0;u<n.length;u++)n[u]&&n[u].setVisibility(i)},this.setSize=a=>{this.morph&&this.morph.material&&(this.morph.material.size=a,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=a=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=a,this.morph.material.needsUpdate=!0)},this.getVerticesByIndex=function(a){if(a>=0&&this.drawRange>a){const u=this.getMorph().geometry.getAttribute("position");return[u.getX(a),u.getY(a),u.getZ(a)]}},this.editVertices=function(a,u){if(a&&a.length){let f=this.getMorph();const l=u+a.length-1;if(!f||0>u||l>=this.drawRange)return;{const c=f.geometry.getAttribute("position");let d=u;a.forEach(h=>{const p=n[d];p&&p.setPosition(h[0],h[1],h[2]),c.setXYZ(d++,h[0],h[1],h[2])}),c.needsUpdate=!0,f.geometry.computeBoundingBox(),f.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}},this.deleteVertices=function(a){return Te.prototype.deleteVertices.call(this,a)&&o(a),this.drawRange},this.setName=function(a){const u=this.groupName;Te.prototype.setName.call(this,a),n.forEach(f=>{f.getString()===u&&(f==null||f.setText(a))})},this.render=(a,u,f,l)=>{this.morph&&f&&(this.morph.sizePerPixel=f.pixelHeight),Te.prototype.render.call(this,a,u,f,l)}};Te.prototype=Object.create(Y.prototype);const Ve=function(){Y.call(this),this.isLines=!0,this.createLineSegment=(n,e,t)=>{if(n&&e){let s=Ze(n,t);t.localMorphColour&&s.morphAttributes.color&&(e.onBeforeCompile=Pt());let i=new Xe(s,e);this.setMesh(i,t.localTimeEnabled,t.localMorphColour)}},this.setWidth=n=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=n,this.morph.material.needsUpdate=!0)},this.addLines=(n,e)=>{if(n&&n.length>0){const t=this.addVertices(n);if(!this.getMorph()){let i=new S.LineBasicMaterial({color:e});const r={localTimeEnabled:!1,localMorphColour:!1};t.colorsNeedUpdate=!0,this.createLineSegment(t,i,r)}this.region&&(this.region.pickableUpdateRequired=!0)}}};Ve.prototype=Object.create(Y.prototype);const Ue=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};Ue.prototype.loadImage=function(n,e){return new Promise((t,s)=>{n.onload=()=>t(n),n.onerror=s,n.src=e})},Ue.prototype.imageToUint8Array=async function(n,e,t,s){await n.loadImage(e,t),s.width=e.width,s.height=e.height;const i=s.getContext("2d");return i.drawImage(e,0,0),{array:new Uint8Array(i.getImageData(0,0,s.width,s.height).data.buffer),width:s.width,height:s.height}},Ue.prototype.loadFromImages=async function(n){},Ue.prototype.isReady=function(){return!!(this.impl&&!this.isLoading)},Ue.prototype.getMaterial=function(){if(this.impl)return new S.MeshBasicMaterial({color:new S.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:S.DoubleSide})};const yt=function(){Ue.call(this),this.isTextureArray=!0,this.loadFromImages=async n=>{let e=1,t=1,s=0;if(n&&n.length){this.isLoading=!0;const i=new Image;i.crossOrigin="Anonymous";const r=document.createElement("canvas");let o=0;const a=new Array(n.length);for(let f=0;f<n.length;f++){const l=await this.imageToUint8Array(this,i,n[f],r);l&&l.array&&(e=l.width,t=l.height,a[s]=l.array,o+=a[s].length,s++)}const u=new Uint8Array(o);o=0,a.forEach(f=>{u.set(f,o),o+=f.length}),this.impl=new S.DataTexture2DArray(u,e,t,s),this.size={width:e,height:t,depth:s},this.isLoading=!1,this.impl.needsUpdate=!0}},this.getMaterial=n=>{if(this.impl){let e;if(n){if(n.vs&&n.fs){let t=!0;"transparent"in n&&(t=n.transparent);let s=S.FrontSide;n.side&&(s=n.side),e=new S.ShaderMaterial({transparent:t,uniforms:n.uniforms,vertexShader:n.vs,fragmentShader:n.fs,side:s}),n.glslVersion&&(e.glslVersion=n.glslVersion)}}else e=new S.MeshBasicMaterial({color:new S.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:S.DoubleSide});if(e)return e.needsUpdate=!0,e}}};yt.prototype=Object.create(Ue.prototype);const Qi=S.GLSL3,Hi=`
4
+ precision highp float;
5
+ precision highp int;
6
+ precision highp sampler2DArray;
7
+
8
+ uniform sampler2DArray diffuse0;
9
+ uniform sampler2DArray diffuse1;
10
+ uniform sampler2DArray mask;
11
+ uniform bool discardAlpha;
12
+ uniform bool maskEnabled;
13
+ uniform float brightness;
14
+ uniform float contrast;
15
+ uniform float time;
16
+ uniform int nChannels;
17
+ in vec3 vUw;
18
+
19
+ out vec4 outColor;
20
+
21
+ void main() {
22
+
23
+ float color0 = texture( diffuse0, vUw ).r;
24
+ float color1 = texture( diffuse1, vUw ).r;
25
+ float color = mix(color0, color1, time);
26
+ // discard if alpha is zero
27
+ if (maskEnabled && discardAlpha) {
28
+ float mask = texture(mask, vUw).r;
29
+ if (mask == 0.0) discard;
30
+ }
31
+
32
+ // discard if alpha is zero
33
+ //if (discardAlpha && color.a == 0.0) discard;
34
+ // Apply brightness
35
+ vec3 brightenedColor = vec3(color) + vec3(brightness);
36
+ // Apply contrast
37
+ vec3 contrastedColor = (brightenedColor - vec3(0.5)) * contrast + vec3(0.5);
38
+ outColor = vec4(contrastedColor, 1.0);
39
+ }
40
+ `,es=`
41
+ out vec3 vUw;
42
+ uniform float depth;
43
+ uniform vec3 slide;
44
+ uniform int direction;
45
+ uniform bool flipY;
46
+ uniform bool flipZ;
47
+
48
+ void main() {
49
+
50
+ vec3 slidePos = position.xyz;
51
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position.xyz, 1.0 );
52
+
53
+ if (direction == 1)
54
+ slidePos = vec3(slide.x, position.y, position.x);
55
+ if (direction == 2)
56
+ slidePos = vec3(position.x, slide.y, position.y);
57
+ if (direction == 3)
58
+ slidePos = vec3(position.x, position.y, slide.z);
59
+
60
+ if (flipY)
61
+ slidePos.y = 1.0 - slidePos.y;
62
+ if (flipZ)
63
+ slidePos.z = 1.0 - slidePos.z;
64
+
65
+ vUw.xyz = vec3(slidePos.x, slidePos.y, slidePos.z * depth);
66
+
67
+ }
68
+ `,ts=function(){return{brightness:{value:0},contrast:{value:1},depth:{value:1},discardAlpha:{value:!0},diffuse0:{value:void 0},diffuse1:{value:void 0},direction:{value:1},flipY:{value:!0},flipZ:{value:!1},nChannels:{value:1},mask:{value:void 0},maskEnabled:{value:!1},slide:{value:new S.Vector3(0,0,1)},time:{value:0}}},ke=function(n){Y.call(this),this.isTexturePrimitive=!0,this.texture=n,this.textureList=[],this.texture&&this.textureList.push(this.texture),this.load=(e,t,s)=>{if(e&&e.images&&e.images.source){const i=new yt,r=[];e.images.source.forEach(a=>{r.push(ye(a))});const o=this;i.loadFromImages(r).then(()=>{o.texture=i,o.textureList.push(this.texture),o.initialise(e,t)})}},this.addTextureArray=e=>{this.textureList.length===0&&this.texture&&this.textureList.push(this.texture),e&&e.isTextureArray&&this.textureList.push(e)},this.initialise=(e,t)=>{t!=null&&typeof t=="function"&&t(this)}};ke.prototype=Object.create(Y.prototype),ke.prototype.constructor=ke;const Ee=function(n){ke.call(this,n),this.isTextureSlides=!0;const e=[],t={};this.morph=new S.Group,this.group=this.morph,this.morph.userData=this;let s,i=!0,r=!1,o=0,a=1,u=1,f,l=!1,c=!0,d=0,h=0,p=-.1;this.createSlides=g=>{g.forEach(_=>this.createSlide(_))};const w=(g,_)=>{const A=g.material,N=A.uniforms;switch(g.rotation.x=0,g.rotation.y=0,g.rotation.z=0,g.position.x=0,g.position.y=0,g.position.z=0,_.direction){case"x":const I=-Math.PI/2;g.rotation.y=I,N.direction.value=1,N.slide.value.set(_.value,0,0),g.position.x=_.value;break;case"y":g.rotation.x=Math.PI/2,N.direction.value=2,N.slide.value.set(0,_.value,0),g.position.y=_.value;break;case"z":N.direction.value=3,N.slide.value.set(0,0,_.value),g.position.z=_.value;break}A.needsUpdate=!0,this.boundingBoxUpdateRequired=!0};this.modifySlideSettings=g=>{g&&g.id&&g.id in t&&t[g.id]&&w(t[g.id],g)},this.createSlide=g=>{if(this.texture&&this.texture.isTextureArray&&this.texture.isReady()&&g&&g.direction&&g.value!==void 0){const _=new S.PlaneGeometry(1,1);_.translate(.5,.5,0);const A=ts();A.brightness.value=o,A.contrast.value=a,A.diffuse0.value=this.texture.impl,A.diffuse1.value=this.texture.impl,A.discardAlpha.value=c,A.depth.value=this.texture.size.depth,A.flipY.value=i,A.flipZ.value=r,A.mask.value=f,A.maskEnabled.value=l,A.nChannels.value=u;const N={fs:Hi,vs:es,uniforms:A,glslVersion:Qi,side:S.DoubleSide,transparent:!1},I=this.texture.getMaterial(N);I.needsUpdate=!0;const D=new S.Mesh(_,I);D.name=this.groupName,D.userData=this;const F={value:g.value,direction:g.direction,id:D.id};return e.push(F),w(D,F),t[D.id]=D,this.morph.add(D),this.boundingBoxUpdateRequired=!0,this.updateTimeTexture(),F}},this.getTextureSettings=()=>[...e],this.getTextureSettingsWithId=g=>{for(let _=0;_<e.length;_++)if(g===e[_].id)return{...e[_]}},this.getSlides=()=>this.morph?[...this.morph.children]:[],this.removeSlide=g=>{g&&this.removeSlideWithId(g.id)},this.removeSlideWithId=g=>{if(this.morph&&g in t&&t[g]){if(this.morph.getObjectById(g)){const A=t[g];this.morph.remove(A),A.clear(),A.geometry&&A.geometry.dispose(),A.material&&A.material.dispose(),this.boundingBoxUpdateRequired=!0}const _=e.findIndex(A=>A.id===g);_>-1&&e.splice(_,1)}},this.dispose=()=>{this.morph.children.forEach(g=>{g.geometry&&g.geometry.dispose(),g.material&&g.material.dispose()}),ke.prototype.dispose.call(this),this.boundingBoxUpdateRequired=!0};const y=(g,_,A)=>{if(_)switch(_.direction.value){case 1:A.copy(_.slide.value),g.expandByPoint(A),A.setY(1),A.setZ(1),g.expandByPoint(A);break;case 2:A.copy(_.slide.value),g.expandByPoint(A),A.setX(1),A.setZ(1),g.expandByPoint(A);break;case 3:A.copy(_.slide.value),g.expandByPoint(A),A.setX(1),A.setY(1),g.expandByPoint(A);break}};this.getBoundingBox=()=>{if(this.morph&&this.morph.children&&this.morph.visible&&this.boundingBoxUpdateRequired){this.cachedBoundingBox.makeEmpty();const g=new S.Vector3(0,0,0);this.morph.children.forEach(_=>{y(this.cachedBoundingBox,_.material.uniforms,g)}),this.morph.updateMatrixWorld(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox},this.applyTransformation=(g,_,A)=>{const N=new S.Matrix4;N.set(g[0],g[1],g[2],0,g[3],g[4],g[5],0,g[6],g[7],g[8],0,0,0,0,0);const I=new S.Quaternion().setFromRotationMatrix(N);this.morph.position.set(..._),this.morph.quaternion.copy(I),this.morph.scale.set(...A),this.morph.updateMatrix(),this.boundingBoxUpdateRequired=!0},this.setRenderOrder=g=>{this.morph.renderOrder=g},this.initialise=(g,_)=>{if(g){const A=g.locations;A&&A.length>0&&(this.applyTransformation(A[0].orientation,A[0].position,A[0].scale),"flipY"in A[0]&&(i=A[0].flipY),"flipZ"in A[0]&&(r=A[0].flipZ)),this.createSlides(g.settings.slides),_!=null&&typeof _=="function"&&_(this)}},this.showEdges=g=>{if(s)s.material.color=g;else{const _=new S.BoxGeometry(1,1,1);_.translate(.5,.5,.5);const A=new S.EdgesGeometry(_);s=new S.LineSegments(A,new S.LineBasicMaterial({color:g})),this.group.add(s)}s.visible=!0},this.setUniformsValue=(g,_)=>{this.morph.children.forEach(A=>{const N=A.material;if(N.type==="ShaderMaterial"){const I=N.uniforms;I[g].value=_,N.needsUpdate=!0}})},this.isAlphaPixelDiscarded=()=>c,this.discardAlphaPixel=g=>{c=g,this.setUniformsValue("discardAlpha",c)},this.getBrightness=()=>o,this.setBrightness=g=>{o=g,this.setUniformsValue("brightness",o)},this.getContrast=()=>a,this.setContrast=g=>{a>=0&&(a=g,this.setUniformsValue("contrast",a))},this.getNumberOfChannels=()=>u,this.setNumberOfChannels=g=>{u=g,this.setUniformsValue("nChannels",u)},this.getMask=()=>f,this.setMask=g=>{f=g,l=!!f,this.setUniformsValue("mask",f),this.setUniformsValue("maskEnabled",l)},this.hideEdges=()=>{s&&(s.visible=!1)},this.updateTimeTexture=()=>{const g=this.textureList.length-1,_=this.inbuildTime/this.duration;if(this.timeEnabled&&g>0&&p!==_){const A=_*g,N=Math.floor(A),I=Math.ceil(A),D=A-N;this.morph.children.forEach(F=>{const q=F.material;if(q.type==="ShaderMaterial"){const G=q.uniforms;d!==N&&(G.diffuse0.value=this.textureList[N].impl),h!==I&&(G.diffuse1.value=this.textureList[I].impl),G.time.value=D,q.needsUpdate=!0}}),d=N,h=I,p=_}},this.setMorphTime=g=>{let _=g;g>this.duration?_=this.duration:0>g?_=0:_=g,_!=this.inbuildTime&&(this.inbuildTime=_,this.updateTimeTexture())},this.render=(g,_,A)=>{if(_==!0&&this.timeEnabled&&this.textureList.length>1){let N=this.inbuildTime+g;N>this.duration&&(N=N-this.duration),this.inbuildTime=N,this.updateTimeTexture()}}};Ee.prototype=Object.create(ke.prototype),Ee.prototype.constructor=Ee;const Ie=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];const n=this;this.setFromObject=({nearPlane:e,farPlane:t,eyePosition:s,targetPosition:i,upVector:r})=>{n.nearPlane=e,n.farPlane=t,n.eyePosition=s,n.targetPosition=i,n.upVector=r}},Ht=function(n,e,t,s){const i={DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,MINIMAP:5,SYNC_CONTROL:6},r={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,SCROLL:6,KEYBOARD_ZOOM:7,KEYBOARD_ROTATE:8,KEYBOARD_PAN:9},o={NONE:-1,FREE:1,HORIZONTAL:2,VERTICAL:3},a={ARROWLEFT:37,ARROWUP:38,ARROWRIGHT:39,ARROWDOWN:40,NUMPADADD:107,NUMPADSUBTRACT:109,EQUAL:187,MINUS:189},u={};u.MAIN=r.ROTATE,u.AUXILIARY=r.ZOOM,u.SECONDARY=r.PAN,this.cameraObject=n,this.domElement=e!==void 0?e:document,this.renderer=t,this.scene=s,this.tumble_rate=1.5,this.pointer_x=0,this.pointer_y=0,this.pointer_x_start=0,this.pointer_y_start=0,this.previous_pointer_x=0,this.previous_pointer_y=0,this.near_plane_fly_debt=0,this.touchZoomDistanceStart=0,this.touchZoomDistanceEnd=0,this.directionalLight=0,this.zoomRate=50,this.rotateRate=50,this.panRate=100,this.pixelHeight=1;let f=6e3,l=!0,c=0,d,h,p=!1,w=500,y,g="default",_=i.DEFAULT,A,N,I,D=0,F=o.FREE;this._state=r.NONE;let q;this.targetTouchId=-1;let G;const T=new S.Vector3,C=new S.Vector3,U=new S.Vector3,M=new S.Vector3,O=new S.Vector3,k=new S.Vector3,P=new S.Vector3,m=new S.Vector3,L=new S.Sphere,b=new S.Vector3;let B=!1,V,R=0;const z={default:new Ie};z.default.nearPlane=.1,z.default.farPlane=2e3,z.default.eyePosition=[0,0,0],z.default.targetPosition=[0,0,-1],z.default.upVector=[0,1,0],this.cameraObject.target===void 0&&(this.cameraObject.target=new S.Vector3(...z.default.targetPosition)),this.calculateMaxAllowedDistance=x=>{const j=x.getBoundingBox();if(j){j.getBoundingSphere(L),R=L.radius*6;let W=0;this.cameraObject&&(W=this.cameraObject.position.distanceTo(L.center)),R=W>R?W*1.5:R}else R=0};const Z=x=>{T.copy(this.cameraObject.position);const W=T.sub(this.cameraObject.target).length();this.cameraObject.near=Math.max(1e-4,W*.001),this.cameraObject.far=this.cameraObject.near*1e4};this.addViewport=(x,j)=>{x&&j&&(z[x]=j)},this.setDefaultViewport=x=>x&&x in z?(g=x,!0):!1,this.getDefaultViewport=()=>g,this.getViewportOfName=x=>z[x],this.setCurrentViewport=x=>x in z?(this.setCurrentCameraSettings(z[x]),!0):!1,this.setRotationMode=x=>{switch(x){case"none":F=o.NONE;break;case"horizontal":F=o.HORIZONTAL;break;case"vertical":F=o.VERTICAL;break;case"free":default:F=o.FREE}},this.onResize=()=>{G&&(G=void 0),V&&V.setCurrentCameraSettings(this.cameraObject,z[g])},this.getVisibleHeightAtZDepth=x=>{const j=this.cameraObject.position.distanceTo(this.cameraObject.target);x<j?x-=j:x+=j;const W=this.cameraObject.fov*Math.PI/180;return 2*Math.tan(W/2)*Math.abs(x)},this.calculateHeightPerPixelAtZeroDepth=x=>{const j=this.getVisibleHeightAtZDepth(0);return this.pixelHeight=j/x,this.pixelHeight},this.getNDCFromDocumentCoords=(x,j,W)=>{ie(!1);const X=W||new S.Vector2,he=(x-G.left)/G.width*2-1,le=-((j-G.top)/G.height)*2+1;return X.set(he,le)},this.getRelativeCoordsFromNDC=(x,j,W)=>{ie(!1);const X=W||new S.Vector2;return X.x=(x+1)*G.width/2,X.y=(1-j)*G.height/2,X},this.setMouseButtonAction=(x,j)=>{u[x]=r[j]};const E=(x,j)=>{x instanceof HTMLCanvasElement&&(x.tabIndex=j)},$=()=>{if(R>0){const x=b.distanceTo(L.center);return R>x||this.cameraObject.position.distanceTo(L.center)>x}return!0},H=x=>{b.copy(this.cameraObject.position).add(x),$()&&(this.cameraObject.target.add(x),this.cameraObject.position.add(x),this.updateDirectionalLight())},K=x=>{ie(!1);let j;if(_===i.DEFAULT&&(j=this.scene.getNormalisedMinimapCoordinates(this.renderer,x)),!j)x.button==0?x.ctrlKey?this._state=u.AUXILIARY:x.shiftKey?this._state=u.SECONDARY:this._state=u.MAIN:x.button==1?(x.preventDefault(),this._state=u.AUXILIARY):x.button==2&&(this._state=u.SECONDARY),this.pointer_x=x.clientX-G.left,this.pointer_y=x.clientY-G.top,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y;else{_=i.MINIMAP;let W=this.scene.getMinimapDiffFromNormalised(j.x,j.y);H(W)}},ee=x=>{if(ie(!1),G)if(this.pointer_x=x.clientX-G.left,this.pointer_y=x.clientY-G.top,_===i.MINIMAP){let j=this.scene.getNormalisedMinimapCoordinates(this.renderer,x);if(j){let W=this.scene.getMinimapDiffFromNormalised(j.x,j.y);H(W)}}else this._state===r.NONE&&q!==void 0&&q.move(this,x.clientX,x.clientY,this.renderer)},re=x=>{this._state=r.NONE,_==i.MINIMAP&&(_=i.DEFAULT),q!==void 0&&this.pointer_x_start==x.clientX-G.left&&this.pointer_y_start==x.clientY-G.top&&q.pick(this,x.clientX,x.clientY,this.renderer)},Q=x=>{this._state=r.NONE},ue=x=>{ie(!1);const j=x.touches.length;if(j==1)this._state=r.TOUCH_ROTATE,this.pointer_x=x.touches[0].clientX-(G==null?void 0:G.left),this.pointer_y=x.touches[0].clientY-(G==null?void 0:G.top),this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y;else if(j==2){this._state=r.TOUCH_ZOOM;const W=x.touches[0].clientX-x.touches[1].clientX,X=x.touches[0].clientY-x.touches[1].clientY;this.touchZoomDistanceEnd=this.touchZoomDistanceStart=Math.sqrt(W*W+X*X)}else j==3&&(this._state=r.TOUCH_PAN,this.targetTouchId=x.touches[0].identifier,this.pointer_x=x.touches[0].clientX-(G==null?void 0:G.left),this.pointer_y=x.touches[0].clientY-(G==null?void 0:G.top),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y)},ne=x=>{x.preventDefault(),x.stopPropagation();const j=x.touches.length;if(j==1)this.pointer_x=x.touches[0].clientX-G.left,this.pointer_y=x.touches[0].clientY-G.top;else if(j==2){if(this._state===r.TOUCH_ZOOM){const W=x.touches[0].clientX-x.touches[1].clientX,X=x.touches[0].clientY-x.touches[1].clientY;this.touchZoomDistanceEnd=Math.sqrt(W*W+X*X)}}else if(j==3&&this._state===r.TOUCH_PAN)for(let W=0;W<3;W++)x.touches[W].identifier==this.targetTouchId&&(this.pointer_x=x.touches[0].clientX-G.left,this.pointer_y=x.touches[0].clientY-G.top)},te=x=>{const j=x.touches.length;this.touchZoomDistanceStart=this.touchZoomDistanceEnd=0,this.targetTouchId=-1,this._state=r.NONE,j==1&&q!==void 0&&this.pointer_x_start==x.touches[0].clientX-G.left&&this.pointer_y_start==x.touches[0].clientY-G.top&&q.pick(this.cameraObject,x.touches[0].clientX,x.touches[0].clientY,this.renderer)},J=()=>{ie(!0)},ie=x=>{if(x||G===void 0){const j=new IntersectionObserver(W=>{for(const X of W)G=X.boundingClientRect;j.disconnect()});j.observe(this.domElement)}},ae=x=>{ie(!1),this._state=r.SCROLL;let j=0;x.deltaY>0?j=this.zoomRate:x.deltaY<0&&(j=this.zoomRate*-1),D=D+j,x.preventDefault(),x.stopImmediatePropagation()},Le=x=>{ie(!1);let j=0;if(x.keyCode===a.EQUAL||x.keyCode===a.MINUS||x.keyCode===a.NUMPADADD||x.keyCode===a.NUMPADSUBTRACT){this._state=r.KEYBOARD_ZOOM;let W=1;x.shiftKey&&(W=W*2),x.keyCode===a.EQUAL||x.keyCode===a.NUMPADADD?j=this.zoomRate*W*-1:(x.keyCode===a.MINUS||x.keyCode===a.NUMPADSUBTRACT)&&(j=this.zoomRate*W),D=D+j}else(x.keyCode===a.ARROWLEFT||x.keyCode===a.ARROWUP||x.keyCode===a.ARROWRIGHT||x.keyCode===a.ARROWDOWN)&&(x.shiftKey?(this._state=r.KEYBOARD_ROTATE,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,j=this.rotateRate):(this._state=r.KEYBOARD_PAN,j=this.panRate),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,x.keyCode===a.ARROWLEFT?this.pointer_x=this.pointer_x-j:x.keyCode===a.ARROWUP?this.pointer_y=this.pointer_y-j:x.keyCode===a.ARROWRIGHT?this.pointer_x=this.pointer_x+j:x.keyCode===a.ARROWDOWN&&(this.pointer_y=this.pointer_y+j));Object.values(a).includes(x.keyCode)&&x.preventDefault()},oe=x=>{this._state=r.NONE},Ne=()=>{if(typeof this.cameraObject<"u"){const x=G.height,j=this.cameraObject.position.distanceTo(this.cameraObject.target);let W=0;this.cameraObject.far>this.cameraObject.near&&j>=this.cameraObject.near&&j<=this.cameraObject.far&&(W=(j-this.cameraObject.near)/(this.cameraObject.far-this.cameraObject.near)),C.set(this.previous_pointer_x,x-this.previous_pointer_y,0),U.set(this.previous_pointer_x,x-this.previous_pointer_y,1),M.set(this.pointer_x,x-this.pointer_y,0),O.set(this.pointer_x,x-this.pointer_y,1),C.unproject(this.cameraObject),U.unproject(this.cameraObject),M.unproject(this.cameraObject),O.unproject(this.cameraObject);const X=-.002;M.sub(C).multiplyScalar(1-W),O.sub(U).multiplyScalar(W),M.add(O).multiplyScalar(X),H(M)}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y};this.getVectorsFromRotateAboutLookAtPoints=(x,j)=>{x.normalize(),P.copy(this.cameraObject.position).sub(this.cameraObject.target),m.copy(P),P.normalize(),.8<Math.abs(P.dot(x))&&P.copy(this.cameraObject.up),C.crossVectors(x,P).normalize(),U.crossVectors(x,C);const W=x.dot(m),X=C.dot(m),he=U.dot(m),le=x.dot(this.cameraObject.up),pe=C.dot(this.cameraObject.up),ce=U.dot(this.cameraObject.up),me=Math.cos(j),ve=Math.sin(j);return M.set(me*C.x+ve*U.x,me*C.y+ve*U.y,me*C.z+ve*U.z),O.set(me*U.x-ve*C.x,me*U.y-ve*C.y,me*U.z-ve*C.z),P.copy(this.cameraObject.target),P.x=P.x+x.x*W+M.x*X+O.x*he,P.y=P.y+x.y*W+M.y*X+O.y*he,P.z=P.z+x.z*W+M.z*X+O.z*he,T.set(x.x*le+M.x*pe+O.x*ce,x.y*le+M.y*pe+O.y*ce,x.z*le+M.z*pe+O.z*ce),{position:P,up:T}},this.rotateAboutLookAtpoint=(x,j)=>{const W=this.getVectorsFromRotateAboutLookAtPoints(x,j);this.cameraObject.position.copy(W.position),this.updateDirectionalLight(),this.cameraObject.up.copy(W.up)};const Ci=()=>{if(typeof this.cameraObject<"u"){const x=G==null?void 0:G.width,j=G==null?void 0:G.height;if(0<x&&0<j){const W=.25*(x+j);let X=0,he=0;(F===o.FREE||F===o.HORIZONTAL)&&(X=this.pointer_x-this.previous_pointer_x),(F===o.FREE||F===o.VERTICAL)&&(he=this.previous_pointer_y-this.pointer_y);const le=Math.sqrt(X*X+he*he);if(le>0){const pe=-he*1/le,ce=X*1/le;let me=0;F===o.FREE&&pe*(this.pointer_x-.5*(x-1))+ce*(.5*(j-1)-this.pointer_y);const ve=Math.acos(me/W)-.5*Math.PI,We=this.tumble_rate*le/W;T.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(),C.copy(this.cameraObject.up).normalize(),U.copy(C).cross(T).normalize().multiplyScalar(pe),C.multiplyScalar(ce),k.addVectors(U,C).multiplyScalar(Math.cos(ve)),T.multiplyScalar(Math.sin(ve)),k.add(T),this.rotateAboutLookAtpoint(k,-We)}}}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},Oi=()=>{let x=0;return this._state===r.ZOOM?x=this.previous_pointer_y-this.pointer_y:this._state===r.SCROLL||this._state===r.KEYBOARD_ZOOM?x=D:(x=-1*(this.touchZoomDistanceEnd-this.touchZoomDistanceStart),this.touchZoomDistanceStart=this.touchZoomDistanceEnd),x};this.changeZoomByScrollRateUnit=x=>{const j=x*this.zoomRate;this.changeZoomByValue(j)},this.changeZoomByValue=x=>{if(typeof this.cameraObject<"u"){const j=G.height,W=this.cameraObject.position.clone();W.sub(this.cameraObject.target);const X=W.length(),he=1.5*x/j,le=X*he;X+le>.01&&(W.normalize(),b.copy(this.cameraObject.position),b.x+=W.x*le,b.y+=W.y*le,b.z+=W.z*le,$()&&(this.cameraObject.position.copy(b),this.updateDirectionalLight(),Z(),B=!0))}};const Gs=()=>{const x=Oi();this.changeZoomByValue(x),this._state===r.ZOOM&&(this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y),(this._state===r.SCROLL||this._state===r.KEYBOARD_ZOOM)&&(D=0,this._state=r.NONE)};this.setDirectionalLight=x=>{this.directionalLight=x},this.updateDirectionalLight=()=>{this.directionalLight!=0&&this.directionalLight.position.set(this.cameraObject.position.x,this.cameraObject.position.y,this.cameraObject.position.z)},this.enable=function(){l=!0,this.domElement&&this.domElement.addEventListener&&(E(this.domElement,0),this.domElement.addEventListener("mousedown",K,!1),this.domElement.addEventListener("mousemove",ee,!1),this.domElement.addEventListener("mouseup",re,!1),this.domElement.addEventListener("mouseleave",Q,!1),this.domElement.addEventListener("touchstart",ue,!1),this.domElement.addEventListener("touchmove",ne,!1),this.domElement.addEventListener("touchend",te,!1),this.domElement.addEventListener("wheel",ae,!1),this.domElement.addEventListener("mouseenter",J,!1),this.domElement.addEventListener("contextmenu",x=>{x.preventDefault()},!1),this.domElement.addEventListener("keydown",Le,!1),this.domElement.addEventListener("keyup",oe,!1))},this.disable=function(){l=!1,this.domElement&&this.domElement.removeEventListener&&(this.domElement.removeEventListener("mousedown",K,!1),this.domElement.removeEventListener("mousemove",ee,!1),this.domElement.removeEventListener("mouseup",re,!1),this.domElement.removeEventListener("mouseleave",Q,!1),this.domElement.removeEventListener("touchstart",ue,!1),this.domElement.removeEventListener("touchmove",ne,!1),this.domElement.removeEventListener("touchend",te,!1),this.domElement.removeEventListener("wheel",ae,!1),this.domElement.removeEventListener("mouseenter",J,!1),this.domElement.removeEventListener("contextmenu",x=>{x.preventDefault()},!1),this.domElement.removeEventListener("keydown",Le,!1),this.domElement.removeEventListener("keyup",oe,!1),E(this.domElement,-1))},this.loadPath=x=>{d=x.CameraPath,h=x.NumberOfPoints},this.loadPathURL=(x,j)=>{const W=ye(x);fetch(W).then(X=>{if(!X.ok)throw new Error(`HTTP error! status: ${X.status}`);return X.json()}).then(X=>{this.loadPath(X),j!==void 0&&typeof j=="function"&&j()}).catch(X=>{console.error(`Failed to load path asset from: ${W}`,X)})},this.setPathDuration=x=>{f=x,A&&A.setDuration(f),N&&N.setDuration(f)},this.getPlayRate=()=>w,this.setPlayRate=x=>{w=x};const js=x=>{let j=c+x;j>f&&(j=j-f),c=j};this.getTime=()=>c,this.setTime=x=>{x>f?c=f:x<0?c=0:c=x},this.getNumberOfTimeFrame=()=>h,this.getCurrentTimeFrame=()=>{if(h>2){const x=c/f*(h-1),j=Math.floor(x),W=1-(x-j),X=Math.ceil(x);return j==X?j==h-1?[j-1,X,0]:[j,X+1,1]:[j,X,W]}else if(h==1)return[0,0,0]},this.setCurrentTimeFrame=x=>{h>2&&(c=f*x/(h-1),c<0&&(c=0),c>f&&(c=f))};const Ti=x=>{if(_===i.PATH&&(js(x),d)){const j=this.getCurrentTimeFrame(),W=j[0],X=j[1],he=j[2],le=[d[W*3],d[W*3+1],d[W*3+2]],pe=[d[X*3],d[X*3+1],d[X*3+2]],ce=[];for(let me=0;me<le.length;me++)ce.push(he*le[me]+(1-he)*pe[me]);this.cameraObject.position.set(ce[0],ce[1],ce[2]),this.cameraObject.target.set(pe[0],pe[1],pe[2]),y&&this.cameraObject.lookAt(this.cameraObject.target),p&&(this.directionalLight.position.set(ce[0],ce[1],ce[2]),this.directionalLight.target.position.set(pe[0],pe[1],pe[2]))}};this.calculatePathNow=()=>{Ti(0)};const Es=()=>{this._state===r.ROTATE||this._state===r.TOUCH_ROTATE||this._state===r.KEYBOARD_ROTATE?Ci():this._state===r.PAN||this._state===r.TOUCH_PAN||this._state===r.KEYBOARD_PAN?(Ne(),V.triggerCallback()):(this._state===r.ZOOM||this._state===r.TOUCH_ZOOM||this._state===r.SCROLL||this._state===r.KEYBOARD_ZOOM)&&(V.zoom(Oi()),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,(this._state===r.SCROLL||this._state===r.KEYBOARD_ZOOM)&&(this._state=r.NONE),D=0,V.triggerCallback())};this.update=x=>{const j=x*w;let W=l,X=!0;return _===i.PATH?Ti(j):_===i.SMOOTH_CAMERA_TRANSITION&&A?(A.update(j),A.isTransitionCompleted()&&(_=i.DEFAULT),W=!1):_===i.ROTATE_CAMERA_TRANSITION&&N?(N.update(j),N.isTransitionCompleted()&&(_=i.DEFAULT),W=!1):_===i.AUTO_TUMBLE&&I?I.update(j):_===i.SYNC_CONTROL&&V?(Es(),W=!1):X=!1,W&&(this._state!==r.NONE&&(X=!0),this._state===r.ROTATE||this._state===r.TOUCH_ROTATE||this._state===r.KEYBOARD_ROTATE?Ci():this._state===r.PAN||this._state===r.TOUCH_PAN||this._state===r.KEYBOARD_PAN?Ne():(this._state===r.ZOOM||this._state===r.TOUCH_ZOOM||this._state===r.SCROLL||this._state===r.KEYBOARD_ZOOM)&&Gs(),this._state!==r.NONE&&_===i.AUTO_TUMBLE&&I&&I.stopOnCameraInput,this._state===r.SCROLL&&(this._state=r.NONE)),y?(X=!0,y.update()):this.cameraObject.lookAt(this.cameraObject.target),X=X||B,B=!1,X},this.playPath=()=>{_=i.PATH},this.stopPath=()=>{_=i.DEFAULT},this.isPlayingPath=()=>_===i.PATH,this.enableDirectionalLightUpdateWithPath=x=>{p=x},this.enableDeviceOrientation=()=>{y||(y=new ss(this.cameraObject))},this.disableDeviceOrientation=()=>{y&&(y.dispose(),y=void 0)},this.isDeviceOrientationEnabled=()=>!!y,this.resetView=()=>{const x=z[g];this.cameraObject.near=x.nearPlane,this.cameraObject.far=x.farPlane,this.cameraObject.position.set(x.eyePosition[0],x.eyePosition[1],x.eyePosition[2]),this.cameraObject.target.set(x.targetPosition[0],x.targetPosition[1],x.targetPosition[2]),this.cameraObject.up.set(x.upVector[0],x.upVector[1],x.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight()},this.setCurrentCameraSettings=x=>{x.nearPlane&&(this.cameraObject.near=x.nearPlane),x.farPlane&&(this.cameraObject.far=x.farPlane),x.eyePosition&&this.cameraObject.position.set(x.eyePosition[0],x.eyePosition[1],x.eyePosition[2]),x.targetPosition&&this.cameraObject.target.set(x.targetPosition[0],x.targetPosition[1],x.targetPosition[2]),x.upVector&&this.cameraObject.up.set(x.upVector[0],x.upVector[1],x.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight(),B=!0},this.getViewportFromCentreAndRadius=(x,j,W,X,he,le)=>{T.copy(this.cameraObject.position),T.sub(this.cameraObject.target),T.normalize();const pe=[x,j,W],ce=X/Math.tan(he*Math.PI/360),me=[x+T.x*ce,j+T.y*ce,W+T.z*ce],ve=ce+le;let We=0;const Li=.95;le>Li*ce?We=(1-Li)*ce:We=ce-le;const Re=new Ie;return Re.nearPlane=We,Re.farPlane=ve,Re.eyePosition=me,Re.targetPosition=pe,Re.upVector=[this.cameraObject.up.x,this.cameraObject.up.y,this.cameraObject.up.z],Re},this.getViewportFromBoundingBox=(x,j)=>{const W=x.min.distanceTo(x.max)/2*j,X=(x.min.x+x.max.x)/2,he=(x.min.y+x.max.y)/2,le=(x.min.z+x.max.z)/2;return this.getViewportFromCentreAndRadius(X,he,le,W,40,W*4)},this.getCurrentViewport=()=>{const x=new Ie;return x.nearPlane=this.cameraObject.near,x.farPlane=this.cameraObject.far,x.eyePosition[0]=this.cameraObject.position.x,x.eyePosition[1]=this.cameraObject.position.y,x.eyePosition[2]=this.cameraObject.position.z,x.targetPosition[0]=this.cameraObject.target.x,x.targetPosition[1]=this.cameraObject.target.y,x.targetPosition[2]=this.cameraObject.target.z,x.upVector[0]=this.cameraObject.up.x,x.upVector[1]=this.cameraObject.up.y,x.upVector[2]=this.cameraObject.up.z,x},this.getDefaultEyePosition=()=>eyePosition,this.getDefaultTargetPosition=()=>targetPosition,this.cameraTransition=(x,j,W)=>{N==null&&(A=new ei(x,j,this,W))},this.rotateCameraTransition=(x,j,W)=>{A==null&&(N=new is(x,j,this,W))},this.enableCameraTransition=()=>{A&&(_=i.SMOOTH_CAMERA_TRANSITION),N&&(_=i.ROTATE_CAMERA_TRANSITION)},this.pauseCameraTransition=()=>{_=i.DEFAULT},this.stopCameraTransition=()=>{_=i.DEFAULT,A=void 0,N=void 0},this.isTransitioningCamera=()=>_===i.SMOOTH_CAMERA_TRANSITION||_===i.ROTATE_CAMERA_TRANSITION,this.autoTumble=(x,j,W)=>{I=new ii(x,j,W,this)},this.enableAutoTumble=()=>{_=i.AUTO_TUMBLE},this.stopAutoTumble=()=>{_=i.DEFAULT,I=void 0},this.updateAutoTumble=()=>{I&&(I.requireUpdate=!0)},this.isAutoTumble=()=>_===i.AUTO_TUMBLE,this.enableRaycaster=(x,j,W)=>{q==null&&(q=new ti(x,this.scene,j,W,this.renderer))},this.disableRaycaster=()=>{q.disable(),q=void 0},this.isSyncControl=()=>currentMpde===i.SYNC_CONTROL,this.enableSyncControl=()=>(_=i.SYNC_CONTROL,V||(V=new rs),V.setCurrentCameraSettings(this.cameraObject,z[g]),V),this.disableSyncControl=()=>{_=i.DEFAULT,this.cameraObject.zoom=1,this.cameraObject.updateProjectionMatrix()},this.enable()},ei=function(n,e,t,s){const i=n.eyePosition,r=n.targetPosition,o=n.upVector,a=e.eyePosition,u=e.targetPosition,f=e.upVector,l=t;let c=s,d=0,h=!1;l.near=Math.min(n.nearPlane,e.nearPlane),l.far=Math.max(n.farPlane,e.farPlane),l.cameraObject.up.set(e.upVector[0],e.upVector[1],e.upVector[2]),this.setDuration=y=>{c=y};const p=y=>{let g=d+y;g>c&&(g=c),d=g},w=()=>{const y=d/c,g=[i[0]*(1-y)+a[0]*y,i[1]*(1-y)+a[1]*y,i[2]*(1-y)+a[2]*y],_=[r[0]*(1-y)+u[0]*y,r[1]*(1-y)+u[1]*y,r[2]*(1-y)+u[2]*y];o[0]*(1-y)+f[0]*y,o[1]*(1-y)+f[1]*y,o[2]*(1-y)+f[2]*y,l.cameraObject.position.set(g[0],g[1],g[2]),l.cameraObject.target.set(_[0],_[1],_[2])};this.update=y=>{this.enabled!==!1&&(p(y),w(),d==c&&(h=!0))},this.isTransitionCompleted=()=>h},is=function(n,e,t,s){const i=n,r=e,o=t;let a=s,u=0,f=!1;this.setDuration=c=>{a=c};const l=c=>{const d=u;let h=u+c;h>a&&(h=a),u=h;const y=(u-d)/a*r;o.rotateAboutLookAtpoint(i,y)};this.update=c=>{this.enabled!==!1&&(l(c),u==a&&(f=!0))},this.isTransitionCompleted=()=>f},ti=function(n,e,t,s,i){const r=n,o=e,a=i,u=t,f=s;let l=!0;const c=new S.Raycaster;c.params.Line.threshold=.1,c.params.Points.threshold=1;const d=new S.Vector2;let h=!1,p=new Date,w=!1,y=0,g=new Array,_={zincCamera:void 0,x:-1,y:-1},A;this.enable=()=>{l=!0},this.disable=()=>{l=!1},this.getIntersectsObject=D=>{if(o!==r){const q=r.getThreeJSScene();a.render(q,D.cameraObject)}let F=A||r.getPickableThreeJSObjects();return g.length=0,c.intersectObjects(F,!0,g)},this.setPickableObjects=D=>{D===void 0?A=void 0:(A=[],D.forEach(F=>{F.getGroup()&&F.getGroup().visible&&A.push(F.getGroup())}))},this.getIntersectsObjectWithOrigin=(D,F,q)=>(c.set(F,q),this.getIntersectsObject(D)),this.getIntersectsObjectWithCamera=(D,F,q)=>(D.getNDCFromDocumentCoords(F,q,d),c.setFromCamera(d,D.cameraObject),this.getIntersectsObject(D)),this.pick=(D,F,q)=>{if(l&&a&&r&&D&&u){this.getIntersectsObjectWithCamera(D,F,q);const G=g.length;for(let T=0;T<G;T++){let C=g[T].object?g[T].object.userData:void 0;if(C&&C.isMarkerCluster&&C.visible&&C.clusterIsVisible(g[T].object.clusterIndex)&&C.zoomToCluster(g[T].object.clusterIndex))return}u(g,F,q)}};let N=(D,F,q)=>{if(l&&a&&r&&D&&f){if(this.getIntersectsObjectWithCamera(D,F,q),p.setTime(Date.now()),g.length===0){if(w)return;w=!0}else w=!1;f(g,F,q)}};this.move=(D,F,q)=>{l&&a&&r&&D&&f&&(r.displayMarkers?N(D,F,q):(_.zincCamera=D,_.x=F,_.y=q,h||(y=p?Date.now()-p.getTime():250,y>=250?N(D,F,q):(h=!0,setTimeout(I(_),y)))))};let I=D=>function(){h=!1,N(D.zincCamera,D.x,D.y)}},ii=function(n,e,t,s){const i=new S.Vector3,r=-e,o=s,a=n;this.stopOnCameraInput=t,this.requireUpdate=!0;const u=new S.Vector3,f=new S.Vector3,l=c=>{const d=Math.sqrt(c[0]*c[0]+c[1]*c[1]),h=Math.abs(c[0])*4,p=Math.abs(c[1])*4,w=.25*(h+p),y=-c[1]/d,g=c[0]/d;let _=y*c[0]+g*-c[1];_>w?_=w:_<-w&&(_=-w);const A=Math.acos(_/w)-.5*Math.PI;i.copy(o.cameraObject.position).sub(o.cameraObject.target).normalize(),u.copy(o.cameraObject.up).normalize(),f.crossVectors(u,i).normalize().multiplyScalar(y),u.multiplyScalar(g),u.add(f).multiplyScalar(Math.cos(A)),i.multiplyScalar(Math.sin(A)).add(u)};this.update=c=>{this.enabled!==!1&&(this.requireUpdate&&(l(a),this.requireUpdate=!1),o.rotateAboutLookAtpoint(i,r*c/1e3))}},si=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new S.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new S.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1};Object.assign(si.prototype,{update:(()=>{let n,e,t,s,i,r;const o=new S.Matrix4,a=new S.Matrix4;return function(f){if(n!==f.focus||e!==f.fov||t!==f.aspect*this.aspect||s!==f.near||i!==f.far||r!==f.zoom){n=f.focus,e=f.fov,t=f.aspect*this.aspect,s=f.near,i=f.far,r=f.zoom;const c=f.projectionMatrix.clone(),d=.064/2,h=d*s/n,p=s*Math.tan(S.Math.DEG2RAD*e*.5)/f.zoom;let w,y;a.elements[12]=-d,o.elements[12]=d,w=-p*t+h,y=p*t+h,c.elements[0]=2*s/(y-w),c.elements[8]=(y+w)/(y-w),this.cameraL.projectionMatrix.copy(c),w=-p*t-h,y=p*t-h,c.elements[0]=2*s/(y-w),c.elements[8]=(y+w)/(y-w),this.cameraR.projectionMatrix.copy(c)}this.cameraL.matrixWorld.copy(f.matrixWorld).multiply(a),this.cameraR.matrixWorld.copy(f.matrixWorld).multiply(o)}})()});const ri=function(n){const e=new si;e.aspect=.5,this.setSize=(t,s)=>{n.setSize(t,s)},this.render=(t,s)=>{t.updateMatrixWorld(),s.parent===null&&s.updateMatrixWorld(),e.update(s);const i=n.getSize();n.setScissorTest(!0),n.clear(),n.setScissor(0,0,i.width/2,i.height),n.setViewport(0,0,i.width/2,i.height),n.render(t,e.cameraL),n.setScissor(i.width/2,0,i.width/2,i.height),n.setViewport(i.width/2,0,i.width/2,i.height),n.render(t,e.cameraR),n.setScissorTest(!1)}},ss=function(n){const e=this;this.object=n,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;const t=r=>{e.deviceOrientation=r},s=()=>{typeof window<"u"&&(e.screenOrientation=window.orientation||0)},i=(()=>{const r=new S.Vector3(0,0,1),o=new S.Euler,a=new S.Quaternion,u=new S.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return(f,l,c,d,h)=>{const p=new S.Vector3(0,0,1);p.subVectors(f.target,f.position),o.set(c,l,-d,"YXZ");const w=new S.Quaternion;w.setFromEuler(o),w.multiply(u),w.multiply(a.setFromAxisAngle(r,-h)),p.applyQuaternion(w),p.addVectors(f.position,p),f.lookAt(p)}})();this.connect=()=>{s(),typeof window<"u"&&(window.addEventListener("orientationchange",s,!1),window.addEventListener("deviceorientation",t,!1)),e.enabled=!0},this.disconnect=()=>{typeof window<"u"&&(window.removeEventListener("orientationchange",s,!1),window.removeEventListener("deviceorientation",t,!1)),e.enabled=!1},this.update=()=>{if(e.enabled===!1)return;const r=e.deviceOrientation.alpha?S.Math.degToRad(e.deviceOrientation.alpha):0,o=e.deviceOrientation.beta?S.Math.degToRad(e.deviceOrientation.beta):0,a=e.deviceOrientation.gamma?S.Math.degToRad(e.deviceOrientation.gamma):0,u=e.screenOrientation?S.Math.degToRad(e.screenOrientation):0;i(e.object,r,o,a,u)},this.dispose=function(){this.disconnect()},this.connect()},rs=function(){let n,e,t;const s=new S.Vector3,i=new S.Vector3,r=new S.Vector3,o=new S.Vector3;let a;this.setCurrentCameraSettings=(u,f)=>{this.near_plane_fly_debt==0,n=u.clone(),e=u,t=f,n.near=t.nearPlane,t.farPlane&&(n.far=t.farPlane),t.eyePosition&&n.position.set(t.eyePosition[0],t.eyePosition[1],t.eyePosition[2]),t.upVector&&n.up.set(t.upVector[0],t.upVector[1],t.upVector[2]),t.targetPosition&&(n.target=new S.Vector3(t.targetPosition[0],t.targetPosition[1],t.targetPosition[2]),n.lookAt(n.target)),n.updateProjectionMatrix(),s.copy(n.position).project(n),i.copy(n.target).project(n)},this.getCurrentPosition=()=>(i.copy(e.target).project(n),[i.x,i.y]),this.zoom=u=>{let f=u*.002,l=Math.max(e.zoom-f,1);e.zoom=l,e.updateProjectionMatrix()},this.zoomToBox=(u,f)=>{u.getCenter(r),r.project(n),this.setCenterZoom([r.x,r.y],f)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:e.zoom}),this.setCenterZoom=(u,f)=>{r.set(u[0],u[1],i.z).unproject(n),o.copy(r).sub(e.target),e.target.copy(r),e.lookAt(e.target),e.position.add(o),e.zoom=f,e.updateProjectionMatrix()},this.setEventCallback=u=>{(u===void 0||typeof u=="function")&&(a=u)},this.triggerCallback=()=>{a!==void 0&&typeof a=="function"&&a()}},ns="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'%20?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20width='365'%20height='560'%20viewBox='0%200%20365%20560'%20xml:space='preserve'%3e%3cdesc%3eCreated%20with%20Fabric.js%205.2.4%3c/desc%3e%3cdefs%3e%3c/defs%3e%3crect%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20fill='transparent'%3e%3c/rect%3e%3cg%20transform='matrix(0%200%200%200%200%200)'%20id='808ed283-2524-440f-88ae-3bdb47bb5749'%20%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%20182.5%20280)'%20id='db30413d-5bff-4b98-ab59-464497ee199e'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-182.5'%20y='-280'%20rx='0'%20ry='0'%20width='365'%20height='560'%20/%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0.99%200%200%200.99%20182.5%20280)'%20%3e%3cg%20style=''%20vector-effect='non-scaling-stroke'%20%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-540'%20y='-540'%20rx='0'%20ry='0'%20width='1080'%20height='1080'%20/%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3cpath%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,165,0);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20transform='%20translate(-182.9,%20-279.85)'%20d='M%20182.9%20551.7%20C%20182.9%20551.8000000000001%20183.1%20552%20183.1%20552%20C%20183.1%20552%20358.3%20283%20358.3%20194.6%20C%20358.3%2064.5%20269.5%207.900000000000006%20182.9%207.699999999999989%20C%2096.3%207.9%207.5%2064.5%207.5%20194.6%20C%207.5%20283%20182.8%20552%20182.8%20552%20C%20182.8%20552%20182.9%20551.7%20182.9%20551.7%20z%20M%20122.2%20187.2%20C%20122.2%20153.6%20149.4%20126.39999999999999%20183%20126.39999999999999%20C%20216.6%20126.39999999999999%20243.8%20153.6%20243.8%20187.2%20C%20243.8%20220.79999999999998%20216.5%20248%20182.9%20248%20C%20149.4%20248%20122.2%20220.8%20122.2%20187.2%20z'%20stroke-linecap='round'%20/%3e%3c/g%3e%3cg%20transform='matrix(3.82%200%200%203.82%200%20-100.77)'%20%3e%3ccircle%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20cx='0'%20cy='0'%20r='35'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",ni=new Image(128,128);ni.src=ns;const et=new S.Texture;et.image=ni,et.needsUpdate=!0;const bt=[.02,.03,1],os=new S.SpriteMaterial({map:et,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),oi=function(n){Y.call(this),this.texture=et;let e,t=n;this.morph=new S.Group,this.group=this.morph,this.isMarkerCluster=!0;let s=!0,i=[];this.markers={};let r=new S.Vector2,o=new S.Vector2,a=.1,u=Date.now();this.setSpriteSize=h=>{e.scale.set(.015,.02,1),e.scale.multiplyScalar(h)},this.clear=()=>{this.group.clear(),this.markers={}},this.dispose=()=>{this.clear(),this.morph&&this.morph.clear()};const f=h=>{const p=new S.Group,w=new S.Sprite(os);return w.clusterIndex=h,w.center.set(.5,0),w.position.set(0,0,0),w.renderOrder=1e4,w.scale.set(bt[0],bt[1],bt[2]),w.userData=this,p.add(w),this.group.add(p),{group:p,marker:w,label:void 0,number:0,min:[0,0,0],max:[1,1,1]}},l=(h,p,w)=>{h.group.visible=!0,h.group.position.set(p.coords[0],p.coords[1],p.coords[2]),(h.label===void 0||w!==h.number)&&(h.label&&(h.group.remove(h.label),h.label.material.map.dispose(),h.label.material.dispose()),h.label=ot(w,.012,"black","Asap",120,700),h.number=w,h.group.add(h.label)),h.min=p.min,h.max=p.max},c=h=>{let p=0;for(h.forEach(w=>{const y=w.members.length;let g=0;y===1?w.members[0].setVisibility(!0):(w.members.forEach(_=>{g+=_.getNumber(),_.setVisibility(!1)}),i[p]||i.push(f(p)),l(i[p],w,g),p++)}),p;p<i.length;p++)i[p].group.visible=!1},d=(h,p)=>{let w=!0,y={members:[],coords:[0,0,0],min:[0,0,0],max:[1,1,1]},g=0;for(let _ in h)w?(r.set(h[_].ndc.x,h[_].ndc.y),this._b1.setFromPoints([h[_].morph.position]),w=!1,y.members.push(h[_]),y.coords=[h[_].morph.position.x,h[_].morph.position.y,h[_].morph.position.z],p.push(y),delete h[_]):(o.set(h[_].ndc.x,h[_].ndc.y),g=r.distanceTo(o),a>g&&(y.members.push(h[_]),this._b1.expandByPoint(h[_].morph.position),delete h[_]));y.min=[this._b1.min.x,this._b1.min.y,this._b1.min.z],y.max=[this._b1.max.x,this._b1.max.y,this._b1.max.z],w!==!0&&d(h,p)};this.calculate=()=>{if(s&&Date.now()-u>500){let p=[];d({...this.markers},p),c(p),u=Date.now(),this.markerUpdateRequired=!1}},this.isEnabled=()=>s,this.enable=()=>{s=!0,this.morph.visible=!0},this.disable=()=>{var h;s=!1,this.morph.visible=!1;for(let p in this.markers)(h=this.markers[p])!=null&&h.isMarker&&this.markers[p].isEnabled()&&this.markers[p].setVisibility(!0)},this.zoomToCluster=h=>h!==void 0&&h>-1&&(this._v1.set(...i[h].min),this._v2.set(...i[h].max),Math.abs(this._v1.distanceTo(this._v2)>0))?(this._b1.set(this._v1,this._v2),t.translateBoundingBoxToCameraView(this._b1,3,300),this.markerUpdateRequired=!0,!0):!1,this.clusterIsVisible=h=>{var p;return h!==void 0&&h>-1&&i[h]?(p=i[h].group)==null?void 0:p.visible:!1}};oi.prototype=Object.create(Y.prototype);const as=function(n){let e=n;this.camera=new S.OrthographicCamera(-.5,.5,.5,-.5,.01,10),this.helper=void 0;let t=new S.BufferGeometry;var s=new Float32Array([-1,-1,1,1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,1]);let i=new S.BufferAttribute(s,3);t.setAttribute("position",i);var r=new S.MeshBasicMaterial({color:3355443,depthTest:!1,depthWrite:!1,opacity:.5,transparent:!0});this.mask=new S.Mesh(t,r);let o=new S.Box3,a=new S.Vector3;this.getDiffFromNormalised=(f,l)=>{o.setFromBufferAttribute(i).getCenter(a);let c=a.clone().project(this.camera);return new S.Vector3(f,l,c.z).unproject(this.camera).sub(a)};let u=(f,l)=>{e.camera.near&&(this.camera.near=e.camera.near),l.farPlane&&(this.camera.far=l.farPlane),l.eyePosition&&this.camera.position.set(l.eyePosition[0],l.eyePosition[1],l.eyePosition[2]),l.upVector&&this.camera.up.set(l.upVector[0],l.upVector[1],l.upVector[2]),l.targetPosition&&this.camera.lookAt(new S.Vector3(l.targetPosition[0],l.targetPosition[1],l.targetPosition[2])),this.camera.zoom=1/f,this.camera.updateProjectionMatrix()};this.getBoundary=()=>{let f=new S.Vector3().copy(e.camera.target).project(e.camera),l=new S.Vector3(-1,-1,f.z).unproject(e.camera),c=new S.Vector3(1,-1,f.z).unproject(e.camera),d=new S.Vector3(1,1,f.z).unproject(e.camera),h=new S.Vector3(-1,1,f.z).unproject(e.camera),p=[l,c,d,d,h,l];i.copyVector3sArray(p),i.needsUpdate=!0},this.updateCamera=()=>{this.getBoundary();let f=e.getZincCameraControls(),l=e.getBoundingBox();if(l){const c=l.min.distanceTo(l.max),d=c/2,h=(l.min.x+l.max.x)/2,p=(l.min.y+l.max.y)/2,w=(l.min.z+l.max.z)/2,g=f.getViewportFromCentreAndRadius(h,p,w,d,40,d*4);u(c,g)}}},ai=new v.Box3,tt=new v.Vector3;class xt extends v.InstancedBufferGeometry{constructor(){super(),this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],s=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(s),this.setAttribute("position",new v.Float32BufferAttribute(e,3)),this.setAttribute("uv",new v.Float32BufferAttribute(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,s=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),s.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const s=new v.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new v.InterleavedBufferAttribute(s,3,0)),this.setAttribute("instanceEnd",new v.InterleavedBufferAttribute(s,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const s=new v.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new v.InterleavedBufferAttribute(s,3,0)),this.setAttribute("instanceColorEnd",new v.InterleavedBufferAttribute(s,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new v.WireframeGeometry(e.geometry)),this}fromLineSegments(e){const t=e.geometry;if(t.isGeometry){console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.");return}else t.isBufferGeometry&&this.setPositions(t.attributes.position.array);return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new v.Box3);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),ai.setFromBufferAttribute(t),this.boundingBox.union(ai))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new v.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const s=this.boundingSphere.center;this.boundingBox.getCenter(s);let i=0;for(let r=0,o=e.count;r<o;r++)tt.fromBufferAttribute(e,r),i=Math.max(i,s.distanceToSquared(tt)),tt.fromBufferAttribute(t,r),i=Math.max(i,s.distanceToSquared(tt));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}xt.prototype.isLineSegmentsGeometry=!0,v.UniformsLib.line={linewidth:{value:1},resolution:{value:new v.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},dashOffset:{value:0},gapSize:{value:1},opacity:{value:1}},v.ShaderLib.line={uniforms:v.UniformsUtils.merge([v.UniformsLib.common,v.UniformsLib.fog,v.UniformsLib.line]),vertexShader:`
69
+ #include <common>
70
+ #include <color_pars_vertex>
71
+ #include <fog_pars_vertex>
72
+ #include <logdepthbuf_pars_vertex>
73
+ #include <clipping_planes_pars_vertex>
74
+
75
+ uniform float linewidth;
76
+ uniform vec2 resolution;
77
+
78
+ attribute vec3 instanceStart;
79
+ attribute vec3 instanceEnd;
80
+
81
+ attribute vec3 instanceColorStart;
82
+ attribute vec3 instanceColorEnd;
83
+
84
+ varying vec2 vUv;
85
+
86
+ #ifdef USE_DASH
87
+
88
+ uniform float dashScale;
89
+ attribute float instanceDistanceStart;
90
+ attribute float instanceDistanceEnd;
91
+ varying float vLineDistance;
92
+
93
+ #endif
94
+
95
+ void trimSegment( const in vec4 start, inout vec4 end ) {
96
+
97
+ // trim end segment so it terminates between the camera plane and the near plane
98
+
99
+ // conservative estimate of the near plane
100
+ float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
101
+ float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
102
+ float nearEstimate = - 0.5 * b / a;
103
+
104
+ float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
105
+
106
+ end.xyz = mix( start.xyz, end.xyz, alpha );
107
+
108
+ }
109
+
110
+ void main() {
111
+
112
+ #ifdef USE_COLOR
113
+
114
+ vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
115
+
116
+ #endif
117
+
118
+ #ifdef USE_DASH
119
+
120
+ vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
121
+
122
+ #endif
123
+
124
+ float aspect = resolution.x / resolution.y;
125
+
126
+ vUv = uv;
127
+
128
+ // camera space
129
+ vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
130
+ vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
131
+
132
+ // special case for perspective projection, and segments that terminate either in, or behind, the camera plane
133
+ // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
134
+ // but we need to perform ndc-space calculations in the shader, so we must address this issue directly
135
+ // perhaps there is a more elegant solution -- WestLangley
136
+
137
+ bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
138
+
139
+ if ( perspective ) {
140
+
141
+ if ( start.z < 0.0 && end.z >= 0.0 ) {
142
+
143
+ trimSegment( start, end );
144
+
145
+ } else if ( end.z < 0.0 && start.z >= 0.0 ) {
146
+
147
+ trimSegment( end, start );
148
+
149
+ }
150
+
151
+ }
152
+
153
+ // clip space
154
+ vec4 clipStart = projectionMatrix * start;
155
+ vec4 clipEnd = projectionMatrix * end;
156
+
157
+ // ndc space
158
+ vec2 ndcStart = clipStart.xy / clipStart.w;
159
+ vec2 ndcEnd = clipEnd.xy / clipEnd.w;
160
+
161
+ // direction
162
+ vec2 dir = ndcEnd - ndcStart;
163
+
164
+ // account for clip-space aspect ratio
165
+ dir.x *= aspect;
166
+ dir = normalize( dir );
167
+
168
+ // perpendicular to dir
169
+ vec2 offset = vec2( dir.y, - dir.x );
170
+
171
+ // undo aspect ratio adjustment
172
+ dir.x /= aspect;
173
+ offset.x /= aspect;
174
+
175
+ // sign flip
176
+ if ( position.x < 0.0 ) offset *= - 1.0;
177
+
178
+ // endcaps
179
+ if ( position.y < 0.0 ) {
180
+
181
+ offset += - dir;
182
+
183
+ } else if ( position.y > 1.0 ) {
184
+
185
+ offset += dir;
186
+
187
+ }
188
+
189
+ // adjust for linewidth
190
+ offset *= linewidth;
191
+
192
+ // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
193
+ offset /= resolution.y;
194
+
195
+ // select end
196
+ vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
197
+
198
+ // back to clip space
199
+ offset *= clip.w;
200
+
201
+ clip.xy += offset;
202
+
203
+ gl_Position = clip;
204
+
205
+ vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
206
+
207
+ #include <logdepthbuf_vertex>
208
+ #include <clipping_planes_vertex>
209
+ #include <fog_vertex>
210
+
211
+ }`,fragmentShader:`
212
+ uniform vec3 diffuse;
213
+ uniform float opacity;
214
+
215
+ #ifdef USE_DASH
216
+
217
+ uniform float dashSize;
218
+ uniform float dashOffset;
219
+ uniform float gapSize;
220
+
221
+ #endif
222
+
223
+ varying float vLineDistance;
224
+
225
+ #include <common>
226
+ #include <color_pars_fragment>
227
+ #include <fog_pars_fragment>
228
+ #include <logdepthbuf_pars_fragment>
229
+ #include <clipping_planes_pars_fragment>
230
+
231
+ varying vec2 vUv;
232
+
233
+ void main() {
234
+
235
+ #include <clipping_planes_fragment>
236
+
237
+ #ifdef USE_DASH
238
+
239
+ if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
240
+
241
+ if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
242
+
243
+ #endif
244
+
245
+ float alpha = opacity;
246
+
247
+ #ifdef ALPHA_TO_COVERAGE
248
+
249
+ // artifacts appear on some hardware if a derivative is taken within a conditional
250
+ float a = vUv.x;
251
+ float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
252
+ float len2 = a * a + b * b;
253
+ float dlen = fwidth( len2 );
254
+
255
+ if ( abs( vUv.y ) > 1.0 ) {
256
+
257
+ alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
258
+
259
+ }
260
+
261
+ #else
262
+
263
+ if ( abs( vUv.y ) > 1.0 ) {
264
+
265
+ float a = vUv.x;
266
+ float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
267
+ float len2 = a * a + b * b;
268
+
269
+ if ( len2 > 1.0 ) discard;
270
+
271
+ }
272
+
273
+ #endif
274
+
275
+ vec4 diffuseColor = vec4( diffuse, alpha );
276
+
277
+ #include <logdepthbuf_fragment>
278
+ #include <color_fragment>
279
+
280
+ gl_FragColor = vec4( diffuseColor.rgb, alpha );
281
+
282
+ #include <tonemapping_fragment>
283
+ #include <encodings_fragment>
284
+ #include <fog_fragment>
285
+ #include <premultiplied_alpha_fragment>
286
+
287
+ }`};class vt extends v.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:v.UniformsUtils.clone(v.ShaderLib.line.uniforms),vertexShader:v.ShaderLib.line.vertexShader,fragmentShader:v.ShaderLib.line.fragmentShader,clipping:!0}),Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(t){!!t!="USE_DASH"in this.defines&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return"ALPHA_TO_COVERAGE"in this.defines},set:function(t){!!t!="ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),t===!0?(this.defines.ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}vt.prototype.isLineMaterial=!0;const li=new v.Vector3,ci=new v.Vector3,de=new v.Vector4,fe=new v.Vector4,Me=new v.Vector4,wt=new v.Vector3,At=new v.Matrix4,be=new v.Line3,hi=new v.Vector3,Ce=new v.Box3,it=new v.Sphere,_e=new v.Vector4;class ui extends v.Mesh{constructor(e=new xt,t=new vt({color:Math.random()*16777215})){super(e,t),this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,s=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let o=0,a=0,u=t.count;o<u;o++,a+=2)li.fromBufferAttribute(t,o),ci.fromBufferAttribute(s,o),i[a]=a===0?0:i[a-1],i[a+1]=i[a]+li.distanceTo(ci);const r=new v.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new v.InterleavedBufferAttribute(r,1,0)),e.setAttribute("instanceDistanceEnd",new v.InterleavedBufferAttribute(r,1,1)),this}raycast(e,t){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0,i=e.ray,r=e.camera,o=r.projectionMatrix,a=this.matrixWorld,u=this.geometry,f=this.material,l=f.resolution,c=f.linewidth+s,d=u.attributes.instanceStart,h=u.attributes.instanceEnd,p=-r.near,w=2*Math.max(c/l.width,c/l.height);u.boundingSphere===null&&u.computeBoundingSphere(),it.copy(u.boundingSphere).applyMatrix4(a);const y=Math.max(r.near,it.distanceToPoint(i.origin));_e.set(0,0,-y,1).applyMatrix4(r.projectionMatrix),_e.multiplyScalar(1/_e.w),_e.applyMatrix4(r.projectionMatrixInverse);const g=Math.abs(w/_e.w)*.5;if(it.radius+=g,e.ray.intersectsSphere(it)===!1)return;u.boundingBox===null&&u.computeBoundingBox(),Ce.copy(u.boundingBox).applyMatrix4(a);const _=Math.max(r.near,Ce.distanceToPoint(i.origin));_e.set(0,0,-_,1).applyMatrix4(r.projectionMatrix),_e.multiplyScalar(1/_e.w),_e.applyMatrix4(r.projectionMatrixInverse);const A=Math.abs(w/_e.w)*.5;if(Ce.max.x+=A,Ce.max.y+=A,Ce.max.z+=A,Ce.min.x-=A,Ce.min.y-=A,Ce.min.z-=A,e.ray.intersectsBox(Ce)!==!1){i.at(1,Me),Me.w=1,Me.applyMatrix4(r.matrixWorldInverse),Me.applyMatrix4(o),Me.multiplyScalar(1/Me.w),Me.x*=l.x/2,Me.y*=l.y/2,Me.z=0,wt.copy(Me),At.multiplyMatrices(r.matrixWorldInverse,a);for(let I=0,D=d.count;I<D;I++){de.fromBufferAttribute(d,I),fe.fromBufferAttribute(h,I),de.w=1,fe.w=1,de.applyMatrix4(At),fe.applyMatrix4(At);var N=de.z>p&&fe.z>p;if(N)continue;if(de.z>p){const C=de.z-fe.z,U=(de.z-p)/C;de.lerp(fe,U)}else if(fe.z>p){const C=fe.z-de.z,U=(fe.z-p)/C;fe.lerp(de,U)}de.applyMatrix4(o),fe.applyMatrix4(o),de.multiplyScalar(1/de.w),fe.multiplyScalar(1/fe.w),de.x*=l.x/2,de.y*=l.y/2,fe.x*=l.x/2,fe.y*=l.y/2,be.start.copy(de),be.start.z=0,be.end.copy(fe),be.end.z=0;const F=be.closestPointToPointParameter(wt,!0);be.at(F,hi);const q=v.MathUtils.lerp(de.z,fe.z,F),G=q>=-1&&q<=1,T=wt.distanceTo(hi)<c*.5;if(G&&T){be.start.fromBufferAttribute(d,I),be.end.fromBufferAttribute(h,I),be.start.applyMatrix4(a),be.end.applyMatrix4(a);const C=new v.Vector3,U=new v.Vector3;i.distanceSqToSegment(be.start,be.end,U,C),t.push({point:U,pointOnLine:C,distance:i.origin.distanceTo(U),object:this,face:null,faceIndex:I,uv:null,uv2:null})}}}}}ui.prototype.LineSegments2=!0;const st=function(){Ve.call(this),this.isLines2=!0;let n=new Array(300);this.createLineSegment=(e,t,s)=>{if(e&&t){const i=new xt;i.setPositions(e),i.colorsNeedUpdate=!0;const r=new ui(i,t);r.scale.set(1,1,1),r.computeLineDistances(),this.setMesh(r,s.localTimeEnabled,s.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addVertices=function(e){if(e&&e.length){let t=this.getMorph();t||(this.drawRange=0);let s=this.drawRange*3;if(e.forEach(i=>{n[s++]=i[0],n[s++]=i[1],n[s++]=i[2],this.drawRange++}),!t)for(;s<300;)n[s++]=e[0][0],n[s++]=e[0][1],n[s++]=e[0][2];t&&(t.geometry.setPositions(n),t.computeLineDistances(),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0)}return n},this.getVerticesByFaceIndex=function(e){let t=e*2*3;const s=this.getMorph();if(s&&this.drawRange*3>t){const i=s.geometry.getAttribute("instanceStart");return[[i.data.array[t],i.data.array[++t],i.data.array[++t]],[i.data.array[++t],i.data.array[++t],i.data.array[++t]]]}return[]},this.editVertices=function(e,t){if(e&&e.length){let s=this.getMorph();const i=t+e.length-1;if(!s||0>t||i>=this.drawRange)return;{let r=t*3;for(e.forEach(o=>{n[r++]=o[0],n[r++]=o[1],n[r++]=o[2]}),r=this.drawRange*3;r<300;)n[r++]=e[0][0],n[r++]=e[0][1],n[r++]=e[0][2];s.geometry.setPositions(n),s.computeLineDistances(),s.geometry.computeBoundingBox(),s.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}return n},this.addLines=(e,t)=>{if(e&&e.length>0){if(this.addVertices(e),!this.getMorph()){const i=new vt({color:t,linewidth:1,vertexColors:!1,worldUnits:!1});i.resolution.set(window.innerWidth,window.innerHeight);const r={localTimeEnabled:!1,localMorphColour:!1};this.createLineSegment(n,i,r)}this.region&&(this.region.pickableUpdateRequired=!0)}},this.render=(e,t,s,i)=>{this.getMorph().material.resolution.set(window.innerWidth,window.innerHeight)}};st.prototype=Object.create(Ve.prototype),st.prototype.constructor=st;let ls=0;const cs=function(){return"re"+ls++};let di=function(n,e){let t=n,s=new S.Group;s.matrixAutoUpdate=!1,s.userData=this;let i=[],r="",o=[],a=e;const u=new S.Matrix4;let f=3e3;u.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this.pickableUpdateRequired=!0,this.isRegion=!0,this.uuid=cs(),this.hideAllPrimitives=()=>{i.forEach(l=>l.hideAllPrimitives()),o.forEach(l=>l.setVisibility(!1))},this.showAllPrimitives=()=>{i.forEach(l=>l.showAllPrimitives()),o.forEach(l=>l.setVisibility(!0))},this.setVisibility=l=>{l!=s.visible&&(s.visible=l,this.pickableUpdateRequired=!0)},this.getVisibility=()=>s.visible,this.getGroup=()=>s,this.setTransformation=l=>{u.set(...l),s.matrix.copy(u),s.updateMatrixWorld()},this.setName=l=>{l&&l!==""&&(r=l)},this.getName=()=>r,this.getParent=()=>t,this.getFullSeparatedPath=()=>{const l=[];if(r!==""){l.push(r);for(let c=t;c!==void 0;){const d=c.getName();d!==""&&l.unshift(d),c=c.getParent()}}return l},this.getFullPath=()=>{const l=this.getFullSeparatedPath();if(l.length>0){let c=l.shift();return l.forEach(d=>{c=c.concat("/",d)}),c}return""},this.createChild=l=>{let c=new di(this,a);return c.setName(l),i.push(c),s.add(c.getGroup()),c},this.getChildWithName=l=>{if(l){const c=l.toLowerCase();for(let d=0;d<i.length;d++)if(i[d].getName().toLowerCase()===c)return i[d]}},this.findChildFromSeparatedPath=l=>{if(l&&l.length>0&&l[0]===""&&l.shift(),l&&l.length>0){const c=this.getChildWithName(l[0]);return c?(l.shift(),c.findChildFromSeparatedPath(l)):void 0}return this},this.findChildFromPath=l=>{const c=l.split("/");return this.findChildFromSeparatedPath(c)},this.createChildFromSeparatedPath=l=>{if(l.length>0&&l[0]===""&&l.shift(),l.length>0){let c=this.getChildWithName(l[0]);return c||(c=this.createChild(l[0])),l.shift(),c.createChildFromSeparatedPath(l)}return this},this.createChildFromPath=l=>{const c=l.split("/");return this.createChildFromSeparatedPath(c)},this.findOrCreateChildFromPath=l=>{let c=this.findChildFromPath(l);return c||(c=this.createChildFromPath(l)),c},this.addZincObject=l=>{l&&(l.setRegion(this),s.add(l.getGroup()),o.push(l),this.pickableUpdateRequired=!0,a&&a.triggerObjectAddedCallback(l))},this.removeZincObject=l=>{for(let c=0;c<o.length;c++)if(l===o[c]){s.remove(l.getGroup()),o.splice(c,1),a&&a.triggerObjectRemovedCallback(l),l.dispose(),this.pickableUpdateRequired=!0;return}},this.checkPickableUpdateRequred=l=>{if(this.pickableUpdateRequired)return!0;if(l){let c=!1;for(let d=0;d<i.length;d++)if(c=i[d].checkPickableUpdateRequred(l),c)return!0}return!1},this.getPickableThreeJSObjects=(l,c)=>(s.visible&&(o.forEach(d=>{if(d.isPickable&&d.getGroup()&&d.getGroup().visible){let h=d.marker;h&&h.isEnabled()&&l.push(h.getMorph()),l.push(d.getGroup())}}),c&&i.forEach(d=>{d.getPickableThreeJSObjects(l,c)}),this.pickableUpdateRequired=!1),l),this.setDuration=l=>{f=l,o.forEach(c=>c.setDuration(l)),i.forEach(c=>c.setDuration(l))},this.getDuration=()=>f,this.getBoundingBox=l=>{let c,d;return o.forEach(h=>{d=h.getBoundingBox(),d&&(c==null?c=d.clone():c.union(d))}),l&&i.forEach(h=>{d=h.getBoundingBox(l),d&&(c==null?c=d.clone():c.union(d))}),c},this.clear=l=>{l&&i.forEach(c=>c.clear(l)),o.forEach(c=>{s.remove(c.getGroup()),c.dispose()}),i=[],o=[]},this.objectIsInRegion=(l,c)=>{for(let d=0;d<o.length;d++)if(l===o[d])return!0;if(c){for(let d=0;d<i.length;d++)if(i[d].objectIsInRegion(l,c))return!0}return!1},this.forEachGeometry=(l,c)=>{o.forEach(d=>{d.isGeometry&&l(d)}),c&&i.forEach(d=>d.forEachGeometry(l,c))},this.forEachGlyphset=(l,c)=>{o.forEach(d=>{d.isGlyphset&&l(d)}),c&&i.forEach(d=>d.forEachGlyphset(l,c))},this.forEachPointset=(l,c)=>{o.forEach(d=>{d.isPointset&&l(d)}),c&&i.forEach(d=>d.forEachPointset(l,c))},this.forEachLine=(l,c)=>{o.forEach(d=>{d.isLines&&l(d)}),c&&i.forEach(d=>d.forEachLine(l,c))},this.findObjectsWithAnatomicalId=(l,c)=>{const d=[];return o.forEach(h=>{h.anatomicalId===l&&d.push(h)}),c&&i.forEach(h=>{let p=h.findObjectsWithAnatomicalId(l,c);d.push(...p)}),d},this.findObjectsWithGroupName=(l,c)=>{const d=[];return o.forEach(h=>{const p=h.groupName?h.groupName.toLowerCase():h.groupName,w=l&&l.toLowerCase();p===w&&d.push(h)}),c&&i.forEach(h=>{let p=h.findObjectsWithGroupName(l,c);d.push(...p)}),d},this.findGeometriesWithGroupName=(l,c)=>this.findObjectsWithGroupName(l,c).filter(p=>p.isGeometry),this.findPointsetsWithGroupName=(l,c)=>this.findObjectsWithGroupName(l,c).filter(p=>p.isPointset),this.findGlyphsetsWithGroupName=(l,c)=>this.findObjectsWithGroupName(l,c).filter(p=>p.isGlyphset),this.findLinesWithGroupName=(l,c)=>this.findObjectsWithGroupName(l,c).filter(p=>p.isLines),this.getAllObjects=l=>{const c=[...o];return l&&i.forEach(d=>{let h=d.getAllObjects(l);c.push(...h)}),c},this.getChildRegions=l=>{const c=[...i];return l&&i.forEach(d=>{const h=d.getChildRegions(l);c.push(...h)}),c},this.getCurrentTime=()=>{if(o[0]!=null)return o[0].getCurrentTime();for(let l=0;l<i.length;l++){const c=i[l].getCurrentTime();if(c!==-1)return c}return-1},this.setMorphTime=(l,c)=>{o.forEach(d=>{d.setMorphTime(l)}),c&&i.forEach(d=>{d.setMorphTime(l)})},this.isTimeVarying=()=>{for(let l=0;l<o.length;l++)if(o[l].isTimeVarying())return!0;for(let l=0;l<i.length;l++)if(i[l].isTimeVarying())return!0;return!1},this.renderGeometries=(l,c,d,h,p,w)=>{var g;this.getAllObjects(w).forEach(_=>{_.render(l*c,d,h,p)}),p&&d===!1&&((g=p.markerCluster)!=null&&g.markerUpdateRequired)&&p.markerCluster.calculate()},this.createPoints=(l,c,d,h)=>{let p=!1;const w=this.findObjectsWithGroupName(l,!1),y=w.findIndex(_=>_.isPointset),g=y>-1?w[y]:new Te;return g.addPoints(c,d,h),y===-1?(g.setName(l),this.addZincObject(g),p=!0):this.pickableUpdateRequired=!0,{zincObject:g,isNew:p}},this.createLines=(l,c,d)=>{let h=!1;const p=this.findObjectsWithGroupName(l,!1),w=p.findIndex(g=>g.isLines),y=w>-1?p[w]:new st;return y.addLines(c,d),w===-1?(y.setName(l),this.addZincObject(y),h=!0):this.pickableUpdateRequired=!0,{zincObject:y,isNew:h}},this.createGeometryFromThreeJSGeometry=(l,c,d,h,p,w)=>{const y=new Fe,g=new S.MeshPhongMaterial({color:d,morphTargets:!1,morphNormals:!1,transparent:!0,opacity:h,side:S.DoubleSide});if(y.createMesh(c,g,{localTimeEnabled:!1,localMorphColour:!1}),y.getMorph())return y.setVisibility(!1),y.setName(l),y.setRenderOrder(w),this.addZincObject(y),y}};class Mt{constructor(){this.pluginCallbacks=[],this.register(function(e){return new bs(e)}),this.register(function(e){return new xs(e)}),this.register(function(e){return new vs(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s){const i=new ys,r=[];for(let o=0,a=this.pluginCallbacks.length;o<a;o++)r.push(this.pluginCallbacks[o](i));i.setPlugins(r),i.write(e,t,s)}}const se={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,FLOAT:5126,UNSIGNED_INT:5125,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},ge={};ge[v.NearestFilter]=se.NEAREST,ge[v.NearestMipmapNearestFilter]=se.NEAREST_MIPMAP_NEAREST,ge[v.NearestMipmapLinearFilter]=se.NEAREST_MIPMAP_LINEAR,ge[v.LinearFilter]=se.LINEAR,ge[v.LinearMipmapNearestFilter]=se.LINEAR_MIPMAP_NEAREST,ge[v.LinearMipmapLinearFilter]=se.LINEAR_MIPMAP_LINEAR,ge[v.ClampToEdgeWrapping]=se.CLAMP_TO_EDGE,ge[v.RepeatWrapping]=se.REPEAT,ge[v.MirroredRepeatWrapping]=se.MIRRORED_REPEAT;const fi={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},pi=12,hs=1179937895,us=2,mi=8,ds=1313821514,fs=5130562;function ze(n,e){return n.length===e.length&&n.every(function(t,s){return t===e[s]})}function ps(n){if(window.TextEncoder!==void 0)return new TextEncoder().encode(n).buffer;const e=new Uint8Array(new ArrayBuffer(n.length));for(let t=0,s=n.length;t<s;t++){const i=n.charCodeAt(t);e[t]=i>255?32:i}return e.buffer}function ms(n){return ze(n.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function gs(n,e,t){const s={min:new Array(n.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(n.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let i=e;i<e+t;i++)for(let r=0;r<n.itemSize;r++){let o;n.itemSize>4?o=n.array[i*n.itemSize+r]:r===0?o=n.getX(i):r===1?o=n.getY(i):r===2?o=n.getZ(i):r===3&&(o=n.getW(i)),s.min[r]=Math.min(s.min[r],o),s.max[r]=Math.max(s.max[r],o)}return s}function gi(n){return Math.ceil(n/4)*4}function _t(n,e=0){const t=gi(n.byteLength);if(t!==n.byteLength){const s=new Uint8Array(t);if(s.set(new Uint8Array(n)),e!==0)for(let i=n.byteLength;i<t;i++)s[i]=e;return s.buffer}return n}let yi=null;class ys{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}write(e,t,s){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},s),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e);const i=this;Promise.all(this.pending).then(function(){const r=i.buffers,o=i.json,a=i.options,u=i.extensionsUsed,f=new Blob(r,{type:"application/octet-stream"}),l=Object.keys(u);if(l.length>0&&(o.extensionsUsed=l),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=f.size),a.binary===!0){const c=new window.FileReader;c.readAsArrayBuffer(f),c.onloadend=function(){const d=_t(c.result),h=new DataView(new ArrayBuffer(mi));h.setUint32(0,d.byteLength,!0),h.setUint32(4,fs,!0);const p=_t(ps(JSON.stringify(o)),32),w=new DataView(new ArrayBuffer(mi));w.setUint32(0,p.byteLength,!0),w.setUint32(4,ds,!0);const y=new ArrayBuffer(pi),g=new DataView(y);g.setUint32(0,hs,!0),g.setUint32(4,us,!0);const _=pi+w.byteLength+p.byteLength+h.byteLength+d.byteLength;g.setUint32(8,_,!0);const A=new Blob([y,w,p,h,d],{type:"application/octet-stream"}),N=new window.FileReader;N.readAsArrayBuffer(A),N.onloadend=function(){t(N.result)}}}else if(o.buffers&&o.buffers.length>0){const c=new window.FileReader;c.readAsDataURL(f),c.onloadend=function(){const d=c.result;o.buffers[0].uri=d,t(o)}}else t(o)})}serializeUserData(e,t){if(e.userData&&e.userData.isZincObject||Object.keys(e.userData).length===0)return;const s=this.options,i=this.extensionsUsed;try{const r=JSON.parse(JSON.stringify(e.userData));if(s.includeCustomExtensions&&r.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const o in r.gltfExtensions)t.extensions[o]=r.gltfExtensions[o],i[o]=!0;delete r.gltfExtensions}Object.keys(r).length>0&&(t.extras=r)}catch(r){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+r.message)}}getUID(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const s=new v.Vector3;for(let i=0,r=e.count;i<r;i++)if(Math.abs(s.fromBufferAttribute(e,i).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const s=e.clone(),i=new v.Vector3;for(let r=0,o=s.count;r<o;r++)i.fromBufferAttribute(s,r),i.x===0&&i.y===0&&i.z===0?i.setX(1):i.normalize(),s.setXYZ(r,i.x,i.y,i.z);return t.attributesNormalized.set(e,s),s}applyTextureTransform(e,t){let s=!1;const i={};(t.offset.x!==0||t.offset.y!==0)&&(i.offset=t.offset.toArray(),s=!0),t.rotation!==0&&(i.rotation=t.rotation,s=!0),(t.repeat.x!==1||t.repeat.y!==1)&&(i.scale=t.repeat.toArray(),s=!0),s&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=i,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(e){const t=this.json,s=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),s.push(e),0}processBufferView(e,t,s,i,r){const o=this.json;o.bufferViews||(o.bufferViews=[]);let a;t===se.UNSIGNED_BYTE?a=1:t===se.UNSIGNED_SHORT?a=2:a=4;const u=gi(i*e.itemSize*a),f=new DataView(new ArrayBuffer(u));let l=0;for(let h=s;h<s+i;h++)for(let p=0;p<e.itemSize;p++){let w;e.itemSize>4?w=e.array[h*e.itemSize+p]:p===0?w=e.getX(h):p===1?w=e.getY(h):p===2?w=e.getZ(h):p===3&&(w=e.getW(h)),t===se.FLOAT?f.setFloat32(l,w,!0):t===se.UNSIGNED_INT?f.setUint32(l,w,!0):t===se.UNSIGNED_SHORT?f.setUint16(l,w,!0):t===se.UNSIGNED_BYTE&&f.setUint8(l,w),l+=a}const c={buffer:this.processBuffer(f.buffer),byteOffset:this.byteOffset,byteLength:u};return r!==void 0&&(c.target=r),r===se.ARRAY_BUFFER&&(c.byteStride=e.itemSize*a),this.byteOffset+=u,o.bufferViews.push(c),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,s=t.json;return s.bufferViews||(s.bufferViews=[]),new Promise(function(i){const r=new window.FileReader;r.readAsArrayBuffer(e),r.onloadend=function(){const o=_t(r.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,i(s.bufferViews.push(a)-1)}})}processAccessor(e,t,s,i){const r=this.options,o=this.json,a={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"};let u;if(e.array.constructor===Float32Array)u=se.FLOAT;else if(e.array.constructor===Uint32Array)u=se.UNSIGNED_INT;else if(e.array.constructor===Uint16Array)u=se.UNSIGNED_SHORT;else if(e.array.constructor===Uint8Array)u=se.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");if(s===void 0&&(s=0),i===void 0&&(i=e.count),r.truncateDrawRange&&t!==void 0&&t.index===null){const h=s+i,p=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count;s=Math.max(s,t.drawRange.start),i=Math.min(h,p)-s,i<0&&(i=0)}if(i===0)return null;const f=gs(e,s,i);let l;t!==void 0&&(l=e===t.index?se.ELEMENT_ARRAY_BUFFER:se.ARRAY_BUFFER);const c=this.processBufferView(e,u,s,i,l),d={bufferView:c.id,byteOffset:c.byteOffset,componentType:u,count:i,max:f.max,min:f.min,type:a[e.itemSize]};return e.normalized===!0&&(d.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(d)-1}processImage(e,t,s){const i=this,r=i.cache,o=i.json,a=i.options,u=i.pending;r.images.has(e)||r.images.set(e,{});const f=r.images.get(e),l=t===v.RGBAFormat?"image/png":"image/jpeg",c=l+":flipY/"+s.toString();if(f[c]!==void 0)return f[c];o.images||(o.images=[]);const d={mimeType:l};if(a.embedImages){const p=yi=yi||document.createElement("canvas");p.width=Math.min(e.width,a.maxTextureSize),p.height=Math.min(e.height,a.maxTextureSize);const w=p.getContext("2d");if(s===!0&&(w.translate(0,p.height),w.scale(1,-1)),typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas||typeof ImageBitmap<"u"&&e instanceof ImageBitmap)w.drawImage(e,0,0,p.width,p.height);else{t!==v.RGBAFormat&&t!==v.RGBFormat&&console.error("GLTFExporter: Only RGB and RGBA formats are supported."),(e.width>a.maxTextureSize||e.height>a.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const y=new Uint8ClampedArray(e.height*e.width*4);if(t===v.RGBAFormat)for(let g=0;g<y.length;g+=4)y[g+0]=e.data[g+0],y[g+1]=e.data[g+1],y[g+2]=e.data[g+2],y[g+3]=e.data[g+3];else for(let g=0,_=0;g<y.length;g+=4,_+=3)y[g+0]=e.data[_+0],y[g+1]=e.data[_+1],y[g+2]=e.data[_+2],y[g+3]=255;w.putImageData(new ImageData(y,e.width,e.height),0,0)}a.binary===!0?u.push(new Promise(function(y){p.toBlob(function(g){i.processBufferViewImage(g).then(function(_){d.bufferView=_,y()})},l)})):d.uri=p.toDataURL(l)}else d.uri=e.src;const h=o.images.push(d)-1;return f[c]=h,h}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const s={magFilter:ge[e.magFilter],minFilter:ge[e.minFilter],wrapS:ge[e.wrapS],wrapT:ge[e.wrapT]};return t.samplers.push(s)-1}processTexture(e){const t=this.cache,s=this.json;if(t.textures.has(e))return t.textures.get(e);s.textures||(s.textures=[]);const i={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY)};e.name&&(i.name=e.name),this._invokeAll(function(o){o.writeTexture&&o.writeTexture(e,i)});const r=s.textures.push(i)-1;return t.textures.set(e,r),r}processMaterial(e){const t=this.cache,s=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;s.materials||(s.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const r=e.color.toArray().concat([e.opacity]);if(ze(r,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=r),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap)if(e.metalnessMap===e.roughnessMap){const a={index:this.processTexture(e.metalnessMap)};this.applyTextureTransform(a,e.metalnessMap),i.pbrMetallicRoughness.metallicRoughnessTexture=a}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(e.map){const a={index:this.processTexture(e.map)};this.applyTextureTransform(a,e.map),i.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){const a=e.emissive.clone().multiplyScalar(e.emissiveIntensity),u=Math.max(a.r,a.g,a.b);if(u>1&&(a.multiplyScalar(1/u),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),u>0&&(i.emissiveFactor=a.toArray()),e.emissiveMap){const f={index:this.processTexture(e.emissiveMap)};this.applyTextureTransform(f,e.emissiveMap),i.emissiveTexture=f}}if(e.normalMap){const a={index:this.processTexture(e.normalMap)};e.normalScale&&e.normalScale.x!==-1&&(e.normalScale.x!==e.normalScale.y&&console.warn("THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X."),a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),i.normalTexture=a}if(e.aoMap){const a={index:this.processTexture(e.aoMap),texCoord:1};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),i.occlusionTexture=a}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===v.DoubleSide&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,i)});const o=s.materials.push(i)-1;return t.materials.set(e,o),o}processMesh(e){const t=this.cache,s=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let A=0,N=e.material.length;A<N;A++)i.push(e.material[A].uuid);else i.push(e.material.uuid);const r=i.join(":");if(t.meshes.has(r))return t.meshes.get(r);const o=e.geometry;let a;if(e.isLineSegments?a=se.LINES:e.isLineLoop?a=se.LINE_LOOP:e.isLine?a=se.LINE_STRIP:e.isPoints?a=se.POINTS:a=e.material.wireframe?se.LINES:se.TRIANGLES,o.isBufferGeometry!==!0)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");const u={},f={},l=[],c=[],d={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},h=o.getAttribute("normal");h!==void 0&&!this.isNormalizedNormalAttribute(h)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),o.setAttribute("normal",this.createNormalizedNormalAttribute(h)));let p=null;for(let A in o.attributes){if(A.substr(0,5)==="morph")continue;const N=o.attributes[A];if(A=d[A]||A.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(A)||(A="_"+A),t.attributes.has(this.getUID(N))){f[A]=t.attributes.get(this.getUID(N));continue}p=null;const D=N.array;A==="JOINTS_0"&&!(D instanceof Uint16Array)&&!(D instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),p=new v.BufferAttribute(new Uint16Array(D),N.itemSize,N.normalized));const F=this.processAccessor(p||N,o);F!==null&&(f[A]=F,t.attributes.set(this.getUID(N),F))}if(h!==void 0&&o.setAttribute("normal",h),Object.keys(f).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const A=[],N=[],I={};if(e.morphTargetDictionary!==void 0)for(const D in e.morphTargetDictionary)I[e.morphTargetDictionary[D]]=D;for(let D=0;D<e.morphTargetInfluences.length;++D){const F={};let q=!1;for(const G in o.morphAttributes){if(G!=="position"&&G!=="normal"&&G!=="color"){q||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),q=!0);continue}const T=o.morphAttributes[G][D];let C=G.toUpperCase();d[G]&&(C=d[G]);const U=o.attributes[G];if(t.attributes.has(this.getUID(T))){F[C]=t.attributes.get(this.getUID(T));continue}const M=U.clone();if(!o.morphTargetsRelative)if(U)for(let O=0,k=T.count;O<k;O++)U.count>O&&M.setXYZ(O,T.getX(O)-U.getX(O),T.getY(O)-U.getY(O),T.getZ(O)-U.getZ(O));else for(let O=0,k=T.count;O<k;O++)M.setXYZ(O,0,0,0);F[C]=this.processAccessor(M,o),t.attributes.set(this.getUID(U),F[C])}c.push(F),A.push(e.morphTargetInfluences[D]),e.morphTargetDictionary!==void 0&&N.push(I[D])}u.weights=A,N.length>0&&(u.extras={},u.extras.targetNames=N)}const w=Array.isArray(e.material);if(w&&o.groups.length===0)return null;const y=w?e.material:[e.material],g=w?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let A=0,N=g.length;A<N;A++){const I={mode:a,attributes:f};if(this.serializeUserData(o,I),c.length>0&&(I.targets=c),o.index!==null){let F=this.getUID(o.index);(g[A].start!==void 0||g[A].count!==void 0)&&(F+=":"+g[A].start+":"+g[A].count),t.attributes.has(F)?I.indices=t.attributes.get(F):(I.indices=this.processAccessor(o.index,o,g[A].start,g[A].count),t.attributes.set(F,I.indices)),I.indices===null&&delete I.indices}const D=this.processMaterial(y[g[A].materialIndex]);D!==null&&(I.material=D),l.push(I)}u.primitives=l,s.meshes||(s.meshes=[]),this._invokeAll(function(A){A.writeMesh&&A.writeMesh(e,u)});const _=s.meshes.push(u)-1;return t.meshes.set(r,_),_}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const s=e.isOrthographicCamera,i={type:s?"orthographic":"perspective"};return s?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:v.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),t.cameras.push(i)-1}processAnimation(e,t){const s=this.json,i=this.nodeMap;s.animations||(s.animations=[]),e=Mt.Utils.mergeMorphTargetTracks(e.clone(),t);const r=e.tracks,o=[],a=[];for(let u=0;u<r.length;++u){const f=r[u],l=v.PropertyBinding.parseTrackName(f.name);let c=v.PropertyBinding.findNode(t,l.nodeName);const d=fi[l.propertyName];if(l.objectName==="bones"&&(c.isSkinnedMesh===!0?c=c.skeleton.getBoneByName(l.objectIndex):c=void 0),!c||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',f.name),null;const h=1;let p=f.values.length/f.times.length;d===fi.morphTargetInfluences&&(p/=c.morphTargetInfluences.length);let w;f.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(w="CUBICSPLINE",p/=3):f.getInterpolation()===v.InterpolateDiscrete?w="STEP":w="LINEAR",a.push({input:this.processAccessor(new v.BufferAttribute(f.times,h)),output:this.processAccessor(new v.BufferAttribute(f.values,p)),interpolation:w}),o.push({sampler:a.length-1,target:{node:i.get(c),path:d}})}return s.animations.push({name:e.name||"clip_"+s.animations.length,samplers:a,channels:o}),s.animations.length-1}processSkin(e){const t=this.json,s=this.nodeMap,i=t.nodes[s.get(e)],r=e.skeleton;if(r===void 0)return null;const o=e.skeleton.bones[0];if(o===void 0)return null;const a=[],u=new Float32Array(r.bones.length*16),f=new v.Matrix4;for(let c=0;c<r.bones.length;++c)a.push(s.get(r.bones[c])),f.copy(r.boneInverses[c]),f.multiply(e.bindMatrix).toArray(u,c*16);return t.skins===void 0&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new v.BufferAttribute(u,16)),joints:a,skeleton:s.get(o)}),i.skin=t.skins.length-1}processNode(e){const t=this.json,s=this.options,i=this.nodeMap;t.nodes||(t.nodes=[]);const r={};if(s.trs){const a=e.quaternion.toArray(),u=e.position.toArray(),f=e.scale.toArray();ze(a,[0,0,0,1])||(r.rotation=a),ze(u,[0,0,0])||(r.translation=u),ze(f,[1,1,1])||(r.scale=f)}else e.matrixAutoUpdate&&e.updateMatrix(),ms(e.matrix)===!1&&(r.matrix=e.matrix.elements);if(e.name!==""&&(r.name=String(e.name)),this.serializeUserData(e,r),e.isMesh||e.isLine||e.isPoints){const a=this.processMesh(e);a!==null&&(r.mesh=a)}else e.isCamera&&(r.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const a=[];for(let u=0,f=e.children.length;u<f;u++){const l=e.children[u];if(l.visible||s.onlyVisible===!1){const c=this.processNode(l);c!==null&&a.push(c)}}a.length>0&&(r.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,r)});const o=t.nodes.push(r)-1;return i.set(e,o),o}processScene(e){const t=this.json,s=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);const r=[];for(let o=0,a=e.children.length;o<a;o++){const u=e.children[o];if(u.visible||s.onlyVisible===!1){const f=this.processNode(u);f!==null&&r.push(f)}}r.length>0&&(i.nodes=r),this.serializeUserData(e,i)}processObjects(e){const t=new v.Scene;t.name="AuxScene";for(let s=0;s<e.length;s++)t.children.push(e[s]);this.processScene(t)}processInput(e){const t=this.options;e=e instanceof Array?e:[e],this._invokeAll(function(i){i.beforeParse&&i.beforeParse(e)});const s=[];for(let i=0;i<e.length;i++)e[i]instanceof v.Scene?this.processScene(e[i]):s.push(e[i]);s.length>0&&this.processObjects(s);for(let i=0;i<this.skins.length;++i)this.processSkin(this.skins[i]);for(let i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i].clip,t.animations[i].mesh);this._invokeAll(function(i){i.afterParse&&i.afterParse(e)})}_invokeAll(e){for(let t=0,s=this.plugins.length;t<s;t++)e(this.plugins[t])}}class bs{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}const s=this.writer,i=s.json,r=s.extensionsUsed,o={};e.name&&(o.name=e.name),o.color=e.color.toArray(),o.intensity=e.intensity,e.isDirectionalLight?o.type="directional":e.isPointLight?(o.type="point",e.distance>0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,o.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),r[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},r[this.name]=!0);const a=i.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}}class xs{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class vs{constructor(e){this.writer=e,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(e,t){if(!e.isGLTFSpecularGlossinessMaterial)return;const s=this.writer,i=s.extensionsUsed,r={};t.pbrMetallicRoughness.baseColorFactor&&(r.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);const o=[1,1,1];if(e.specular.toArray(o,0),r.specularFactor=o,r.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(r.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap){const a={index:s.processTexture(e.specularMap)};s.applyTextureTransform(a,e.specularMap),r.specularGlossinessTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=r,i[this.name]=!0}}Mt.Utils={insertKeyframe:function(n,e){const s=n.getValueSize(),i=new n.TimeBufferType(n.times.length+1),r=new n.ValueBufferType(n.values.length+s),o=n.createInterpolant(new n.ValueBufferType(s));let a;if(n.times.length===0){i[0]=e;for(let u=0;u<s;u++)r[u]=0;a=0}else if(e<n.times[0]){if(Math.abs(n.times[0]-e)<.001)return 0;i[0]=e,i.set(n.times,1),r.set(o.evaluate(e),0),r.set(n.values,s),a=0}else if(e>n.times[n.times.length-1]){if(Math.abs(n.times[n.times.length-1]-e)<.001)return n.times.length-1;i[i.length-1]=e,i.set(n.times,0),r.set(n.values,0),r.set(o.evaluate(e),n.values.length),a=i.length-1}else for(let u=0;u<n.times.length;u++){if(Math.abs(n.times[u]-e)<.001)return u;if(n.times[u]<e&&n.times[u+1]>e){i.set(n.times.slice(0,u+1),0),i[u+1]=e,i.set(n.times.slice(u+1),u+2),r.set(n.values.slice(0,(u+1)*s),0),r.set(o.evaluate(e),(u+1)*s),r.set(n.values.slice((u+1)*s),(u+2)*s),a=u+1;break}}return n.times=i,n.values=r,a},mergeMorphTargetTracks:function(n,e){const t=[],s={},i=n.tracks;for(let r=0;r<i.length;++r){let o=i[r];const a=v.PropertyBinding.parseTrackName(o.name),u=v.PropertyBinding.findNode(e,a.nodeName);if(a.propertyName!=="morphTargetInfluences"||a.propertyIndex===void 0){t.push(o);continue}if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),o=o.clone(),o.setInterpolation(v.InterpolateLinear)}const f=u.morphTargetInfluences.length,l=u.morphTargetDictionary[a.propertyIndex];if(l===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let c;if(s[u.uuid]===void 0){c=o.clone();const h=new c.ValueBufferType(f*c.times.length);for(let p=0;p<c.times.length;p++)h[p*f+l]=c.values[p];c.name=(a.nodeName||"")+".morphTargetInfluences",c.values=h,s[u.uuid]=c,t.push(c);continue}const d=o.createInterpolant(new o.ValueBufferType(1));c=s[u.uuid];for(let h=0;h<c.times.length;h++)c.values[h*f+l]=d.evaluate(c.times[h]);for(let h=0;h<o.times.length;h++){const p=this.insertKeyframe(c,o.times[h]);c.values[p*f+l]=o.values[h]}}return n.tracks=t,n}};const ws=function(n){const e=n;this.exportGLTF=t=>{const i=e.getRootRegion().getAllObjects(!0),r=[];i.forEach(u=>{u.animationClip&&r.push({clip:u.animationClip[0],mesh:u.getMorph()})});const o=new Mt,a={binary:t,animations:r};return new Promise((u,f)=>{o.parse(e.getThreeJSScene(),function(l){u(l)},a)})}},As=function(){const n=this;this.parseGLTFObjects=(e,t,s,i)=>{let r=t;if(s!==0)if(e.type==="Object3D"){if(e.name!==""&&(t&&(r=t.findOrCreateChildFromPath(e.name)),r)){const o=r.getGroup();o.position.copy(e.position),o.rotation.copy(e.rotation),o.quaternion.copy(e.quaternion),o.matrixAutoUpdate=!0}}else{let o;if(e.type==="Mesh"?o=new Fe:e.type==="LineSegments"?o=new Ve:e.type==="Points"&&(o=new Te),o){let a=!1,u=!1;e.geometry&&e.geometry.morphAttributes&&(a=!!e.geometry.morphAttributes.position,u=!!e.geometry.morphAttributes.color),o.setMesh(e.clone(),a,u);const f=o.getMorph();o.groupName=f.name,f.matrixAutoUpdate=!0,t.addZincObject(o),i!=null&&typeof i=="function"&&i(o)}}s++,e.children.forEach(o=>{n.parseGLTFObjects(o,r,s,i)})},this.setCamera=e=>{e.viewAll();const t=e.getZincCameraControls(),s=t.getCurrentViewport();t.addViewport("default",s),t.setDefaultViewport("default")},this.load=(e,t,s,i,r,o)=>{const a=s.substring(0,s.lastIndexOf("/")+1),u=s.substring(s.lastIndexOf("/")+1,s.length);new Bi.GLTFLoader().setPath(a).load(u,function(l){console.log(l),n.parseGLTFObjects(l.scene,t,0,i),n.setCamera(e),r!=null&&typeof r=="function"&&r()})}},Ms=/^[og]\s*(.+)?/,_s=/^mtllib /,Ss=/^usemtl /,Cs=/^usemap /,bi=new v.Vector3,St=new v.Vector3,xi=new v.Vector3,vi=new v.Vector3,xe=new v.Vector3;function Os(){const n={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}const s=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(i,r){const o=this._finalize(!1);o&&(o.inherited||o.groupCount<=0)&&this.materials.splice(o.index,1);const a={index:this.materials.length,name:i||"",mtllib:Array.isArray(r)&&r.length>0?r[r.length-1]:"",smooth:o!==void 0?o.smooth:this.smooth,groupStart:o!==void 0?o.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(u){const f={index:typeof u=="number"?u:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return f.clone=this.clone.bind(f),f}};return this.materials.push(a),a},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(i){const r=this.currentMaterial();if(r&&r.groupEnd===-1&&(r.groupEnd=this.geometry.vertices.length/3,r.groupCount=r.groupEnd-r.groupStart,r.inherited=!1),i&&this.materials.length>1)for(let o=this.materials.length-1;o>=0;o--)this.materials[o].groupCount<=0&&this.materials.splice(o,1);return i&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),r}},s&&s.name&&typeof s.clone=="function"){const i=s.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const s=parseInt(e,10);return(s>=0?s-1:s+t/3)*3},parseNormalIndex:function(e,t){const s=parseInt(e,10);return(s>=0?s-1:s+t/3)*3},parseUVIndex:function(e,t){const s=parseInt(e,10);return(s>=0?s-1:s+t/2)*2},addVertex:function(e,t,s){const i=this.vertices,r=this.object.geometry.vertices;r.push(i[e+0],i[e+1],i[e+2]),r.push(i[t+0],i[t+1],i[t+2]),r.push(i[s+0],i[s+1],i[s+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,s){const i=this.normals,r=this.object.geometry.normals;r.push(i[e+0],i[e+1],i[e+2]),r.push(i[t+0],i[t+1],i[t+2]),r.push(i[s+0],i[s+1],i[s+2])},addFaceNormal:function(e,t,s){const i=this.vertices,r=this.object.geometry.normals;bi.fromArray(i,e),St.fromArray(i,t),xi.fromArray(i,s),xe.subVectors(xi,St),vi.subVectors(bi,St),xe.cross(vi),xe.normalize(),r.push(xe.x,xe.y,xe.z),r.push(xe.x,xe.y,xe.z),r.push(xe.x,xe.y,xe.z)},addColor:function(e,t,s){const i=this.colors,r=this.object.geometry.colors;i[e]!==void 0&&r.push(i[e+0],i[e+1],i[e+2]),i[t]!==void 0&&r.push(i[t+0],i[t+1],i[t+2]),i[s]!==void 0&&r.push(i[s+0],i[s+1],i[s+2])},addUV:function(e,t,s){const i=this.uvs,r=this.object.geometry.uvs;r.push(i[e+0],i[e+1]),r.push(i[t+0],i[t+1]),r.push(i[s+0],i[s+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,s,i,r,o,a,u,f){const l=this.vertices.length;let c=this.parseVertexIndex(e,l),d=this.parseVertexIndex(t,l),h=this.parseVertexIndex(s,l);if(this.addVertex(c,d,h),this.addColor(c,d,h),a!==void 0&&a!==""){const p=this.normals.length;c=this.parseNormalIndex(a,p),d=this.parseNormalIndex(u,p),h=this.parseNormalIndex(f,p),this.addNormal(c,d,h)}else this.addFaceNormal(c,d,h);if(i!==void 0&&i!==""){const p=this.uvs.length;c=this.parseUVIndex(i,p),d=this.parseUVIndex(r,p),h=this.parseUVIndex(o,p),this.addUV(c,d,h),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let s=0,i=e.length;s<i;s++){const r=this.parseVertexIndex(e[s],t);this.addVertexPoint(r),this.addColor(r)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const s=this.vertices.length,i=this.uvs.length;for(let r=0,o=e.length;r<o;r++)this.addVertexLine(this.parseVertexIndex(e[r],s));for(let r=0,o=t.length;r<o;r++)this.addUVLine(this.parseUVIndex(t[r],i))}};return n.startObject("",!1),n}class wi extends v.Loader{constructor(e){super(e),this.materials=null}load(e,t,s,i){const r=this,o=new v.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(a))}catch(u){i?i(u):console.error(u),r.manager.itemError(e)}},s,i)}setMaterials(e){return this.materials=e,this}parse(e){const t=new Os;e.indexOf(`\r
288
+ `)!==-1&&(e=e.replace(/\r\n/g,`
289
+ `)),e.indexOf(`\\
290
+ `)!==-1&&(e=e.replace(/\\\n/g,""));const s=e.split(`
291
+ `);let i="",r="",o=0,a=[];const u=typeof"".trimLeft=="function";for(let c=0,d=s.length;c<d;c++)if(i=s[c],i=u?i.trimLeft():i.trim(),o=i.length,o!==0&&(r=i.charAt(0),r!=="#"))if(r==="v"){const h=i.split(/\s+/);switch(h[0]){case"v":t.vertices.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])),h.length>=7?t.colors.push(parseFloat(h[4]),parseFloat(h[5]),parseFloat(h[6])):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3]));break;case"vt":t.uvs.push(parseFloat(h[1]),parseFloat(h[2]));break}}else if(r==="f"){const p=i.substr(1).trim().split(/\s+/),w=[];for(let g=0,_=p.length;g<_;g++){const A=p[g];if(A.length>0){const N=A.split("/");w.push(N)}}const y=w[0];for(let g=1,_=w.length-1;g<_;g++){const A=w[g],N=w[g+1];t.addFace(y[0],A[0],N[0],y[1],A[1],N[1],y[2],A[2],N[2])}}else if(r==="l"){const h=i.substring(1).trim().split(" ");let p=[];const w=[];if(i.indexOf("/")===-1)p=h;else for(let y=0,g=h.length;y<g;y++){const _=h[y].split("/");_[0]!==""&&p.push(_[0]),_[1]!==""&&w.push(_[1])}t.addLineGeometry(p,w)}else if(r==="p"){const p=i.substr(1).trim().split(" ");t.addPointGeometry(p)}else if((a=Ms.exec(i))!==null){const h=(" "+a[0].substr(1).trim()).substr(1);t.startObject(h)}else if(Ss.test(i))t.object.startMaterial(i.substring(7).trim(),t.materialLibraries);else if(_s.test(i))t.materialLibraries.push(i.substring(7).trim());else if(Cs.test(i))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(r==="s"){if(a=i.split(" "),a.length>1){const p=a[1].trim().toLowerCase();t.object.smooth=p!=="0"&&p!=="off"}else t.object.smooth=!0;const h=t.object.currentMaterial();h&&(h.smooth=t.object.smooth)}else{if(i==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+i+'"')}t.finalize();const f=new v.Group;if(f.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let c=0,d=t.objects.length;c<d;c++){const h=t.objects[c],p=h.geometry,w=h.materials,y=p.type==="Line",g=p.type==="Points";let _=!1;if(p.vertices.length===0)continue;const A=new v.BufferGeometry;A.setAttribute("position",new v.Float32BufferAttribute(p.vertices,3)),p.normals.length>0&&A.setAttribute("normal",new v.Float32BufferAttribute(p.normals,3)),p.colors.length>0&&(_=!0,A.setAttribute("color",new v.Float32BufferAttribute(p.colors,3))),p.hasUVIndices===!0&&A.setAttribute("uv",new v.Float32BufferAttribute(p.uvs,2));const N=[];for(let D=0,F=w.length;D<F;D++){const q=w[D],G=q.name+"_"+q.smooth+"_"+_;let T=t.materials[G];if(this.materials!==null){if(T=this.materials.create(q.name),y&&T&&!(T instanceof v.LineBasicMaterial)){const C=new v.LineBasicMaterial;v.Material.prototype.copy.call(C,T),C.color.copy(T.color),T=C}else if(g&&T&&!(T instanceof v.PointsMaterial)){const C=new v.PointsMaterial({size:10,sizeAttenuation:!1});v.Material.prototype.copy.call(C,T),C.color.copy(T.color),C.map=T.map,T=C}}T===void 0&&(y?T=new v.LineBasicMaterial:g?T=new v.PointsMaterial({size:1,sizeAttenuation:!1}):T=new v.MeshPhongMaterial,T.name=q.name,T.flatShading=!q.smooth,T.vertexColors=_,t.materials[G]=T),N.push(T)}let I;if(N.length>1){for(let D=0,F=w.length;D<F;D++){const q=w[D];A.addGroup(q.groupStart,q.groupCount,D)}y?I=new v.LineSegments(A,N):g?I=new v.Points(A,N):I=new v.Mesh(A,N)}else y?I=new v.LineSegments(A,N[0]):g?I=new v.Points(A,N[0]):I=new v.Mesh(A,N[0]);I.name=h.name,f.add(I)}else if(t.vertices.length>0){const c=new v.PointsMaterial({size:1,sizeAttenuation:!1}),d=new v.BufferGeometry;d.setAttribute("position",new v.Float32BufferAttribute(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(d.setAttribute("color",new v.Float32BufferAttribute(t.colors,3)),c.vertexColors=!0);const h=new v.Points(d,c);f.add(h)}return f}}const Ai=S.FileLoader,Ts=n=>{const e=(t,s)=>{t.metadata.number_of_vertices+=s.metadata.number_of_vertices,"labels"in t&&t.labels.push(...t.labels),["axis1","axis2","axis3","colors","positions","scale"].forEach(r=>{r in t&&Object.keys(t[r]).forEach(o=>{const a=s[r][o].length;for(let u=0;u<a;u++)t[r][o].push(s[r][o][u])})})};if(n&&n.length>0)for(;n.length>1;){const t=n.splice(1,1);e(n[0],t[0])}},Ls=n=>{const e=(t,s)=>{t.merge(s)};if(n&&n.length>0){for(;n.length>1;){const t=n.splice(1,1);e(n[0],t[0])}return n[0]}},Bs=function(n,e,t){const s=new Ai,i=new Qe;s.crossOrigin=e;const r=n,o=t;let a,u=!1,f=!1,l;const c=[],d=y=>{const g=a[y.index];if(g)if("GlyphGeometriesURL"in g)y.onLoad(g);else{let _=i.parse(g);y.onLoad(_.geometry,_.materials)}else h(y)},h=y=>{y.onError&&(l||(l={responseURL:r}),y.onError(l))};this.downloadCompleted=y=>{try{a=JSON.parse(y[0]),u=!1,f=!0,Array.isArray(a)?c.forEach(g=>d(g)):c.forEach(g=>h(g))}catch{c.forEach(g=>h(g))}};const p=()=>y=>{l=y,f=!0,u=!1,c.forEach(g=>{h(g)})},w=()=>y=>{c.forEach(g=>{g.onProgress&&g.onProgress(y)})};this.load=(y,g,_,A)=>{const N={index:y,onLoad:g,onProgress:_,onError:A};f?a?d(N):h(l):u?c.push(N):(c.push(N),u=!0,s.load(r,o,w,p))}},Us=function(n,e,t){const s=[],i=n,r=e;let o=0;const a=t.isGlyphsets;this.itemDownloaded=(u,f)=>{if(s[u]=f,o++,o==i&&s.length>0)if(a){const l=s.map(c=>JSON.parse(c[0]));Ts(l),r(l[0])}else{const l=s[0][1],c=s.map(h=>h[0]),d=Ls(c);for(let h=1;h<i;h++)s[u][0].dispose(),s[u][1].forEach(p=>p.dispose());r(d,l)}}},Ns=function(){let n=0;const e=20;this.crossOrigin="Anonymous";const t=new Qe,s=new Ai;s.crossOrigin="Anonymous";const i=[],r={},o=(l,c,d,h,p)=>{const w=l.length,y=new Us(w,c,p);let g=0;l.forEach(_=>{const A=p?{...p}:{};A.msHandler=y,A.order=g,g++,u(_,c,d,h,A)})},a=(l,c,d,h,p)=>{const w=p?{...p}:{};let y=r[l];if(!y)if(e>n){const g=new f(void 0,this,w);++n,y=new Bs(l,this.crossOrigin,g),r[l]=y}else i.push({url:l,onLoad:c,onProgress:d,onError:h,options:p});y&&(w.isHandler=y,y.load(p.index,c,d,h))},u=(l,c,d,h,p)=>{if(p&&p.index!==void 0)a(l,c,d,h,p);else if(e>n){++n;const w=new f(c,this,p),y=new f(h,this,p);p.isGlyphsets?s.load(l,w,d,y):(t.crossOrigin=this.crossOrigin,t.load(l,w,d,y))}else i.push({url:l,onLoad:c,onProgress:d,onError:h,options:p})};this.load=(l,c,d,h,p)=>{Array.isArray(l)?o(l,c,d,h,p):u(l,c,d,h,p)},this.loadFromWaitingList=()=>{for(;e>n;){const l=i.shift();if(l)this.load(l.url,l.onLoad,l.onProgress,l.onError,l.options);else return}},this.itemRemainingCheck=()=>{if(i.length===0&&n===0)for(let l in r)r.hasOwnProperty(l)&&delete r[l]};const f=function(l,c,d){return(...h)=>{--n,d!=null&&d.msHandler?d.msHandler.itemDownloaded(d.order,h):d!=null&&d.isHandler?d.isHandler.downloadCompleted(h):l&&l(...h),c.loadFromWaitingList(),c.itemRemainingCheck()}};this.parse=l=>loader.parse(l)};class Mi extends v.Loader{constructor(e){super(e)}load(e,t,s,i){const r=this,o=new v.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(a))}catch(u){i?i(u):console.error(u),r.manager.itemError(e)}},s,i)}parse(e){function t(f){const l=new DataView(f),c=32/8*3+32/8*3*3+16/8,d=l.getUint32(80,!0);if(80+32/8+d*c===l.byteLength)return!0;const p=[115,111,108,105,100];for(let w=0;w<5;w++)if(s(p,l,w))return!1;return!0}function s(f,l,c){for(let d=0,h=f.length;d<h;d++)if(f[d]!==l.getUint8(c+d,!1))return!1;return!0}function i(f){const l=new DataView(f),c=l.getUint32(80,!0);let d,h,p,w=!1,y,g,_,A,N;for(let T=0;T<70;T++)l.getUint32(T,!1)==1129270351&&l.getUint8(T+4)==82&&l.getUint8(T+5)==61&&(w=!0,y=new Float32Array(c*3*3),g=l.getUint8(T+6)/255,_=l.getUint8(T+7)/255,A=l.getUint8(T+8)/255,N=l.getUint8(T+9)/255);const I=84,D=12*4+2,F=new v.BufferGeometry,q=new Float32Array(c*3*3),G=new Float32Array(c*3*3);for(let T=0;T<c;T++){const C=I+T*D,U=l.getFloat32(C,!0),M=l.getFloat32(C+4,!0),O=l.getFloat32(C+8,!0);if(w){const k=l.getUint16(C+48,!0);k&32768?(d=g,h=_,p=A):(d=(k&31)/31,h=(k>>5&31)/31,p=(k>>10&31)/31)}for(let k=1;k<=3;k++){const P=C+k*12,m=T*3*3+(k-1)*3;q[m]=l.getFloat32(P,!0),q[m+1]=l.getFloat32(P+4,!0),q[m+2]=l.getFloat32(P+8,!0),G[m]=U,G[m+1]=M,G[m+2]=O,w&&(y[m]=d,y[m+1]=h,y[m+2]=p)}}return F.setAttribute("position",new v.BufferAttribute(q,3)),F.setAttribute("normal",new v.BufferAttribute(G,3)),w&&(F.setAttribute("color",new v.BufferAttribute(y,3)),F.hasColors=!0,F.alpha=N),F}function r(f){const l=new v.BufferGeometry,c=/solid([\s\S]*?)endsolid/g,d=/facet([\s\S]*?)endfacet/g;let h=0;const p=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,w=new RegExp("vertex"+p+p+p,"g"),y=new RegExp("normal"+p+p+p,"g"),g=[],_=[],A=new v.Vector3;let N,I=0,D=0,F=0;for(;(N=c.exec(f))!==null;){D=F;const q=N[0];for(;(N=d.exec(q))!==null;){let C=0,U=0;const M=N[0];for(;(N=y.exec(M))!==null;)A.x=parseFloat(N[1]),A.y=parseFloat(N[2]),A.z=parseFloat(N[3]),U++;for(;(N=w.exec(M))!==null;)g.push(parseFloat(N[1]),parseFloat(N[2]),parseFloat(N[3])),_.push(A.x,A.y,A.z),C++,F++;U!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+h),C!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+h),h++}const G=D,T=F-D;l.addGroup(G,T,I),I++}return l.setAttribute("position",new v.Float32BufferAttribute(g,3)),l.setAttribute("normal",new v.Float32BufferAttribute(_,3)),l}function o(f){return typeof f!="string"?v.LoaderUtils.decodeText(new Uint8Array(f)):f}function a(f){if(typeof f=="string"){const l=new Uint8Array(f.length);for(let c=0;c<f.length;c++)l[c]=f.charCodeAt(c)&255;return l.buffer||l}else return f}const u=a(e);return t(u)?i(u):r(o(e))}}const _i=function(){Y.call(this),this.isTubeLines=!0;let n={},e={radius:1,radialSegments:8,smooth:!1};this.createLineSegment=(s,i,r)=>{if(s&&i){n={geometryIn:s,materialIn:i,options:r};const o=t(s.vertices),a=new S.MeshStandardMaterial({color:i.color}),u=new S.Mesh(o,a);this.setMesh(u,r.localTimeEnabled,r.localMorphColour)}},this.setWidth=s=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=s,this.morph.material.needsUpdate=!0)},this.setAlpha=function(s){let i=this.getMorph();i.material.opacity=s,i.material.transparent=s<1,i.material.depthWrite=s>.5},this.setWireframe=s=>{let i=this.getMorph();i.material.wireframe=s},this.setTubeLines=(s,i)=>{if(s&&i){const{geometryIn:r}=n;let o=this.getMorph();o.geometry.dispose(),e=Object.assign(e,{radius:s,radialSegments:i}),o.geometry=t(r.vertices)}};const t=s=>{const{radius:i,radialSegments:r,smooth:o}=e;let a;if(o){const u=new S.CatmullRomCurve3(s);a=new S.TubeGeometry(u,s.length,i,r,!1)}else{const u=[];for(let f=0;f+1<s.length;f=f+2){const l=new S.LineCurve3(s[f],s[f+1]),c=new S.TubeGeometry(l,1,i,r,!1);u.push(c)}a=Gi(u,!0),u.forEach(f=>f.dispose())}return a}};_i.prototype=Object.create(Y.prototype);const Ps=function(n){const e=n;this.toBeDownloaded=0,this.progressMap={};let t=!1,s=!1;const i=new Ns;this.getDownloadProgress=()=>{let T=0,C=0,U=!1;for(const M in this.progressMap){const O=this.progressMap[M];T+=O[1],C+=O[0],O[1]==0&&(U=!0)}return U&&(T=0),[T,C,s]},this.onProgress=T=>C=>{this.progressMap[T]=[C.loaded,C.total]},this.onError=T=>C=>{this.toBeDownloaded=this.toBeDownloaded-1,s=!0,console.error(`There is an issue with external resource ${C!=null&&C.responseURL?": "+(C==null?void 0:C.responseURL):""}.`),T&&T({type:"Error",xhr:C})};let r=(T,C)=>{const U=C.Default;if(C.Inline)e.setupMultipleViews(U,C.Entries);else{const M=[];for(const[O,k]of Object.entries(C.Entries))if(T){const P=Pe(k,T);M.push(new Promise((m,L)=>{fetch(P).then(b=>b.json()).then(b=>m({key:O,data:b})).catch(b=>L(b))}))}Promise.all(M).then(O=>{const k={};O.forEach(m=>{k[m.key]=m.data}),e.setupMultipleViews(U,k);let P=e.getZincCameraControls();P&&P.setCurrentViewport(U),t=!0})}};this.loadViewURL=(T,C)=>{this.toBeDownloaded+=1;const U=ye(T);fetch(U).then(M=>{if(!M.ok)throw new Error(`HTTP error! status: ${M.status}`);return M.json()}).then(M=>{e.setupMultipleViews("default",{default:M}),e.resetView(),t=!0,--this.toBeDownloaded,C!==void 0&&typeof C=="function"&&C()}).catch(M=>{console.error(`Fetch failed for URL: ${U}`,M),this.onError(C)({responseURL:U})})},this.loadModelsURL=(T,C,U,M,O,k,P)=>{const m=C.length;this.toBeDownloaded+=m;for(let L=0;L<m;L++){const b=C[L];let B=Se.defaultMaterialColor,V=Se.defaultOpacity;U!=null&&U[L]!=null&&(B=!!U[L]),M!=null&&M[L]!=null&&(V=M[L]);let R=0;O!=null&&O[L]!=null&&(R=!!O[L]);let z=0;k!=null&&k[L]!=null&&(z=!!k[L]),i.load(ye(b),h(T,B,V,R,z,void 0,void 0,void 0,void 0,P),this.onProgress(b),this.onError(P))}},this.loadFromViewURL=(T,C,U)=>{const M=ye(C+"_view.json");fetch(M).then(O=>{if(!O.ok)throw new Error(`HTTP error! status: ${O.status}`);return O.json()}).then(O=>{e.loadView(O);const k=[],P=C+"_";for(let m=0;m<O.numberOfResources;m++){const L=P+(m+1)+".json";k.push(L)}this.loadModelsURL(T,k,O.colour,O.opacity,O.timeEnabled,O.morphColour,U)}).catch(O=>{console.error(`Failed to load view data from: ${M}`,O)})};const o=(T,C,U,M,O,k,P,m,L)=>(b,B)=>{const V=m?new _i:new Ve;let R;B&&B[0]&&(R=new S.LineBasicMaterial({color:B[0].color.clone()}),1>B[0].opacity&&(R.transparent=!0),R.opacity=B[0].opacity,R.morphTargets=C,R.vertexColors=B[0].vertexColors);let z={};if(z.localTimeEnabled=C,z.localMorphColour=U,V&&(V.createLineSegment(b,R,z),V.setName(M),V.setAnatomicalId(O),V.setRenderOrder(k),T.addZincObject(V),V.setDuration(e.getDuration()),P&&P.levels))for(const[Z,E]of Object.entries(P.levels))V.addLOD(i,Z,E.URL,E.Index,P.preload);--this.toBeDownloaded,b.dispose(),L!=null&&typeof L=="function"&&L(V)};this.loadLinesURL=(T,C,U,M,O,k,P)=>{let m=0;this.toBeDownloaded+=1;let L=P!=null&&P.isInline?P.isInline:!1,b=P!=null&&P.anatomicalId?P.anatomicalId:void 0,B=P&&"renderOrder"in P?P.renderOrder:void 0;U!=null&&(m=!!U);let V=0;M!=null&&(V=!!M);let R=P.tubeLines&&!m&&!V;if(L){let z=i.parse(C);o(T,m,V,O,b,B,P.lod,R,k)(z.geometry,z.materials)}else i.load(C,o(T,m,V,O,b,B,P.lod,R,k),this.onProgress(C),this.onError(k),P.loaderOptions)};const a=(T,C,U,M,O)=>k=>{let P=k;(typeof P=="string"||P instanceof String)&&(P=JSON.parse(k));let m=O&&O.isInline?O.isInline:void 0,L=O&&O.anatomicalId?O.anatomicalId:void 0,b=O&&O.displayLabels?O.displayLabels:void 0,B=O&&"renderOrder"in O?O.renderOrder:void 0;const V=new ft;V.setDuration(e.getDuration()),V.groupName=U;let R=()=>{--this.toBeDownloaded,M!=null&&typeof M=="function"&&M(V)};++this.toBeDownloaded,m?V.load(P,C,R,m,b):V.load(P,ye(C),R,m,b),V.setAnatomicalId(L),V.setRenderOrder(B),T.addZincObject(V)};this.loadGlyphsetURL=(T,C,U,M,O,k)=>{(k&&k.isInline?k.isInline:!1)?a(T,U,M,O,k)(C):i.load(C,a(T,U,M,O,k),this.onProgress(C),this.onError(O),k.loaderOptions)};const u=(T,C,U,M,O,k,P)=>(m,L)=>{const b=new Te;let B=new S.PointsMaterial({alphaTest:.5,size:10,sizeAttenuation:!1});L&&L[0]&&(1>L[0].opacity&&(B.transparent=!0),B.opacity=L[0].opacity,B.color=L[0].color,B.morphTargets=C,B.vertexColors=L[0].vertexColors);let V={};V.localTimeEnabled=C,V.localMorphColour=U,b&&(b.createMesh(m,B,V),b.setName(M),b.setAnatomicalId(O),T.addZincObject(b),b.setDuration(e.getDuration()),b.setRenderOrder(k)),m.dispose(),--this.toBeDownloaded,P!=null&&typeof P=="function"&&P(b)};this.loadSTL=(T,C,U,M)=>{this.toBeDownloaded+=1;const O=Se.defaultMaterialColor,k=Se.defaultOpacity,P=new Mi;P.crossOrigin="Anonymous",P.load(ye(C),h(T,O,k,!1,!1,U,void 0,void 0,void 0,M))},this.loadOBJ=(T,C,U,M)=>{this.toBeDownloaded+=1;const O=Se.defaultMaterialColor,k=Se.defaultOpacity,P=new wi;P.crossOrigin="Anonymous",P.load(ye(C),h(T,O,k,!1,!1,U,void 0,void 0,void 0,M))};const f=(T,C,U,M,O,k,P)=>{this.toBeDownloaded+=1;const m=Se.defaultMaterialColor,L=Se.defaultOpacity;let b=0,B=P&&P.isInline?P.isInline:!1,V=P&&P.fileFormat?P.fileFormat:void 0,R=P&&P.anatomicalId?P.anatomicalId:void 0,z=P&&"renderOrder"in P?P.renderOrder:void 0;U!=null&&(b=!!U);let Z=0;M!=null&&(Z=!!M);let E=i;if(V!==void 0){if(V=="STL")E=new Mi;else if(V=="OBJ"){E=new wi,E.crossOrigin="Anonymous",E.load(C,objloader(T,m,L,b,Z,O,R,k),this.onProgress(C),this.onError,P.loaderOptions);return}}if(B){const $=i.parse(C);h(T,m,L,b,Z,O,R,z,P,k)($.geometry,$.materials)}else E.crossOrigin="Anonymous",i.load(C,h(T,m,L,b,Z,O,R,z,P,k),this.onProgress(C),this.onError(k),P.loaderOptions)},l=function(T,C,U){let M=0;return O=>{if(M=M+1,O&&C!=null&&typeof C=="function"&&C(O),M==T&&(t===!1&&e.viewAll(),U!=null&&typeof U=="function")){U();let k=e.getZincCameraControls();k&&k.calculateMaxAllowedDistance(e)}}};this.loadPointsetURL=(T,C,U,M,O,k,P)=>{let m=0;this.toBeDownloaded+=1,U!=null&&(m=!!U);let L=0;M!=null&&(L=!!M);let b=P&&P.isInline?P.isInline:!1,B=P&&P.anatomicalId?P.anatomicalId:void 0,V=P&&"renderOrder"in P?P.renderOrder:void 0;if(b){const R=i.parse(C);u(T,m,L,O,B,V,k)(R.geometry,R.materials)}else i.load(C,u(T,m,L,O,B,V,k),this.onProgress(C),this.onError(k),P.loaderOptions)};const c=(T,C,U,M,O,k)=>{let P=k&&k.isInline?k.isInline:void 0,m=k&&k.anatomicalId?k.anatomicalId:void 0,L=k&&"renderOrder"in k?k.renderOrder:void 0,b;if(U){if(C&&U.images&&U.images.source){const B=U.images.source;for(let V=0;V<B.length;V++){const R=Pe(B[V],C);U.images.source[V]=R}}if(U.type==="slides"&&(b=new Ee),b){b.groupName=M;let B=()=>{T.addZincObject(b),--this.toBeDownloaded,O!=null&&typeof O=="function"&&O(b)};++this.toBeDownloaded,b.load(U,B,P),b.setAnatomicalId(m),b.setRenderOrder(L)}}};this.loadTextureURL=(T,C,U,M,O)=>{if(O&&O.isInline?O.isInline:!1)c(T,void 0,C,U,M,O);else{const P=ye(C);fetch(P).then(m=>{if(!m.ok)throw new Error(`HTTP error! status: ${m.status}`);const L=m.url||new URL(P).href;return m.json().then(b=>({textureData:b,referenceURL:L}))}).then(({textureData:m,referenceURL:L})=>{c(T,L,m,U,M,O)}).catch(m=>{console.error(`Fetch failed for texture URL: ${P}`,m)})}};const d=(T,C,U,M,O,k,P,m,L,b,B)=>{let V={};V.colour=U,V.opacity=M,V.localTimeEnabled=O,V.localMorphColour=k;const R=new Fe;if(R.createMesh(C,m,V),R.getMorph())return R.setName(L),R.setRenderOrder(b),R.setAnatomicalId(B),T&&T.addZincObject(R),R.setDuration(e.getDuration()),R.videoHandler&&e.setVideoHandler(R.videoHandler),R},h=(T,C,U,M,O,k,P,m,L,b)=>(B,V)=>{let R;V&&V[0]&&(R=V[0]);const z=d(T,B,C,U,M,O,void 0,R,k,m,P);if(L.lod&&L.lod.levels)for(const[Z,E]of Object.entries(L.lod.levels))z.addLOD(i,Z,E.URL,E.Index,L.lod.preload);--this.toBeDownloaded,B.dispose(),b!=null&&typeof b=="function"&&b(z)},p=T=>{const C=/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/,[,U,M,O,k,P,m,L]=T.match(C);return{years:U,months:M,weeks:O,days:k,hours:P,mins:m,secs:L}};this.loadSettings=T=>{if(T){if(T.Duration){const C=p(T.Duration);e.setDurationFromObject(C)}if(T.OriginalDuration){const C=p(T.OriginalDuration);e.setOriginalDurationFromObject(C)}if(T.TimeStamps)for(const C in T.TimeStamps){const U=p(T.TimeStamps[C]);e.addMetadataTimeStamp(C,U)}}};const w=(T,C,U,M,O)=>{if(U){let k,P=!1;U.URL?(k=U.URL,C&&(k=Pe(k,C))):U.Inline&&(k=U.Inline.URL,P=!0);const m={};if(U.LOD&&U.LOD.Levels){m.preload=!!U.LOD.Preload,m.levels={};for(const[B,V]of Object.entries(U.LOD.Levels))m.levels[B]={},m.levels[B].URL=Pe(V.URL,C),m.levels[B].Index=V.Index}let L=U.GroupName;(L===void 0||L==="")&&(L="_Unnamed");let b={loaderOptions:{index:U.Index},isInline:P,fileFormat:U.FileFormat,anatomicalId:U.AnatomicalId,compression:U.compression,tubeLines:U.tubeLines,lod:m,renderOrder:M};switch(U.Type){case"Surfaces":f(T,k,U.MorphVertices,U.MorphColours,L,O,b);break;case"Glyph":let B;P?B=U.Inline.GlyphGeometriesURL:(B=U.GlyphGeometriesURL,B=Pe(U.GlyphGeometriesURL,C)),U.DisplayLabels&&(b.displayLabels=!0),b.loaderOptions.isGlyphsets=!0,this.loadGlyphsetURL(T,k,B,L,O,b);break;case"Points":this.loadPointsetURL(T,k,U.MorphVertices,U.MorphColours,L,O,b);break;case"Lines":this.loadLinesURL(T,k,U.MorphVertices,U.MorphColours,L,O,b);break;case"Texture":this.loadTextureURL(T,k,L,O,b);break}}},y=(T,C,U)=>{if(C){let M,O=!1;switch(C.URL?(M=C.URL,T&&(M=Pe(C.URL,T))):C.Inline&&(M=C.Inline.URL,O=!0),C.Type){case"View":O?(e.setupMultipleViews("default",{default:M}),t=!0,U!=null&&typeof U=="function"&&U()):this.loadViewURL(M,U);break;case"Settings":this.loadSettings(C);break}}};this.loadGLTF=(T,C,U,M,O)=>{new As().load(e,T,C,U,M,O)};let g=(T,C,U,M)=>{if(U.Primitives&&U.Primitives.forEach(O=>{let k=1;O.Order&&(k=O.Order),w(T,C,O,k,M)}),U.Transformation&&T.setTransformation(U.Transformation),U.Children)for(const[O,k]of Object.entries(U.Children)){const P=T.findOrCreateChildFromPath(O);P&&g(P,C,k,M)}},_=(T,C)=>{var P,m;let U=T;const M=(P=C==null?void 0:C.enabled)==null?void 0:P.include,O=(m=C==null?void 0:C.enabled)==null?void 0:m.exclude,k=C==null?void 0:C.tubeLines;return(M!=null&&M.length||O!=null&&O.length)&&(M&&(U=T.filter(L=>{if(L.Type==="View")return!0;for(let b=0;b<M.length;b++)if(Nt(L.RegionPath,L.GroupName,M[b]))return!0;return!1})),O&&(U=U.filter(L=>{if(L.Type==="View")return!0;for(let b=0;b<O.length;b++)if(Nt(L.RegionPath,L.GroupName,O[b]))return!1;return!0}))),k&&U.forEach(L=>{L.Type==="Lines"&&(L.tubeLines=!0)}),U},A=(T,C)=>Array.isArray(T)?_(T,C):T,N=(T,C)=>{if(Array.isArray(T)){let U=0;for(let M=0;M<T.length;M++)T[M].Type&&(C&&T[M].Type==="View"||T[M].Type==="Surfaces"||T[M].Type==="Glyph"||T[M].Type==="Points"||T[M].Type==="Lines"||T[M].Type==="Texture")&&U++;return U}return 0},I=T=>{let C=T.Primitives?N(T.Primitives,!1):0;return T.Children&&Object.values(T.Children).forEach(U=>{C+=I(U)}),C},D=T=>{if(Array.isArray(T))return N(T,!0);if(typeof T=="object"&&T!==null&&T.Version==="2.0")return I(T.Regions)},F=(T,C,U,M,O)=>{let k=T;U.RegionPath&&U.RegionPath!==""&&(k=T.findOrCreateChildFromPath(U.RegionPath)),w(k,C,U,M*2,O)},q=(T,C,U,M,O,k)=>{const P=A(C,k);let m=D(P),L=new l(m,M,O);for(let b=0;b<C.length;b++)y(U,P[b],L);for(let b=0;b<C.length;b++)F(T,U,P[b],b,L)},G=(T,C,U,M,O)=>{let k=D(C),P=new l(k,M,O);C.Settings&&this.loadSettings(C.Settings),C.Views&&r(U,C.Views),C.Regions&&g(T,U,C.Regions,P)};this.loadMetadataURL=(T,C,U,M,O)=>{const k=ye(C);fetch(k).then(P=>{if(!P.ok)throw new Error(`HTTP error! status: ${P.status}`);const m=P.url||new URL(k).href;return P.json().then(L=>({metadata:L,referenceURL:m}))}).then(({metadata:P,referenceURL:m})=>{e.resetMetadata(),e.resetDuration(),t=!1,Array.isArray(P)?q(T,P,m,U,M,O):typeof P=="object"&&P!==null&&P.Version==="2.0"&&G(T,P,m,U,M)}).catch(P=>{console.error(`Fetch failed for URL: ${k}`,P)})}};let Vs=0;const ks=function(){return"sc"+Vs++},Si=function(){return{Duration:"6 secs",OriginalDuration:"-",TimeStamps:{}}},Is=6e3,Ct=function(n,e){const t=n;let s,i,r=new Ps(this),o,a={},u=0,f={},l=0;const c=new S.Scene,d=new S.Scene,h=new di(void 0,this);c.add(h.getGroup());const p=new S.Group;c.add(p),this.directionalLight=void 0,this.ambient=void 0,this.camera=void 0;let w=6e3,y;this.sceneName=void 0;let g=!1,_;this.autoClearFlag=!0,this.displayMarkers=!1,this.displayMinimap=!1,this.displayMiniAxes=!1,this.minimapScissor={x_offset:16,y_offset:16,width:128,height:128,align:"top-right",updateRequired:!0};let A={x:0,y:0},N=Si(),I=new S.Vector2,D=[];this.forcePickableObjectsUpdate=!1,this.uuid=ks();let F=new oi(this);F.disable(),c.add(F.group);let q={main:[],mini:[]};const G=new S.Vector3(0,0,0),T=()=>t?typeof t.clientWidth<"u"?t.clientWidth:t.width:0,C=()=>t?typeof t.clientHeight<"u"?t.clientHeight:t.height:0;this.getDownloadProgress=()=>r.getDownloadProgress(),this.onWindowResize=()=>{const m=C();this.camera.aspect=T()/m,this.camera.updateProjectionMatrix(),this.minimapScissor.updateRequired=!0,y.onResize(),y.calculateHeightPerPixelAtZeroDepth(m)},this.resetView=()=>{this.onWindowResize(),y.resetView()},this.changeZoomByScrollRateUnit=m=>{y.changeZoomByScrollRateUnit(m)},(()=>{this.camera=new S.PerspectiveCamera(40,T()/C(),0,10),this.ambient=new S.AmbientLight(16777215,.2),c.add(this.ambient),this.directionalLight=new S.DirectionalLight(16777215,.8),c.add(this.directionalLight),y=new Ht(this.camera,e.domElement,e,this),y.setDirectionalLight(this.directionalLight),y.resetView(),o=new as(this)})(),this.loadView=m=>{const L=new Ie;return L.setFromObject(m),y.setCurrentCameraSettings(L),!0},this.setupMultipleViews=(m,L)=>{for(const[b,B]of Object.entries(L)){const V=new Ie;V.setFromObject(B),y.addViewport(b,V)}y.setDefaultViewport(m)},this.getBoundingBox=()=>h.getBoundingBox(!0),this.viewAllWithBoundingBox=m=>{if(m){const L=y.getViewportFromBoundingBox(m,1);y.setCurrentCameraSettings(L),y.calculateHeightPerPixelAtZeroDepth(C()),F.markerUpdateRequired=!0}},this.viewAll=()=>{const m=this.getBoundingBox();this.viewAllWithBoundingBox(m),F.markerUpdateRequired=!0},this.forEachGeometry=m=>{h.forEachGeometry(m,!0)},this.forEachGlyphset=m=>{h.forEachGlyphset(m,!0)},this.forEachPointset=m=>{h.forEachPointset(m,!0)},this.forEachLine=m=>{h.forEachLine(m,!0)},this.findGeometriesWithGroupName=m=>h.findGeometriesWithGroupName(m,!0),this.findPointsetsWithGroupName=m=>h.findPointsetsWithGroupName(m,!0),this.findGlyphsetsWithGroupName=m=>h.findGlyphsetsWithGroupName(m,!0),this.findLinesWithGroupName=m=>h.findLinesWithGroupName(m,!0),this.findObjectsWithGroupName=m=>h.findObjectsWithGroupName(m,!0),this.findObjectsWithAnatomicalId=m=>h.findObjectsWithAnatomicalId(m,!0),this.getBoundingBoxOfZincObjects=m=>{let L;for(let b=0;b<m.length;b++){let B=m[b].getBoundingBox();B&&(L?L.union(B):L=B)}return L},this.vectorToScreenXY=m=>{m.project(this.camera);let L=T(),b=C(),B=L/2,V=b/2;return m.x=m.x*B+B,m.y=-(m.y*V)+V,m},this.getObjectsScreenXY=m=>{if(m&&m.length>0){let L=this.getBoundingBoxOfZincObjects(m);const b=new S.Vector3;return L.getCenter(b),this.vectorToScreenXY(b)}},this.getNamedObjectsScreenXY=m=>{let L=this.findObjectsWithGroupName(m);return this.getObjectsScreenXY(L)},this.addZincObject=m=>{m&&(h.addZincObject(m),y&&y.calculateMaxAllowedDistance(this))},this.loadGlyphsetURL=(m,L,b,B)=>{r.loadGlyphsetURL(h,m,L,b,B)},this.loadPointsetURL=(m,L,b,B,V)=>{r.loadPointsetURL(h,m,L,b,B,V)},this.loadLinesURL=(m,L,b,B,V)=>{r.loadLinesURL(h,m,L,b,B,V)},this.loadSTL=(m,L,b)=>{r.loadSTL(h,m,L,b)},this.loadOBJ=(m,L,b)=>{r.loadOBJ(h,m,L,b)},this.loadMetadataURL=(m,L,b,B)=>{r.loadMetadataURL(h,m,L,b,B)},this.loadModelsURL=(m,L,b,B,V,R)=>{r.loadModelsURL(h.urls,L,b,B,V,R)},this.loadViewURL=m=>{r.loadViewURL(m)},this.loadFromViewURL=(m,L)=>{r.loadFromViewURL(m,L)},this.loadGLTF=(m,L,b,B)=>{r.loadGLTF(h,m,L,b,B)},this.updateDirectionalLight=()=>{y.updateDirectionalLight()},this.addObject=m=>{c.add(m)},this.removeObject=m=>{c.remove(m)},this.getCurrentTime=()=>{if(i!=null)return i.getCurrentTime(w);const m=h.getCurrentTime();return m!==-1?m:0},this.setMorphsTime=m=>{i!=null&&i.setMorphTime(m,w),h.setMorphTime(m,!0)},this.isTimeVarying=()=>i&&i.video&&!i.video.error?!0:h.isTimeVarying(),this.renderGeometries=(m,L,b)=>{let B={};if(B.camera=y,B.displayMarkers=this.displayMarkers,B.markerCluster=F,B.markersList=F.markers,B.ndcToBeUpdated=!1,b&&(B.markerCluster.markerUpdateRequired=!0),i)if(i.isReadyToPlay()){b?i.video.play():i.video.pause();const V=i.video.currentTime/i.getVideoDuration()*w;r.toBeDownloaded==0?(y.setTime(V),B.ndcToBeUpdated=y.update(0),B.ndcToBeUpdated&&y.calculateHeightPerPixelAtZeroDepth(C()),h.setMorphTime(V,!0),h.renderGeometries(0,0,b,y,B,!0)):y.update(0)}else myPlayRate=0;else r.toBeDownloaded==0?(B.ndcToBeUpdated=y.update(L),B.ndcToBeUpdated&&y.calculateHeightPerPixelAtZeroDepth(C()),h.renderGeometries(m,L,b,y,B,!0)):y.update(0)},this.getThreeJSScene=()=>c,this.setVideoHandler=m=>{i||(i=m)},this.setAdditionalScenesGroup=m=>{c.add(m)};let M=(m,L,b,B,V,R,z)=>{let Z=0,E=0;return m.includes("top")?E=z-V-b:m.includes("bottom")?E=b:E=Math.floor((z-V)/2),m.includes("left")?Z=L:m.includes("right")?Z=R-L-B:Z=Math.floor((R-B)/2),{x:Z,y:E}};const O=m=>{(this.displayMinimap||this.displayMiniAxes)&&(m.setScissorTest(!0),m.getSize(I),this.minimapScissor.updateRequired&&(A=M(this.minimapScissor.align,this.minimapScissor.x_offset,this.minimapScissor.y_offset,this.minimapScissor.width,this.minimapScissor.height,I.x,I.y),this.minimapScissor.updateRequired=!1),m.setScissor(A.x,A.y,this.minimapScissor.width,this.minimapScissor.height),m.setViewport(A.x,A.y,this.minimapScissor.width,this.minimapScissor.height),o.updateCamera(),this.displayMiniAxes?m.render(d,o.camera):(c.add(o.mask),m.render(c,o.camera),c.remove(o.mask)),m.setScissorTest(!1),m.setViewport(0,0,I.x,I.y))};this.render=m=>{this.autoClearFlag&&m.clear(),g&&_?_.render(c,this.camera):(m.render(c,this.camera),O(m))},this.setInteractiveControlEnable=m=>{m==!0?y.enable():y.disable()},this.getZincCameraControls=()=>y,this.getThreeJSScene=()=>c,this.setDuration=m=>{h.setDuration(m),w=m,y.setPathDuration(m),r.duration=m},this.getDuration=()=>w,this.setStereoEffectEnable=m=>{m==!0&&(_||(_=new ri(e))),e.setSize(T(),C()),this.camera.updateProjectionMatrix(),g=m},this.objectIsInScene=m=>h.objectIsInRegion(m,!0),this.alignBoundingBoxToCameraView=(m,L)=>{if(m){m.getCenter(G);const b=this.getZincCameraControls().getCurrentViewport(),B=new S.Vector3(b.targetPosition[0],b.targetPosition[1],b.targetPosition[2]),V=new S.Vector3(b.eyePosition[0],b.eyePosition[1],b.eyePosition[2]),R=new S.Vector3,z=new S.Vector3;R.subVectors(B,V).normalize(),z.subVectors(B,G).normalize();const Z=new S.Vector3;Z.crossVectors(R,z);const E=R.angleTo(z);L>0?(this.getZincCameraControls().rotateCameraTransition(Z,E,L),this.getZincCameraControls().enableCameraTransition()):this.getZincCameraControls().rotateAboutLookAtpoint(Z,E),F.markerUpdateRequired=!0}},this.translateBoundingBoxToCameraView=(m,L,b)=>{if(m){const B=this.getZincCameraControls().getCurrentViewport(),V=this.getZincCameraControls().getViewportFromBoundingBox(m,L);b>0&&(this.getZincCameraControls().cameraTransition(B,V,b),this.getZincCameraControls().enableCameraTransition()),F.markerUpdateRequired=!0}},this.alignObjectToCameraView=(m,L)=>{if(this.objectIsInScene(m)){const b=m.getBoundingBox();this.alignBoundingBoxToCameraView(b,L)}},this.setCameraTargetToObject=m=>{if(this.objectIsInScene(m)){const L=m.getBoundingBox(),b=this.getZincCameraControls().getCurrentViewport();L.getCenter(G);const B=new S.Vector3(b.targetPosition[0],b.targetPosition[1],b.targetPosition[2]),V=new S.Vector3(b.eyePosition[0],b.eyePosition[1],b.eyePosition[2]),R=new S.Vector3,z=new S.Vector3;R.subVectors(V,B),z.addVectors(G,R),b.eyePosition[0]=z.x,b.eyePosition[1]=z.y,b.eyePosition[2]=z.z,b.targetPosition[0]=G.x,b.targetPosition[1]=G.y,b.targetPosition[2]=G.z,this.getZincCameraControls().setCurrentCameraSettings(b),F.markerUpdateRequired=!0}},this.isStereoEffectEnable=()=>g,this.removeZincObject=m=>{h.removeZincObject(m),y&&y.calculateMaxAllowedDistance(this),F.markerUpdateRequired=!0},this.updatePickableThreeJSObjects=()=>{D.length=0,F.isEnabled&&D.push(F.group),h.getPickableThreeJSObjects(D,!0),this.forcePickableObjectsUpdate=!1},this.getPickableThreeJSObjects=()=>((this.forcePickableObjectsUpdate||h.checkPickableUpdateRequred(!0))&&this.updatePickableThreeJSObjects(),D),this.getNormalisedMinimapCoordinates=(m,L)=>{if(this.displayMinimap){const b=new S.Vector2;m.getSize(b);let B=b.y-L.clientY;if(A.x+this.minimapScissor.width>L.clientX&&L.clientX>A.x&&A.y+this.minimapScissor.height>B&&B>A.y){let V=(L.clientX-A.x)/this.minimapScissor.width*2-1,R=(B-A.y)/this.minimapScissor.height*2-1;return{x:V,y:R}}}},this.getMinimapDiffFromNormalised=(m,L)=>{if(o)return o.getDiffFromNormalised(m,L)},this.isWebGL2=()=>e.isWebGL2(),this.clearAll=()=>{F.clear(),h.clear(!0),this.clearZincObjectAddedCallbacks(),this.clearZincObjectRemovedCallbacks(),r.toBeDwonloaded=0,y&&y.calculateMaxAllowedDistance(this),F.markerUpdateRequired=!0},this.addMetadataTimeStamp=(m,L)=>{N.TimeStamps[m]=P(L)},this.getMetadataTag=m=>N[m],this.getMetadata=()=>N,this.setMetadataTag=(m,L)=>{N[m]=L},this.removeMetadataTag=m=>{delete N[m]},this.resetMetadata=()=>{N=Si()},this.resetDuration=()=>{this.setDuration(Is)};const k=m=>[...m.years?[`${m.years}years`]:[],...m.months?[`${m.months}months`]:[],...m.weeks?[`${m.weeks}weeks`]:[],...m.days?[`${m.days}days`]:[],...m.hours?[`${m.hours}hours`]:[],...m.mins?[`${m.mins}mins`]:[],...m.secs?[`${m.secs}secs`]:[]].join(" "),P=m=>m.years?m.years*31536e6:0+m.months?m.months*2592e6:0+m.weeks?m.weeks*6048e5:0+m.days?m.days*864e5:0+m.hours?m.hours*36e5:0+m.mins?m.mins*6e4:0+m.secs?m.secs*1e3:0;this.setDurationFromObject=m=>{const L=k(m),b=P(m);this.setMetadataTag("Duration",L),this.setDuration(b)},this.setOriginalDurationFromObject=m=>{const L=k(m);this.setMetadataTag("OriginalDuration",L)},this.exportGLTF=m=>new ws(this).exportGLTF(m),this.getRootRegion=()=>h,this.createLines=(m,L,b,B)=>{let V=h.findChildFromPath(m);return V===void 0&&(V=h.createChildFromPath(m)),V.createLines(L,b,B)},this.createPoints=(m,L,b,B,V)=>{let R=h.findChildFromPath(m);return R===void 0&&(R=h.createChildFromPath(m)),R.createPoints(L,b,B,V)},this.addZincObjectAddedCallbacks=m=>(u=u+1,a[u]=m,u),this.addZincObjectRemovedCallbacks=m=>(l=l+1,f[l]=m,l),this.removeZincObjectAddedCallbacks=m=>{m in u&&delete a[m]},this.removeZincObjectRemovedCallbacks=m=>{m in l&&delete f[m]},this.clearZincObjectAddedCallbacks=()=>{a={},u=0},this.clearZincObjectRemovedCallbacks=()=>{f={},l=0},this.triggerObjectAddedCallback=m=>{for(let L in a)a.hasOwnProperty(L)&&a[L](m)},this.triggerObjectRemovedCallback=m=>{for(let L in f)f.hasOwnProperty(L)&&f[L](m)},this.addTemporaryPoints=(m,L)=>{const b=nt(m.length,m);let B=new S.PointsMaterial({alphaTest:.5,size:15,color:L,sizeAttenuation:!1});const V=Ut();B.map=V;let R=new gt(b,B);return p.add(R),R},this.addTemporaryLines=(m,L)=>{const b=nt(m.length,m),B=new S.LineBasicMaterial({color:L}),V=new Xe(b,B);return p.add(V),V},this.enableFrustumDisplay=()=>{this.camera&&!s&&(s=new S.CameraHelper(this.camera),c.add(s))},this.disableFrustumDisplay=()=>{s&&(c.remove(s),s.dispose(),s=void 0)},this.removeTemporaryPrimitive=m=>{p.remove(m),m.geometry.dispose(),m.material.dispose()},this.clearTemporaryPrimitives=()=>{let m=0;return p.children.forEach(b=>{b.geometry.dispose(),b.material.dispose(),m++}),p.clear(),m},this.addBoundingBoxPrimitive=(m,L,b,B,V,R=void 0)=>{let z=h.findChildFromPath(m);z===void 0&&(z=h.createChildFromPath(m));const Z=R||this.getBoundingBox();G.set(0,0,0);const E=G.subVectors(Z.max,Z.min),$=new S.BoxGeometry(E.x,E.y,E.z),H=z.createGeometryFromThreeJSGeometry(L,$,b,B,V,1e4);return E.addVectors(Z.min,Z.max).multiplyScalar(.5),H.setPosition(E.x,E.y,E.z),H},this.addSlicesPrimitive=(m,L,b,B,V,R=void 0)=>{if(L&&L.length>=3&&b&&b.length>=3){let z=h.findChildFromPath(m);z===void 0&&(z=h.createChildFromPath(m));const Z=R||this.getBoundingBox();G.set(0,0,0);const E=G.subVectors(Z.max,Z.min),$=["x","y","z"],H=[];let K=0;return $.forEach(ee=>{let re;switch(ee){case"x":re=new S.PlaneGeometry(E.z,E.y),re.rotateY(Math.PI/2);break;case"y":re=new S.PlaneGeometry(E.x,E.z),re.rotateX(Math.PI/2);break;case"z":re=new S.PlaneGeometry(E.x,E.y);break}const Q=z.createGeometryFromThreeJSGeometry(L[K],re,b[K],B,V,10001);H.push(Q),K++}),E.addVectors(Z.min,Z.max).multiplyScalar(.5),H.forEach(ee=>{ee.setPosition(E.x,E.y,E.z)}),H}},this.enableMarkerCluster=m=>{m?(F.markerUpdateRequired=!0,F.enable()):(F.markerUpdateRequired=!1,F.disable()),this.forcePickableObjectsUpdate=!0},this.destroyAxisDisplay=()=>{this.displayMiniAxes=!1,q.main&&(this.enableAxisDisplay(!1,!1),q.main.forEach(m=>{m.dispose&&m.dispose()})),q.mini&&(this.enableAxisDisplay(!1,!0),q.mini.forEach(m=>{m.dispose&&m.dispose()})),q={main:[],mini:[]}},this.createAxisDisplay=(m=!1)=>{this.destroyAxisDisplay();const L=[{name:"x",dir:new S.Vector3(1,0,0),colour:"red",hex:16733525},{name:"y",dir:new S.Vector3(0,1,0),colour:"green",hex:5635925},{name:"z",dir:new S.Vector3(0,0,1),colour:"blue",hex:5592575}],b=this.getBoundingBox(),B=b.min.distanceTo(b.max);let V=new S.Vector3(0,0,0);m&&V.copy(b.min),L.forEach(R=>{const z=new S.ArrowHelper(R.dir,V,B,R.hex);q.main.push(z);const Z=new S.ArrowHelper(R.dir,b.getCenter(G),B/2,R.hex);q.mini.push(Z);const E=ot(R.name,.036,R.colour,"Asap",120,700),$=R.dir.clone().multiplyScalar(B).add(V);E.position.set($.x,$.y,$.z),q.main.push(E)})},this.enableAxisDisplay=(m,L=!1)=>{var b;L&&((b=q==null?void 0:q.mini)!=null&&b.length)?(this.displayMiniAxes=m,q.mini.forEach(B=>{m?d.add(B):d.remove(B)})):!L&&q.main&&q.main.forEach(B=>{m?c.add(B):c.remove(B)})}},Rs=function(n){let e=n,t,s;const i=new S.Clock(!1);this.playAnimation=!0;let r=1e3,o={},a=0,u={},f=0,l={},c=0,d={},h=0,p,w,y,g,_=[],A=[],N=new S.Group,I,D,F=!1,q=!1;this.getDrawingWidth=()=>e?e.clientWidth:I?typeof I.clientWidth<"u"?Math.round(I.clientWidth):Math.round(I.width):0,this.getDrawingHeight=()=>e?e.clientHeight:I?typeof I.clientHeight<"u"?Math.round(I.clientHeight):Math.round(I.height):0,this.onWindowResize=()=>{s.onWindowResize();const M=this.getDrawingWidth(),O=this.getDrawingHeight();if(t!=null){let k;e?(k=e.getBoundingClientRect(),t.setSize(M,O)):I&&(typeof I.getBoundingClientRect<"u"&&(k=I.getBoundingClientRect(),I.width=M,I.height=O),t.setSize(M,O,!1)),k&&(k.left,k.top);const P=new S.Vector2;t.getSize(P),P.x,P.y}},this.initialiseVisualisation=M=>{if(!q){if(M=M||{},M.antialias===void 0){let P=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(P=!0)}catch{P=!1}P?M.antialias=!1:M.antialias=!0}M.canvas&&(e=void 0,I=M.canvas),t=new S.WebGLRenderer(M),e!==void 0&&e.appendChild(t.domElement),t.setClearColor(16777215,1),I&&I.style&&(I.style.height="100%",I.style.width="100%");const O=t.domElement;O.addEventListener("webglcontextlost",G,!1),O.addEventListener("webglcontextrestored",T,!1),t.autoClear=!1;const k=this.createScene("default");this.setCurrentScene(k),q=!0}};const G=M=>{M.preventDefault();for(let O of Object.keys(o))l.hasOwnProperty(O)&&l[O].call()},T=M=>{M.preventDefault();for(let O of Object.keys(o))d.hasOwnProperty(O)&&d[O].call()};this.getCurrentScene=()=>s,this.setCurrentScene=M=>{if(M){this.removeActiveScene(M);const O=s;s=M,O&&O.setInteractiveControlEnable(!1),s.setInteractiveControlEnable(!0),s.setAdditionalScenesGroup(N),this.onWindowResize()}},this.getSceneByName=M=>_[M],this.createScene=M=>{if(_[M]==null){let O;return I?O=new Ct(I,t):O=new Ct(e,t),_[M]=O,O.sceneName=M,O}},this.resetView=()=>{s.resetView()},this.viewAll=()=>{if(s){const M=s.getBoundingBox();if(M){for(let O=0;O<A.length;O++){const k=A[O].getBoundingBox();k&&M.union(k)}s.viewAllWithBoundingBox(M)}}},this.loadModelsURL=(M,O,k,P,m,L)=>{s.loadModelsURL(M,O,k,P,m,L)},this.loadViewURL=M=>{s.loadViewURL(M)},this.loadFromViewURL=(M,O)=>{s.loadFromViewURL(M,O)},this.updateDirectionalLight=()=>{s.updateDirectionalLight()};let C=()=>{F?(p=requestAnimationFrame(C),this.render()):(cancelAnimationFrame(p),p=void 0)};this.stopAnimate=()=>{F&&(i.stop(),F=!1)},this.animate=()=>{F||(i.start(),F=!0,C())},this.addContextLostCallbackFunction=M=>(c=c+1,l[c]=M,c),this.removeContextLostCallbackFunction=M=>{M in l&&delete l[M]},this.addContextRestoredCallbackFunction=M=>(h=h+1,d[h]=M,h),this.removeContextRestoredCallbackFunction=M=>{M in h&&delete h[M]},this.addPreRenderCallbackFunction=M=>(a=a+1,o[a]=M,a),this.removePreRenderCallbackFunction=M=>{M in o&&delete o[M]},this.addPostRenderCallbackFunction=M=>(f=f+1,u[f]=M,f),this.removePostRenderCallbackFunction=M=>{M in u&&delete u[M]},this.getPlayRate=()=>r,this.setPlayRate=M=>{r=M},this.getCurrentTime=()=>s.getCurrentTime(),this.setMorphsTime=M=>{s.setMorphsTime(M)},this.getZincGeometryByID=M=>s.getZincGeometryByID(M),this.addToScene=M=>{s.addObject(M)},this.addToOrthoScene=M=>{if(y==null&&(y=new S.Scene),w==null){const O=this.getDrawingWidth(),k=this.getDrawingHeight();w=new S.OrthographicCamera(-O/2,O/2,k/2,-k/2,1,10),w.position.z=10}y.add(M)};const U=M=>O=>{O.needsUpdate=!0;const k=new S.SpriteMaterial({map:O}),P=k.map.image.width,m=k.map.image.height;M.material=k,M.scale.set(P,m,1);const L=this.getDrawingWidth(),b=this.getDrawingHeight();M.position.set((L-P)/2,(-b+m)/2,1),this.addToOrthoScene(M)};this.addLogo=()=>{g=new S.Sprite,S.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png",void 0,U(g))},this.render=()=>{D||(e?e.clientWidth>0&&e.clientHeight>0&&(D=new Ot.ResizeSensor(e,this.onWindowResize)):I&&I.width>0&&I.height>0&&(D=new Ot.ResizeSensor(I,this.onWindowResize)));const M=i.getDelta();s.renderGeometries(r,M,this.playAnimation);for(let O=0;O<A.length;O++)A[O].renderGeometries(r,M,this.playAnimation);w!=null&&y!=null&&(t.clearDepth(),t.render(y,w));for(let O of Object.keys(o))o.hasOwnProperty(O)&&o[O].call();s.render(t);for(let O of Object.keys(u))u.hasOwnProperty(O)&&u[O].call()},this.forceContextLoss=()=>{t.forceContextLoss()},this.forceContextRestore=()=>{t.forceContextRestore()},this.getThreeJSRenderer=()=>t,this.isSceneActive=M=>{if(s===M)return!0;for(let O=0;O<A.length;O++)if(A[O]===M)return!0;return!1},this.addActiveScene=M=>{this.isSceneActive(M)||(A.push(M),N.add(M.getThreeJSScene()))},this.removeActiveScene=M=>{for(let O=0;O<A.length;O++)if(A[O]===M){A.splice(O,1),N.remove(M.getThreeJSScene());return}},this.clearAllActiveScene=()=>{for(let M=0;M<A.length;M++)N.remove(A[M].getThreeJSScene());A.splice(0,A.length)},this.dispose=()=>{F&&cancelAnimationFrame(p);for(const O in _)_.hasOwnProperty(O)&&_[O].clearAll();_=[],A=[],N=new S.Group,this.stopAnimate(),o={},a=0,u={},u=0,l={},c=0,d={},h=0,w=void 0,y=void 0,g=void 0;const M=this.createScene("default");this.setCurrentScene(M),D=void 0,t==null||t.dispose()},this.transitionScene=(M,O)=>{if(s){const k=s.getZincCameraControls(),P=M.getBoundingBox();if(P){const m=P.min.distanceTo(P.max)/2,L=(P.min.x+P.max.x)/2,b=(P.min.y+P.max.y)/2,B=(P.min.z+P.max.z)/2,R=k.getViewportFromCentreAndRadius(L,b,B,m,40,m*4),z=k.getCurrentViewport();k.cameraTransition(z,R,O),k.enableCameraTransition()}}},this.isWebGL2=()=>t?t.capabilities.isWebGL2:!1},Ds=Ni.version,Fs=function(){this.Revision=Ds,this.defaultMaterialColor=16777215,this.defaultOpacity=1,this.modelPrefix=void 0,this.Geometry=Fe,this.Glyph=Ke,this.Glyphset=ft,this.Pointset=Te,this.Label=ut,this.Lines=Ve,this.TextureArray=yt,this.TextureSlides=Ee,this.Renderer=Rs,this.Scene=Ct,this.Viewport=Ie,this.CameraControls=Ht,this.SmoothCameraTransition=ei,this.RayCaster=ti,this.CameraAutoTumble=ii,this.StereoEffect=ri,this.loadExternalFile=Tt,this.loadExternalFiles=Ri,this.THREE=S},Se=new Fs;return Se});
292
+ //# sourceMappingURL=zinc.js.map