/// <summary> /// Start this instance. /// </summary> private void Start() { m_tangoApplication = FindObjectOfType <TangoApplication>(); if (m_tangoApplication != null) { if (AndroidHelper.IsTangoCorePresent()) { // Request Tango permissions m_tangoApplication.RegisterPermissionsCallback(_OnTangoApplicationPermissionsEvent); m_tangoApplication.RequestNecessaryPermissionsAndConnect(); m_tangoApplication.Register(this); m_tangoServiceVersionName = TangoApplication.GetTangoServiceVersion(); } else { // If no Tango Core is present let's tell the user to install it! StartCoroutine(_InformUserNoTangoCore()); } } else { Debug.Log("No Tango Manager found in scene."); } }
/// <summary> /// Data logging GUI. /// </summary> private void OnGUI() { Color oldColor = GUI.color; GUI.color = Color.black; if (m_tangoApplication.HasRequestedPermissions()) { int guiIndex = 0; string logString; GUI.Label(new Rect(UI_LABEL_START_X, UI_LABEL_START_Y, UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + String.Format(UX_TANGO_SERVICE_VERSION, TangoApplication.GetTangoServiceVersion()) + "</size>"); // MOTION TRACKING GUI.Label(new Rect(UI_LABEL_START_X, UI_POSE_LABEL_START_Y - UI_LABEL_OFFSET, UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + String.Format(UX_TARGET_TO_BASE_FRAME, "Device", "Start") + "</size>"); logString = String.Format(UX_STATUS, _GetLoggingStringFromPoseStatus(m_tangoPoseController.m_poseStatus[(int)AreaLearningPoseController.PoseFrame.DeviceToStart]), _GetLoggingStringFromFrameCount(m_tangoPoseController.m_poseCount[(int)AreaLearningPoseController.PoseFrame.DeviceToStart]), _GetLoggingStringFromVec3(m_tangoPoseController.m_tangoPosition[(int)AreaLearningPoseController.PoseFrame.DeviceToStart]), _GetLoggingStringFromQuaternion(m_tangoPoseController.m_tangoRotation[(int)AreaLearningPoseController.PoseFrame.DeviceToStart])); GUI.Label(new Rect(UI_LABEL_START_X, UI_POSE_LABEL_START_Y + (UI_LABEL_OFFSET * guiIndex), UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + logString + "</size>"); ++guiIndex; // ADF GUI.Label(new Rect(UI_LABEL_START_X, UI_POSE_LABEL_START_Y + (UI_LABEL_OFFSET * guiIndex), UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + String.Format(UX_TARGET_TO_BASE_FRAME, "Device", "ADF") + "</size>"); ++guiIndex; logString = String.Format(UX_STATUS, _GetLoggingStringFromPoseStatus(m_tangoPoseController.m_poseStatus[(int)AreaLearningPoseController.PoseFrame.DeviceToADF]), _GetLoggingStringFromFrameCount(m_tangoPoseController.m_poseCount[(int)AreaLearningPoseController.PoseFrame.DeviceToADF]), _GetLoggingStringFromVec3(m_tangoPoseController.m_tangoPosition[(int)AreaLearningPoseController.PoseFrame.DeviceToADF]), _GetLoggingStringFromQuaternion(m_tangoPoseController.m_tangoRotation[(int)AreaLearningPoseController.PoseFrame.DeviceToADF])); GUI.Label(new Rect(UI_LABEL_START_X, UI_POSE_LABEL_START_Y + (UI_LABEL_OFFSET * guiIndex), UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + logString + "</size>"); ++guiIndex; // RELOCALIZATION GUI.Label(new Rect(UI_LABEL_START_X, UI_POSE_LABEL_START_Y + (UI_LABEL_OFFSET * guiIndex), UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + String.Format(UX_TARGET_TO_BASE_FRAME, "Start", "ADF") + "</size>"); guiIndex++; logString = String.Format(UX_STATUS, _GetLoggingStringFromPoseStatus(m_tangoPoseController.m_poseStatus[(int)AreaLearningPoseController.PoseFrame.StartToADF]), _GetLoggingStringFromFrameCount(m_tangoPoseController.m_poseCount[(int)AreaLearningPoseController.PoseFrame.StartToADF]), _GetLoggingStringFromVec3(m_tangoPoseController.m_tangoPosition[(int)AreaLearningPoseController.PoseFrame.StartToADF]), _GetLoggingStringFromQuaternion(m_tangoPoseController.m_tangoRotation[(int)AreaLearningPoseController.PoseFrame.StartToADF])); GUI.Label(new Rect(UI_LABEL_START_X, UI_POSE_LABEL_START_Y + (UI_LABEL_OFFSET * guiIndex), UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + logString + "</size>"); ++guiIndex; } GUI.color = oldColor; }
/// <summary> /// Unity Start() callback, we set up some initial values here. /// </summary> void Start() { m_currentFPS = 0; m_framesSinceUpdate = 0; m_currentTime = 0.0f; m_FPSText = "FPS = Calculating"; m_label = new Rect(Screen.width * 0.025f - 50, Screen.height * 0.96f - 25, 600.0f, 50.0f); m_tangoApplication = FindObjectOfType <TangoApplication>(); m_tangoServiceVersion = TangoApplication.GetTangoServiceVersion(); }
/// <summary> /// Unity Start() callback, we set up some initial values here. /// </summary> public void Start() { m_currentFPS = 0; m_framesSinceUpdate = 0; m_currentTime = 0.0f; m_fpsText = "FPS = Calculating"; m_tangoApplication = FindObjectOfType <TangoApplication>(); m_tangoPose = FindObjectOfType <TangoARPoseController>(); m_arCameraPostProcess = FindObjectOfType <ARCameraPostProcess>(); m_tangoServiceVersion = TangoApplication.GetTangoServiceVersion(); }
public void Start() { m_tangoApplication = FindObjectOfType <TangoApplication>(); m_tangoPose = FindObjectOfType <TangoARPoseController>(); m_tangoServiceVersion = TangoApplication.GetTangoServiceVersion(); m_tangoApplication.Register(this); for (int i = 0; i < _Selectables.Length; i++) { Debug.Log(_Selectables[i]._SelectableType.ToString() + " " + i); _selectablesMap.Add(_Selectables[i]._SelectableType, i); } }
/// <summary> /// Start this instance. /// </summary> public void Start() { m_tangoServiceVersionName = TangoApplication.GetTangoServiceVersion(); TangoApplication tangoApplication = FindObjectOfType <TangoApplication>(); if (tangoApplication != null) { tangoApplication.Register(this); } else { Debug.Log("No Tango Manager found in scene."); } }
//Unity Start() callback, we set up some initial values here. public void Start() { m_currentFPS = 0; m_framesSinceUpdate = 0; m_currentTime = 0.0f; m_fpsText = "FPS = Calculating"; m_tangoApplication = FindObjectOfType <TangoApplication>(); m_tangoPose = FindObjectOfType <TangoARPoseController>(); m_arCameraPostProcess = FindObjectOfType <ARCameraPostProcess>(); m_tangoServiceVersion = TangoApplication.GetTangoServiceVersion(); //show screenshot icon after a screenshot screenshotPic = GameObject.Find("screenshotPic"); this.screenshotPic.SetActive(false); }
/// <summary> /// Unity Start() callback, we set up some initial values here. /// </summary> public void Start() { m_currentFPS = 0; m_framesSinceUpdate = 0; m_currentTime = 0.0f; m_fpsText = "FPS = Calculating"; m_tangoApplication = FindObjectOfType <TangoApplication>(); m_tangoPose = FindObjectOfType <TangoARPoseController>(); m_arCameraPostProcess = FindObjectOfType <ARCameraPostProcess>(); m_tangoServiceVersion = TangoApplication.GetTangoServiceVersion(); m_tangoApplication.Register(this); #region Cfd _cfdManager = new CfdSceneManagerV2(); _cfdManager.DefaultMaterial = defaultMaterial; _cfdManager.VertexColorMaterial = vertexColorMaterial; _cfdManager.CfdShader = shader; _cfdManager.Start(); #endregion }
private void Start() { m_tangoApplication = FindObjectOfType <TangoApplication>(); if (m_tangoApplication != null) { // Request Tango permissions m_tangoApplication.RequestNecessaryPermissions(); if (TangoApplication.HasGrantedPermissions()) { m_tangoApplication.InitApplication(); if (m_useADF) { // Query the full adf list. PoseProvider.RefreshADFList(); // loading last recorded ADF string uuid = PoseProvider.GetLatestADFUUID().GetStringDataUUID(); m_tangoApplication.InitProviders(uuid); } else { m_tangoApplication.InitProviders(string.Empty); } m_tangoApplication.ConnectToService(); } else { Debug.Log("Tango can't be initialized because of invalid permissions"); } } else { Debug.Log("No Tango Manager found in scene."); } m_tangoServiceVersionName = TangoApplication.GetTangoServiceVersion(); }
/// <summary> /// Unity GUI callback. /// </summary> public void OnGUI() { if (m_tangoApplication.HasRequiredPermissions) { Color oldColor = GUI.color; GUI.color = Color.black; GUI.Label(new Rect(UI_LABEL_START_X, UI_LABEL_START_Y, UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + String.Format(UX_TANGO_SERVICE_VERSION, TangoApplication.GetTangoServiceVersion()) + "</size>"); GUI.Label(new Rect(UI_LABEL_START_X, UI_FPS_LABEL_START_Y, UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + m_fpsText + "</size>"); // MOTION TRACKING GUI.Label(new Rect(UI_LABEL_START_X, UI_POSE_LABEL_START_Y - UI_LABEL_OFFSET, UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + String.Format(UX_TARGET_TO_BASE_FRAME, "Device", "Start") + "</size>"); string logString = String.Format(UX_STATUS, _GetLoggingStringFromPoseStatus(m_tangoPoseController.m_poseStatus), _GetLoggingStringFromFrameCount(m_tangoPoseController.m_poseCount), _GetLoggingStringFromVec3(m_tangoPoseController.transform.position), _GetLoggingStringFromQuaternion(m_tangoPoseController.transform.rotation)); GUI.Label(new Rect(UI_LABEL_START_X, UI_POSE_LABEL_START_Y, UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + logString + "</size>"); GUI.Label(new Rect(UI_LABEL_START_X, UI_DEPTH_LABLE_START_Y, UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + "Average depth (m): " + m_pointcloud.m_overallZ.ToString() + "</size>"); GUI.Label(new Rect(UI_LABEL_START_X, UI_DEPTH_LABLE_START_Y + (UI_LABEL_OFFSET * 1.0f), UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + "Point count: " + m_pointcloud.m_pointsCount.ToString() + "</size>"); GUI.Label(new Rect(UI_LABEL_START_X, UI_DEPTH_LABLE_START_Y + (UI_LABEL_OFFSET * 2.0f), UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + "Frame delta time (ms): " + m_pointcloud.m_depthDeltaTime.ToString(UI_FLOAT_FORMAT) + "</size>"); GUI.color = oldColor; } }
/// <summary> /// Unity GUI callback. /// </summary> public void OnGUI() { if (m_tangoApplication.HasRequestedPermissions()) { Color oldColor = GUI.color; GUI.color = Color.white; if (GUI.Button(new Rect(UI_BUTTON_GAP_X, Screen.height - (UI_BUTTON_SIZE_Y + UI_LABEL_GAP_Y), UI_BUTTON_SIZE_X + 100, UI_BUTTON_SIZE_Y), "<size=20>Reset motion tracking</size>")) { PoseProvider.ResetMotionTracking(); } GUI.color = Color.black; GUI.Label(new Rect(UI_LABEL_START_X, UI_LABEL_START_Y, UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + String.Format(UX_TANGO_SERVICE_VERSION, TangoApplication.GetTangoServiceVersion()) + "</size>"); GUI.Label(new Rect(UI_LABEL_START_X, UI_FPS_LABEL_START_Y, UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + m_fpsText + "</size>"); // MOTION TRACKING GUI.Label(new Rect(UI_LABEL_START_X, UI_POSE_LABEL_START_Y - UI_LABEL_OFFSET, UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + String.Format(UX_TARGET_TO_BASE_FRAME, "Device", "Start") + "</size>"); string logString = String.Format(UX_STATUS, _GetLoggingStringFromPoseStatus(m_tangoPoseController.m_poseStatus), _GetLoggingStringFromFrameCount(m_tangoPoseController.m_poseCount), _GetLoggingStringFromVec3(m_tangoPoseController.transform.position), _GetLoggingStringFromQuaternion(m_tangoPoseController.transform.rotation)); GUI.Label(new Rect(UI_LABEL_START_X, UI_POSE_LABEL_START_Y, UI_LABEL_SIZE_X, UI_LABEL_SIZE_Y), UI_FONT_SIZE + logString + "</size>"); GUI.color = oldColor; } }
/// <summary> /// GUI for switch getting data API and status. /// </summary> private void OnGUI() { if (TangoApplication.HasRequestedPermissions()) { Color oldColor = GUI.color; GUI.color = Color.gray; if (!TangoApplication.HasGrantedPermissions()) { GUI.Label(new Rect(Common.UI_LABEL_START_X, Common.UI_LABEL_START_Y, Common.UI_LABEL_SIZE_X, Common.UI_LABEL_SIZE_Y), "<size=15>" + Common.TANGO_NO_PERMISSIONS_ERROR + "</size>"); return; } GUI.Label(new Rect(Common.UI_LABEL_START_X, Common.UI_LABEL_START_Y, Common.UI_LABEL_SIZE_X, Common.UI_LABEL_SIZE_Y), "<size=15>" + String.Format(Common.UX_TANGO_SERVICE_VERSION, TangoApplication.GetTangoServiceVersion()) + "</size>"); GUI.Label(new Rect(Common.UI_LABEL_START_X, Common.UI_LABEL_START_Y + Common.UI_LABEL_OFFSET, Common.UI_LABEL_SIZE_X, Common.UI_LABEL_SIZE_Y), "<size=15>Point Count: " + pointcloud.m_pointsCount.ToString() + "</size>"); GUI.Label(new Rect(Common.UI_LABEL_START_X, Common.UI_LABEL_START_Y + Common.UI_LABEL_OFFSET * 2.0f, Common.UI_LABEL_SIZE_X, Common.UI_LABEL_SIZE_Y), "<size=15>Average Depth (m): " + pointcloud.m_overallZ.ToString() + "</size>"); GUI.Label(new Rect(Common.UI_LABEL_START_X, Common.UI_LABEL_START_Y + Common.UI_LABEL_OFFSET * 3.0f, Common.UI_LABEL_SIZE_X, Common.UI_LABEL_SIZE_Y), "<size=15>Frame Delta Time (ms): " + pointcloud.GetTimeSinceLastFrame().ToString("0.") + "</size>"); GUI.color = oldColor; } }