Merge pull request #10863 from zfox23/spectatorCamera_clarifySetDisplay

Clarify setDisplayTexture() cases, also fixing crash bug
This commit is contained in:
Zach Fox 2017-06-30 14:05:21 -07:00 committed by GitHub
commit e85b6c870c

View file

@ -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;