zincjs 1.3.0 → 1.3.2

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.js CHANGED
@@ -103,7 +103,7 @@ __webpack_require__(1);/**
103
103
  *
104
104
  * @namespace
105
105
  * @author Alan Wu
106
- */var Zinc=function(){this.Revision="1.0.12",this.defaultMaterialColor=16777215,this.defaultOpacity=1,this.modelPrefix=void 0,this.Geometry=__webpack_require__(2).Geometry,this.Glyph=__webpack_require__(10).Glyph,this.Glyphset=__webpack_require__(13).Glyphset,this.Pointset=__webpack_require__(17).Pointset,this.Lines=__webpack_require__(20).Lines,this.TextureArray=__webpack_require__(23).TextureArray,this.TextureSlides=__webpack_require__(25).TextureSlides,this.Renderer=__webpack_require__(28).Renderer,this.Scene=__webpack_require__(30).Scene,this.GeometryCSG=__webpack_require__(42).GeometryCSG,this.GlyphsetCSG=__webpack_require__(48).GlyphsetCSG,this.Viewport=__webpack_require__(39).Viewport,this.CameraControls=__webpack_require__(39).CameraControls,this.SmoothCameraTransition=__webpack_require__(39).SmoothCameraTransition,this.RayCaster=__webpack_require__(39).RayCaster,this.CameraAutoTumble=__webpack_require__(39).CameraAutoTumble,this.StereoEffect=__webpack_require__(39).StereoEffect,this.loadExternalFile=__webpack_require__(6).loadExternalFile,this.loadExternalFiles=__webpack_require__(6).loadExternalFiles,this.THREE=__webpack_require__(3)};module.exports=new Zinc;
106
+ */var Zinc=function(){this.Revision="1.0.12",this.defaultMaterialColor=16777215,this.defaultOpacity=1,this.modelPrefix=void 0,this.Geometry=__webpack_require__(2).Geometry,this.Glyph=__webpack_require__(10).Glyph,this.Glyphset=__webpack_require__(13).Glyphset,this.Pointset=__webpack_require__(17).Pointset,this.Lines=__webpack_require__(20).Lines,this.TextureArray=__webpack_require__(23).TextureArray,this.TextureSlides=__webpack_require__(25).TextureSlides,this.Renderer=__webpack_require__(28).Renderer,this.Scene=__webpack_require__(30).Scene,this.GeometryCSG=__webpack_require__(42).GeometryCSG,this.GlyphsetCSG=__webpack_require__(48).GlyphsetCSG,this.Viewport=__webpack_require__(39).Viewport,this.CameraControls=__webpack_require__(39).CameraControls,this.SmoothCameraTransition=__webpack_require__(39).SmoothCameraTransition,this.RayCaster=__webpack_require__(39).RayCaster,this.CameraAutoTumble=__webpack_require__(39).CameraAutoTumble,this.StereoEffect=__webpack_require__(39).StereoEffect,this.loadExternalFile=__webpack_require__(4).loadExternalFile,this.loadExternalFiles=__webpack_require__(4).loadExternalFiles,this.THREE=__webpack_require__(3)};module.exports=new Zinc;
107
107
 
108
108
  /***/ }),
109
109
  /* 1 */
@@ -115,7 +115,7 @@ module.exports = require("url-polyfill");
115
115
  /* 2 */
116
116
  /***/ (function(module, exports, __webpack_require__) {
117
117
 
118
- var THREE=__webpack_require__(3),Geometry=function(){// THREE.Geometry or THREE.BufferGeometry
118
+ var THREE=__webpack_require__(3),toBufferGeometry=__webpack_require__(4).toBufferGeometry,Geometry=function(){// THREE.Geometry or THREE.BufferGeometry
119
119
  /**
120
120
  * Create the mesh for rendering
121
121
  *
@@ -131,19 +131,14 @@ var THREE=__webpack_require__(3),Geometry=function(){// THREE.Geometry or THREE.
131
131
  */ /**
132
132
  * Calculate the UV for texture rendering.
133
133
  */ /**
134
+ * Handle transparent mesh, remove a clone for backside rendering if it is
135
+ * transparent.
136
+ */ /**
134
137
  * Set wireframe display for this geometry.
135
138
  *
136
139
  * @param {Boolean} wireframe - Flag to turn on/off wireframe display.
137
- */__webpack_require__(4).ZincObject.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(geometryIn,materialIn,options)=>{if(!(this.geometry&&this.morph&&null!=geometryIn)){// First copy the geometry
138
- var geometry=this.toBufferGeometry(geometryIn,options),isTransparent=!1;1>options.opacity&&(isTransparent=!0);var material;if(void 0===geometry._video){var morphTargets=options.localTimeEnabled||options.localMorphColour;materialIn?(material=materialIn,material.morphTargets=morphTargets,material.morphNormals=options.localTimeEnabled):geometry instanceof THREE.BufferGeometry&&void 0===geometry.attributes.color?material=new THREE.MeshPhongMaterial({color:options.colour,morphTargets:morphTargets,morphNormals:options.localTimeEnabled,transparent:isTransparent,opacity:options.opacity,side:THREE.DoubleSide}):material=new THREE.MeshPhongMaterial({color:options.colour,morphTargets:morphTargets,morphNormals:options.localTimeEnabled,vertexColors:THREE.VertexColors,transparent:isTransparent,opacity:options.opacity,side:THREE.DoubleSide}),options.localMorphColour&&geometry.morphAttributes.color&&(material.onBeforeCompile=__webpack_require__(9).augmentMorphColor())}else{var videoTexture=geometry._video.createCanvasVideoTexture();material=new THREE.MeshBasicMaterial({morphTargets:options.localTimeEnabled,color:new THREE.Color(1,1,1),transparent:isTransparent,opacity:options.opacity,map:videoTexture,side:THREE.DoubleSide}),this.videoHandler=geometry._video}var mesh=new THREE.Mesh(geometry,material);this.setMesh(mesh,options.localTimeEnabled,options.localMorphColour)}},this.calculateUVs=()=>{this.geometry.computeBoundingBox();var max=this.geometry.boundingBox.max,min=this.geometry.boundingBox.min,offset=new THREE.Vector2(0-min.x,0-min.y),range=new THREE.Vector2(max.x-min.x,max.y-min.y);this.geometry.faceVertexUvs[0]=[];for(var i=0;i<this.geometry.faces.length;i++){var v1=this.geometry.vertices[this.geometry.faces[i].a],v2=this.geometry.vertices[this.geometry.faces[i].b],v3=this.geometry.vertices[this.geometry.faces[i].c];geometry.faceVertexUvs[0].push([new THREE.Vector2((v1.x+offset.x)/range.x,(v1.y+offset.y)/range.y),new THREE.Vector2((v2.x+offset.x)/range.x,(v2.y+offset.y)/range.y),new THREE.Vector2((v3.x+offset.x)/range.x,(v3.y+offset.y)/range.y)])}geometry.uvsNeedUpdate=!0},this.setWireframe=wireframe=>{this.morph.material.wireframe=wireframe}};/**
139
- * Provides an object which stores geometry and provides method which controls its animations.
140
- * This is created when a valid json file containging geometry is read into a {@link Zinc.Scene}
141
- * object.
142
- *
143
- * @class
144
- * @author Alan Wu
145
- * @return {Geometry}
146
- */Geometry.prototype=Object.create(__webpack_require__(4).ZincObject.prototype),exports.Geometry=Geometry;
140
+ */__webpack_require__(6).ZincObject.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(geometryIn,materialIn,options)=>{if(!(this.geometry&&this.morph&&null!=geometryIn)){// First copy the geometry
141
+ var geometry=toBufferGeometry(geometryIn,options),isTransparent=!1;1>options.opacity&&(isTransparent=!0);var material;if(void 0===geometry._video){var morphTargets=options.localTimeEnabled||options.localMorphColour;materialIn?(material=materialIn,material.morphTargets=morphTargets,material.morphNormals=options.localTimeEnabled):geometry instanceof THREE.BufferGeometry&&void 0===geometry.attributes.color?material=new THREE.MeshPhongMaterial({color:options.colour,morphTargets:morphTargets,morphNormals:options.localTimeEnabled,transparent:isTransparent,opacity:options.opacity,side:THREE.DoubleSide}):material=new THREE.MeshPhongMaterial({color:options.colour,morphTargets:morphTargets,morphNormals:options.localTimeEnabled,vertexColors:THREE.VertexColors,transparent:isTransparent,opacity:options.opacity,side:THREE.DoubleSide}),options.localMorphColour&&geometry.morphAttributes.color&&(material.onBeforeCompile=__webpack_require__(9).augmentMorphColor())}else{var videoTexture=geometry._video.createCanvasVideoTexture();material=new THREE.MeshBasicMaterial({morphTargets:options.localTimeEnabled,color:new THREE.Color(1,1,1),transparent:isTransparent,opacity:options.opacity,map:videoTexture,side:THREE.DoubleSide}),this.videoHandler=geometry._video}var mesh=new THREE.Mesh(geometry,material);this.setMesh(mesh,options.localTimeEnabled,options.localMorphColour)}},this.calculateUVs=()=>{this.geometry.computeBoundingBox();var max=this.geometry.boundingBox.max,min=this.geometry.boundingBox.min,offset=new THREE.Vector2(0-min.x,0-min.y),range=new THREE.Vector2(max.x-min.x,max.y-min.y);this.geometry.faceVertexUvs[0]=[];for(var i=0;i<this.geometry.faces.length;i++){var v1=this.geometry.vertices[this.geometry.faces[i].a],v2=this.geometry.vertices[this.geometry.faces[i].b],v3=this.geometry.vertices[this.geometry.faces[i].c];geometry.faceVertexUvs[0].push([new THREE.Vector2((v1.x+offset.x)/range.x,(v1.y+offset.y)/range.y),new THREE.Vector2((v2.x+offset.x)/range.x,(v2.y+offset.y)/range.y),new THREE.Vector2((v3.x+offset.x)/range.x,(v3.y+offset.y)/range.y)])}geometry.uvsNeedUpdate=!0},this.checkAndCreateTransparentMesh=function(){if(this.morph.material&&this.morph.material.transparent){if(!this.secondaryMesh){var secondaryMaterial=this.morph.material.clone();secondaryMaterial.side=THREE.FrontSide,this.secondaryMesh=new THREE.Mesh(this.morph.geometry,secondaryMaterial),this.secondaryMesh.renderOrder=this.morph.renderOrder+1,this.secondaryMesh.userData=this,this.secondaryMesh.name=this.groupName}this.morph.material.side=THREE.BackSide,this.morph.material.needsUpdate=!0,this.morph.add(this.secondaryMesh),this.animationGroup.add(this.secondaryMesh)}},this.checkAndRemoveTransparentMesh=function(){this.secondaryMesh&&(this.morph.remove(this.secondaryMesh),this.animationGroup.uncache(this.secondaryMesh),this.animationGroup.remove(this.secondaryMesh)),this.morph.material.side=THREE.DoubleSide},this.setWireframe=wireframe=>{this.morph.material.wireframe=wireframe}};Geometry.prototype=Object.create(__webpack_require__(6).ZincObject.prototype),exports.Geometry=Geometry;
147
142
 
148
143
  /***/ }),
149
144
  /* 3 */
@@ -155,105 +150,22 @@ module.exports = require("three");
155
150
  /* 4 */
