zincjs 1.15.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/zinc.js CHANGED
@@ -32,7 +32,7 @@ module.exports = require("url-polyfill");
32
32
  /***/ ((module) => {
33
33
 
34
34
  "use strict";
35
- module.exports = /*#__PURE__*/JSON.parse('{"name":"zincjs","version":"1.15.0","description":"ZincJS (Web-based-Zinc-Visualisation)","main":"build/zinc.js","directories":{"doc":"docs"},"files":["package.json","LICENSE","README.md","src/*","build/zinc.js","build/zinc.frontend.js","build/zinc.js.map","webpack.config.js"],"scripts":{"build-bundle":"webpack --config webpack.frontend.js; webpack --config webpack.backend.js","build-backend":"webpack --config webpack.backend.js","test":"npm --prefix ./test install && npm --prefix ./test run test-ci","changelog":"auto-changelog -p --output CHANGELOG.md --template keepachangelog","jsdoc":"jsdoc -c jsdoc_conf.json","version":"npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs","release:beta":"npm version prerelease --preid=beta; npm publish --tag beta","release:minor":"npm version minor; npm publish","release:patch":"npm version patch; npm publish"},"repository":{"type":"git","url":"git+https://github.com/alan-wu/ZincJS.git"},"keywords":["library","webgl","3d","zincjs"],"author":"Alan Wu <alan.wu@auckland.ac.nz>","license":"MIT","bugs":{"url":"https://github.com/alan-wu/ZincJS/issues"},"homepage":"http://alan-wu.github.io/ZincJS/","devDependencies":{"@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","auto-changelog":"^2.4.0","babel-loader":"^9.1.3","babel-preset-minify":"^0.5.1","file-loader":"^6.2.0","jsdoc":"^4.0.2","raw-loader":"^4.0.2","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"dependencies":{"css-element-queries":"^1.2.2","lodash":"^4.17.19","promise-polyfill":"^8.1.3","three":"^0.130.1","three-spritetext":"1.6.2","url-loader":"^4.1.1","url-polyfill":"^1.1.7","webworkify-webpack":"^2.1.5"}}');
35
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"zincjs","version":"1.16.0","description":"ZincJS (Web-based-Zinc-Visualisation)","main":"build/zinc.js","directories":{"doc":"docs"},"files":["package.json","LICENSE","README.md","src/*","build/zinc.js","build/zinc.frontend.js","build/zinc.js.map","webpack.config.js"],"scripts":{"build-bundle":"webpack --config webpack.frontend.js; webpack --config webpack.backend.js","build-backend":"webpack --config webpack.backend.js","test":"npm --prefix ./test install && npm --prefix ./test run test-ci","changelog":"auto-changelog -p --output CHANGELOG.md --template keepachangelog","jsdoc":"jsdoc -c jsdoc_conf.json","version":"npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs","release:beta":"npm version prerelease --preid=beta; npm publish --tag beta","release:minor":"npm version minor; npm publish","release:patch":"npm version patch; npm publish"},"repository":{"type":"git","url":"git+https://github.com/alan-wu/ZincJS.git"},"keywords":["library","webgl","3d","zincjs"],"author":"Alan Wu <alan.wu@auckland.ac.nz>","license":"MIT","bugs":{"url":"https://github.com/alan-wu/ZincJS/issues"},"homepage":"http://alan-wu.github.io/ZincJS/","devDependencies":{"@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","auto-changelog":"^2.4.0","babel-loader":"^9.1.3","babel-preset-minify":"^0.5.1","file-loader":"^6.2.0","jsdoc":"^4.0.2","raw-loader":"^4.0.2","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"dependencies":{"css-element-queries":"^1.2.2","lodash":"^4.17.19","promise-polyfill":"^8.1.3","three":"^0.130.1","three-spritetext":"1.6.2","url-loader":"^4.1.1","url-polyfill":"^1.1.7","webworkify-webpack":"^2.1.5"}}');
36
36
 
37
37
  /***/ }),
38
38
  /* 3 */
@@ -1046,62 +1046,65 @@ var THREE=__webpack_require__(4),resolveURL=(__webpack_require__(5).resolveURL),
1046
1046
  /* 30 */
1047
1047
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1048
1048
 
1049
- var THREE=__webpack_require__(4),ResizeSensor=__webpack_require__(31);/**
1050
- * Create a Zinc 3D renderer in the container provided.
1051
- * The primary function of a Zinc 3D renderer is to display the current
1052
- * scene (@link Scene} set to the renderer and each scene may contain as
1053
- * many geometries, glyphset and other primitives as the system can support.
1054
- * Zinc.Renderer also allows additional scenes to be displayed.
1055
- *
1056
- * @param {Object} containerIn - Container to create the renderer on.
1057
- * @class
1058
- * @author Alan Wu
1059
- * @return {Renderer}
1049
+ var THREE=__webpack_require__(4),ResizeSensor=__webpack_require__(31);/**
1050
+ * Create a Zinc 3D renderer in the container provided.
1051
+ * The primary function of a Zinc 3D renderer is to display the current
1052
+ * scene (@link Scene} set to the renderer and each scene may contain as
1053
+ * many geometries, glyphset and other primitives as the system can support.
1054
+ * Zinc.Renderer also allows additional scenes to be displayed.
1055
+ *
1056
+ * @param {Object} containerIn - Container to create the renderer on.
1057
+ * @class
1058
+ * @author Alan Wu
1059
+ * @return {Renderer}
1060
1060
  */exports.Renderer=function(containerIn){var container=containerIn,renderer=void 0,currentScene=void 0,clock=new THREE.Clock(!1);//myGezincGeometriestains a tuple of the threejs mesh, timeEnabled, morphColour flag, unique id and morph
1061
- this.playAnimation=!0;/* default animation update rate, rate is 1000 and duration
1062
- 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,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__(32).Scene))(canvas,renderer):new((__webpack_require__(32).Scene))(container,renderer),sceneMap[name]=new_scene,new_scene.sceneName=name,new_scene}};/**
1063
- * Reset the viewport of the current scene to its original state.
1064
- */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)};/**
1065
- * Load the viewport from an external location provided by the url. This should be
1066
- * called from {@link Zinc.Scene};
1067
- * @param {String} URL - address to the file containing viewport information.
1068
- * @deprecated
1069
- */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)};/**
1070
- * Stop the animation and renderer to get into the render loop.
1071
- */this.stopAnimate=()=>{isRendering&&(clock.stop(),isRendering=!1)},this.animate=()=>{isRendering||(clock.start(),isRendering=!0,runAnimation())};Date.now();/**
1072
- * Add a callback function which will be called everytime before the renderer renders its scene.
1073
- * @param {Function} callbackFunction - callbackFunction to be added.
1074
- *
1075
- * @return {Number}
1076
- */this.addPreRenderCallbackFunction=callbackFunction=>(++preRenderCallbackFunctions_id,preRenderCallbackFunctions[preRenderCallbackFunctions_id]=callbackFunction,preRenderCallbackFunctions_id),this.removePreRenderCallbackFunction=id=>{id in preRenderCallbackFunctions&&delete preRenderCallbackFunctions[id]},this.addPostRenderCallbackFunction=callbackFunction=>(++postRenderCallbackFunctions_id,postRenderCallbackFunctions[postRenderCallbackFunctions_id]=callbackFunction,postRenderCallbackFunctions_id),this.removePostRenderCallbackFunction=id=>{id in postRenderCallbackFunctions&&delete postRenderCallbackFunctions[id]},this.getPlayRate=()=>playRate,this.setPlayRate=playRateIn=>{playRate=playRateIn},this.getCurrentTime=()=>currentScene.getCurrentTime(),this.setMorphsTime=time=>{currentScene.setMorphsTime(time)},this.getZincGeometryByID=id=>currentScene.getZincGeometryByID(id),this.addToScene=object=>{currentScene.addObject(object)},this.addToOrthoScene=object=>{if(null==sceneOrtho&&(sceneOrtho=new THREE.Scene),null==cameraOrtho){var width=this.getDrawingWidth(),height=this.getDrawingHeight();cameraOrtho=new THREE.OrthographicCamera(-width/2,width/2,height/2,-height/2,1,10),cameraOrtho.position.z=10}sceneOrtho.add(object)};var createHUDSprites=logoSprite=>texture=>{texture.needsUpdate=!0;var material=new THREE.SpriteMaterial({map:texture}),imagewidth=material.map.image.width,imageheight=material.map.image.height;logoSprite.material=material,logoSprite.scale.set(imagewidth,imageheight,1);var width=this.getDrawingWidth(),height=this.getDrawingHeight();logoSprite.position.set((width-imagewidth)/2,(-height+imageheight)/2,1),this.addToOrthoScene(logoSprite)};/**
1077
- * Render the current and all additional scenes. It will first update all geometries and glyphsets
1078
- * in scenes, clear depth buffer and render the ortho scene, call the preRenderCallbackFunctions stack
1079
- * , render the scenes then postRenderCallback.
1080
- */ /**
1081
- * Get the internal {@link Three.Renderer}, to gain access to ThreeJS APIs.
1082
- */ /**
1083
- * Check if a scene is currently active.
1084
- * @param {Zinc.Scene} sceneIn - Scene to check if it is currently
1085
- * rendered.
1086
- */ /**
1087
- * Add additional active scene for rendering, this scene will also be rendered but
1088
- * viewport of the currentScene will be used.
1089
- * @param {Zinc.Scene} additionalScene - Scene to be added to the rendering.
1090
- */ /**
1091
- * Remove a currenrtly active scene from the renderer, this scene will also be rendered but
1092
- * viewport of the currentScene will be used.
1093
- * @param {Zinc.Scene} additionalScene - Scene to be removed from rendering.
1094
- */ /**
1095
- * Clear all additional scenes from rendering except for curentScene.
1096
- */ /**
1097
- * Dispose all memory allocated, this will effetively destroy all scenes.
1098
- */ /**
1099
- * Transition from the current viewport to the endingScene's viewport in the specified duration.
1100
- *
1101
- * @param {Zinc.Scene} endingScene - Viewport of this scene will be used as the destination.
1102
- * @param {Number} duration - Amount of time to transition from current viewport to the
1103
- * endingScene's viewport.
1104
- */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};
1061
+ this.playAnimation=!0;/* default animation update rate, rate is 1000 and duration
1062
+ is default to 6000, 6s to finish a full animation */var playRate=1e3,preRenderCallbackFunctions={},preRenderCallbackFunctions_id=0,postRenderCallbackFunctions={},postRenderCallbackFunctions_id=0,contextLostCallbackFunctions={},contextLostCallbackFunctions_id=0,contextRestoredCallbackFunctions={},contextRestoredCallbackFunctions_id=0,animated_id=void 0,cameraOrtho=void 0,sceneOrtho=void 0,logoSprite=void 0,sceneMap=[],additionalActiveScenes=[],scenesGroup=new THREE.Group,canvas=void 0,sensor=void 0,isRendering=!1,isInitialised=!1,currentSize=[0,0],currentOffset=[0,0];this.getDrawingWidth=()=>{if(container)return container.clientWidth;return canvas?"undefined"==typeof canvas.clientWidth?Math.round(canvas.width):Math.round(canvas.clientWidth):0},this.getDrawingHeight=()=>{if(container)return container.clientHeight;return canvas?"undefined"==typeof canvas.clientHeight?Math.round(canvas.height):Math.round(canvas.clientHeight):0},this.onWindowResize=()=>{currentScene.onWindowResize();var width=this.getDrawingWidth(),height=this.getDrawingHeight();if(renderer!=null){var localRect;container?(localRect=container.getBoundingClientRect(),renderer.setSize(width,height)):canvas&&("undefined"==typeof canvas.getBoundingClientRect?renderer.setSize(width,height,!1):(localRect=canvas.getBoundingClientRect(),canvas.width=width,canvas.height=height,renderer.setSize(width,height,!1))),localRect&&(currentOffset[0]=localRect.left,currentOffset[1]=localRect.top);var target=new THREE.Vector2;renderer.getSize(target),currentSize[0]=target.x,currentSize[1]=target.y}},this.initialiseVisualisation=parameters=>{if(!isInitialised){if(parameters=parameters||{},void 0===parameters.antialias){var onMobile=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(onMobile=!0)}catch(err){onMobile=!1}parameters.antialias=!onMobile}parameters.canvas&&(container=void 0,canvas=parameters.canvas),renderer=new THREE.WebGLRenderer(parameters),void 0!==container&&container.appendChild(renderer.domElement),renderer.setClearColor(16777215,1),canvas&&canvas.style&&(canvas.style.height="100%",canvas.style.width="100%");var domCanvas=renderer.domElement;domCanvas.addEventListener("webglcontextlost",onContextLost,!1),domCanvas.addEventListener("webglcontextrestored",onContextRestored,!1),renderer.autoClear=!1;var scene=this.createScene("default");this.setCurrentScene(scene),isInitialised=!0}};var onContextLost=event=>{event.preventDefault();for(var key of Object.keys(preRenderCallbackFunctions))contextLostCallbackFunctions.hasOwnProperty(key)&&contextLostCallbackFunctions[key].call()},onContextRestored=event=>{event.preventDefault();for(var key of Object.keys(preRenderCallbackFunctions))contextRestoredCallbackFunctions.hasOwnProperty(key)&&contextRestoredCallbackFunctions[key].call()};/**
1063
+ * Get the current scene on display.
1064
+ * @return {Zinc.Scene};
1065
+ */this.getCurrentScene=()=>currentScene,this.setCurrentScene=sceneIn=>{if(sceneIn){this.removeActiveScene(sceneIn);var oldScene=currentScene;currentScene=sceneIn,oldScene&&oldScene.setInteractiveControlEnable(!1),currentScene.setInteractiveControlEnable(!0),currentScene.setAdditionalScenesGroup(scenesGroup),this.onWindowResize()}},this.getSceneByName=name=>sceneMap[name],this.createScene=name=>{if(null==sceneMap[name]){var new_scene;return new_scene=canvas?new((__webpack_require__(32).Scene))(canvas,renderer):new((__webpack_require__(32).Scene))(container,renderer),sceneMap[name]=new_scene,new_scene.sceneName=name,new_scene}};/**
1066
+ * Reset the viewport of the current scene to its original state.
1067
+ */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)};/**
1068
+ * Load the viewport from an external location provided by the url. This should be
1069
+ * called from {@link Zinc.Scene};
1070
+ * @param {String} URL - address to the file containing viewport information.
1071
+ * @deprecated
1072
+ */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)};/**
1073
+ * Stop the animation and renderer to get into the render loop.
1074
+ */this.stopAnimate=()=>{isRendering&&(clock.stop(),isRendering=!1)},this.animate=()=>{isRendering||(clock.start(),isRendering=!0,runAnimation())};Date.now();/**
1075
+ * Add a callback function which will be called when the gl context is lost.
1076
+ * @param {Function} callbackFunction - callbackFunction to be added.
1077
+ *
1078
+ * @return {Number}
1079
+ */this.addContextLostCallbackFunction=callbackFunction=>(++contextLostCallbackFunctions_id,contextLostCallbackFunctions[contextLostCallbackFunctions_id]=callbackFunction,contextLostCallbackFunctions_id),this.removeContextLostCallbackFunction=id=>{id in contextLostCallbackFunctions&&delete contextLostCallbackFunctions[id]},this.addContextRestoredCallbackFunction=callbackFunction=>(++contextRestoredCallbackFunctions_id,contextRestoredCallbackFunctions[contextRestoredCallbackFunctions_id]=callbackFunction,contextRestoredCallbackFunctions_id),this.removeContextRestoredCallbackFunction=id=>{id in contextRestoredCallbackFunctions_id&&delete contextRestoredCallbackFunctions_id[id]},this.addPreRenderCallbackFunction=callbackFunction=>(++preRenderCallbackFunctions_id,preRenderCallbackFunctions[preRenderCallbackFunctions_id]=callbackFunction,preRenderCallbackFunctions_id),this.removePreRenderCallbackFunction=id=>{id in preRenderCallbackFunctions&&delete preRenderCallbackFunctions[id]},this.addPostRenderCallbackFunction=callbackFunction=>(++postRenderCallbackFunctions_id,postRenderCallbackFunctions[postRenderCallbackFunctions_id]=callbackFunction,postRenderCallbackFunctions_id),this.removePostRenderCallbackFunction=id=>{id in postRenderCallbackFunctions&&delete postRenderCallbackFunctions[id]},this.getPlayRate=()=>playRate,this.setPlayRate=playRateIn=>{playRate=playRateIn},this.getCurrentTime=()=>currentScene.getCurrentTime(),this.setMorphsTime=time=>{currentScene.setMorphsTime(time)},this.getZincGeometryByID=id=>currentScene.getZincGeometryByID(id),this.addToScene=object=>{currentScene.addObject(object)},this.addToOrthoScene=object=>{if(null==sceneOrtho&&(sceneOrtho=new THREE.Scene),null==cameraOrtho){var width=this.getDrawingWidth(),height=this.getDrawingHeight();cameraOrtho=new THREE.OrthographicCamera(-width/2,width/2,height/2,-height/2,1,10),cameraOrtho.position.z=10}sceneOrtho.add(object)};var createHUDSprites=logoSprite=>texture=>{texture.needsUpdate=!0;var material=new THREE.SpriteMaterial({map:texture}),imagewidth=material.map.image.width,imageheight=material.map.image.height;logoSprite.material=material,logoSprite.scale.set(imagewidth,imageheight,1);var width=this.getDrawingWidth(),height=this.getDrawingHeight();logoSprite.position.set((width-imagewidth)/2,(-height+imageheight)/2,1),this.addToOrthoScene(logoSprite)};/**
1080
+ * Render the current and all additional scenes. It will first update all geometries and glyphsets
1081
+ * in scenes, clear depth buffer and render the ortho scene, call the preRenderCallbackFunctions stack
1082
+ * , render the scenes then postRenderCallback.
1083
+ */ /**
1084
+ * Get the internal {@link Three.Renderer}, to gain access to ThreeJS APIs.
1085
+ */ /**
1086
+ * Check if a scene is currently active.
1087
+ * @param {Zinc.Scene} sceneIn - Scene to check if it is currently
1088
+ * rendered.
1089
+ */ /**
1090
+ * Add additional active scene for rendering, this scene will also be rendered but
1091
+ * viewport of the currentScene will be used.
1092
+ * @param {Zinc.Scene} additionalScene - Scene to be added to the rendering.
1093
+ */ /**
1094
+ * Remove a currenrtly active scene from the renderer, this scene will also be rendered but
1095
+ * viewport of the currentScene will be used.
1096
+ * @param {Zinc.Scene} additionalScene - Scene to be removed from rendering.
1097
+ */ /**
1098
+ * Clear all additional scenes from rendering except for curentScene.
1099
+ */ /**
1100
+ * Dispose all memory allocated, this will effetively destroy all scenes.
1101
+ */ /**
1102
+ * Transition from the current viewport to the endingScene's viewport in the specified duration.
1103
+ *
1104
+ * @param {Zinc.Scene} endingScene - Viewport of this scene will be used as the destination.
1105
+ * @param {Number} duration - Amount of time to transition from current viewport to the
1106
+ * endingScene's viewport.
1107
+ */this.addLogo=()=>{logoSprite=new THREE.Sprite;THREE.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png",void 0,createHUDSprites(logoSprite))},this.render=()=>{sensor||(container?0<container.clientWidth&&0<container.clientHeight&&(sensor=new ResizeSensor(container,this.onWindowResize)):canvas&&0<canvas.width&&0<canvas.height&&(sensor=new ResizeSensor(canvas,this.onWindowResize)));var delta=clock.getDelta();currentScene.renderGeometries(playRate,delta,this.playAnimation);for(var sceneItem,i=0;i<additionalActiveScenes.length;i++)sceneItem=additionalActiveScenes[i],sceneItem.renderGeometries(playRate,delta,this.playAnimation);cameraOrtho!=null&&sceneOrtho!=null&&(renderer.clearDepth(),renderer.render(sceneOrtho,cameraOrtho));for(var key of Object.keys(preRenderCallbackFunctions))preRenderCallbackFunctions.hasOwnProperty(key)&&preRenderCallbackFunctions[key].call();currentScene.render(renderer);for(var _key of Object.keys(postRenderCallbackFunctions))postRenderCallbackFunctions.hasOwnProperty(_key)&&postRenderCallbackFunctions[_key].call()},this.forceContextLoss=()=>{renderer.forceContextLoss()},this.forceContextRestore=()=>{renderer.forceContextRestore()},this.getThreeJSRenderer=()=>renderer,this.isSceneActive=sceneIn=>{if(currentScene===sceneIn)return!0;for(var sceneItem,i=0;i<additionalActiveScenes.length;i++)if(sceneItem=additionalActiveScenes[i],sceneItem===sceneIn)return!0;return!1},this.addActiveScene=additionalScene=>{this.isSceneActive(additionalScene)||(additionalActiveScenes.push(additionalScene),scenesGroup.add(additionalScene.getThreeJSScene()))},this.removeActiveScene=additionalScene=>{for(var sceneItem,i=0;i<additionalActiveScenes.length;i++)if(sceneItem=additionalActiveScenes[i],sceneItem===additionalScene)return additionalActiveScenes.splice(i,1),void scenesGroup.remove(additionalScene.getThreeJSScene())},this.clearAllActiveScene=()=>{for(var i=0;i<additionalActiveScenes.length;i++)scenesGroup.remove(additionalActiveScenes[i].getThreeJSScene());additionalActiveScenes.splice(0,additionalActiveScenes.length)},this.dispose=()=>{var _renderer;for(var key in isRendering&&cancelAnimationFrame(animated_id),sceneMap)sceneMap.hasOwnProperty(key)&&sceneMap[key].clearAll();sceneMap=[],additionalActiveScenes=[],scenesGroup=new THREE.Group,this.stopAnimate(),preRenderCallbackFunctions={},preRenderCallbackFunctions_id=0,postRenderCallbackFunctions={},postRenderCallbackFunctions=0,contextLostCallbackFunctions={},contextLostCallbackFunctions_id=0,contextRestoredCallbackFunctions={},contextRestoredCallbackFunctions_id=0,cameraOrtho=void 0,sceneOrtho=void 0,logoSprite=void 0;var scene=this.createScene("default");this.setCurrentScene(scene),sensor=void 0,null===(_renderer=renderer)||void 0===_renderer||_renderer.dispose()},this.transitionScene=(endingScene,duration)=>{if(currentScene){var currentCamera=currentScene.getZincCameraControls(),boundingBox=endingScene.getBoundingBox();if(boundingBox){var radius=boundingBox.min.distanceTo(boundingBox.max)/2,centreX=(boundingBox.min.x+boundingBox.max.x)/2,centreY=(boundingBox.min.y+boundingBox.max.y)/2,centreZ=(boundingBox.min.z+boundingBox.max.z)/2,endingViewport=currentCamera.getViewportFromCentreAndRadius(centreX,centreY,centreZ,radius,40,radius*4),startingViewport=currentCamera.getCurrentViewport();currentCamera.cameraTransition(startingViewport,endingViewport,duration),currentCamera.enableCameraTransition()}}},this.isWebGL2=()=>!!renderer&&renderer.capabilities.isWebGL2};
1105
1108
 
1106
1109
  /***/ }),
