private void ConfigureEyeDesc(VR.VRNode eye) { if (!VR.VRDevice.isPresent) return; OVRPlugin.Sizei size = OVRPlugin.GetEyeTextureSize((OVRPlugin.Eye)eye); OVRPlugin.Frustumf frust = OVRPlugin.GetEyeFrustum((OVRPlugin.Eye)eye); eyeDescs[(int)eye] = new EyeRenderDesc() { resolution = new Vector2(size.w, size.h), fov = Mathf.Rad2Deg * new Vector2(frust.fovX, frust.fovY), }; }
private Transform ConfigureEyeAnchor(Transform root, VR.VRNode eye) { string eyeName = (eye == VR.VRNode.CenterEye) ? "Center" : (eye == VR.VRNode.LeftEye) ? "Left" : "Right"; string name = eyeName + eyeAnchorName; Transform anchor = transform.Find(root.name + "/" + name); if (anchor == null) { anchor = transform.Find(name); } if (anchor == null) { string legacyName = legacyEyeAnchorName + eye.ToString(); anchor = transform.Find(legacyName); } if (anchor == null) { anchor = new GameObject(name).transform; } anchor.name = name; anchor.parent = root; anchor.localScale = Vector3.one; anchor.localPosition = Vector3.zero; anchor.localRotation = Quaternion.identity; return anchor; }
/// <summary> /// Gets the resolution and field of view for the given eye. /// </summary> public EyeRenderDesc GetEyeRenderDesc(VR.VRNode eye) { return eyeDescs[(int)eye]; }