156
151
  /***/ (function(module, exports, __webpack_require__) {
157
152
 
158
- var THREE=__webpack_require__(3),THREEGeometry=__webpack_require__(5).Geometry,uniqueiId=0,getUniqueId=function(){return"pr"+uniqueiId++},ZincObject=function(){// THREE.Mesh
159
- // THREE.Mesh - for utilities purpose such as rendering
160
- // transparent surfaces - one for front face and one for back face.
161
- /**
162
- * Groupname given to this geometry.
163
- */ /**
164
- * Total duration of the animation, this value interacts with the
165
- * {@link Renderer#playRate} to produce the actual duration of the
166
- * animation. Actual time in second = duration / playRate.
167
- */this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.secondaryMesh=void 0,this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.videoHandler=void 0,this.marker=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new THREE.Box3,this._vertex=new THREE.Vector3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode="inherited",this.uuid=getUniqueId()};ZincObject.prototype.setDuration=function(durationIn){this.duration=durationIn,this.clipAction&&this.clipAction.setDuration(this.duration)},ZincObject.prototype.getDuration=function(){return this.duration},ZincObject.prototype.setRegion=function(region){this.region=region},ZincObject.prototype.getRegion=function(){return this.region},ZincObject.prototype.toBufferGeometry=function(geometryIn,options){var geometry;return geometryIn instanceof THREEGeometry?(options.localTimeEnabled&&!geometryIn.morphNormalsReady&&(null==geometryIn.morphNormals||0==geometryIn.morphNormals.length)&&geometryIn.computeMorphNormals(),geometry=geometryIn.toIndexedBufferGeometry(),options.localMorphColour&&__webpack_require__(6).copyMorphColorsToIndexedBufferGeometry(geometryIn,geometry)):geometryIn instanceof THREE.BufferGeometry&&(geometry=geometryIn.clone()),geometry.colorsNeedUpdate=!0,geometry.computeBoundingBox(),geometry.computeBoundingSphere(),geometryIn._video&&(geometry._video=geometryIn._video),geometry},ZincObject.prototype.checkAndCreateTransparentMesh=function(){if(this.isGeometry&&this.morph.material&&this.morph.material.transparent){if(!this.secondaryMesh){var secondaryMaterial=this.morph.material.clone();secondaryMaterial.side=THREE.FrontSide,this.secondaryMesh=new THREE.Mesh(this.morph.geometry,secondaryMaterial),this.secondaryMesh.renderOrder=this.morph.renderOrder+1,this.secondaryMesh.userData=this,this.secondaryMesh.name=this.groupName}this.morph.material.side=THREE.BackSide,this.morph.material.needsUpdate=!0,this.morph.add(this.secondaryMesh),this.animationGroup.add(this.secondaryMesh)}},ZincObject.prototype.checkAndRemoveTransparentMesh=function(){this.isGeometry&&this.secondaryMesh&&(this.morph.remove(this.secondaryMesh),this.animationGroup.uncache(this.secondaryMesh),this.animationGroup.remove(this.secondaryMesh)),this.morph.material.side=THREE.DoubleSide},ZincObject.prototype.setMesh=function(mesh,localTimeEnabled,localMorphColour){if(this.animationGroup=new THREE.AnimationObjectGroup(mesh),this.mixer=new THREE.AnimationMixer(this.animationGroup),this.geometry=mesh.geometry,this.clipAction=void 0,this.geometry&&this.geometry.morphAttributes){var morphAttribute=this.geometry.morphAttributes.position;morphAttribute||(morphAttribute=this.geometry.morphAttributes.color?this.geometry.morphAttributes.color:this.geometry.morphAttributes.normal),morphAttribute&&(this.animationClip=THREE.AnimationClip.CreateClipsFromMorphTargetSequences(morphAttribute,10,!0),this.animationClip&&null!=this.animationClip[0]&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=THREE.loopOnce,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=localTimeEnabled,this.morphColour=localMorphColour,this.morph=mesh,this.morph.userData=this,this.morph.matrixAutoUpdate=!1,this.checkAndCreateTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(this.geometry.setAttribute("morphTarget0",this.geometry.getAttribute("position")),this.geometry.setAttribute("morphTarget1",this.geometry.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},ZincObject.prototype.setName=function(groupNameIn){this.groupName=groupNameIn,this.morph&&(this.morph.name=this.groupName),this.secondaryMesh&&(this.secondaryMesh.name=this.groupName)},ZincObject.prototype.getCurrentTime=function(){if(this.clipAction){var ratio=this.clipAction.time/this.clipAction._clip.duration;return this.duration*ratio}return this.inbuildTime};var updateMorphColorAttribute=function(targetGeometry,morph){if(morph&&targetGeometry&&targetGeometry.morphAttributes&&targetGeometry.morphAttributes.color){var morphColors=targetGeometry.morphAttributes.color,influences=morph.morphTargetInfluences,length=influences.length;targetGeometry.deleteAttribute("morphColor0"),targetGeometry.deleteAttribute("morphColor1");for(var bound=0,morphArray=[],i=0;1>bound||i<length;i++)0<influences[i]&&(bound++,morphArray.push([i,influences[i]]));2==morphArray.length?(targetGeometry.setAttribute("morphColor0",morphColors[morphArray[0][0]]),targetGeometry.setAttribute("morphColor1",morphColors[morphArray[1][0]])):1==morphArray.length&&(targetGeometry.setAttribute("morphColor0",morphColors[morphArray[0][0]]),targetGeometry.setAttribute("morphColor1",morphColors[morphArray[0][0]]))}};/**
168
- * Set the local time of this geometry.
169
- *
170
- * @param {Number} time - Can be any value between 0 to duration.
171
- */ /**
172
- * Check if the geometry is time varying.
173
- *
174
- * @return {Boolean}
175
- */ /**
176
- * Get the visibility of this Geometry.
177
- *
178
- */ /**
179
- * Set the visibility of this Geometry.
180
- *
181
- * @param {Boolean} visible - a boolean flag indicate the visibility to be set
182
- */ /**
183
- * Set the opacity of this Geometry. This function will also set the isTransparent
184
- * flag according to the provided alpha value.
185
- *
186
- * @param {Number} alpah - Alpha value to set for this geometry,
187
- * can be any value between from 0 to 1.0.
188
- */ /**
189
- * The rendering will be culled if it is outside of the frustrum
190
- * when this flag is set to true, it should be set to false if
191
- * morphing is enabled.
192
- *
193
- * @param {Boolean} flag - Set frustrum culling on/off based on this flag.
194
- */ /**
195
- * Set rather a zinc object should be displayed using per vertex colour or
196
- * not.
197
- *
198
- * @param {Boolean} vertexColors - Set display with vertex color on/off.
199
- */ /**
200
- * Get the colour of the mesh.
201
- *
202
- * @return {THREE.Color}
203
- */ /**
204
- * Set the colour of the mesh.
205
- *
206
- * @param {THREE.Color} colour - Colour to be set for this geometry.
207
- */ /**
208
- * Get the colour of the mesh in hex string form.
209
- *
210
- * @return {String}
211
- */ /**
212
- * Set the colour of the mesh using hex in string form.
213
- *
214
- * @param {String} hex - The colour value in hex form.
215
- */ /**
216
- * Set the material of the geometry.
217
- *
218
- * @param {THREE.Material} material - Material to be set for this geometry.
219
- */ /**
220
- * Get the index of the closest vertex to centroid.
221
- *
222
- * @return {Number} - integer index in the array
223
- */ /**
224
- * Get the closest vertex to centroid.
225
- *
226
- * @return {THREE.Vector3}
227
- */ /**
228
- * Get the bounding box of this geometry.
229
- *
230
- * @return {THREE.Box3}.
231
- */ /**
232
- * Clear this geometry and free the memory.
233
- */ /**
234
- * Check if marker is enabled based on the objects settings with
235
- * the provided scene options.
236
- *
237
- * @return {Boolean}
238
- */ /**
239
- * Update the marker's position and size based on current viewport.
240
- */ /**
241
- * Get the windows coordinates.
242
- *
243
- * @return {Object} - position and rather the closest vertex is on screen.
244
- */ /**
245
- * Set marker mode for this zinc object which determine rather the
246
- * markers should be displayed or not.
247
- *
248
- * @param {string} mode - There are three options:
249
- * "on" - marker is enabled regardless of settings of scene
250
- * "off" - marker is disabled regardless of settings of scene
251
- * "inherited" - Marker settings on scene will determine the visibility
252
- * of the marker.
253
- *
254
- * @return {Boolean}
255
- */ //Update the geometry and colours depending on the morph.
256
- ZincObject.prototype.setMorphTime=function(time){var timeChanged=!1;if(this.clipAction){var ratio=time/this.duration,actualDuration=this.clipAction._clip.duration,newTime=ratio*actualDuration;newTime!=this.clipAction.time&&(this.clipAction.time=newTime,timeChanged=!0),timeChanged&&this.isTimeVarying()&&this.mixer.update(0)}else{var _newTime=time;_newTime=time>this.duration?this.duration:0>time?0:time,_newTime!=this.inbuildTime&&(this.inbuildTime=_newTime,timeChanged=!0)}timeChanged&&(this.boundingBoxUpdateRequired=!0,updateMorphColorAttribute(this.geometry,this.morph),this.timeEnabled&&(this.markerUpdateRequired=!0))},ZincObject.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},ZincObject.prototype.getVisibility=function(){return!!this.morph&&this.morph.visible},ZincObject.prototype.setVisibility=function(visible){this.morph.visible!==visible&&(this.morph.visible=visible,this.region&&(this.region.pickableUpdateRequired=!0))},ZincObject.prototype.setAlpha=function(alpha){var material=this.morph.material,isTransparent=!1;1>alpha&&(isTransparent=!0);var transparentChanged=material.transparent!=isTransparent;material.opacity=alpha,material.transparent=isTransparent,transparentChanged&&(isTransparent?this.checkAndCreateTransparentMesh():this.checkAndRemoveTransparentMesh()),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.opacity=alpha)},ZincObject.prototype.setFrustumCulled=function(flag){this.morph&&(this.morph.frustumCulled=flag)},ZincObject.prototype.setVertexColors=function(vertexColors){this.morph.material.vertexColors=vertexColors,this.geometry.colorsNeedUpdate=!0,this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.vertexColors=vertexColors)},ZincObject.prototype.getColour=function(){return this.morph&&this.morph.material?this.morph.material.color:void 0},ZincObject.prototype.setColour=function(colour){this.morph.material.color=colour,this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry.colorsNeedUpdate=!0},ZincObject.prototype.getColourHex=function(){return!this.morphColour&&this.morph&&this.morph.material&&this.morph.material.color?this.morph.material.color.getHexString():void 0},ZincObject.prototype.setColourHex=function(hex){this.morph.material.color.setHex(hex),this.secondaryMesh&&this.secondaryMesh.material&&this.secondaryMesh.material.color.setHex(hex)},ZincObject.prototype.setMaterial=function(material){this.morph.material=material,this.geometry.colorsNeedUpdate=!0,this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.dispose(),this.secondaryMesh.material=material.clone(),this.secondaryMesh.material.side=THREE.FrontSide)},ZincObject.prototype.getClosestVertexIndex=function(){var closestIndex=-1;if(this.morph){var position=this.morph.geometry.attributes.position,boundingBox=new THREE.Box3().setFromBufferAttribute(position),center=new THREE.Vector3;if(boundingBox.getCenter(center),position&&boundingBox)for(var distance=-1,currentDistance=0,current=new THREE.Vector3,i=0;i<position.count;i++)current.fromArray(position.array,3*i),currentDistance=current.distanceTo(center),-1==distance?distance=currentDistance:distance>currentDistance&&(distance=currentDistance,closestIndex=i)}return closestIndex},ZincObject.prototype.getClosestVertex=function(applyMatrixWorld){var position=new THREE.Vector3;if(-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex()),0<=this.closestVertexIndex){var influences=this.morph.morphTargetInfluences,attributes=this.morph.geometry.morphAttributes;if(influences&&attributes&&attributes.position){for(var found=!1,i=0;i<influences.length;i++)0<influences[i]&&(found=!0,this._vertex.fromArray(attributes.position[i].array,3*this.closestVertexIndex),position.add(this._vertex.multiplyScalar(influences[i])));if(found)return applyMatrixWorld?position.applyMatrix4(this.morph.matrixWorld):position}else return position.fromArray(this.morph.geometry.attributes.position.array,3*this.closestVertexIndex),applyMatrixWorld?position.applyMatrix4(this.morph.matrixWorld):position}return this.getBoundingBox().getCenter(position),applyMatrixWorld?position.applyMatrix4(this.morph.matrixWorld):position},ZincObject.prototype.getBoundingBox=function(){if(this.morph&&this.morph.visible){if(this.boundingBoxUpdateRequired){var influences=this.morph.morphTargetInfluences,attributes=void 0;this.morph.geometry&&(attributes=this.morph.geometry.morphAttributes);var found=!1;if(influences&&attributes&&attributes.position){for(var min=new THREE.Vector3,max=new THREE.Vector3,box=new THREE.Box3,i=0;i<influences.length;i++)0<influences[i]&&(found=!0,box.setFromArray(attributes.position[i].array),min.add(box.min.multiplyScalar(influences[i])),max.add(box.max.multiplyScalar(influences[i])));found&&this.cachedBoundingBox.set(min,max)}found||this.cachedBoundingBox.setFromBufferAttribute(this.morph.geometry.attributes.position),this.morph.updateWorldMatrix(),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox}},ZincObject.prototype.dispose=function(){this.morph&&this.morph.geometry&&this.morph.geometry.dispose(),this.morph&&this.morph.material&&this.morph.material.dispose(),this.secondaryMesh&&this.secondaryMesh.material&&this.secondaryMesh.material.dispose(),this.geometry&&this.geometry.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.clipAction=void 0,this.groupName=void 0},ZincObject.prototype.markerIsEnabled=function(options){return!!("on"===this.markerMode||options&&options.displayMarkers&&"inherited"===this.markerMode)},ZincObject.prototype.updateMarker=function(playAnimation,options){if(!(!1==playAnimation&&this.markerIsEnabled(options)))this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.morph.remove(this.marker.morph)),this.markerUpdateRequired=!0;else if(this.groupName){if(this.marker||(this.marker=new(__webpack_require__(7).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)}options&&options.camera&&options.markerDepths&&options.markerDepths.push(this.marker.updateNDC(options.camera.cameraObject)),this.marker.isEnabled()||(this.marker.enable(),this.morph.add(this.marker.morph))}},ZincObject.prototype.processMarkerVisual=function(min,max){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(min,max)},ZincObject.prototype.initiateMorphColor=function(){1==this.morphColour&&"undefined"!=typeof this.geometry&&(this.morph.material.vertexColors==THREE.VertexColors||!0==this.morph.material.vertexColors)&&updateMorphColorAttribute(this.geometry,this.morph)},ZincObject.prototype.setRenderOrder=function(renderOrder){this.morph&&renderOrder!==void 0&&(this.morph.renderOrder=renderOrder,this.secondaryMesh&&(this.secondaryMesh.renderOrder=this.morph.renderOrder+1))},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){mode!==this.markerMode&&(this.markerMode="on"===mode||"off"===mode?mode:"inherited",this.region&&(this.region.pickableUpdateRequired=!0))},ZincObject.prototype.render=function(delta,playAnimation,options){if(!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}0!=delta&&(this.boundingBoxUpdateRequired=!0,1==this.morphColour&&"undefined"!=typeof this.geometry&&(this.morph.material.vertexColors==THREE.VertexColors||!0==this.morph.material.vertexColors)&&updateMorphColorAttribute(this.geometry,this.morph))}this.updateMarker(playAnimation,options)},exports.ZincObject=ZincObject;
153
+ function _readOnlyError(name){throw new Error("\""+name+"\" is read-only")}var THREE=__webpack_require__(3),THREEGeometry=__webpack_require__(5).Geometry;function resolveURL(url){var actualURL=url,prefix=__webpack_require__(0).modelPrefix;if(prefix){"/"!=prefix[prefix.length-1]&&(prefix=(_readOnlyError("prefix"),prefix+"/"));var r=/^(?:[a-z]+:)?\/\//i;r.test(url)||(actualURL=prefix+url)}return actualURL}//Convenient function
154
+ function loadExternalFile(url,data,callback,errorCallback){// Set up an asynchronous request
155
+ var request=new XMLHttpRequest;// Hook the event that gets called as the request progresses
156
+ request.open("GET",resolveURL(url),!0),request.onreadystatechange=()=>{4==request.readyState&&(200==request.status?callback(request.responseText,data):errorCallback(url))},request.send(null)}function loadExternalFiles(urls,callback,errorCallback){// Callback for a single file
157
+ function partialCallback(text,urlIndex){result[urlIndex]=text,numComplete++,numComplete==numUrls&&callback(result)}for(var numUrls=urls.length,numComplete=0,result=[],i=0;i<numUrls;i++)loadExternalFile(urls[i],i,partialCallback,errorCallback)}//Get the colours at index
158
+ exports.getColorsRGB=(colors,index)=>{var index_in_colors=Math.floor(index/3),remainder=index%3,hex_value=0;0==remainder?hex_value=colors[index_in_colors].r:1==remainder?hex_value=colors[index_in_colors].g:2==remainder&&(hex_value=colors[index_in_colors].b);var mycolor=new THREE.Color(hex_value);return[mycolor.r,mycolor.g,mycolor.b]},exports.updateMorphColorAttribute=function(targetGeometry,morph){if(morph&&targetGeometry&&targetGeometry.morphAttributes&&targetGeometry.morphAttributes.color){var morphColors=targetGeometry.morphAttributes.color,influences=morph.morphTargetInfluences,length=influences.length;targetGeometry.deleteAttribute("morphColor0"),targetGeometry.deleteAttribute("morphColor1");for(var bound=0,morphArray=[],i=0;1>bound||i<length;i++)0<influences[i]&&(bound++,morphArray.push([i,influences[i]]));2==morphArray.length?(targetGeometry.setAttribute("morphColor0",morphColors[morphArray[0][0]]),targetGeometry.setAttribute("morphColor1",morphColors[morphArray[1][0]])):1==morphArray.length&&(targetGeometry.setAttribute("morphColor0",morphColors[morphArray[0][0]]),targetGeometry.setAttribute("morphColor1",morphColors[morphArray[0][0]]))}},exports.toBufferGeometry=(geometryIn,options)=>{var geometry;return geometryIn instanceof THREEGeometry?(options.localTimeEnabled&&!geometryIn.morphNormalsReady&&(null==geometryIn.morphNormals||0==geometryIn.morphNormals.length)&&geometryIn.computeMorphNormals(),geometry=geometryIn.toIndexedBufferGeometry(),options.localMorphColour&&copyMorphColorsToIndexedBufferGeometry(geometryIn,geometry)):geometryIn instanceof THREE.BufferGeometry&&(geometry=geometryIn.clone()),geometry.colorsNeedUpdate=!0,geometry.computeBoundingBox(),geometry.computeBoundingSphere(),geometryIn._video&&(geometry._video=geometryIn._video),geometry},exports.copyMorphColorsToBufferGeometry=(geometry,bufferGeometry)=>{if(geometry&&geometry.morphColors&&0<geometry.morphColors.length){for(var array=[],morphColors=geometry.morphColors,getColorsRGB=__webpack_require__(4).getColorsRGB,i=0,l=morphColors.length;i<l;i++){for(var morphColor=morphColors[i],colorArray=[],j=0;j<geometry.faces.length;j++){var face=geometry.faces[j],color=getColorsRGB(morphColor.colors,face.a);colorArray.push(color[0],color[1],color[2]),color=getColorsRGB(morphColor.colors,face.b),colorArray.push(color[0],color[1],color[2]),color=getColorsRGB(morphColor.colors,face.c),colorArray.push(color[0],color[1],color[2])}var attribute=new THREE.Float32BufferAttribute(3*(3*geometry.faces.length),3);attribute.name=morphColor.name,array.push(attribute.copyArray(colorArray))}bufferGeometry.morphAttributes.color=array}};var copyMorphColorsToIndexedBufferGeometry=(geometry,bufferGeometry)=>{if(geometry&&geometry.morphColors&&0<geometry.morphColors.length){for(var array=[],morphColors=geometry.morphColors,getColorsRGB=__webpack_require__(4).getColorsRGB,i=0,l=morphColors.length;i<l;i++){for(var color,morphColor=morphColors[i],colorArray=[],j=0;j<3*morphColor.colors.length;j++)color=getColorsRGB(morphColor.colors,j),colorArray.push(color[0],color[1],color[2]);var attribute=new THREE.Float32BufferAttribute(colorArray,3);attribute.name=morphColor.name,array.push(attribute)}bufferGeometry.morphAttributes.color=array}};exports.mergeVertices=function(geometry){var tolerance=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1e-4;tolerance=Math.max(tolerance,Number.EPSILON);// initialize the arrays
159
+ for(var name,hashToIndex={},indices=geometry.getIndex(),positions=geometry.getAttribute("position"),vertexCount=indices?indices.count:positions.count,nextIndex=0,attributeNames=Object.keys(geometry.attributes),attrArrays={},morphAttrsArrays={},newIndices=[],getters=["getX","getY","getZ","getW"],i=0,l=attributeNames.length;i<l;i++){name=attributeNames[i],attrArrays[name]=[];var morphAttr=geometry.morphAttributes[name];morphAttr&&(morphAttrsArrays[name]=Array(morphAttr.length).fill().map(()=>[]))}// convert the error tolerance to an amount of decimal places to truncate to
160
+ for(var decimalShift=Math.log10(1/tolerance),shiftMultiplier=Math.pow(10,decimalShift),i=0;i<vertexCount;i++){for(var index=indices?indices.getX(i):i,hash="",j=0,l=attributeNames.length;j<l;j++)for(var name=attributeNames[j],attribute=geometry.getAttribute(name),itemSize=attribute.itemSize,k=0;k<itemSize;k++)// double tilde truncates the decimal value
161
+ hash+="".concat(~~(attribute[getters[k]](index)*shiftMultiplier),",");// Add another reference to the vertex if it's already
162
+ // used by another index
163
+ if(hash in hashToIndex)newIndices.push(hashToIndex[hash]);else{// copy data to the new index in the attribute arrays
164
+ for(var j=0,l=attributeNames.length;j<l;j++)for(var getterFunc,name=attributeNames[j],attribute=geometry.getAttribute(name),morphAttr=geometry.morphAttributes[name],itemSize=attribute.itemSize,newarray=attrArrays[name],newMorphArrays=morphAttrsArrays[name],k=0;k<itemSize;k++)if(getterFunc=getters[k],newarray.push(attribute[getterFunc](index)),morphAttr)for(var m=0,ml=morphAttr.length;m<ml;m++)newMorphArrays[m].push(morphAttr[m][getterFunc](index));hashToIndex[hash]=nextIndex,newIndices.push(nextIndex),nextIndex++}}// Generate typed arrays from new attribute arrays and update
165
+ // the attributeBuffers
166
+ for(var result=geometry.clone(),i=0,l=attributeNames.length;i<l;i++){var attribute,name=attributeNames[i],oldAttribute=geometry.getAttribute(name),buffer=new oldAttribute.array.constructor(attrArrays[name]);// Update the attribute arrays
167
+ if(oldAttribute.isInterleavedBufferAttribute?attribute=new THREE.BufferAttribute(buffer,oldAttribute.itemSize,oldAttribute.itemSize):(attribute=geometry.getAttribute(name).clone(),attribute.setArray(buffer)),result.setAttribute(name,attribute),name in morphAttrsArrays)for(var morphAttribute,j=0;j<morphAttrsArrays[name].length;j++)morphAttribute=geometry.morphAttributes[name][j].clone(),morphAttribute.setArray(new morphAttribute.array.constructor(morphAttrsArrays[name][j])),result.morphAttributes[name][j]=morphAttribute}// Generate an index buffer typed array
168
+ var cons=Uint8Array;newIndices.length>=Math.pow(2,8)&&(cons=Uint16Array),newIndices.length>=Math.pow(2,16)&&(cons=Uint32Array);var newIndexBuffer=new cons(newIndices),newIndices=null;return null===indices?newIndices=new THREE.BufferAttribute(newIndexBuffer,1):(newIndices=geometry.getIndex().clone(),newIndices.setArray(newIndexBuffer)),result.setIndex(newIndices),result};function PhongToToon(materialIn){if(materialIn.isMeshPhongMaterial){var material=new THREE.MeshToonMaterial({color:materialIn.color.clone(),morphTargets:materialIn.morphTargets,morphNormals:materialIn.morphNormals,vertexColors:materialIn.vertexColors,transparent:materialIn.transparent,opacity:materialIn.opacity,side:materialIn.side});return materialIn.map&&(material.map=materialIn.map),material}return materialIn}exports.resolveURL=resolveURL,exports.loadExternalFile=loadExternalFile,exports.loadExternalFiles=loadExternalFiles,exports.PhongToToon=PhongToToon;
257
169
 
258
170
  /***/ }),
259
171
  /* 5 */
