From 1e01d6bd8f0f16e0015278c9dec3a0366a6f808b Mon Sep 17 00:00:00 2001 From: Chris Collins Date: Mon, 5 Oct 2015 15:30:53 -0700 Subject: [PATCH 1/2] Add the ability to switch between mono and stereo in HMD Add the ability to switch between mono and stereo in HMD --- examples/utilities/tools/MonoHMD.js | 68 +++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 examples/utilities/tools/MonoHMD.js diff --git a/examples/utilities/tools/MonoHMD.js b/examples/utilities/tools/MonoHMD.js new file mode 100644 index 0000000000..5ab0ea4d64 --- /dev/null +++ b/examples/utilities/tools/MonoHMD.js @@ -0,0 +1,68 @@ +// +// MonoHMD.js +// +// Created by Chris Collins on 10/5/15 +// Copyright 2015 High Fidelity, Inc. +// +// This script allows you to switch between mono and stereo mode within the HMD. +// It will add adition menu to Tools called "IPD". +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html + + + + +function setupipdMenu() { + if (!Menu.menuExists("Tools > IPD")) { + Menu.addMenu("Tools > IPD"); + } + if (!Menu.menuItemExists("Tools > IPD", "Stereo")) { + Menu.addMenuItem({ + menuName: "Tools > IPD", + menuItemName: "Stereo", + isCheckable: true, + isChecked: true + }); + } + if (!Menu.menuItemExists("Tools > IPD", "Mono")) { + Menu.addMenuItem({ + menuName: "Tools > IPD", + menuItemName: "Mono", + isCheckable: true, + isChecked: false + }); + } + +} + + +function menuItemEvent(menuItem) { + if (menuItem == "Stereo") { + Menu.setIsOptionChecked("Mono", false); + HMD.setIPDScale(1.0); + + } + if (menuItem == "Mono") { + Menu.setIsOptionChecked("Stereo", false); + HMD.setIPDScale(0.0); + } + +} + + + +function scriptEnding() { + + Menu.removeMenuItem("Tools > IPD", "Stereo"); + Menu.removeMenuItem("Tools > IPD", "Mono"); + Menu.removeMenu("Tools > IPD"); + //reset the HMD to stereo mode + HMD.setIPDScale(1.0); + +} + + +setupipdMenu(); +Menu.menuItemEvent.connect(menuItemEvent); +Script.scriptEnding.connect(scriptEnding); \ No newline at end of file From c0a881ec52321f8a339d8e4951dd865ba67d19da Mon Sep 17 00:00:00 2001 From: Chris Collins Date: Mon, 5 Oct 2015 15:37:04 -0700 Subject: [PATCH 2/2] added the correct call added the correct call --- examples/utilities/tools/MonoHMD.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/utilities/tools/MonoHMD.js b/examples/utilities/tools/MonoHMD.js index 5ab0ea4d64..4565ebd7bf 100644 --- a/examples/utilities/tools/MonoHMD.js +++ b/examples/utilities/tools/MonoHMD.js @@ -40,12 +40,12 @@ function setupipdMenu() { function menuItemEvent(menuItem) { if (menuItem == "Stereo") { Menu.setIsOptionChecked("Mono", false); - HMD.setIPDScale(1.0); + HMD.ipdScale = 1.0; } if (menuItem == "Mono") { Menu.setIsOptionChecked("Stereo", false); - HMD.setIPDScale(0.0); + HMD.ipdScale = 0.0; } }