Exemple #1
0
            //For each Surface, update viewing parameters and render the surface
            public void UpdateSurfaces()
            {
                //for each surface
                for (uint surfaceIndex = 0; surfaceIndex < SurfaceCount; surfaceIndex++)
                {
                    //get the eye's surface
                    VRSurface surface = Surfaces[surfaceIndex];

                    //get viewport from ClientKit and set surface viewport
                    OSVR.ClientKit.Viewport viewport = Viewer.DisplayController.DisplayConfig.GetRelativeViewportForViewerEyeSurface(
                        Viewer.ViewerIndex, (byte)_eyeIndex, surfaceIndex);

                    surface.SetViewport(Math.ConvertViewport(viewport));

                    //get projection matrix from ClientKit and set surface projection matrix
                    OSVR.ClientKit.Matrix44f projMatrix = Viewer.DisplayController.DisplayConfig.GetProjectionMatrixForViewerEyeSurfacef(
                        Viewer.ViewerIndex, (byte)_eyeIndex, surfaceIndex,
                        surface.Camera.nearClipPlane, surface.Camera.farClipPlane, OSVR.ClientKit.MatrixConventionsFlags.ColMajor);

                    surface.SetProjectionMatrix(Math.ConvertMatrix(projMatrix));

                    //render the surface
                    surface.Render();
                }
            }
Exemple #2
0
            //For each Surface, update viewing parameters and render the surface
            public void UpdateSurfaces()
            {
                //for each surface
                for (uint surfaceIndex = 0; surfaceIndex < SurfaceCount; surfaceIndex++)
                {
                    //get the eye's surface
                    VRSurface surface = Surfaces[surfaceIndex];

                    OSVR.ClientKit.Viewport  viewport;
                    OSVR.ClientKit.Matrix44f projMatrix;

                    //get viewport from ClientKit and set surface viewport
                    if (Viewer.DisplayController.UseRenderManager)
                    {
                        viewport = Viewer.DisplayController.RenderManager.GetEyeViewport((int)EyeIndex);
                        surface.SetViewportRect(Math.ConvertViewportRenderManager(viewport));

                        //get projection matrix from RenderManager and set surface projection matrix
                        surface.SetProjectionMatrix(Viewer.DisplayController.RenderManager.GetEyeProjectionMatrix((int)EyeIndex));

                        surface.Render();
                        surface.SetActiveRenderTexture();
                    }
                    else
                    {
                        //get viewport from ClientKit and set surface viewport
                        viewport = Viewer.DisplayController.DisplayConfig.GetRelativeViewportForViewerEyeSurface(
                            Viewer.ViewerIndex, (byte)_eyeIndex, surfaceIndex);

                        int displayInputIndex = Viewer.DisplayController.DisplayConfig.GetViewerEyeSurfaceDisplayInputIndex(Viewer.ViewerIndex, (byte)_eyeIndex, surfaceIndex);
                        int numDisplayInputs  = Viewer.DisplayController.DisplayConfig.GetNumDisplayInputs();
                        surface.SetViewportRect(Math.ConvertViewport(viewport, Viewer.DisplayController.DisplayConfig.GetDisplayDimensions((byte)displayInputIndex),
                                                                     numDisplayInputs, (int)_eyeIndex, (int)Viewer.DisplayController.TotalDisplayWidth));

                        //get projection matrix from ClientKit and set surface projection matrix
                        projMatrix = Viewer.DisplayController.DisplayConfig.GetProjectionMatrixForViewerEyeSurfacef(
                            Viewer.ViewerIndex, (byte)_eyeIndex, surfaceIndex,
                            surface.Camera.nearClipPlane, surface.Camera.farClipPlane, OSVR.ClientKit.MatrixConventionsFlags.ColMajor);

                        surface.SetProjectionMatrix(Math.ConvertMatrix(projMatrix));

                        //render the surface
                        surface.Render();
                    }
                }
            }