Exemplo n.º 1
0
        private void RefreshCamera()
        {
            CardboardLensDistortion.RetrieveEyeMeshes();
            CardboardLensDistortion.RefreshProjectionMatrix();

            Matrix4x4 leftMatrix = CardboardLensDistortion.GetProjectionMatrix(CardboardEye.kLeft);

            if (!leftMatrix.Equals(Matrix4x4.zero))
            {
                leftCam.projectionMatrix = leftMatrix;
            }
            Matrix4x4 rightMatrix = CardboardLensDistortion.GetProjectionMatrix(CardboardEye.kRight);

            if (!rightMatrix.Equals(Matrix4x4.zero))
            {
                rightCam.projectionMatrix = rightMatrix;
            }

            (CardboardMesh, CardboardMesh)eyeMeshes = CardboardLensDistortion.GetEyeMeshes();
            CardboardDistortionRenderer.SetEyeMeshes(eyeMeshes.Item1, eyeMeshes.Item2);
            CardboardManager.SetEyeMesh(
                CardboardUtility.ConvertCardboardMesh_Triangle(eyeMeshes.Item1),
                CardboardUtility.ConvertCardboardMesh_Triangle(eyeMeshes.Item2));
            testEyeMeshLeft.mesh  = CardboardManager.viewMeshLeft;
            testEyeMeshRight.mesh = CardboardManager.viewMeshRight;

            NativeDataExtract.Save_MeshJson(eyeMeshes.Item1);
            NativeDataExtract.Save_MeshJson(eyeMeshes.Item2);
        }
Exemplo n.º 2
0
        private void DoRenderTest()
        {
            CardboardEyeTextureDescription cetdLeft = new CardboardEyeTextureDescription()
            {
                texture       = centerRenderTexture.GetNativeTexturePtr(),
                eye_from_head = CardboardLensDistortion.GetEyeFromHeadRaw(CardboardEye.kLeft),
                left_u        = 0,
                right_u       = 1,
                bottom_v      = 0,
                top_v         = 1,
                layer         = 0
            };

            CardboardDistortionRenderer.RenderEyeToDisplay(cetdLeft, cetdLeft);
        }
Exemplo n.º 3
0
        private void ResetProfile()
        {
            CardboardQrCode.RetrieveDeviceParam();
            (IntPtr, int)par = CardboardQrCode.GetDeviceParamsPointer();

            if (par.Item2 == 0 && !Application.isEditor)
            {
                ScanQRCode();
                return;
            }

            //CardboardLensDistortion.DestroyLensDistortion();
            CardboardLensDistortion.CreateLensDistortion(par.Item1, par.Item2);
            RefreshCamera();

            // needUpdateProfile = false;

            (byte[], int)paramDetailVar = CardboardQrCode.GetDeviceParamsByte();
            NativeDataExtract.Save_EncodedParam(paramDetailVar.Item1, paramDetailVar.Item2);
        }