OVRChromaticAberration.cs 1.9 KB

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