// Token: 0x06000D86 RID: 3462 RVA: 0x00054E44 File Offset: 0x00053044 private void OnPostRender() { if (this.currentColor != this.targetColor) { if (Mathf.Abs(this.currentColor.a - this.targetColor.a) < Mathf.Abs(this.deltaColor.a) * Time.deltaTime) { this.currentColor = this.targetColor; this.deltaColor = new Color(0f, 0f, 0f, 0f); } else { this.currentColor += this.deltaColor * Time.deltaTime; } if (this.fadeOverlay) { SteamVR_Overlay instance = SteamVR_Overlay.instance; if (instance != null) { instance.alpha = 1f - this.currentColor.a; } } } if (this.currentColor.a > 0f && SteamVR_Fade.fadeMaterial) { SteamVR_Fade.fadeMaterial.SetColor(SteamVR_Fade.fadeMaterialColorID, this.currentColor); SteamVR_Fade.fadeMaterial.SetPass(0); GL.Begin(7); GL.Vertex3(-1f, -1f, 0f); GL.Vertex3(1f, -1f, 0f); GL.Vertex3(1f, 1f, 0f); GL.Vertex3(-1f, 1f, 0f); GL.End(); } }
public bool ComputeIntersection(Vector3 source, Vector3 direction, ref SteamVR_Overlay.IntersectionResults results) { CVROverlay overlay = OpenVR.Overlay; if (overlay == null) { return false; } VROverlayIntersectionParams_t vROverlayIntersectionParams_t = default(VROverlayIntersectionParams_t); vROverlayIntersectionParams_t.eOrigin = SteamVR_Render.instance.trackingSpace; vROverlayIntersectionParams_t.vSource.v0 = source.x; vROverlayIntersectionParams_t.vSource.v1 = source.y; vROverlayIntersectionParams_t.vSource.v2 = -source.z; vROverlayIntersectionParams_t.vDirection.v0 = direction.x; vROverlayIntersectionParams_t.vDirection.v1 = direction.y; vROverlayIntersectionParams_t.vDirection.v2 = -direction.z; VROverlayIntersectionResults_t vROverlayIntersectionResults_t = default(VROverlayIntersectionResults_t); if (!overlay.ComputeOverlayIntersection(this.handle, ref vROverlayIntersectionParams_t, ref vROverlayIntersectionResults_t)) { return false; } results.point = new Vector3(vROverlayIntersectionResults_t.vPoint.v0, vROverlayIntersectionResults_t.vPoint.v1, -vROverlayIntersectionResults_t.vPoint.v2); results.normal = new Vector3(vROverlayIntersectionResults_t.vNormal.v0, vROverlayIntersectionResults_t.vNormal.v1, -vROverlayIntersectionResults_t.vNormal.v2); results.UVs = new Vector2(vROverlayIntersectionResults_t.vUVs.v0, vROverlayIntersectionResults_t.vUVs.v1); results.distance = vROverlayIntersectionResults_t.fDistance; return true; }
// Token: 0x06005F5A RID: 24410 RVA: 0x00217CD0 File Offset: 0x002160D0 private IEnumerator RenderLoop() { while (Application.isPlaying) { yield return(this.waitForEndOfFrame); if (!SteamVR_Render.pauseRendering) { CVRCompositor compositor = OpenVR.Compositor; if (compositor != null) { if (!compositor.CanRenderScene()) { continue; } compositor.SetTrackingSpace(this.trackingSpace); } SteamVR_Overlay overlay = SteamVR_Overlay.instance; if (overlay != null) { overlay.UpdateOverlay(); } this.RenderExternalCamera(); } } yield break; }
private void Update() { foreach (int num in this.controllerIndices) { SteamVR_Overlay instance = SteamVR_Overlay.instance; if (instance && this.point && this.pointer) { SteamVR_Utils.RigidTransform transform = SteamVR_Controller.Input(num).transform; this.pointer.transform.localPosition = transform.pos; this.pointer.transform.localRotation = transform.rot; SteamVR_Overlay.IntersectionResults intersectionResults = default(SteamVR_Overlay.IntersectionResults); bool flag = instance.ComputeIntersection(transform.pos, transform.rot * Vector3.forward, ref intersectionResults); if (flag) { this.point.transform.localPosition = intersectionResults.point; this.point.transform.localRotation = Quaternion.LookRotation(intersectionResults.normal); } } else { foreach (EVRButtonId evrbuttonId in this.buttonIds) { if (SteamVR_Controller.Input(num).GetPressDown(evrbuttonId)) { Debug.Log(evrbuttonId + " press down"); } if (SteamVR_Controller.Input(num).GetPressUp(evrbuttonId)) { Debug.Log(evrbuttonId + " press up"); if (evrbuttonId == EVRButtonId.k_EButton_Axis1) { SteamVR_Controller.Input(num).TriggerHapticPulse(500, EVRButtonId.k_EButton_Axis0); this.PrintControllerStatus(num); } } if (SteamVR_Controller.Input(num).GetPress(evrbuttonId)) { Debug.Log(evrbuttonId); } } foreach (EVRButtonId evrbuttonId2 in this.axisIds) { if (SteamVR_Controller.Input(num).GetTouchDown(evrbuttonId2)) { Debug.Log(evrbuttonId2 + " touch down"); } if (SteamVR_Controller.Input(num).GetTouchUp(evrbuttonId2)) { Debug.Log(evrbuttonId2 + " touch up"); } if (SteamVR_Controller.Input(num).GetTouch(evrbuttonId2)) { Vector2 axis = SteamVR_Controller.Input(num).GetAxis(evrbuttonId2); Debug.Log("axis: " + axis); } } } } }
private void Update() { foreach (int controllerIndex in this.controllerIndices) { SteamVR_Overlay instance = SteamVR_Overlay.instance; if ((bool)((Object)instance) && (bool)((Object)this.point) && (bool)((Object)this.pointer)) { SteamVR_Utils.RigidTransform transform = SteamVR_Controller.Input(controllerIndex).transform; this.pointer.transform.localPosition = transform.pos; this.pointer.transform.localRotation = transform.rot; SteamVR_Overlay.IntersectionResults results = new SteamVR_Overlay.IntersectionResults(); if (instance.ComputeIntersection(transform.pos, transform.rot * Vector3.forward, ref results)) { this.point.transform.localPosition = results.point; this.point.transform.localRotation = Quaternion.LookRotation(results.normal); } } else { foreach (EVRButtonId buttonId in this.buttonIds) { if (SteamVR_Controller.Input(controllerIndex).GetPressDown(buttonId)) { Debug.Log((object)(((int)buttonId).ToString() + " press down")); } if (SteamVR_Controller.Input(controllerIndex).GetPressUp(buttonId)) { Debug.Log((object)(((int)buttonId).ToString() + " press up")); if (buttonId == EVRButtonId.k_EButton_Axis1) { SteamVR_Controller.Input(controllerIndex).TriggerHapticPulse((ushort)500, EVRButtonId.k_EButton_Axis0); this.PrintControllerStatus(controllerIndex); } } if (SteamVR_Controller.Input(controllerIndex).GetPress(buttonId)) { Debug.Log((object)buttonId); } } foreach (EVRButtonId axisId in this.axisIds) { if (SteamVR_Controller.Input(controllerIndex).GetTouchDown(axisId)) { Debug.Log((object)(((int)axisId).ToString() + " touch down")); } if (SteamVR_Controller.Input(controllerIndex).GetTouchUp(axisId)) { Debug.Log((object)(((int)axisId).ToString() + " touch up")); } if (SteamVR_Controller.Input(controllerIndex).GetTouch(axisId)) { Debug.Log((object)("axis: " + (object)SteamVR_Controller.Input(controllerIndex).GetAxis(axisId))); } } } } }
private void OnPostRender() { SteamVR instance = SteamVR.instance; Camera component = base.GetComponent <Camera>(); float num = this.scale * component.aspect / instance.aspect; float x = -this.scale; float x2 = this.scale; float y = num; float y2 = -num; Material blitMaterial = SteamVR_Camera.blitMaterial; blitMaterial.mainTexture = SteamVR_Camera.GetSceneTexture(component.hdr); GL.PushMatrix(); GL.LoadOrtho(); blitMaterial.SetPass(0); GL.Begin(7); GL.TexCoord2(0f, 0f); GL.Vertex3(x, y, 0f); GL.TexCoord2(1f, 0f); GL.Vertex3(x2, y, 0f); GL.TexCoord2(1f, 1f); GL.Vertex3(x2, y2, 0f); GL.TexCoord2(0f, 1f); GL.Vertex3(x, y2, 0f); GL.End(); GL.PopMatrix(); SteamVR_Overlay instance2 = SteamVR_Overlay.instance; if (instance2 && instance2.texture && SteamVR_GameView.overlayMaterial && this.drawOverlay) { Texture texture = instance2.texture; SteamVR_GameView.overlayMaterial.mainTexture = texture; float x3 = 0f; float y3 = 1f - (float)Screen.height / (float)texture.height; float x4 = (float)Screen.width / (float)texture.width; float y4 = 1f; GL.PushMatrix(); GL.LoadOrtho(); SteamVR_GameView.overlayMaterial.SetPass((QualitySettings.activeColorSpace != ColorSpace.Linear) ? 0 : 1); GL.Begin(7); GL.TexCoord2(x3, y3); GL.Vertex3(-1f, -1f, 0f); GL.TexCoord2(x4, y3); GL.Vertex3(1f, -1f, 0f); GL.TexCoord2(x4, y4); GL.Vertex3(1f, 1f, 0f); GL.TexCoord2(x3, y4); GL.Vertex3(-1f, 1f, 0f); GL.End(); GL.PopMatrix(); } }
private void Awake() { this.scaleLimitX = string.Format("{0:N1}", this.scaleLimits.x); this.scaleLimitY = string.Format("{0:N1}", this.scaleLimits.y); this.scaleRateText = string.Format("{0:N1}", this.scaleRate); SteamVR_Overlay instance = SteamVR_Overlay.instance; if (instance != null) { this.uvOffset = instance.uvOffset; this.distance = instance.distance; } }
public void HideMenu() { this.RestoreCursorState(); if (this.overlayCam != null) { this.overlayCam.enabled = true; } if (this.overlay != null) { this.overlay.uvOffset = this.uvOffset; this.overlay.distance = this.distance; this.overlay = null; } }
public void HideMenu() { RestoreCursorState(); if (overlayCam != null) overlayCam.enabled = true; if (overlay != null) { overlay.uvOffset = uvOffset; overlay.distance = distance; overlay = null; } }
public void ShowMenu() { var overlay = SteamVR_Overlay.instance; if (overlay == null) { return; } var texture = overlay.texture as RenderTexture; if (texture == null) { Debug.LogError("Menu requires overlay texture to be a render texture."); return; } SaveCursorState(); /*# if !UNITY_WSA_10_0 * Cursor.visible = true; * Cursor.lockState = CursorLockMode.None; #endif */ this.overlay = overlay; uvOffset = overlay.uvOffset; distance = overlay.distance; // If an existing camera is rendering into the overlay texture, we need // to temporarily disable it to keep it from clearing the texture on us. var cameras = Object.FindObjectsOfType(typeof(Camera)) as Camera[]; foreach (var cam in cameras) { if (cam.enabled && cam.targetTexture == texture) { overlayCam = cam; overlayCam.enabled = false; break; } } var tracker = SteamVR_Render.Top(); if (tracker != null) { scale = tracker.origin.localScale.x; } }
private void OnDisable() { if (handle != OpenVR.k_ulOverlayHandleInvalid) { var overlay = OpenVR.Overlay; if (overlay != null) { overlay.DestroyOverlay(handle); } handle = OpenVR.k_ulOverlayHandleInvalid; } SteamVR_Overlay.instance = null; }
public void HideMenu() { RestoreCursorState(); if (overlayCam != null) { overlayCam.enabled = true; } if (overlay != null) { overlay.uvOffset = uvOffset; overlay.distance = distance; overlay = null; } }
private void OnEnable() { var overlay = OpenVR.Overlay; if (overlay != null) { var error = overlay.CreateOverlay(key, gameObject.name, ref handle); if (error != EVROverlayError.None) { Debug.Log(overlay.GetOverlayErrorNameFromEnum(error)); enabled = false; return; } } SteamVR_Overlay.instance = this; }
public void ShowMenu() { SteamVR_Overlay instance = SteamVR_Overlay.instance; if (instance == null) { return; } RenderTexture renderTexture = instance.texture as RenderTexture; if (renderTexture == null) { Debug.LogError("Menu requires overlay texture to be a render texture."); return; } this.SaveCursorState(); Cursor.visible = true; Cursor.lockState = CursorLockMode.None; this.overlay = instance; this.uvOffset = instance.uvOffset; this.distance = instance.distance; Camera[] array = UnityEngine.Object.FindObjectsOfType(typeof(Camera)) as Camera[]; Camera[] array2 = array; for (int i = 0; i < array2.Length; i++) { Camera camera = array2[i]; if (camera.enabled && camera.targetTexture == renderTexture) { this.overlayCam = camera; this.overlayCam.enabled = false; break; } } SteamVR_Camera steamVR_Camera = SteamVR_Render.Top(); if (steamVR_Camera != null) { this.scale = steamVR_Camera.origin.localScale.x; } }
public void ShowMenu() { var overlay = SteamVR_Overlay.instance; if (overlay == null) return; var texture = overlay.texture as RenderTexture; if (texture == null) { Debug.LogError("Menu requires overlay texture to be a render texture."); return; } SaveCursorState(); Cursor.visible = true; Cursor.lockState = CursorLockMode.None; this.overlay = overlay; uvOffset = overlay.uvOffset; distance = overlay.distance; // If an existing camera is rendering into the overlay texture, we need // to temporarily disable it to keep it from clearing the texture on us. var cameras = Object.FindObjectsOfType(typeof(Camera)) as Camera[]; foreach (var cam in cameras) { if (cam.enabled && cam.targetTexture == texture) { overlayCam = cam; overlayCam.enabled = false; break; } } var tracker = SteamVR_Render.Top(); if (tracker != null) scale = tracker.origin.localScale.x; }