Пример #1
0
        /// <summary>
        /// Connect a callback to a camera for texture updates.
        /// </summary>
        /// <param name="cameraId">
        /// The ID of the camera to connect this texture to.  Only <code>TANGO_CAMERA_COLOR</code> and
        /// <code>TANGO_CAMERA_FISHEYE</code> are supported.
        /// </param>
        /// <param name="callback">Function called when a new frame is available from the camera.</param>
        internal static void SetCallback(TangoEnums.TangoCameraId cameraId, TangoService_onTextureAvailable callback)
        {
            int returnValue = API.TangoService_connectOnTextureAvailable(cameraId, IntPtr.Zero, callback);

            if (returnValue == Common.ErrorType.TANGO_SUCCESS)
            {
                Debug.Log(CLASS_NAME + ".SetCallback(OnTextureAvailable) Callback was set.");
            }
            else
            {
                Debug.Log(CLASS_NAME + ".SetCallback(OnTextureAvailable) Callback was not set!");
            }
        }
Пример #2
0
        /// <summary>
        /// DEPRECATED: Connect a Texture IDs to a camera.
        ///
        /// The camera is selected via TangoCameraId.  Currently only TANGO_CAMERA_COLOR is supported.  The texture
        /// handles will be regenerated by the API on startup after which the application can use them, and will be
        /// packed RGBA8888 data containing bytes of the image (so a single RGBA8888 will pack 4 neighboring pixels).
        /// If the config flag experimental_image_pixel_format is set to HAL_PIXEL_FORMAT_YCrCb_420_SP, texture_y will
        /// pack 1280x720 pixels into a 320x720 RGBA8888 texture.  texture_Cb and texture_Cr will contain copies of
        /// the 2x2 downsampled interleaved UV planes packed similarly.  If experimental_image_pixel_format is set to
        /// HAL_PIXEL_FORMAT_YV12 then texture_y will have a stride of 1536 containing 1280 columns of data, packed
        /// similarly in a RGBA8888 texture. texture_Cb and texture_Cr will be 2x2 downsampled versions of the same.
        /// See YV12 and NV21 formats for details.
        ///
        /// Note: The first scan-line of the color image is reserved for metadata instead of image pixels.
        /// </summary>
        /// <param name="cameraId">
        /// The ID of the camera to connect this texture to.  Only TANGO_CAMERA_COLOR and TANGO_CAMERA_FISHEYE are
        /// supported.
        /// </param>
        /// <param name="textures">The texture IDs to use for the Y, Cb, and Cr planes.</param>
        /// <param name="callback">Callback method.</param>
        internal static void ExperimentalConnectTexture(
            TangoEnums.TangoCameraId cameraId, YUVTexture textures, TangoService_onTextureAvailable callback)
        {
#if UNITY_EDITOR
            if (cameraId == TangoEnums.TangoCameraId.TANGO_CAMERA_COLOR)
            {
                m_emulatedExpId_Y    = (RenderTexture)textures.m_videoOverlayTextureY;
                m_emulatedExpId_CbCr = (RenderTexture)textures.m_videoOverlayTextureCb;
            }
#else
            int returnValue = API.TangoService_Experimental_connectTextureIdUnity(
                cameraId,
                (uint)textures.m_videoOverlayTextureY.GetNativeTexturePtr().ToInt64(),
                (uint)textures.m_videoOverlayTextureCb.GetNativeTexturePtr().ToInt64(),
                (uint)textures.m_videoOverlayTextureCr.GetNativeTexturePtr().ToInt64(),
                IntPtr.Zero,
                callback);

            if (returnValue != Common.ErrorType.TANGO_SUCCESS)
            {
                Debug.Log("VideoOverlayProvider.ConnectTexture() Texture was not connected to camera!");
            }
#endif
        }
Пример #3
0
 public static int TangoService_Experimental_connectTextureIdUnity(
     TangoEnums.TangoCameraId id, UInt32 texture_y, UInt32 texture_Cb, UInt32 texture_Cr, IntPtr context,
     TangoService_onTextureAvailable onUnityFrameAvailable)
 {
     return(Common.ErrorType.TANGO_SUCCESS);
 }
Пример #4
0
 public static int TangoService_connectOnTextureAvailable(
     TangoEnums.TangoCameraId cameraId, IntPtr context, TangoService_onTextureAvailable callback)
 {
     return(Common.ErrorType.TANGO_SUCCESS);
 }
Пример #5
0
 public static extern int TangoService_Experimental_connectTextureIdUnity(
     TangoEnums.TangoCameraId id, UInt32 texture_y, UInt32 texture_Cb, UInt32 texture_Cr, IntPtr context,
     TangoService_onTextureAvailable onUnityFrameAvailable);
Пример #6
0
 public static extern int TangoService_connectOnTextureAvailable(
     TangoEnums.TangoCameraId cameraId, IntPtr ContextMenu, TangoService_onTextureAvailable callback);