BlueGit

blue-star ggj-2020

Files

ggj-2020 / Assets / Oculus / VR / Scripts / Util / OVRChromaticAberration.cs

OVRChromaticAberration.cs

Project Import
timfa Tim Falken · pushed by timfa · 6 years ago
b77834a1 History
OVRChromaticAberration.cs 1.9 KiB Download Raw
1/************************************************************************************
2Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
3
4Licensed under the Oculus Utilities SDK License Version 1.31 (the "License"); you may not use
5the Utilities SDK except in compliance with the License, which is provided at the time of installation
6or download, or which otherwise accompanies this software in either electronic or hard copy form.
7
8You may obtain a copy of the License at
9https://developer.oculus.com/licenses/utilities-1.31
10
11Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
12under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
13ANY KIND, either express or implied. See the License for the specific language governing
14permissions and limitations under the License.
15************************************************************************************/
16
17using UnityEngine;
18
19/// <summary>
20/// Allows you to toggle chromatic aberration correction with a gamepad button press.
21/// </summary>
22public class OVRChromaticAberration : MonoBehaviour
23{
24 /// <summary>
25 /// The button that will toggle chromatic aberration correction.
26 /// </summary>
27 public OVRInput.RawButton toggleButton = OVRInput.RawButton.X;
28
29 private bool chromatic = false;
30
31 void Start ()
32 {
33 // Enable/Disable Chromatic Aberration Correction.
34 // NOTE: Enabling Chromatic Aberration for mobile has a large performance cost.
35 OVRManager.instance.chromatic = chromatic;
36 }
37
38 void Update()
39 {
40 // NOTE: some of the buttons defined in OVRInput.RawButton are not available on the Android game pad controller
41 if (OVRInput.GetDown(toggleButton))
42 {
43 //*************************
44 // toggle chromatic aberration correction
45 //*************************
46 chromatic = !chromatic;
47 OVRManager.instance.chromatic = chromatic;
48 }
49 }
50
51}