@@ -354,28 +266,150 @@ hasSkinIndices&&this.skinIndices.push(skinIndices[face.a],skinIndices[face.b],sk
354
266
  /* 6 */
355
267
  /***/ (function(module, exports, __webpack_require__) {
356
268
 
357
- function _readOnlyError(name){throw new Error("\""+name+"\" is read-only")}var THREE=__webpack_require__(3);function resolveURL(url){var actualURL=url,prefix=__webpack_require__(0).modelPrefix;if(prefix){"/"!=prefix[prefix.length-1]&&(prefix=(_readOnlyError("prefix"),prefix+"/"));var r=/^(?:[a-z]+:)?\/\//i;r.test(url)||(actualURL=prefix+url)}return actualURL}//Convenient function
358
- function loadExternalFile(url,data,callback,errorCallback){// Set up an asynchronous request
359
- var request=new XMLHttpRequest;// Hook the event that gets called as the request progresses
360
- request.open("GET",resolveURL(url),!0),request.onreadystatechange=()=>{4==request.readyState&&(200==request.status?callback(request.responseText,data):errorCallback(url))},request.send(null)}function loadExternalFiles(urls,callback,errorCallback){// Callback for a single file
361
- function partialCallback(text,urlIndex){result[urlIndex]=text,numComplete++,numComplete==numUrls&&callback(result)}for(var numUrls=urls.length,numComplete=0,result=[],i=0;i<numUrls;i++)loadExternalFile(urls[i],i,partialCallback,errorCallback)}//Get the colours at index
362
- exports.getColorsRGB=(colors,index)=>{var index_in_colors=Math.floor(index/3),remainder=index%3,hex_value=0;0==remainder?hex_value=colors[index_in_colors].r:1==remainder?hex_value=colors[index_in_colors].g:2==remainder&&(hex_value=colors[index_in_colors].b);var mycolor=new THREE.Color(hex_value);return[mycolor.r,mycolor.g,mycolor.b]},exports.copyMorphColorsToBufferGeometry=(geometry,bufferGeometry)=>{if(geometry&&geometry.morphColors&&0<geometry.morphColors.length){for(var array=[],morphColors=geometry.morphColors,getColorsRGB=__webpack_require__(6).getColorsRGB,i=0,l=morphColors.length;i<l;i++){for(var morphColor=morphColors[i],colorArray=[],j=0;j<geometry.faces.length;j++){var face=geometry.faces[j],color=getColorsRGB(morphColor.colors,face.a);colorArray.push(color[0],color[1],color[2]),color=getColorsRGB(morphColor.colors,face.b),colorArray.push(color[0],color[1],color[2]),color=getColorsRGB(morphColor.colors,face.c),colorArray.push(color[0],color[1],color[2])}var attribute=new THREE.Float32BufferAttribute(3*(3*geometry.faces.length),3);attribute.name=morphColor.name,array.push(attribute.copyArray(colorArray))}bufferGeometry.morphAttributes.color=array}},exports.copyMorphColorsToIndexedBufferGeometry=(geometry,bufferGeometry)=>{if(geometry&&geometry.morphColors&&0<geometry.morphColors.length){for(var array=[],morphColors=geometry.morphColors,getColorsRGB=__webpack_require__(6).getColorsRGB,i=0,l=morphColors.length;i<l;i++){for(var color,morphColor=morphColors[i],colorArray=[],j=0;j<3*morphColor.colors.length;j++)color=getColorsRGB(morphColor.colors,j),colorArray.push(color[0],color[1],color[2]);var attribute=new THREE.Float32BufferAttribute(colorArray,3);attribute.name=morphColor.name,array.push(attribute)}bufferGeometry.morphAttributes.color=array}},exports.mergeVertices=function(geometry){var tolerance=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1e-4;tolerance=Math.max(tolerance,Number.EPSILON);// initialize the arrays
363
- for(var name,hashToIndex={},indices=geometry.getIndex(),positions=geometry.getAttribute("position"),vertexCount=indices?indices.count:positions.count,nextIndex=0,attributeNames=Object.keys(geometry.attributes),attrArrays={},morphAttrsArrays={},newIndices=[],getters=["getX","getY","getZ","getW"],i=0,l=attributeNames.length;i<l;i++){name=attributeNames[i],attrArrays[name]=[];var morphAttr=geometry.morphAttributes[name];morphAttr&&(morphAttrsArrays[name]=Array(morphAttr.length).fill().map(()=>[]))}// convert the error tolerance to an amount of decimal places to truncate to
364
- for(var decimalShift=Math.log10(1/tolerance),shiftMultiplier=Math.pow(10,decimalShift),i=0;i<vertexCount;i++){for(var index=indices?indices.getX(i):i,hash="",j=0,l=attributeNames.length;j<l;j++)for(var name=attributeNames[j],attribute=geometry.getAttribute(name),itemSize=attribute.itemSize,k=0;k<itemSize;k++)// double tilde truncates the decimal value
365
- hash+="".concat(~~(attribute[getters[k]](index)*shiftMultiplier),",");// Add another reference to the vertex if it's already
366
- // used by another index
367
- if(hash in hashToIndex)newIndices.push(hashToIndex[hash]);else{// copy data to the new index in the attribute arrays
368
- for(var j=0,l=attributeNames.length;j<l;j++)for(var getterFunc,name=attributeNames[j],attribute=geometry.getAttribute(name),morphAttr=geometry.morphAttributes[name],itemSize=attribute.itemSize,newarray=attrArrays[name],newMorphArrays=morphAttrsArrays[name],k=0;k<itemSize;k++)if(getterFunc=getters[k],newarray.push(attribute[getterFunc](index)),morphAttr)for(var m=0,ml=morphAttr.length;m<ml;m++)newMorphArrays[m].push(morphAttr[m][getterFunc](index));hashToIndex[hash]=nextIndex,newIndices.push(nextIndex),nextIndex++}}// Generate typed arrays from new attribute arrays and update
369
- // the attributeBuffers
370
- for(var result=geometry.clone(),i=0,l=attributeNames.length;i<l;i++){var attribute,name=attributeNames[i],oldAttribute=geometry.getAttribute(name),buffer=new oldAttribute.array.constructor(attrArrays[name]);// Update the attribute arrays
371
- if(oldAttribute.isInterleavedBufferAttribute?attribute=new THREE.BufferAttribute(buffer,oldAttribute.itemSize,oldAttribute.itemSize):(attribute=geometry.getAttribute(name).clone(),attribute.setArray(buffer)),result.setAttribute(name,attribute),name in morphAttrsArrays)for(var morphAttribute,j=0;j<morphAttrsArrays[name].length;j++)morphAttribute=geometry.morphAttributes[name][j].clone(),morphAttribute.setArray(new morphAttribute.array.constructor(morphAttrsArrays[name][j])),result.morphAttributes[name][j]=morphAttribute}// Generate an index buffer typed array
372
- var cons=Uint8Array;newIndices.length>=Math.pow(2,8)&&(cons=Uint16Array),newIndices.length>=Math.pow(2,16)&&(cons=Uint32Array);var newIndexBuffer=new cons(newIndices),newIndices=null;return null===indices?newIndices=new THREE.BufferAttribute(newIndexBuffer,1):(newIndices=geometry.getIndex().clone(),newIndices.setArray(newIndexBuffer)),result.setIndex(newIndices),result};function PhongToToon(materialIn){if(materialIn.isMeshPhongMaterial){var material=new THREE.MeshToonMaterial({color:materialIn.color.clone(),morphTargets:materialIn.morphTargets,morphNormals:materialIn.morphNormals,vertexColors:materialIn.vertexColors,transparent:materialIn.transparent,opacity:materialIn.opacity,side:materialIn.side});return materialIn.map&&(material.map=materialIn.map),material}return materialIn}exports.resolveURL=resolveURL,exports.loadExternalFile=loadExternalFile,exports.loadExternalFiles=loadExternalFiles,exports.PhongToToon=PhongToToon;
269
+ var THREE=__webpack_require__(3),updateMorphColorAttribute=__webpack_require__(4).updateMorphColorAttribute,uniqueiId=0,getUniqueId=function(){return"pr"+uniqueiId++},ZincObject=function(){// THREE.Mesh
270
+ // THREE.Mesh - for utilities purpose such as rendering
271
+ // transparent surfaces - one for front face and one for back face.
272
+ /**
273
+ * Groupname given to this geometry.
274
+ */ /**
275
+ * Total duration of the animation, this value interacts with the
276
+ * {@link Renderer#playRate} to produce the actual duration of the
277
+ * animation. Actual time in second = duration / playRate.
278
+ */this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.secondaryMesh=void 0,this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.videoHandler=void 0,this.marker=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new THREE.Box3,this._vertex=new THREE.Vector3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode="inherited",this.uuid=getUniqueId()};/**
279
+ * Set the duration of the animation of this object.
280
+ *
281
+ * @param {Number} durationIn - Duration of the animation.
282
+ */ /**
283
+ * Get the duration of the animation of this object.
284
+ *
285
+ * @return {Number}
286
+ */ /**
287
+ * Set the region this object belongs to.
288
+ *
289
+ * @param {Region} region
290
+ */ /**
291
+ * Get the region this object belongs to.
292
+ *
293
+ * @return {Region}
294
+ */ /**
295
+ * Handle transparent mesh, create a clone for backside rendering if it is
296
+ * transparent.
297
+ */ /**
298
+ * Handle transparent mesh, remove a clone for backside rendering if it is
299
+ * transparent.
300
+ */ /**
301
+ * Set the mesh function for zincObject.
302
+ *
303
+ * @param {THREE.Mesh} mesh - Mesh to be set for this zinc object.
304
+ * @param {Boolean} localTimeEnabled - A flag to indicate either the mesh is
305
+ * time dependent.
306
+ * @param {Boolean} localMorphColour - A flag to indicate either the colour is
307
+ * time dependent.
308
+ */ /**
309
+ * Set the name for this ZincObject.
310
+ *
311
+ * @param {String} groupNameIn - Name to be set.
312
+ */ /**
313
+ * Get the local time of this geometry, it returns a value between
314
+ * 0 and the duration.
315
+ *
316
+ * @return {Number}
317
+ */ /**
318
+ * Set the local time of this geometry.
319
+ *
320
+ * @param {Number} time - Can be any value between 0 to duration.
321
+ */ /**
322
+ * Check if the geometry is time varying.
323
+ *
324
+ * @return {Boolean}
325
+ */ /**
326
+ * Get the visibility of this Geometry.
327
+ *
328
+ */ /**
329
+ * Set the visibility of this Geometry.
330
+ *
331
+ * @param {Boolean} visible - a boolean flag indicate the visibility to be set
332
+ */ /**
333
+ * Set the opacity of this Geometry. This function will also set the isTransparent
334
+ * flag according to the provided alpha value.
335
+ *
336
+ * @param {Number} alpah - Alpha value to set for this geometry,
337
+ * can be any value between from 0 to 1.0.
338
+ */ /**
339
+ * The rendering will be culled if it is outside of the frustrum
340
+ * when this flag is set to true, it should be set to false if
341
+ * morphing is enabled.
342
+ *
343
+ * @param {Boolean} flag - Set frustrum culling on/off based on this flag.
344
+ */ /**
345
+ * Set rather a zinc object should be displayed using per vertex colour or
346
+ * not.
347
+ *
348
+ * @param {Boolean} vertexColors - Set display with vertex color on/off.
349
+ */ /**
350
+ * Get the colour of the mesh.
351
+ *
352
+ * @return {THREE.Color}
353
+ */ /**
354
+ * Set the colour of the mesh.
355
+ *
356
+ * @param {THREE.Color} colour - Colour to be set for this geometry.
357
+ */ /**
358
+ * Get the colour of the mesh in hex string form.
359
+ *
360
+ * @return {String}
361
+ */ /**
362
+ * Set the colour of the mesh using hex in string form.
363
+ *
364
+ * @param {String} hex - The colour value in hex form.
365
+ */ /**
366
+ * Set the material of the geometry.
367
+ *
368
+ * @param {THREE.Material} material - Material to be set for this geometry.
369
+ */ /**
370
+ * Get the index of the closest vertex to centroid.
371
+ *
372
+ * @return {Number} - integer index in the array
373
+ */ /**
374
+ * Get the closest vertex to centroid.
375
+ *
376
+ * @return {THREE.Vector3}
377
+ */ /**
378
+ * Get the bounding box of this geometry.
379
+ *
380
+ * @return {THREE.Box3}.
381
+ */ /**
382
+ * Clear this geometry and free the memory.
383
+ */ /**
384
+ * Check if marker is enabled based on the objects settings with
385
+ * the provided scene options.
386
+ *
387
+ * @return {Boolean}
388
+ */ /**
389
+ * Update the marker's position and size based on current viewport.
390
+ */ /**
391
+ * Get the windows coordinates.
392
+ *
393
+ * @return {Object} - position and rather the closest vertex is on screen.
394
+ */ /**
395
+ * Set marker mode for this zinc object which determine rather the
396
+ * markers should be displayed or not.
397
+ *
398
+ * @param {string} mode - There are three options:
399
+ * "on" - marker is enabled regardless of settings of scene
400
+ * "off" - marker is disabled regardless of settings of scene
401
+ * "inherited" - Marker settings on scene will determine the visibility
402
+ * of the marker.
403
+ *
404
+ * @return {Boolean}
405
+ */ //Update the geometry and colours depending on the morph.
406
+ ZincObject.prototype.setDuration=function(durationIn){this.duration=durationIn,this.clipAction&&this.clipAction.setDuration(this.duration)},ZincObject.prototype.getDuration=function(){return this.duration},ZincObject.prototype.setRegion=function(region){this.region=region},ZincObject.prototype.getRegion=function(){return this.region},ZincObject.prototype.checkAndCreateTransparentMesh=function(){},ZincObject.prototype.checkAndRemoveTransparentMesh=function(){},ZincObject.prototype.setMesh=function(mesh,localTimeEnabled,localMorphColour){if(this.animationGroup=new THREE.AnimationObjectGroup(mesh),this.mixer=new THREE.AnimationMixer(this.animationGroup),this.geometry=mesh.geometry,this.clipAction=void 0,this.geometry&&this.geometry.morphAttributes){var morphAttribute=this.geometry.morphAttributes.position;morphAttribute||(morphAttribute=this.geometry.morphAttributes.color?this.geometry.morphAttributes.color:this.geometry.morphAttributes.normal),morphAttribute&&(this.animationClip=THREE.AnimationClip.CreateClipsFromMorphTargetSequences(morphAttribute,10,!0),this.animationClip&&null!=this.animationClip[0]&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=THREE.loopOnce,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=localTimeEnabled,this.morphColour=localMorphColour,this.morph=mesh,this.morph.userData=this,this.morph.matrixAutoUpdate=!1,this.checkAndCreateTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(this.geometry.setAttribute("morphTarget0",this.geometry.getAttribute("position")),this.geometry.setAttribute("morphTarget1",this.geometry.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},ZincObject.prototype.setName=function(groupNameIn){this.groupName=groupNameIn,this.morph&&(this.morph.name=this.groupName),this.secondaryMesh&&(this.secondaryMesh.name=this.groupName)},ZincObject.prototype.getCurrentTime=function(){if(this.clipAction){var ratio=this.clipAction.time/this.clipAction._clip.duration;return this.duration*ratio}return this.inbuildTime},ZincObject.prototype.setMorphTime=function(time){var timeChanged=!1;if(this.clipAction){var ratio=time/this.duration,actualDuration=this.clipAction._clip.duration,newTime=ratio*actualDuration;newTime!=this.clipAction.time&&(this.clipAction.time=newTime,timeChanged=!0),timeChanged&&this.isTimeVarying()&&this.mixer.update(0)}else{var _newTime=time;_newTime=time>this.duration?this.duration:0>time?0:time,_newTime!=this.inbuildTime&&(this.inbuildTime=_newTime,timeChanged=!0)}timeChanged&&(this.boundingBoxUpdateRequired=!0,updateMorphColorAttribute(this.geometry,this.morph),this.timeEnabled&&(this.markerUpdateRequired=!0))},ZincObject.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},ZincObject.prototype.getVisibility=function(){return!!this.morph&&this.morph.visible},ZincObject.prototype.setVisibility=function(visible){this.morph.visible!==visible&&(this.morph.visible=visible,this.region&&(this.region.pickableUpdateRequired=!0))},ZincObject.prototype.setAlpha=function(alpha){var material=this.morph.material,isTransparent=!1;1>alpha&&(isTransparent=!0);var transparentChanged=material.transparent!=isTransparent;material.opacity=alpha,material.transparent=isTransparent,transparentChanged&&(isTransparent?this.checkAndCreateTransparentMesh():this.checkAndRemoveTransparentMesh()),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.opacity=alpha)},ZincObject.prototype.setFrustumCulled=function(flag){this.morph&&(this.morph.frustumCulled=flag)},ZincObject.prototype.setVertexColors=function(vertexColors){this.morph.material.vertexColors=vertexColors,this.geometry.colorsNeedUpdate=!0,this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.vertexColors=vertexColors)},ZincObject.prototype.getColour=function(){return this.morph&&this.morph.material?this.morph.material.color:void 0},ZincObject.prototype.setColour=function(colour){this.morph.material.color=colour,this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry.colorsNeedUpdate=!0},ZincObject.prototype.getColourHex=function(){return!this.morphColour&&this.morph&&this.morph.material&&this.morph.material.color?this.morph.material.color.getHexString():void 0},ZincObject.prototype.setColourHex=function(hex){this.morph.material.color.setHex(hex),this.secondaryMesh&&this.secondaryMesh.material&&this.secondaryMesh.material.color.setHex(hex)},ZincObject.prototype.setMaterial=function(material){this.morph.material=material,this.geometry.colorsNeedUpdate=!0,this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.dispose(),this.secondaryMesh.material=material.clone(),this.secondaryMesh.material.side=THREE.FrontSide)},ZincObject.prototype.getClosestVertexIndex=function(){var closestIndex=-1;if(this.morph){var position=this.morph.geometry.attributes.position,boundingBox=new THREE.Box3().setFromBufferAttribute(position),center=new THREE.Vector3;if(boundingBox.getCenter(center),position&&boundingBox)for(var distance=-1,currentDistance=0,current=new THREE.Vector3,i=0;i<position.count;i++)current.fromArray(position.array,3*i),currentDistance=current.distanceTo(center),-1==distance?distance=currentDistance:distance>currentDistance&&(distance=currentDistance,closestIndex=i)}return closestIndex},ZincObject.prototype.getClosestVertex=function(applyMatrixWorld){var position=new THREE.Vector3;if(-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex()),0<=this.closestVertexIndex){var influences=this.morph.morphTargetInfluences,attributes=this.morph.geometry.morphAttributes;if(influences&&attributes&&attributes.position){for(var found=!1,i=0;i<influences.length;i++)0<influences[i]&&(found=!0,this._vertex.fromArray(attributes.position[i].array,3*this.closestVertexIndex),position.add(this._vertex.multiplyScalar(influences[i])));if(found)return applyMatrixWorld?position.applyMatrix4(this.morph.matrixWorld):position}else return position.fromArray(this.morph.geometry.attributes.position.array,3*this.closestVertexIndex),applyMatrixWorld?position.applyMatrix4(this.morph.matrixWorld):position}return this.getBoundingBox().getCenter(position),applyMatrixWorld?position.applyMatrix4(this.morph.matrixWorld):position},ZincObject.prototype.getBoundingBox=function(){if(this.morph&&this.morph.visible){if(this.boundingBoxUpdateRequired){var influences=this.morph.morphTargetInfluences,attributes=void 0;this.morph.geometry&&(attributes=this.morph.geometry.morphAttributes);var found=!1;if(influences&&attributes&&attributes.position){for(var min=new THREE.Vector3,max=new THREE.Vector3,box=new THREE.Box3,i=0;i<influences.length;i++)0<influences[i]&&(found=!0,box.setFromArray(attributes.position[i].array),min.add(box.min.multiplyScalar(influences[i])),max.add(box.max.multiplyScalar(influences[i])));found&&this.cachedBoundingBox.set(min,max)}found||this.cachedBoundingBox.setFromBufferAttribute(this.morph.geometry.attributes.position),this.morph.updateWorldMatrix(),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox}},ZincObject.prototype.dispose=function(){this.morph&&this.morph.geometry&&this.morph.geometry.dispose(),this.morph&&this.morph.material&&this.morph.material.dispose(),this.secondaryMesh&&this.secondaryMesh.material&&this.secondaryMesh.material.dispose(),this.geometry&&this.geometry.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.clipAction=void 0,this.groupName=void 0},ZincObject.prototype.markerIsEnabled=function(options){return!!("on"===this.markerMode||options&&options.displayMarkers&&"inherited"===this.markerMode)},ZincObject.prototype.updateMarker=function(playAnimation,options){if(!(!1==playAnimation&&this.markerIsEnabled(options)))this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.morph.remove(this.marker.morph)),this.markerUpdateRequired=!0;else if(this.groupName){if(this.marker||(this.marker=new(__webpack_require__(7).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)}options&&options.camera&&options.markerDepths&&options.markerDepths.push(this.marker.updateNDC(options.camera.cameraObject)),this.marker.isEnabled()||(this.marker.enable(),this.morph.add(this.marker.morph))}},ZincObject.prototype.processMarkerVisual=function(min,max){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(min,max)},ZincObject.prototype.initiateMorphColor=function(){1==this.morphColour&&"undefined"!=typeof this.geometry&&(this.morph.material.vertexColors==THREE.VertexColors||!0==this.morph.material.vertexColors)&&updateMorphColorAttribute(this.geometry,this.morph)},ZincObject.prototype.setRenderOrder=function(renderOrder){this.morph&&renderOrder!==void 0&&(this.morph.renderOrder=renderOrder,this.secondaryMesh&&(this.secondaryMesh.renderOrder=this.morph.renderOrder+1))},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){mode!==this.markerMode&&(this.markerMode="on"===mode||"off"===mode?mode:"inherited",this.region&&(this.region.pickableUpdateRequired=!0))},ZincObject.prototype.render=function(delta,playAnimation,options){if(!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}0!=delta&&(this.boundingBoxUpdateRequired=!0,1==this.morphColour&&"undefined"!=typeof this.geometry&&(this.morph.material.vertexColors==THREE.VertexColors||!0==this.morph.material.vertexColors)&&updateMorphColorAttribute(this.geometry,this.morph))}this.updateMarker(playAnimation,options)},exports.ZincObject=ZincObject;
373
407
 
374
408
  /***/ }),
375
409
  /* 7 */
376
410
  /***/ (function(module, exports, __webpack_require__) {
377
411
 
378
- var THREE=__webpack_require__(3),markerImage=new Image(128,128);markerImage.src=__webpack_require__(8);var texture=new THREE.Texture;texture.image=markerImage,texture.needsUpdate=!0;var size=[.015,.02,1],Marker=function(zincObject){__webpack_require__(4).ZincObject.call(this),this.texture=texture;var spriteMaterial=void 0,sprite=void 0;this.morph=new THREE.Group,this.parent=zincObject,this.isMarker=!0;var enabled=!1,vector=new THREE.Vector3,initialise=()=>{spriteMaterial=new THREE.SpriteMaterial({map:texture,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),sprite=new THREE.Sprite(spriteMaterial),sprite.center.set(.5,0),this.morph.add(sprite),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,sprite.scale.set(size[0],size[1],size[2]),sprite.userData=this};/**
412
+ var THREE=__webpack_require__(3),markerImage=new Image(128,128);markerImage.src=__webpack_require__(8);var texture=new THREE.Texture;texture.image=markerImage,texture.needsUpdate=!0;var size=[.015,.02,1],Marker=function(zincObject){__webpack_require__(6).ZincObject.call(this),this.texture=texture;var spriteMaterial=void 0,sprite=void 0;this.morph=new THREE.Group,this.parent=zincObject,this.isMarker=!0;var enabled=!1,vector=new THREE.Vector3,initialise=()=>{spriteMaterial=new THREE.SpriteMaterial({map:texture,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),sprite=new THREE.Sprite(spriteMaterial),sprite.center.set(.5,0),this.morph.add(sprite),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,sprite.scale.set(size[0],size[1],size[2]),sprite.userData=this};/**
379
413
  * Set the position of the marker.
380
414
  *
381
415
  * @param {Number} x - x coordinate to be set.
@@ -400,7 +434,7 @@ this.updateVisual=(min,max)=>{var scale=1,opacity=1,porportion=0;min!==max&&(por
400
434
  * @class
401
435
  * @author Alan Wu
402
436
  * @return {Marker}
403
- */Marker.prototype=Object.create(__webpack_require__(4).ZincObject.prototype),exports.Marker=Marker;
437
+ */Marker.prototype=Object.create(__webpack_require__(6).ZincObject.prototype),exports.Marker=Marker;
404
438
 
405
439
  /***/ }),
406
440
  /* 8 */
@@ -420,7 +454,7 @@ module.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGlu
420
454
  /* 10 */
421
455
  /***/ (function(module, exports, __webpack_require__) {
422
456
 
423
- var THREE=__webpack_require__(3),Glyph=function(geometry,materialIn,idIn,glyphsetIn){__webpack_require__(4).ZincObject.call(this);var material;materialIn&&(material=materialIn.clone(),material.vertexColors=THREE.FaceColors);this.id=idIn;var label=void 0,labelString=void 0,group=new THREE.Group;/**
457
+ var THREE=__webpack_require__(3),Glyph=function(geometry,materialIn,idIn,glyphsetIn){__webpack_require__(6).ZincObject.call(this);var material;materialIn&&(material=materialIn.clone(),material.vertexColors=THREE.FaceColors);this.id=idIn;var label=void 0,labelString=void 0,group=new THREE.Group;/**
424
458
  * Create a glyph using mesh
425
459
  * @param {THREE.Mesh} meshIn - Mesh to create the glyph from
426
460
  *
@@ -472,7 +506,7 @@ var THREE=__webpack_require__(3),Glyph=function(geometry,materialIn,idIn,glyphse
472
506
  * @class
473
507
  * @author Alan Wu
474
508
  * @return {Glyph}
475
- */Glyph.prototype=Object.create(__webpack_require__(4).ZincObject.prototype),exports.Glyph=Glyph;
509
+ */Glyph.prototype=Object.create(__webpack_require__(6).ZincObject.prototype),exports.Glyph=Glyph;
476
510
 
477
511
  /***/ }),
478
512
  /* 11 */
@@ -529,7 +563,7 @@ module.exports = require("three-spritetext");
529
563
  /* 13 */
530
564
  /***/ (function(module, exports, __webpack_require__) {
531
565
 
532
- function _readOnlyError(name){throw new Error("\""+name+"\" is read-only")}var THREE=__webpack_require__(3),JSONLoader=__webpack_require__(14).JSONLoader,Glyphset=function(){__webpack_require__(4).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;for(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=[],i=0;8>i;i++)_points[i]=new THREE.Vector3;/**
566
+ function _readOnlyError(name){throw new Error("\""+name+"\" is read-only")}var THREE=__webpack_require__(3),JSONLoader=__webpack_require__(14).JSONLoader,Glyphset=function(){__webpack_require__(6).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;for(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=[],i=0;8>i;i++)_points[i]=new THREE.Vector3;/**
533
567
  * Get the {@link Three.Group} containing all of the glyphs' meshes.
534
568
  * @returns {Three.Group}
535
569
  */this.getGroup=()=>this.morph,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;if(this.geometry=new THREE.BufferGeometry,this.morph=new THREE.InstancedMesh(this.geometry,void 0,numberOfVertices),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))};/**
@@ -580,7 +614,7 @@ labels!=null&&displayLabels&&this.showLabel(this.morph.material?this.morph.mater
580
614
  if (glyphList && glyphList[this.closestVertexIndex]) {
581
615
  glyphList[this.closestVertexIndex].getBoundingBox().getCenter(position);
582
616
  }
583
- */{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 _i9=0;_i9<numberOfVertices;_i9++)this.morph.getMatrixAt(_i9,_transformMatrix),_boundingBox2.copy(_boundingBox1).applyMatrix4(_transformMatrix),0==_i9?_boundingBox3.copy(_boundingBox2):_boundingBox3.union(_boundingBox2);if(_boundingBox3)this.cachedBoundingBox.copy(_boundingBox3),this.morph.updateWorldMatrix(),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=()=>!!(0<numberOfTimeSteps&&(morphColours||morphVertices)),this.getCurrentTime=()=>this.inbuildTime,this.dispose=()=>{for(var _i10=glyphList.length-1;0<=_i10;_i10--)glyphList[_i10].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)}};Glyphset.prototype=Object.create(__webpack_require__(4).ZincObject.prototype),exports.Glyphset=Glyphset;
617
+ */{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 _i9=0;_i9<numberOfVertices;_i9++)this.morph.getMatrixAt(_i9,_transformMatrix),_boundingBox2.copy(_boundingBox1).applyMatrix4(_transformMatrix),0==_i9?_boundingBox3.copy(_boundingBox2):_boundingBox3.union(_boundingBox2);if(_boundingBox3)this.cachedBoundingBox.copy(_boundingBox3),this.morph.updateWorldMatrix(),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=()=>!!(0<numberOfTimeSteps&&(morphColours||morphVertices)),this.getCurrentTime=()=>this.inbuildTime,this.dispose=()=>{for(var _i10=glyphList.length-1;0<=_i10;_i10--)glyphList[_i10].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)}};Glyphset.prototype=Object.create(__webpack_require__(6).ZincObject.prototype),exports.Glyphset=Glyphset;
584
618
 
585
619
  /***/ }),
