public void SetUndistortMethod(UndistortionMethod newMethod) { if (UndistortMethod == newMethod) { return; } if (ViveSR_DualCameraImageCapture.UndistortTextureIsNative) { EnableNativeMeshManipulation(false); if (UndistortMethod == UndistortionMethod.DEFISH_BY_SRMODULE) { RestoreToInitialLocalTransform(); } } UndistortMethod = newMethod; if (UndistortMethod == UndistortionMethod.DEFISH_BY_MESH) { if (distortMesh == null) { CreateMesh(NumVertexRows, NumVertexCols); } else { GetComponent <MeshFilter>().sharedMesh = distortMesh; } } else { if (planeMesh == null) { SetCorrectSize(); SetUV(CameraIndex); } else { GetComponent <MeshFilter>().sharedMesh = planeMesh; } if (UndistortMethod == UndistortionMethod.DEFISH_BY_SRMODULE && ViveSR_DualCameraImageCapture.UndistortTextureIsNative) { InitializeNativeMeshManipulation(); SetLocalTransformToIdentity(); if (gameObject.activeInHierarchy) { EnableNativeMeshManipulation(true); } } } if (meshRnd) { meshRnd.sharedMaterial = defaultMat; } }
private static void SetUndistortMode(UndistortionMethod method) { _UndistortMethod = method; if (_UndistortMethod == UndistortionMethod.DEFISH_BY_SRMODULE) { UpdateDistortedMaterial = false; UpdateUndistortedMaterial = true; } else { UpdateDistortedMaterial = true; UpdateUndistortedMaterial = false; } ViveSR_DualCameraRig.Instance.TrackedCameraLeft.ImagePlane.SetUndistortMethod(UndistortMethod); ViveSR_DualCameraRig.Instance.TrackedCameraRight.ImagePlane.SetUndistortMethod(UndistortMethod); ViveSR_DualCameraRig.Instance.TrackedCameraLeft.ImagePlaneCalibration.SetUndistortMethod(UndistortMethod); ViveSR_DualCameraRig.Instance.TrackedCameraRight.ImagePlaneCalibration.SetUndistortMethod(UndistortMethod); }