ScreenLocate.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using Serenegiant.UVC;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using UnityEngine;
  6. using ZIM;
  7. /// <summary>
  8. /// JC-补充接口
  9. /// </summary>
  10. public partial class ScreenLocate : MonoBehaviour
  11. {
  12. public bool IsScreenLoateOK()
  13. {
  14. return screenIdentification != null &&
  15. screenIdentification.Screen != null &&
  16. screenIdentification.Screen.Active;
  17. }
  18. public bool IsScreenLocateManualDoing()
  19. {
  20. return mode == Mode.ScreenLocateManual;
  21. }
  22. public Texture2D EnterScreenLocateManual()
  23. {
  24. CreateUVCTexture2DIfNeeded();
  25. Texture2D texture = mUVCTexture2D.zimAutoLight(0);
  26. mode = Mode.ScreenLocateManual;
  27. return texture;
  28. }
  29. public void QuitScreenLocateManual(List<Vector2> points)
  30. {
  31. if (points != null && points.Count == 4)
  32. {
  33. var size = getUVCCameraInfoSize;
  34. screenIdentification?.SetScreenQuad(
  35. new QuadrilateralInCamera(
  36. new o0.Geometry2D.Float.Vector(points[0].x * size.x, points[0].y * size.y),
  37. new o0.Geometry2D.Float.Vector(points[1].x * size.x, points[1].y * size.y),
  38. new o0.Geometry2D.Float.Vector(points[3].x * size.x, points[3].y * size.y),
  39. new o0.Geometry2D.Float.Vector(points[2].x * size.x, points[2].y * size.y),
  40. size.o0Vector()
  41. )
  42. );
  43. }
  44. ToMode(Mode.InfraredLocate);
  45. }
  46. public void EnterScreenLocateManualAuto()
  47. {
  48. BtnScreenLocate();
  49. }
  50. public void SetCapture(int value)
  51. {
  52. Capture = value;
  53. }
  54. public void SetDelay(int value)
  55. {
  56. Delay = value;
  57. }
  58. }