586
620
  /* 14 */
@@ -635,7 +669,7 @@ return!!(_this.video&&3<=_this.video.readyState)},function initialise(){document
635
669
  /* 17 */
636
670
  /***/ (function(module, exports, __webpack_require__) {
637
671
 
638
- var THREE=__webpack_require__(3),Points=__webpack_require__(18).Points,Pointset=function(){__webpack_require__(4).ZincObject.call(this),this.isPointset=!0;/** Shape of the points is created using the function below */var getCircularTexture=()=>{var image=new Image;image.src=__webpack_require__(19);var texture=new THREE.Texture;return texture.image=image,texture.needsUpdate=!0,texture};/**
672
+ var THREE=__webpack_require__(3),Points=__webpack_require__(18).Points,toBufferGeometry=__webpack_require__(4).toBufferGeometry,Pointset=function(){__webpack_require__(6).ZincObject.call(this),this.isPointset=!0;/** Shape of the points is created using the function below */var getCircularTexture=()=>{var image=new Image;image.src=__webpack_require__(19);var texture=new THREE.Texture;return texture.image=image,texture.needsUpdate=!0,texture};/**
639
673
  * Create the pointsets using geometry and material.
640
674
  *
641
675
  * @param {THREE.Geomtry} geometryIn - Geometry of points to be rendered.
@@ -654,7 +688,7 @@ var THREE=__webpack_require__(3),Points=__webpack_require__(18).Points,Pointset=
654
688
  *
655
689
  * @param {Boolean} flag - Determin either size attenuation
656
690
  * should be on or off.
657
- */this.createMesh=(geometryIn,materialIn,options)=>{if(geometryIn&&materialIn){var geometry=this.toBufferGeometry(geometryIn,options),texture=getCircularTexture();materialIn.map=texture;var point=new Points(geometry,materialIn);this.setMesh(point,options.localTimeEnabled,options.localMorphColour)}},this.setSize=size=>{this.morph&&this.morph.material&&(this.morph.material.size=size,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=flag=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=flag,this.morph.material.needsUpdate=!0)}};Pointset.prototype=Object.create(__webpack_require__(4).ZincObject.prototype),exports.Pointset=Pointset;
691
+ */this.createMesh=(geometryIn,materialIn,options)=>{if(geometryIn&&materialIn){var geometry=toBufferGeometry(geometryIn,options),texture=getCircularTexture();materialIn.map=texture;var point=new Points(geometry,materialIn);this.setMesh(point,options.localTimeEnabled,options.localMorphColour)}},this.setSize=size=>{this.morph&&this.morph.material&&(this.morph.material.size=size,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=flag=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=flag,this.morph.material.needsUpdate=!0)}};Pointset.prototype=Object.create(__webpack_require__(6).ZincObject.prototype),exports.Pointset=Pointset;
658
692
 
659
693
  /***/ }),
660
694
  /* 18 */
@@ -678,7 +712,7 @@ module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABz
678
712
  /* 20 */
679
713
  /***/ (function(module, exports, __webpack_require__) {
680
714
 
681
- var THREE=__webpack_require__(3),Lines=function(){/**
715
+ var THREE=__webpack_require__(3),toBufferGeometry=__webpack_require__(4).toBufferGeometry,Lines=function(){/**
682
716
  * Create the line segements using geometry and material.
683
717
  *
684
718
  * @param {THREE.Geomtry} geometryIn - Geometry of lines to be rendered.
@@ -692,15 +726,7 @@ var THREE=__webpack_require__(3),Lines=function(){/**
692
726
  * Set the width for the lines.
693
727
  *
694
728
  * @param {Number} width - Width of the lines.
695
- */__webpack_require__(4).ZincObject.call(this),this.isLines=!0,this.createLineSegment=(geometryIn,materialIn,options)=>{if(geometryIn&&materialIn){var geometry=this.toBufferGeometry(geometryIn,options);options.localMorphColour&&geometry.morphAttributes.color&&(materialIn.onBeforeCompile=__webpack_require__(9).augmentMorphColor());var line=new(__webpack_require__(21).LineSegments)(geometry,materialIn);this.setMesh(line,options.localTimeEnabled,options.localMorphColour)}},this.setWidth=width=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=width,this.morph.material.needsUpdate=!0)}};/**
696
- * Provides an object which stores lines.
697
- * This is created when a valid json file containing lines is read into a {@link Zinc.Scene}
698
- * object.
699
- *
700
- * @class
701
- * @author Alan Wu
702
- * @return {Lines}
703
- */Lines.prototype=Object.create(__webpack_require__(4).ZincObject.prototype),exports.Lines=Lines;
729
+ */__webpack_require__(6).ZincObject.call(this),this.isLines=!0,this.createLineSegment=(geometryIn,materialIn,options)=>{if(geometryIn&&materialIn){var geometry=toBufferGeometry(geometryIn,options);options.localMorphColour&&geometry.morphAttributes.color&&(materialIn.onBeforeCompile=__webpack_require__(9).augmentMorphColor());var line=new(__webpack_require__(21).LineSegments)(geometry,materialIn);this.setMesh(line,options.localTimeEnabled,options.localMorphColour)}},this.setWidth=width=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=width,this.morph.material.needsUpdate=!0)}};Lines.prototype=Object.create(__webpack_require__(6).ZincObject.prototype),exports.Lines=Lines;
704
730
 
705
731
  /***/ }),
706
732
  /* 21 */
@@ -880,13 +906,13 @@ var THREE=__webpack_require__(3),glslVersion=THREE.GLSL3,fs="\nprecision highp f
880
906
  /* 27 */
881
907
  /***/ (function(module, exports, __webpack_require__) {
882
908
 
883
- var THREE=__webpack_require__(3),TexturePrimitive=function(textureIn){__webpack_require__(4).ZincObject.call(this),this.isTexturePrimitive=!0,this.texture=textureIn};/**
909
+ var THREE=__webpack_require__(3),TexturePrimitive=function(textureIn){__webpack_require__(6).ZincObject.call(this),this.isTexturePrimitive=!0,this.texture=textureIn};/**
884
910
  * Provides a base class object which stores textures and rendering object.
885
911
  *
886
912
  * @class
887
913
  * @author Alan Wu
888
914
  * @return {TexturePrimitive}
889
- */TexturePrimitive.prototype=Object.create(__webpack_require__(4).ZincObject.prototype),exports.TexturePrimitive=TexturePrimitive;
915
+ */TexturePrimitive.prototype=Object.create(__webpack_require__(6).ZincObject.prototype),exports.TexturePrimitive=TexturePrimitive;
890
916
 
891
917
  /***/ }),
892
918
  /* 28 */
