Counter Strike : Global Offensive Source Code
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.

2621 lines
101 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. xnamath.h
  5. Abstract:
  6. XNA math library for Windows and Xbox 360
  7. --*/
  8. #if defined(_MSC_VER) && (_MSC_VER > 1000)
  9. #pragma once
  10. #endif
  11. #ifndef __XNAMATH_H__
  12. #define __XNAMATH_H__
  13. #ifdef __XBOXMATH_H__
  14. #error XNAMATH and XBOXMATH are incompatible in the same compilation module. Use one or the other.
  15. #endif
  16. #define XNAMATH_VERSION 200
  17. #if !defined(_XM_X64_) && !defined(_XM_X86_)
  18. #if defined(_M_AMD64) || defined(_AMD64_)
  19. #define _XM_X64_
  20. #elif defined(_M_IX86) || defined(_X86_)
  21. #define _XM_X86_
  22. #endif
  23. #endif
  24. #if defined(_XM_X86_) || defined(_XM_X64_)
  25. #define _XM_SSE_INTRINSICS_
  26. #if !defined(__cplusplus) && !defined(_XM_NO_INTRINSICS_)
  27. #error xnamath.h only supports C compliation for Xbox 360 targets and no intrinsics cases for x86/x64
  28. #endif
  29. #elif defined(_XBOX_VER)
  30. #if !defined(__VMX128_SUPPORTED) && !defined(_XM_NO_INTRINSICS_)
  31. #error xnamath.h requires VMX128 compiler support for XBOX 360
  32. #endif // !__VMX128_SUPPORTED && !_XM_NO_INTRINSICS_
  33. #define _XM_VMX128_INTRINSICS_
  34. #else
  35. #error xnamath.h only supports x86, x64, or XBox 360 targets
  36. #endif
  37. #if defined(_XM_SSE_INTRINSICS_)
  38. #ifndef _XM_NO_INTRINSICS_
  39. #include <xmmintrin.h>
  40. #include <emmintrin.h>
  41. #endif
  42. #elif defined(_XM_VMX128_INTRINSICS_)
  43. #error This version of xnamath.h is for Windows use only
  44. #endif
  45. #if defined(_XM_SSE_INTRINSICS_)
  46. #pragma warning(push)
  47. #pragma warning(disable:4985)
  48. #endif
  49. #include <math.h>
  50. #if defined(_XM_SSE_INTRINSICS_)
  51. #pragma warning(pop)
  52. #endif
  53. #include <sal.h>
  54. #if !defined(XMINLINE)
  55. #if !defined(XM_NO_MISALIGNED_VECTOR_ACCESS)
  56. #define XMINLINE __inline
  57. #else
  58. #define XMINLINE __forceinline
  59. #endif
  60. #endif
  61. #if !defined(XMFINLINE)
  62. #define XMFINLINE __forceinline
  63. #endif
  64. #if !defined(XMDEBUG)
  65. #if defined(_DEBUG)
  66. #define XMDEBUG
  67. #endif
  68. #endif // !XMDEBUG
  69. #if !defined(XMASSERT)
  70. #if defined(_PREFAST_)
  71. #define XMASSERT(Expression) __analysis_assume((Expression))
  72. #elif defined(XMDEBUG) // !_PREFAST_
  73. #define XMASSERT(Expression) ((VOID)((Expression) || (XMAssert(#Expression, __FILE__, __LINE__), 0)))
  74. #else // !XMDEBUG
  75. #define XMASSERT(Expression) ((VOID)0)
  76. #endif // !XMDEBUG
  77. #endif // !XMASSERT
  78. #if !defined(XM_NO_ALIGNMENT)
  79. #define _DECLSPEC_ALIGN_16_ __declspec(align(16))
  80. #else
  81. #define _DECLSPEC_ALIGN_16_
  82. #endif
  83. #if defined(_MSC_VER) && (_MSC_VER<1500) && (_MSC_VER>=1400)
  84. #define _XM_ISVS2005_
  85. #endif
  86. #if defined(_MSC_VER) && (_MSC_VER<1600) && (_MSC_VER>=1500)
  87. #define _XM_ISVS2008_
  88. #endif
  89. /****************************************************************************
  90. *
  91. * Constant definitions
  92. *
  93. ****************************************************************************/
  94. #define XM_PI 3.141592654f
  95. #define XM_2PI 6.283185307f
  96. #define XM_1DIVPI 0.318309886f
  97. #define XM_1DIV2PI 0.159154943f
  98. #define XM_PIDIV2 1.570796327f
  99. #define XM_PIDIV4 0.785398163f
  100. #define XM_SELECT_0 0x00000000
  101. #define XM_SELECT_1 0xFFFFFFFF
  102. #define XM_PERMUTE_0X 0x00010203
  103. #define XM_PERMUTE_0Y 0x04050607
  104. #define XM_PERMUTE_0Z 0x08090A0B
  105. #define XM_PERMUTE_0W 0x0C0D0E0F
  106. #define XM_PERMUTE_1X 0x10111213
  107. #define XM_PERMUTE_1Y 0x14151617
  108. #define XM_PERMUTE_1Z 0x18191A1B
  109. #define XM_PERMUTE_1W 0x1C1D1E1F
  110. #define XM_CRMASK_CR6 0x000000F0
  111. #define XM_CRMASK_CR6TRUE 0x00000080
  112. #define XM_CRMASK_CR6FALSE 0x00000020
  113. #define XM_CRMASK_CR6BOUNDS XM_CRMASK_CR6FALSE
  114. #define XM_CACHE_LINE_SIZE 64
  115. /****************************************************************************
  116. *
  117. * Macros
  118. *
  119. ****************************************************************************/
  120. // Unit conversion
  121. XMFINLINE FLOAT XMConvertToRadians(FLOAT fDegrees) { return fDegrees * (XM_PI / 180.0f); }
  122. XMFINLINE FLOAT XMConvertToDegrees(FLOAT fRadians) { return fRadians * (180.0f / XM_PI); }
  123. // Condition register evaluation proceeding a recording (Rc) comparison
  124. #define XMComparisonAllTrue(CR) (((CR) & XM_CRMASK_CR6TRUE) == XM_CRMASK_CR6TRUE)
  125. #define XMComparisonAnyTrue(CR) (((CR) & XM_CRMASK_CR6FALSE) != XM_CRMASK_CR6FALSE)
  126. #define XMComparisonAllFalse(CR) (((CR) & XM_CRMASK_CR6FALSE) == XM_CRMASK_CR6FALSE)
  127. #define XMComparisonAnyFalse(CR) (((CR) & XM_CRMASK_CR6TRUE) != XM_CRMASK_CR6TRUE)
  128. #define XMComparisonMixed(CR) (((CR) & XM_CRMASK_CR6) == 0)
  129. #define XMComparisonAllInBounds(CR) (((CR) & XM_CRMASK_CR6BOUNDS) == XM_CRMASK_CR6BOUNDS)
  130. #define XMComparisonAnyOutOfBounds(CR) (((CR) & XM_CRMASK_CR6BOUNDS) != XM_CRMASK_CR6BOUNDS)
  131. #define XMMin(a, b) (((a) < (b)) ? (a) : (b))
  132. #define XMMax(a, b) (((a) > (b)) ? (a) : (b))
  133. /****************************************************************************
  134. *
  135. * Data types
  136. *
  137. ****************************************************************************/
  138. #pragma warning(push)
  139. #pragma warning(disable:4201)
  140. #if !defined (_XM_X86_) && !defined(_XM_X64_)
  141. #pragma bitfield_order(push)
  142. #pragma bitfield_order(lsb_to_msb)
  143. #endif // !_XM_X86_ && !_XM_X64_
  144. #if defined(_XM_NO_INTRINSICS_) && !defined(_XBOX_VER)
  145. // The __vector4 structure is an intrinsic on Xbox but must be separately defined
  146. // for x86/x64
  147. typedef struct __vector4
  148. {
  149. union
  150. {
  151. struct
  152. {
  153. FLOAT x;
  154. FLOAT y;
  155. FLOAT z;
  156. FLOAT w;
  157. };
  158. FLOAT v[4];
  159. UINT u[4];
  160. };
  161. } __vector4;
  162. #endif // _XM_NO_INTRINSICS_
  163. #if (defined (_XM_X86_) || defined(_XM_X64_)) && defined(_XM_NO_INTRINSICS_)
  164. typedef UINT __vector4i[4];
  165. #else
  166. typedef __declspec(align(16)) UINT __vector4i[4];
  167. #endif
  168. // Vector intrinsic: Four 32 bit floating point components aligned on a 16 byte
  169. // boundary and mapped to hardware vector registers
  170. #if defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_)
  171. typedef __m128 XMVECTOR;
  172. #else
  173. typedef __vector4 XMVECTOR;
  174. #endif
  175. // Conversion types for constants
  176. typedef _DECLSPEC_ALIGN_16_ struct XMVECTORF32 {
  177. union {
  178. float f[4];
  179. XMVECTOR v;
  180. };
  181. #if defined(__cplusplus)
  182. inline operator XMVECTOR() const { return v; }
  183. #if !defined(_XM_NO_INTRINSICS_) && defined(_XM_SSE_INTRINSICS_)
  184. inline operator __m128i() const { return reinterpret_cast<const __m128i *>(&v)[0]; }
  185. inline operator __m128d() const { return reinterpret_cast<const __m128d *>(&v)[0]; }
  186. #endif
  187. #endif // __cplusplus
  188. } XMVECTORF32;
  189. typedef _DECLSPEC_ALIGN_16_ struct XMVECTORI32 {
  190. union {
  191. INT i[4];
  192. XMVECTOR v;
  193. };
  194. #if defined(__cplusplus)
  195. inline operator XMVECTOR() const { return v; }
  196. #if !defined(_XM_NO_INTRINSICS_) && defined(_XM_SSE_INTRINSICS_)
  197. inline operator __m128i() const { return reinterpret_cast<const __m128i *>(&v)[0]; }
  198. inline operator __m128d() const { return reinterpret_cast<const __m128d *>(&v)[0]; }
  199. #endif
  200. #endif // __cplusplus
  201. } XMVECTORI32;
  202. typedef _DECLSPEC_ALIGN_16_ struct XMVECTORU8 {
  203. union {
  204. BYTE u[16];
  205. XMVECTOR v;
  206. };
  207. #if defined(__cplusplus)
  208. inline operator XMVECTOR() const { return v; }
  209. #if !defined(_XM_NO_INTRINSICS_) && defined(_XM_SSE_INTRINSICS_)
  210. inline operator __m128i() const { return reinterpret_cast<const __m128i *>(&v)[0]; }
  211. inline operator __m128d() const { return reinterpret_cast<const __m128d *>(&v)[0]; }
  212. #endif
  213. #endif // __cplusplus
  214. } XMVECTORU8;
  215. typedef _DECLSPEC_ALIGN_16_ struct XMVECTORU32 {
  216. union {
  217. UINT u[4];
  218. XMVECTOR v;
  219. };
  220. #if defined(__cplusplus)
  221. inline operator XMVECTOR() const { return v; }
  222. #if !defined(_XM_NO_INTRINSICS_) && defined(_XM_SSE_INTRINSICS_)
  223. inline operator __m128i() const { return reinterpret_cast<const __m128i *>(&v)[0]; }
  224. inline operator __m128d() const { return reinterpret_cast<const __m128d *>(&v)[0]; }
  225. #endif
  226. #endif // __cplusplus
  227. } XMVECTORU32;
  228. // Fix-up for (1st-3rd) XMVECTOR parameters that are pass-in-register for x86 and Xbox 360, but not for other targets
  229. #if defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINISCS_)
  230. typedef const XMVECTOR FXMVECTOR;
  231. #elif defined(_XM_X86_) && !defined(_XM_NO_INTRINISCS_)
  232. typedef const XMVECTOR FXMVECTOR;
  233. #elif defined(__cplusplus)
  234. typedef const XMVECTOR& FXMVECTOR;
  235. #else
  236. typedef const XMVECTOR FXMVECTOR;
  237. #endif
  238. // Fix-up for (4th+) XMVECTOR parameters to pass in-register for Xbox 360 and by reference otherwise
  239. #if defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINISCS_)
  240. typedef const XMVECTOR CXMVECTOR;
  241. #elif defined(__cplusplus)
  242. typedef const XMVECTOR& CXMVECTOR;
  243. #else
  244. typedef const XMVECTOR CXMVECTOR;
  245. #endif
  246. // Vector operators
  247. #if defined(__cplusplus) && !defined(XM_NO_OPERATOR_OVERLOADS)
  248. XMVECTOR operator+ (FXMVECTOR V);
  249. XMVECTOR operator- (FXMVECTOR V);
  250. XMVECTOR& operator+= (XMVECTOR& V1, FXMVECTOR V2);
  251. XMVECTOR& operator-= (XMVECTOR& V1, FXMVECTOR V2);
  252. XMVECTOR& operator*= (XMVECTOR& V1, FXMVECTOR V2);
  253. XMVECTOR& operator/= (XMVECTOR& V1, FXMVECTOR V2);
  254. XMVECTOR& operator*= (XMVECTOR& V, FLOAT S);
  255. XMVECTOR& operator/= (XMVECTOR& V, FLOAT S);
  256. XMVECTOR operator+ (FXMVECTOR V1, FXMVECTOR V2);
  257. XMVECTOR operator- (FXMVECTOR V1, FXMVECTOR V2);
  258. XMVECTOR operator* (FXMVECTOR V1, FXMVECTOR V2);
  259. XMVECTOR operator/ (FXMVECTOR V1, FXMVECTOR V2);
  260. XMVECTOR operator* (FXMVECTOR V, FLOAT S);
  261. XMVECTOR operator* (FLOAT S, FXMVECTOR V);
  262. XMVECTOR operator/ (FXMVECTOR V, FLOAT S);
  263. #endif // __cplusplus && !XM_NO_OPERATOR_OVERLOADS
  264. // Matrix type: Sixteen 32 bit floating point components aligned on a
  265. // 16 byte boundary and mapped to four hardware vector registers
  266. #if (defined(_XM_X86_) || defined(_XM_X64_)) && defined(_XM_NO_INTRINSICS_)
  267. typedef struct _XMMATRIX
  268. #else
  269. typedef _DECLSPEC_ALIGN_16_ struct _XMMATRIX
  270. #endif
  271. {
  272. union
  273. {
  274. XMVECTOR r[4];
  275. struct
  276. {
  277. FLOAT _11, _12, _13, _14;
  278. FLOAT _21, _22, _23, _24;
  279. FLOAT _31, _32, _33, _34;
  280. FLOAT _41, _42, _43, _44;
  281. };
  282. FLOAT m[4][4];
  283. };
  284. #ifdef __cplusplus
  285. _XMMATRIX() {};
  286. _XMMATRIX(FXMVECTOR R0, FXMVECTOR R1, FXMVECTOR R2, CXMVECTOR R3);
  287. _XMMATRIX(FLOAT m00, FLOAT m01, FLOAT m02, FLOAT m03,
  288. FLOAT m10, FLOAT m11, FLOAT m12, FLOAT m13,
  289. FLOAT m20, FLOAT m21, FLOAT m22, FLOAT m23,
  290. FLOAT m30, FLOAT m31, FLOAT m32, FLOAT m33);
  291. _XMMATRIX(CONST FLOAT *pArray);
  292. FLOAT operator() (UINT Row, UINT Column) CONST;
  293. FLOAT& operator() (UINT Row, UINT Column);
  294. _XMMATRIX& operator= (CONST _XMMATRIX&);
  295. #ifndef XM_NO_OPERATOR_OVERLOADS
  296. _XMMATRIX& operator*= (CONST _XMMATRIX&);
  297. _XMMATRIX operator* (CONST _XMMATRIX&) CONST;
  298. #endif // !XM_NO_OPERATOR_OVERLOADS
  299. #endif // __cplusplus
  300. } XMMATRIX;
  301. // Fix-up for XMMATRIX parameters to pass in-register on Xbox 360, by reference otherwise
  302. #if defined(_XM_VMX128_INTRINSICS_)
  303. typedef const XMMATRIX CXMMATRIX;
  304. #elif defined(__cplusplus)
  305. typedef const XMMATRIX& CXMMATRIX;
  306. #else
  307. typedef const XMMATRIX CXMMATRIX;
  308. #endif
  309. // 16 bit floating point number consisting of a sign bit, a 5 bit biased
  310. // exponent, and a 10 bit mantissa
  311. //typedef WORD HALF;
  312. typedef USHORT HALF;
  313. // 2D Vector; 32 bit floating point components
  314. typedef struct _XMFLOAT2
  315. {
  316. FLOAT x;
  317. FLOAT y;
  318. #ifdef __cplusplus
  319. _XMFLOAT2() {};
  320. _XMFLOAT2(FLOAT _x, FLOAT _y);
  321. _XMFLOAT2(CONST FLOAT *pArray);
  322. _XMFLOAT2& operator= (CONST _XMFLOAT2& Float2);
  323. #endif // __cplusplus
  324. } XMFLOAT2;
  325. // 2D Vector; 32 bit floating point components aligned on a 16 byte boundary
  326. typedef __declspec(align(16)) XMFLOAT2 XMFLOAT2A;
  327. // 2D Vector; 16 bit floating point components
  328. typedef struct _XMHALF2
  329. {
  330. HALF x;
  331. HALF y;
  332. #ifdef __cplusplus
  333. _XMHALF2() {};
  334. _XMHALF2(HALF _x, HALF _y);
  335. _XMHALF2(CONST HALF *pArray);
  336. _XMHALF2(FLOAT _x, FLOAT _y);
  337. _XMHALF2(CONST FLOAT *pArray);
  338. _XMHALF2& operator= (CONST _XMHALF2& Half2);
  339. #endif // __cplusplus
  340. } XMHALF2;
  341. // 2D Vector; 16 bit signed normalized integer components
  342. typedef struct _XMSHORTN2
  343. {
  344. SHORT x;
  345. SHORT y;
  346. #ifdef __cplusplus
  347. _XMSHORTN2() {};
  348. _XMSHORTN2(SHORT _x, SHORT _y);
  349. _XMSHORTN2(CONST SHORT *pArray);
  350. _XMSHORTN2(FLOAT _x, FLOAT _y);
  351. _XMSHORTN2(CONST FLOAT *pArray);
  352. _XMSHORTN2& operator= (CONST _XMSHORTN2& ShortN2);
  353. #endif // __cplusplus
  354. } XMSHORTN2;
  355. // 2D Vector; 16 bit signed integer components
  356. typedef struct _XMSHORT2
  357. {
  358. SHORT x;
  359. SHORT y;
  360. #ifdef __cplusplus
  361. _XMSHORT2() {};
  362. _XMSHORT2(SHORT _x, SHORT _y);
  363. _XMSHORT2(CONST SHORT *pArray);
  364. _XMSHORT2(FLOAT _x, FLOAT _y);
  365. _XMSHORT2(CONST FLOAT *pArray);
  366. _XMSHORT2& operator= (CONST _XMSHORT2& Short2);
  367. #endif // __cplusplus
  368. } XMSHORT2;
  369. // 2D Vector; 16 bit unsigned normalized integer components
  370. typedef struct _XMUSHORTN2
  371. {
  372. USHORT x;
  373. USHORT y;
  374. #ifdef __cplusplus
  375. _XMUSHORTN2() {};
  376. _XMUSHORTN2(USHORT _x, USHORT _y);
  377. _XMUSHORTN2(CONST USHORT *pArray);
  378. _XMUSHORTN2(FLOAT _x, FLOAT _y);
  379. _XMUSHORTN2(CONST FLOAT *pArray);
  380. _XMUSHORTN2& operator= (CONST _XMUSHORTN2& UShortN2);
  381. #endif // __cplusplus
  382. } XMUSHORTN2;
  383. // 2D Vector; 16 bit unsigned integer components
  384. typedef struct _XMUSHORT2
  385. {
  386. USHORT x;
  387. USHORT y;
  388. #ifdef __cplusplus
  389. _XMUSHORT2() {};
  390. _XMUSHORT2(USHORT _x, USHORT _y);
  391. _XMUSHORT2(CONST USHORT *pArray);
  392. _XMUSHORT2(FLOAT _x, FLOAT _y);
  393. _XMUSHORT2(CONST FLOAT *pArray);
  394. _XMUSHORT2& operator= (CONST _XMUSHORT2& UShort2);
  395. #endif // __cplusplus
  396. } XMUSHORT2;
  397. // 3D Vector; 32 bit floating point components
  398. typedef struct _XMFLOAT3
  399. {
  400. FLOAT x;
  401. FLOAT y;
  402. FLOAT z;
  403. #ifdef __cplusplus
  404. _XMFLOAT3() {};
  405. _XMFLOAT3(FLOAT _x, FLOAT _y, FLOAT _z);
  406. _XMFLOAT3(CONST FLOAT *pArray);
  407. _XMFLOAT3& operator= (CONST _XMFLOAT3& Float3);
  408. #endif // __cplusplus
  409. } XMFLOAT3;
  410. // 3D Vector; 32 bit floating point components aligned on a 16 byte boundary
  411. typedef __declspec(align(16)) XMFLOAT3 XMFLOAT3A;
  412. // 3D Vector; 11-11-10 bit normalized components packed into a 32 bit integer
  413. // The normalized 3D Vector is packed into 32 bits as follows: a 10 bit signed,
  414. // normalized integer for the z component and 11 bit signed, normalized
  415. // integers for the x and y components. The z component is stored in the
  416. // most significant bits and the x component in the least significant bits
  417. // (Z10Y11X11): [32] zzzzzzzz zzyyyyyy yyyyyxxx xxxxxxxx [0]
  418. typedef struct _XMHENDN3
  419. {
  420. union
  421. {
  422. struct
  423. {
  424. INT x : 11; // -1023/1023 to 1023/1023
  425. INT y : 11; // -1023/1023 to 1023/1023
  426. INT z : 10; // -511/511 to 511/511
  427. };
  428. UINT v;
  429. };
  430. #ifdef __cplusplus
  431. _XMHENDN3() {};
  432. _XMHENDN3(UINT Packed);
  433. _XMHENDN3(FLOAT _x, FLOAT _y, FLOAT _z);
  434. _XMHENDN3(CONST FLOAT *pArray);
  435. operator UINT ();
  436. _XMHENDN3& operator= (CONST _XMHENDN3& HenDN3);
  437. _XMHENDN3& operator= (CONST UINT Packed);
  438. #endif // __cplusplus
  439. } XMHENDN3;
  440. // 3D Vector; 11-11-10 bit components packed into a 32 bit integer
  441. // The 3D Vector is packed into 32 bits as follows: a 10 bit signed,
  442. // integer for the z component and 11 bit signed integers for the
  443. // x and y components. The z component is stored in the
  444. // most significant bits and the x component in the least significant bits
  445. // (Z10Y11X11): [32] zzzzzzzz zzyyyyyy yyyyyxxx xxxxxxxx [0]
  446. typedef struct _XMHEND3
  447. {
  448. union
  449. {
  450. struct
  451. {
  452. INT x : 11; // -1023 to 1023
  453. INT y : 11; // -1023 to 1023
  454. INT z : 10; // -511 to 511
  455. };
  456. UINT v;
  457. };
  458. #ifdef __cplusplus
  459. _XMHEND3() {};
  460. _XMHEND3(UINT Packed);
  461. _XMHEND3(FLOAT _x, FLOAT _y, FLOAT _z);
  462. _XMHEND3(CONST FLOAT *pArray);
  463. operator UINT ();
  464. _XMHEND3& operator= (CONST _XMHEND3& HenD3);
  465. _XMHEND3& operator= (CONST UINT Packed);
  466. #endif // __cplusplus
  467. } XMHEND3;
  468. // 3D Vector; 11-11-10 bit normalized components packed into a 32 bit integer
  469. // The normalized 3D Vector is packed into 32 bits as follows: a 10 bit unsigned,
  470. // normalized integer for the z component and 11 bit unsigned, normalized
  471. // integers for the x and y components. The z component is stored in the
  472. // most significant bits and the x component in the least significant bits
  473. // (Z10Y11X11): [32] zzzzzzzz zzyyyyyy yyyyyxxx xxxxxxxx [0]
  474. typedef struct _XMUHENDN3
  475. {
  476. union
  477. {
  478. struct
  479. {
  480. UINT x : 11; // 0/2047 to 2047/2047
  481. UINT y : 11; // 0/2047 to 2047/2047
  482. UINT z : 10; // 0/1023 to 1023/1023
  483. };
  484. UINT v;
  485. };
  486. #ifdef __cplusplus
  487. _XMUHENDN3() {};
  488. _XMUHENDN3(UINT Packed);
  489. _XMUHENDN3(FLOAT _x, FLOAT _y, FLOAT _z);
  490. _XMUHENDN3(CONST FLOAT *pArray);
  491. operator UINT ();
  492. _XMUHENDN3& operator= (CONST _XMUHENDN3& UHenDN3);
  493. _XMUHENDN3& operator= (CONST UINT Packed);
  494. #endif // __cplusplus
  495. } XMUHENDN3;
  496. // 3D Vector; 11-11-10 bit components packed into a 32 bit integer
  497. // The 3D Vector is packed into 32 bits as follows: a 10 bit unsigned
  498. // integer for the z component and 11 bit unsigned integers
  499. // for the x and y components. The z component is stored in the
  500. // most significant bits and the x component in the least significant bits
  501. // (Z10Y11X11): [32] zzzzzzzz zzyyyyyy yyyyyxxx xxxxxxxx [0]
  502. typedef struct _XMUHEND3
  503. {
  504. union
  505. {
  506. struct
  507. {
  508. UINT x : 11; // 0 to 2047
  509. UINT y : 11; // 0 to 2047
  510. UINT z : 10; // 0 to 1023
  511. };
  512. UINT v;
  513. };
  514. #ifdef __cplusplus
  515. _XMUHEND3() {};
  516. _XMUHEND3(UINT Packed);
  517. _XMUHEND3(FLOAT _x, FLOAT _y, FLOAT _z);
  518. _XMUHEND3(CONST FLOAT *pArray);
  519. operator UINT ();
  520. _XMUHEND3& operator= (CONST _XMUHEND3& UHenD3);
  521. _XMUHEND3& operator= (CONST UINT Packed);
  522. #endif // __cplusplus
  523. } XMUHEND3;
  524. // 3D Vector; 10-11-11 bit normalized components packed into a 32 bit integer
  525. // The normalized 3D Vector is packed into 32 bits as follows: a 10 bit signed,
  526. // normalized integer for the x component and 11 bit signed, normalized
  527. // integers for the y and z components. The z component is stored in the
  528. // most significant bits and the x component in the least significant bits
  529. // (Z11Y11X10): [32] zzzzzzzz zzzyyyyy yyyyyyxx xxxxxxxx [0]
  530. typedef struct _XMDHENN3
  531. {
  532. union
  533. {
  534. struct
  535. {
  536. INT x : 10; // -511/511 to 511/511
  537. INT y : 11; // -1023/1023 to 1023/1023
  538. INT z : 11; // -1023/1023 to 1023/1023
  539. };
  540. UINT v;
  541. };
  542. #ifdef __cplusplus
  543. _XMDHENN3() {};
  544. _XMDHENN3(UINT Packed);
  545. _XMDHENN3(FLOAT _x, FLOAT _y, FLOAT _z);
  546. _XMDHENN3(CONST FLOAT *pArray);
  547. operator UINT ();
  548. _XMDHENN3& operator= (CONST _XMDHENN3& DHenN3);
  549. _XMDHENN3& operator= (CONST UINT Packed);
  550. #endif // __cplusplus
  551. } XMDHENN3;
  552. // 3D Vector; 10-11-11 bit components packed into a 32 bit integer
  553. // The 3D Vector is packed into 32 bits as follows: a 10 bit signed,
  554. // integer for the x component and 11 bit signed integers for the
  555. // y and z components. The w component is stored in the
  556. // most significant bits and the x component in the least significant bits
  557. // (Z11Y11X10): [32] zzzzzzzz zzzyyyyy yyyyyyxx xxxxxxxx [0]
  558. typedef struct _XMDHEN3
  559. {
  560. union
  561. {
  562. struct
  563. {
  564. INT x : 10; // -511 to 511
  565. INT y : 11; // -1023 to 1023
  566. INT z : 11; // -1023 to 1023
  567. };
  568. UINT v;
  569. };
  570. #ifdef __cplusplus
  571. _XMDHEN3() {};
  572. _XMDHEN3(UINT Packed);
  573. _XMDHEN3(FLOAT _x, FLOAT _y, FLOAT _z);
  574. _XMDHEN3(CONST FLOAT *pArray);
  575. operator UINT ();
  576. _XMDHEN3& operator= (CONST _XMDHEN3& DHen3);
  577. _XMDHEN3& operator= (CONST UINT Packed);
  578. #endif // __cplusplus
  579. } XMDHEN3;
  580. // 3D Vector; 10-11-11 bit normalized components packed into a 32 bit integer
  581. // The normalized 3D Vector is packed into 32 bits as follows: a 10 bit unsigned,
  582. // normalized integer for the x component and 11 bit unsigned, normalized
  583. // integers for the y and z components. The w component is stored in the
  584. // most significant bits and the x component in the least significant bits
  585. // (Z11Y11X10): [32] zzzzzzzz zzzyyyyy yyyyyyxx xxxxxxxx [0]
  586. typedef struct _XMUDHENN3
  587. {
  588. union
  589. {
  590. struct
  591. {
  592. UINT x : 10; // 0/1023 to 1023/1023
  593. UINT y : 11; // 0/2047 to 2047/2047
  594. UINT z : 11; // 0/2047 to 2047/2047
  595. };
  596. UINT v;
  597. };
  598. #ifdef __cplusplus
  599. _XMUDHENN3() {};
  600. _XMUDHENN3(UINT Packed);
  601. _XMUDHENN3(FLOAT _x, FLOAT _y, FLOAT _z);
  602. _XMUDHENN3(CONST FLOAT *pArray);
  603. operator UINT ();
  604. _XMUDHENN3& operator= (CONST _XMUDHENN3& UDHenN3);
  605. _XMUDHENN3& operator= (CONST UINT Packed);
  606. #endif // __cplusplus
  607. } XMUDHENN3;
  608. // 3D Vector; 10-11-11 bit components packed into a 32 bit integer
  609. // The 3D Vector is packed into 32 bits as follows: a 10 bit unsigned,
  610. // integer for the x component and 11 bit unsigned integers
  611. // for the y and z components. The w component is stored in the
  612. // most significant bits and the x component in the least significant bits
  613. // (Z11Y11X10): [32] zzzzzzzz zzzyyyyy yyyyyyxx xxxxxxxx [0]
  614. typedef struct _XMUDHEN3
  615. {
  616. union
  617. {
  618. struct
  619. {
  620. UINT x : 10; // 0 to 1023
  621. UINT y : 11; // 0 to 2047
  622. UINT z : 11; // 0 to 2047
  623. };
  624. UINT v;
  625. };
  626. #ifdef __cplusplus
  627. _XMUDHEN3() {};
  628. _XMUDHEN3(UINT Packed);
  629. _XMUDHEN3(FLOAT _x, FLOAT _y, FLOAT _z);
  630. _XMUDHEN3(CONST FLOAT *pArray);
  631. operator UINT ();
  632. _XMUDHEN3& operator= (CONST _XMUDHEN3& UDHen3);
  633. _XMUDHEN3& operator= (CONST UINT Packed);
  634. #endif // __cplusplus
  635. } XMUDHEN3;
  636. // 4D Vector; 32 bit floating point components
  637. typedef struct _XMFLOAT4
  638. {
  639. FLOAT x;
  640. FLOAT y;
  641. FLOAT z;
  642. FLOAT w;
  643. #ifdef __cplusplus
  644. _XMFLOAT4() {};
  645. _XMFLOAT4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  646. _XMFLOAT4(CONST FLOAT *pArray);
  647. _XMFLOAT4& operator= (CONST _XMFLOAT4& Float4);
  648. #endif // __cplusplus
  649. } XMFLOAT4;
  650. // 4D Vector; 32 bit floating point components aligned on a 16 byte boundary
  651. typedef __declspec(align(16)) XMFLOAT4 XMFLOAT4A;
  652. // 4D Vector; 16 bit floating point components
  653. typedef struct _XMHALF4
  654. {
  655. HALF x;
  656. HALF y;
  657. HALF z;
  658. HALF w;
  659. #ifdef __cplusplus
  660. _XMHALF4() {};
  661. _XMHALF4(HALF _x, HALF _y, HALF _z, HALF _w);
  662. _XMHALF4(CONST HALF *pArray);
  663. _XMHALF4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  664. _XMHALF4(CONST FLOAT *pArray);
  665. _XMHALF4& operator= (CONST _XMHALF4& Half4);
  666. #endif // __cplusplus
  667. } XMHALF4;
  668. // 4D Vector; 16 bit signed normalized integer components
  669. typedef struct _XMSHORTN4
  670. {
  671. SHORT x;
  672. SHORT y;
  673. SHORT z;
  674. SHORT w;
  675. #ifdef __cplusplus
  676. _XMSHORTN4() {};
  677. _XMSHORTN4(SHORT _x, SHORT _y, SHORT _z, SHORT _w);
  678. _XMSHORTN4(CONST SHORT *pArray);
  679. _XMSHORTN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  680. _XMSHORTN4(CONST FLOAT *pArray);
  681. _XMSHORTN4& operator= (CONST _XMSHORTN4& ShortN4);
  682. #endif // __cplusplus
  683. } XMSHORTN4;
  684. // 4D Vector; 16 bit signed integer components
  685. typedef struct _XMSHORT4
  686. {
  687. SHORT x;
  688. SHORT y;
  689. SHORT z;
  690. SHORT w;
  691. #ifdef __cplusplus
  692. _XMSHORT4() {};
  693. _XMSHORT4(SHORT _x, SHORT _y, SHORT _z, SHORT _w);
  694. _XMSHORT4(CONST SHORT *pArray);
  695. _XMSHORT4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  696. _XMSHORT4(CONST FLOAT *pArray);
  697. _XMSHORT4& operator= (CONST _XMSHORT4& Short4);
  698. #endif // __cplusplus
  699. } XMSHORT4;
  700. // 4D Vector; 16 bit unsigned normalized integer components
  701. typedef struct _XMUSHORTN4
  702. {
  703. USHORT x;
  704. USHORT y;
  705. USHORT z;
  706. USHORT w;
  707. #ifdef __cplusplus
  708. _XMUSHORTN4() {};
  709. _XMUSHORTN4(USHORT _x, USHORT _y, USHORT _z, USHORT _w);
  710. _XMUSHORTN4(CONST USHORT *pArray);
  711. _XMUSHORTN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  712. _XMUSHORTN4(CONST FLOAT *pArray);
  713. _XMUSHORTN4& operator= (CONST _XMUSHORTN4& UShortN4);
  714. #endif // __cplusplus
  715. } XMUSHORTN4;
  716. // 4D Vector; 16 bit unsigned integer components
  717. typedef struct _XMUSHORT4
  718. {
  719. USHORT x;
  720. USHORT y;
  721. USHORT z;
  722. USHORT w;
  723. #ifdef __cplusplus
  724. _XMUSHORT4() {};
  725. _XMUSHORT4(USHORT _x, USHORT _y, USHORT _z, USHORT _w);
  726. _XMUSHORT4(CONST USHORT *pArray);
  727. _XMUSHORT4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  728. _XMUSHORT4(CONST FLOAT *pArray);
  729. _XMUSHORT4& operator= (CONST _XMUSHORT4& UShort4);
  730. #endif // __cplusplus
  731. } XMUSHORT4;
  732. // 4D Vector; 10-10-10-2 bit normalized components packed into a 32 bit integer
  733. // The normalized 4D Vector is packed into 32 bits as follows: a 2 bit unsigned,
  734. // normalized integer for the w component and 10 bit signed, normalized
  735. // integers for the z, y, and x components. The w component is stored in the
  736. // most significant bits and the x component in the least significant bits
  737. // (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0]
  738. typedef struct _XMXDECN4
  739. {
  740. union
  741. {
  742. struct
  743. {
  744. INT x : 10; // -511/511 to 511/511
  745. INT y : 10; // -511/511 to 511/511
  746. INT z : 10; // -511/511 to 511/511
  747. UINT w : 2; // 0/3 to 3/3
  748. };
  749. UINT v;
  750. };
  751. #ifdef __cplusplus
  752. _XMXDECN4() {};
  753. _XMXDECN4(UINT Packed);
  754. _XMXDECN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  755. _XMXDECN4(CONST FLOAT *pArray);
  756. operator UINT ();
  757. _XMXDECN4& operator= (CONST _XMXDECN4& XDecN4);
  758. _XMXDECN4& operator= (CONST UINT Packed);
  759. #endif // __cplusplus
  760. } XMXDECN4;
  761. // 4D Vector; 10-10-10-2 bit components packed into a 32 bit integer
  762. // The normalized 4D Vector is packed into 32 bits as follows: a 2 bit unsigned
  763. // integer for the w component and 10 bit signed integers for the
  764. // z, y, and x components. The w component is stored in the
  765. // most significant bits and the x component in the least significant bits
  766. // (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0]
  767. typedef struct _XMXDEC4
  768. {
  769. union
  770. {
  771. struct
  772. {
  773. INT x : 10; // -511 to 511
  774. INT y : 10; // -511 to 511
  775. INT z : 10; // -511 to 511
  776. UINT w : 2; // 0 to 3
  777. };
  778. UINT v;
  779. };
  780. #ifdef __cplusplus
  781. _XMXDEC4() {};
  782. _XMXDEC4(UINT Packed);
  783. _XMXDEC4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  784. _XMXDEC4(CONST FLOAT *pArray);
  785. operator UINT ();
  786. _XMXDEC4& operator= (CONST _XMXDEC4& XDec4);
  787. _XMXDEC4& operator= (CONST UINT Packed);
  788. #endif // __cplusplus
  789. } XMXDEC4;
  790. // 4D Vector; 10-10-10-2 bit normalized components packed into a 32 bit integer
  791. // The normalized 4D Vector is packed into 32 bits as follows: a 2 bit signed,
  792. // normalized integer for the w component and 10 bit signed, normalized
  793. // integers for the z, y, and x components. The w component is stored in the
  794. // most significant bits and the x component in the least significant bits
  795. // (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0]
  796. typedef struct _XMDECN4
  797. {
  798. union
  799. {
  800. struct
  801. {
  802. INT x : 10; // -511/511 to 511/511
  803. INT y : 10; // -511/511 to 511/511
  804. INT z : 10; // -511/511 to 511/511
  805. INT w : 2; // -1/1 to 1/1
  806. };
  807. UINT v;
  808. };
  809. #ifdef __cplusplus
  810. _XMDECN4() {};
  811. _XMDECN4(UINT Packed);
  812. _XMDECN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  813. _XMDECN4(CONST FLOAT *pArray);
  814. operator UINT ();
  815. _XMDECN4& operator= (CONST _XMDECN4& DecN4);
  816. _XMDECN4& operator= (CONST UINT Packed);
  817. #endif // __cplusplus
  818. } XMDECN4;
  819. // 4D Vector; 10-10-10-2 bit components packed into a 32 bit integer
  820. // The 4D Vector is packed into 32 bits as follows: a 2 bit signed,
  821. // integer for the w component and 10 bit signed integers for the
  822. // z, y, and x components. The w component is stored in the
  823. // most significant bits and the x component in the least significant bits
  824. // (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0]
  825. typedef struct _XMDEC4
  826. {
  827. union
  828. {
  829. struct
  830. {
  831. INT x : 10; // -511 to 511
  832. INT y : 10; // -511 to 511
  833. INT z : 10; // -511 to 511
  834. INT w : 2; // -1 to 1
  835. };
  836. UINT v;
  837. };
  838. #ifdef __cplusplus
  839. _XMDEC4() {};
  840. _XMDEC4(UINT Packed);
  841. _XMDEC4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  842. _XMDEC4(CONST FLOAT *pArray);
  843. operator UINT ();
  844. _XMDEC4& operator= (CONST _XMDEC4& Dec4);
  845. _XMDEC4& operator= (CONST UINT Packed);
  846. #endif // __cplusplus
  847. } XMDEC4;
  848. // 4D Vector; 10-10-10-2 bit normalized components packed into a 32 bit integer
  849. // The normalized 4D Vector is packed into 32 bits as follows: a 2 bit unsigned,
  850. // normalized integer for the w component and 10 bit unsigned, normalized
  851. // integers for the z, y, and x components. The w component is stored in the
  852. // most significant bits and the x component in the least significant bits
  853. // (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0]
  854. typedef struct _XMUDECN4
  855. {
  856. union
  857. {
  858. struct
  859. {
  860. UINT x : 10; // 0/1023 to 1023/1023
  861. UINT y : 10; // 0/1023 to 1023/1023
  862. UINT z : 10; // 0/1023 to 1023/1023
  863. UINT w : 2; // 0/3 to 3/3
  864. };
  865. UINT v;
  866. };
  867. #ifdef __cplusplus
  868. _XMUDECN4() {};
  869. _XMUDECN4(UINT Packed);
  870. _XMUDECN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  871. _XMUDECN4(CONST FLOAT *pArray);
  872. operator UINT ();
  873. _XMUDECN4& operator= (CONST _XMUDECN4& UDecN4);
  874. _XMUDECN4& operator= (CONST UINT Packed);
  875. #endif // __cplusplus
  876. } XMUDECN4;
  877. // 4D Vector; 10-10-10-2 bit components packed into a 32 bit integer
  878. // The 4D Vector is packed into 32 bits as follows: a 2 bit unsigned,
  879. // integer for the w component and 10 bit unsigned integers
  880. // for the z, y, and x components. The w component is stored in the
  881. // most significant bits and the x component in the least significant bits
  882. // (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0]
  883. typedef struct _XMUDEC4
  884. {
  885. union
  886. {
  887. struct
  888. {
  889. UINT x : 10; // 0 to 1023
  890. UINT y : 10; // 0 to 1023
  891. UINT z : 10; // 0 to 1023
  892. UINT w : 2; // 0 to 3
  893. };
  894. UINT v;
  895. };
  896. #ifdef __cplusplus
  897. _XMUDEC4() {};
  898. _XMUDEC4(UINT Packed);
  899. _XMUDEC4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  900. _XMUDEC4(CONST FLOAT *pArray);
  901. operator UINT ();
  902. _XMUDEC4& operator= (CONST _XMUDEC4& UDec4);
  903. _XMUDEC4& operator= (CONST UINT Packed);
  904. #endif // __cplusplus
  905. } XMUDEC4;
  906. // 4D Vector; 20-20-20-4 bit normalized components packed into a 64 bit integer
  907. // The normalized 4D Vector is packed into 64 bits as follows: a 4 bit unsigned,
  908. // normalized integer for the w component and 20 bit signed, normalized
  909. // integers for the z, y, and x components. The w component is stored in the
  910. // most significant bits and the x component in the least significant bits
  911. // (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0]
  912. typedef struct _XMXICON4
  913. {
  914. union
  915. {
  916. struct
  917. {
  918. INT64 x : 20; // -524287/524287 to 524287/524287
  919. INT64 y : 20; // -524287/524287 to 524287/524287
  920. INT64 z : 20; // -524287/524287 to 524287/524287
  921. UINT64 w : 4; // 0/15 to 15/15
  922. };
  923. UINT64 v;
  924. };
  925. #ifdef __cplusplus
  926. _XMXICON4() {};
  927. _XMXICON4(UINT64 Packed);
  928. _XMXICON4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  929. _XMXICON4(CONST FLOAT *pArray);
  930. operator UINT64 ();
  931. _XMXICON4& operator= (CONST _XMXICON4& XIcoN4);
  932. _XMXICON4& operator= (CONST UINT64 Packed);
  933. #endif // __cplusplus
  934. } XMXICON4;
  935. // 4D Vector; 20-20-20-4 bit components packed into a 64 bit integer
  936. // The 4D Vector is packed into 64 bits as follows: a 4 bit unsigned
  937. // integer for the w component and 20 bit signed integers for the
  938. // z, y, and x components. The w component is stored in the
  939. // most significant bits and the x component in the least significant bits
  940. // (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0]
  941. typedef struct _XMXICO4
  942. {
  943. union
  944. {
  945. struct
  946. {
  947. INT64 x : 20; // -524287 to 524287
  948. INT64 y : 20; // -524287 to 524287
  949. INT64 z : 20; // -524287 to 524287
  950. UINT64 w : 4; // 0 to 15
  951. };
  952. UINT64 v;
  953. };
  954. #ifdef __cplusplus
  955. _XMXICO4() {};
  956. _XMXICO4(UINT64 Packed);
  957. _XMXICO4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  958. _XMXICO4(CONST FLOAT *pArray);
  959. operator UINT64 ();
  960. _XMXICO4& operator= (CONST _XMXICO4& XIco4);
  961. _XMXICO4& operator= (CONST UINT64 Packed);
  962. #endif // __cplusplus
  963. } XMXICO4;
  964. // 4D Vector; 20-20-20-4 bit normalized components packed into a 64 bit integer
  965. // The normalized 4D Vector is packed into 64 bits as follows: a 4 bit signed,
  966. // normalized integer for the w component and 20 bit signed, normalized
  967. // integers for the z, y, and x components. The w component is stored in the
  968. // most significant bits and the x component in the least significant bits
  969. // (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0]
  970. typedef struct _XMICON4
  971. {
  972. union
  973. {
  974. struct
  975. {
  976. INT64 x : 20; // -524287/524287 to 524287/524287
  977. INT64 y : 20; // -524287/524287 to 524287/524287
  978. INT64 z : 20; // -524287/524287 to 524287/524287
  979. INT64 w : 4; // -7/7 to 7/7
  980. };
  981. UINT64 v;
  982. };
  983. #ifdef __cplusplus
  984. _XMICON4() {};
  985. _XMICON4(UINT64 Packed);
  986. _XMICON4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  987. _XMICON4(CONST FLOAT *pArray);
  988. operator UINT64 ();
  989. _XMICON4& operator= (CONST _XMICON4& IcoN4);
  990. _XMICON4& operator= (CONST UINT64 Packed);
  991. #endif // __cplusplus
  992. } XMICON4;
  993. // 4D Vector; 20-20-20-4 bit components packed into a 64 bit integer
  994. // The 4D Vector is packed into 64 bits as follows: a 4 bit signed,
  995. // integer for the w component and 20 bit signed integers for the
  996. // z, y, and x components. The w component is stored in the
  997. // most significant bits and the x component in the least significant bits
  998. // (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0]
  999. typedef struct _XMICO4
  1000. {
  1001. union
  1002. {
  1003. struct
  1004. {
  1005. INT64 x : 20; // -524287 to 524287
  1006. INT64 y : 20; // -524287 to 524287
  1007. INT64 z : 20; // -524287 to 524287
  1008. INT64 w : 4; // -7 to 7
  1009. };
  1010. UINT64 v;
  1011. };
  1012. #ifdef __cplusplus
  1013. _XMICO4() {};
  1014. _XMICO4(UINT64 Packed);
  1015. _XMICO4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  1016. _XMICO4(CONST FLOAT *pArray);
  1017. operator UINT64 ();
  1018. _XMICO4& operator= (CONST _XMICO4& Ico4);
  1019. _XMICO4& operator= (CONST UINT64 Packed);
  1020. #endif // __cplusplus
  1021. } XMICO4;
  1022. // 4D Vector; 20-20-20-4 bit normalized components packed into a 64 bit integer
  1023. // The normalized 4D Vector is packed into 64 bits as follows: a 4 bit unsigned,
  1024. // normalized integer for the w component and 20 bit unsigned, normalized
  1025. // integers for the z, y, and x components. The w component is stored in the
  1026. // most significant bits and the x component in the least significant bits
  1027. // (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0]
  1028. typedef struct _XMUICON4
  1029. {
  1030. union
  1031. {
  1032. struct
  1033. {
  1034. UINT64 x : 20; // 0/1048575 to 1048575/1048575
  1035. UINT64 y : 20; // 0/1048575 to 1048575/1048575
  1036. UINT64 z : 20; // 0/1048575 to 1048575/1048575
  1037. UINT64 w : 4; // 0/15 to 15/15
  1038. };
  1039. UINT64 v;
  1040. };
  1041. #ifdef __cplusplus
  1042. _XMUICON4() {};
  1043. _XMUICON4(UINT64 Packed);
  1044. _XMUICON4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  1045. _XMUICON4(CONST FLOAT *pArray);
  1046. operator UINT64 ();
  1047. _XMUICON4& operator= (CONST _XMUICON4& UIcoN4);
  1048. _XMUICON4& operator= (CONST UINT64 Packed);
  1049. #endif // __cplusplus
  1050. } XMUICON4;
  1051. // 4D Vector; 20-20-20-4 bit components packed into a 64 bit integer
  1052. // The 4D Vector is packed into 64 bits as follows: a 4 bit unsigned
  1053. // integer for the w component and 20 bit unsigned integers for the
  1054. // z, y, and x components. The w component is stored in the
  1055. // most significant bits and the x component in the least significant bits
  1056. // (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0]
  1057. typedef struct _XMUICO4
  1058. {
  1059. union
  1060. {
  1061. struct
  1062. {
  1063. UINT64 x : 20; // 0 to 1048575
  1064. UINT64 y : 20; // 0 to 1048575
  1065. UINT64 z : 20; // 0 to 1048575
  1066. UINT64 w : 4; // 0 to 15
  1067. };
  1068. UINT64 v;
  1069. };
  1070. #ifdef __cplusplus
  1071. _XMUICO4() {};
  1072. _XMUICO4(UINT64 Packed);
  1073. _XMUICO4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  1074. _XMUICO4(CONST FLOAT *pArray);
  1075. operator UINT64 ();
  1076. _XMUICO4& operator= (CONST _XMUICO4& UIco4);
  1077. _XMUICO4& operator= (CONST UINT64 Packed);
  1078. #endif // __cplusplus
  1079. } XMUICO4;
  1080. // ARGB Color; 8-8-8-8 bit unsigned normalized integer components packed into
  1081. // a 32 bit integer. The normalized color is packed into 32 bits using 8 bit
  1082. // unsigned, normalized integers for the alpha, red, green, and blue components.
  1083. // The alpha component is stored in the most significant bits and the blue
  1084. // component in the least significant bits (A8R8G8B8):
  1085. // [32] aaaaaaaa rrrrrrrr gggggggg bbbbbbbb [0]
  1086. typedef struct _XMCOLOR
  1087. {
  1088. union
  1089. {
  1090. struct
  1091. {
  1092. UINT b : 8; // Blue: 0/255 to 255/255
  1093. UINT g : 8; // Green: 0/255 to 255/255
  1094. UINT r : 8; // Red: 0/255 to 255/255
  1095. UINT a : 8; // Alpha: 0/255 to 255/255
  1096. };
  1097. UINT c;
  1098. };
  1099. #ifdef __cplusplus
  1100. _XMCOLOR() {};
  1101. _XMCOLOR(UINT Color);
  1102. _XMCOLOR(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  1103. _XMCOLOR(CONST FLOAT *pArray);
  1104. operator UINT ();
  1105. _XMCOLOR& operator= (CONST _XMCOLOR& Color);
  1106. _XMCOLOR& operator= (CONST UINT Color);
  1107. #endif // __cplusplus
  1108. } XMCOLOR;
  1109. // 4D Vector; 8 bit signed normalized integer components
  1110. typedef struct _XMBYTEN4
  1111. {
  1112. union
  1113. {
  1114. struct
  1115. {
  1116. CHAR x;
  1117. CHAR y;
  1118. CHAR z;
  1119. CHAR w;
  1120. };
  1121. UINT v;
  1122. };
  1123. #ifdef __cplusplus
  1124. _XMBYTEN4() {};
  1125. _XMBYTEN4(CHAR _x, CHAR _y, CHAR _z, CHAR _w);
  1126. _XMBYTEN4(UINT _v);
  1127. _XMBYTEN4(CONST CHAR *pArray);
  1128. _XMBYTEN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  1129. _XMBYTEN4(CONST FLOAT *pArray);
  1130. _XMBYTEN4& operator= (CONST _XMBYTEN4& ByteN4);
  1131. #endif // __cplusplus
  1132. } XMBYTEN4;
  1133. // 4D Vector; 8 bit signed integer components
  1134. typedef struct _XMBYTE4
  1135. {
  1136. union
  1137. {
  1138. struct
  1139. {
  1140. CHAR x;
  1141. CHAR y;
  1142. CHAR z;
  1143. CHAR w;
  1144. };
  1145. UINT v;
  1146. };
  1147. #ifdef __cplusplus
  1148. _XMBYTE4() {};
  1149. _XMBYTE4(CHAR _x, CHAR _y, CHAR _z, CHAR _w);
  1150. _XMBYTE4(UINT _v);
  1151. _XMBYTE4(CONST CHAR *pArray);
  1152. _XMBYTE4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  1153. _XMBYTE4(CONST FLOAT *pArray);
  1154. _XMBYTE4& operator= (CONST _XMBYTE4& Byte4);
  1155. #endif // __cplusplus
  1156. } XMBYTE4;
  1157. // 4D Vector; 8 bit unsigned normalized integer components
  1158. typedef struct _XMUBYTEN4
  1159. {
  1160. union
  1161. {
  1162. struct
  1163. {
  1164. BYTE x;
  1165. BYTE y;
  1166. BYTE z;
  1167. BYTE w;
  1168. };
  1169. UINT v;
  1170. };
  1171. #ifdef __cplusplus
  1172. _XMUBYTEN4() {};
  1173. _XMUBYTEN4(BYTE _x, BYTE _y, BYTE _z, BYTE _w);
  1174. _XMUBYTEN4(UINT _v);
  1175. _XMUBYTEN4(CONST BYTE *pArray);
  1176. _XMUBYTEN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  1177. _XMUBYTEN4(CONST FLOAT *pArray);
  1178. _XMUBYTEN4& operator= (CONST _XMUBYTEN4& UByteN4);
  1179. #endif // __cplusplus
  1180. } XMUBYTEN4;
  1181. // 4D Vector; 8 bit unsigned integer components
  1182. typedef struct _XMUBYTE4
  1183. {
  1184. union
  1185. {
  1186. struct
  1187. {
  1188. BYTE x;
  1189. BYTE y;
  1190. BYTE z;
  1191. BYTE w;
  1192. };
  1193. UINT v;
  1194. };
  1195. #ifdef __cplusplus
  1196. _XMUBYTE4() {};
  1197. _XMUBYTE4(BYTE _x, BYTE _y, BYTE _z, BYTE _w);
  1198. _XMUBYTE4(UINT _v);
  1199. _XMUBYTE4(CONST BYTE *pArray);
  1200. _XMUBYTE4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w);
  1201. _XMUBYTE4(CONST FLOAT *pArray);
  1202. _XMUBYTE4& operator= (CONST _XMUBYTE4& UByte4);
  1203. #endif // __cplusplus
  1204. } XMUBYTE4;
  1205. // 3x3 Matrix: 32 bit floating point components
  1206. typedef struct _XMFLOAT3X3
  1207. {
  1208. union
  1209. {
  1210. struct
  1211. {
  1212. FLOAT _11, _12, _13;
  1213. FLOAT _21, _22, _23;
  1214. FLOAT _31, _32, _33;
  1215. };
  1216. FLOAT m[3][3];
  1217. };
  1218. #ifdef __cplusplus
  1219. _XMFLOAT3X3() {};
  1220. _XMFLOAT3X3(FLOAT m00, FLOAT m01, FLOAT m02,
  1221. FLOAT m10, FLOAT m11, FLOAT m12,
  1222. FLOAT m20, FLOAT m21, FLOAT m22);
  1223. _XMFLOAT3X3(CONST FLOAT *pArray);
  1224. FLOAT operator() (UINT Row, UINT Column) CONST;
  1225. FLOAT& operator() (UINT Row, UINT Column);
  1226. _XMFLOAT3X3& operator= (CONST _XMFLOAT3X3& Float3x3);
  1227. #endif // __cplusplus
  1228. } XMFLOAT3X3;
  1229. // 4x3 Matrix: 32 bit floating point components
  1230. typedef struct _XMFLOAT4X3
  1231. {
  1232. union
  1233. {
  1234. struct
  1235. {
  1236. FLOAT _11, _12, _13;
  1237. FLOAT _21, _22, _23;
  1238. FLOAT _31, _32, _33;
  1239. FLOAT _41, _42, _43;
  1240. };
  1241. FLOAT m[4][3];
  1242. };
  1243. #ifdef __cplusplus
  1244. _XMFLOAT4X3() {};
  1245. _XMFLOAT4X3(FLOAT m00, FLOAT m01, FLOAT m02,
  1246. FLOAT m10, FLOAT m11, FLOAT m12,
  1247. FLOAT m20, FLOAT m21, FLOAT m22,
  1248. FLOAT m30, FLOAT m31, FLOAT m32);
  1249. _XMFLOAT4X3(CONST FLOAT *pArray);
  1250. FLOAT operator() (UINT Row, UINT Column) CONST;
  1251. FLOAT& operator() (UINT Row, UINT Column);
  1252. _XMFLOAT4X3& operator= (CONST _XMFLOAT4X3& Float4x3);
  1253. #endif // __cplusplus
  1254. } XMFLOAT4X3;
  1255. // 4x3 Matrix: 32 bit floating point components aligned on a 16 byte boundary
  1256. typedef __declspec(align(16)) XMFLOAT4X3 XMFLOAT4X3A;
  1257. // 4x4 Matrix: 32 bit floating point components
  1258. typedef struct _XMFLOAT4X4
  1259. {
  1260. union
  1261. {
  1262. struct
  1263. {
  1264. FLOAT _11, _12, _13, _14;
  1265. FLOAT _21, _22, _23, _24;
  1266. FLOAT _31, _32, _33, _34;
  1267. FLOAT _41, _42, _43, _44;
  1268. };
  1269. FLOAT m[4][4];
  1270. };
  1271. #ifdef __cplusplus
  1272. _XMFLOAT4X4() {};
  1273. _XMFLOAT4X4(FLOAT m00, FLOAT m01, FLOAT m02, FLOAT m03,
  1274. FLOAT m10, FLOAT m11, FLOAT m12, FLOAT m13,
  1275. FLOAT m20, FLOAT m21, FLOAT m22, FLOAT m23,
  1276. FLOAT m30, FLOAT m31, FLOAT m32, FLOAT m33);
  1277. _XMFLOAT4X4(CONST FLOAT *pArray);
  1278. FLOAT operator() (UINT Row, UINT Column) CONST;
  1279. FLOAT& operator() (UINT Row, UINT Column);
  1280. _XMFLOAT4X4& operator= (CONST _XMFLOAT4X4& Float4x4);
  1281. #endif // __cplusplus
  1282. } XMFLOAT4X4;
  1283. // 4x4 Matrix: 32 bit floating point components aligned on a 16 byte boundary
  1284. typedef __declspec(align(16)) XMFLOAT4X4 XMFLOAT4X4A;
  1285. #if !defined(_XM_X86_) && !defined(_XM_X64_)
  1286. #pragma bitfield_order(pop)
  1287. #endif // !_XM_X86_ && !_XM_X64_
  1288. #pragma warning(pop)
  1289. /****************************************************************************
  1290. *
  1291. * Data conversion operations
  1292. *
  1293. ****************************************************************************/
  1294. #if !defined(_XM_NO_INTRINSICS_) && defined(_XM_VMX128_INTRINSICS_)
  1295. #else
  1296. XMVECTOR XMConvertVectorIntToFloat(FXMVECTOR VInt, UINT DivExponent);
  1297. XMVECTOR XMConvertVectorFloatToInt(FXMVECTOR VFloat, UINT MulExponent);
  1298. XMVECTOR XMConvertVectorUIntToFloat(FXMVECTOR VUInt, UINT DivExponent);
  1299. XMVECTOR XMConvertVectorFloatToUInt(FXMVECTOR VFloat, UINT MulExponent);
  1300. #endif
  1301. FLOAT XMConvertHalfToFloat(HALF Value);
  1302. FLOAT* XMConvertHalfToFloatStream(__out_bcount(sizeof(FLOAT)+OutputStride*(HalfCount-1)) FLOAT* pOutputStream,
  1303. __in UINT OutputStride,
  1304. __in_bcount(sizeof(HALF)+InputStride*(HalfCount-1)) CONST HALF* pInputStream,
  1305. __in UINT InputStride, __in UINT HalfCount);
  1306. HALF XMConvertFloatToHalf(FLOAT Value);
  1307. HALF* XMConvertFloatToHalfStream(__out_bcount(sizeof(HALF)+OutputStride*(FloatCount-1)) HALF* pOutputStream,
  1308. __in UINT OutputStride,
  1309. __in_bcount(sizeof(FLOAT)+InputStride*(FloatCount-1)) CONST FLOAT* pInputStream,
  1310. __in UINT InputStride, __in UINT FloatCount);
  1311. #if !defined(_XM_NO_INTRINSICS_) && defined(_XM_VMX128_INTRINSICS_)
  1312. #else
  1313. XMVECTOR XMVectorSetBinaryConstant(UINT C0, UINT C1, UINT C2, UINT C3);
  1314. XMVECTOR XMVectorSplatConstant(INT IntConstant, UINT DivExponent);
  1315. XMVECTOR XMVectorSplatConstantInt(INT IntConstant);
  1316. #endif
  1317. /****************************************************************************
  1318. *
  1319. * Load operations
  1320. *
  1321. ****************************************************************************/
  1322. XMVECTOR XMLoadInt(__in CONST UINT* pSource);
  1323. XMVECTOR XMLoadFloat(__in CONST FLOAT* pSource);
  1324. XMVECTOR XMLoadInt2(__in CONST UINT* pSource);
  1325. XMVECTOR XMLoadInt2A(__in CONST UINT* PSource);
  1326. XMVECTOR XMLoadFloat2(__in CONST XMFLOAT2* pSource);
  1327. XMVECTOR XMLoadFloat2A(__in CONST XMFLOAT2A* pSource);
  1328. XMVECTOR XMLoadHalf2(__in CONST XMHALF2* pSource);
  1329. XMVECTOR XMLoadShortN2(__in CONST XMSHORTN2* pSource);
  1330. XMVECTOR XMLoadShort2(__in CONST XMSHORT2* pSource);
  1331. XMVECTOR XMLoadUShortN2(__in CONST XMUSHORTN2* pSource);
  1332. XMVECTOR XMLoadUShort2(__in CONST XMUSHORT2* pSource);
  1333. XMVECTOR XMLoadInt3(__in CONST UINT* pSource);
  1334. XMVECTOR XMLoadInt3A(__in CONST UINT* pSource);
  1335. XMVECTOR XMLoadFloat3(__in CONST XMFLOAT3* pSource);
  1336. XMVECTOR XMLoadFloat3A(__in CONST XMFLOAT3A* pSource);
  1337. XMVECTOR XMLoadHenDN3(__in CONST XMHENDN3* pSource);
  1338. XMVECTOR XMLoadHenD3(__in CONST XMHEND3* pSource);
  1339. XMVECTOR XMLoadUHenDN3(__in CONST XMUHENDN3* pSource);
  1340. XMVECTOR XMLoadUHenD3(__in CONST XMUHEND3* pSource);
  1341. XMVECTOR XMLoadDHenN3(__in CONST XMDHENN3* pSource);
  1342. XMVECTOR XMLoadDHen3(__in CONST XMDHEN3* pSource);
  1343. XMVECTOR XMLoadUDHenN3(__in CONST XMUDHENN3* pSource);
  1344. XMVECTOR XMLoadUDHen3(__in CONST XMUDHEN3* pSource);
  1345. XMVECTOR XMLoadInt4(__in CONST UINT* pSource);
  1346. XMVECTOR XMLoadInt4A(__in CONST UINT* pSource);
  1347. XMVECTOR XMLoadFloat4(__in CONST XMFLOAT4* pSource);
  1348. XMVECTOR XMLoadFloat4A(__in CONST XMFLOAT4A* pSource);
  1349. XMVECTOR XMLoadHalf4(__in CONST XMHALF4* pSource);
  1350. XMVECTOR XMLoadShortN4(__in CONST XMSHORTN4* pSource);
  1351. XMVECTOR XMLoadShort4(__in CONST XMSHORT4* pSource);
  1352. XMVECTOR XMLoadUShortN4(__in CONST XMUSHORTN4* pSource);
  1353. XMVECTOR XMLoadUShort4(__in CONST XMUSHORT4* pSource);
  1354. XMVECTOR XMLoadXIcoN4(__in CONST XMXICON4* pSource);
  1355. XMVECTOR XMLoadXIco4(__in CONST XMXICO4* pSource);
  1356. XMVECTOR XMLoadIcoN4(__in CONST XMICON4* pSource);
  1357. XMVECTOR XMLoadIco4(__in CONST XMICO4* pSource);
  1358. XMVECTOR XMLoadUIcoN4(__in CONST XMUICON4* pSource);
  1359. XMVECTOR XMLoadUIco4(__in CONST XMUICO4* pSource);
  1360. XMVECTOR XMLoadXDecN4(__in CONST XMXDECN4* pSource);
  1361. XMVECTOR XMLoadXDec4(__in CONST XMXDEC4* pSource);
  1362. XMVECTOR XMLoadDecN4(__in CONST XMDECN4* pSource);
  1363. XMVECTOR XMLoadDec4(__in CONST XMDEC4* pSource);
  1364. XMVECTOR XMLoadUDecN4(__in CONST XMUDECN4* pSource);
  1365. XMVECTOR XMLoadUDec4(__in CONST XMUDEC4* pSource);
  1366. XMVECTOR XMLoadByteN4(__in CONST XMBYTEN4* pSource);
  1367. XMVECTOR XMLoadByte4(__in CONST XMBYTE4* pSource);
  1368. XMVECTOR XMLoadUByteN4(__in CONST XMUBYTEN4* pSource);
  1369. XMVECTOR XMLoadUByte4(__in CONST XMUBYTE4* pSource);
  1370. XMVECTOR XMLoadColor(__in CONST XMCOLOR* pSource);
  1371. XMMATRIX XMLoadFloat3x3(__in CONST XMFLOAT3X3* pSource);
  1372. XMMATRIX XMLoadFloat4x3(__in CONST XMFLOAT4X3* pSource);
  1373. XMMATRIX XMLoadFloat4x3A(__in CONST XMFLOAT4X3A* pSource);
  1374. XMMATRIX XMLoadFloat4x4(__in CONST XMFLOAT4X4* pSource);
  1375. XMMATRIX XMLoadFloat4x4A(__in CONST XMFLOAT4X4A* pSource);
  1376. /****************************************************************************
  1377. *
  1378. * Store operations
  1379. *
  1380. ****************************************************************************/
  1381. VOID XMStoreInt(__out UINT* pDestination, FXMVECTOR V);
  1382. VOID XMStoreFloat(__out FLOAT* pDestination, FXMVECTOR V);
  1383. VOID XMStoreInt2(__out UINT* pDestination, FXMVECTOR V);
  1384. VOID XMStoreInt2A(__out UINT* pDestination, FXMVECTOR V);
  1385. VOID XMStoreFloat2(__out XMFLOAT2* pDestination, FXMVECTOR V);
  1386. VOID XMStoreFloat2A(__out XMFLOAT2A* pDestination, FXMVECTOR V);
  1387. VOID XMStoreHalf2(__out XMHALF2* pDestination, FXMVECTOR V);
  1388. VOID XMStoreShortN2(__out XMSHORTN2* pDestination, FXMVECTOR V);
  1389. VOID XMStoreShort2(__out XMSHORT2* pDestination, FXMVECTOR V);
  1390. VOID XMStoreUShortN2(__out XMUSHORTN2* pDestination, FXMVECTOR V);
  1391. VOID XMStoreUShort2(__out XMUSHORT2* pDestination, FXMVECTOR V);
  1392. VOID XMStoreInt3(__out UINT* pDestination, FXMVECTOR V);
  1393. VOID XMStoreInt3A(__out UINT* pDestination, FXMVECTOR V);
  1394. VOID XMStoreFloat3(__out XMFLOAT3* pDestination, FXMVECTOR V);
  1395. VOID XMStoreFloat3A(__out XMFLOAT3A* pDestination, FXMVECTOR V);
  1396. VOID XMStoreHenDN3(__out XMHENDN3* pDestination, FXMVECTOR V);
  1397. VOID XMStoreHenD3(__out XMHEND3* pDestination, FXMVECTOR V);
  1398. VOID XMStoreUHenDN3(__out XMUHENDN3* pDestination, FXMVECTOR V);
  1399. VOID XMStoreUHenD3(__out XMUHEND3* pDestination, FXMVECTOR V);
  1400. VOID XMStoreDHenN3(__out XMDHENN3* pDestination, FXMVECTOR V);
  1401. VOID XMStoreDHen3(__out XMDHEN3* pDestination, FXMVECTOR V);
  1402. VOID XMStoreUDHenN3(__out XMUDHENN3* pDestination, FXMVECTOR V);
  1403. VOID XMStoreUDHen3(__out XMUDHEN3* pDestination, FXMVECTOR V);
  1404. VOID XMStoreInt4(__out UINT* pDestination, FXMVECTOR V);
  1405. VOID XMStoreInt4A(__out UINT* pDestination, FXMVECTOR V);
  1406. VOID XMStoreInt4NC(__out UINT* pDestination, FXMVECTOR V);
  1407. VOID XMStoreFloat4(__out XMFLOAT4* pDestination, FXMVECTOR V);
  1408. VOID XMStoreFloat4A(__out XMFLOAT4A* pDestination, FXMVECTOR V);
  1409. VOID XMStoreFloat4NC(__out XMFLOAT4* pDestination, FXMVECTOR V);
  1410. VOID XMStoreHalf4(__out XMHALF4* pDestination, FXMVECTOR V);
  1411. VOID XMStoreShortN4(__out XMSHORTN4* pDestination, FXMVECTOR V);
  1412. VOID XMStoreShort4(__out XMSHORT4* pDestination, FXMVECTOR V);
  1413. VOID XMStoreUShortN4(__out XMUSHORTN4* pDestination, FXMVECTOR V);
  1414. VOID XMStoreUShort4(__out XMUSHORT4* pDestination, FXMVECTOR V);
  1415. VOID XMStoreXIcoN4(__out XMXICON4* pDestination, FXMVECTOR V);
  1416. VOID XMStoreXIco4(__out XMXICO4* pDestination, FXMVECTOR V);
  1417. VOID XMStoreIcoN4(__out XMICON4* pDestination, FXMVECTOR V);
  1418. VOID XMStoreIco4(__out XMICO4* pDestination, FXMVECTOR V);
  1419. VOID XMStoreUIcoN4(__out XMUICON4* pDestination, FXMVECTOR V);
  1420. VOID XMStoreUIco4(__out XMUICO4* pDestination, FXMVECTOR V);
  1421. VOID XMStoreXDecN4(__out XMXDECN4* pDestination, FXMVECTOR V);
  1422. VOID XMStoreXDec4(__out XMXDEC4* pDestination, FXMVECTOR V);
  1423. VOID XMStoreDecN4(__out XMDECN4* pDestination, FXMVECTOR V);
  1424. VOID XMStoreDec4(__out XMDEC4* pDestination, FXMVECTOR V);
  1425. VOID XMStoreUDecN4(__out XMUDECN4* pDestination, FXMVECTOR V);
  1426. VOID XMStoreUDec4(__out XMUDEC4* pDestination, FXMVECTOR V);
  1427. VOID XMStoreByteN4(__out XMBYTEN4* pDestination, FXMVECTOR V);
  1428. VOID XMStoreByte4(__out XMBYTE4* pDestination, FXMVECTOR V);
  1429. VOID XMStoreUByteN4(__out XMUBYTEN4* pDestination, FXMVECTOR V);
  1430. VOID XMStoreUByte4(__out XMUBYTE4* pDestination, FXMVECTOR V);
  1431. VOID XMStoreColor(__out XMCOLOR* pDestination, FXMVECTOR V);
  1432. VOID XMStoreFloat3x3(__out XMFLOAT3X3* pDestination, CXMMATRIX M);
  1433. VOID XMStoreFloat3x3NC(__out XMFLOAT3X3* pDestination, CXMMATRIX M);
  1434. VOID XMStoreFloat4x3(__out XMFLOAT4X3* pDestination, CXMMATRIX M);
  1435. VOID XMStoreFloat4x3A(__out XMFLOAT4X3A* pDestination, CXMMATRIX M);
  1436. VOID XMStoreFloat4x3NC(__out XMFLOAT4X3* pDestination, CXMMATRIX M);
  1437. VOID XMStoreFloat4x4(__out XMFLOAT4X4* pDestination, CXMMATRIX M);
  1438. VOID XMStoreFloat4x4A(__out XMFLOAT4X4A* pDestination, CXMMATRIX M);
  1439. VOID XMStoreFloat4x4NC(__out XMFLOAT4X4* pDestination, CXMMATRIX M);
  1440. /****************************************************************************
  1441. *
  1442. * General vector operations
  1443. *
  1444. ****************************************************************************/
  1445. XMVECTOR XMVectorZero();
  1446. XMVECTOR XMVectorSet(FLOAT x, FLOAT y, FLOAT z, FLOAT w);
  1447. XMVECTOR XMVectorSetInt(UINT x, UINT y, UINT z, UINT w);
  1448. XMVECTOR XMVectorReplicate(FLOAT Value);
  1449. XMVECTOR XMVectorReplicatePtr(__in CONST FLOAT *pValue);
  1450. XMVECTOR XMVectorReplicateInt(UINT Value);
  1451. XMVECTOR XMVectorReplicateIntPtr(__in CONST UINT *pValue);
  1452. XMVECTOR XMVectorTrueInt();
  1453. XMVECTOR XMVectorFalseInt();
  1454. XMVECTOR XMVectorSplatX(FXMVECTOR V);
  1455. XMVECTOR XMVectorSplatY(FXMVECTOR V);
  1456. XMVECTOR XMVectorSplatZ(FXMVECTOR V);
  1457. XMVECTOR XMVectorSplatW(FXMVECTOR V);
  1458. XMVECTOR XMVectorSplatOne();
  1459. XMVECTOR XMVectorSplatInfinity();
  1460. XMVECTOR XMVectorSplatQNaN();
  1461. XMVECTOR XMVectorSplatEpsilon();
  1462. XMVECTOR XMVectorSplatSignMask();
  1463. FLOAT XMVectorGetByIndex(FXMVECTOR V,UINT i);
  1464. FLOAT XMVectorGetX(FXMVECTOR V);
  1465. FLOAT XMVectorGetY(FXMVECTOR V);
  1466. FLOAT XMVectorGetZ(FXMVECTOR V);
  1467. FLOAT XMVectorGetW(FXMVECTOR V);
  1468. VOID XMVectorGetByIndexPtr(__out FLOAT *f, FXMVECTOR V, UINT i);
  1469. VOID XMVectorGetXPtr(__out FLOAT *x, FXMVECTOR V);
  1470. VOID XMVectorGetYPtr(__out FLOAT *y, FXMVECTOR V);
  1471. VOID XMVectorGetZPtr(__out FLOAT *z, FXMVECTOR V);
  1472. VOID XMVectorGetWPtr(__out FLOAT *w, FXMVECTOR V);
  1473. UINT XMVectorGetIntByIndex(FXMVECTOR V,UINT i);
  1474. UINT XMVectorGetIntX(FXMVECTOR V);
  1475. UINT XMVectorGetIntY(FXMVECTOR V);
  1476. UINT XMVectorGetIntZ(FXMVECTOR V);
  1477. UINT XMVectorGetIntW(FXMVECTOR V);
  1478. VOID XMVectorGetIntByIndexPtr(__out UINT *x,FXMVECTOR V, UINT i);
  1479. VOID XMVectorGetIntXPtr(__out UINT *x, FXMVECTOR V);
  1480. VOID XMVectorGetIntYPtr(__out UINT *y, FXMVECTOR V);
  1481. VOID XMVectorGetIntZPtr(__out UINT *z, FXMVECTOR V);
  1482. VOID XMVectorGetIntWPtr(__out UINT *w, FXMVECTOR V);
  1483. XMVECTOR XMVectorSetByIndex(FXMVECTOR V,FLOAT f,UINT i);
  1484. XMVECTOR XMVectorSetX(FXMVECTOR V, FLOAT x);
  1485. XMVECTOR XMVectorSetY(FXMVECTOR V, FLOAT y);
  1486. XMVECTOR XMVectorSetZ(FXMVECTOR V, FLOAT z);
  1487. XMVECTOR XMVectorSetW(FXMVECTOR V, FLOAT w);
  1488. XMVECTOR XMVectorSetByIndexPtr(FXMVECTOR V, __in CONST FLOAT *f, UINT i);
  1489. XMVECTOR XMVectorSetXPtr(FXMVECTOR V, __in CONST FLOAT *x);
  1490. XMVECTOR XMVectorSetYPtr(FXMVECTOR V, __in CONST FLOAT *y);
  1491. XMVECTOR XMVectorSetZPtr(FXMVECTOR V, __in CONST FLOAT *z);
  1492. XMVECTOR XMVectorSetWPtr(FXMVECTOR V, __in CONST FLOAT *w);
  1493. XMVECTOR XMVectorSetIntByIndex(FXMVECTOR V, UINT x,UINT i);
  1494. XMVECTOR XMVectorSetIntX(FXMVECTOR V, UINT x);
  1495. XMVECTOR XMVectorSetIntY(FXMVECTOR V, UINT y);
  1496. XMVECTOR XMVectorSetIntZ(FXMVECTOR V, UINT z);
  1497. XMVECTOR XMVectorSetIntW(FXMVECTOR V, UINT w);
  1498. XMVECTOR XMVectorSetIntByIndexPtr(FXMVECTOR V, __in CONST UINT *x, UINT i);
  1499. XMVECTOR XMVectorSetIntXPtr(FXMVECTOR V, __in CONST UINT *x);
  1500. XMVECTOR XMVectorSetIntYPtr(FXMVECTOR V, __in CONST UINT *y);
  1501. XMVECTOR XMVectorSetIntZPtr(FXMVECTOR V, __in CONST UINT *z);
  1502. XMVECTOR XMVectorSetIntWPtr(FXMVECTOR V, __in CONST UINT *w);
  1503. XMVECTOR XMVectorPermuteControl(UINT ElementIndex0, UINT ElementIndex1, UINT ElementIndex2, UINT ElementIndex3);
  1504. XMVECTOR XMVectorPermute(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Control);
  1505. XMVECTOR XMVectorSelectControl(UINT VectorIndex0, UINT VectorIndex1, UINT VectorIndex2, UINT VectorIndex3);
  1506. XMVECTOR XMVectorSelect(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Control);
  1507. XMVECTOR XMVectorMergeXY(FXMVECTOR V1, FXMVECTOR V2);
  1508. XMVECTOR XMVectorMergeZW(FXMVECTOR V1, FXMVECTOR V2);
  1509. #if !defined(_XM_NO_INTRINSICS_) && defined(_XM_VMX128_INTRINSICS_)
  1510. #else
  1511. XMVECTOR XMVectorShiftLeft(FXMVECTOR V1, FXMVECTOR V2, UINT Elements);
  1512. XMVECTOR XMVectorRotateLeft(FXMVECTOR V, UINT Elements);
  1513. XMVECTOR XMVectorRotateRight(FXMVECTOR V, UINT Elements);
  1514. XMVECTOR XMVectorSwizzle(FXMVECTOR V, UINT E0, UINT E1, UINT E2, UINT E3);
  1515. XMVECTOR XMVectorInsert(FXMVECTOR VD, FXMVECTOR VS, UINT VSLeftRotateElements,
  1516. UINT Select0, UINT Select1, UINT Select2, UINT Select3);
  1517. #endif
  1518. XMVECTOR XMVectorEqual(FXMVECTOR V1, FXMVECTOR V2);
  1519. XMVECTOR XMVectorEqualR(__out UINT* pCR, FXMVECTOR V1, FXMVECTOR V2);
  1520. XMVECTOR XMVectorEqualInt(FXMVECTOR V1, FXMVECTOR V2);
  1521. XMVECTOR XMVectorEqualIntR(__out UINT* pCR, FXMVECTOR V, FXMVECTOR V2);
  1522. XMVECTOR XMVectorNearEqual(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Epsilon);
  1523. XMVECTOR XMVectorNotEqual(FXMVECTOR V1, FXMVECTOR V2);
  1524. XMVECTOR XMVectorNotEqualInt(FXMVECTOR V1, FXMVECTOR V2);
  1525. XMVECTOR XMVectorGreater(FXMVECTOR V1, FXMVECTOR V2);
  1526. XMVECTOR XMVectorGreaterR(__out UINT* pCR, FXMVECTOR V1, FXMVECTOR V2);
  1527. XMVECTOR XMVectorGreaterOrEqual(FXMVECTOR V1, FXMVECTOR V2);
  1528. XMVECTOR XMVectorGreaterOrEqualR(__out UINT* pCR, FXMVECTOR V1, FXMVECTOR V2);
  1529. XMVECTOR XMVectorLess(FXMVECTOR V1, FXMVECTOR V2);
  1530. XMVECTOR XMVectorLessOrEqual(FXMVECTOR V1, FXMVECTOR V2);
  1531. XMVECTOR XMVectorInBounds(FXMVECTOR V, FXMVECTOR Bounds);
  1532. XMVECTOR XMVectorInBoundsR(__out UINT* pCR, FXMVECTOR V, FXMVECTOR Bounds);
  1533. XMVECTOR XMVectorIsNaN(FXMVECTOR V);
  1534. XMVECTOR XMVectorIsInfinite(FXMVECTOR V);
  1535. XMVECTOR XMVectorMin(FXMVECTOR V1,FXMVECTOR V2);
  1536. XMVECTOR XMVectorMax(FXMVECTOR V1, FXMVECTOR V2);
  1537. XMVECTOR XMVectorRound(FXMVECTOR V);
  1538. XMVECTOR XMVectorTruncate(FXMVECTOR V);
  1539. XMVECTOR XMVectorFloor(FXMVECTOR V);
  1540. XMVECTOR XMVectorCeiling(FXMVECTOR V);
  1541. XMVECTOR XMVectorClamp(FXMVECTOR V, FXMVECTOR Min, FXMVECTOR Max);
  1542. XMVECTOR XMVectorSaturate(FXMVECTOR V);
  1543. XMVECTOR XMVectorAndInt(FXMVECTOR V1, FXMVECTOR V2);
  1544. XMVECTOR XMVectorAndCInt(FXMVECTOR V1, FXMVECTOR V2);
  1545. XMVECTOR XMVectorOrInt(FXMVECTOR V1, FXMVECTOR V2);
  1546. XMVECTOR XMVectorNorInt(FXMVECTOR V1, FXMVECTOR V2);
  1547. XMVECTOR XMVectorXorInt(FXMVECTOR V1, FXMVECTOR V2);
  1548. XMVECTOR XMVectorNegate(FXMVECTOR V);
  1549. XMVECTOR XMVectorAdd(FXMVECTOR V1, FXMVECTOR V2);
  1550. XMVECTOR XMVectorAddAngles(FXMVECTOR V1, FXMVECTOR V2);
  1551. XMVECTOR XMVectorSubtract(FXMVECTOR V1, FXMVECTOR V2);
  1552. XMVECTOR XMVectorSubtractAngles(FXMVECTOR V1, FXMVECTOR V2);
  1553. XMVECTOR XMVectorMultiply(FXMVECTOR V1, FXMVECTOR V2);
  1554. XMVECTOR XMVectorMultiplyAdd(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR V3);
  1555. XMVECTOR XMVectorNegativeMultiplySubtract(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR V3);
  1556. XMVECTOR XMVectorScale(FXMVECTOR V, FLOAT ScaleFactor);
  1557. XMVECTOR XMVectorReciprocalEst(FXMVECTOR V);
  1558. XMVECTOR XMVectorReciprocal(FXMVECTOR V);
  1559. XMVECTOR XMVectorSqrtEst(FXMVECTOR V);
  1560. XMVECTOR XMVectorSqrt(FXMVECTOR V);
  1561. XMVECTOR XMVectorReciprocalSqrtEst(FXMVECTOR V);
  1562. XMVECTOR XMVectorReciprocalSqrt(FXMVECTOR V);
  1563. XMVECTOR XMVectorExpEst(FXMVECTOR V);
  1564. XMVECTOR XMVectorExp(FXMVECTOR V);
  1565. XMVECTOR XMVectorLogEst(FXMVECTOR V);
  1566. XMVECTOR XMVectorLog(FXMVECTOR V);
  1567. XMVECTOR XMVectorPowEst(FXMVECTOR V1, FXMVECTOR V2);
  1568. XMVECTOR XMVectorPow(FXMVECTOR V1, FXMVECTOR V2);
  1569. XMVECTOR XMVectorAbs(FXMVECTOR V);
  1570. XMVECTOR XMVectorMod(FXMVECTOR V1, FXMVECTOR V2);
  1571. XMVECTOR XMVectorModAngles(FXMVECTOR Angles);
  1572. XMVECTOR XMVectorSin(FXMVECTOR V);
  1573. XMVECTOR XMVectorSinEst(FXMVECTOR V);
  1574. XMVECTOR XMVectorCos(FXMVECTOR V);
  1575. XMVECTOR XMVectorCosEst(FXMVECTOR V);
  1576. VOID XMVectorSinCos(__out XMVECTOR* pSin, __out XMVECTOR* pCos, FXMVECTOR V);
  1577. VOID XMVectorSinCosEst(__out XMVECTOR* pSin, __out XMVECTOR* pCos, FXMVECTOR V);
  1578. XMVECTOR XMVectorTan(FXMVECTOR V);
  1579. XMVECTOR XMVectorTanEst(FXMVECTOR V);
  1580. XMVECTOR XMVectorSinH(FXMVECTOR V);
  1581. XMVECTOR XMVectorSinHEst(FXMVECTOR V);
  1582. XMVECTOR XMVectorCosH(FXMVECTOR V);
  1583. XMVECTOR XMVectorCosHEst(FXMVECTOR V);
  1584. XMVECTOR XMVectorTanH(FXMVECTOR V);
  1585. XMVECTOR XMVectorTanHEst(FXMVECTOR V);
  1586. XMVECTOR XMVectorASin(FXMVECTOR V);
  1587. XMVECTOR XMVectorASinEst(FXMVECTOR V);
  1588. XMVECTOR XMVectorACos(FXMVECTOR V);
  1589. XMVECTOR XMVectorACosEst(FXMVECTOR V);
  1590. XMVECTOR XMVectorATan(FXMVECTOR V);
  1591. XMVECTOR XMVectorATanEst(FXMVECTOR V);
  1592. XMVECTOR XMVectorATan2(FXMVECTOR Y, FXMVECTOR X);
  1593. XMVECTOR XMVectorATan2Est(FXMVECTOR Y, FXMVECTOR X);
  1594. XMVECTOR XMVectorLerp(FXMVECTOR V0, FXMVECTOR V1, FLOAT t);
  1595. XMVECTOR XMVectorLerpV(FXMVECTOR V0, FXMVECTOR V1, FXMVECTOR T);
  1596. XMVECTOR XMVectorHermite(FXMVECTOR Position0, FXMVECTOR Tangent0, FXMVECTOR Position1, CXMVECTOR Tangent1, FLOAT t);
  1597. XMVECTOR XMVectorHermiteV(FXMVECTOR Position0, FXMVECTOR Tangent0, FXMVECTOR Position1, CXMVECTOR Tangent1, CXMVECTOR T);
  1598. XMVECTOR XMVectorCatmullRom(FXMVECTOR Position0, FXMVECTOR Position1, FXMVECTOR Position2, CXMVECTOR Position3, FLOAT t);
  1599. XMVECTOR XMVectorCatmullRomV(FXMVECTOR Position0, FXMVECTOR Position1, FXMVECTOR Position2, CXMVECTOR Position3, CXMVECTOR T);
  1600. XMVECTOR XMVectorBaryCentric(FXMVECTOR Position0, FXMVECTOR Position1, FXMVECTOR Position2, FLOAT f, FLOAT g);
  1601. XMVECTOR XMVectorBaryCentricV(FXMVECTOR Position0, FXMVECTOR Position1, FXMVECTOR Position2, CXMVECTOR F, CXMVECTOR G);
  1602. /****************************************************************************
  1603. *
  1604. * 2D vector operations
  1605. *
  1606. ****************************************************************************/
  1607. BOOL XMVector2Equal(FXMVECTOR V1, FXMVECTOR V2);
  1608. UINT XMVector2EqualR(FXMVECTOR V1, FXMVECTOR V2);
  1609. BOOL XMVector2EqualInt(FXMVECTOR V1, FXMVECTOR V2);
  1610. UINT XMVector2EqualIntR(FXMVECTOR V1, FXMVECTOR V2);
  1611. BOOL XMVector2NearEqual(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Epsilon);
  1612. BOOL XMVector2NotEqual(FXMVECTOR V1, FXMVECTOR V2);
  1613. BOOL XMVector2NotEqualInt(FXMVECTOR V1, FXMVECTOR V2);
  1614. BOOL XMVector2Greater(FXMVECTOR V1, FXMVECTOR V2);
  1615. UINT XMVector2GreaterR(FXMVECTOR V1, FXMVECTOR V2);
  1616. BOOL XMVector2GreaterOrEqual(FXMVECTOR V1, FXMVECTOR V2);
  1617. UINT XMVector2GreaterOrEqualR(FXMVECTOR V1, FXMVECTOR V2);
  1618. BOOL XMVector2Less(FXMVECTOR V1, FXMVECTOR V2);
  1619. BOOL XMVector2LessOrEqual(FXMVECTOR V1, FXMVECTOR V2);
  1620. BOOL XMVector2InBounds(FXMVECTOR V, FXMVECTOR Bounds);
  1621. UINT XMVector2InBoundsR(FXMVECTOR V, FXMVECTOR Bounds);
  1622. BOOL XMVector2IsNaN(FXMVECTOR V);
  1623. BOOL XMVector2IsInfinite(FXMVECTOR V);
  1624. XMVECTOR XMVector2Dot(FXMVECTOR V1, FXMVECTOR V2);
  1625. XMVECTOR XMVector2Cross(FXMVECTOR V1, FXMVECTOR V2);
  1626. XMVECTOR XMVector2LengthSq(FXMVECTOR V);
  1627. XMVECTOR XMVector2ReciprocalLengthEst(FXMVECTOR V);
  1628. XMVECTOR XMVector2ReciprocalLength(FXMVECTOR V);
  1629. XMVECTOR XMVector2LengthEst(FXMVECTOR V);
  1630. XMVECTOR XMVector2Length(FXMVECTOR V);
  1631. XMVECTOR XMVector2NormalizeEst(FXMVECTOR V);
  1632. XMVECTOR XMVector2Normalize(FXMVECTOR V);
  1633. XMVECTOR XMVector2ClampLength(FXMVECTOR V, FLOAT LengthMin, FLOAT LengthMax);
  1634. XMVECTOR XMVector2ClampLengthV(FXMVECTOR V, FXMVECTOR LengthMin, FXMVECTOR LengthMax);
  1635. XMVECTOR XMVector2Reflect(FXMVECTOR Incident, FXMVECTOR Normal);
  1636. XMVECTOR XMVector2Refract(FXMVECTOR Incident, FXMVECTOR Normal, FLOAT RefractionIndex);
  1637. XMVECTOR XMVector2RefractV(FXMVECTOR Incident, FXMVECTOR Normal, FXMVECTOR RefractionIndex);
  1638. XMVECTOR XMVector2Orthogonal(FXMVECTOR V);
  1639. XMVECTOR XMVector2AngleBetweenNormalsEst(FXMVECTOR N1, FXMVECTOR N2);
  1640. XMVECTOR XMVector2AngleBetweenNormals(FXMVECTOR N1, FXMVECTOR N2);
  1641. XMVECTOR XMVector2AngleBetweenVectors(FXMVECTOR V1, FXMVECTOR V2);
  1642. XMVECTOR XMVector2LinePointDistance(FXMVECTOR LinePoint1, FXMVECTOR LinePoint2, FXMVECTOR Point);
  1643. XMVECTOR XMVector2IntersectLine(FXMVECTOR Line1Point1, FXMVECTOR Line1Point2, FXMVECTOR Line2Point1, CXMVECTOR Line2Point2);
  1644. XMVECTOR XMVector2Transform(FXMVECTOR V, CXMMATRIX M);
  1645. XMFLOAT4* XMVector2TransformStream(__out_bcount(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream,
  1646. __in UINT OutputStride,
  1647. __in_bcount(sizeof(XMFLOAT2)+InputStride*(VectorCount-1)) CONST XMFLOAT2* pInputStream,
  1648. __in UINT InputStride, __in UINT VectorCount, CXMMATRIX M);
  1649. XMFLOAT4* XMVector2TransformStreamNC(__out_bcount(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream,
  1650. __in UINT OutputStride,
  1651. __in_bcount(sizeof(XMFLOAT2)+InputStride*(VectorCount-1)) CONST XMFLOAT2* pInputStream,
  1652. __in UINT InputStride, __in UINT VectorCount, CXMMATRIX M);
  1653. XMVECTOR XMVector2TransformCoord(FXMVECTOR V, CXMMATRIX M);
  1654. XMFLOAT2* XMVector2TransformCoordStream(__out_bcount(sizeof(XMFLOAT2)+OutputStride*(VectorCount-1)) XMFLOAT2* pOutputStream,
  1655. __in UINT OutputStride,
  1656. __in_bcount(sizeof(XMFLOAT2)+InputStride*(VectorCount-1)) CONST XMFLOAT2* pInputStream,
  1657. __in UINT InputStride, __in UINT VectorCount, CXMMATRIX M);
  1658. XMVECTOR XMVector2TransformNormal(FXMVECTOR V, CXMMATRIX M);
  1659. XMFLOAT2* XMVector2TransformNormalStream(__out_bcount(sizeof(XMFLOAT2)+OutputStride*(VectorCount-1)) XMFLOAT2* pOutputStream,
  1660. __in UINT OutputStride,
  1661. __in_bcount(sizeof(XMFLOAT2)+InputStride*(VectorCount-1)) CONST XMFLOAT2* pInputStream,
  1662. __in UINT InputStride, __in UINT VectorCount, CXMMATRIX M);
  1663. /****************************************************************************
  1664. *
  1665. * 3D vector operations
  1666. *
  1667. ****************************************************************************/
  1668. BOOL XMVector3Equal(FXMVECTOR V1, FXMVECTOR V2);
  1669. UINT XMVector3EqualR(FXMVECTOR V1, FXMVECTOR V2);
  1670. BOOL XMVector3EqualInt(FXMVECTOR V1, FXMVECTOR V2);
  1671. UINT XMVector3EqualIntR(FXMVECTOR V1, FXMVECTOR V2);
  1672. BOOL XMVector3NearEqual(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Epsilon);
  1673. BOOL XMVector3NotEqual(FXMVECTOR V1, FXMVECTOR V2);
  1674. BOOL XMVector3NotEqualInt(FXMVECTOR V1, FXMVECTOR V2);
  1675. BOOL XMVector3Greater(FXMVECTOR V1, FXMVECTOR V2);
  1676. UINT XMVector3GreaterR(FXMVECTOR V1, FXMVECTOR V2);
  1677. BOOL XMVector3GreaterOrEqual(FXMVECTOR V1, FXMVECTOR V2);
  1678. UINT XMVector3GreaterOrEqualR(FXMVECTOR V1, FXMVECTOR V2);
  1679. BOOL XMVector3Less(FXMVECTOR V1, FXMVECTOR V2);
  1680. BOOL XMVector3LessOrEqual(FXMVECTOR V1, FXMVECTOR V2);
  1681. BOOL XMVector3InBounds(FXMVECTOR V, FXMVECTOR Bounds);
  1682. UINT XMVector3InBoundsR(FXMVECTOR V, FXMVECTOR Bounds);
  1683. BOOL XMVector3IsNaN(FXMVECTOR V);
  1684. BOOL XMVector3IsInfinite(FXMVECTOR V);
  1685. XMVECTOR XMVector3Dot(FXMVECTOR V1, FXMVECTOR V2);
  1686. XMVECTOR XMVector3Cross(FXMVECTOR V1, FXMVECTOR V2);
  1687. XMVECTOR XMVector3LengthSq(FXMVECTOR V);
  1688. XMVECTOR XMVector3ReciprocalLengthEst(FXMVECTOR V);
  1689. XMVECTOR XMVector3ReciprocalLength(FXMVECTOR V);
  1690. XMVECTOR XMVector3LengthEst(FXMVECTOR V);
  1691. XMVECTOR XMVector3Length(FXMVECTOR V);
  1692. XMVECTOR XMVector3NormalizeEst(FXMVECTOR V);
  1693. XMVECTOR XMVector3Normalize(FXMVECTOR V);
  1694. XMVECTOR XMVector3ClampLength(FXMVECTOR V, FLOAT LengthMin, FLOAT LengthMax);
  1695. XMVECTOR XMVector3ClampLengthV(FXMVECTOR V, FXMVECTOR LengthMin, FXMVECTOR LengthMax);
  1696. XMVECTOR XMVector3Reflect(FXMVECTOR Incident, FXMVECTOR Normal);
  1697. XMVECTOR XMVector3Refract(FXMVECTOR Incident, FXMVECTOR Normal, FLOAT RefractionIndex);
  1698. XMVECTOR XMVector3RefractV(FXMVECTOR Incident, FXMVECTOR Normal, FXMVECTOR RefractionIndex);
  1699. XMVECTOR XMVector3Orthogonal(FXMVECTOR V);
  1700. XMVECTOR XMVector3AngleBetweenNormalsEst(FXMVECTOR N1, FXMVECTOR N2);
  1701. XMVECTOR XMVector3AngleBetweenNormals(FXMVECTOR N1, FXMVECTOR N2);
  1702. XMVECTOR XMVector3AngleBetweenVectors(FXMVECTOR V1, FXMVECTOR V2);
  1703. XMVECTOR XMVector3LinePointDistance(FXMVECTOR LinePoint1, FXMVECTOR LinePoint2, FXMVECTOR Point);
  1704. VOID XMVector3ComponentsFromNormal(__out XMVECTOR* pParallel, __out XMVECTOR* pPerpendicular, FXMVECTOR V, FXMVECTOR Normal);
  1705. XMVECTOR XMVector3Rotate(FXMVECTOR V, FXMVECTOR RotationQuaternion);
  1706. XMVECTOR XMVector3InverseRotate(FXMVECTOR V, FXMVECTOR RotationQuaternion);
  1707. XMVECTOR XMVector3Transform(FXMVECTOR V, CXMMATRIX M);
  1708. XMFLOAT4* XMVector3TransformStream(__out_bcount(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream,
  1709. __in UINT OutputStride,
  1710. __in_bcount(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream,
  1711. __in UINT InputStride, __in UINT VectorCount, CXMMATRIX M);
  1712. XMFLOAT4* XMVector3TransformStreamNC(__out_bcount(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream,
  1713. __in UINT OutputStride,
  1714. __in_bcount(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream,
  1715. __in UINT InputStride, __in UINT VectorCount, CXMMATRIX M);
  1716. XMVECTOR XMVector3TransformCoord(FXMVECTOR V, CXMMATRIX M);
  1717. XMFLOAT3* XMVector3TransformCoordStream(__out_bcount(sizeof(XMFLOAT3)+OutputStride*(VectorCount-1)) XMFLOAT3* pOutputStream,
  1718. __in UINT OutputStride,
  1719. __in_bcount(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream,
  1720. __in UINT InputStride, __in UINT VectorCount, CXMMATRIX M);
  1721. XMVECTOR XMVector3TransformNormal(FXMVECTOR V, CXMMATRIX M);
  1722. XMFLOAT3* XMVector3TransformNormalStream(__out_bcount(sizeof(XMFLOAT3)+OutputStride*(VectorCount-1)) XMFLOAT3* pOutputStream,
  1723. __in UINT OutputStride,
  1724. __in_bcount(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream,
  1725. __in UINT InputStride, __in UINT VectorCount, CXMMATRIX M);
  1726. XMVECTOR XMVector3Project(FXMVECTOR V, FLOAT ViewportX, FLOAT ViewportY, FLOAT ViewportWidth, FLOAT ViewportHeight, FLOAT ViewportMinZ, FLOAT ViewportMaxZ,
  1727. CXMMATRIX Projection, CXMMATRIX View, CXMMATRIX World);
  1728. XMFLOAT3* XMVector3ProjectStream(__out_bcount(sizeof(XMFLOAT3)+OutputStride*(VectorCount-1)) XMFLOAT3* pOutputStream,
  1729. __in UINT OutputStride,
  1730. __in_bcount(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream,
  1731. __in UINT InputStride, __in UINT VectorCount,
  1732. FLOAT ViewportX, FLOAT ViewportY, FLOAT ViewportWidth, FLOAT ViewportHeight, FLOAT ViewportMinZ, FLOAT ViewportMaxZ,
  1733. CXMMATRIX Projection, CXMMATRIX View, CXMMATRIX World);
  1734. XMVECTOR XMVector3Unproject(FXMVECTOR V, FLOAT ViewportX, FLOAT ViewportY, FLOAT ViewportWidth, FLOAT ViewportHeight, FLOAT ViewportMinZ, FLOAT ViewportMaxZ,
  1735. CXMMATRIX Projection, CXMMATRIX View, CXMMATRIX World);
  1736. XMFLOAT3* XMVector3UnprojectStream(__out_bcount(sizeof(XMFLOAT3)+OutputStride*(VectorCount-1)) XMFLOAT3* pOutputStream,
  1737. __in UINT OutputStride,
  1738. __in_bcount(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream,
  1739. __in UINT InputStride, __in UINT VectorCount,
  1740. FLOAT ViewportX, FLOAT ViewportY, FLOAT ViewportWidth, FLOAT ViewportHeight, FLOAT ViewportMinZ, FLOAT ViewportMaxZ,
  1741. CXMMATRIX Projection, CXMMATRIX View, CXMMATRIX World);
  1742. /****************************************************************************
  1743. *
  1744. * 4D vector operations
  1745. *
  1746. ****************************************************************************/
  1747. BOOL XMVector4Equal(FXMVECTOR V1, FXMVECTOR V2);
  1748. UINT XMVector4EqualR(FXMVECTOR V1, FXMVECTOR V2);
  1749. BOOL XMVector4EqualInt(FXMVECTOR V1, FXMVECTOR V2);
  1750. UINT XMVector4EqualIntR(FXMVECTOR V1, FXMVECTOR V2);
  1751. BOOL XMVector4NearEqual(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Epsilon);
  1752. BOOL XMVector4NotEqual(FXMVECTOR V1, FXMVECTOR V2);
  1753. BOOL XMVector4NotEqualInt(FXMVECTOR V1, FXMVECTOR V2);
  1754. BOOL XMVector4Greater(FXMVECTOR V1, FXMVECTOR V2);
  1755. UINT XMVector4GreaterR(FXMVECTOR V1, FXMVECTOR V2);
  1756. BOOL XMVector4GreaterOrEqual(FXMVECTOR V1, FXMVECTOR V2);
  1757. UINT XMVector4GreaterOrEqualR(FXMVECTOR V1, FXMVECTOR V2);
  1758. BOOL XMVector4Less(FXMVECTOR V1, FXMVECTOR V2);
  1759. BOOL XMVector4LessOrEqual(FXMVECTOR V1, FXMVECTOR V2);
  1760. BOOL XMVector4InBounds(FXMVECTOR V, FXMVECTOR Bounds);
  1761. UINT XMVector4InBoundsR(FXMVECTOR V, FXMVECTOR Bounds);
  1762. BOOL XMVector4IsNaN(FXMVECTOR V);
  1763. BOOL XMVector4IsInfinite(FXMVECTOR V);
  1764. XMVECTOR XMVector4Dot(FXMVECTOR V1, FXMVECTOR V2);
  1765. XMVECTOR XMVector4Cross(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR V3);
  1766. XMVECTOR XMVector4LengthSq(FXMVECTOR V);
  1767. XMVECTOR XMVector4ReciprocalLengthEst(FXMVECTOR V);
  1768. XMVECTOR XMVector4ReciprocalLength(FXMVECTOR V);
  1769. XMVECTOR XMVector4LengthEst(FXMVECTOR V);
  1770. XMVECTOR XMVector4Length(FXMVECTOR V);
  1771. XMVECTOR XMVector4NormalizeEst(FXMVECTOR V);
  1772. XMVECTOR XMVector4Normalize(FXMVECTOR V);
  1773. XMVECTOR XMVector4ClampLength(FXMVECTOR V, FLOAT LengthMin, FLOAT LengthMax);
  1774. XMVECTOR XMVector4ClampLengthV(FXMVECTOR V, FXMVECTOR LengthMin, FXMVECTOR LengthMax);
  1775. XMVECTOR XMVector4Reflect(FXMVECTOR Incident, FXMVECTOR Normal);
  1776. XMVECTOR XMVector4Refract(FXMVECTOR Incident, FXMVECTOR Normal, FLOAT RefractionIndex);
  1777. XMVECTOR XMVector4RefractV(FXMVECTOR Incident, FXMVECTOR Normal, FXMVECTOR RefractionIndex);
  1778. XMVECTOR XMVector4Orthogonal(FXMVECTOR V);
  1779. XMVECTOR XMVector4AngleBetweenNormalsEst(FXMVECTOR N1, FXMVECTOR N2);
  1780. XMVECTOR XMVector4AngleBetweenNormals(FXMVECTOR N1, FXMVECTOR N2);
  1781. XMVECTOR XMVector4AngleBetweenVectors(FXMVECTOR V1, FXMVECTOR V2);
  1782. XMVECTOR XMVector4Transform(FXMVECTOR V, CXMMATRIX M);
  1783. XMFLOAT4* XMVector4TransformStream(__out_bcount(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream,
  1784. __in UINT OutputStride,
  1785. __in_bcount(sizeof(XMFLOAT4)+InputStride*(VectorCount-1)) CONST XMFLOAT4* pInputStream,
  1786. __in UINT InputStride, __in UINT VectorCount, CXMMATRIX M);
  1787. /****************************************************************************
  1788. *
  1789. * Matrix operations
  1790. *
  1791. ****************************************************************************/
  1792. BOOL XMMatrixIsNaN(CXMMATRIX M);
  1793. BOOL XMMatrixIsInfinite(CXMMATRIX M);
  1794. BOOL XMMatrixIsIdentity(CXMMATRIX M);
  1795. XMMATRIX XMMatrixMultiply(CXMMATRIX M1, CXMMATRIX M2);
  1796. XMMATRIX XMMatrixMultiplyTranspose(CXMMATRIX M1, CXMMATRIX M2);
  1797. XMMATRIX XMMatrixTranspose(CXMMATRIX M);
  1798. XMMATRIX XMMatrixInverse(__out XMVECTOR* pDeterminant, CXMMATRIX M);
  1799. XMVECTOR XMMatrixDeterminant(CXMMATRIX M);
  1800. BOOL XMMatrixDecompose(__out XMVECTOR *outScale, __out XMVECTOR *outRotQuat, __out XMVECTOR *outTrans, CXMMATRIX M);
  1801. XMMATRIX XMMatrixIdentity();
  1802. XMMATRIX XMMatrixSet(FLOAT m00, FLOAT m01, FLOAT m02, FLOAT m03,
  1803. FLOAT m10, FLOAT m11, FLOAT m12, FLOAT m13,
  1804. FLOAT m20, FLOAT m21, FLOAT m22, FLOAT m23,
  1805. FLOAT m30, FLOAT m31, FLOAT m32, FLOAT m33);
  1806. XMMATRIX XMMatrixTranslation(FLOAT OffsetX, FLOAT OffsetY, FLOAT OffsetZ);
  1807. XMMATRIX XMMatrixTranslationFromVector(FXMVECTOR Offset);
  1808. XMMATRIX XMMatrixScaling(FLOAT ScaleX, FLOAT ScaleY, FLOAT ScaleZ);
  1809. XMMATRIX XMMatrixScalingFromVector(FXMVECTOR Scale);
  1810. XMMATRIX XMMatrixRotationX(FLOAT Angle);
  1811. XMMATRIX XMMatrixRotationY(FLOAT Angle);
  1812. XMMATRIX XMMatrixRotationZ(FLOAT Angle);
  1813. XMMATRIX XMMatrixRotationRollPitchYaw(FLOAT Pitch, FLOAT Yaw, FLOAT Roll);
  1814. XMMATRIX XMMatrixRotationRollPitchYawFromVector(FXMVECTOR Angles);
  1815. XMMATRIX XMMatrixRotationNormal(FXMVECTOR NormalAxis, FLOAT Angle);
  1816. XMMATRIX XMMatrixRotationAxis(FXMVECTOR Axis, FLOAT Angle);
  1817. XMMATRIX XMMatrixRotationQuaternion(FXMVECTOR Quaternion);
  1818. XMMATRIX XMMatrixTransformation2D(FXMVECTOR ScalingOrigin, FLOAT ScalingOrientation, FXMVECTOR Scaling,
  1819. FXMVECTOR RotationOrigin, FLOAT Rotation, CXMVECTOR Translation);
  1820. XMMATRIX XMMatrixTransformation(FXMVECTOR ScalingOrigin, FXMVECTOR ScalingOrientationQuaternion, FXMVECTOR Scaling,
  1821. CXMVECTOR RotationOrigin, CXMVECTOR RotationQuaternion, CXMVECTOR Translation);
  1822. XMMATRIX XMMatrixAffineTransformation2D(FXMVECTOR Scaling, FXMVECTOR RotationOrigin, FLOAT Rotation, FXMVECTOR Translation);
  1823. XMMATRIX XMMatrixAffineTransformation(FXMVECTOR Scaling, FXMVECTOR RotationOrigin, FXMVECTOR RotationQuaternion, CXMVECTOR Translation);
  1824. XMMATRIX XMMatrixReflect(FXMVECTOR ReflectionPlane);
  1825. XMMATRIX XMMatrixShadow(FXMVECTOR ShadowPlane, FXMVECTOR LightPosition);
  1826. XMMATRIX XMMatrixLookAtLH(FXMVECTOR EyePosition, FXMVECTOR FocusPosition, FXMVECTOR UpDirection);
  1827. XMMATRIX XMMatrixLookAtRH(FXMVECTOR EyePosition, FXMVECTOR FocusPosition, FXMVECTOR UpDirection);
  1828. XMMATRIX XMMatrixLookToLH(FXMVECTOR EyePosition, FXMVECTOR EyeDirection, FXMVECTOR UpDirection);
  1829. XMMATRIX XMMatrixLookToRH(FXMVECTOR EyePosition, FXMVECTOR EyeDirection, FXMVECTOR UpDirection);
  1830. XMMATRIX XMMatrixPerspectiveLH(FLOAT ViewWidth, FLOAT ViewHeight, FLOAT NearZ, FLOAT FarZ);
  1831. XMMATRIX XMMatrixPerspectiveRH(FLOAT ViewWidth, FLOAT ViewHeight, FLOAT NearZ, FLOAT FarZ);
  1832. XMMATRIX XMMatrixPerspectiveFovLH(FLOAT FovAngleY, FLOAT AspectHByW, FLOAT NearZ, FLOAT FarZ);
  1833. XMMATRIX XMMatrixPerspectiveFovRH(FLOAT FovAngleY, FLOAT AspectHByW, FLOAT NearZ, FLOAT FarZ);
  1834. XMMATRIX XMMatrixPerspectiveOffCenterLH(FLOAT ViewLeft, FLOAT ViewRight, FLOAT ViewBottom, FLOAT ViewTop, FLOAT NearZ, FLOAT FarZ);
  1835. XMMATRIX XMMatrixPerspectiveOffCenterRH(FLOAT ViewLeft, FLOAT ViewRight, FLOAT ViewBottom, FLOAT ViewTop, FLOAT NearZ, FLOAT FarZ);
  1836. XMMATRIX XMMatrixOrthographicLH(FLOAT ViewWidth, FLOAT ViewHeight, FLOAT NearZ, FLOAT FarZ);
  1837. XMMATRIX XMMatrixOrthographicRH(FLOAT ViewWidth, FLOAT ViewHeight, FLOAT NearZ, FLOAT FarZ);
  1838. XMMATRIX XMMatrixOrthographicOffCenterLH(FLOAT ViewLeft, FLOAT ViewRight, FLOAT ViewBottom, FLOAT ViewTop, FLOAT NearZ, FLOAT FarZ);
  1839. XMMATRIX XMMatrixOrthographicOffCenterRH(FLOAT ViewLeft, FLOAT ViewRight, FLOAT ViewBottom, FLOAT ViewTop, FLOAT NearZ, FLOAT FarZ);
  1840. /****************************************************************************
  1841. *
  1842. * Quaternion operations
  1843. *
  1844. ****************************************************************************/
  1845. BOOL XMQuaternionEqual(FXMVECTOR Q1, FXMVECTOR Q2);
  1846. BOOL XMQuaternionNotEqual(FXMVECTOR Q1, FXMVECTOR Q2);
  1847. BOOL XMQuaternionIsNaN(FXMVECTOR Q);
  1848. BOOL XMQuaternionIsInfinite(FXMVECTOR Q);
  1849. BOOL XMQuaternionIsIdentity(FXMVECTOR Q);
  1850. XMVECTOR XMQuaternionDot(FXMVECTOR Q1, FXMVECTOR Q2);
  1851. XMVECTOR XMQuaternionMultiply(FXMVECTOR Q1, FXMVECTOR Q2);
  1852. XMVECTOR XMQuaternionLengthSq(FXMVECTOR Q);
  1853. XMVECTOR XMQuaternionReciprocalLength(FXMVECTOR Q);
  1854. XMVECTOR XMQuaternionLength(FXMVECTOR Q);
  1855. XMVECTOR XMQuaternionNormalizeEst(FXMVECTOR Q);
  1856. XMVECTOR XMQuaternionNormalize(FXMVECTOR Q);
  1857. XMVECTOR XMQuaternionConjugate(FXMVECTOR Q);
  1858. XMVECTOR XMQuaternionInverse(FXMVECTOR Q);
  1859. XMVECTOR XMQuaternionLn(FXMVECTOR Q);
  1860. XMVECTOR XMQuaternionExp(FXMVECTOR Q);
  1861. XMVECTOR XMQuaternionSlerp(FXMVECTOR Q0, FXMVECTOR Q1, FLOAT t);
  1862. XMVECTOR XMQuaternionSlerpV(FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR T);
  1863. XMVECTOR XMQuaternionSquad(FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, CXMVECTOR Q3, FLOAT t);
  1864. XMVECTOR XMQuaternionSquadV(FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, CXMVECTOR Q3, CXMVECTOR T);
  1865. VOID XMQuaternionSquadSetup(__out XMVECTOR* pA, __out XMVECTOR* pB, __out XMVECTOR* pC, FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, CXMVECTOR Q3);
  1866. XMVECTOR XMQuaternionBaryCentric(FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, FLOAT f, FLOAT g);
  1867. XMVECTOR XMQuaternionBaryCentricV(FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, CXMVECTOR F, CXMVECTOR G);
  1868. XMVECTOR XMQuaternionIdentity();
  1869. XMVECTOR XMQuaternionRotationRollPitchYaw(FLOAT Pitch, FLOAT Yaw, FLOAT Roll);
  1870. XMVECTOR XMQuaternionRotationRollPitchYawFromVector(FXMVECTOR Angles);
  1871. XMVECTOR XMQuaternionRotationNormal(FXMVECTOR NormalAxis, FLOAT Angle);
  1872. XMVECTOR XMQuaternionRotationAxis(FXMVECTOR Axis, FLOAT Angle);
  1873. XMVECTOR XMQuaternionRotationMatrix(CXMMATRIX M);
  1874. VOID XMQuaternionToAxisAngle(__out XMVECTOR* pAxis, __out FLOAT* pAngle, FXMVECTOR Q);
  1875. /****************************************************************************
  1876. *
  1877. * Plane operations
  1878. *
  1879. ****************************************************************************/
  1880. BOOL XMPlaneEqual(FXMVECTOR P1, FXMVECTOR P2);
  1881. BOOL XMPlaneNearEqual(FXMVECTOR P1, FXMVECTOR P2, FXMVECTOR Epsilon);
  1882. BOOL XMPlaneNotEqual(FXMVECTOR P1, FXMVECTOR P2);
  1883. BOOL XMPlaneIsNaN(FXMVECTOR P);
  1884. BOOL XMPlaneIsInfinite(FXMVECTOR P);
  1885. XMVECTOR XMPlaneDot(FXMVECTOR P, FXMVECTOR V);
  1886. XMVECTOR XMPlaneDotCoord(FXMVECTOR P, FXMVECTOR V);
  1887. XMVECTOR XMPlaneDotNormal(FXMVECTOR P, FXMVECTOR V);
  1888. XMVECTOR XMPlaneNormalizeEst(FXMVECTOR P);
  1889. XMVECTOR XMPlaneNormalize(FXMVECTOR P);
  1890. XMVECTOR XMPlaneIntersectLine(FXMVECTOR P, FXMVECTOR LinePoint1, FXMVECTOR LinePoint2);
  1891. VOID XMPlaneIntersectPlane(__out XMVECTOR* pLinePoint1, __out XMVECTOR* pLinePoint2, FXMVECTOR P1, FXMVECTOR P2);
  1892. XMVECTOR XMPlaneTransform(FXMVECTOR P, CXMMATRIX M);
  1893. XMFLOAT4* XMPlaneTransformStream(__out_bcount(sizeof(XMFLOAT4)+OutputStride*(PlaneCount-1)) XMFLOAT4* pOutputStream,
  1894. __in UINT OutputStride,
  1895. __in_bcount(sizeof(XMFLOAT4)+InputStride*(PlaneCount-1)) CONST XMFLOAT4* pInputStream,
  1896. __in UINT InputStride, __in UINT PlaneCount, CXMMATRIX M);
  1897. XMVECTOR XMPlaneFromPointNormal(FXMVECTOR Point, FXMVECTOR Normal);
  1898. XMVECTOR XMPlaneFromPoints(FXMVECTOR Point1, FXMVECTOR Point2, FXMVECTOR Point3);
  1899. /****************************************************************************
  1900. *
  1901. * Color operations
  1902. *
  1903. ****************************************************************************/
  1904. BOOL XMColorEqual(FXMVECTOR C1, FXMVECTOR C2);
  1905. BOOL XMColorNotEqual(FXMVECTOR C1, FXMVECTOR C2);
  1906. BOOL XMColorGreater(FXMVECTOR C1, FXMVECTOR C2);
  1907. BOOL XMColorGreaterOrEqual(FXMVECTOR C1, FXMVECTOR C2);
  1908. BOOL XMColorLess(FXMVECTOR C1, FXMVECTOR C2);
  1909. BOOL XMColorLessOrEqual(FXMVECTOR C1, FXMVECTOR C2);
  1910. BOOL XMColorIsNaN(FXMVECTOR C);
  1911. BOOL XMColorIsInfinite(FXMVECTOR C);
  1912. XMVECTOR XMColorNegative(FXMVECTOR C);
  1913. XMVECTOR XMColorModulate(FXMVECTOR C1, FXMVECTOR C2);
  1914. XMVECTOR XMColorAdjustSaturation(FXMVECTOR C, FLOAT Saturation);
  1915. XMVECTOR XMColorAdjustContrast(FXMVECTOR C, FLOAT Contrast);
  1916. /****************************************************************************
  1917. *
  1918. * Miscellaneous operations
  1919. *
  1920. ****************************************************************************/
  1921. BOOL XMVerifyCPUSupport();
  1922. VOID XMAssert(__in_z CONST CHAR* pExpression, __in_z CONST CHAR* pFileName, UINT LineNumber);
  1923. XMVECTOR XMFresnelTerm(FXMVECTOR CosIncidentAngle, FXMVECTOR RefractionIndex);
  1924. BOOL XMScalarNearEqual(FLOAT S1, FLOAT S2, FLOAT Epsilon);
  1925. FLOAT XMScalarModAngle(FLOAT Value);
  1926. FLOAT XMScalarSin(FLOAT Value);
  1927. FLOAT XMScalarCos(FLOAT Value);
  1928. VOID XMScalarSinCos(__out FLOAT* pSin, __out FLOAT* pCos, FLOAT Value);
  1929. FLOAT XMScalarASin(FLOAT Value);
  1930. FLOAT XMScalarACos(FLOAT Value);
  1931. FLOAT XMScalarSinEst(FLOAT Value);
  1932. FLOAT XMScalarCosEst(FLOAT Value);
  1933. VOID XMScalarSinCosEst(__out FLOAT* pSin, __out FLOAT* pCos, FLOAT Value);
  1934. FLOAT XMScalarASinEst(FLOAT Value);
  1935. FLOAT XMScalarACosEst(FLOAT Value);
  1936. /****************************************************************************
  1937. *
  1938. * Globals
  1939. *
  1940. ****************************************************************************/
  1941. // The purpose of the following global constants is to prevent redundant
  1942. // reloading of the constants when they are referenced by more than one
  1943. // separate inline math routine called within the same function. Declaring
  1944. // a constant locally within a routine is sufficient to prevent redundant
  1945. // reloads of that constant when that single routine is called multiple
  1946. // times in a function, but if the constant is used (and declared) in a
  1947. // separate math routine it would be reloaded.
  1948. #define XMGLOBALCONST extern CONST __declspec(selectany)
  1949. XMGLOBALCONST XMVECTORF32 g_XMSinCoefficients0 = {1.0f, -0.166666667f, 8.333333333e-3f, -1.984126984e-4f};
  1950. XMGLOBALCONST XMVECTORF32 g_XMSinCoefficients1 = {2.755731922e-6f, -2.505210839e-8f, 1.605904384e-10f, -7.647163732e-13f};
  1951. XMGLOBALCONST XMVECTORF32 g_XMSinCoefficients2 = {2.811457254e-15f, -8.220635247e-18f, 1.957294106e-20f, -3.868170171e-23f};
  1952. XMGLOBALCONST XMVECTORF32 g_XMCosCoefficients0 = {1.0f, -0.5f, 4.166666667e-2f, -1.388888889e-3f};
  1953. XMGLOBALCONST XMVECTORF32 g_XMCosCoefficients1 = {2.480158730e-5f, -2.755731922e-7f, 2.087675699e-9f, -1.147074560e-11f};
  1954. XMGLOBALCONST XMVECTORF32 g_XMCosCoefficients2 = {4.779477332e-14f, -1.561920697e-16f, 4.110317623e-19f, -8.896791392e-22f};
  1955. XMGLOBALCONST XMVECTORF32 g_XMTanCoefficients0 = {1.0f, 0.333333333f, 0.133333333f, 5.396825397e-2f};
  1956. XMGLOBALCONST XMVECTORF32 g_XMTanCoefficients1 = {2.186948854e-2f, 8.863235530e-3f, 3.592128167e-3f, 1.455834485e-3f};
  1957. XMGLOBALCONST XMVECTORF32 g_XMTanCoefficients2 = {5.900274264e-4f, 2.391290764e-4f, 9.691537707e-5f, 3.927832950e-5f};
  1958. XMGLOBALCONST XMVECTORF32 g_XMASinCoefficients0 = {-0.05806367563904f, -0.41861972469416f, 0.22480114791621f, 2.17337241360606f};
  1959. XMGLOBALCONST XMVECTORF32 g_XMASinCoefficients1 = {0.61657275907170f, 4.29696498283455f, -1.18942822255452f, -6.53784832094831f};
  1960. XMGLOBALCONST XMVECTORF32 g_XMASinCoefficients2 = {-1.36926553863413f, -4.48179294237210f, 1.41810672941833f, 5.48179257935713f};
  1961. XMGLOBALCONST XMVECTORF32 g_XMATanCoefficients0 = {1.0f, 0.333333334f, 0.2f, 0.142857143f};
  1962. XMGLOBALCONST XMVECTORF32 g_XMATanCoefficients1 = {1.111111111e-1f, 9.090909091e-2f, 7.692307692e-2f, 6.666666667e-2f};
  1963. XMGLOBALCONST XMVECTORF32 g_XMATanCoefficients2 = {5.882352941e-2f, 5.263157895e-2f, 4.761904762e-2f, 4.347826087e-2f};
  1964. XMGLOBALCONST XMVECTORF32 g_XMSinEstCoefficients = {1.0f, -1.66521856991541e-1f, 8.199913018755e-3f, -1.61475937228e-4f};
  1965. XMGLOBALCONST XMVECTORF32 g_XMCosEstCoefficients = {1.0f, -4.95348008918096e-1f, 3.878259962881e-2f, -9.24587976263e-4f};
  1966. XMGLOBALCONST XMVECTORF32 g_XMTanEstCoefficients = {2.484f, -1.954923183e-1f, 2.467401101f, XM_1DIVPI};
  1967. XMGLOBALCONST XMVECTORF32 g_XMATanEstCoefficients = {7.689891418951e-1f, 1.104742493348f, 8.661844266006e-1f, XM_PIDIV2};
  1968. XMGLOBALCONST XMVECTORF32 g_XMASinEstCoefficients = {-1.36178272886711f, 2.37949493464538f, -8.08228565650486e-1f, 2.78440142746736e-1f};
  1969. XMGLOBALCONST XMVECTORF32 g_XMASinEstConstants = {1.00000011921f, XM_PIDIV2, 0.0f, 0.0f};
  1970. XMGLOBALCONST XMVECTORF32 g_XMPiConstants0 = {XM_PI, XM_2PI, XM_1DIVPI, XM_1DIV2PI};
  1971. XMGLOBALCONST XMVECTORF32 g_XMIdentityR0 = {1.0f, 0.0f, 0.0f, 0.0f};
  1972. XMGLOBALCONST XMVECTORF32 g_XMIdentityR1 = {0.0f, 1.0f, 0.0f, 0.0f};
  1973. XMGLOBALCONST XMVECTORF32 g_XMIdentityR2 = {0.0f, 0.0f, 1.0f, 0.0f};
  1974. XMGLOBALCONST XMVECTORF32 g_XMIdentityR3 = {0.0f, 0.0f, 0.0f, 1.0f};
  1975. XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR0 = {-1.0f,0.0f, 0.0f, 0.0f};
  1976. XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR1 = {0.0f,-1.0f, 0.0f, 0.0f};
  1977. XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR2 = {0.0f, 0.0f,-1.0f, 0.0f};
  1978. XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR3 = {0.0f, 0.0f, 0.0f,-1.0f};
  1979. #if defined(_XM_NO_INTRINSICS_) || defined(_XM_SSE_INTRINSICS_)
  1980. XMGLOBALCONST XMVECTORI32 g_XMNegativeZero = {0x80000000, 0x80000000, 0x80000000, 0x80000000};
  1981. XMGLOBALCONST XMVECTORI32 g_XMNegate3 = {0x80000000, 0x80000000, 0x80000000, 0x00000000};
  1982. XMGLOBALCONST XMVECTORI32 g_XMMask3 = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000};
  1983. XMGLOBALCONST XMVECTORI32 g_XMMaskX = {0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000};
  1984. XMGLOBALCONST XMVECTORI32 g_XMMaskY = {0x00000000, 0xFFFFFFFF, 0x00000000, 0x00000000};
  1985. XMGLOBALCONST XMVECTORI32 g_XMMaskZ = {0x00000000, 0x00000000, 0xFFFFFFFF, 0x00000000};
  1986. XMGLOBALCONST XMVECTORI32 g_XMMaskW = {0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF};
  1987. XMGLOBALCONST XMVECTORF32 g_XMOne = { 1.0f, 1.0f, 1.0f, 1.0f};
  1988. XMGLOBALCONST XMVECTORF32 g_XMOne3 = { 1.0f, 1.0f, 1.0f, 0.0f};
  1989. XMGLOBALCONST XMVECTORF32 g_XMZero = { 0.0f, 0.0f, 0.0f, 0.0f};
  1990. XMGLOBALCONST XMVECTORF32 g_XMNegativeOne = {-1.0f,-1.0f,-1.0f,-1.0f};
  1991. XMGLOBALCONST XMVECTORF32 g_XMOneHalf = { 0.5f, 0.5f, 0.5f, 0.5f};
  1992. XMGLOBALCONST XMVECTORF32 g_XMNegativeOneHalf = {-0.5f,-0.5f,-0.5f,-0.5f};
  1993. XMGLOBALCONST XMVECTORF32 g_XMNegativeTwoPi = {-XM_2PI, -XM_2PI, -XM_2PI, -XM_2PI};
  1994. XMGLOBALCONST XMVECTORF32 g_XMNegativePi = {-XM_PI, -XM_PI, -XM_PI, -XM_PI};
  1995. XMGLOBALCONST XMVECTORF32 g_XMHalfPi = {XM_PIDIV2, XM_PIDIV2, XM_PIDIV2, XM_PIDIV2};
  1996. XMGLOBALCONST XMVECTORF32 g_XMPi = {XM_PI, XM_PI, XM_PI, XM_PI};
  1997. XMGLOBALCONST XMVECTORF32 g_XMReciprocalPi = {XM_1DIVPI, XM_1DIVPI, XM_1DIVPI, XM_1DIVPI};
  1998. XMGLOBALCONST XMVECTORF32 g_XMTwoPi = {XM_2PI, XM_2PI, XM_2PI, XM_2PI};
  1999. XMGLOBALCONST XMVECTORF32 g_XMReciprocalTwoPi = {XM_1DIV2PI, XM_1DIV2PI, XM_1DIV2PI, XM_1DIV2PI};
  2000. XMGLOBALCONST XMVECTORF32 g_XMEpsilon = {1.192092896e-7f, 1.192092896e-7f, 1.192092896e-7f, 1.192092896e-7f};
  2001. XMGLOBALCONST XMVECTORI32 g_XMInfinity = {0x7F800000, 0x7F800000, 0x7F800000, 0x7F800000};
  2002. XMGLOBALCONST XMVECTORI32 g_XMQNaN = {0x7FC00000, 0x7FC00000, 0x7FC00000, 0x7FC00000};
  2003. XMGLOBALCONST XMVECTORI32 g_XMQNaNTest = {0x007FFFFF, 0x007FFFFF, 0x007FFFFF, 0x007FFFFF};
  2004. XMGLOBALCONST XMVECTORI32 g_XMAbsMask = {0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF};
  2005. XMGLOBALCONST XMVECTORI32 g_XMFltMin = {0x00800000, 0x00800000, 0x00800000, 0x00800000};
  2006. XMGLOBALCONST XMVECTORI32 g_XMFltMax = {0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF};
  2007. XMGLOBALCONST XMVECTORI32 g_XMNegOneMask = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
  2008. XMGLOBALCONST XMVECTORI32 g_XMMaskA8R8G8B8 = {0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000};
  2009. XMGLOBALCONST XMVECTORI32 g_XMFlipA8R8G8B8 = {0x00000000, 0x00000000, 0x00000000, 0x80000000};
  2010. XMGLOBALCONST XMVECTORF32 g_XMFixAA8R8G8B8 = {0.0f,0.0f,0.0f,(float)(0x80000000U)};
  2011. XMGLOBALCONST XMVECTORF32 g_XMNormalizeA8R8G8B8 = {1.0f/(255.0f*(float)(0x10000)),1.0f/(255.0f*(float)(0x100)),1.0f/255.0f,1.0f/(255.0f*(float)(0x1000000))};
  2012. XMGLOBALCONST XMVECTORI32 g_XMMaskA2B10G10R10 = {0x000003FF, 0x000FFC00, 0x3FF00000, 0xC0000000};
  2013. XMGLOBALCONST XMVECTORI32 g_XMFlipA2B10G10R10 = {0x00000200, 0x00080000, 0x20000000, 0x80000000};
  2014. XMGLOBALCONST XMVECTORF32 g_XMFixAA2B10G10R10 = {-512.0f,-512.0f*(float)(0x400),-512.0f*(float)(0x100000),(float)(0x80000000U)};
  2015. XMGLOBALCONST XMVECTORF32 g_XMNormalizeA2B10G10R10 = {1.0f/511.0f,1.0f/(511.0f*(float)(0x400)),1.0f/(511.0f*(float)(0x100000)),1.0f/(3.0f*(float)(0x40000000))};
  2016. XMGLOBALCONST XMVECTORI32 g_XMMaskX16Y16 = {0x0000FFFF, 0xFFFF0000, 0x00000000, 0x00000000};
  2017. XMGLOBALCONST XMVECTORI32 g_XMFlipX16Y16 = {0x00008000, 0x00000000, 0x00000000, 0x00000000};
  2018. XMGLOBALCONST XMVECTORF32 g_XMFixX16Y16 = {-32768.0f,0.0f,0.0f,0.0f};
  2019. XMGLOBALCONST XMVECTORF32 g_XMNormalizeX16Y16 = {1.0f/32767.0f,1.0f/(32767.0f*65536.0f),0.0f,0.0f};
  2020. XMGLOBALCONST XMVECTORI32 g_XMMaskX16Y16Z16W16 = {0x0000FFFF, 0x0000FFFF, 0xFFFF0000, 0xFFFF0000};
  2021. XMGLOBALCONST XMVECTORI32 g_XMFlipX16Y16Z16W16 = {0x00008000, 0x00008000, 0x00000000, 0x00000000};
  2022. XMGLOBALCONST XMVECTORF32 g_XMFixX16Y16Z16W16 = {-32768.0f,-32768.0f,0.0f,0.0f};
  2023. XMGLOBALCONST XMVECTORF32 g_XMNormalizeX16Y16Z16W16 = {1.0f/32767.0f,1.0f/32767.0f,1.0f/(32767.0f*65536.0f),1.0f/(32767.0f*65536.0f)};
  2024. XMGLOBALCONST XMVECTORF32 g_XMNoFraction = {8388608.0f,8388608.0f,8388608.0f,8388608.0f};
  2025. XMGLOBALCONST XMVECTORI32 g_XMMaskByte = {0x000000FF, 0x000000FF, 0x000000FF, 0x000000FF};
  2026. XMGLOBALCONST XMVECTORF32 g_XMNegateX = {-1.0f, 1.0f, 1.0f, 1.0f};
  2027. XMGLOBALCONST XMVECTORF32 g_XMNegateY = { 1.0f,-1.0f, 1.0f, 1.0f};
  2028. XMGLOBALCONST XMVECTORF32 g_XMNegateZ = { 1.0f, 1.0f,-1.0f, 1.0f};
  2029. XMGLOBALCONST XMVECTORF32 g_XMNegateW = { 1.0f, 1.0f, 1.0f,-1.0f};
  2030. XMGLOBALCONST XMVECTORI32 g_XMSelect0101 = {XM_SELECT_0, XM_SELECT_1, XM_SELECT_0, XM_SELECT_1};
  2031. XMGLOBALCONST XMVECTORI32 g_XMSelect1010 = {XM_SELECT_1, XM_SELECT_0, XM_SELECT_1, XM_SELECT_0};
  2032. XMGLOBALCONST XMVECTORI32 g_XMOneHalfMinusEpsilon = { 0x3EFFFFFD, 0x3EFFFFFD, 0x3EFFFFFD, 0x3EFFFFFD};
  2033. #ifdef _XM_NO_INTRINSICS_
  2034. XMGLOBALCONST XMVECTORI32 g_XMSelect1000 = {XM_SELECT_1, XM_SELECT_0, XM_SELECT_0, XM_SELECT_0};
  2035. XMGLOBALCONST XMVECTORI32 g_XMSelect1100 = {XM_SELECT_1, XM_SELECT_1, XM_SELECT_0, XM_SELECT_0};
  2036. XMGLOBALCONST XMVECTORI32 g_XMSelect1110 = {XM_SELECT_1, XM_SELECT_1, XM_SELECT_1, XM_SELECT_0};
  2037. XMGLOBALCONST XMVECTORI32 g_XMSwizzleXYXY = {XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_0X, XM_PERMUTE_0Y};
  2038. XMGLOBALCONST XMVECTORI32 g_XMSwizzleXYZX = {XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_0Z, XM_PERMUTE_0X};
  2039. XMGLOBALCONST XMVECTORI32 g_XMSwizzleYXZW = {XM_PERMUTE_0Y, XM_PERMUTE_0X, XM_PERMUTE_0Z, XM_PERMUTE_0W};
  2040. XMGLOBALCONST XMVECTORI32 g_XMSwizzleYZXW = {XM_PERMUTE_0Y, XM_PERMUTE_0Z, XM_PERMUTE_0X, XM_PERMUTE_0W};
  2041. XMGLOBALCONST XMVECTORI32 g_XMSwizzleZXYW = {XM_PERMUTE_0Z, XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_0W};
  2042. XMGLOBALCONST XMVECTORI32 g_XMPermute0X0Y1X1Y = {XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_1X, XM_PERMUTE_1Y};
  2043. XMGLOBALCONST XMVECTORI32 g_XMPermute0Z0W1Z1W = {XM_PERMUTE_0Z, XM_PERMUTE_0W, XM_PERMUTE_1Z, XM_PERMUTE_1W};
  2044. #endif // !_XM_NO_INTRINSICS_
  2045. #endif // _XM_NO_INTRINSICS_
  2046. /****************************************************************************
  2047. *
  2048. * Implementation
  2049. *
  2050. ****************************************************************************/
  2051. #pragma warning(push)
  2052. #pragma warning(disable:4214 4204 4616 6001)
  2053. #if !defined(__cplusplus) && !defined(_XBOX) && defined(_XM_ISVS2005_)
  2054. /* Work around VC 2005 bug where math.h defines logf with a semicolon at the end.
  2055. * Note this is fixed as of Visual Studio 2005 Service Pack 1
  2056. */
  2057. #undef logf
  2058. #define logf(x) ((float)log((double)(x)))
  2059. #endif // !defined(__cplusplus) && !defined(_XBOX) && defined(_XM_ISVS2005_)
  2060. //------------------------------------------------------------------------------
  2061. #if defined(_XM_NO_INTRINSICS_) || defined(_XM_SSE_INTRINSICS_)
  2062. XMFINLINE XMVECTOR XMVectorSetBinaryConstant(UINT C0, UINT C1, UINT C2, UINT C3)
  2063. {
  2064. #if defined(_XM_NO_INTRINSICS_)
  2065. XMVECTORF32 vResult = { (C0&1)*1.f, (C1&1)*1.f, (C2&1)*1.f, (C3&1)*1.f};
  2066. return vResult.v;
  2067. #else // XM_SSE_INTRINSICS_
  2068. return _mm_set_ps( (C3&1)*1.f, (C2&1)*1.f, (C1&1)*1.f, (C0&1)*1.f );
  2069. #endif
  2070. }
  2071. //------------------------------------------------------------------------------
  2072. XMFINLINE XMVECTOR XMVectorSplatConstant(INT IntConstant, UINT DivExponent)
  2073. {
  2074. #if defined(_XM_NO_INTRINSICS_)
  2075. XMASSERT( IntConstant >= -16 && IntConstant <= 15 );
  2076. {
  2077. XMVECTORI32 V = { IntConstant, IntConstant, IntConstant, IntConstant };
  2078. return XMConvertVectorIntToFloat( V.v, DivExponent);
  2079. }
  2080. #else // XM_SSE_INTRINSICS_
  2081. XMASSERT( IntConstant >= -16 && IntConstant <= 15 );
  2082. return _mm_set_ps1((float)(IntConstant) / (float)(1 << DivExponent) );
  2083. #endif
  2084. }
  2085. //------------------------------------------------------------------------------
  2086. XMFINLINE XMVECTOR XMVectorSplatConstantInt(INT IntConstant)
  2087. {
  2088. #if defined(_XM_NO_INTRINSICS_)
  2089. XMASSERT( IntConstant >= -16 && IntConstant <= 15 );
  2090. {
  2091. XMVECTORI32 V = { IntConstant, IntConstant, IntConstant, IntConstant };
  2092. return V.v;
  2093. }
  2094. #else // XM_SSE_INTRINSICS_
  2095. XMASSERT( IntConstant >= -16 && IntConstant <= 15 );
  2096. __m128i V = _mm_set1_epi32( IntConstant );
  2097. return reinterpret_cast<__m128 *>(&V)[0];
  2098. #endif
  2099. }
  2100. //------------------------------------------------------------------------------
  2101. XMFINLINE XMVECTOR XMVectorShiftLeft(FXMVECTOR V1, FXMVECTOR V2, UINT Elements)
  2102. {
  2103. return XMVectorPermute(V1, V2, XMVectorPermuteControl((Elements), ((Elements) + 1), ((Elements) + 2), ((Elements) + 3)));
  2104. }
  2105. //------------------------------------------------------------------------------
  2106. XMFINLINE XMVECTOR XMVectorRotateLeft(FXMVECTOR V, UINT Elements)
  2107. {
  2108. #if defined(_XM_NO_INTRINSICS_)
  2109. XMASSERT( Elements < 4 );
  2110. {
  2111. XMVECTORF32 vResult = { V.v[Elements & 3], V.v[(Elements + 1) & 3], V.v[(Elements + 2) & 3], V.v[(Elements + 3) & 3] };
  2112. return vResult.v;
  2113. }
  2114. #else // XM_SSE_INTRINSICS_
  2115. FLOAT fx = XMVectorGetByIndex(V,(Elements) & 3);
  2116. FLOAT fy = XMVectorGetByIndex(V,((Elements) + 1) & 3);
  2117. FLOAT fz = XMVectorGetByIndex(V,((Elements) + 2) & 3);
  2118. FLOAT fw = XMVectorGetByIndex(V,((Elements) + 3) & 3);
  2119. return _mm_set_ps( fw, fz, fy, fx );
  2120. #endif
  2121. }
  2122. //------------------------------------------------------------------------------
  2123. XMFINLINE XMVECTOR XMVectorRotateRight(FXMVECTOR V, UINT Elements)
  2124. {
  2125. #if defined(_XM_NO_INTRINSICS_)
  2126. XMASSERT( Elements < 4 );
  2127. {
  2128. XMVECTORF32 vResult = { V.v[(4 - (Elements)) & 3], V.v[(5 - (Elements)) & 3], V.v[(6 - (Elements)) & 3], V.v[(7 - (Elements)) & 3] };
  2129. return vResult.v;
  2130. }
  2131. #else // XM_SSE_INTRINSICS_
  2132. FLOAT fx = XMVectorGetByIndex(V,(4 - (Elements)) & 3);
  2133. FLOAT fy = XMVectorGetByIndex(V,(5 - (Elements)) & 3);
  2134. FLOAT fz = XMVectorGetByIndex(V,(6 - (Elements)) & 3);
  2135. FLOAT fw = XMVectorGetByIndex(V,(7 - (Elements)) & 3);
  2136. return _mm_set_ps( fw, fz, fy, fx );
  2137. #endif
  2138. }
  2139. //------------------------------------------------------------------------------
  2140. XMFINLINE XMVECTOR XMVectorSwizzle(FXMVECTOR V, UINT E0, UINT E1, UINT E2, UINT E3)
  2141. {
  2142. #if defined(_XM_NO_INTRINSICS_)
  2143. XMASSERT( (E0 < 4) && (E1 < 4) && (E2 < 4) && (E3 < 4) );
  2144. {
  2145. XMVECTORF32 vResult = { V.v[E0], V.v[E1], V.v[E2], V.v[E3] };
  2146. return vResult.v;
  2147. }
  2148. #else // XM_SSE_INTRINSICS_
  2149. FLOAT fx = XMVectorGetByIndex(V,E0);
  2150. FLOAT fy = XMVectorGetByIndex(V,E1);
  2151. FLOAT fz = XMVectorGetByIndex(V,E2);
  2152. FLOAT fw = XMVectorGetByIndex(V,E3);
  2153. return _mm_set_ps( fw, fz, fy, fx );
  2154. #endif
  2155. }
  2156. //------------------------------------------------------------------------------
  2157. XMFINLINE XMVECTOR XMVectorInsert(FXMVECTOR VD, FXMVECTOR VS, UINT VSLeftRotateElements,
  2158. UINT Select0, UINT Select1, UINT Select2, UINT Select3)
  2159. {
  2160. XMVECTOR Control = XMVectorSelectControl(Select0&1, Select1&1, Select2&1, Select3&1);
  2161. return XMVectorSelect( VD, XMVectorRotateLeft(VS, VSLeftRotateElements), Control );
  2162. }
  2163. // Implemented for VMX128 intrinsics as #defines aboves
  2164. #endif _XM_NO_INTRINSICS_ || _XM_SSE_INTRINSICS_
  2165. //------------------------------------------------------------------------------
  2166. #include <xnamathconvert.inl>
  2167. #include <xnamathvector.inl>
  2168. #include <xnamathmatrix.inl>
  2169. #include <xnamathmisc.inl>
  2170. #pragma warning(pop)
  2171. #endif // __XNAMATH_H__