OVRChromaticAberration.cs 1.9 KB

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