private void Awake() { var solverHandler = GetComponent <SolverHandler>(); _gazeProvider = CoreServices.InputSystem?.EyeGazeProvider; if (_gazeProvider != null) { solverHandler.TransformOverride = Target; } }
//private Dictionary<System.Guid, ScanContext> scanContextMap = new Dictionary<System.Guid, ScanContext>(); // we may use a dictionary to store many scans waiting for results ... let's start with one for now // Use this for initialization void Start() { angleRadian = horizontalAngle * (Math.PI / 180); gaze = CoreServices.InputSystem.GazeProvider; cursor?.SetActive(false);//disable cursor shutterSound = GetComponent <AudioSource>() as AudioSource; labeler = GetComponent <ObjectLabeler>() as ObjectLabeler; mqttHelper = GetComponent <MqttHelper>() as MqttHelper; mqttHelper.Subscribe(ResultReceiver); // Debug.Log("File path " + Application.persistentDataPath); // take lower resolution available if ((PhotoCapture.SupportedResolutions != null) && (PhotoCapture.SupportedResolutions.Count() > 0)) { cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).Last(); ratio = (float)cameraResolution.height / (float)cameraResolution.width; Debug.Log("Resolution " + cameraResolution.height + " x " + cameraResolution.width); } else { ratio = 9f / 16f; } scanContext = new ScanContext(horizontalAngle, ratio, Camera.main.transform); // create a context with Camera position. ScannerScreen.SetActive(false); // remove the scanner Vector3 scale = ScannerScreen.transform.localScale; scale.x = 2f * scannerScreenDistance * (float)Math.Tan(angleRadian / 2f); scale.y = scale.x * ratio; // scale the entire photo on height ScannerScreen.transform.localScale = scale; Debug.Log("scanContext init " + scanContext.ToString()); // Create a PhotoCapture object PhotoCapture.CreateAsync(false, delegate(PhotoCapture captureObject) { photoCaptureObject = captureObject; CameraParameters cameraParameters = new CameraParameters(); cameraParameters.hologramOpacity = 0.0f; cameraParameters.cameraResolutionWidth = cameraResolution.width; cameraParameters.cameraResolutionHeight = cameraResolution.height; cameraParameters.pixelFormat = CapturePixelFormat.BGRA32; //cameraParameters.pixelFormat = showPicture == true ? CapturePixelFormat.BGRA32 : CapturePixelFormat.JPEG; photoCaptureObject.StartPhotoModeAsync(cameraParameters, delegate(PhotoCapture.PhotoCaptureResult result) { // Take a picture Debug.Log("camera ready to take picture"); }); }); PointerUtils.SetGazePointerBehavior(PointerBehavior.AlwaysOn); }