| 1 | /************************************************************************************ |
| 2 | Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved. |
| 3 | |
| 4 | Licensed under the Oculus Utilities SDK License Version 1.31 (the "License"); you may not use |
| 5 | the Utilities SDK except in compliance with the License, which is provided at the time of installation |
| 6 | or download, or which otherwise accompanies this software in either electronic or hard copy form. |
| 7 | |
| 8 | You may obtain a copy of the License at |
| 9 | https://developer.oculus.com/licenses/utilities-1.31 |
| 10 | |
| 11 | Unless required by applicable law or agreed to in writing, the Utilities SDK distributed |
| 12 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF |
| 13 | ANY KIND, either express or implied. See the License for the specific language governing |
| 14 | permissions and limitations under the License. |
| 15 | ************************************************************************************/ |
| 16 | |
| 17 | using UnityEngine; |
| 18 | |
| 19 | /// <summary> |
| 20 | /// Allows you to toggle monoscopic rendering with a gamepad button press. |
| 21 | /// </summary> |
| 22 | public class OVRMonoscopic : MonoBehaviour |
| 23 | { |
| 24 | /// <summary> |
| 25 | /// The gamepad button that will toggle monoscopic rendering. |
| 26 | /// </summary> |
| 27 | public OVRInput.RawButton toggleButton = OVRInput.RawButton.B; |
| 28 | |
| 29 | private bool monoscopic = false; |
| 30 | |
| 31 | /// <summary> |
| 32 | /// Check input and toggle monoscopic rendering mode if necessary |
| 33 | /// See the input mapping setup in the Unity Integration guide |
| 34 | /// </summary> |
| 35 | void Update() |
| 36 | { |
| 37 | // NOTE: some of the buttons defined in OVRInput.RawButton are not available on the Android game pad controller |
| 38 | if (OVRInput.GetDown(toggleButton)) |
| 39 | { |
| 40 | //************************* |
| 41 | // toggle monoscopic rendering mode |
| 42 | //************************* |
| 43 | monoscopic = !monoscopic; |
| 44 | OVRManager.instance.monoscopic = monoscopic; |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | } |