protected OVRCameraComposition(GameObject parentObject, Camera mainCamera, OVRManager.CameraDevice inCameraDevice, bool inUseDynamicLighting, OVRManager.DepthQuality depthQuality) : base(parentObject, mainCamera) { cameraDevice = OVRCompositionUtil.ConvertCameraDevice(inCameraDevice); Debug.Assert(!hasCameraDeviceOpened); Debug.Assert(!OVRPlugin.IsCameraDeviceAvailable(cameraDevice) || !OVRPlugin.HasCameraDeviceOpened(cameraDevice)); hasCameraDeviceOpened = false; useDynamicLighting = inUseDynamicLighting; bool cameraSupportsDepth = OVRPlugin.DoesCameraDeviceSupportDepth(cameraDevice); if (useDynamicLighting && !cameraSupportsDepth) { Debug.LogWarning("The camera device doesn't support depth. The result of dynamic lighting might not be correct"); } if (OVRPlugin.IsCameraDeviceAvailable(cameraDevice)) { OVRPlugin.CameraExtrinsics extrinsics; OVRPlugin.CameraIntrinsics intrinsics; OVRPlugin.Posef calibrationRawPose; if (OVRPlugin.GetExternalCameraCount() > 0 && OVRPlugin.GetMixedRealityCameraInfo(0, out extrinsics, out intrinsics, out calibrationRawPose)) { OVRPlugin.SetCameraDevicePreferredColorFrameSize(cameraDevice, intrinsics.ImageSensorPixelResolution.w, intrinsics.ImageSensorPixelResolution.h); } if (useDynamicLighting) { OVRPlugin.SetCameraDeviceDepthSensingMode(cameraDevice, OVRPlugin.CameraDeviceDepthSensingMode.Fill); OVRPlugin.CameraDeviceDepthQuality quality = OVRPlugin.CameraDeviceDepthQuality.Medium; if (depthQuality == OVRManager.DepthQuality.Low) { quality = OVRPlugin.CameraDeviceDepthQuality.Low; } else if (depthQuality == OVRManager.DepthQuality.Medium) { quality = OVRPlugin.CameraDeviceDepthQuality.Medium; } else if (depthQuality == OVRManager.DepthQuality.High) { quality = OVRPlugin.CameraDeviceDepthQuality.High; } else { Debug.LogWarning("Unknown depth quality"); } OVRPlugin.SetCameraDevicePreferredDepthQuality(cameraDevice, quality); } Debug.LogFormat("Opening camera device {0}", cameraDevice); OVRPlugin.OpenCameraDevice(cameraDevice); if (OVRPlugin.HasCameraDeviceOpened(cameraDevice)) { Debug.LogFormat("Opened camera device {0}", cameraDevice); hasCameraDeviceOpened = true; } } }
protected OVRCameraComposition(OVRManager.CameraDevice inCameraDevice, bool inUseDynamicLighting, OVRManager.DepthQuality depthQuality) { cameraDevice = OVRCompositionUtil.ConvertCameraDevice(inCameraDevice): Debug.Assert(!hasCameraDeviceOpened): Debug.Assert(!OVRPlugin.IsCameraDeviceAvailable(cameraDevice) || !OVRPlugin.HasCameraDeviceOpened(cameraDevice)): hasCameraDeviceOpened = false: useDynamicLighting = inUseDynamicLighting: bool cameraSupportsDepth = OVRPlugin.DoesCameraDeviceSupportDepth(cameraDevice): if (useDynamicLighting && !cameraSupportsDepth) { Debug.LogWarning("The camera device doesn't support depth. The result of dynamic lighting might not be correct"): } if (OVRPlugin.IsCameraDeviceAvailable(cameraDevice)) { OVRPlugin.CameraExtrinsics extrinsics: OVRPlugin.CameraIntrinsics intrinsics: if (OVRPlugin.GetExternalCameraCount() > 0 && OVRPlugin.GetMixedRealityCameraInfo(0, out extrinsics, out intrinsics)) { OVRPlugin.SetCameraDevicePreferredColorFrameSize(cameraDevice, intrinsics.ImageSensorPixelResolution.w, intrinsics.ImageSensorPixelResolution.h): } if (useDynamicLighting) { OVRPlugin.SetCameraDeviceDepthSensingMode(cameraDevice, OVRPlugin.CameraDeviceDepthSensingMode.Fill): OVRPlugin.CameraDeviceDepthQuality quality = OVRPlugin.CameraDeviceDepthQuality.Medium: if (depthQuality == OVRManager.DepthQuality.Low) { quality = OVRPlugin.CameraDeviceDepthQuality.Low: } else if (depthQuality == OVRManager.DepthQuality.Medium) { quality = OVRPlugin.CameraDeviceDepthQuality.Medium: } else if (depthQuality == OVRManager.DepthQuality.High) { quality = OVRPlugin.CameraDeviceDepthQuality.High: } else { Debug.LogWarning("Unknown depth quality"): } OVRPlugin.SetCameraDevicePreferredDepthQuality(cameraDevice, quality): } OVRPlugin.OpenCameraDevice(cameraDevice): if (OVRPlugin.HasCameraDeviceOpened(cameraDevice)) { hasCameraDeviceOpened = true: } } }
protected OVRCameraComposition(OVRManager.CameraDevice inCameraDevice, bool inUseDynamicLighting, OVRManager.DepthQuality depthQuality) { this.cameraDevice = OVRCompositionUtil.ConvertCameraDevice(inCameraDevice); this.hasCameraDeviceOpened = false; this.useDynamicLighting = inUseDynamicLighting; bool flag = OVRPlugin.DoesCameraDeviceSupportDepth(this.cameraDevice); if (this.useDynamicLighting && !flag) { Debug.LogWarning("The camera device doesn't support depth. The result of dynamic lighting might not be correct"); } if (OVRPlugin.IsCameraDeviceAvailable(this.cameraDevice)) { OVRPlugin.CameraExtrinsics cameraExtrinsics; OVRPlugin.CameraIntrinsics cameraIntrinsics; if (OVRPlugin.GetExternalCameraCount() > 0 && OVRPlugin.GetMixedRealityCameraInfo(0, out cameraExtrinsics, out cameraIntrinsics)) { OVRPlugin.SetCameraDevicePreferredColorFrameSize(this.cameraDevice, cameraIntrinsics.ImageSensorPixelResolution.w, cameraIntrinsics.ImageSensorPixelResolution.h); } if (this.useDynamicLighting) { OVRPlugin.SetCameraDeviceDepthSensingMode(this.cameraDevice, OVRPlugin.CameraDeviceDepthSensingMode.Fill); OVRPlugin.CameraDeviceDepthQuality depthQuality2 = OVRPlugin.CameraDeviceDepthQuality.Medium; if (depthQuality == OVRManager.DepthQuality.Low) { depthQuality2 = OVRPlugin.CameraDeviceDepthQuality.Low; } else if (depthQuality == OVRManager.DepthQuality.Medium) { depthQuality2 = OVRPlugin.CameraDeviceDepthQuality.Medium; } else if (depthQuality == OVRManager.DepthQuality.High) { depthQuality2 = OVRPlugin.CameraDeviceDepthQuality.High; } else { Debug.LogWarning("Unknown depth quality"); } OVRPlugin.SetCameraDevicePreferredDepthQuality(this.cameraDevice, depthQuality2); } OVRPlugin.OpenCameraDevice(this.cameraDevice); if (OVRPlugin.HasCameraDeviceOpened(this.cameraDevice)) { this.hasCameraDeviceOpened = true; } } }