Inheritance: MonoBehaviour
Esempio n. 1
0
 private static void CardboardLensDistortion_getDistortionMesh(
     IntPtr lens_Distortion, CardboardEye eye, ref CardboardMesh mesh)
 {
     if (eye == CardboardEye.kLeft)
     {
         mesh = new CardboardMesh()
         {
             vertices   = new[] { -0.65f, -0.25f, -0.65f, 0.25f, -0.125f, -0.25f, -0.125f, 0.25f },
             n_vertices = 4,
             indices    = new[] { 0, 1, 2, 3 },
             n_indices  = 4,
             uvs        = new[] { 0f, 0f, 0f, 1f, 1f, 0f, 1f, 1f }
         };
     }
     else
     {
         mesh = new CardboardMesh()
         {
             vertices   = new[] { 0.125f, -0.25f, 0.125f, 0.25f, 0.65f, -0.25f, 0.65f, 0.25f },
             n_vertices = 4,
             indices    = new[] { 0, 1, 2, 3 },
             n_indices  = 4,
             uvs        = new[] { 0f, 0f, 0f, 1f, 1f, 0f, 1f, 1f }
         };
     }
 }
        public static CardboardMesh CreateMockupCardboardMesh(CardboardEye eye)
        {
            CardboardMesh result;

            if (eye == CardboardEye.kLeft)
            {
                result = new CardboardMesh()
                {
                    vertices   = new[] { -0.9f, -0.9f, -0.9f, 0.9f, -0.1f, -0.9f, -0.1f, 0.9f },
                    n_vertices = 4,
                    indices    = new[] { 0, 1, 2, 3 },
                    n_indices  = 4,
                    uvs        = new[] { 0f, 0f, 0f, 1f, 1f, 0f, 1f, 1f }
                };
            }
            else
            {
                result = new CardboardMesh()
                {
                    vertices   = new[] { 0.1f, -0.9f, 0.1f, 0.9f, 0.9f, -0.9f, 0.9f, 0.9f },
                    n_vertices = 4,
                    indices    = new[] { 0, 1, 2, 3 },
                    n_indices  = 4,
                    uvs        = new[] { 0f, 0f, 0f, 1f, 1f, 0f, 1f, 1f }
                };
            }

            return(result);
        }
Esempio n. 3
0
        public static float[] GetEyeFromHeadRaw(CardboardEye eye)
        {
            if (eyeFromHeadMatrixLeft == null || eyeFromHeadMatrixRight == null)
            {
                RefreshProjectionMatrix();
            }

            return(eye == CardboardEye.kLeft ? eyeFromHeadMatrixLeft : eyeFromHeadMatrixRight);
        }
Esempio n. 4
0
        public static Matrix4x4 GetEyeFromHeadMatrix(CardboardEye eye)
        {
            if (eyeFromHeadMatrixLeft == null || eyeFromHeadMatrixRight == null)
            {
                RefreshProjectionMatrix();
            }

            float[] targetMatrix = eye == CardboardEye.kLeft ? eyeFromHeadMatrixLeft : eyeFromHeadMatrixRight;

            return(CardboardUtility.ArrayToMatrix4x4(targetMatrix));
        }
Esempio n. 5
0
        public static Matrix4x4 GetEyeFromHeadMatrix(CardboardEye eye)
        {
            if (eyeFromHeadMatrixLeft == null || eyeFromHeadMatrixRight == null)
            {
                RefreshProjectionMatrix();
            }

            Matrix4x4 result = new Matrix4x4();

            float[] targetMatrix = eye == CardboardEye.kLeft ? eyeFromHeadMatrixLeft : eyeFromHeadMatrixRight;
            for (int i = 0; i < targetMatrix.Length; i++)
            {
                result[i] = targetMatrix[i];
            }
            return(result);
        }
 private static void CardboardDistortionRenderer_setMesh(
     IntPtr renderer, ref CardboardMesh mesh, CardboardEye eye)
 {
 }
Esempio n. 7
0
 private static CardboardUv CardboardLensDistortion_undistortedUvForDistortedUv(
     IntPtr lens_Distortion, CardboardUv distorted_uv, CardboardEye eye)
 {
     return(distorted_uv);
 }
Esempio n. 8
0
 private static void CardboardLensDistortion_getEyeMatrices(
     IntPtr lens_Distortion, float[] projection_matrix, float[] eye_from_head_matrix, CardboardEye eye)
 {
     CardboardUtility.Matrix4x4ToArray(Matrix4x4.Perspective(70, 0.8f, 0.5f, 1000)).CopyTo(projection_matrix, 0);
     // projection_matrix.Initialize();
     eye_from_head_matrix.Initialize();
 }
Esempio n. 9
0
 private static void CardboardLensDistortion_getDistortionMesh(
     IntPtr lens_Distortion, CardboardEye eye, ref CardboardMesh mesh)
 {
     mesh = CardboardUtility.CreateMockupCardboardMesh(eye);
 }
Esempio n. 10
0
 private static extern CardboardUv CardboardLensDistortion_undistortedUvForDistortedUv(
     IntPtr lens_Distortion, CardboardUv distorted_uv, CardboardEye eye);
Esempio n. 11
0
 private static extern void CardboardLensDistortion_getEyeMatrices(
     IntPtr lens_Distortion, float[] projection_matrix, float[] eye_from_head_matrix, CardboardEye eye);
Esempio n. 12
0
 private static extern void CardboardLensDistortion_getDistortionMesh(
     IntPtr lens_Distortion, CardboardEye eye, ref CardboardMesh mesh);
Esempio n. 13
0
 private static void CardboardLensDistortion_getEyeMatrices(
     IntPtr lens_Distortion, float[] projection_matrix, float[] eye_from_head_matrix, CardboardEye eye)
 {
     projection_matrix.Initialize();
     eye_from_head_matrix.Initialize();
 }
Esempio n. 14
0
 private static void CardboardLensDistortion_getFieldOfView(IntPtr lens_Distortion, CardboardEye eye,
                                                            ref float field_of_view)
 {
     field_of_view = 60.0f;
 }
Esempio n. 15
0
 private static void CardboardLensDistortion_getEyeFromHeadMatrix(IntPtr lens_Distortion, CardboardEye eye,
                                                                  float[] eye_from_head_matrix)
 {
     eye_from_head_matrix.Initialize();
 }
Esempio n. 16
0
 private static void CardboardLensDistortion_getProjectionMatrix(IntPtr lens_Distortion, CardboardEye eye,
                                                                 float z_near, float z_far, float[] projection_matrix)
 {
     CardboardUtility.Matrix4x4ToArray(Matrix4x4.Perspective(70, 0.8f, 0.5f, 1000)).CopyTo(projection_matrix, 0);
 }
Esempio n. 17
0
 private static extern void CardboardLensDistortion_getEyeFromHeadMatrix(IntPtr lens_Distortion, CardboardEye eye, float[] eye_from_head_matrix);
Esempio n. 18
0
 private static extern void CardboardLensDistortion_getProjectionMatrix(IntPtr lens_Distortion, CardboardEye eye, float z_near, float z_far, float[] projection_matrix);