Esempio n. 1
0
 public void Play()
 {
     if (m_IsPlaying)
     {
         return;
     }
     this.Initilize();
     NRKernalUpdater.Instance.OnUpdate += UpdateTexture;
     NRRgbCamera.Play();
     m_IsPlaying = true;
 }
Esempio n. 2
0
 public void Play()
 {
     if (m_IsPlaying)
     {
         return;
     }
     NRRgbCamera.OnImageUpdate         += OnFrameUpdated;
     InternalUpdater.Instance.OnUpdate += UpdateTexture;
     NRRgbCamera.Play();
     m_IsPlaying = true;
 }
Esempio n. 3
0
        private void Initilize()
        {
            if (m_IsInitilized)
            {
                return;
            }

            OnCreated();
            NRRgbCamera.Regist(this);
            m_IsInitilized = true;
        }
        /// <summary> Creates RGB camera proxy. </summary>
        /// <returns> The new RGB camera proxy. </returns>
        public static NativeCameraProxy CreateRGBCameraProxy()
        {
            NativeCameraProxy controller;

            if (!m_CameraControllerDict.TryGetValue(NRRgbCamera.ID, out controller))
            {
                controller = new NRRgbCamera();
                m_CameraControllerDict.Add(NRRgbCamera.ID, controller);
            }
            return(controller);
        }
Esempio n. 5
0
 public void Stop()
 {
     if (!m_IsPlaying)
     {
         return;
     }
     NRRgbCamera.OnImageUpdate         -= OnFrameUpdated;
     InternalUpdater.Instance.OnUpdate -= UpdateTexture;
     NRRgbCamera.Stop();
     m_IsPlaying = false;
 }
 private void Initilize()
 {
     if (m_IsInitilized)
     {
         return;
     }
     if (m_texture == null)
     {
         m_texture = CreateTex();
     }
     NRRgbCamera.Regist(this);
     m_IsInitilized = true;
 }
 public void Stop()
 {
     if (!m_IsInitilized)
     {
         return;
     }
     NRRgbCamera.UnRegist(this);
     this.Pause();
     NRRgbCamera.Stop();
     GameObject.Destroy(m_texture);
     m_texture      = null;
     m_IsInitilized = false;
 }
Esempio n. 8
0
        private void UpdateTexture()
        {
            if (!DidUpdateThisFrame || !IsPlaying)
            {
                return;
            }

            RGBRawDataFrame rgbRawDataFrame = NRRgbCamera.GetRGBFrame();

            if (rgbRawDataFrame.data == null)
            {
                Debug.LogError("Get Rgb camera data faild...");
                return;
            }

            OnLoadRawTextureData(rgbRawDataFrame);
        }
Esempio n. 9
0
        public void Stop()
        {
            if (!m_IsInitilized)
            {
                return;
            }

            NRRgbCamera.UnRegist(this);
            NRRgbCamera.Stop();

            this.Pause();
            this.OnStopped();

            FrameCount     = 0;
            m_IsPlaying    = false;
            m_IsInitilized = false;
        }
Esempio n. 10
0
        private void UpdateTexture()
        {
            if (!NRRgbCamera.HasFrame())
            {
                return;
            }
            RGBRawDataFrame rgbRawDataFrame = NRRgbCamera.GetRGBFrame();

            m_texture.LoadRawTextureData(rgbRawDataFrame.data);
            m_texture.Apply();

            CurrentFrame.timeStamp = rgbRawDataFrame.timeStamp;
            CurrentFrame.texture   = m_texture;
            FrameCount++;

            OnUpdate?.Invoke(CurrentFrame);
        }
Esempio n. 11
0
        private void UpdateTexture()
        {
            if (!NRRgbCamera.HasFrame())
            {
                return;
            }
            RGBRawDataFrame rgbRawDataFrame = NRRgbCamera.GetRGBFrame();

            if (m_texture == null || m_texture.width != NRRgbCamera.Resolution.width ||
                m_texture.height != NRRgbCamera.Resolution.height)
            {
                m_texture = new Texture2D(NRRgbCamera.Resolution.width, NRRgbCamera.Resolution.height, TextureFormat.RGB24, false);
            }
            m_texture.LoadRawTextureData(rgbRawDataFrame.data);
            m_texture.Apply();

            CurrentFrame.timeStamp = rgbRawDataFrame.timeStamp;
            CurrentFrame.texture   = m_texture;

            if (OnUpdate != null)
            {
                OnUpdate(CurrentFrame);
            }
        }
Esempio n. 12
0
 /**
  * @brief Release the rgb camera.
  */
 public void Release()
 {
     NRRgbCamera.Release();
 }
Esempio n. 13
0
 /**
  * @brief Stop rgb camera.
  */
 public void Stop()
 {
     NRRgbCamera.Stop();
     StopCoroutine("RefreshTex");
 }
Esempio n. 14
0
 /**
  * @brief Start to play rgb camera.
  */
 public void Play()
 {
     NRRgbCamera.Play();
     StopCoroutine("RefreshTex");
     StartCoroutine("RefreshTex");
 }
 public void Dispose()
 {
     NRRgbCamera.Release();
     GameObject.Destroy(m_texture);
 }