Beispiel #1
0
 public static void Release()
 {
     #if !ALLOCATE_NEW_FRAME_TEXTURES //NatCam retains ownership if we aren't reallocating
     if (Photo != null)
     {
         MonoBehaviour.Destroy(Photo);
     }
     Photo = null;
     #endif
     #if !ALLOCATE_NEW_PHOTO_TEXTURES //NatCam retains ownership if we aren't reallocating
     if (mPreviewFrame != null)
     {
         MonoBehaviour.Destroy(mPreviewFrame);
     }
     mPreviewFrame = null;
     #endif
     if (Preview != null)
     {
         MonoBehaviour.Destroy(Preview);
     }
     Preview = null;
     #if OPENCV_DEVELOPER_MODE
     if (PreviewMatrix != null)
     {
         PreviewMatrix.release();
     }
     PreviewMatrix = null;
     #endif
     mActiveCamera  = -1;
     mPhotoSaveMode = 0;
     if (listener != null)
     {
         listener.WillDestroyMe();
         MonoBehaviour.Destroy(listener.gameObject);
     }
     listener = null;
     #if UNITY_IOS
     TerminateOperations();
     NatCamDispatch.Release(Dispatch);
     Dispatch = null;
     #elif UNITY_ANDROID
     A.Call("TerminateOperations");
     NCNA = null;
     #endif
     FirstFrameReceived =
         isInitialized  =
             isPlaying  = false;
 }
Beispiel #2
0
 private static void Render(int request)
 {
     #if UNITY_ANDROID
     if (Dispatch == null)
     {
         return;
     }
     //Dispatch on the main thread
     Dispatch.Dispatch(() => {
         //Invocation
         Ext.LogVerbose("Native requested callback " + request + " on render thread");
         GL.IssuePluginEvent(NatCamNativeCallback(), request);
         //Release
         if (request == 3)
         {
             NatCamDispatch.Release(Dispatch);
             Dispatch = null;
         }
     });
     #endif
 }
Beispiel #3
0
 public static void Release()
 {
     #if !ALLOCATE_NEW_FRAME_TEXTURES //NatCam retains ownership if we aren't reallocating
     if (Photo != null)
     {
         MonoBehaviour.Destroy(Photo); Photo = null;
     }
     #endif
     #if !ALLOCATE_NEW_PHOTO_TEXTURES //NatCam retains ownership if we aren't reallocating
     if (mPreviewFrame != null)
     {
         MonoBehaviour.Destroy(mPreviewFrame); mPreviewFrame = null;
     }
     #endif
     if (Preview.isPlaying)
     {
         Preview.Stop();
     }
     MonoBehaviour.Destroy(Preview); Preview = null;
     #if OPENCV_DEVELOPER_MODE
     if (PreviewMatrix != null)
     {
         PreviewMatrix.release();
     }
     PreviewMatrix = null;
     #endif
     mActiveCamera = -1;
     PreviewBuffer = metadataBuffer = null;
     NatCamDispatch.Release(Dispatch);
     if (mMetadataDetection)
     {
         NatCamDispatch.Release(MetadataDispatch);
     }
     Dispatch                   = MetadataDispatch = null;
     FirstFrameReceived         =
         isInitialized          =
             mMetadataDetection = false;
 }