diff --git a/js/menus/templates/NavViewMenu.html b/js/menus/templates/NavViewMenu.html index db5339f909de7e1ac7fa10ad4f59909edf7ed4d5..a7446c5199989d17b1eb527ff6b2f42f8ada8933 100644 --- a/js/menus/templates/NavViewMenu.html +++ b/js/menus/templates/NavViewMenu.html @@ -19,8 +19,9 @@ <li class="dropdown-submenu"> <a tabindex="-1">Rendering<span class="pull-right fui-arrow-right"></span></a> <ul class="dropdown-menu"> - <li><a class="appState boolProperty" data-property="renderAmbientOcclusion" href="#">Ambient Occlusion</a></li> + <!--<li><a class="appState boolProperty" data-property="renderAmbientOcclusion" href="#">Ambient Occlusion</a></li>--> <li><a class="appState boolProperty" data-property="realisticColorScheme" href="#">Realistic Color Scheme</a></li> + <li><a class="appState boolProperty" data-property="turnOffRendering" href="#">Turn Off Rendering</a></li> </ul> </li> <li class="dropdown-submenu"> diff --git a/js/models/AppState.js b/js/models/AppState.js index 76e105b27431d8019bbb34917bdb2a2758a05acb..1f7c4641c64290125cb25a0e7f8f57333cfb1c1c 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -20,6 +20,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu scriptIsVisible: false, consoleIsVisible: false, ribbonIsVisible: true, + turnOffRendering: false, basePlaneIsVisible:true, highlighterIsVisible:true, @@ -60,6 +61,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu this.listenTo(this, "change:currentNav", this._navChanged); this.listenTo(this, "change:materialType", this._materialTypeChanged); this.listenTo(this, "change:gikLength", this._gikLengthChanged); + this.listenTo(this, "change:turnOffRendering", this._renderingOnOff); this.downKeys = {};//track keypresses to prevent repeat keystrokes on hold this.lastCellMode = this.get("cellMode");//store this to toggle on/off hide mode @@ -139,6 +141,11 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu } }, + _renderingOnOff: function(){ + if (!this.get("turnOffRendering")) three.render(); + }, + + /////////////////////////////////////////////////////////////////////////////// /////////////////////KEY BINDINGS////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/js/three/ThreeModel.js b/js/three/ThreeModel.js index faeb0df87a9556f60f862ba4935123403fefc7c1..497e1b36fdd425a723f7b1db20eef97e18dd3749 100644 --- a/js/three/ThreeModel.js +++ b/js/three/ThreeModel.js @@ -9,6 +9,11 @@ define(['underscore', 'three'], function(_, THREE){ var scene = new THREE.Scene(); var renderer = new THREE.WebGLRenderer({antialias:true});//antialiasing is not supported in ff and on mac+chrome + var appState; + require(['appState'], function(globalAppState){ + appState = globalAppState; + }); + //store all meshes to highlight var cells = []; var compositeCells = []; @@ -122,7 +127,7 @@ define(['underscore', 'three'], function(_, THREE){ } function startAnimationLoop(){ - if (animationLoopRunning) return; + if (appState.get("turnOffRendering") || animationLoopRunning) return; stopAnimationFlag = false; animationLoopRunning = true; console.log("animation started"); @@ -145,7 +150,7 @@ define(['underscore', 'three'], function(_, THREE){ } function render(){ - if (animationLoopRunning) return; + if ((appState && appState.get("turnOffRendering")) || animationLoopRunning) return; _render(); }