From 3c9291062d7546d14693974ba99f841d0b778a02 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 30 Jun 2017 11:31:48 -0700 Subject: [PATCH] Clarify setDisplayTexture cases, also fixing crash bug --- scripts/system/spectatorCamera.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/system/spectatorCamera.js b/scripts/system/spectatorCamera.js index 5154322daa..4df168fde4 100644 --- a/scripts/system/spectatorCamera.js +++ b/scripts/system/spectatorCamera.js @@ -223,9 +223,19 @@ } } + // Function Name: setDisplay() + // + // Description: + // -There are two bool variables that determine what the "url" argument to "setDisplayTexture(url)" should be: + // Camera on/off switch, and the "Monitor Shows" on/off switch. + // This results in four possible cases for the argument. Those four cases are: + // 1. Camera is off; "Monitor Shows" is "HMD Preview": "url" is "" + // 2. Camera is off; "Monitor Shows" is "Camera View": "url" is "" + // 3. Camera is on; "Monitor Shows" is "HMD Preview": "url" is "" + // 4. Camera is on; "Monitor Shows" is "Camera View": "url" is "resource://spectatorCameraFrame" function setDisplay(showCameraView) { - // It would be fancy if (showCameraView && !cameraUpdateInterval) would show instructions, but that's out of scope for now. - var url = (showCameraView && cameraUpdateInterval) ? "resource://spectatorCameraFrame" : ""; + // It would be fancy if the app would show instructions when (url === ""), but that's out of scope for now. + var url = (camera && showCameraView && cameraUpdateInterval) ? "resource://spectatorCameraFrame" : ""; Window.setDisplayTexture(url); } const MONITOR_SHOWS_CAMERA_VIEW_DEFAULT = false;