half2.gen.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. //------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This code was generated by a tool.
  4. //
  5. // Changes to this file may cause incorrect behavior and will be lost if
  6. // the code is regenerated.
  7. // </auto-generated>
  8. //------------------------------------------------------------------------------
  9. using System;
  10. using System.Runtime.CompilerServices;
  11. using System.Diagnostics;
  12. #pragma warning disable 0660, 0661
  13. namespace Unity.Mathematics
  14. {
  15. [DebuggerTypeProxy(typeof(half2.DebuggerProxy))]
  16. public partial struct half2 : System.IEquatable<half2>, IFormattable
  17. {
  18. public half x;
  19. public half y;
  20. /// <summary>half2 zero value.</summary>
  21. public static readonly half2 zero;
  22. /// <summary>Constructs a half2 vector from two half values.</summary>
  23. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  24. public half2(half x, half y)
  25. {
  26. this.x = x;
  27. this.y = y;
  28. }
  29. /// <summary>Constructs a half2 vector from a half2 vector.</summary>
  30. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  31. public half2(half2 xy)
  32. {
  33. this.x = xy.x;
  34. this.y = xy.y;
  35. }
  36. /// <summary>Constructs a half2 vector from a single half value by assigning it to every component.</summary>
  37. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  38. public half2(half v)
  39. {
  40. this.x = v;
  41. this.y = v;
  42. }
  43. /// <summary>Constructs a half2 vector from a single float value by converting it to half and assigning it to every component.</summary>
  44. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  45. public half2(float v)
  46. {
  47. this.x = (half)v;
  48. this.y = (half)v;
  49. }
  50. /// <summary>Constructs a half2 vector from a float2 vector by componentwise conversion.</summary>
  51. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  52. public half2(float2 v)
  53. {
  54. this.x = (half)v.x;
  55. this.y = (half)v.y;
  56. }
  57. /// <summary>Constructs a half2 vector from a single double value by converting it to half and assigning it to every component.</summary>
  58. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  59. public half2(double v)
  60. {
  61. this.x = (half)v;
  62. this.y = (half)v;
  63. }
  64. /// <summary>Constructs a half2 vector from a double2 vector by componentwise conversion.</summary>
  65. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  66. public half2(double2 v)
  67. {
  68. this.x = (half)v.x;
  69. this.y = (half)v.y;
  70. }
  71. /// <summary>Implicitly converts a single half value to a half2 vector by assigning it to every component.</summary>
  72. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  73. public static implicit operator half2(half v) { return new half2(v); }
  74. /// <summary>Explicitly converts a single float value to a half2 vector by converting it to half and assigning it to every component.</summary>
  75. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  76. public static explicit operator half2(float v) { return new half2(v); }
  77. /// <summary>Explicitly converts a float2 vector to a half2 vector by componentwise conversion.</summary>
  78. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  79. public static explicit operator half2(float2 v) { return new half2(v); }
  80. /// <summary>Explicitly converts a single double value to a half2 vector by converting it to half and assigning it to every component.</summary>
  81. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  82. public static explicit operator half2(double v) { return new half2(v); }
  83. /// <summary>Explicitly converts a double2 vector to a half2 vector by componentwise conversion.</summary>
  84. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  85. public static explicit operator half2(double2 v) { return new half2(v); }
  86. /// <summary>Returns the result of a componentwise equality operation on two half2 vectors.</summary>
  87. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  88. public static bool2 operator == (half2 lhs, half2 rhs) { return new bool2 (lhs.x == rhs.x, lhs.y == rhs.y); }
  89. /// <summary>Returns the result of a componentwise equality operation on a half2 vector and a half value.</summary>
  90. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  91. public static bool2 operator == (half2 lhs, half rhs) { return new bool2 (lhs.x == rhs, lhs.y == rhs); }
  92. /// <summary>Returns the result of a componentwise equality operation on a half value and a half2 vector.</summary>
  93. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  94. public static bool2 operator == (half lhs, half2 rhs) { return new bool2 (lhs == rhs.x, lhs == rhs.y); }
  95. /// <summary>Returns the result of a componentwise not equal operation on two half2 vectors.</summary>
  96. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  97. public static bool2 operator != (half2 lhs, half2 rhs) { return new bool2 (lhs.x != rhs.x, lhs.y != rhs.y); }
  98. /// <summary>Returns the result of a componentwise not equal operation on a half2 vector and a half value.</summary>
  99. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  100. public static bool2 operator != (half2 lhs, half rhs) { return new bool2 (lhs.x != rhs, lhs.y != rhs); }
  101. /// <summary>Returns the result of a componentwise not equal operation on a half value and a half2 vector.</summary>
  102. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  103. public static bool2 operator != (half lhs, half2 rhs) { return new bool2 (lhs != rhs.x, lhs != rhs.y); }
  104. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  105. public half4 xxxx
  106. {
  107. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  108. get { return new half4(x, x, x, x); }
  109. }
  110. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  111. public half4 xxxy
  112. {
  113. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  114. get { return new half4(x, x, x, y); }
  115. }
  116. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  117. public half4 xxyx
  118. {
  119. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  120. get { return new half4(x, x, y, x); }
  121. }
  122. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  123. public half4 xxyy
  124. {
  125. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  126. get { return new half4(x, x, y, y); }
  127. }
  128. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  129. public half4 xyxx
  130. {
  131. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  132. get { return new half4(x, y, x, x); }
  133. }
  134. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  135. public half4 xyxy
  136. {
  137. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  138. get { return new half4(x, y, x, y); }
  139. }
  140. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  141. public half4 xyyx
  142. {
  143. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  144. get { return new half4(x, y, y, x); }
  145. }
  146. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  147. public half4 xyyy
  148. {
  149. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  150. get { return new half4(x, y, y, y); }
  151. }
  152. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  153. public half4 yxxx
  154. {
  155. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  156. get { return new half4(y, x, x, x); }
  157. }
  158. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  159. public half4 yxxy
  160. {
  161. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  162. get { return new half4(y, x, x, y); }
  163. }
  164. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  165. public half4 yxyx
  166. {
  167. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  168. get { return new half4(y, x, y, x); }
  169. }
  170. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  171. public half4 yxyy
  172. {
  173. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  174. get { return new half4(y, x, y, y); }
  175. }
  176. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  177. public half4 yyxx
  178. {
  179. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  180. get { return new half4(y, y, x, x); }
  181. }
  182. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  183. public half4 yyxy
  184. {
  185. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  186. get { return new half4(y, y, x, y); }
  187. }
  188. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  189. public half4 yyyx
  190. {
  191. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  192. get { return new half4(y, y, y, x); }
  193. }
  194. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  195. public half4 yyyy
  196. {
  197. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  198. get { return new half4(y, y, y, y); }
  199. }
  200. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  201. public half3 xxx
  202. {
  203. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  204. get { return new half3(x, x, x); }
  205. }
  206. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  207. public half3 xxy
  208. {
  209. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  210. get { return new half3(x, x, y); }
  211. }
  212. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  213. public half3 xyx
  214. {
  215. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  216. get { return new half3(x, y, x); }
  217. }
  218. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  219. public half3 xyy
  220. {
  221. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  222. get { return new half3(x, y, y); }
  223. }
  224. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  225. public half3 yxx
  226. {
  227. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  228. get { return new half3(y, x, x); }
  229. }
  230. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  231. public half3 yxy
  232. {
  233. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  234. get { return new half3(y, x, y); }
  235. }
  236. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  237. public half3 yyx
  238. {
  239. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  240. get { return new half3(y, y, x); }
  241. }
  242. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  243. public half3 yyy
  244. {
  245. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  246. get { return new half3(y, y, y); }
  247. }
  248. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  249. public half2 xx
  250. {
  251. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  252. get { return new half2(x, x); }
  253. }
  254. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  255. public half2 xy
  256. {
  257. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  258. get { return new half2(x, y); }
  259. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  260. set { x = value.x; y = value.y; }
  261. }
  262. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  263. public half2 yx
  264. {
  265. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  266. get { return new half2(y, x); }
  267. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  268. set { y = value.x; x = value.y; }
  269. }
  270. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  271. public half2 yy
  272. {
  273. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  274. get { return new half2(y, y); }
  275. }
  276. /// <summary>Returns the half element at a specified index.</summary>
  277. unsafe public half this[int index]
  278. {
  279. get
  280. {
  281. #if ENABLE_UNITY_COLLECTIONS_CHECKS
  282. if ((uint)index >= 2)
  283. throw new System.ArgumentException("index must be between[0...1]");
  284. #endif
  285. fixed (half2* array = &this) { return ((half*)array)[index]; }
  286. }
  287. set
  288. {
  289. #if ENABLE_UNITY_COLLECTIONS_CHECKS
  290. if ((uint)index >= 2)
  291. throw new System.ArgumentException("index must be between[0...1]");
  292. #endif
  293. fixed (half* array = &x) { array[index] = value; }
  294. }
  295. }
  296. /// <summary>Returns true if the half2 is equal to a given half2, false otherwise.</summary>
  297. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  298. public bool Equals(half2 rhs) { return x == rhs.x && y == rhs.y; }
  299. /// <summary>Returns true if the half2 is equal to a given half2, false otherwise.</summary>
  300. public override bool Equals(object o) { return Equals((half2)o); }
  301. /// <summary>Returns a hash code for the half2.</summary>
  302. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  303. public override int GetHashCode() { return (int)math.hash(this); }
  304. /// <summary>Returns a string representation of the half2.</summary>
  305. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  306. public override string ToString()
  307. {
  308. return string.Format("half2({0}, {1})", x, y);
  309. }
  310. /// <summary>Returns a string representation of the half2 using a specified format and culture-specific format information.</summary>
  311. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  312. public string ToString(string format, IFormatProvider formatProvider)
  313. {
  314. return string.Format("half2({0}, {1})", x.ToString(format, formatProvider), y.ToString(format, formatProvider));
  315. }
  316. internal sealed class DebuggerProxy
  317. {
  318. public half x;
  319. public half y;
  320. public DebuggerProxy(half2 v)
  321. {
  322. x = v.x;
  323. y = v.y;
  324. }
  325. }
  326. }
  327. public static partial class math
  328. {
  329. /// <summary>Returns a half2 vector constructed from two half values.</summary>
  330. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  331. public static half2 half2(half x, half y) { return new half2(x, y); }
  332. /// <summary>Returns a half2 vector constructed from a half2 vector.</summary>
  333. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  334. public static half2 half2(half2 xy) { return new half2(xy); }
  335. /// <summary>Returns a half2 vector constructed from a single half value by assigning it to every component.</summary>
  336. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  337. public static half2 half2(half v) { return new half2(v); }
  338. /// <summary>Returns a half2 vector constructed from a single float value by converting it to half and assigning it to every component.</summary>
  339. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  340. public static half2 half2(float v) { return new half2(v); }
  341. /// <summary>Return a half2 vector constructed from a float2 vector by componentwise conversion.</summary>
  342. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  343. public static half2 half2(float2 v) { return new half2(v); }
  344. /// <summary>Returns a half2 vector constructed from a single double value by converting it to half and assigning it to every component.</summary>
  345. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  346. public static half2 half2(double v) { return new half2(v); }
  347. /// <summary>Return a half2 vector constructed from a double2 vector by componentwise conversion.</summary>
  348. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  349. public static half2 half2(double2 v) { return new half2(v); }
  350. /// <summary>Returns a uint hash code of a half2 vector.</summary>
  351. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  352. public static uint hash(half2 v)
  353. {
  354. return csum(uint2(v.x.value, v.y.value) * uint2(0x6E624EB7u, 0x7383ED49u)) + 0xDD49C23Bu;
  355. }
  356. /// <summary>
  357. /// Returns a uint2 vector hash code of a half2 vector.
  358. /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
  359. /// that are only reduced to a narrow uint hash at the very end instead of at every step.
  360. /// </summary>
  361. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  362. public static uint2 hashwide(half2 v)
  363. {
  364. return (uint2(v.x.value, v.y.value) * uint2(0xEBD0D005u, 0x91475DF7u)) + 0x55E84827u;
  365. }
  366. }
  367. }