XRRGBCamera.cs 762 B

12345678910111213141516171819202122232425262728293031323334
  1. using NRKernal;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class XRRGBCamera : MonoBehaviour
  7. {
  8. public Texture CaptureImage;
  9. NRRGBCamTexture RGBCamTexture;
  10. private void Start()
  11. {
  12. RGBCamTexture = new NRRGBCamTexture();
  13. playCamera();
  14. }
  15. public void playCamera()
  16. {
  17. CaptureImage = RGBCamTexture.GetTexture();
  18. if(this.GetComponent<RawImage>()!=null)
  19. {
  20. this.GetComponent<RawImage>().texture = CaptureImage;
  21. this.GetComponent<RawImage>().transform.localEulerAngles = new Vector3(-180,0,0);
  22. }
  23. RGBCamTexture.Play();
  24. }
  25. public void stopCamera()
  26. {
  27. RGBCamTexture.Stop();
  28. }
  29. }