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); }
private void Awake() { CardboardMesh cMeshData = JsonUtility.FromJson <CardboardMesh>(meshDataRaw.text); // CardboardMesh cMeshData = GetEditorTestMesh(); Mesh unityMesh = CardboardUtility.ConvertCardboardMesh_Triangle(cMeshData); meshFilter.mesh = unityMesh; }
// Matrix, col 0 to col 3: // right, up, forward, all of them are normalized void Start() { Debug.LogFormat("Origin Pos={0}, Quat={1}, \r\neuler={2}, \r\nup={3}, forward={4}", testTransform.localPosition.ToString("F4"), testTransform.localRotation.ToString("F4"), testTransform.localEulerAngles.ToString("F4"), testTransform.up.ToString("F4"), testTransform.forward.ToString("F4")); Matrix4x4 testMat = CardboardUtility.GetTransformTRSMatrix(testTransform); Debug.LogFormat("matrix=\r\n{0}", testMat); Pose newPose = CardboardUtility.GetPoseFromTRSMatrix(testMat); Debug.LogFormat("newPose Pos={0}, Quat={1}, euler={2}", newPose.position.ToString("F4"), newPose.rotation.ToString("F4"), newPose.rotation.eulerAngles.ToString("F4")); }