/// <summary> /// Register to get Tango texture events when the camera is updated. /// /// NOTE: Tango texture events happen on a different thread than the main Unity thread. /// </summary> internal static void SetCallbackTextureMethod() { if (m_onTextureAvailable != null) { Debug.Log("VideoOverlayProvider.SetCallbackTextureMethod() called when a callback is already set."); return; } Debug.Log("VideoOverlayProvider.SetCallbackTextureMethod()"); m_onTextureAvailable = new VideoOverlayProvider.APIOnTextureAvailable(_OnTangoCameraTextureAvailable); VideoOverlayProvider.SetCallback(COLOR_CAMERA_ID, m_onTextureAvailable); }
/// <summary> /// Stop getting Tango image or texture callbacks. /// </summary> internal static void Reset() { // Avoid calling into tango_client_api before the correct library is loaded. if (m_onImageAvailable != null || m_onTextureAvailable != null || m_onYUVTextureAvailable != null) { VideoOverlayProvider.ClearCallback(COLOR_CAMERA_ID); } m_onImageAvailable = null; m_onTextureAvailable = null; m_onYUVTextureAvailable = null; m_previousImageBuffer = new TangoUnityImageData(); m_shouldSendTextureMethodEvent = false; m_shouldSendByteBufferMethodEvent = false; m_shouldSendYUVTextureIdMethodEvent = false; m_onTangoImageAvailable = null; m_onTangoCameraTextureAvailable = null; m_onTangoYUVTextureAvailable = null; m_onTangoImageMultithreadedAvailable = null; }
/// <summary> /// DEPRECATED: Register to get Tango texture events for the texture ID is updated. /// /// NOTE: Tango texture events happen on a different thread than the main /// Unity thread. /// </summary> /// <param name="videoOverlayTexture">The video overlay texture to use.</param> internal static void SetCallbackYUVTextureIdMethod(YUVTexture videoOverlayTexture) { if (videoOverlayTexture != null) { if (m_onYUVTextureAvailable != null) { Debug.Log("VideoOverlayProvider.SetCallbackYUVTextureIdMethod() called when a callback is already set."); return; } Debug.Log("VideoOverlayProvider.SetCallbackYUVTextureIdMethod()"); m_onYUVTextureAvailable = new VideoOverlayProvider.APIOnTextureAvailable(_OnTangoYUVTextureAvailable); VideoOverlayProvider.ExperimentalConnectTexture( COLOR_CAMERA_ID, videoOverlayTexture, m_onYUVTextureAvailable); } else { Debug.Log("VideoOverlayListener.SetCallbackYUVTextureIdMethod() : No Texture2D found!"); } }
/// <summary> /// DEPRECATED: Register to get Tango texture events for the texture ID is updated. /// /// NOTE: Tango texture events happen on a different thread than the main /// Unity thread. /// </summary> /// <param name="videoOverlayTexture">The video overlay texture to use.</param> internal static void SetCallbackYUVTextureIdMethod(YUVTexture videoOverlayTexture) { if (videoOverlayTexture != null) { if (m_onYUVTextureAvailable != null) { Debug.Log("VideoOverlayProvider.SetCallbackYUVTextureIdMethod() called when a callback is already set."); return; } Debug.Log("VideoOverlayProvider.SetCallbackYUVTextureIdMethod()"); m_onYUVTextureAvailable = new VideoOverlayProvider.APIOnTextureAvailable(_OnTangoYUVTextureAvailable); VideoOverlayProvider.ExperimentalConnectTexture( COLOR_CAMERA_ID, videoOverlayTexture, m_onYUVTextureAvailable); } else { Debug.Log("VideoOverlayListener.SetCallbackYUVTextureIdMethod() : No Texture2D found!"); } }
/// <summary> /// Register to get Tango texture events when the camera is updated. /// /// NOTE: Tango texture events happen on a different thread than the main Unity thread. /// </summary> internal static void SetCallbackTextureMethod() { if (m_onTextureAvailable != null) { Debug.Log("VideoOverlayProvider.SetCallbackTextureMethod() called when a callback is already set."); return; } Debug.Log("VideoOverlayProvider.SetCallbackTextureMethod()"); m_onTextureAvailable = new VideoOverlayProvider.APIOnTextureAvailable(_OnTangoCameraTextureAvailable); VideoOverlayProvider.SetCallback(COLOR_CAMERA_ID, m_onTextureAvailable); }
/// <summary> /// Clear just the Tango callbacks. External registered listeners are kept. /// </summary> internal static void ClearTangoCallbacks() { m_onTextureAvailable = null; m_onYUVTextureAvailable = null; m_onImageAvailable = null; }
/// <summary> /// Stop getting Tango image or texture callbacks. /// </summary> internal static void Reset() { // Avoid calling into tango_client_api before the correct library is loaded. if (m_onImageAvailable != null || m_onTextureAvailable != null || m_onYUVTextureAvailable != null) { VideoOverlayProvider.ClearCallback(COLOR_CAMERA_ID); } m_onImageAvailable = null; m_onTextureAvailable = null; m_onYUVTextureAvailable = null; m_previousImageBuffer = new TangoUnityImageData(); m_shouldSendTextureMethodEvent = false; m_shouldSendByteBufferMethodEvent = false; m_shouldSendYUVTextureIdMethodEvent = false; m_onTangoImageAvailable = null; m_onTangoCameraTextureAvailable = null; m_onTangoYUVTextureAvailable = null; m_onTangoImageMultithreadedAvailable = null; }
/// <summary> /// Clear just the Tango callbacks. External registered listeners are kept. /// </summary> internal static void ClearTangoCallbacks() { m_onTextureAvailable = null; m_onYUVTextureAvailable = null; m_onImageAvailable = null; }