LayerHandler.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. using UnityEngine;
  2. #if UNITY_EDITOR
  3. using UnityEditor;
  4. #endif
  5. public class LayerHandler
  6. {
  7. public static bool[] layer_pack_used = new bool[4];
  8. private LayerHandler()
  9. {
  10. for (int k = 0; k < 4; k++)
  11. layer_pack_used [k] = false;
  12. }
  13. private static LayerHandler _instance = null;
  14. public static LayerHandler GetInstance()
  15. {
  16. if (_instance == null)
  17. {
  18. _instance = new LayerHandler();
  19. }
  20. return _instance;
  21. }
  22. public enum LAYER_MODE
  23. {
  24. LAYER_MODE_LEFT_SCREEN,
  25. LAYER_MODE_RIGHT_SCREEN,
  26. LAYER_MODE_LEFT_FINALSCREEN,
  27. LAYER_MODE_RIGHT_FINALSCREEN
  28. };
  29. public enum LAYER_PACK_LAYER_NUMBER
  30. {
  31. LAYER_PACK_CAM1_LS = 27,
  32. LAYER_PACK_CAM1_RS = 28,
  33. LAYER_PACK_CAM1_LFS = 29,
  34. LAYER_PACK_CAM1_RFS = 30,
  35. LAYER_PACK_CAM2_LS = 23,
  36. LAYER_PACK_CAM2_RS = 24,
  37. LAYER_PACK_CAM2_LFS = 25,
  38. LAYER_PACK_CAM2_RFS = 26,
  39. LAYER_PACK_CAM3_LS = 19,
  40. LAYER_PACK_CAM3_RS = 20,
  41. LAYER_PACK_CAM3_LFS = 21,
  42. LAYER_PACK_CAM3_RFS = 22,
  43. LAYER_PACK_CAM4_LS = 15,
  44. LAYER_PACK_CAM4_RS = 16,
  45. LAYER_PACK_CAM4_LFS = 17,
  46. LAYER_PACK_CAM4_RFS = 18
  47. };
  48. public void setUsed(sl.ZED_CAMERA_ID lp, bool used)
  49. {
  50. layer_pack_used [(int)lp] = used;
  51. }
  52. public bool getUsed(sl.ZED_CAMERA_ID lp)
  53. {
  54. return layer_pack_used [(int)lp];
  55. }
  56. public int getLayerNumber(sl.ZED_CAMERA_ID lp, LAYER_MODE mode)
  57. {
  58. switch (lp) {
  59. case sl.ZED_CAMERA_ID.CAMERA_ID_01:
  60. {
  61. switch (mode) {
  62. case LAYER_MODE.LAYER_MODE_LEFT_SCREEN:
  63. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM1_LS;
  64. case LAYER_MODE.LAYER_MODE_RIGHT_SCREEN:
  65. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM1_RS;
  66. case LAYER_MODE.LAYER_MODE_LEFT_FINALSCREEN:
  67. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM1_LFS;
  68. case LAYER_MODE.LAYER_MODE_RIGHT_FINALSCREEN:
  69. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM1_RFS;
  70. default :
  71. return -1;
  72. }
  73. }
  74. case sl.ZED_CAMERA_ID.CAMERA_ID_02:
  75. {
  76. switch (mode) {
  77. case LAYER_MODE.LAYER_MODE_LEFT_SCREEN:
  78. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM2_LS;
  79. case LAYER_MODE.LAYER_MODE_RIGHT_SCREEN:
  80. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM2_RS;
  81. case LAYER_MODE.LAYER_MODE_LEFT_FINALSCREEN:
  82. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM2_LFS;
  83. case LAYER_MODE.LAYER_MODE_RIGHT_FINALSCREEN:
  84. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM2_RFS;
  85. default :
  86. return -1;
  87. }
  88. }
  89. case sl.ZED_CAMERA_ID.CAMERA_ID_03:
  90. {
  91. switch (mode) {
  92. case LAYER_MODE.LAYER_MODE_LEFT_SCREEN:
  93. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM3_LS;
  94. case LAYER_MODE.LAYER_MODE_RIGHT_SCREEN:
  95. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM3_RS;
  96. case LAYER_MODE.LAYER_MODE_LEFT_FINALSCREEN:
  97. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM3_LFS;
  98. case LAYER_MODE.LAYER_MODE_RIGHT_FINALSCREEN:
  99. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM3_RFS;
  100. default :
  101. return -1;
  102. }
  103. }
  104. case sl.ZED_CAMERA_ID.CAMERA_ID_04:
  105. {
  106. switch (mode) {
  107. case LAYER_MODE.LAYER_MODE_LEFT_SCREEN:
  108. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM4_LS;
  109. case LAYER_MODE.LAYER_MODE_RIGHT_SCREEN:
  110. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM4_RS;
  111. case LAYER_MODE.LAYER_MODE_LEFT_FINALSCREEN:
  112. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM4_LFS;
  113. case LAYER_MODE.LAYER_MODE_RIGHT_FINALSCREEN:
  114. return (int)LAYER_PACK_LAYER_NUMBER.LAYER_PACK_CAM4_RFS;
  115. default :
  116. return -1;
  117. }
  118. }
  119. default :
  120. return -1;
  121. }
  122. }
  123. }