SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

232 lines
11 KiB

4 years ago
  1. using System;
  2. namespace UnityEngine.XR.ARSubsystems
  3. {
  4. /// <summary>
  5. /// Encapsulates the parameters for creating a new <see cref="XREnvironmentProbeSubsystemDescriptor"/>.
  6. /// </summary>
  7. public struct XREnvironmentProbeSubsystemCinfo : IEquatable<XREnvironmentProbeSubsystemCinfo>
  8. {
  9. /// <summary>
  10. /// Specifies an identifier for the provider implementation of the subsystem.
  11. /// </summary>
  12. /// <value>
  13. /// The identifier for the provider implementation of the subsystem.
  14. /// </value>
  15. public string id { get; set; }
  16. /// <summary>
  17. /// Specifies the provider implementation type to use for instantiation.
  18. /// </summary>
  19. /// <value>
  20. /// Specifies the provider implementation type to use for instantiation.
  21. /// </value>
  22. public Type implementationType { get; set; }
  23. /// <summary>
  24. /// Whether the implementation supports manual placement of environment probes.
  25. /// </summary>
  26. /// <value>
  27. /// <c>true</c> if manual placement of environment probes is supported. Otherwise, <c>false</c>.
  28. /// </value>
  29. public bool supportsManualPlacement { get; set; }
  30. /// <summary>
  31. /// Whether the implementation supports removal of manually-placed environment probes.
  32. /// </summary>
  33. /// <value>
  34. /// <c>true</c> if removal of manually-placed environment probes is supported. Otherwise, <c>false</c>.
  35. /// </value>
  36. public bool supportsRemovalOfManual { get; set; }
  37. /// <summary>
  38. /// Whether the implementation supports automatic placement of environment probes.
  39. /// </summary>
  40. /// <value>
  41. /// <c>true</c> if automatic placement of environment probes is supported. Otherwise, <c>false</c>.
  42. /// </value>
  43. public bool supportsAutomaticPlacement { get; set; }
  44. /// <summary>
  45. /// Whether the implementation supports removal of automatically-placed environment probes.
  46. /// </summary>
  47. /// <value>
  48. /// <c>true</c> if removal of automatically-placed environment probes is supported. Otherwise, <c>false</c>.
  49. /// </value>
  50. public bool supportsRemovalOfAutomatic { get; set; }
  51. /// <summary>
  52. /// Whether the implementation supports generation of environment textures.
  53. /// </summary>
  54. /// <value>
  55. /// <c>true</c> if the generation of environment textures is supported. Otherwise, <c>false</c>.
  56. /// </value>
  57. public bool supportsEnvironmentTexture { get; set; }
  58. /// <summary>
  59. /// Whether the implementation supports generation of HDR environment textures.
  60. /// </summary>
  61. /// <value>
  62. /// <c>true</c> if the generation of HDR environment textures is supported. Otherwise, <c>false</c>.
  63. /// </value>
  64. public bool supportsEnvironmentTextureHDR { get; set; }
  65. public bool Equals(XREnvironmentProbeSubsystemCinfo other)
  66. {
  67. return (id.Equals(other.id)
  68. && implementationType.Equals(other.implementationType)
  69. && supportsManualPlacement.Equals(other.supportsManualPlacement)
  70. && supportsRemovalOfManual.Equals(other.supportsRemovalOfManual)
  71. && supportsAutomaticPlacement.Equals(other.supportsAutomaticPlacement)
  72. && supportsRemovalOfAutomatic.Equals(other.supportsRemovalOfAutomatic)
  73. && supportsEnvironmentTexture.Equals(other.supportsEnvironmentTexture)
  74. && supportsEnvironmentTextureHDR.Equals(other.supportsEnvironmentTextureHDR));
  75. }
  76. public override bool Equals(System.Object obj)
  77. {
  78. return ((obj is XREnvironmentProbeSubsystemCinfo) && Equals((XREnvironmentProbeSubsystemCinfo)obj));
  79. }
  80. public static bool operator ==(XREnvironmentProbeSubsystemCinfo lhs, XREnvironmentProbeSubsystemCinfo rhs)
  81. {
  82. return lhs.Equals(rhs);
  83. }
  84. public static bool operator !=(XREnvironmentProbeSubsystemCinfo lhs, XREnvironmentProbeSubsystemCinfo rhs)
  85. {
  86. return !(lhs == rhs);
  87. }
  88. public override int GetHashCode()
  89. {
  90. int hashCode = 486187739;
  91. unchecked
  92. {
  93. hashCode = (hashCode * 486187739) + id.GetHashCode();
  94. hashCode = (hashCode * 486187739) + implementationType.GetHashCode();
  95. hashCode = (hashCode * 486187739) + supportsManualPlacement.GetHashCode();
  96. hashCode = (hashCode * 486187739) + supportsRemovalOfManual.GetHashCode();
  97. hashCode = (hashCode * 486187739) + supportsAutomaticPlacement.GetHashCode();
  98. hashCode = (hashCode * 486187739) + supportsRemovalOfAutomatic.GetHashCode();
  99. hashCode = (hashCode * 486187739) + supportsEnvironmentTexture.GetHashCode();
  100. hashCode = (hashCode * 486187739) + supportsEnvironmentTextureHDR.GetHashCode();
  101. }
  102. return hashCode;
  103. }
  104. }
  105. /// <summary>
  106. /// Specifies a functionality description that may be registered for each implementation that provides the
  107. /// <see cref="XREnvironmentProbeSubsystem"/> interface.
  108. /// </summary>
  109. public class XREnvironmentProbeSubsystemDescriptor : SubsystemDescriptor<XREnvironmentProbeSubsystem>
  110. {
  111. /// <summary>
  112. /// Constructs a <c>XREnvironmentProbeSubsystemDescriptor</c> based on the given parameters.
  113. /// </summary>
  114. /// <param name='environmentProbeSubsystemCinfo'>The parameters required to initialize the descriptor.</param>
  115. XREnvironmentProbeSubsystemDescriptor(XREnvironmentProbeSubsystemCinfo environmentProbeSubsystemCinfo)
  116. {
  117. id = environmentProbeSubsystemCinfo.id;
  118. subsystemImplementationType = environmentProbeSubsystemCinfo.implementationType;
  119. supportsManualPlacement = environmentProbeSubsystemCinfo.supportsManualPlacement;
  120. supportsRemovalOfManual = environmentProbeSubsystemCinfo.supportsRemovalOfManual;
  121. supportsAutomaticPlacement = environmentProbeSubsystemCinfo.supportsAutomaticPlacement;
  122. supportsRemovalOfAutomatic = environmentProbeSubsystemCinfo.supportsRemovalOfAutomatic;
  123. supportsEnvironmentTexture = environmentProbeSubsystemCinfo.supportsEnvironmentTexture;
  124. supportsEnvironmentTextureHDR = environmentProbeSubsystemCinfo.supportsEnvironmentTextureHDR;
  125. }
  126. /// <summary>
  127. /// Whether the implementation supports manual placement of environment probes.
  128. /// </summary>
  129. /// <value>
  130. /// <c>true</c> if manual placement of environment probes is supported. Otherwise, <c>false</c>.
  131. /// </value>
  132. public bool supportsManualPlacement { get; private set; }
  133. /// <summary>
  134. /// Whether the implementation supports removal of manually-placed environment probes.
  135. /// </summary>
  136. /// <value>
  137. /// <c>true</c> if removal of manually-placed environment probes is supported. Otherwise, <c>false</c>.
  138. /// </value>
  139. public bool supportsRemovalOfManual { get; private set; }
  140. /// <summary>
  141. /// Whether the implementation supports automatic placement of environment probes.
  142. /// </summary>
  143. /// <value>
  144. /// <c>true</c> if automatic placement of environment probes is supported. Otherwise, <c>false</c>.
  145. /// </value>
  146. public bool supportsAutomaticPlacement { get; private set; }
  147. /// <summary>
  148. /// Whether the implementation supports removal of automatically-placed environment probes.
  149. /// </summary>
  150. /// <value>
  151. /// <c>true</c> if removal of automatically-placed environment probes is supported. Otherwise, <c>false</c>.
  152. /// </value>
  153. public bool supportsRemovalOfAutomatic { get; private set; }
  154. /// <summary>
  155. /// Whether the implementation supports generation of environment textures.
  156. /// </summary>
  157. /// <value>
  158. /// <c>true</c> if the generation of environment textures is supported. Otherwise, <c>false</c>.
  159. /// </value>
  160. public bool supportsEnvironmentTexture { get; private set; }
  161. /// <summary>
  162. /// Whether the implementation supports generation of HDR environment textures.
  163. /// </summary>
  164. /// <value>
  165. /// <c>true</c> if the generation of HDR environment textures is supported. Otherwise, <c>false</c>.
  166. /// </value>
  167. public bool supportsEnvironmentTextureHDR { get; private set; }
  168. /// <summary>
  169. /// Creates a <c>XREnvironmentProbeSubsystemDescriptor</c> based on the given parameters validating that the
  170. /// <c>id</c> and <c>implentationType</c> properties are specified.
  171. /// </summary>
  172. /// <param name='environmentProbeSubsystemCinfo'>The parameters required to initialize the descriptor.</param>
  173. /// <returns>
  174. /// The created <c>XREnvironmentProbeSubsystemDescriptor</c>.
  175. /// </returns>
  176. /// <exception cref="ArgumentException">Thrown when the values specified in the
  177. /// <paramref name="environmentProbeSubsystemCinfo"/> parameter are invalid. Typically, this will occur
  178. /// <list type="bullet">
  179. /// <item>
  180. /// <description>if <see cref="XREnvironmentProbeSubsystemCinfo.id"/> is <c>null</c> or empty</description>
  181. /// </item>
  182. /// <item>
  183. /// <description>if <see cref="XREnvironmentProbeSubsystemCinfo.implementationType"/> is <c>null</c>
  184. /// </description>
  185. /// </item>
  186. /// <item>
  187. /// <description>if <see cref="XREnvironmentProbeSubsystemCinfo.implementationType"/> does not derive from the
  188. /// <c>XREnvironmentProbeSubsystem</c> class
  189. /// </description>
  190. /// </item>
  191. /// </list>
  192. /// </exception>
  193. internal static XREnvironmentProbeSubsystemDescriptor Create(XREnvironmentProbeSubsystemCinfo environmentProbeSubsystemCinfo)
  194. {
  195. if (String.IsNullOrEmpty(environmentProbeSubsystemCinfo.id))
  196. {
  197. throw new ArgumentException("Cannot create environment probe subsystem descriptor because id is invalid",
  198. "environmentProbeSubsystemCinfo");
  199. }
  200. if ((environmentProbeSubsystemCinfo.implementationType == null)
  201. || !environmentProbeSubsystemCinfo.implementationType.IsSubclassOf(typeof(XREnvironmentProbeSubsystem)))
  202. {
  203. throw new ArgumentException("Cannot create environment probe subsystem descriptor because implementationType is invalid",
  204. "environmentProbeSubsystemCinfo");
  205. }
  206. return new XREnvironmentProbeSubsystemDescriptor(environmentProbeSubsystemCinfo);
  207. }
  208. }
  209. }