12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
-
- using UnityEngine;
- using UnityEngine.UI;
- namespace NRKernal.NRExamples
- {
-
- [HelpURL("https://developer.nreal.ai/develop/unity/rgb-camera")]
- public class CameraCaptureController : MonoBehaviour
- {
-
- public RawImage CaptureImage;
-
-
-
-
- private NRRGBCamTexture RGBCamTexture { get; set; }
- void Start()
- {
- RGBCamTexture = new NRRGBCamTexture();
- CaptureImage.texture = RGBCamTexture.GetTexture();
- RGBCamTexture.Play();
- }
-
- void Update()
- {
- if (RGBCamTexture == null)
- {
- return;
- }
-
- }
-
- public void Play()
- {
- if (RGBCamTexture == null)
- {
- RGBCamTexture = new NRRGBCamTexture();
- CaptureImage.texture = RGBCamTexture.GetTexture();
- }
- RGBCamTexture.Play();
-
-
- CaptureImage.texture = RGBCamTexture.GetTexture();
- }
-
- public void Pause()
- {
- RGBCamTexture?.Pause();
- }
-
- public void Stop()
- {
- RGBCamTexture?.Stop();
- RGBCamTexture = null;
- }
-
- void OnDestroy()
- {
- RGBCamTexture?.Stop();
- RGBCamTexture = null;
- }
- }
- }
|