SteamVR_UpdatePoses.cs 807 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using UnityEngine;
  3. using Valve.VR;
  4. [RequireComponent(typeof(Camera))]
  5. public class SteamVR_UpdatePoses : MonoBehaviour
  6. {
  7. private void Awake()
  8. {
  9. Camera component = base.GetComponent<Camera>();
  10. component.stereoTargetEye = StereoTargetEyeMask.None;
  11. component.clearFlags = CameraClearFlags.Nothing;
  12. component.useOcclusionCulling = false;
  13. component.cullingMask = 0;
  14. component.depth = -9999f;
  15. }
  16. private void OnPreCull()
  17. {
  18. CVRCompositor compositor = OpenVR.Compositor;
  19. if (compositor != null)
  20. {
  21. SteamVR_Render instance = SteamVR_Render.instance;
  22. compositor.GetLastPoses(instance.poses, instance.gamePoses);
  23. SteamVR_Utils.Event.Send("new_poses", new object[]
  24. {
  25. instance.poses
  26. });
  27. SteamVR_Utils.Event.Send("new_poses_applied", new object[0]);
  28. }
  29. }
  30. }