zincjs 1.9.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/zinc.frontend.js +1 -1
- package/build/zinc.js +50 -45
- package/build/zinc.js.map +1 -1
- package/package.json +1 -1
- package/src/controls.js +4 -2
- package/src/loaders/primitivesLoader.js +202 -13
- package/src/primitives/lod.js +3 -2
- package/src/primitives/markerCluster.js +7 -3
- package/src/primitives/zincObject.js +9 -4
- package/src/sceneLoader.js +21 -10
- package/src/three/Geometry.js +79 -0
- package/src/utilities.js +23 -8
package/build/zinc.js
CHANGED
|
@@ -32,7 +32,7 @@ module.exports = require("url-polyfill");
|
|
|
32
32
|
/***/ ((module) => {
|
|
33
33
|
|
|
34
34
|
"use strict";
|
|
35
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"zincjs","version":"1.
|
|
35
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"zincjs","version":"1.10.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","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
36
|
|
|
37
37
|
/***/ }),
|
|
38
38
|
/* 3 */
|
|
@@ -85,9 +85,9 @@ module.exports = require("three");
|
|
|
85
85
|
/* 5 */
|
|
86
86
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
87
87
|
|
|
88
|
-
function _readOnlyError(name){throw new TypeError("\""+name+"\" is read-only")}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+"/",_readOnlyError("prefix"));/^(?:[a-z]+:)?\/\//i.test(url)||(actualURL=prefix+url)}return actualURL}function createNewURL(target,reference){var newURL=new URL(target,reference).href;//Make sure the target url does not contain parameters
|
|
88
|
+
function _readOnlyError(name){throw new TypeError("\""+name+"\" is read-only")}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+"/",_readOnlyError("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
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}/*
|
|
90
|
+
2===paramsStrings.length&&(newURL=newURL+"?"+paramsStrings[1])}return newURL}catch(_unused){console.error("There is an issue creting 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
91
|
* Calculate the bounding box of a mesh, values will be
|
|
92
92
|
* set for cachedBox, b1, v1 and v2 and they need to be
|
|
93
93
|
* defined.
|
|
@@ -126,7 +126,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
126
126
|
/* harmony export */ });
|
|
127
127
|
/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
|
128
128
|
/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_0__);
|
|
129
|
-
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;function Geometry(){// update flags
|
|
129
|
+
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
|
|
130
130
|
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
|
|
131
131
|
// http://www.iquilezles.org/www/articles/normals/normals.htm
|
|
132
132
|
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
|
|
@@ -137,26 +137,26 @@ var tmpGeo=new Geometry;tmpGeo.faces=this.faces;for(var _i5=0,_il2=this.morphTar
|
|
|
137
137
|
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
|
|
138
138
|
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
|
|
139
139
|
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
|
|
140
|
-
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)},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,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
|
|
141
|
-
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)}
|
|
142
|
-
for(var
|
|
143
|
-
for(var
|
|
144
|
-
for(var faceVertexUvs2,
|
|
140
|
+
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
|
|
141
|
+
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
|
|
142
|
+
for(var _i8=0,_il3=colors2.length;_i8<_il3;_i8++)colors1.push(colors2[_i8].clone());// faces
|
|
143
|
+
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
|
|
144
|
+
for(var faceVertexUvs2,_i10=0,_il5=geometry.faceVertexUvs.length;_i10<_il5;_i10++){faceVertexUvs2=geometry.faceVertexUvs[_i10],this.faceVertexUvs[_i10]===void 0&&(this.faceVertexUvs[_i10]=[]);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[_i10].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)},/*
|
|
145
145
|
* Checks for duplicate vertices with hashmap.
|
|
146
146
|
* Duplicated vertices are removed
|
|
147
147
|
* and faces' vertices are updated.
|
|
148
148
|
*/mergeVertices:function mergeVertices(){// Hashmap for looking up vertices by position coordinates (and making sure they are unique)
|
|
149
149
|
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
|
|
150
150
|
// have to remove them from the geometry.
|
|
151
|
-
for(var face,faceIndicesToRemove=[],
|
|
151
|
+
for(var face,faceIndicesToRemove=[],_i11=0,_il6=this.faces.length;_i11<_il6;_i11++){face=this.faces[_i11],face.a=changes[face.a],face.b=changes[face.b],face.c=changes[face.c];// if any duplicate vertices are found in a Face3
|
|
152
152
|
// we have to remove the face as nothing can be saved
|
|
153
|
-
for(var indices=[face.a,face.b,face.c],n=0;3>n;n++)if(indices[n]===indices[(n+1)%3]){faceIndicesToRemove.push(
|
|
153
|
+
for(var indices=[face.a,face.b,face.c],n=0;3>n;n++)if(indices[n]===indices[(n+1)%3]){faceIndicesToRemove.push(_i11);break}}for(var idx,_i12=faceIndicesToRemove.length-1;0<=_i12;_i12--){idx=faceIndicesToRemove[_i12],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
|
|
154
154
|
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
|
|
155
155
|
// tag faces
|
|
156
156
|
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
|
|
157
|
-
var newUvs1,newUvs2,uvs1=this.faceVertexUvs[0],uvs2=this.faceVertexUvs[1];uvs1&&uvs1.length===length&&(newUvs1=[]),uvs2&&uvs2.length===length&&(newUvs2=[]);for(var id,
|
|
158
|
-
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={},
|
|
159
|
-
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][
|
|
157
|
+
var newUvs1,newUvs2,uvs1=this.faceVertexUvs[0],uvs2=this.faceVertexUvs[1];uvs1&&uvs1.length===length&&(newUvs1=[]),uvs2&&uvs2.length===length&&(newUvs2=[]);for(var id,_i13=0;_i13<length;_i13++)id=faces[_i13]._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
|
|
158
|
+
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={},_i14=0;_i14<this.faces.length;_i14++){var face=this.faces[_i14],hasMaterial=!0,hasFaceUv=!1,hasFaceVertexUv=void 0!==this.faceVertexUvs[0][_i14],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
|
|
159
|
+
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][_i14];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(){/*
|
|
160
160
|
// Handle primitives
|
|
161
161
|
|
|
162
162
|
const parameters = this.parameters;
|
|
@@ -179,18 +179,18 @@ if(faceType=setBit(faceType,0,0),faceType=setBit(faceType,1,hasMaterial),faceTyp
|
|
|
179
179
|
|
|
180
180
|
return new this.constructor().copy( this );
|
|
181
181
|
*/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
|
|
182
|
-
for(var colors=source.colors,
|
|
183
|
-
for(var faces=source.faces,
|
|
184
|
-
for(var faceVertexUvs,
|
|
185
|
-
for(var morphTarget,morphTargets=source.morphTargets,
|
|
186
|
-
if(morphTarget={},morphTarget.name=morphTargets[
|
|
187
|
-
if(void 0!==morphTargets[
|
|
188
|
-
for(var morphNormal,morphNormals=source.morphNormals,
|
|
189
|
-
if(morphNormal={},void 0!==morphNormals[
|
|
190
|
-
if(void 0!==morphNormals[
|
|
191
|
-
for(var skinWeights=source.skinWeights,
|
|
192
|
-
for(var skinIndices=source.skinIndices,
|
|
193
|
-
for(var lineDistances=source.lineDistances,
|
|
182
|
+
for(var colors=source.colors,_i15=0,_il7=colors.length;_i15<_il7;_i15++)this.colors.push(colors[_i15].clone());// faces
|
|
183
|
+
for(var faces=source.faces,_i16=0,_il8=faces.length;_i16<_il8;_i16++)this.faces.push(faces[_i16].clone());// face vertex uvs
|
|
184
|
+
for(var faceVertexUvs,_i17=0,_il9=source.faceVertexUvs.length;_i17<_il9;_i17++){faceVertexUvs=source.faceVertexUvs[_i17],void 0===this.faceVertexUvs[_i17]&&(this.faceVertexUvs[_i17]=[]);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[_i17].push(uvsCopy)}}// morph targets
|
|
185
|
+
for(var morphTarget,morphTargets=source.morphTargets,_i18=0,_il10=morphTargets.length;_i18<_il10;_i18++){// vertices
|
|
186
|
+
if(morphTarget={},morphTarget.name=morphTargets[_i18].name,void 0!==morphTargets[_i18].vertices){morphTarget.vertices=[];for(var _j3=0,_jl3=morphTargets[_i18].vertices.length;_j3<_jl3;_j3++)morphTarget.vertices.push(morphTargets[_i18].vertices[_j3].clone())}// normals
|
|
187
|
+
if(void 0!==morphTargets[_i18].normals){morphTarget.normals=[];for(var _j4=0,_jl4=morphTargets[_i18].normals.length;_j4<_jl4;_j4++)morphTarget.normals.push(morphTargets[_i18].normals[_j4].clone())}this.morphTargets.push(morphTarget)}// morph normals
|
|
188
|
+
for(var morphNormal,morphNormals=source.morphNormals,_i19=0,_il11=morphNormals.length;_i19<_il11;_i19++){// vertex normals
|
|
189
|
+
if(morphNormal={},void 0!==morphNormals[_i19].vertexNormals){morphNormal.vertexNormals=[];for(var _j5=0,_jl5=morphNormals[_i19].vertexNormals.length;_j5<_jl5;_j5++){var srcVertexNormal=morphNormals[_i19].vertexNormals[_j5],destVertexNormal={};destVertexNormal.a=srcVertexNormal.a.clone(),destVertexNormal.b=srcVertexNormal.b.clone(),destVertexNormal.c=srcVertexNormal.c.clone(),morphNormal.vertexNormals.push(destVertexNormal)}}// face normals
|
|
190
|
+
if(void 0!==morphNormals[_i19].faceNormals){morphNormal.faceNormals=[];for(var _j6=0,_jl6=morphNormals[_i19].faceNormals.length;_j6<_jl6;_j6++)morphNormal.faceNormals.push(morphNormals[_i19].faceNormals[_j6].clone())}this.morphNormals.push(morphNormal)}// skin weights
|
|
191
|
+
for(var skinWeights=source.skinWeights,_i20=0,_il12=skinWeights.length;_i20<_il12;_i20++)this.skinWeights.push(skinWeights[_i20].clone());// skin indices
|
|
192
|
+
for(var skinIndices=source.skinIndices,_i21=0,_il13=skinIndices.length;_i21<_il13;_i21++)this.skinIndices.push(skinIndices[_i21].clone());// line distances
|
|
193
|
+
for(var lineDistances=source.lineDistances,_i22=0,_il14=lineDistances.length;_i22<_il14;_i22++)this.lineDistances.push(lineDistances[_i22]);// bounding box
|
|
194
194
|
var boundingBox=source.boundingBox;null!==boundingBox&&(this.boundingBox=boundingBox.clone());// bounding sphere
|
|
195
195
|
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
|
|
196
196
|
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
|
|
@@ -198,21 +198,21 @@ face.materialIndex!==materialIndex&&(materialIndex=face.materialIndex,void 0!==g
|
|
|
198
198
|
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
|
|
199
199
|
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))}//
|
|
200
200
|
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 );
|
|
201
|
-
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),
|
|
201
|
+
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),_i23=0;_i23<3*this.vertices.length;_i23++)colorsArray[_i23]=1;buffergeometry.setAttribute("color",new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(colorsArray,3))}if(0<this.faces.length){for(var _colors=[],indices=[],_i24=0;_i24<this.faces.length;_i24++){indices.push(this.faces[_i24].a,this.faces[_i24].b,this.faces[_i24].c);var vertexColors=this.faces[_i24].vertexColors;if(3===vertexColors.length)_colors.push(vertexColors[0],vertexColors[1],vertexColors[2]);else{var color=this.faces[_i24].color;_colors.push(color,color,color)}}// if ( colors.length > 0 ) {
|
|
202
202
|
// const colorsArray = new Float32Array( colors.length * 3 );
|
|
203
203
|
// buffergeometry.setAttribute( 'color', new BufferAttribute( colorsArray, 3 ).copyColorsArray( colors ) );
|
|
204
204
|
// }
|
|
205
205
|
buffergeometry.setIndex(indices),buffergeometry.groups=this.computeGroups()}// morphs
|
|
206
|
-
if(0<this.morphTargets.length){for(var array=[],normalsArray=[],
|
|
206
|
+
if(0<this.morphTargets.length){for(var array=[],normalsArray=[],_i25=0,l=this.morphTargets.length;_i25<l;_i25++){var morphTarget=this.morphTargets[_i25],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
|
|
207
207
|
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))}//
|
|
208
208
|
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 = [];
|
|
209
209
|
// update flags
|
|
210
210
|
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
|
|
211
211
|
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
|
|
212
|
-
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
|
|
213
|
-
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,
|
|
214
|
-
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[
|
|
215
|
-
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
|
|
212
|
+
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 _i26=0;_i26<morphNormalsLength;_i26++)morphTargetsNormal[_i26]={name:morphNormals[_i26].name,data:[]};this.morphTargets.normal=morphTargetsNormal}// skins
|
|
213
|
+
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,_i27=0;_i27<faces.length;_i27++){face=faces[_i27],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][_i27];void 0===vertexUvs?(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",_i27),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][_i27];void 0===_vertexUvs?(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",_i27),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
|
|
214
|
+
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[_i27],morphTargetsNormal[_j7].data.push(morphNormal.a,morphNormal.b,morphNormal.c);// skins
|
|
215
|
+
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 _i28=0,_il15=source.vertexColors.length;_i28<_il15;_i28++)this.vertexColors[_i28]=source.vertexColors[_i28].clone();return this}}
|
|
216
216
|
|
|
217
217
|
/***/ }),
|
|
218
218
|
/* 7 */
|
|
@@ -239,7 +239,7 @@ module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABz
|
|
|
239
239
|
/* 10 */
|
|
240
240
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
241
241
|
|
|
242
|
-
var THREE=__webpack_require__(4),createBufferGeometry=(__webpack_require__(5).createBufferGeometry),uniqueiId=0,getUniqueId=function(){return"pr"+uniqueiId++},ZincObject=function(){// THREE.Mesh
|
|
242
|
+
var THREE=__webpack_require__(4),createBufferGeometry=(__webpack_require__(5).createBufferGeometry),resolveURL=(__webpack_require__(5).resolveURL),uniqueiId=0,getUniqueId=function(){return"pr"+uniqueiId++},ZincObject=function(){// THREE.Mesh
|
|
243
243
|
/**
|
|
244
244
|
* Groupname given to this geometry.
|
|
245
245
|
*/ /**
|
|
@@ -412,13 +412,13 @@ this._lod.setFrustumCulled(flag)},ZincObject.prototype.setVertexColors=function(
|
|
|
412
412
|
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.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.geoemtry){var position=morph.geometry.attributes.position;if(this._b1.setFromBufferAttribute(position),this._b1.getCenter(this._v1),position)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}return this.getBoundingBox(),position.copy(this.center),applyMatrixWorld?position.applyMatrix4(this.morph.matrixWorld):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
|
|
413
413
|
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),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
|
|
414
414
|
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)},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
|
|
415
|
-
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,preload){this._lod.addLevelFromURL(loader,level,url,preload)},ZincObject.prototype.addVertices=function(coords){var mesh=this.getMorph(),geometry=void 0;if(!mesh)geometry=createBufferGeometry(
|
|
415
|
+
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.setPosition=function(x,y,z){var group=this.getGroup();group&&(group.position.set(x,y,z),group.updateMatrix(),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;
|
|
416
416
|
|
|
417
417
|
/***/ }),
|
|
418
418
|
/* 11 */
|
|
419
419
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
420
420
|
|
|
421
|
-
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,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}),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)),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
|
|
421
|
+
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
|
|
422
422
|
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
|
|
423
423
|
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)})}};/**
|
|
424
424
|
* Provides an object which stores meshes at different levels based
|
|
@@ -1185,7 +1185,7 @@ var localGroup=new THREE.Group,sprite=new THREE.Sprite(spriteMaterial);return sp
|
|
|
1185
1185
|
*/ /**
|
|
1186
1186
|
* Disable and hide the marker.
|
|
1187
1187
|
*/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
|
|
1188
|
-
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
|
|
1188
|
+
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}};/**
|
|
1189
1189
|
* A special graphics type with a tear drop shape.
|
|
1190
1190
|
* It forms a cluster a marker based on distance.
|
|
1191
1191
|
*
|
|
@@ -1217,12 +1217,12 @@ var THREE=__webpack_require__(4),resolveURL=(__webpack_require__(5).resolveURL),
|
|
|
1217
1217
|
* [totalsize, totalLoaded and errorDownload] of all the downloads happening
|
|
1218
1218
|
* in this scene.
|
|
1219
1219
|
* @returns {Array}
|
|
1220
|
-
*/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=>
|
|
1220
|
+
*/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 one of the external resource: ".concat(null===xhr||void 0===xhr?void 0:xhr.responseURL,".")),finishCallback&&finishCallback()};var loadMultipleViews=(referenceURL,views)=>{var defaultView=views.Default;if(views.Inline)scene.setupMultipleViews(defaultView,views.Entries);else{var promises=[],_loop=function _loop(key){referenceURL&&(newURL=createNewURL(value,referenceURL),promises.push(new Promise((resolve,reject)=>{// Add parameters if we are sent them
|
|
1221
1221
|
fetch(newURL).then(response=>response.json()).then(data=>resolve({key:key,data:data})).catch(data=>reject(data))})))};for(var[key,value]of Object.entries(views.Entries))_loop(key);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})}};/**
|
|
1222
1222
|
* Load the viewport from an external location provided by the url.
|
|
1223
1223
|
* @param {String} URL - address to the file containing viewport information.
|
|
1224
1224
|
*/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()};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.
|
|
1225
|
-
var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,lod,finishCallback)=>(geometry,materials)=>{var newLines=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.anatomicalId=anatomicalId,newLines.setRenderOrder(renderOrder),region.addZincObject(newLines),newLines.setDuration(scene.getDuration()),lod&&lod.levels))for(var[key,value]of Object.entries(lod.levels))newLines.addLOD(primitivesLoader,key,value.URL,lod.preload);--this.toBeDownloaded,geometry.dispose(),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newLines)};/**
|
|
1225
|
+
var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,lod,finishCallback)=>(geometry,materials)=>{var newLines=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.anatomicalId=anatomicalId,newLines.setRenderOrder(renderOrder),region.addZincObject(newLines),newLines.setDuration(scene.getDuration()),console.log(lod),lod&&lod.levels))for(var[key,value]of Object.entries(lod.levels))newLines.addLOD(primitivesLoader,key,value.URL,value.Index,lod.preload);--this.toBeDownloaded,geometry.dispose(),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newLines)};/**
|
|
1226
1226
|
* Load lines into this scene object.
|
|
1227
1227
|
*
|
|
1228
1228
|
* @param {Boolean} timeEnabled - Indicate if morphing is enabled.
|
|
@@ -1230,7 +1230,7 @@ var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId
|
|
|
1230
1230
|
* @param {STRING} groupName - name to assign the pointset's groupname to.
|
|
1231
1231
|
* @param {Function} finishCallback - Callback function which will be called
|
|
1232
1232
|
* once the glyphset is succssfully load in.
|
|
1233
|
-
*/this.loadLinesURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{var localTimeEnabled=0;this.toBeDownloaded+=1;var isInline=!!(options&&options.isInline)&&options.isInline,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&options.renderOrder?options.renderOrder:void 0;null!=timeEnabled&&(localTimeEnabled=!!timeEnabled);var localMorphColour=0;if(null!=morphColour&&(localMorphColour=!!morphColour),isInline){var object=primitivesLoader.parse(url);linesloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options.lod,finishCallback)(object.geometry,object.materials)}else primitivesLoader.load(url,linesloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options.lod,finishCallback),this.onProgress(url),this.onError(finishCallback))};var loadGlyphset=(region,glyphsetData,glyphurl,groupName,finishCallback,options)=>{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&&options.renderOrder?options.renderOrder:void 0,newGlyphset=new((__webpack_require__(18).Glyphset));newGlyphset.setDuration(scene.getDuration()),newGlyphset.groupName=groupName;var myCallback=()=>{--this.toBeDownloaded,finishCallback!=null&&"function"==typeof finishCallback&&finishCallback(newGlyphset)};++this.toBeDownloaded,isInline?newGlyphset.load(glyphsetData,glyphurl,myCallback,isInline,displayLabels):newGlyphset.load(glyphsetData,resolveURL(glyphurl),myCallback,isInline,displayLabels),newGlyphset.anatomicalId=anatomicalId,newGlyphset.setRenderOrder(renderOrder),region.addZincObject(newGlyphset)},onLoadGlyphsetReady=(region,xmlhttp,glyphurl,groupName,finishCallback,options)=>()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){var glyphsetData=JSON.parse(xmlhttp.responseText);loadGlyphset(region,glyphsetData,glyphurl,groupName,finishCallback,options)}},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.anatomicalId=anatomicalId,region.addZincObject(newPointset),newPointset.setDuration(scene.getDuration()),newPointset.setRenderOrder(renderOrder)),geometry.dispose(),--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newPointset)};//Load a glyphset into this scene.
|
|
1233
|
+
*/this.loadLinesURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{var localTimeEnabled=0;this.toBeDownloaded+=1;var isInline=!!(options&&options.isInline)&&options.isInline,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&options.renderOrder?options.renderOrder:void 0;null!=timeEnabled&&(localTimeEnabled=!!timeEnabled);var localMorphColour=0;if(null!=morphColour&&(localMorphColour=!!morphColour),isInline){var object=primitivesLoader.parse(url);linesloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options.lod,finishCallback)(object.geometry,object.materials)}else primitivesLoader.load(url,linesloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options.lod,finishCallback),this.onProgress(url),this.onError(finishCallback),options.loaderOptions)};var loadGlyphset=(region,glyphsetData,glyphurl,groupName,finishCallback,options)=>{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&&options.renderOrder?options.renderOrder:void 0,newGlyphset=new((__webpack_require__(18).Glyphset));newGlyphset.setDuration(scene.getDuration()),newGlyphset.groupName=groupName;var myCallback=()=>{--this.toBeDownloaded,finishCallback!=null&&"function"==typeof finishCallback&&finishCallback(newGlyphset)};++this.toBeDownloaded,isInline?newGlyphset.load(glyphsetData,glyphurl,myCallback,isInline,displayLabels):newGlyphset.load(glyphsetData,resolveURL(glyphurl),myCallback,isInline,displayLabels),newGlyphset.anatomicalId=anatomicalId,newGlyphset.setRenderOrder(renderOrder),region.addZincObject(newGlyphset)},onLoadGlyphsetReady=(region,xmlhttp,glyphurl,groupName,finishCallback,options)=>()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){var glyphsetData=JSON.parse(xmlhttp.responseText);loadGlyphset(region,glyphsetData,glyphurl,groupName,finishCallback,options)}},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.anatomicalId=anatomicalId,region.addZincObject(newPointset),newPointset.setDuration(scene.getDuration()),newPointset.setRenderOrder(renderOrder)),geometry.dispose(),--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newPointset)};//Load a glyphset into this scene.
|
|
1234
1234
|
//Internal loader for zinc pointset.
|
|
1235
1235
|
/**
|
|
1236
1236
|
* Read a STL file into this scene, the geometry will be presented as
|
|
@@ -1252,7 +1252,7 @@ var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId
|
|
|
1252
1252
|
* @param {STRING} fileFormat - name supported formats are STL, OBJ and JSON.
|
|
1253
1253
|
* @param {Function} finishCallback - Callback function which will be called
|
|
1254
1254
|
* once the geometry is succssfully loaded in.
|
|
1255
|
-
*/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&&options.renderOrder?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);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))},metaFinishCallback=function metaFinishCallback(numberOfDownloaded,finishCallback,allCompletedCallback){var downloadedItem=0;return zincObject=>{if(++downloadedItem,zincObject&&null!=finishCallback&&"function"==typeof finishCallback){finishCallback(zincObject);var zincCameraControls=scene.getZincCameraControls();zincCameraControls&&zincCameraControls.calculateMaxAllowedDistance(scene)}downloadedItem==numberOfDownloaded&&(!1==viewLoaded&&scene.viewAll(),null!=allCompletedCallback&&"function"==typeof allCompletedCallback&&allCompletedCallback())}};//Object to keep track of number of items downloaded and when all items are downloaded
|
|
1255
|
+
*/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&&options.renderOrder?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);var zincCameraControls=scene.getZincCameraControls();zincCameraControls&&zincCameraControls.calculateMaxAllowedDistance(scene)}downloadedItem==numberOfDownloaded&&(!1==viewLoaded&&scene.viewAll(),null!=allCompletedCallback&&"function"==typeof allCompletedCallback&&allCompletedCallback())}};//Object to keep track of number of items downloaded and when all items are downloaded
|
|
1256
1256
|
//allCompletedCallback is called
|
|
1257
1257
|
/**
|
|
1258
1258
|
* Load a pointset into this scene object.
|
|
@@ -1262,7 +1262,7 @@ var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId
|
|
|
1262
1262
|
* @param {STRING} groupName - name to assign the pointset's groupname to.
|
|
1263
1263
|
* @param {Function} finishCallback - Callback function which will be called
|
|
1264
1264
|
* once the glyphset is succssfully load in.
|
|
1265
|
-
*/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&&options.renderOrder?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))};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&&options.renderOrder?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=()=>{--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newTexture)};++this.toBeDownloaded,newTexture.load(textureData,myCallback,isInline),newTexture.anatomicalId=anatomicalId,newTexture.setRenderOrder(renderOrder),region.addZincObject(newTexture)}}},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.
|
|
1265
|
+
*/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&&options.renderOrder?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&&options.renderOrder?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=()=>{--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newTexture)};++this.toBeDownloaded,newTexture.load(textureData,myCallback,isInline),newTexture.anatomicalId=anatomicalId,newTexture.setRenderOrder(renderOrder),region.addZincObject(newTexture)}}},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.
|
|
1266
1266
|
/**
|
|
1267
1267
|
* Load a texture into this scene object.
|
|
1268
1268
|
*
|
|
@@ -1282,13 +1282,13 @@ var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId
|
|
|
1282
1282
|
* @param {THREE.Material} materialIn - Material to be set for this geometry if it is present.
|
|
1283
1283
|
*
|
|
1284
1284
|
* @returns {Zinc.Geometry}
|
|
1285
|
-
*/var addZincGeometry=(region,geometryIn,colour,opacity,localTimeEnabled,localMorphColour,finishCallback,materialIn,groupName)=>{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),region&®ion.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);if(zincGeometry.anatomicalId=anatomicalId,zincGeometry.setRenderOrder(renderOrder),options.lod&&options.lod.levels)for(var[key,value]of Object.entries(options.lod.levels))zincGeometry.addLOD(primitivesLoader,key,value.URL,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)?)?$/,[,years,months,weeks,days,hours,mins,secs]=durationString.match(regex);return{years:years,months:months,weeks:weeks,days:days,hours:hours,mins:mins,secs:secs}};//Internal loader for a regular zinc geometry.
|
|
1285
|
+
*/var addZincGeometry=(region,geometryIn,colour,opacity,localTimeEnabled,localMorphColour,finishCallback,materialIn,groupName)=>{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),region&®ion.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);if(zincGeometry.anatomicalId=anatomicalId,zincGeometry.setRenderOrder(renderOrder),options.lod&&options.lod.levels)for(var[key,value]of Object.entries(options.lod.levels))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)?)?$/,[,years,months,weeks,days,hours,mins,secs]=durationString.match(regex);return{years:years,months:months,weeks:weeks,days:days,hours:hours,mins:mins,secs:secs}};//Internal loader for a regular zinc geometry.
|
|
1286
1286
|
//Turn ISO 8601 duration string into an array.
|
|
1287
1287
|
//Load settings from metadata item.
|
|
1288
1288
|
this.loadSettings=item=>{if(item){//duration uses the ISO 8601 standard - PnYnMnDTnHnMnS
|
|
1289
1289
|
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
|
|
1290
1290
|
//settings.
|
|
1291
|
-
var readPrimitivesItem=(region,referenceURL,item,order,finishCallback)=>{if(item){var _newURL2=void 0,isInline=!1;item.URL?(_newURL2=item.URL,referenceURL&&(_newURL2=createNewURL(
|
|
1291
|
+
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[key,value]of Object.entries(item.LOD.Levels))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,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),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
|
|
1292
1292
|
/**
|
|
1293
1293
|
* Load GLTF into this scene object.
|
|
1294
1294
|
*
|
|
@@ -1458,7 +1458,11 @@ if(0<state.vertices.length){var _material2=new three__WEBPACK_IMPORTED_MODULE_0_
|
|
|
1458
1458
|
/* 38 */
|
|
1459
1459
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1460
1460
|
|
|
1461
|
-
var
|
|
1461
|
+
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(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}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,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 allData=[],loader=new FileLoader,jsonLoader=new JSONLoader;loader.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){var obj=jsonLoader.parse(modelData);item.onLoad(obj.geometry,obj.materials)}else processItemError(item,{responseURL:url})},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,loader.load(url,onDownloaded,progressHandling,errorHandling))}},MultiSourcesHandler=function MultiSourcesHandler(numberIn,onLoadCallback){var allData=[],number=numberIn,onLoad=onLoadCallback,totalDownloaded=0;this.itemDownloaded=(order,args)=>{if(allData[order]=args,totalDownloaded++,totalDownloaded==number){//All geometries will be merged into the first one
|
|
1462
|
+
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)}}};exports.PrimitivesLoader=function(){var concurrentDownloads=0,MAX_DOWNLOAD=20;this.crossOrigin="Anonymous";var loader=new JSONLoader,waitingList=[],indexedLoaders={},loadFromMultipleSources=(urls,onLoad,onProgress,onError,options)=>{var number=urls.length,msHandler=new MultiSourcesHandler(number,onLoad),order=0;//The order here will give us hint on the sequence on merging the primitives
|
|
1463
|
+
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){var onLoadCallback=new onFinally(void 0,this,newOptions);++concurrentDownloads,indexedLoader=new IndexedSourcesHandler(url,this.crossOrigin,onLoadCallback),indexedLoaders[url]=indexedLoader}newOptions.isHandler=indexedLoader,indexedLoader.load(options.index,onLoad,onProgress,onError)},loadFromSingleSource=(url,onLoad,onProgress,onError,options)=>{if(!(MAX_DOWNLOAD>concurrentDownloads))waitingList.push({url,onLoad,onProgress,onError,options});else if(options&&void 0!==options.index)handleIndexedSource(url,onLoad,onProgress,onError,options);else{++concurrentDownloads;var onLoadCallback=new onFinally(onLoad,this,options),onErrorCallback=new onFinally(onError,this,options);loader.crossOrigin=this.crossOrigin,loader.load(url,onLoadCallback,onProgress,onErrorCallback)}};//URL to loader pair
|
|
1464
|
+
//Load the first file then the rest will be handled separately
|
|
1465
|
+
this.load=(url,onLoad,onProgress,onError,options)=>{Array.isArray(url)?loadFromMultipleSources(url,onLoad,onProgress,onError,options):loadFromSingleSource(url,onLoad,onProgress,onError,options)},this.loadFromWaitingList=()=>{var item=waitingList.shift();if(item)this.load(item.url,item.onLoad,item.onProgress,item.onError,item.options);else 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()}};this.parse=data=>loader.parse(data)};
|
|
1462
1466
|
|
|
1463
1467
|
/***/ }),
|
|
1464
1468
|
/* 39 */
|
|
@@ -1885,7 +1889,8 @@ var handleSyncControl=()=>{this._state===STATE.ROTATE||this._state===STATE.TOUCH
|
|
|
1885
1889
|
*/ /**
|
|
1886
1890
|
* Disable syncControl.
|
|
1887
1891
|
*/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?tumble():this._state===STATE.PAN||this._state===STATE.TOUCH_PAN?translate():(this._state===STATE.ZOOM||this._state===STATE.TOUCH_ZOOM||this._state===STATE.SCROLL)&&flyZoom(),this._state!==STATE.NONE&¤tMode===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},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()},this.getViewportFromCentreAndRadius=(centreX,centreY,centreZ,radius,view_angle,clip_distance)=>{var eyex=this.cameraObject.position.x-this.cameraObject.target.x,eyey=this.cameraObject.position.y-this.cameraObject.target.y,eyez=this.cameraObject.position.z-this.cameraObject.target.z,fact=1/Math.sqrt(eyex*eyex+eyey*eyey+eyez*eyez);eyex*=fact,eyey*=fact,eyez*=fact;/* look at the centre of the sphere */var localTargetPosition=[centreX,centreY,centreZ],eye_distance=radius/Math.tan(view_angle*Math.PI/360),localEyePosition=[centreX+eyex*eye_distance,centreY+eyey*eye_distance,centreZ+eyez*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
|
|
1888
|
-
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)
|
|
1892
|
+
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
|
|
1893
|
+
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
|
|
1889
1894
|
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};/**
|
|
1890
1895
|
* Object with containg viewport information used in ZincJS.
|
|
1891
1896
|
*
|