/// <summary> /// Updates the <see cref="Camera.projectionMatrix"/> of the <see cref="renderCamera"/> /// which creates a holographic projection effect. /// </summary> /// <param name="screen">The screen the camera is facing.</</param> /// <param name="eyes">The eye position in world space.</param> /// <param name="nearClipPlane">The near clip plane of the camera.</param> /// <param name="farClipPlane">The far clip plane of the camera.</param> public void UpdateCameraProjection(VirtualScreen screen, Vector3 eyes, float nearClipPlane, float farClipPlane) { // Use the world position of the specified eye anchor // to calculate the local position in the screen coordinate system. // Finally use the local position to compute the projection matrix // for the holographic projection. // Additionally correct the projection with a bimber matrix if // necessary. var local = screen.transform.InverseTransformPoint(eyes); var projection = VirtualProjection.ComputeHolographicProjectionMatrix(local, nearClipPlane, farClipPlane, screen.width, screen.height); var bimber = this.m_Calibration.projectionCorrection ? this.m_BimberMatrix : Matrix4x4.identity; this.m_Camera.nearClipPlane = nearClipPlane; this.m_Camera.farClipPlane = farClipPlane; this.m_Camera.projectionMatrix = bimber * projection; }
private void RebuildBimberMatrix(Quad quad) { this.m_BimberMatrix = VirtualProjection.ComputeBimberMatrix(quad.bottomLeft, quad.topLeft, quad.topRight, quad.bottomRight); }