@@ -904,7 +930,7 @@ var THREE=__webpack_require__(3),ResizeSensor=__webpack_require__(29);/**
904
930
  * @author Alan Wu
905
931
  * @return {Renderer}
906
932
  */exports.Renderer=function(containerIn){var container=containerIn,renderer=void 0,currentScene=void 0,clock=new THREE.Clock(!1);this.playAnimation=!0;/* default animation update rate, rate is 1000 and duration
907
- is default to 6000, 6s to finish a full animation */var playRate=1e3,preRenderCallbackFunctions=[],preRenderCallbackFunctions_id=0,postRenderCallbackFunctions=[],postRenderCallbackFunctions_id=0,animated_id=void 0,cameraOrtho=void 0,sceneOrtho=void 0,logoSprite=void 0,sceneMap=[],additionalActiveScenes=[],scenesGroup=new THREE.Group,canvas=void 0,sensor=void 0,isRendering=!1,_this=this,currentSize=[0,0],currentOffset=[0,0];this.getDrawingWidth=()=>{if(container)return container.clientWidth;return canvas?"undefined"==typeof canvas.clientWidth?Math.round(canvas.width):Math.round(canvas.clientWidth):0},this.getDrawingHeight=()=>{if(container)return container.clientHeight;return canvas?"undefined"==typeof canvas.clientHeight?Math.round(canvas.height):Math.round(canvas.clientHeight):0},this.onWindowResize=()=>{currentScene.onWindowResize();var width=this.getDrawingWidth(),height=this.getDrawingHeight();if(renderer!=null){var localRect;container?(localRect=container.getBoundingClientRect(),renderer.setSize(width,height)):canvas&&("undefined"==typeof canvas.getBoundingClientRect?renderer.setSize(width,height,!1):(localRect=canvas.getBoundingClientRect(),canvas.width=width,canvas.height=height,renderer.setSize(width,height,!1))),localRect&&(currentOffset[0]=localRect.left,currentOffset[1]=localRect.top);var target=new THREE.Vector2;renderer.getSize(target),currentSize[0]=target.x,currentSize[1]=target.y}},this.initialiseVisualisation=parameters=>{if(parameters=parameters||{},void 0===parameters.antialias){var onMobile=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(onMobile=!0)}catch(err){onMobile=!1}parameters.antialias=!onMobile}parameters.canvas&&(container=void 0,canvas=parameters.canvas),renderer=new THREE.WebGLRenderer(parameters),void 0!==container&&container.appendChild(renderer.domElement),renderer.setClearColor(16777215,1),canvas&&canvas.style&&(canvas.style.height="100%",canvas.style.width="100%"),renderer.autoClear=!1;var scene=this.createScene("default");this.setCurrentScene(scene)},this.getCurrentScene=()=>currentScene,this.setCurrentScene=sceneIn=>{if(sceneIn){this.removeActiveScene(sceneIn);var oldScene=currentScene;currentScene=sceneIn,oldScene&&oldScene.setInteractiveControlEnable(!1),currentScene.setInteractiveControlEnable(!0),currentScene.setAdditionalScenesGroup(scenesGroup),this.onWindowResize()}},this.getSceneByName=name=>sceneMap[name],this.createScene=name=>{if(null==sceneMap[name]){var new_scene;return new_scene=canvas?new(__webpack_require__(30).Scene)(canvas,renderer):new(__webpack_require__(30).Scene)(container,renderer),sceneMap[name]=new_scene,new_scene.sceneName=name,new_scene}};this.resetView=()=>{currentScene.resetView()},this.viewAll=()=>{if(currentScene){var boundingBox=currentScene.getBoundingBox();if(boundingBox){for(i=0;i<additionalActiveScenes.length;i++){var boundingBox2=additionalActiveScenes[i].getBoundingBox();boundingBox2&&boundingBox.union(boundingBox2)}currentScene.viewAllWithBoundingBox(boundingBox)}}},this.loadModelsURL=(urls,colours,opacities,timeEnabled,morphColour,finishCallback)=>{currentScene.loadModelsURL(urls,colours,opacities,timeEnabled,morphColour,finishCallback)};this.loadViewURL=url=>{currentScene.loadViewURL(url)},this.loadFromViewURL=(jsonFilePrefix,finishCallback)=>{currentScene.loadFromViewURL(jsonFilePrefix,finishCallback)},this.updateDirectionalLight=()=>{currentScene.updateDirectionalLight()};var runAnimation=()=>{isRendering?(animated_id=requestAnimationFrame(runAnimation),this.render()):(cancelAnimationFrame(animated_id),animated_id=void 0)};/**
933
+ is default to 6000, 6s to finish a full animation */var playRate=1e3,preRenderCallbackFunctions=[],preRenderCallbackFunctions_id=0,postRenderCallbackFunctions=[],postRenderCallbackFunctions_id=0,animated_id=void 0,cameraOrtho=void 0,sceneOrtho=void 0,logoSprite=void 0,sceneMap=[],additionalActiveScenes=[],scenesGroup=new THREE.Group,canvas=void 0,sensor=void 0,isRendering=!1,_this=this,currentSize=[0,0],currentOffset=[0,0];this.getDrawingWidth=()=>{if(container)return container.clientWidth;return canvas?"undefined"==typeof canvas.clientWidth?Math.round(canvas.width):Math.round(canvas.clientWidth):0},this.getDrawingHeight=()=>{if(container)return container.clientHeight;return canvas?"undefined"==typeof canvas.clientHeight?Math.round(canvas.height):Math.round(canvas.clientHeight):0},this.onWindowResize=()=>{currentScene.onWindowResize();var width=this.getDrawingWidth(),height=this.getDrawingHeight();if(renderer!=null){var localRect;container?(localRect=container.getBoundingClientRect(),renderer.setSize(width,height)):canvas&&("undefined"==typeof canvas.getBoundingClientRect?renderer.setSize(width,height,!1):(localRect=canvas.getBoundingClientRect(),canvas.width=width,canvas.height=height,renderer.setSize(width,height,!1))),localRect&&(currentOffset[0]=localRect.left,currentOffset[1]=localRect.top);var target=new THREE.Vector2;renderer.getSize(target),currentSize[0]=target.x,currentSize[1]=target.y}},this.initialiseVisualisation=parameters=>{if(parameters=parameters||{},void 0===parameters.antialias){var onMobile=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(onMobile=!0)}catch(err){onMobile=!1}parameters.antialias=!onMobile}parameters.canvas&&(container=void 0,canvas=parameters.canvas),renderer=new THREE.WebGLRenderer(parameters),void 0!==container&&container.appendChild(renderer.domElement),renderer.setClearColor(16777215,1),canvas&&canvas.style&&(canvas.style.height="100%",canvas.style.width="100%"),renderer.autoClear=!1;var scene=this.createScene("default");this.setCurrentScene(scene)},this.getCurrentScene=()=>currentScene,this.setCurrentScene=sceneIn=>{if(sceneIn){this.removeActiveScene(sceneIn);var oldScene=currentScene;currentScene=sceneIn,oldScene&&oldScene.setInteractiveControlEnable(!1),currentScene.setInteractiveControlEnable(!0),currentScene.setAdditionalScenesGroup(scenesGroup),this.onWindowResize()}},this.getSceneByName=name=>sceneMap[name],this.createScene=name=>{if(null==sceneMap[name]){var new_scene;return new_scene=canvas?new(__webpack_require__(30).Scene)(canvas,renderer):new(__webpack_require__(30).Scene)(container,renderer),sceneMap[name]=new_scene,new_scene.sceneName=name,new_scene}};this.resetView=()=>{currentScene.resetView()},this.viewAll=()=>{if(currentScene){var boundingBox=currentScene.getBoundingBox();if(boundingBox){for(var boundingBox2,i=0;i<additionalActiveScenes.length;i++)boundingBox2=additionalActiveScenes[i].getBoundingBox(),boundingBox2&&boundingBox.union(boundingBox2);currentScene.viewAllWithBoundingBox(boundingBox)}}},this.loadModelsURL=(urls,colours,opacities,timeEnabled,morphColour,finishCallback)=>{currentScene.loadModelsURL(urls,colours,opacities,timeEnabled,morphColour,finishCallback)};this.loadViewURL=url=>{currentScene.loadViewURL(url)},this.loadFromViewURL=(jsonFilePrefix,finishCallback)=>{currentScene.loadFromViewURL(jsonFilePrefix,finishCallback)},this.updateDirectionalLight=()=>{currentScene.updateDirectionalLight()};var runAnimation=()=>{isRendering?(animated_id=requestAnimationFrame(runAnimation),this.render()):(cancelAnimationFrame(animated_id),animated_id=void 0)};/**
908
934
  * Stop the animation and renderer to get into the render loop.
909
935
  */this.stopAnimate=()=>{isRendering&&(clock.stop(),isRendering=!1)},this.animate=()=>{isRendering||(clock.start(),isRendering=!0,runAnimation())};Date.now();/**
910
936
  * Add a callback function which will be called everytime before the renderer renders its scene.
@@ -939,7 +965,7 @@ var THREE=__webpack_require__(3),ResizeSensor=__webpack_require__(29);/**
939
965
  * @param {Zinc.Scene} endingScene - Viewport of this scene will be used as the destination.
940
966
  * @param {Number} duration - Amount of time to transition from current viewport to the
941
967
  * endingScene's viewport.
942
- */this.addLogo=()=>{logoSprite=new THREE.Sprite;THREE.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png",void 0,createHUDSprites(logoSprite))},this.render=()=>{sensor||(container?0<container.clientWidth&&0<container.clientHeight&&(sensor=new ResizeSensor(container,this.onWindowResize)):canvas&&0<canvas.width&&0<canvas.height&&(sensor=new ResizeSensor(canvas,this.onWindowResize)));var delta=clock.getDelta();for(currentScene.renderGeometries(playRate,delta,this.playAnimation),i=0;i<additionalActiveScenes.length;i++){var sceneItem=additionalActiveScenes[i];sceneItem.renderGeometries(playRate,delta,this.playAnimation)}for(key in null!=cameraOrtho&&null!=sceneOrtho&&(renderer.clearDepth(),renderer.render(sceneOrtho,cameraOrtho)),preRenderCallbackFunctions)preRenderCallbackFunctions.hasOwnProperty(key)&&preRenderCallbackFunctions[key].call();for(key in currentScene.render(renderer),postRenderCallbackFunctions)postRenderCallbackFunctions.hasOwnProperty(key)&&postRenderCallbackFunctions[key].call()},this.getThreeJSRenderer=()=>renderer,this.isSceneActive=sceneIn=>{if(currentScene===sceneIn)return!0;for(i=0;i<additionalActiveScenes.length;i++){var sceneItem=additionalActiveScenes[i];if(sceneItem===sceneIn)return!0}return!1},this.addActiveScene=additionalScene=>{this.isSceneActive(additionalScene)||(additionalActiveScenes.push(additionalScene),scenesGroup.add(additionalScene.getThreeJSScene()))},this.removeActiveScene=additionalScene=>{for(i=0;i<additionalActiveScenes.length;i++){var sceneItem=additionalActiveScenes[i];if(sceneItem===additionalScene)return additionalActiveScenes.splice(i,1),void scenesGroup.remove(additionalScene.getThreeJSScene())}},this.clearAllActiveScene=()=>{for(var _i=0;_i<additionalActiveScenes.length;_i++)scenesGroup.remove(additionalActiveScenes[_i].getThreeJSScene());additionalActiveScenes.splice(0,additionalActiveScenes.length)},this.dispose=()=>{for(var _key in isRendering&&cancelAnimationFrame(animated_id),sceneMap)sceneMap.hasOwnProperty(_key)&&sceneMap[_key].clearAll();sceneMap=[],additionalActiveScenes=[],scenesGroup=new THREE.Group,this.stopAnimate(),preRenderCallbackFunctions=[],preRenderCallbackFunctions_id=0,cameraOrtho=void 0,sceneOrtho=void 0,logoSprite=void 0;var scene=this.createScene("default");this.setCurrentScene(scene),sensor=void 0},this.transitionScene=(endingScene,duration)=>{if(currentScene){var currentCamera=currentScene.getZincCameraControls(),boundingBox=endingScene.getBoundingBox();if(boundingBox){var radius=boundingBox.min.distanceTo(boundingBox.max)/2,centreX=(boundingBox.min.x+boundingBox.max.x)/2,centreY=(boundingBox.min.y+boundingBox.max.y)/2,centreZ=(boundingBox.min.z+boundingBox.max.z)/2,endingViewport=currentCamera.getViewportFromCentreAndRadius(centreX,centreY,centreZ,radius,40,radius*4),startingViewport=currentCamera.getCurrentViewport();currentCamera.cameraTransition(startingViewport,endingViewport,duration),currentCamera.enableCameraTransition()}}},this.isWebGL2=()=>!!renderer&&renderer.capabilities.isWebGL2};
968
+ */this.addLogo=()=>{logoSprite=new THREE.Sprite;THREE.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png",void 0,createHUDSprites(logoSprite))},this.render=()=>{sensor||(container?0<container.clientWidth&&0<container.clientHeight&&(sensor=new ResizeSensor(container,this.onWindowResize)):canvas&&0<canvas.width&&0<canvas.height&&(sensor=new ResizeSensor(canvas,this.onWindowResize)));var delta=clock.getDelta();currentScene.renderGeometries(playRate,delta,this.playAnimation);for(var sceneItem,i=0;i<additionalActiveScenes.length;i++)sceneItem=additionalActiveScenes[i],sceneItem.renderGeometries(playRate,delta,this.playAnimation);for(var key in null!=cameraOrtho&&null!=sceneOrtho&&(renderer.clearDepth(),renderer.render(sceneOrtho,cameraOrtho)),preRenderCallbackFunctions)preRenderCallbackFunctions.hasOwnProperty(key)&&preRenderCallbackFunctions[key].call();for(var _key in currentScene.render(renderer),postRenderCallbackFunctions)postRenderCallbackFunctions.hasOwnProperty(_key)&&postRenderCallbackFunctions[_key].call()},this.getThreeJSRenderer=()=>renderer,this.isSceneActive=sceneIn=>{if(currentScene===sceneIn)return!0;for(var sceneItem,i=0;i<additionalActiveScenes.length;i++)if(sceneItem=additionalActiveScenes[i],sceneItem===sceneIn)return!0;return!1},this.addActiveScene=additionalScene=>{this.isSceneActive(additionalScene)||(additionalActiveScenes.push(additionalScene),scenesGroup.add(additionalScene.getThreeJSScene()))},this.removeActiveScene=additionalScene=>{for(var sceneItem,i=0;i<additionalActiveScenes.length;i++)if(sceneItem=additionalActiveScenes[i],sceneItem===additionalScene)return additionalActiveScenes.splice(i,1),void scenesGroup.remove(additionalScene.getThreeJSScene())},this.clearAllActiveScene=()=>{for(var i=0;i<additionalActiveScenes.length;i++)scenesGroup.remove(additionalActiveScenes[i].getThreeJSScene());additionalActiveScenes.splice(0,additionalActiveScenes.length)},this.dispose=()=>{for(var key in isRendering&&cancelAnimationFrame(animated_id),sceneMap)sceneMap.hasOwnProperty(key)&&sceneMap[key].clearAll();sceneMap=[],additionalActiveScenes=[],scenesGroup=new THREE.Group,this.stopAnimate(),preRenderCallbackFunctions=[],preRenderCallbackFunctions_id=0,cameraOrtho=void 0,sceneOrtho=void 0,logoSprite=void 0;var scene=this.createScene("default");this.setCurrentScene(scene),sensor=void 0},this.transitionScene=(endingScene,duration)=>{if(currentScene){var currentCamera=currentScene.getZincCameraControls(),boundingBox=endingScene.getBoundingBox();if(boundingBox){var radius=boundingBox.min.distanceTo(boundingBox.max)/2,centreX=(boundingBox.min.x+boundingBox.max.x)/2,centreY=(boundingBox.min.y+boundingBox.max.y)/2,centreZ=(boundingBox.min.z+boundingBox.max.z)/2,endingViewport=currentCamera.getViewportFromCentreAndRadius(centreX,centreY,centreZ,radius,40,radius*4),startingViewport=currentCamera.getCurrentViewport();currentCamera.cameraTransition(startingViewport,endingViewport,duration),currentCamera.enableCameraTransition()}}},this.isWebGL2=()=>!!renderer&&renderer.capabilities.isWebGL2};
943
969
 
944
970
  /***/ }),
945
971
  /* 29 */
