/// <summary> /// Shutdown this instance. /// </summary> private void OnDestroy() { if (m_applicationHandle != System.IntPtr.Zero) { TangoApplicationAPI.ApplicationShutdown(m_applicationHandle); } }
void LateUpdate() { //load next frame if (mApplicationHandler != System.IntPtr.Zero) { Common.RetCodes retCode = (Common.RetCodes)TangoApplicationAPI.ApplicationDoStep(mApplicationHandler); mValid = (retCode == Common.RetCodes.kCAPISuccess); // if(retCode != Common.RetCodes.kCAPISuccess) // ErrorHandler.instance.presentErrorMessage("Application step failed with error code:" + retCode); // else // Debug.Log("Do step succeed"); } }
void Awake() { TangoUtilAPI.UtilSetDepthNoiseLevel(2); TangoUtilAPI.UtilSetDepthConfidenceLevel(2); mApplicationHandler = TangoApplicationAPI.ApplicationInitialize("[Superframes Small-Peanut]"); if (mApplicationHandler == System.IntPtr.Zero) { ErrorHandler.instance.presentErrorMessage("Application initialization failed"); } //let's hardcode depth image reoslution //but eventially we can get resolution using VideoMode interface mDepthBufferResolution = new Resolution(); mDepthBufferResolution.width = 320; mDepthBufferResolution.height = 180; mDepthBufferResolution.refreshRate = 5; }
/// <summary> /// Perform updates for the next frame after the /// normal update has run. This loads next frame. /// </summary> private void LateUpdate() { if (m_applicationHandle != System.IntPtr.Zero) { Common.RetCodes retCode = (Common.RetCodes)TangoApplicationAPI.ApplicationDoStep(m_applicationHandle); if (retCode != Common.RetCodes.kCAPISuccess) { DebugLogger.GetInstance.WriteToLog(DebugLogger.EDebugLevel.DEBUG_ERROR, "Application do step error: " + retCode); } m_valid = retCode == Common.RetCodes.kCAPISuccess; } if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); } }
/// <summary> /// Initialize application and providers. /// </summary> public void InitApplication() { if (m_applicationHandle != System.IntPtr.Zero) { DebugLogger.GetInstance.WriteToLog(DebugLogger.EDebugLevel.DEBUG_ERROR, "Duplicated application handler"); return; } // let's hardcode depth image reoslution // but eventially we can get resolution using VideoMode interface Resolution imageResolution = new Resolution(); imageResolution.width = 320; imageResolution.height = 180; imageResolution.refreshRate = 5; Common.DepthFrameResolution = imageResolution; Common.DepthBufferSize = 320 * 180; m_applicationHandle = TangoApplicationAPI.ApplicationInitialize("[Superframes Small-Peanut]"); if (m_applicationHandle == System.IntPtr.Zero) { ErrorHandler.instance.presentErrorMessage("Application initialization failed"); } if (m_enableVio) { VIOProvider.SetAutoReset(m_vioAutoReset); VIOProvider.Init(m_operationMode, m_sparseMapPath); } if (m_enableDepth) { DepthProvider.Init(); } if (m_enableVideoOverlay) { VideoOverlayProvider.Init(); } }
/// <summary> /// Shut down the providers and application. /// </summary> public void ShutDownApplication() { if (m_enableVio) { VIOProvider.ShutDown(); } if (m_enableDepth) { DepthProvider.ShutDown(); } if (m_enableVideoOverlay) { VideoOverlayProvider.Shutdown(); } if (m_applicationHandle == System.IntPtr.Zero) { DebugLogger.GetInstance.WriteToLog( DebugLogger.EDebugLevel.DEBUG_ERROR, "No application initialized"); return; } TangoApplicationAPI.ApplicationShutdown(m_applicationHandle); m_applicationHandle = System.IntPtr.Zero; }