public void ToggleEditMenu() { // Close upload menu if already open. if (editMenu.activeSelf) { editMenu.SetActive(false); EnableCloudAndTracker(true); return; } // Only edit target if it exists. if (targetsInCamera < 1) { Debug.Log("There must be a target to edit!"); PrintStatusText("There must be a target to edit!"); return; } // Set current input fields to target profile data. SetInputFields(editMenu, false); texture = CameraImageAccess.GetLatestTexture(); rawImage.texture = texture; rawImage.material.mainTexture = texture; editMenu.SetActive(true); EnableCloudAndTracker(false); }
void Start() { if (Instance == null) { Instance = this; Debug.Log("CustomMessage: Start CameraImageAccess"); } else { Debug.Log("CustomMessage: Destroy CameraImageAccess"); Destroy(gameObject); return; } #if UNITY_EDITOR mPixelFormat = Vuforia.PIXEL_FORMAT.GRAYSCALE; // Need Grayscale for Editor texture = new Texture2D(Screen.width, Screen.height, TextureFormat.Alpha8, false); #else mPixelFormat = Vuforia.PIXEL_FORMAT.RGB888; // Use RGB888 for mobile texture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); #endif // Register Vuforia life-cycle callbacks: VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted); VuforiaARController.Instance.RegisterTrackablesUpdatedCallback(OnTrackablesUpdated); VuforiaARController.Instance.RegisterOnPauseCallback(OnPause); // Remove the pixel format (in case it was previously set); // note that we are passing "false" here. // OnPause(true); // OnPause(false); }
public void ToggleUploadMenu() { // Close upload menu if already open. if (uploadMenu.activeSelf) { uploadMenu.SetActive(false); EnableCloudAndTracker(true); return; } // Only post target if there is no other targets in camera. if (targetsInCamera > 0) { Debug.Log("There must be no targets present to upload!"); PrintStatusText("There must be no targets present to upload!"); return; } // Only post target if camera quality is medium or high. if (userDefinedTargetHandler.m_FrameQuality != Vuforia.ImageTargetBuilder.FrameQuality.FRAME_QUALITY_MEDIUM && userDefinedTargetHandler.m_FrameQuality != Vuforia.ImageTargetBuilder.FrameQuality.FRAME_QUALITY_HIGH) { Debug.Log("Camera frame quality: " + userDefinedTargetHandler.m_FrameQuality); PrintStatusText("Camera frame must be in medium or high quality!"); return; } // Clear input fields. SetInputFields(uploadMenu, true); texture = CameraImageAccess.GetLatestTexture(); rawImage.texture = texture; rawImage.material.mainTexture = texture; uploadMenu.SetActive(true); EnableCloudAndTracker(false); }