Esempio n. 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();
                }
            }
Esempio n. 2
0
 //Convert OSVR.ClientKit.Matrix44f to Matrix4x4
 public static Matrix4x4 ConvertMatrix(OSVR.ClientKit.Matrix44f matrix)
 {
     Matrix4x4 matrix4x4 = new Matrix4x4();
     matrix4x4[0, 0] = matrix.M0;
     matrix4x4[1, 0] = matrix.M1;
     matrix4x4[2, 0] = matrix.M2;
     matrix4x4[3, 0] = matrix.M3;
     matrix4x4[0, 1] = matrix.M4;
     matrix4x4[1, 1] = matrix.M5;
     matrix4x4[2, 1] = matrix.M6;
     matrix4x4[3, 1] = matrix.M7;
     matrix4x4[0, 2] = matrix.M8;
     matrix4x4[1, 2] = matrix.M9;
     matrix4x4[2, 2] = matrix.M10;
     matrix4x4[3, 2] = matrix.M11;
     matrix4x4[0, 3] = matrix.M12;
     matrix4x4[1, 3] = matrix.M13;
     matrix4x4[2, 3] = matrix.M14;
     matrix4x4[3, 3] = matrix.M15;
     return matrix4x4;// * Matrix4x4.Scale(new Vector3(1, -1, 1)); ;
 }
Esempio n. 3
0
 /// <summary>
 /// Convert an OSVR Matrix44f to a SharpDX Matrix.
 /// </summary>
 /// <param name="ovrMatrix4f">ovrMatrix4f to convert to a SharpDX Matrix.</param>
 /// <returns>SharpDX Matrix, based on the ovrMatrix4f.</returns>
 public static Matrix ToMatrix(this OSVR.ClientKit.Matrix44f projectionf)
 {
     return(new Matrix()
     {
         M11 = projectionf.M0,
         M12 = projectionf.M1,
         M13 = projectionf.M2,
         M14 = projectionf.M3,
         M21 = projectionf.M4,
         M22 = projectionf.M5,
         M23 = projectionf.M6,
         M24 = projectionf.M7,
         M31 = projectionf.M8,
         M32 = projectionf.M9,
         M33 = projectionf.M10,
         M34 = projectionf.M11,
         M41 = projectionf.M12,
         M42 = projectionf.M13,
         M43 = projectionf.M14,
         M44 = projectionf.M15
     });
 }
Esempio n. 4
0
            //Convert OSVR.ClientKit.Matrix44f to Matrix4x4
            public static Matrix4x4 ConvertMatrix(OSVR.ClientKit.Matrix44f matrix)
            {
                Matrix4x4 matrix4x4 = new Matrix4x4();

                matrix4x4[0, 0] = matrix.M0;
                matrix4x4[1, 0] = matrix.M1;
                matrix4x4[2, 0] = matrix.M2;
                matrix4x4[3, 0] = matrix.M3;
                matrix4x4[0, 1] = matrix.M4;
                matrix4x4[1, 1] = matrix.M5;
                matrix4x4[2, 1] = matrix.M6;
                matrix4x4[3, 1] = matrix.M7;
                matrix4x4[0, 2] = matrix.M8;
                matrix4x4[1, 2] = matrix.M9;
                matrix4x4[2, 2] = matrix.M10;
                matrix4x4[3, 2] = matrix.M11;
                matrix4x4[0, 3] = matrix.M12;
                matrix4x4[1, 3] = matrix.M13;
                matrix4x4[2, 3] = matrix.M14;
                matrix4x4[3, 3] = matrix.M15;
                return(matrix4x4);
            }