1107
1110
  /* 31 */
@@ -1542,7 +1545,7 @@ var THREE=__webpack_require__(4),mergeGeometries=(__webpack_require__(5).mergeGe
1542
1545
  *
1543
1546
  * @param {Array} vertices - An array of THREE.Vector3 vertices.
1544
1547
  * @returns {Object}
1545
- */var getTubeLinesGeometry=vertices=>{var finalGeometry,{radius,radialSegments,smooth}=geometryConfig;if(smooth){var curve=new THREE.CatmullRomCurve3(vertices);finalGeometry=new THREE.TubeGeometry(curve,vertices.length,radius,radialSegments,!1)}else{var geometries=vertices.slice(0,-1).map((start,i)=>{var end=vertices[i+1],curve=new THREE.LineCurve3(start,end),tubeGeometry=new THREE.TubeGeometry(curve,1,radius,radialSegments,!1);return tubeGeometry});finalGeometry=mergeGeometries(geometries,!0),geometries.forEach(g=>g.dispose())}return finalGeometry}};/**
1548
+ */var getTubeLinesGeometry=vertices=>{var finalGeometry,{radius,radialSegments,smooth}=geometryConfig;if(smooth){var curve=new THREE.CatmullRomCurve3(vertices);finalGeometry=new THREE.TubeGeometry(curve,vertices.length,radius,radialSegments,!1)}else{for(var geometries=[],i=0;i+1<vertices.length;i+=2){var _curve=new THREE.LineCurve3(vertices[i],vertices[i+1]),tubeGeometry=new THREE.TubeGeometry(_curve,1,radius,radialSegments,!1);geometries.push(tubeGeometry)}finalGeometry=mergeGeometries(geometries,!0),geometries.forEach(g=>g.dispose())}return finalGeometry}};/**
1546
1549
  * Provides an object which stores lines.
1547
1550
  * This is created when a valid json file containing lines is read into a {@link Zinc.Scene}
1548
1551
  * object.