zincjs 1.18.4 → 1.18.6
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 +24 -24
- package/build/zinc.js.map +1 -1
- package/package.json +1 -1
- package/src/primitives/glyph.js +4 -4
- package/src/primitives/glyphset.js +29 -18
- package/src/sceneLoader.js +5 -5
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.18.
|
|
35
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"zincjs","version":"1.18.6","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 */
|
|
@@ -595,18 +595,18 @@ var THREE=__webpack_require__(4),Glyph=function(geometry,materialIn,idIn,glyphse
|
|
|
595
595
|
* transformation.
|
|
596
596
|
*/ /**
|
|
597
597
|
* Set the color of the glyph and its label.
|
|
598
|
-
*
|
|
598
|
+
*
|
|
599
599
|
* @param {THREE.Color} color - Colour to be set.
|
|
600
600
|
*/ /**
|
|
601
601
|
* Clear and free its memory.
|
|
602
602
|
*/this.fromMesh=meshIn=>!!(meshIn&&meshIn.isMesh)&&(this.morph=meshIn.clone(),this.morph.userData=this,this.group.add(this.morph),!0),geometry&&material&&this.fromMesh(new THREE.Mesh(geometry,material)),this.getGlyphset=function(){return glyphsetIn},this.setLabel=text=>{text&&("string"==typeof text||text instanceof String)&&(labelString=text,this.morph&&(this.morph.name=text))},this.showLabel=colour=>{label&&(_position=label.getPosition(),this.group.remove(label.getSprite()),label.dispose(),label=void 0),labelString&&("string"==typeof labelString||labelString instanceof String)&&(label=new((__webpack_require__(17).Label))(labelString,colour),label.setPosition(_position[0],_position[1],_position[2]),this.group.add(label.getSprite()))},this.hideLabel=()=>{label&&(_position=label.getPosition(),this.group.remove(label.getSprite()),label.dispose(),label=void 0)},this.getLabel=()=>labelString,this.getMesh=()=>this.morph,this.setTransformation=(position,axis1,axis2,axis3)=>{this.morph&&(this.morph.matrix.elements[0]=axis1[0],this.morph.matrix.elements[1]=axis1[1],this.morph.matrix.elements[2]=axis1[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=axis2[0],this.morph.matrix.elements[5]=axis2[1],this.morph.matrix.elements[6]=axis2[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=axis3[0],this.morph.matrix.elements[9]=axis3[1],this.morph.matrix.elements[10]=axis3[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=position[0],this.morph.matrix.elements[13]=position[1],this.morph.matrix.elements[14]=position[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),_position=[...position],label&&label.setPosition(position[0],position[1],position[2])},this.setColour=color=>{label&&label.setColour(color),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry&&(this.geometry.colorsNeedUpdate=!0)},this.dispose=()=>{this.material&&this.material.dispose(),this.morph=void 0}};/**
|
|
603
|
-
* Zinc representation of glyph graphic, it contains the colours,
|
|
603
|
+
* Zinc representation of glyph graphic, it contains the colours,
|
|
604
604
|
* geometry and transformation of the glyph.
|
|
605
|
-
*
|
|
605
|
+
*
|
|
606
606
|
* @param {THREE.Geometry} geometry - Geometry of the glyph .
|
|
607
607
|
* @param {THREE.Material} materialIn - Material of the glyph.
|
|
608
608
|
* @param {Number} idIn - Id of the glyph.
|
|
609
|
-
*
|
|
609
|
+
*
|
|
610
610
|
* @class
|
|
611
611
|
* @author Alan Wu
|
|
612
612
|
* @return {Glyph}
|
|
@@ -683,19 +683,19 @@ var SpriteText=(__webpack_require__(7)["default"]);/**
|
|
|
683
683
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
684
684
|
|
|
685
685
|
var THREE=__webpack_require__(4),JSONLoader=(__webpack_require__(19).JSONLoader),Glyphset=function(){(__webpack_require__(10).ZincObject).call(this);var glyphList=[],axis1s=void 0,axis2s=void 0,axis3s=void 0,positions=void 0,scales=void 0,colors=void 0,labels=void 0,numberOfTimeSteps=0,numberOfVertices=0,baseSize=[0,0,0],offset=[0,0,0],scaleFactors=[0,0,0],repeat_mode="NONE";this.ready=!1;var morphColours=!1,morphVertices=!1;this.isGlyphset=!0;var _transformMatrix=new THREE.Matrix4,_bot_colour=new THREE.Color,_top_colour=new THREE.Color,_boundingBox1=new THREE.Box3,_boundingBox2=new THREE.Box3,_boundingBox3=new THREE.Box3,_points=[],_current_positions=[],_current_axis1s=[],_current_axis2s=[],_current_axis3s=[],_current_scales=[],_current_colors=[],_glyph_axis_array=[];this.globalScale=1;for(var i=0;8>i;i++)_points[i]=new THREE.Vector3;/**
|
|
686
|
-
* Copy glyphset data into this glyphset then load the glyph's geoemtry
|
|
686
|
+
* Copy glyphset data into this glyphset then load the glyph's geoemtry
|
|
687
687
|
* with the provided glyphURL. FinishCallback will be called once
|
|
688
688
|
* glyph is loaded.
|
|
689
|
-
*
|
|
689
|
+
*
|
|
690
690
|
* @param {Array} glyphsetData - contains the informations about the glyphs.
|
|
691
691
|
* @param {String} glyphURL - URL to the geometry which will be applied to all
|
|
692
692
|
* all the glyphs in the glyphset once loaded.
|
|
693
693
|
* @param {Function} finishCallback - User's function to be called once glyph's
|
|
694
694
|
* geometry is loaded.
|
|
695
695
|
*/this.load=(glyphsetData,glyphURL,finishCallback,isInline,displayLabels)=>{axis1s=glyphsetData.axis1,axis2s=glyphsetData.axis2,axis3s=glyphsetData.axis3,positions=glyphsetData.positions,scales=glyphsetData.scale,colors=glyphsetData.colors,labels=glyphsetData.label,morphColours=glyphsetData.metadata.MorphColours,morphVertices=glyphsetData.metadata.MorphVertices,numberOfTimeSteps=glyphsetData.metadata.number_of_time_steps,repeat_mode=glyphsetData.metadata.repeat_mode,numberOfVertices=glyphsetData.metadata.number_of_vertices,"AXES_2D"==repeat_mode||"MIRROR"==repeat_mode?numberOfVertices*=2:"AXES_3D"==repeat_mode&&(numberOfVertices*=3),baseSize=glyphsetData.metadata.base_size,offset=glyphsetData.metadata.offset,scaleFactors=glyphsetData.metadata.scale_factors;var loader=new JSONLoader;this.geometry=new THREE.BufferGeometry;var instancedMesh=new THREE.InstancedMesh(this.geometry,void 0,numberOfVertices);if(this.setMorph(instancedMesh),isInline){var object=loader.parse(glyphURL);meshloader(finishCallback,displayLabels)(object.geometry,object.materials),object.geometry.dispose()}else loader.crossOrigin="Anonymous",loader.load(glyphURL,meshloader(finishCallback,displayLabels))};/**
|
|
696
|
-
* Calculate the actual transformation value that can be applied
|
|
696
|
+
* Calculate the actual transformation value that can be applied
|
|
697
697
|
* to the transformation matrix.
|
|
698
|
-
*
|
|
698
|
+
*
|
|
699
699
|
* @returns {Array}
|
|
700
700
|
*/var resolve_glyph_axes=(point,axis1,axis2,axis3,scale,return_arrays)=>{if("NONE"==repeat_mode||"MIRROR"==repeat_mode){for(var sign,axis_scale=[0,0,0],final_axis1=[0,0,0],final_axis2=[0,0,0],final_axis3=[0,0,0],final_point=[0,0,0],mirrored_axis1=[0,0,0],mirrored_axis2=[0,0,0],mirrored_axis3=[0,0,0],mirrored_point=[0,0,0],j=0;3>j;j++)sign=0>scale[j]?-1:1,axis_scale[j]=(sign*baseSize[j]+scale[j]*scaleFactors[j])*this.globalScale;for(var j=0;3>j;j++)final_axis1[j]=axis1[j]*axis_scale[0],final_axis2[j]=axis2[j]*axis_scale[1],final_axis3[j]=axis3[j]*axis_scale[2],final_point[j]=point[j]+offset[0]*final_axis1[j]+offset[1]*final_axis2[j]+offset[2]*final_axis3[j],"MIRROR"==repeat_mode&&(mirrored_axis1[j]=-final_axis1[j],mirrored_axis2[j]=-final_axis2[j],mirrored_axis3[j]=-final_axis3[j],mirrored_point[j]=final_point[j],0>scale[0]&&(final_point[j]-=final_axis1[j],mirrored_point[j]-=mirrored_axis1[j]));/* if required, reverse axis3 to maintain right-handed coordinate system */0>final_axis3[0]*(final_axis1[1]*final_axis2[2]-final_axis1[2]*final_axis2[1])+final_axis3[1]*(final_axis1[2]*final_axis2[0]-final_axis1[0]*final_axis2[2])+final_axis3[2]*(final_axis1[0]*final_axis2[1]-final_axis1[1]*final_axis2[0])&&(final_axis3[0]=-final_axis3[0],final_axis3[1]=-final_axis3[1],final_axis3[2]=-final_axis3[2]),return_arrays[0]=[final_point,final_axis1,final_axis2,final_axis3],"MIRROR"==repeat_mode&&(0>mirrored_axis3[0]*(mirrored_axis1[1]*mirrored_axis2[2]-mirrored_axis1[2]*mirrored_axis2[1])+mirrored_axis3[1]*(mirrored_axis1[2]*mirrored_axis2[0]-mirrored_axis1[0]*mirrored_axis2[2])+mirrored_axis3[2]*(mirrored_axis1[0]*mirrored_axis2[1]-mirrored_axis1[1]*mirrored_axis2[0])&&(mirrored_axis3[0]=-mirrored_axis3[0],mirrored_axis3[1]=-mirrored_axis3[1],mirrored_axis3[2]=-mirrored_axis3[2]),return_arrays[1]=[mirrored_point,mirrored_axis1,mirrored_axis2,mirrored_axis3])}else if("AXES_2D"==repeat_mode||"AXES_3D"==repeat_mode){for(var sign,_axis_scale=[0,0,0],_final_point=[0,0,0],j=0;3>j;j++)sign=0>scale[j]?-1:1,_axis_scale[j]=(sign*baseSize[0]+scale[j]*scaleFactors[0])*this.globalScale;for(var j=0;3>j;j++)_final_point[j]=point[j]+offset[0]*_axis_scale[0]*axis1[j]+offset[1]*_axis_scale[1]*axis2[j]+offset[2]*_axis_scale[2]*axis3[j];for(var number_of_glyphs="AXES_2D"==glyph_repeat_mode?2:3,k=0;k<number_of_glyphs;k++){var use_axis1=void 0,use_axis2=void 0,use_scale=scale[k],_final_axis=[0,0,0],_final_axis2=[0,0,0],_final_axis3=[0,0,0];0==k?(use_axis1=axis1,use_axis2=axis2):1==k?(use_axis1=axis2,use_axis2="AXES_2D"==glyph_repeat_mode?axis1:axis3):(use_axis1=axis3,use_axis2=axis1);var final_scale1=(baseSize[0]+use_scale*scaleFactors[0])*this.globalScale;_final_axis[0]=use_axis1[0]*final_scale1,_final_axis[1]=use_axis1[1]*final_scale1,_final_axis[2]=use_axis1[2]*final_scale1,_final_axis3[0]=_final_axis[1]*use_axis2[2]-use_axis2[1]*_final_axis[2],_final_axis3[1]=_final_axis[2]*use_axis2[0]-use_axis2[2]*_final_axis[0],_final_axis3[2]=_final_axis[0]*use_axis2[1]-_final_axis[1]*use_axis2[0];var magnitude=Math.sqrt(_final_axis3[0]*_final_axis3[0]+_final_axis3[1]*_final_axis3[1]+_final_axis3[2]*_final_axis3[2]);if(0<magnitude){var _scaling=(baseSize[2]+use_scale*scaleFactors[2])*this.globalScale/magnitude;"AXES_2D"==repeat_mode&&0<k&&(_scaling*=-1),_final_axis3[0]*=_scaling,_final_axis3[1]*=_scaling,_final_axis3[2]*=_scaling}if(_final_axis2[0]=_final_axis3[1]*_final_axis[2]-_final_axis[1]*_final_axis3[2],_final_axis2[1]=_final_axis3[2]*_final_axis[0]-_final_axis[2]*_final_axis3[0],_final_axis2[2]=_final_axis3[0]*_final_axis[1]-_final_axis3[1]*_final_axis[0],magnitude=Math.sqrt(_final_axis2[0]*_final_axis2[0]+_final_axis2[1]*_final_axis2[1]+_final_axis2[2]*_final_axis2[2]),0<magnitude){var scaling=(baseSize[1]+use_scale*scaleFactors[1])*this.globalScale/magnitude;_final_axis2[0]*=scaling,_final_axis2[1]*=scaling,_final_axis2[2]*=scaling}return_arrays[k]=[_final_point,_final_axis,_final_axis2,_final_axis3]}}return return_arrays},updateGlyphsetTransformation=(current_positions,current_axis1s,current_axis2s,current_axis3s,current_scales)=>{var numberOfGlyphs=1;"AXES_2D"==repeat_mode||"MIRROR"==repeat_mode?numberOfGlyphs=2:"AXES_3D"==repeat_mode&&(numberOfGlyphs=3);var numberOfPositions=current_positions.length/3,current_glyph_index=0;_glyph_axis_array.length=numberOfGlyphs;for(var _i=0;_i<numberOfPositions;_i++){var current_index=3*_i,current_position=[current_positions[current_index],current_positions[current_index+1],current_positions[current_index+2]],current_axis1=[current_axis1s[current_index],current_axis1s[current_index+1],current_axis1s[current_index+2]],current_axis2=[current_axis2s[current_index],current_axis2s[current_index+1],current_axis2s[current_index+2]],current_axis3=[current_axis3s[current_index],current_axis3s[current_index+1],current_axis3s[current_index+2]],current_scale=[current_scales[current_index],current_scales[current_index+1],current_scales[current_index+2]],arrays=resolve_glyph_axes(current_position,current_axis1,current_axis2,current_axis3,current_scale,_glyph_axis_array);if(arrays.length==numberOfGlyphs)for(var j=0;j<numberOfGlyphs;j++){_transformMatrix.elements[0]=arrays[j][1][0],_transformMatrix.elements[1]=arrays[j][1][1],_transformMatrix.elements[2]=arrays[j][1][2],_transformMatrix.elements[3]=0,_transformMatrix.elements[4]=arrays[j][2][0],_transformMatrix.elements[5]=arrays[j][2][1],_transformMatrix.elements[6]=arrays[j][2][2],_transformMatrix.elements[7]=0,_transformMatrix.elements[8]=arrays[j][3][0],_transformMatrix.elements[9]=arrays[j][3][1],_transformMatrix.elements[10]=arrays[j][3][2],_transformMatrix.elements[11]=0,_transformMatrix.elements[12]=arrays[j][0][0],_transformMatrix.elements[13]=arrays[j][0][1],_transformMatrix.elements[14]=arrays[j][0][2],_transformMatrix.elements[15]=1,this.morph.setMatrixAt(current_glyph_index,_transformMatrix);var glyph=glyphList[current_glyph_index];glyph&&glyph.setTransformation(arrays[j][0],arrays[j][1],arrays[j][2],arrays[j][3]),current_glyph_index++}}this.morph.instanceMatrix.needsUpdate=!0},updateGlyphsetHexColors=current_colors=>{var numberOfGlyphs=1;"AXES_2D"==repeat_mode||"MIRROR"==repeat_mode?numberOfGlyphs=2:"AXES_3D"==repeat_mode&&(numberOfGlyphs=3);for(var hex_values,numberOfColours=current_colors.length,current_glyph_index=0,_i2=0;_i2<numberOfColours;_i2++){hex_values=current_colors[_i2];for(var j=0;j<numberOfGlyphs;j++){_bot_colour.setHex(hex_values),this.morph.setColorAt(current_glyph_index,_bot_colour);var glyph=glyphList[current_glyph_index];glyph&&glyph.setColour(_bot_colour),current_glyph_index++}}this.morph.instanceColor.needsUpdate=!0},updateMorphGlyphsets=()=>{var current_positions=_current_positions,current_axis1s=_current_axis1s,current_axis2s=_current_axis2s,current_axis3s=_current_axis3s,current_scales=_current_scales,current_colors=_current_colors,current_time=this.inbuildTime/this.duration*(numberOfTimeSteps-1),bottom_frame=Math.floor(current_time),proportion=1-(current_time-bottom_frame),top_frame=Math.ceil(current_time);if(morphVertices){var bottom_positions=positions[bottom_frame.toString()],top_positions=positions[top_frame.toString()],bottom_axis1=axis1s[bottom_frame.toString()],top_axis1=axis1s[top_frame.toString()],bottom_axis2=axis2s[bottom_frame.toString()],top_axis2=axis2s[top_frame.toString()],bottom_axis3=axis3s[bottom_frame.toString()],top_axis3=axis3s[top_frame.toString()],bottom_scale=scales[bottom_frame.toString()],top_scale=scales[top_frame.toString()];_current_positions.length=bottom_positions.length,_current_axis1s.length=bottom_positions.length,_current_axis2s.length=bottom_positions.length,_current_axis3s.length=bottom_positions.length,_current_scales.length=bottom_positions.length;for(var _i3=0;_i3<bottom_positions.length;_i3++)current_positions[_i3]=proportion*bottom_positions[_i3]+(1-proportion)*top_positions[_i3],current_axis1s[_i3]=proportion*bottom_axis1[_i3]+(1-proportion)*top_axis1[_i3],current_axis2s[_i3]=proportion*bottom_axis2[_i3]+(1-proportion)*top_axis2[_i3],current_axis3s[_i3]=proportion*bottom_axis3[_i3]+(1-proportion)*top_axis3[_i3],current_scales[_i3]=proportion*bottom_scale[_i3]+(1-proportion)*top_scale[_i3]}else current_positions=positions[0],current_axis1s=axis1s[0],current_axis2s=axis2s[0],current_axis3s=axis3s[0],current_scales=scales[0];if(updateGlyphsetTransformation(current_positions,current_axis1s,current_axis2s,current_axis3s,current_scales),this.boundingBoxUpdateRequired=!0,null!=colors){if(morphColours){var bottom_colors=colors[bottom_frame.toString()],top_colors=colors[top_frame.toString()];current_colors.length=bottom_colors.length;for(var _i4=0;_i4<bottom_colors.length;_i4++)_bot_colour.setHex(bottom_colors[_i4]),_top_colour.setHex(top_colors[_i4]),_bot_colour.setRGB(_bot_colour.r*proportion+_top_colour.r*(1-proportion),_bot_colour.g*proportion+_top_colour.g*(1-proportion),_bot_colour.b*proportion+_top_colour.b*(1-proportion)),current_colors[_i4]=_bot_colour.getHex();/*
|
|
701
701
|
for (var i = 0; i < bottom_colors.length; i++) {
|
|
@@ -710,15 +710,15 @@ var THREE=__webpack_require__(4),JSONLoader=(__webpack_require__(19).JSONLoader)
|
|
|
710
710
|
* colour for each of them. This is called when glyphset and glyphs are initialised and whenever
|
|
711
711
|
* the internal time has been updated.
|
|
712
712
|
*/ /**
|
|
713
|
-
*
|
|
714
|
-
*/this.showLabel=()=>{for(var _i5=0;_i5<glyphList.length;_i5++)glyphList[_i5].showLabel(this.morph.material?this.morph.material.color:void 0)},this.hideLabel=()=>{for(var _i6=0;_i6<glyphList.length;_i6++)glyphList[_i6].hideLabel()};/**
|
|
713
|
+
* Get the assigned label for instance at index
|
|
714
|
+
*/this.getLabel=index=>labels&&labels.length>index?labels[index]:void 0,this.showLabel=()=>{for(var _i5=0;_i5<glyphList.length;_i5++)glyphList[_i5].showLabel(this.morph.material?this.morph.material.color:void 0)},this.hideLabel=()=>{for(var _i6=0;_i6<glyphList.length;_i6++)glyphList[_i6].hideLabel()};/**
|
|
715
715
|
* Create the glyphs in the glyphset.
|
|
716
|
-
*
|
|
716
|
+
*
|
|
717
717
|
* @param {Boolean} displayLabels -Flag to determine either the labels should be display or not.
|
|
718
718
|
*/var createGlyphs=displayLabels=>{for(var _i7=0;_i7<numberOfVertices;_i7++){var glyph=new((__webpack_require__(16).Glyph))(void 0,void 0,_i7,this),label=labels?labels[_i7]:void 0;label=label?label:this.groupName,label&&glyph.setLabel(label),0<numberOfTimeSteps&&glyph.setFrustumCulled(!1),glyphList[_i7]=glyph,this.morph.add(glyph.getGroup())}//Update the transformation of the glyphs.
|
|
719
719
|
displayLabels&&this.showLabel(),updateGlyphsetTransformation(positions[0],axis1s[0],axis2s[0],axis3s[0],scales[0]),colors!=null&&updateGlyphsetHexColors(colors[0]),this.ready=!0,this.boundingBoxUpdateRequired=!0};/**
|
|
720
720
|
* Add a custom {@link Glyph} to this {@link Glyphset}.
|
|
721
|
-
*
|
|
721
|
+
*
|
|
722
722
|
* @param {Glyph} Glyph to be added.
|
|
723
723
|
*/this.addCustomGlyph=glyph=>{glyph.isGlyph&&glyphList.push(glyph),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(mesh,id)=>{if(mesh.isMesh){var glyph=new((__webpack_require__(16).Glyph))(void 0,void 0,id,this);return glyph.fromMesh(mesh),glyphList.push(glyph),this.morph.add(glyph.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,glyph}},this.forEachGlyph=callbackFunction=>{for(var _i8=0;_i8<glyphList.length;_i8++)callbackFunction(glyphList[_i8])};var meshloader=(finishCallback,displayLabels)=>(geometry,materials)=>{var tempGeometry=geometry.toBufferGeometry();this.geometry.copy(tempGeometry),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),tempGeometry.dispose(),materials&&materials[0]&&(this.morph.material=materials[0]),createGlyphs(displayLabels),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),geometry.dispose(),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(this)};/**
|
|
724
724
|
* Get the index of the closest vertex to centroid.
|
|
@@ -726,23 +726,23 @@ displayLabels&&this.showLabel(),updateGlyphsetTransformation(positions[0],axis1s
|
|
|
726
726
|
* Get the closest vertex to centroid.
|
|
727
727
|
*/ /**
|
|
728
728
|
* Get the bounding box for the whole set of glyphs.
|
|
729
|
-
*
|
|
729
|
+
*
|
|
730
730
|
* @return {Three.Box3};
|
|
731
731
|
*/ /**
|
|
732
732
|
* Set the local time of this glyphset.
|
|
733
|
-
*
|
|
733
|
+
*
|
|
734
734
|
* @param {Number} time - Can be any value between 0 to duration.
|
|
735
735
|
*/ /**
|
|
736
736
|
* Check if the glyphset is time varying.
|
|
737
|
-
*
|
|
737
|
+
*
|
|
738
738
|
* @return {Boolean}
|
|
739
739
|
*/ /**
|
|
740
|
-
* Get the current inbuild time of the
|
|
741
|
-
*
|
|
740
|
+
* Get the current inbuild time of the
|
|
741
|
+
*
|
|
742
742
|
* @return {Number}
|
|
743
743
|
*/ /**
|
|
744
744
|
* Set the objects scale.
|
|
745
|
-
*
|
|
745
|
+
*
|
|
746
746
|
* @return {THREE.Box3}.
|
|
747
747
|
*/ /**
|
|
748
748
|
* Clear this glyphset and its list of glyphs which will release them from the memory.
|
|
@@ -753,11 +753,11 @@ displayLabels&&this.showLabel(),updateGlyphsetTransformation(positions[0],axis1s
|
|
|
753
753
|
glyphList[this.closestVertexIndex].getBoundingBox().getCenter(position);
|
|
754
754
|
}
|
|
755
755
|
*/{var position=new THREE.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,_transformMatrix),position.setFromMatrixPosition(_transformMatrix),position}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){_boundingBox1.setFromBufferAttribute(this.morph.geometry.attributes.position);for(var _i10=0;_i10<numberOfVertices;_i10++)this.morph.getMatrixAt(_i10,_transformMatrix),_boundingBox2.copy(_boundingBox1).applyMatrix4(_transformMatrix),0==_i10?_boundingBox3.copy(_boundingBox2):_boundingBox3.union(_boundingBox2);if(_boundingBox3)this.cachedBoundingBox.copy(_boundingBox3),this.morph.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1;else return}return this.cachedBoundingBox}},this.setMorphTime=time=>{this.inbuildTime=time>this.duration?this.duration:0>time?0:time,(morphColours||morphVertices)&&(updateMorphGlyphsets(),morphVertices&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!!((!1===this.ready||0<numberOfTimeSteps)&&(morphColours||morphVertices)),this.getCurrentTime=()=>this.inbuildTime,this.setScaleAll=function(scale){this.globalScale=scale,updateMorphGlyphsets()},this.dispose=()=>{for(var _i11=glyphList.length-1;0<=_i11;_i11--)glyphList[_i11].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),axis1s=void 0,axis2s=void 0,axis3s=void 0,positions=void 0,scales=void 0,colors=void 0,this.ready=!1,this.groupName=void 0},this.render=(delta,playAnimation,options)=>{if(!0==playAnimation){var targetTime=this.inbuildTime+delta;targetTime>this.duration&&(targetTime-=this.duration),this.inbuildTime=targetTime,(morphColours||morphVertices)&&updateMorphGlyphsets()}this.updateMarker(playAnimation,options)}};/**
|
|
756
|
-
* This is a container of {@link Glyph} and their graphical properties
|
|
756
|
+
* This is a container of {@link Glyph} and their graphical properties
|
|
757
757
|
* including transformations, colors, number of time steps, duration of animations
|
|
758
758
|
* and group name. Please note that all glyphs in the glyphset share the same geometry
|
|
759
759
|
* however they may have different transformations.
|
|
760
|
-
*
|
|
760
|
+
*
|
|
761
761
|
* @class
|
|
762
762
|
* @author Alan Wu
|
|
763
763
|
* @return {Glyphset}
|
|
@@ -1352,7 +1352,7 @@ var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId
|
|
|
1352
1352
|
* @param {STRING} groupName - name to assign the pointset's groupname to.
|
|
1353
1353
|
* @param {Function} finishCallback - Callback function which will be called
|
|
1354
1354
|
* once the glyphset is succssfully load in.
|
|
1355
|
-
*/this.loadLinesURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{var localTimeEnabled=0;this.toBeDownloaded+=1;var isInline=!!(null!==options&&void 0!==options&&options.isInline)&&options.isInline,anatomicalId=null!==options&&void 0!==options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=
|
|
1355
|
+
*/this.loadLinesURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{var localTimeEnabled=0;this.toBeDownloaded+=1;var isInline=!!(null!==options&&void 0!==options&&options.isInline)&&options.isInline,anatomicalId=null!==options&&void 0!==options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&"renderOrder"in options?options.renderOrder:void 0;timeEnabled!=null&&(localTimeEnabled=!!timeEnabled);var localMorphColour=0;morphColour!=null&&(localMorphColour=!!morphColour);var tubeLines=options.tubeLines&&!localTimeEnabled&&!localMorphColour;if(isInline){var object=primitivesLoader.parse(url);linesloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options.lod,tubeLines,finishCallback)(object.geometry,object.materials)}else primitivesLoader.load(url,linesloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options.lod,tubeLines,finishCallback),this.onProgress(url),this.onError(finishCallback),options.loaderOptions)};var glyphsetloader=(region,glyphurl,groupName,finishCallback,options)=>data=>{var glyphsetData=data;("string"==typeof glyphsetData||glyphsetData instanceof String)&&(glyphsetData=JSON.parse(data));var isInline=options&&options.isInline?options.isInline:void 0,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,displayLabels=options&&options.displayLabels?options.displayLabels:void 0,renderOrder=options&&"renderOrder"in options?options.renderOrder:void 0,newGlyphset=new((__webpack_require__(18).Glyphset));newGlyphset.setDuration(scene.getDuration()),newGlyphset.groupName=groupName;var myCallback=()=>{--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newGlyphset)};++this.toBeDownloaded,isInline?newGlyphset.load(glyphsetData,glyphurl,myCallback,isInline,displayLabels):newGlyphset.load(glyphsetData,resolveURL(glyphurl),myCallback,isInline,displayLabels),newGlyphset.setAnatomicalId(anatomicalId),newGlyphset.setRenderOrder(renderOrder),region.addZincObject(newGlyphset)};//Load a glyphset into this scene.
|
|
1356
1356
|
/**
|
|
1357
1357
|
* Load a glyphset into this scene object.
|
|
1358
1358
|
*
|
|
@@ -1383,7 +1383,7 @@ var pointsetloader=(region,localTimeEnabled,localMorphColour,groupName,anatomica
|
|
|
1383
1383
|
* @param {STRING} fileFormat - name supported formats are STL, OBJ and JSON.
|
|
1384
1384
|
* @param {Function} finishCallback - Callback function which will be called
|
|
1385
1385
|
* once the geometry is succssfully loaded in.
|
|
1386
|
-
*/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
|
|
1386
|
+
*/var loadSurfaceURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{this.toBeDownloaded+=1;var colour=(__webpack_require__(0).defaultMaterialColor),opacity=(__webpack_require__(0).defaultOpacity),localTimeEnabled=0,isInline=!!(options&&options.isInline)&&options.isInline,fileFormat=options&&options.fileFormat?options.fileFormat:void 0,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&"renderOrder"in options?options.renderOrder:void 0;timeEnabled!=null&&(localTimeEnabled=!!timeEnabled);var localMorphColour=0;morphColour!=null&&(localMorphColour=!!morphColour);var loader=primitivesLoader;if(fileFormat!==void 0)if("STL"==fileFormat)loader=new STLLoader;else if("OBJ"==fileFormat)return loader=new OBJLoader,loader.crossOrigin="Anonymous",void loader.load(url,objloader(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,finishCallback),this.onProgress(url),this.onError,options.loaderOptions);if(isInline){var object=primitivesLoader.parse(url);meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options,finishCallback)(object.geometry,object.materials)}else loader.crossOrigin="Anonymous",primitivesLoader.load(url,meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,options,finishCallback),this.onProgress(url),this.onError(finishCallback),options.loaderOptions)},metaFinishCallback=function metaFinishCallback(numberOfDownloaded,finishCallback,allCompletedCallback){var downloadedItem=0;return zincObject=>{if(++downloadedItem,zincObject&&null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(zincObject),downloadedItem==numberOfDownloaded&&(!1==viewLoaded&&scene.viewAll(),null!=allCompletedCallback&&"function"==typeof allCompletedCallback)){allCompletedCallback();var zincCameraControls=scene.getZincCameraControls();zincCameraControls&&zincCameraControls.calculateMaxAllowedDistance(scene)}}};//Object to keep track of number of items downloaded and when all items are downloaded
|
|
1387
1387
|
//allCompletedCallback is called
|
|
1388
1388
|
/**
|
|
1389
1389
|
* Load a pointset into this scene object.
|
|
@@ -1393,7 +1393,7 @@ var pointsetloader=(region,localTimeEnabled,localMorphColour,groupName,anatomica
|
|
|
1393
1393
|
* @param {STRING} groupName - name to assign the pointset's groupname to.
|
|
1394
1394
|
* @param {Function} finishCallback - Callback function which will be called
|
|
1395
1395
|
* once the glyphset is succssfully load in.
|
|
1396
|
-
*/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
|
|
1396
|
+
*/this.loadPointsetURL=(region,url,timeEnabled,morphColour,groupName,finishCallback,options)=>{var localTimeEnabled=0;this.toBeDownloaded+=1,timeEnabled!=null&&(localTimeEnabled=!!timeEnabled);var localMorphColour=0;morphColour!=null&&(localMorphColour=!!morphColour);var isInline=!!(options&&options.isInline)&&options.isInline,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&"renderOrder"in options?options.renderOrder:void 0;if(isInline){var object=primitivesLoader.parse(url);pointsetloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback)(object.geometry,object.materials)}else primitivesLoader.load(url,pointsetloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback),this.onProgress(url),this.onError(finishCallback),options.loaderOptions)};var loadTexture=(region,referenceURL,textureData,groupName,finishCallback,options)=>{var isInline=options&&options.isInline?options.isInline:void 0,anatomicalId=options&&options.anatomicalId?options.anatomicalId:void 0,renderOrder=options&&"renderOrder"in options?options.renderOrder:void 0,newTexture=void 0;if(textureData){if(referenceURL&&textureData.images&&textureData.images.source)for(var _newURL,source=textureData.images.source,i=0;i<source.length;i++)_newURL=createNewURL(source[i],referenceURL),textureData.images.source[i]=_newURL;if("slides"===textureData.type&&(newTexture=new((__webpack_require__(27).TextureSlides))),newTexture){newTexture.groupName=groupName;var myCallback=()=>{region.addZincObject(newTexture),--this.toBeDownloaded,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newTexture)};++this.toBeDownloaded,newTexture.load(textureData,myCallback,isInline),newTexture.setAnatomicalId(anatomicalId),newTexture.setRenderOrder(renderOrder)}}},onLoadTextureReady=(region,xmlhttp,groupName,finishCallback,options)=>()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){var textureData=JSON.parse(xmlhttp.responseText);loadTexture(region,xmlhttp.responseURL,textureData,groupName,finishCallback,options)}};//Load a glyphset into this scene.
|
|
1397
1397
|
/**
|
|
1398
1398
|
* Load a texture into this scene object.
|
|
1399
1399
|
*
|