@@ -992,7 +1018,7 @@ var convertDurationObjectToString=duration=>[...(duration.years?["".concat(durat
992
1018
  /* 31 */
993
1019
  /***/ (function(module, exports, __webpack_require__) {
994
1020
 
995
- var THREE=__webpack_require__(3),resolveURL=__webpack_require__(6).resolveURL,STLLoader=__webpack_require__(32).STLLoader,OBJLoader=__webpack_require__(33).OBJLoader,PrimitivesLoader=__webpack_require__(34).PrimitivesLoader,createNewURL=(target,reference)=>{var newURL=new URL(target,reference).href;//Make sure the target url does not contain parameters
1021
+ var THREE=__webpack_require__(3),resolveURL=__webpack_require__(4).resolveURL,STLLoader=__webpack_require__(32).STLLoader,OBJLoader=__webpack_require__(33).OBJLoader,PrimitivesLoader=__webpack_require__(34).PrimitivesLoader,createNewURL=(target,reference)=>{var newURL=new URL(target,reference).href;//Make sure the target url does not contain parameters
996
1022
  if(target&&2>target.split("?").length){var paramsStrings=reference.split("?");//There are parameters, add them to the target
997
1023
  2===paramsStrings.length&&(newURL=newURL+"?"+paramsStrings[1])}return newURL};/**
998
1024
  * A helper class to help with reading / importing primitives and
@@ -1002,11 +1028,11 @@ if(target&&2>target.split("?").length){var paramsStrings=reference.split("?");//
1002
1028
  * @param {Object} containerIn - Container to create the renderer on.
1003
1029
  * @author Alan Wu
1004
1030
  * @return {SceneLoader}
1005
- */exports.SceneLoader=function(sceneIn){var scene=sceneIn;this.toBeDownloaded=0,this.progressMap=[];var viewLoaded=!1,errorDownload=!1,primitivesLoader=new PrimitivesLoader;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=>()=>{--this.toBeDownloaded,errorDownload=!0,finishCallback&&finishCallback()};var loadMultipleViews=(referenceURL,views)=>{var defaultView=views.Default;if(views.Inline)scene.setupMultipleViews(defaultView,views.Entries);else{var promises=[],_loop=function(key,value){referenceURL&&(newURL=createNewURL(value,referenceURL),promises.push(new Promise((resolve,reject)=>{// Add parameters if we are sent them
1031
+ */exports.SceneLoader=function(sceneIn){var scene=sceneIn;this.toBeDownloaded=0,this.progressMap={};var viewLoaded=!1,errorDownload=!1,primitivesLoader=new PrimitivesLoader;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=>()=>{--this.toBeDownloaded,errorDownload=!0,finishCallback&&finishCallback()};var loadMultipleViews=(referenceURL,views)=>{var defaultView=views.Default;if(views.Inline)scene.setupMultipleViews(defaultView,views.Entries);else{var promises=[],_loop=function(key,value){referenceURL&&(newURL=createNewURL(value,referenceURL),promises.push(new Promise((resolve,reject)=>{// Add parameters if we are sent them
1006
1032
  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,value);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})}};/**
1007
1033
  * Load the viewport from an external location provided by the url.
1008
1034
  * @param {String} URL - address to the file containing viewport information.
1009
- */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()},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,finishCallback),this.onProgress(_i),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=[],_i2=0;_i2<viewData.numberOfResources;_i2++)filename=jsonFilePrefix+"_"+(_i2+1)+".json",urls.push(filename);this.loadModelsURL(targetRegion,urls,viewData.colour,viewData.opacity,viewData.timeEnabled,viewData.morphColour,finishCallback)}},requestURL=resolveURL(jsonFilePrefix+"_view.json"),xmlhttp.open("GET",requestURL,!0),xmlhttp.send()};//Internal loader for a regular zinc geometry.
1035
+ */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,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=[],i=0;i<viewData.numberOfResources;i++)filename=jsonFilePrefix+"_"+(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.
1010
1036
  var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback)=>(geometry,materials)=>{var newLines=new(__webpack_require__(20).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={};options.localTimeEnabled=localTimeEnabled,options.localMorphColour=localMorphColour,newLines&&(newLines.createLineSegment(geometry,material,options),newLines.setName(groupName),newLines.anatomicalId=anatomicalId,newLines.setRenderOrder=renderOrder,region.addZincObject(newLines),newLines.setDuration(scene.getDuration())),--this.toBeDownloaded,geometry.dispose(),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newLines)};/**
1011
1037
  * Load lines into this scene object.
1012
1038
  *
@@ -1017,9 +1043,9 @@ var linesloader=(region,localTimeEnabled,localMorphColour,groupName,anatomicalId
1017
1043
  * @param {STRING} groupName - name to assign the pointset's groupname to.
1018
1044
  * @param {Function} finishCallback - Callback function which will be called
1019
1045
  * once the glyphset is succssfully load in.
1020
- */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,finishCallback)(object.geometry,object.materials)}else primitivesLoader.load(url,linesloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback),this.onProgress(i),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__(13).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__(17).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),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.
1046
+ */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,finishCallback)(object.geometry,object.materials)}else primitivesLoader.load(url,linesloader(region,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,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__(13).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__(17).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),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.
1021
1047
  this.loadSTL=(region,url,groupName,finishCallback)=>{this.toBeDownloaded+=1;var colour=__webpack_require__(0).defaultMaterialColor,opacity=__webpack_require__(0).defaultOpacity,loader=new STLLoader;loader.crossOrigin="Anonymous",loader.load(resolveURL(url),meshloader(region,colour,opacity,!1,!1,groupName,void 0,void 0,finishCallback))},this.loadOBJ=(region,url,groupName,finishCallback)=>{this.toBeDownloaded+=1;var colour=__webpack_require__(0).defaultMaterialColor,opacity=__webpack_require__(0).defaultOpacity,loader=new OBJLoader;loader.crossOrigin="Anonymous",loader.load(resolveURL(url),meshloader(region,colour,opacity,!1,!1,groupName,void 0,void 0,finishCallback))};//Loader for the OBJ format,
1022
- var objloader=(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,finishCallback)=>object=>{this.toBeDownloaded--,object.traverse(child=>{if(child instanceof THREE.Mesh){var zincGeometry=addMeshToZincGeometry(child,localTimeEnabled,localMorphColour);region.addZincObject(zincGeometry),zincGeometry.morph&&(zincGeometry.morph.name=groupName),zincGeometry.groupName=groupName,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(zincGeometry)}})},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(i),this.onError);if(isInline){var object=primitivesLoader.parse(url);meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback)(object.geometry,object.materials)}else loader.crossOrigin="Anonymous",primitivesLoader.load(url,meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback),this.onProgress(i),this.onError(finishCallback))},metaFinishCallback=function(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())}};/**
1048
+ var objloader=(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,finishCallback)=>object=>{this.toBeDownloaded--,object.traverse(child=>{if(child instanceof THREE.Mesh){var zincGeometry=addMeshToZincGeometry(child,localTimeEnabled,localMorphColour);region.addZincObject(zincGeometry),zincGeometry.morph&&(zincGeometry.morph.name=groupName),zincGeometry.groupName=groupName,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(zincGeometry)}})},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,finishCallback)(object.geometry,object.materials)}else loader.crossOrigin="Anonymous",primitivesLoader.load(url,meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,finishCallback),this.onProgress(url),this.onError(finishCallback))},metaFinishCallback=function(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())}};/**
1023
1049
  * Load a geometry into this scene, this is a subsequent called from
1024
1050
  * {@link Zinc.Scene#loadMetadataURL}, although it can be used to read
1025
1051
  * in geometry into the scene externally.
@@ -1031,15 +1057,27 @@ var objloader=(region,colour,opacity,localTimeEnabled,localMorphColour,groupName
1031
1057
  * @param {STRING} fileFormat - name supported formats are STL, OBJ and JSON.
1032
1058
  * @param {Function} finishCallback - Callback function which will be called
1033
1059
  * once the geometry is succssfully loaded in.
1034
- */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(i),this.onError(finishCallback))},this.loadGlyphsetURL=(region,metaurl,glyphurl,groupName,finishCallback,options)=>{var isInline=!!(options&&options.isInline)&&options.isInline;if(isInline)loadGlyphset(region,metaurl,glyphurl,groupName,finishCallback,options);else{var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=onLoadGlyphsetReady(region,xmlhttp,glyphurl,groupName,finishCallback,options),xmlhttp.open("GET",resolveURL(metaurl),!0),xmlhttp.send()}},addZincGeometry=(region,geometryIn,colour,opacity,localTimeEnabled,localMorphColour,finishCallback,materialIn,groupName)=>{var newGeometry=new(__webpack_require__(2).Geometry);return newGeometry.createMesh(geometryIn,materialIn,{colour:colour,opacity:opacity,localTimeEnabled:localTimeEnabled,localMorphColour:localMorphColour}),newGeometry.morph?(newGeometry.setName(groupName),region&&region.addZincObject(newGeometry),newGeometry.setDuration(scene.getDuration()),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newGeometry),newGeometry.videoHandler&&scene.setVideoHandler(newGeometry.videoHandler),newGeometry):void 0};//Internal loader for a regular zinc geometry.
1035
- var meshloader=(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,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);zincGeometry.anatomicalId=anatomicalId,zincGeometry.setRenderOrder(renderOrder),--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}};//Turn ISO 8601 duration string into an array.
1060
+ */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))},this.loadGlyphsetURL=(region,metaurl,glyphurl,groupName,finishCallback,options)=>{var isInline=!!(options&&options.isInline)&&options.isInline;if(isInline)loadGlyphset(region,metaurl,glyphurl,groupName,finishCallback,options);else{var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=onLoadGlyphsetReady(region,xmlhttp,glyphurl,groupName,finishCallback,options),xmlhttp.open("GET",resolveURL(metaurl),!0),xmlhttp.send()}};/**
1061
+ * Add a user provided {THREE.Geometry} into the scene as zinc geometry.
1062
+ *
1063
+ * @param {Three.Geometry} geometry - The threejs geometry to be added as {@link Zinc.Geometry}.
1064
+ * @param {THREE.Color} color - Colour to be assigned to this geometry, overrided if materialIn is provided.
1065
+ * @param {Number} opacity - Opacity to be set for this geometry, overrided if materialIn is provided.
1066
+ * @param {Boolean} localTimeEnabled - Set this to true if morph geometry is present, overrided if materialIn is provided.
1067
+ * @param {Boolean} localMorphColour - Set this to true if morph colour is present, overrided if materialIn is provided.
1068
+ * @param {Boolean} external - Set this to true if morph geometry is present, overrided if materialIn is provided.
1069
+ * @param {Function} finishCallback - Callback once the geometry has been added succssfully.
1070
+ * @param {THREE.Material} materialIn - Material to be set for this geometry if it is present.
1071
+ *
1072
+ * @returns {Zinc.Geometry}
1073
+ */var addZincGeometry=(region,geometryIn,colour,opacity,localTimeEnabled,localMorphColour,finishCallback,materialIn,groupName)=>{var newGeometry=new(__webpack_require__(2).Geometry);return newGeometry.createMesh(geometryIn,materialIn,{colour:colour,opacity:opacity,localTimeEnabled:localTimeEnabled,localMorphColour:localMorphColour}),newGeometry.morph?(newGeometry.setName(groupName),region&&region.addZincObject(newGeometry),newGeometry.setDuration(scene.getDuration()),null!=finishCallback&&"function"==typeof finishCallback&&finishCallback(newGeometry),newGeometry.videoHandler&&scene.setVideoHandler(newGeometry.videoHandler),newGeometry):void 0},meshloader=(region,colour,opacity,localTimeEnabled,localMorphColour,groupName,anatomicalId,renderOrder,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);zincGeometry.anatomicalId=anatomicalId,zincGeometry.setRenderOrder(renderOrder),--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.
1036
1074
  this.loadSettings=item=>{if(item){//duration uses the ISO 8601 standard - PnYnMnDTnHnMnS
1037
1075
  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
1038
1076
  //settings.
1039
1077
  var readPrimitivesItem=(region,referenceURL,item,order,finishCallback)=>{if(item){var _newURL=void 0,isInline=!1;item.URL?(_newURL=item.URL,referenceURL&&(_newURL=createNewURL(item.URL,referenceURL))):item.Inline&&(_newURL=item.Inline.URL,isInline=!0);var groupName=item.GroupName;(groupName===void 0||""===groupName)&&(groupName="_Unnamed");var options={isInline:isInline,fileFormat:item.FileFormat,anatomicalId:item.AnatomicalId,compression:item.compression,renderOrder:order};switch(item.Type){case"Surfaces":loadSurfaceURL(region,_newURL,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,_newURL,newGeometryURL,groupName,finishCallback,options);break;case"Points":this.loadPointsetURL(region,_newURL,item.MorphVertices,item.MorphColours,groupName,finishCallback,options);break;case"Lines":this.loadLinesURL(region,_newURL,item.MorphVertices,item.MorphColours,groupName,finishCallback,options);break;default:}}},readViewAndSettingsItem=(referenceURL,item,finishCallback)=>{if(item){var _newURL2=void 0,isInline=!1;switch(item.URL?(_newURL2=item.URL,referenceURL&&(_newURL2=createNewURL(item.URL,referenceURL))):item.Inline&&(_newURL2=item.Inline.URL,isInline=!0),item.Type){case"View":isInline?(scene.setupMultipleViews("default",{default:_newURL2}),viewLoaded=!0,null!=finishCallback&&"function"==typeof finishCallback&&finishCallback()):this.loadViewURL(_newURL2,finishCallback);break;case"Settings":this.loadSettings(item);break;default:}}};//Function to read the view item first
1040
- this.loadGLTF=(region,url,finishCallback,options)=>{var GLTFToZincJSLoader=new(__webpack_require__(35).GLTFToZincJSLoader);GLTFToZincJSLoader.load(scene,region,url,finishCallback,options)};var loadRegions=(currentRegion,referenceURL,regions,callback)=>{if(regions.Primitives&&regions.Primitives.forEach(primitive=>{var order=1;primitive.Order&&(order=primitive.Order),readPrimitivesItem(currentRegion,referenceURL,primitive,order,callback)}),regions.Transformation&&currentRegion.setTransformation(regions.Transformation),regions.Children)for(var[regionName,value]of Object.entries(regions.Children)){var childRegion=currentRegion.findOrCreateChildFromPath(regionName);childRegion&&loadRegions(childRegion,referenceURL,value,callback)}},getNumberOfDownloadsInArray=(array,includeViews)=>{if(Array.isArray(array)){for(var count=0,_i3=0;_i3<array.length;_i3++)array[_i3].Type&&(includeViews&&"View"===array[_i3].Type||"Surfaces"===array[_i3].Type||"Glyph"===array[_i3].Type||"Points"===array[_i3].Type||"Lines"===array[_i3].Type)&&count++;return count}return 0},getNumberOfObjectsInRegions=regionJson=>{var counts=regionJson.Primitives?getNumberOfDownloadsInArray(regionJson.Primitives,!1):0;return regionJson.Children&&Object.values(regionJson.Children).forEach(childRegion=>{counts+=getNumberOfObjectsInRegions(childRegion)}),counts},getNumberOfObjects=metadata=>{if(Array.isArray(metadata))return getNumberOfDownloadsInArray(metadata,!0);return"object"==typeof metadata&&null!==metadata&&"2.0"===metadata.Version?getNumberOfObjectsInRegions(metadata.Regions):void 0},readVersionOneRegionPath=(region,referenceURL,item,order,callback)=>{var targetRegion=region;//Render order is set to i * 2 to account for front and back rendering
1078
+ this.loadGLTF=(region,url,finishCallback,options)=>{var GLTFToZincJSLoader=new(__webpack_require__(35).GLTFToZincJSLoader);GLTFToZincJSLoader.load(scene,region,url,finishCallback,options)};var loadRegions=(currentRegion,referenceURL,regions,callback)=>{if(regions.Primitives&&regions.Primitives.forEach(primitive=>{var order=1;primitive.Order&&(order=primitive.Order),readPrimitivesItem(currentRegion,referenceURL,primitive,order,callback)}),regions.Transformation&&currentRegion.setTransformation(regions.Transformation),regions.Children)for(var[regionName,value]of Object.entries(regions.Children)){var childRegion=currentRegion.findOrCreateChildFromPath(regionName);childRegion&&loadRegions(childRegion,referenceURL,value,callback)}},getNumberOfDownloadsInArray=(array,includeViews)=>{if(Array.isArray(array)){for(var count=0,i=0;i<array.length;i++)array[i].Type&&(includeViews&&"View"===array[i].Type||"Surfaces"===array[i].Type||"Glyph"===array[i].Type||"Points"===array[i].Type||"Lines"===array[i].Type)&&count++;return count}return 0},getNumberOfObjectsInRegions=regionJson=>{var counts=regionJson.Primitives?getNumberOfDownloadsInArray(regionJson.Primitives,!1):0;return regionJson.Children&&Object.values(regionJson.Children).forEach(childRegion=>{counts+=getNumberOfObjectsInRegions(childRegion)}),counts},getNumberOfObjects=metadata=>{if(Array.isArray(metadata))return getNumberOfDownloadsInArray(metadata,!0);return"object"==typeof metadata&&null!==metadata&&"2.0"===metadata.Version?getNumberOfObjectsInRegions(metadata.Regions):void 0},readVersionOneRegionPath=(region,referenceURL,item,order,callback)=>{var targetRegion=region;//Render order is set to i * 2 to account for front and back rendering
1041
1079
  item.RegionPath&&""!==item.RegionPath&&(targetRegion=region.findOrCreateChildFromPath(item.RegionPath)),readPrimitivesItem(targetRegion,referenceURL,item,2*order,callback)},loadVersionOne=(targetRegion,metadata,referenceURL,finishCallback,allCompletedCallback)=>{// Prioritise the view file and settings before loading anything else
1042
- for(var numberOfObjects=getNumberOfObjects(metadata),callback=new metaFinishCallback(numberOfObjects,finishCallback,allCompletedCallback),_i4=0;_i4<metadata.length;_i4++)readViewAndSettingsItem(referenceURL,metadata[_i4],callback);for(var _i5=0;_i5<metadata.length;_i5++)readVersionOneRegionPath(targetRegion,referenceURL,metadata[_i5],_i5,callback)},loadVersionTwo=(targetRegion,metadata,referenceURL,finishCallback,allCompletedCallback)=>{var numberOfObjects=getNumberOfObjects(metadata),callback=new metaFinishCallback(numberOfObjects,finishCallback,allCompletedCallback);// view file does not receive callback
1080
+ for(var numberOfObjects=getNumberOfObjects(metadata),callback=new metaFinishCallback(numberOfObjects,finishCallback,allCompletedCallback),i=0;i<metadata.length;i++)readViewAndSettingsItem(referenceURL,metadata[i],callback);for(var _i=0;_i<metadata.length;_i++)readVersionOneRegionPath(targetRegion,referenceURL,metadata[_i],_i,callback)},loadVersionTwo=(targetRegion,metadata,referenceURL,finishCallback,allCompletedCallback)=>{var numberOfObjects=getNumberOfObjects(metadata),callback=new metaFinishCallback(numberOfObjects,finishCallback,allCompletedCallback);// view file does not receive callback
1043
1081
  metadata.Settings&&this.loadSettings(metadata.Settings),metadata.Views&&loadMultipleViews(referenceURL,metadata.Views,referenceURL),metadata.Regions&&loadRegions(targetRegion,referenceURL,metadata.Regions,callback)};/**
1044
1082
  * Load a metadata file from the provided URL into this scene. Once
1045
1083
  * succssful scene proceeds to read each items into scene for visualisations.
@@ -1460,15 +1498,15 @@ for(var keyframeIndex,_j3=0;_j3<sourceTrack.times.length;_j3++)keyframeIndex=thi
1460
1498
  /* 39 */
1461
1499
  /***/ (function(module, exports, __webpack_require__) {
1462
1500
 
1463
- var THREE=__webpack_require__(3),resolveURL=__webpack_require__(6).resolveURL,Viewport=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];var _this=this;this.setFromObject=(_ref)=>{var{nearPlane,farPlane,eyePosition,targetPosition,upVector}=_ref;_this.nearPlane=nearPlane,_this.farPlane=farPlane,_this.eyePosition=eyePosition,_this.targetPosition=targetPosition,_this.upVector=upVector}},CameraControls=function(object,domElement,renderer,scene){var MODE={NONE:-1,DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,ROTATE_TRANSITION:4,MINIMAP:5,SYNC_CONTROL:6},STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,SCROLL:6},ROTATE_DIRECTION={NONE:-1,FREE:1,HORIZONTAL:2,VERTICAL:3},CLICK_ACTION={};/**
1501
+ var THREE=__webpack_require__(3),resolveURL=__webpack_require__(4).resolveURL,Viewport=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];var _this=this;this.setFromObject=(_ref)=>{var{nearPlane,farPlane,eyePosition,targetPosition,upVector}=_ref;_this.nearPlane=nearPlane,_this.farPlane=farPlane,_this.eyePosition=eyePosition,_this.targetPosition=targetPosition,_this.upVector=upVector}},CameraControls=function(object,domElement,renderer,scene){var MODE={NONE:-1,DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,ROTATE_TRANSITION:4,MINIMAP:5,SYNC_CONTROL:6},STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,SCROLL:6},ROTATE_DIRECTION={NONE:-1,FREE:1,HORIZONTAL:2,VERTICAL:3},CLICK_ACTION={};/**
1464
1502
  * Actions states.
1465
1503
  * Available states are NONE, ROTATE, ZOOM, PAN, TOUCH_ROTATE, TOUCH_ZOOM, TOUCH_PAN and SCROLL.
1466
1504
  * @property {Object}
1467
- */CLICK_ACTION.MAIN=STATE.ROTATE,CLICK_ACTION.AUXILIARY=STATE.ZOOM,CLICK_ACTION.SECONDARY=STATE.PAN,this.cameraObject=object,this.domElement=domElement===void 0?document:domElement,this.renderer=renderer,this.scene=scene,this.tumble_rate=1.5,this.pointer_x=0,this.pointer_y=0,this.pointer_x_start=0,this.pointer_y_start=0,this.previous_pointer_x=0,this.previous_pointer_y=0,this.near_plane_fly_debt=0,this.touchZoomDistanceStart=0,this.touchZoomDistanceEnd=0,this.directionalLight=0,this.scrollRate=50;var duration=6e3,inbuildTime=0,cameraPath=void 0,numberOfCameraPoint=void 0,updateLightWithPathFlag=!1,playRate=500,deviceOrientationControl=void 0,defaultViewport="default",currentMode=MODE.DEFAULT,smoothCameraTransitionObject=void 0,rotateCameraTransitionObject=void 0,cameraAutoTumbleObject=void 0,mouseScroll=0,rotateMode=ROTATE_DIRECTION.FREE;this._state=STATE.NONE;var zincRayCaster;this.targetTouchId=-1;var rect=void 0,_a=new THREE.Vector3,_b=new THREE.Vector3,_c=new THREE.Vector3,_new_b=new THREE.Vector3,_new_c=new THREE.Vector3,_axis=new THREE.Vector3,_v=new THREE.Vector3,_rel_eye=new THREE.Vector3,sceneSphere=new THREE.Sphere,_tempEye=new THREE.Vector3,ndcControl=void 0,maxDist=0,viewports={default:new Viewport};viewports.default.nearPlane=.1,viewports.default.farPlane=2e3,viewports.default.eyePosition=[0,0,0],viewports.default.targetPosition=[0,0,-1],viewports.default.upVector=[0,1,0],this.cameraObject.target===void 0&&(this.cameraObject.target=new THREE.Vector3(...viewports.default.targetPosition)),this.calculateMaxAllowedDistance=scene=>{var box=scene.getBoundingBox();if(box){box.getBoundingSphere(sceneSphere),maxDist=6*sceneSphere.radius;var currentDist=0;this.cameraObject&&(currentDist=this.cameraObject.position.distanceTo(sceneSphere.center)),maxDist=currentDist>maxDist?currentDist:maxDist}else maxDist=0},this.addViewport=(viewportName,viewport)=>{viewportName&&viewport&&(viewports[viewportName]=viewport)},this.setDefaultViewport=defaultName=>!!(defaultName&&defaultName in viewports)&&(defaultViewport=defaultName,!0),this.getDefaultViewport=()=>defaultViewport,this.getViewportOfName=name=>viewports[name],this.setCurrentViewport=name=>!!(name in viewports)&&(this.setCurrentCameraSettings(viewports[name]),!0),this.setRotationMode=mode=>{switch(mode){case"none":rotateMode=ROTATE_DIRECTION.NONE;break;case"horizontal":rotateMode=ROTATE_DIRECTION.HORIZONTAL;break;case"vertical":rotateMode=ROTATE_DIRECTION.VERTICAL;break;case"free":default:rotateMode=ROTATE_DIRECTION.FREE;}},this.onResize=()=>{rect&&(rect=void 0),ndcControl&&ndcControl.setCurrentCameraSettings(this.cameraObject,viewports[defaultViewport])},this.getNDCFromDocumentCoords=(x,y,positionIn)=>{updateRect(!1);var position=positionIn?positionIn:new THREE.Vector2,out_x=2*((x-rect.left)/rect.width)-1,out_y=2*-((y-rect.top)/rect.height)+1;return position.set(out_x,out_y)},this.getRelativeCoordsFromNDC=(x,y,positionIn)=>{updateRect(!1);var position=positionIn?positionIn:new THREE.Vector2;return position.x=(x+1)*rect.width/2,position.y=(1-y)*rect.height/2,position},this.setMouseButtonAction=(buttonName,actionName)=>{CLICK_ACTION[buttonName]=STATE[actionName]};//Make sure the camera does not travel beyond limit
1505
+ */CLICK_ACTION.MAIN=STATE.ROTATE,CLICK_ACTION.AUXILIARY=STATE.ZOOM,CLICK_ACTION.SECONDARY=STATE.PAN,this.cameraObject=object,this.domElement=domElement===void 0?document:domElement,this.renderer=renderer,this.scene=scene,this.tumble_rate=1.5,this.pointer_x=0,this.pointer_y=0,this.pointer_x_start=0,this.pointer_y_start=0,this.previous_pointer_x=0,this.previous_pointer_y=0,this.near_plane_fly_debt=0,this.touchZoomDistanceStart=0,this.touchZoomDistanceEnd=0,this.directionalLight=0,this.scrollRate=50;var duration=6e3,enabled=!0,inbuildTime=0,cameraPath=void 0,numberOfCameraPoint=void 0,updateLightWithPathFlag=!1,playRate=500,deviceOrientationControl=void 0,defaultViewport="default",currentMode=MODE.DEFAULT,smoothCameraTransitionObject=void 0,rotateCameraTransitionObject=void 0,cameraAutoTumbleObject=void 0,mouseScroll=0,rotateMode=ROTATE_DIRECTION.FREE;this._state=STATE.NONE;var zincRayCaster;this.targetTouchId=-1;var rect=void 0,_a=new THREE.Vector3,_b=new THREE.Vector3,_c=new THREE.Vector3,_new_b=new THREE.Vector3,_new_c=new THREE.Vector3,_axis=new THREE.Vector3,_v=new THREE.Vector3,_rel_eye=new THREE.Vector3,sceneSphere=new THREE.Sphere,_tempEye=new THREE.Vector3,ndcControl=void 0,maxDist=0,viewports={default:new Viewport};viewports.default.nearPlane=.1,viewports.default.farPlane=2e3,viewports.default.eyePosition=[0,0,0],viewports.default.targetPosition=[0,0,-1],viewports.default.upVector=[0,1,0],this.cameraObject.target===void 0&&(this.cameraObject.target=new THREE.Vector3(...viewports.default.targetPosition)),this.calculateMaxAllowedDistance=scene=>{var box=scene.getBoundingBox();if(box){box.getBoundingSphere(sceneSphere),maxDist=6*sceneSphere.radius;var currentDist=0;this.cameraObject&&(currentDist=this.cameraObject.position.distanceTo(sceneSphere.center)),maxDist=currentDist>maxDist?currentDist:maxDist}else maxDist=0},this.addViewport=(viewportName,viewport)=>{viewportName&&viewport&&(viewports[viewportName]=viewport)},this.setDefaultViewport=defaultName=>!!(defaultName&&defaultName in viewports)&&(defaultViewport=defaultName,!0),this.getDefaultViewport=()=>defaultViewport,this.getViewportOfName=name=>viewports[name],this.setCurrentViewport=name=>!!(name in viewports)&&(this.setCurrentCameraSettings(viewports[name]),!0),this.setRotationMode=mode=>{switch(mode){case"none":rotateMode=ROTATE_DIRECTION.NONE;break;case"horizontal":rotateMode=ROTATE_DIRECTION.HORIZONTAL;break;case"vertical":rotateMode=ROTATE_DIRECTION.VERTICAL;break;case"free":default:rotateMode=ROTATE_DIRECTION.FREE;}},this.onResize=()=>{rect&&(rect=void 0),ndcControl&&ndcControl.setCurrentCameraSettings(this.cameraObject,viewports[defaultViewport])},this.getNDCFromDocumentCoords=(x,y,positionIn)=>{updateRect(!1);var position=positionIn?positionIn:new THREE.Vector2,out_x=2*((x-rect.left)/rect.width)-1,out_y=2*-((y-rect.top)/rect.height)+1;return position.set(out_x,out_y)},this.getRelativeCoordsFromNDC=(x,y,positionIn)=>{updateRect(!1);var position=positionIn?positionIn:new THREE.Vector2;return position.x=(x+1)*rect.width/2,position.y=(1-y)*rect.height/2,position},this.setMouseButtonAction=(buttonName,actionName)=>{CLICK_ACTION[buttonName]=STATE[actionName]};//Make sure the camera does not travel beyond limit
1468
1506
  var checkTravelDistance=()=>{if(0<maxDist){var newDist=_tempEye.distanceTo(sceneSphere.center);return maxDist>newDist||this.cameraObject.position.distanceTo(sceneSphere.center)>newDist}return!0},translateViewport=translation=>{_tempEye.copy(this.cameraObject.position).add(translation),checkTravelDistance()&&(this.cameraObject.target.add(translation),this.cameraObject.position.add(translation),this.updateDirectionalLight())},onDocumentMouseDown=event=>{updateRect(!1);// Check if mouse event hapens inside the minimap
1469
1507
  var minimapCoordinates;if(currentMode===MODE.DEFAULT&&(minimapCoordinates=this.scene.getNormalisedMinimapCoordinates(this.renderer,event)),!minimapCoordinates)0==event.button?event.ctrlKey?this._state=CLICK_ACTION.AUXILIARY:event.shiftKey?this._state=CLICK_ACTION.SECONDARY:this._state=CLICK_ACTION.MAIN:1==event.button?(event.preventDefault(),this._state=CLICK_ACTION.AUXILIARY):2==event.button&&(this._state=CLICK_ACTION.SECONDARY),this.pointer_x=event.clientX-rect.left,this.pointer_y=event.clientY-rect.top,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y;else{currentMode=MODE.MINIMAP;var translation=this.scene.getMinimapDiffFromNormalised(minimapCoordinates.x,minimapCoordinates.y);translateViewport(translation)}},onDocumentMouseMove=event=>{if(updateRect(!1),this.pointer_x=event.clientX-rect.left,this.pointer_y=event.clientY-rect.top,currentMode===MODE.MINIMAP){var minimapCoordinates=this.scene.getNormalisedMinimapCoordinates(this.renderer,event);if(minimapCoordinates){var translation=this.scene.getMinimapDiffFromNormalised(minimapCoordinates.x,minimapCoordinates.y);translateViewport(translation)}}else this._state===STATE.NONE&&void 0!==zincRayCaster&&zincRayCaster.move(this,event.clientX,event.clientY,this.renderer)},onDocumentMouseUp=event=>{this._state=STATE.NONE,currentMode==MODE.MINIMAP&&(currentMode=MODE.DEFAULT),zincRayCaster!==void 0&&this.pointer_x_start==event.clientX-rect.left&&this.pointer_y_start==event.clientY-rect.top&&zincRayCaster.pick(this,event.clientX,event.clientY,this.renderer)},onDocumentMouseLeave=()=>{this._state=STATE.NONE},onDocumentTouchStart=event=>{updateRect(!1);var len=event.touches.length;if(1==len)this._state=STATE.TOUCH_ROTATE,this.pointer_x=event.touches[0].clientX-rect.left,this.pointer_y=event.touches[0].clientY-rect.top,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y;else if(2==len){this._state=STATE.TOUCH_ZOOM;var dx=event.touches[0].clientX-event.touches[1].clientX,dy=event.touches[0].clientY-event.touches[1].clientY;this.touchZoomDistanceEnd=this.touchZoomDistanceStart=Math.sqrt(dx*dx+dy*dy)}else 3==len&&(this._state=STATE.TOUCH_PAN,this.targetTouchId=event.touches[0].identifier,this.pointer_x=event.touches[0].clientX-rect.left,this.pointer_y=event.touches[0].clientY-rect.top,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y)},onDocumentTouchMove=event=>{event.preventDefault(),event.stopPropagation();var len=event.touches.length;if(1==len)this.pointer_x=event.touches[0].clientX-rect.left,this.pointer_y=event.touches[0].clientY-rect.top;else if(2==len){if(this._state===STATE.TOUCH_ZOOM){var dx=event.touches[0].clientX-event.touches[1].clientX,dy=event.touches[0].clientY-event.touches[1].clientY;this.touchZoomDistanceEnd=Math.sqrt(dx*dx+dy*dy)}}else if(3==len&&this._state===STATE.TOUCH_PAN)for(var i=0;3>i;i++)event.touches[i].identifier==this.targetTouchId&&(this.pointer_x=event.touches[0].clientX-rect.left,this.pointer_y=event.touches[0].clientY-rect.top)},onDocumentTouchEnd=event=>{var len=event.touches.length;this.touchZoomDistanceStart=this.touchZoomDistanceEnd=0,this.targetTouchId=-1,this._state=STATE.NONE,1==len&&zincRayCaster!==void 0&&this.pointer_x_start==event.touches[0].clientX-rect.left&&this.pointer_y_start==event.touches[0].clientY-rect.top&&zincRayCaster.pick(this.cameraObject,event.touches[0].clientX,event.touches[0].clientY,this.renderer)},onDocumentEnter=()=>{updateRect(!0)},updateRect=forced=>{//Use intersectionObserver to reset the rect for ray tracing.
1470
1508
  if(forced||rect===void 0){var observer=new IntersectionObserver(entries=>{for(var entry of entries)rect=entry.boundingClientRect;observer.disconnect()});observer.observe(this.domElement)}},onDocumentWheelEvent=event=>{updateRect(!1),this._state=STATE.SCROLL;var changes=0;0<event.deltaY?changes=this.scrollRate:0>event.deltaY&&(changes=-1*this.scrollRate),mouseScroll+=changes,event.preventDefault(),event.stopImmediatePropagation()},translate=()=>{if("undefined"!=typeof this.cameraObject){var height=rect.height,distance=this.cameraObject.position.distanceTo(this.cameraObject.target),fact=0;this.cameraObject.far>this.cameraObject.near&&distance>=this.cameraObject.near&&distance<=this.cameraObject.far&&(fact=(distance-this.cameraObject.near)/(this.cameraObject.far-this.cameraObject.near)),_b.set(this.previous_pointer_x,height-this.previous_pointer_y,0),_c.set(this.previous_pointer_x,height-this.previous_pointer_y,1),_new_b.set(this.pointer_x,height-this.pointer_y,0),_new_c.set(this.pointer_x,height-this.pointer_y,1),_b.unproject(this.cameraObject),_c.unproject(this.cameraObject),_new_b.unproject(this.cameraObject),_new_c.unproject(this.cameraObject);_new_b.sub(_b).multiplyScalar(1-fact),_new_c.sub(_c).multiplyScalar(fact),_new_b.add(_new_c).multiplyScalar(-.002),translateViewport(_new_b)}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y};this.getVectorsFromRotateAboutLookAtPoints=(axis,angle)=>{axis.normalize(),_v.copy(this.cameraObject.position).sub(this.cameraObject.target),_rel_eye.copy(_v),_v.normalize(),.8<Math.abs(_v.dot(axis))&&_v.copy(this.cameraObject.up),_b.crossVectors(axis,_v).normalize(),_c.crossVectors(axis,_b);var rel_eyea=axis.dot(_rel_eye),rel_eyeb=_b.dot(_rel_eye),rel_eyec=_c.dot(_rel_eye),upa=axis.dot(this.cameraObject.up),upb=_b.dot(this.cameraObject.up),upc=_c.dot(this.cameraObject.up),cos_angle=Math.cos(angle),sin_angle=Math.sin(angle);return _new_b.set(cos_angle*_b.x+sin_angle*_c.x,cos_angle*_b.y+sin_angle*_c.y,cos_angle*_b.z+sin_angle*_c.z),_new_c.set(cos_angle*_c.x-sin_angle*_b.x,cos_angle*_c.y-sin_angle*_b.y,cos_angle*_c.z-sin_angle*_b.z),_v.copy(this.cameraObject.target),_v.x=_v.x+axis.x*rel_eyea+_new_b.x*rel_eyeb+_new_c.x*rel_eyec,_v.y=_v.y+axis.y*rel_eyea+_new_b.y*rel_eyeb+_new_c.y*rel_eyec,_v.z=_v.z+axis.z*rel_eyea+_new_b.z*rel_eyeb+_new_c.z*rel_eyec,_a.set(axis.x*upa+_new_b.x*upb+_new_c.x*upc,axis.y*upa+_new_b.y*upb+_new_c.y*upc,axis.z*upa+_new_b.z*upb+_new_c.z*upc),{position:_v,up:_a}},this.rotateAboutLookAtpoint=(axis,angle)=>{var returned_values=this.getVectorsFromRotateAboutLookAtPoints(axis,angle);this.cameraObject.position.copy(returned_values.position),this.updateDirectionalLight(),this.cameraObject.up.copy(returned_values.up)};var tumble=()=>{if("undefined"!=typeof this.cameraObject){var width=rect.width,height=rect.height;if(0<width&&0<height){var radius=.25*(width+height),delta_x=0,delta_y=0;(rotateMode===ROTATE_DIRECTION.FREE||rotateMode===ROTATE_DIRECTION.HORIZONTAL)&&(delta_x=this.pointer_x-this.previous_pointer_x),(rotateMode===ROTATE_DIRECTION.FREE||rotateMode===ROTATE_DIRECTION.VERTICAL)&&(delta_y=this.previous_pointer_y-this.pointer_y);var tangent_dist=Math.sqrt(delta_x*delta_x+delta_y*delta_y);if(0<tangent_dist){var dx=1*-delta_y/tangent_dist,dy=1*delta_x/tangent_dist;// Do not allow rotation on other direction around the origin if rotateMode is not free
1471
- if(rotateMode===ROTATE_DIRECTION.FREE){var _d=dx*(this.pointer_x-.5*(width-1))+dy*(.5*(height-1)-this.pointer_y);_d>radius?_d=radius:_d<-radius&&(_d=-radius)}var phi=Math.acos(0/radius)-.5*Math.PI,angle=this.tumble_rate*tangent_dist/radius;_a.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(),_b.copy(this.cameraObject.up).normalize(),_c.copy(_b).cross(_a).normalize().multiplyScalar(dx),_b.multiplyScalar(dy),_axis.addVectors(_c,_b).multiplyScalar(Math.cos(phi)),_a.multiplyScalar(Math.sin(phi)),_axis.add(_a),this.rotateAboutLookAtpoint(_axis,-angle)}}}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},calculateZoomDelta=()=>{var delta=0;return this._state===STATE.ZOOM?delta=this.previous_pointer_y-this.pointer_y:this._state===STATE.SCROLL?delta=mouseScroll:(delta=-1*(this.touchZoomDistanceEnd-this.touchZoomDistanceStart),this.touchZoomDistanceStart=this.touchZoomDistanceEnd),delta};this.changeZoomByScrollRateUnit=unit=>{var delta_y=unit*this.scrollRate;this.changeZoomByValue(delta_y)},this.changeZoomByValue=delta_y=>{if("undefined"!=typeof this.cameraObject){var width=rect.width,height=rect.height,a=this.cameraObject.position.clone();a.sub(this.cameraObject.target);var dist=a.length(),dy=1.5*delta_y/height;if(.01<dist+dy*dist&&(a.normalize(),_tempEye.copy(this.cameraObject.position),_tempEye.x+=a.x*dy*dist,_tempEye.y+=a.y*dy*dist,_tempEye.z+=a.z*dy*dist,checkTravelDistance())){this.cameraObject.position.copy(_tempEye),this.updateDirectionalLight();var near_far_minimum_ratio=1e-5;if(near_far_minimum_ratio*this.cameraObject.far<this.cameraObject.near+dy*dist+this.near_plane_fly_debt)0!=this.near_plane_fly_debt&&(this.near_plane_fly_debt+=dy*dist,0<this.near_plane_fly_debt?(this.cameraObject.near+=this.near_plane_fly_debt,this.cameraObject.far+=this.near_plane_fly_debt,this.near_plane_fly_debt=0):(this.cameraObject.near+=dy*dist,this.cameraObject.far+=dy*dist));else{if(0==this.near_plane_fly_debt){var diff=this.cameraObject.near-near_far_minimum_ratio*this.cameraObject.far;this.cameraObject.near=near_far_minimum_ratio*this.cameraObject.far,this.cameraObject.far-=diff,this.near_plane_fly_debt-=near_far_minimum_ratio*this.cameraObject.far}this.near_plane_fly_debt+=dy*dist}}}};var flyZoom=()=>{var delta_y=calculateZoomDelta();this.changeZoomByValue(delta_y),this._state===STATE.ZOOM&&(this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y),this._state===STATE.SCROLL&&(mouseScroll=0,this._state=STATE.NONE)};this.setDirectionalLight=directionalLightIn=>{this.directionalLight=directionalLightIn},this.updateDirectionalLight=()=>{0!=this.directionalLight&&this.directionalLight.position.set(this.cameraObject.position.x,this.cameraObject.position.y,this.cameraObject.position.z)},this.enable=function(){enabled=!0,this.domElement&&this.domElement.addEventListener&&(this.domElement.addEventListener("mousedown",onDocumentMouseDown,!1),this.domElement.addEventListener("mousemove",onDocumentMouseMove,!1),this.domElement.addEventListener("mouseup",onDocumentMouseUp,!1),this.domElement.addEventListener("mouseleave",onDocumentMouseLeave,!1),this.domElement.addEventListener("touchstart",onDocumentTouchStart,!1),this.domElement.addEventListener("touchmove",onDocumentTouchMove,!1),this.domElement.addEventListener("touchend",onDocumentTouchEnd,!1),this.domElement.addEventListener("wheel",onDocumentWheelEvent,!1),this.domElement.addEventListener("contextmenu",event=>{event.preventDefault()},!1),this.domElement.addEventListener("mouseenter",onDocumentEnter,!1))},this.disable=function(){enabled=!1,this.domElement&&this.domElement.removeEventListener&&(this.domElement.removeEventListener("mousedown",onDocumentMouseDown,!1),this.domElement.removeEventListener("mousemove",onDocumentMouseMove,!1),this.domElement.removeEventListener("mouseup",onDocumentMouseUp,!1),this.domElement.removeEventListener("mouseleave",onDocumentMouseLeave,!1),this.domElement.removeEventListener("touchstart",onDocumentTouchStart,!1),this.domElement.removeEventListener("touchmove",onDocumentTouchMove,!1),this.domElement.removeEventListener("touchend",onDocumentTouchEnd,!1),this.domElement.removeEventListener("wheel",onDocumentWheelEvent,!1),this.domElement.removeEventListener("mouseenter",onDocumentEnter,!1),this.domElement.removeEventListener("contextmenu",event=>{event.preventDefault()},!1))},this.loadPath=pathData=>{cameraPath=pathData.CameraPath,numberOfCameraPoint=pathData.NumberOfPoints},this.loadPathURL=(path_url,finishCallback)=>{var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){var pathData=JSON.parse(xmlhttp.responseText);this.loadPath(pathData),finishCallback!=null&&"function"==typeof finishCallback&&finishCallback()}},requestURL=resolveURL(path_url),xmlhttp.open("GET",requestURL,!0),xmlhttp.send()},this.setPathDuration=durationIn=>{duration=durationIn,smoothCameraTransitionObject&&smoothCameraTransitionObject.setDuration(duration),rotateCameraTransitionObject&&rotateCameraTransitionObject.setDuration(duration)},this.getPlayRate=()=>playRate,this.setPlayRate=playRateIn=>{playRate=playRateIn};/**
1509
+ if(rotateMode===ROTATE_DIRECTION.FREE){var _d=dx*(this.pointer_x-.5*(width-1))+dy*(.5*(height-1)-this.pointer_y);_d>radius?_d=radius:_d<-radius&&(_d=-radius)}var phi=Math.acos(0/radius)-.5*Math.PI,angle=this.tumble_rate*tangent_dist/radius;_a.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(),_b.copy(this.cameraObject.up).normalize(),_c.copy(_b).cross(_a).normalize().multiplyScalar(dx),_b.multiplyScalar(dy),_axis.addVectors(_c,_b).multiplyScalar(Math.cos(phi)),_a.multiplyScalar(Math.sin(phi)),_axis.add(_a),this.rotateAboutLookAtpoint(_axis,-angle)}}}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},calculateZoomDelta=()=>{var delta=0;return this._state===STATE.ZOOM?delta=this.previous_pointer_y-this.pointer_y:this._state===STATE.SCROLL?delta=mouseScroll:(delta=-1*(this.touchZoomDistanceEnd-this.touchZoomDistanceStart),this.touchZoomDistanceStart=this.touchZoomDistanceEnd),delta};this.changeZoomByScrollRateUnit=unit=>{var delta_y=unit*this.scrollRate;this.changeZoomByValue(delta_y)},this.changeZoomByValue=delta_y=>{if("undefined"!=typeof this.cameraObject){var width=rect.width,height=rect.height,a=this.cameraObject.position.clone();a.sub(this.cameraObject.target);var dist=a.length(),dy=1.5*delta_y/height;if(.01<dist+dy*dist&&(a.normalize(),_tempEye.copy(this.cameraObject.position),_tempEye.x+=a.x*dy*dist,_tempEye.y+=a.y*dy*dist,_tempEye.z+=a.z*dy*dist,checkTravelDistance())){this.cameraObject.position.copy(_tempEye),this.updateDirectionalLight();var near_far_minimum_ratio=1e-5;if(near_far_minimum_ratio*this.cameraObject.far<this.cameraObject.near+dy*dist+this.near_plane_fly_debt)0!=this.near_plane_fly_debt&&(this.near_plane_fly_debt+=dy*dist,0<this.near_plane_fly_debt?(this.cameraObject.near+=this.near_plane_fly_debt,this.cameraObject.far+=this.near_plane_fly_debt,this.near_plane_fly_debt=0):(this.cameraObject.near+=dy*dist,this.cameraObject.far+=dy*dist));else{if(0==this.near_plane_fly_debt){var diff=this.cameraObject.near-near_far_minimum_ratio*this.cameraObject.far;this.cameraObject.near=near_far_minimum_ratio*this.cameraObject.far,this.cameraObject.far-=diff,this.near_plane_fly_debt-=near_far_minimum_ratio*this.cameraObject.far}this.near_plane_fly_debt+=dy*dist}}}};var flyZoom=()=>{var delta_y=calculateZoomDelta();this.changeZoomByValue(delta_y),this._state===STATE.ZOOM&&(this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y),this._state===STATE.SCROLL&&(mouseScroll=0,this._state=STATE.NONE)};this.setDirectionalLight=directionalLightIn=>{this.directionalLight=directionalLightIn},this.updateDirectionalLight=()=>{0!=this.directionalLight&&this.directionalLight.position.set(this.cameraObject.position.x,this.cameraObject.position.y,this.cameraObject.position.z)},this.enable=function(){enabled=!0,this.domElement&&this.domElement.addEventListener&&(this.domElement.addEventListener("mousedown",onDocumentMouseDown,!1),this.domElement.addEventListener("mousemove",onDocumentMouseMove,!1),this.domElement.addEventListener("mouseup",onDocumentMouseUp,!1),this.domElement.addEventListener("mouseleave",onDocumentMouseLeave,!1),this.domElement.addEventListener("touchstart",onDocumentTouchStart,!1),this.domElement.addEventListener("touchmove",onDocumentTouchMove,!1),this.domElement.addEventListener("touchend",onDocumentTouchEnd,!1),this.domElement.addEventListener("wheel",onDocumentWheelEvent,!1),this.domElement.addEventListener("contextmenu",event=>{event.preventDefault()},!1),this.domElement.addEventListener("mouseenter",onDocumentEnter,!1))},this.disable=function(){enabled=!1,this.domElement&&this.domElement.removeEventListener&&(this.domElement.removeEventListener("mousedown",onDocumentMouseDown,!1),this.domElement.removeEventListener("mousemove",onDocumentMouseMove,!1),this.domElement.removeEventListener("mouseup",onDocumentMouseUp,!1),this.domElement.removeEventListener("mouseleave",onDocumentMouseLeave,!1),this.domElement.removeEventListener("touchstart",onDocumentTouchStart,!1),this.domElement.removeEventListener("touchmove",onDocumentTouchMove,!1),this.domElement.removeEventListener("touchend",onDocumentTouchEnd,!1),this.domElement.removeEventListener("wheel",onDocumentWheelEvent,!1),this.domElement.removeEventListener("mouseenter",onDocumentEnter,!1),this.domElement.removeEventListener("contextmenu",event=>{event.preventDefault()},!1))},this.loadPath=pathData=>{cameraPath=pathData.CameraPath,numberOfCameraPoint=pathData.NumberOfPoints},this.loadPathURL=(path_url,finishCallback)=>{var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=()=>{if(4==xmlhttp.readyState&&200==xmlhttp.status){var pathData=JSON.parse(xmlhttp.responseText);this.loadPath(pathData),finishCallback!=null&&"function"==typeof finishCallback&&finishCallback()}};var requestURL=resolveURL(path_url);xmlhttp.open("GET",requestURL,!0),xmlhttp.send()},this.setPathDuration=durationIn=>{duration=durationIn,smoothCameraTransitionObject&&smoothCameraTransitionObject.setDuration(duration),rotateCameraTransitionObject&&rotateCameraTransitionObject.setDuration(duration)},this.getPlayRate=()=>playRate,this.setPlayRate=playRateIn=>{playRate=playRateIn};/**
1472
1510
  * Update the internal timer by the set amount, this can
1473
1511
  * be used to force a time update by setting delta to zero.
1474
1512
  *
@@ -1601,7 +1639,7 @@ var handleSyncControl=()=>{this._state===STATE.ROTATE||this._state===STATE.TOUCH
1601
1639
  * Disable syncControl.
1602
1640
  */this.update=timeChanged=>{var delta=timeChanged*playRate,controlEnabled=enabled;currentMode===MODE.PATH?updatePath(delta):currentMode===MODE.SMOOTH_CAMERA_TRANSITION&&smoothCameraTransitionObject?(smoothCameraTransitionObject.update(delta),smoothCameraTransitionObject.isTransitionCompleted()&&(smoothCameraTransitionObject==null,currentMode=MODE.DEFAULT),controlEnabled=!1):currentMode===MODE.ROTATE_CAMERA_TRANSITION&&rotateCameraTransitionObject?(rotateCameraTransitionObject.update(delta),rotateCameraTransitionObject.isTransitionCompleted()&&(rotateCameraTransitionObject==null,currentMode=MODE.DEFAULT),controlEnabled=!1):currentMode===MODE.AUTO_TUMBLE&&cameraAutoTumbleObject?cameraAutoTumbleObject.update(delta):currentMode===MODE.SYNC_CONTROL&&ndcControl&&(handleSyncControl(),controlEnabled=!1),controlEnabled&&(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&&currentMode===MODE.AUTO_TUMBLE&&cameraAutoTumbleObject&&cameraAutoTumbleObject.stopOnCameraInput,this._state===STATE.SCROLL&&(this._state=STATE.NONE)),deviceOrientationControl?deviceOrientationControl.update():this.cameraObject.lookAt(this.cameraObject.target)},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 eye_distance=radius/Math.tan(view_angle*Math.PI/360),localEyePosition=[centreX+eyex*eye_distance,centreY+eyey*eye_distance,centreZ+eyez*eye_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=eye_distance+clip_distance,newViewport.eyePosition=localEyePosition,newViewport.targetPosition=[centreX,centreY,centreZ],newViewport.upVector=[this.cameraObject.up.x,this.cameraObject.up.y,this.cameraObject.up.z],newViewport},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(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,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(axisIn,angleIn,targetCameraIn,durationIn){var duration=durationIn,inbuildTime=0,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;targetCameraIn.rotateAboutLookAtpoint(axisIn,ratio*angleIn)};this.update=delta=>{!1===this.enabled||(updateCameraSettings(delta),inbuildTime==duration&&(completed=!0))},this.isTransitionCompleted=()=>completed},RayCaster=function(sceneIn,hostSceneIn,callbackFunctionIn,hoverCallbackFunctionIn,rendererIn){var scene=sceneIn,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};this.enable=()=>{enable=!0},this.disable=()=>{enable=!1};var getIntersectsObject=(zincCamera,x,y)=>{if(zincCamera.getNDCFromDocumentCoords(x,y,mouse),hostSceneIn!==scene){var threejsScene=scene.getThreeJSScene();renderer.render(threejsScene,zincCamera.cameraObject)}raycaster.setFromCamera(mouse,zincCamera.cameraObject);var objects=scene.getPickableThreeJSObjects();//Reset pickedObjects array
1603
1641
  return pickedObjects.length=0,raycaster.intersectObjects(objects,!0,pickedObjects)};this.pick=(zincCamera,x,y)=>{enabled&&renderer&&scene&&zincCamera&&callbackFunction&&(getIntersectsObject(zincCamera,x,y),callbackFunction(pickedObjects,x,y))};var hovered=(zincCamera,x,y)=>{if(enabled&&renderer&&scene&&zincCamera&&hoverCallbackFunction){if(getIntersectsObject(zincCamera,x,y),lastHoveredDate.setTime(Date.now()),0===pickedObjects.length){//skip hovered callback if the previous one is empty
1604
- 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(tumbleDirectionIn,tumbleRateIn,stopOnCameraInputIn,targetCameraIn){var tumbleAxis=new THREE.Vector3,targetCamera=targetCameraIn;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(tumbleDirectionIn),this.requireUpdate=!1),targetCamera.rotateAboutLookAtpoint(tumbleAxis,-tumbleRateIn*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},Object.assign(StereoCameraZoomFixed.prototype,{update:(()=>{var focus,fov,aspect,near,far,zoom,eyeRight=new THREE.Matrix4,eyeLeft=new THREE.Matrix4;return function(camera){var needsUpdate=focus!==camera.focus||fov!==camera.fov||aspect!==camera.aspect*this.aspect||near!==camera.near||far!==camera.far||zoom!==camera.zoom;if(needsUpdate){focus=camera.focus,fov=camera.fov,aspect=camera.aspect*this.aspect,near=camera.near,far=camera.far,zoom=camera.zoom;// Off-axis stereoscopic effect based on
1642
+ 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(tumbleDirectionIn,tumbleRateIn,stopOnCameraInputIn,targetCameraIn){var tumbleAxis=new THREE.Vector3,targetCamera=targetCameraIn;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(tumbleDirectionIn),this.requireUpdate=!1),targetCamera.rotateAboutLookAtpoint(tumbleAxis,-tumbleRateIn*delta/1e3))}},StereoCameraZoomFixed=function(){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};Object.assign(StereoCameraZoomFixed.prototype,{update:(()=>{var focus,fov,aspect,near,far,zoom,eyeRight=new THREE.Matrix4,eyeLeft=new THREE.Matrix4;return function(camera){var needsUpdate=focus!==camera.focus||fov!==camera.fov||aspect!==camera.aspect*this.aspect||near!==camera.near||far!==camera.far||zoom!==camera.zoom;if(needsUpdate){focus=camera.focus,fov=camera.fov,aspect=camera.aspect*this.aspect,near=camera.near,far=camera.far,zoom=camera.zoom;// Off-axis stereoscopic effect based on
1605
1643
  // http://paulbourke.net/stereographics/stereorender/
1606
1644
  var xmin,xmax,projectionMatrix=camera.projectionMatrix.clone(),eyeSep=.064/2,eyeSepOnProjection=eyeSep*near/focus,ymax=near*Math.tan(.5*(THREE.Math.DEG2RAD*fov))/camera.zoom;// translate xOffset
1607
1645
  // for left eye
@@ -1611,19 +1649,19 @@ eyeLeft.elements[12]=-eyeSep,eyeRight.elements[12]=eyeSep,xmin=-ymax*aspect+eyeS
1611
1649
  * @authod mrdoob / http://mrdoob.com/
1612
1650
  * @authod arodic / http://aleksandarrodic.com/
1613
1651
  * @authod fonserbc / http://fonserbc.github.io/
1614
- */var StereoEffect=function(renderer){var _stereo=new StereoCameraZoomFixed;_stereo.aspect=.5,this.setSize=(width,height)=>{renderer.setSize(width,height)},this.render=(scene,camera)=>{scene.updateMatrixWorld(),null===camera.parent&&camera.updateMatrixWorld(),_stereo.update(camera);var size=renderer.getSize();renderer.setScissorTest(!0),renderer.clear(),renderer.setScissor(0,0,size.width/2,size.height),renderer.setViewport(0,0,size.width/2,size.height),renderer.render(scene,_stereo.cameraL),renderer.setScissor(size.width/2,0,size.width/2,size.height),renderer.setViewport(size.width/2,0,size.width/2,size.height),renderer.render(scene,_stereo.cameraR),renderer.setScissorTest(!1)}};/**
1615
- * @author richt / http://richt.me
1616
- * @author WestLangley / http://github.com/WestLangley
1617
- *
1618
- * W3C Device Orientation control (http://w3c.github.io/deviceorientation/spec-source-orientation.html)
1619
- */ModifiedDeviceOrientationControls=function ModifiedDeviceOrientationControls(object){var scope=this;this.object=object,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;var onDeviceOrientationChangeEvent=event=>{scope.deviceOrientation=event},onScreenOrientationChangeEvent=()=>{"undefined"!=typeof window&&(scope.screenOrientation=window.orientation||0)},setObjectQuaternion=(()=>{var zee=new THREE.Vector3(0,0,1),euler=new THREE.Euler,q0=new THREE.Quaternion,q1=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));// - PI/2 around the x-axis
1652
+ */var StereoEffect=function(renderer){var _stereo=new StereoCameraZoomFixed;_stereo.aspect=.5,this.setSize=(width,height)=>{renderer.setSize(width,height)},this.render=(scene,camera)=>{scene.updateMatrixWorld(),null===camera.parent&&camera.updateMatrixWorld(),_stereo.update(camera);var size=renderer.getSize();renderer.setScissorTest(!0),renderer.clear(),renderer.setScissor(0,0,size.width/2,size.height),renderer.setViewport(0,0,size.width/2,size.height),renderer.render(scene,_stereo.cameraL),renderer.setScissor(size.width/2,0,size.width/2,size.height),renderer.setViewport(size.width/2,0,size.width/2,size.height),renderer.render(scene,_stereo.cameraR),renderer.setScissorTest(!1)}},ModifiedDeviceOrientationControls=function(object){var scope=this;this.object=object,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;var onDeviceOrientationChangeEvent=event=>{scope.deviceOrientation=event},onScreenOrientationChangeEvent=()=>{"undefined"!=typeof window&&(scope.screenOrientation=window.orientation||0)},setObjectQuaternion=(()=>{var zee=new THREE.Vector3(0,0,1),euler=new THREE.Euler,q0=new THREE.Quaternion,q1=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));// - PI/2 around the x-axis
1620
1653
  return(cameraObject,alpha,beta,gamma,orient)=>{var vector=new THREE.Vector3(0,0,1);vector.subVectors(cameraObject.target,cameraObject.position),euler.set(beta,alpha,-gamma,"YXZ");// 'ZXY' for the device, but 'YXZ' for us
1621
1654
  var quaternion=new THREE.Quaternion;// orient the device
1622
1655
  // camera looks out the back of the device, not the top
1623
1656
  // adjust for screen orientation
1624
1657
  quaternion.setFromEuler(euler),quaternion.multiply(q1),quaternion.multiply(q0.setFromAxisAngle(zee,-orient)),vector.applyQuaternion(quaternion),vector.addVectors(cameraObject.position,vector),cameraObject.lookAt(vector)}})();this.connect=()=>{onScreenOrientationChangeEvent(),"undefined"!=typeof window&&(window.addEventListener("orientationchange",onScreenOrientationChangeEvent,!1),window.addEventListener("deviceorientation",onDeviceOrientationChangeEvent,!1)),scope.enabled=!0},this.disconnect=()=>{"undefined"!=typeof window&&(window.removeEventListener("orientationchange",onScreenOrientationChangeEvent,!1),window.removeEventListener("deviceorientation",onDeviceOrientationChangeEvent,!1)),scope.enabled=!1},this.update=()=>{if(!1!==scope.enabled){var alpha=scope.deviceOrientation.alpha?THREE.Math.degToRad(scope.deviceOrientation.alpha):0,beta=scope.deviceOrientation.beta?THREE.Math.degToRad(scope.deviceOrientation.beta):0,gamma=scope.deviceOrientation.gamma?THREE.Math.degToRad(scope.deviceOrientation.gamma):0,orient=scope.screenOrientation?THREE.Math.degToRad(scope.screenOrientation):0;// Z
1625
- setObjectQuaternion(scope.object,alpha,beta,gamma,orient)}},this.dispose=function(){this.disconnect()},this.connect()};var NDCCameraControl=function(){var camera=void 0,targetCamera=void 0,defaultViewport=void 0,position=new THREE.Vector3,target=new THREE.Vector3,v1=new THREE.Vector3,v2=new THREE.Vector3,eventCallback=void 0;//return top left and size
1626
- this.setCurrentCameraSettings=(cameraIn,defaultViewportIn)=>{camera=cameraIn.clone(),targetCamera=cameraIn,defaultViewport=defaultViewportIn,camera.near=defaultViewport.nearPlane,defaultViewport.farPlane&&(camera.far=defaultViewport.farPlane),defaultViewport.eyePosition&&camera.position.set(defaultViewport.eyePosition[0],defaultViewport.eyePosition[1],defaultViewport.eyePosition[2]),defaultViewport.upVector&&camera.up.set(defaultViewport.upVector[0],defaultViewport.upVector[1],defaultViewport.upVector[2]),defaultViewport.targetPosition&&(camera.target=new THREE.Vector3(defaultViewport.targetPosition[0],defaultViewport.targetPosition[1],defaultViewport.targetPosition[2]),camera.lookAt(camera.target)),camera.updateProjectionMatrix(),position.copy(camera.position).project(camera),target.copy(camera.target).project(camera)},this.getCurrentPosition=()=>(target.copy(targetCamera.target).project(camera),[target.x,target.y]),this.zoom=delta=>{var zoom=Math.max(targetCamera.zoom-.002*delta,1);targetCamera.zoom=zoom,targetCamera.updateProjectionMatrix()},this.zoomToBox=(box,zoom)=>{box.getCenter(v1),v1.project(camera),this.setCenterZoom([v1.x,v1.y],zoom)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:targetCamera.zoom}),this.setCenterZoom=(center,zoom)=>{v1.set(center[0],center[1],target.z).unproject(camera),v2.copy(v1).sub(targetCamera.target),targetCamera.target.copy(v1),targetCamera.lookAt(targetCamera.target),targetCamera.position.add(v2),targetCamera.zoom=zoom,targetCamera.updateProjectionMatrix()},this.setEventCallback=callback=>{(callback===void 0||"function"==typeof callback)&&(eventCallback=callback)},this.triggerCallback=()=>{eventCallback!==void 0&&"function"==typeof eventCallback&&eventCallback()}};exports.Viewport=Viewport,exports.CameraControls=CameraControls,exports.SmoothCameraTransition=SmoothCameraTransition,exports.RotateCameraTransition=RotateCameraTransition,exports.RayCaster=RayCaster,exports.CameraAutoTumble=CameraAutoTumble,exports.StereoEffect=StereoEffect,exports.NDCCameraControl=NDCCameraControl;
1658
+ setObjectQuaternion(scope.object,alpha,beta,gamma,orient)}},this.dispose=function(){this.disconnect()},this.connect()},NDCCameraControl=function(){var camera=void 0,targetCamera=void 0,defaultViewport=void 0,position=new THREE.Vector3,target=new THREE.Vector3,v1=new THREE.Vector3,v2=new THREE.Vector3,eventCallback=void 0;//return top left and size
1659
+ this.setCurrentCameraSettings=(cameraIn,defaultViewportIn)=>{camera=cameraIn.clone(),targetCamera=cameraIn,defaultViewport=defaultViewportIn,camera.near=defaultViewport.nearPlane,defaultViewport.farPlane&&(camera.far=defaultViewport.farPlane),defaultViewport.eyePosition&&camera.position.set(defaultViewport.eyePosition[0],defaultViewport.eyePosition[1],defaultViewport.eyePosition[2]),defaultViewport.upVector&&camera.up.set(defaultViewport.upVector[0],defaultViewport.upVector[1],defaultViewport.upVector[2]),defaultViewport.targetPosition&&(camera.target=new THREE.Vector3(defaultViewport.targetPosition[0],defaultViewport.targetPosition[1],defaultViewport.targetPosition[2]),camera.lookAt(camera.target)),camera.updateProjectionMatrix(),position.copy(camera.position).project(camera),target.copy(camera.target).project(camera)},this.getCurrentPosition=()=>(target.copy(targetCamera.target).project(camera),[target.x,target.y]),this.zoom=delta=>{var zoom=Math.max(targetCamera.zoom-.002*delta,1);targetCamera.zoom=zoom,targetCamera.updateProjectionMatrix()},this.zoomToBox=(box,zoom)=>{box.getCenter(v1),v1.project(camera),this.setCenterZoom([v1.x,v1.y],zoom)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:targetCamera.zoom}),this.setCenterZoom=(center,zoom)=>{v1.set(center[0],center[1],target.z).unproject(camera),v2.copy(v1).sub(targetCamera.target),targetCamera.target.copy(v1),targetCamera.lookAt(targetCamera.target),targetCamera.position.add(v2),targetCamera.zoom=zoom,targetCamera.updateProjectionMatrix()},this.setEventCallback=callback=>{(callback===void 0||"function"==typeof callback)&&(eventCallback=callback)},this.triggerCallback=()=>{eventCallback!==void 0&&"function"==typeof eventCallback&&eventCallback()}};/**
1660
+ * @author richt / http://richt.me
1661
+ * @author WestLangley / http://github.com/WestLangley
1662
+ *
1663
+ * W3C Device Orientation control (http://w3c.github.io/deviceorientation/spec-source-orientation.html)
1664
+ */exports.Viewport=Viewport,exports.CameraControls=CameraControls,exports.SmoothCameraTransition=SmoothCameraTransition,exports.RotateCameraTransition=RotateCameraTransition,exports.RayCaster=RayCaster,exports.CameraAutoTumble=CameraAutoTumble,exports.StereoEffect=StereoEffect,exports.NDCCameraControl=NDCCameraControl;
1627
1665
 
1628
1666
  /***/ }),
1629
1667
  /* 40 */