matrix_integer.hpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. ///////////////////////////////////////////////////////////////////////////////////
  2. /// OpenGL Mathematics (glm.g-truc.net)
  3. ///
  4. /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
  5. /// Permission is hereby granted, free of charge, to any person obtaining a copy
  6. /// of this software and associated documentation files (the "Software"), to deal
  7. /// in the Software without restriction, including without limitation the rights
  8. /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. /// copies of the Software, and to permit persons to whom the Software is
  10. /// furnished to do so, subject to the following conditions:
  11. ///
  12. /// The above copyright notice and this permission notice shall be included in
  13. /// all copies or substantial portions of the Software.
  14. ///
  15. /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. /// THE SOFTWARE.
  22. ///
  23. /// @ref gtc_matrix_integer
  24. /// @file glm/gtc/matrix_integer.hpp
  25. /// @date 2011-01-20 / 2011-06-05
  26. /// @author Christophe Riccio
  27. ///
  28. /// @see core (dependence)
  29. ///
  30. /// @defgroup gtc_matrix_integer GLM_GTC_matrix_integer
  31. /// @ingroup gtc
  32. ///
  33. /// Defines a number of matrices with integer types.
  34. /// <glm/gtc/matrix_integer.hpp> need to be included to use these functionalities.
  35. ///////////////////////////////////////////////////////////////////////////////////
  36. #ifndef GLM_GTC_matrix_integer
  37. #define GLM_GTC_matrix_integer
  38. // Dependency:
  39. #include "../mat2x2.hpp"
  40. #include "../mat2x3.hpp"
  41. #include "../mat2x4.hpp"
  42. #include "../mat3x2.hpp"
  43. #include "../mat3x3.hpp"
  44. #include "../mat3x4.hpp"
  45. #include "../mat4x2.hpp"
  46. #include "../mat4x3.hpp"
  47. #include "../mat4x4.hpp"
  48. #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
  49. # pragma message("GLM: GLM_GTC_matrix_integer extension included")
  50. #endif
  51. namespace glm
  52. {
  53. /// @addtogroup gtc_matrix_integer
  54. /// @{
  55. /// High-precision signed integer 2x2 matrix.
  56. /// @see gtc_matrix_integer
  57. typedef detail::tmat2x2<int, highp> highp_imat2;
  58. /// High-precision signed integer 3x3 matrix.
  59. /// @see gtc_matrix_integer
  60. typedef detail::tmat3x3<int, highp> highp_imat3;
  61. /// High-precision signed integer 4x4 matrix.
  62. /// @see gtc_matrix_integer
  63. typedef detail::tmat4x4<int, highp> highp_imat4;
  64. /// High-precision signed integer 2x2 matrix.
  65. /// @see gtc_matrix_integer
  66. typedef detail::tmat2x2<int, highp> highp_imat2x2;
  67. /// High-precision signed integer 2x3 matrix.
  68. /// @see gtc_matrix_integer
  69. typedef detail::tmat2x3<int, highp> highp_imat2x3;
  70. /// High-precision signed integer 2x4 matrix.
  71. /// @see gtc_matrix_integer
  72. typedef detail::tmat2x4<int, highp> highp_imat2x4;
  73. /// High-precision signed integer 3x2 matrix.
  74. /// @see gtc_matrix_integer
  75. typedef detail::tmat3x2<int, highp> highp_imat3x2;
  76. /// High-precision signed integer 3x3 matrix.
  77. /// @see gtc_matrix_integer
  78. typedef detail::tmat3x3<int, highp> highp_imat3x3;
  79. /// High-precision signed integer 3x4 matrix.
  80. /// @see gtc_matrix_integer
  81. typedef detail::tmat3x4<int, highp> highp_imat3x4;
  82. /// High-precision signed integer 4x2 matrix.
  83. /// @see gtc_matrix_integer
  84. typedef detail::tmat4x2<int, highp> highp_imat4x2;
  85. /// High-precision signed integer 4x3 matrix.
  86. /// @see gtc_matrix_integer
  87. typedef detail::tmat4x3<int, highp> highp_imat4x3;
  88. /// High-precision signed integer 4x4 matrix.
  89. /// @see gtc_matrix_integer
  90. typedef detail::tmat4x4<int, highp> highp_imat4x4;
  91. /// Medium-precision signed integer 2x2 matrix.
  92. /// @see gtc_matrix_integer
  93. typedef detail::tmat2x2<int, mediump> mediump_imat2;
  94. /// Medium-precision signed integer 3x3 matrix.
  95. /// @see gtc_matrix_integer
  96. typedef detail::tmat3x3<int, mediump> mediump_imat3;
  97. /// Medium-precision signed integer 4x4 matrix.
  98. /// @see gtc_matrix_integer
  99. typedef detail::tmat4x4<int, mediump> mediump_imat4;
  100. /// Medium-precision signed integer 2x2 matrix.
  101. /// @see gtc_matrix_integer
  102. typedef detail::tmat2x2<int, mediump> mediump_imat2x2;
  103. /// Medium-precision signed integer 2x3 matrix.
  104. /// @see gtc_matrix_integer
  105. typedef detail::tmat2x3<int, mediump> mediump_imat2x3;
  106. /// Medium-precision signed integer 2x4 matrix.
  107. /// @see gtc_matrix_integer
  108. typedef detail::tmat2x4<int, mediump> mediump_imat2x4;
  109. /// Medium-precision signed integer 3x2 matrix.
  110. /// @see gtc_matrix_integer
  111. typedef detail::tmat3x2<int, mediump> mediump_imat3x2;
  112. /// Medium-precision signed integer 3x3 matrix.
  113. /// @see gtc_matrix_integer
  114. typedef detail::tmat3x3<int, mediump> mediump_imat3x3;
  115. /// Medium-precision signed integer 3x4 matrix.
  116. /// @see gtc_matrix_integer
  117. typedef detail::tmat3x4<int, mediump> mediump_imat3x4;
  118. /// Medium-precision signed integer 4x2 matrix.
  119. /// @see gtc_matrix_integer
  120. typedef detail::tmat4x2<int, mediump> mediump_imat4x2;
  121. /// Medium-precision signed integer 4x3 matrix.
  122. /// @see gtc_matrix_integer
  123. typedef detail::tmat4x3<int, mediump> mediump_imat4x3;
  124. /// Medium-precision signed integer 4x4 matrix.
  125. /// @see gtc_matrix_integer
  126. typedef detail::tmat4x4<int, mediump> mediump_imat4x4;
  127. /// Low-precision signed integer 2x2 matrix.
  128. /// @see gtc_matrix_integer
  129. typedef detail::tmat2x2<int, lowp> lowp_imat2;
  130. /// Low-precision signed integer 3x3 matrix.
  131. /// @see gtc_matrix_integer
  132. typedef detail::tmat3x3<int, lowp> lowp_imat3;
  133. /// Low-precision signed integer 4x4 matrix.
  134. /// @see gtc_matrix_integer
  135. typedef detail::tmat4x4<int, lowp> lowp_imat4;
  136. /// Low-precision signed integer 2x2 matrix.
  137. /// @see gtc_matrix_integer
  138. typedef detail::tmat2x2<int, lowp> lowp_imat2x2;
  139. /// Low-precision signed integer 2x3 matrix.
  140. /// @see gtc_matrix_integer
  141. typedef detail::tmat2x3<int, lowp> lowp_imat2x3;
  142. /// Low-precision signed integer 2x4 matrix.
  143. /// @see gtc_matrix_integer
  144. typedef detail::tmat2x4<int, lowp> lowp_imat2x4;
  145. /// Low-precision signed integer 3x2 matrix.
  146. /// @see gtc_matrix_integer
  147. typedef detail::tmat3x2<int, lowp> lowp_imat3x2;
  148. /// Low-precision signed integer 3x3 matrix.
  149. /// @see gtc_matrix_integer
  150. typedef detail::tmat3x3<int, lowp> lowp_imat3x3;
  151. /// Low-precision signed integer 3x4 matrix.
  152. /// @see gtc_matrix_integer
  153. typedef detail::tmat3x4<int, lowp> lowp_imat3x4;
  154. /// Low-precision signed integer 4x2 matrix.
  155. /// @see gtc_matrix_integer
  156. typedef detail::tmat4x2<int, lowp> lowp_imat4x2;
  157. /// Low-precision signed integer 4x3 matrix.
  158. /// @see gtc_matrix_integer
  159. typedef detail::tmat4x3<int, lowp> lowp_imat4x3;
  160. /// Low-precision signed integer 4x4 matrix.
  161. /// @see gtc_matrix_integer
  162. typedef detail::tmat4x4<int, lowp> lowp_imat4x4;
  163. /// High-precision unsigned integer 2x2 matrix.
  164. /// @see gtc_matrix_integer
  165. typedef detail::tmat2x2<uint, highp> highp_umat2;
  166. /// High-precision unsigned integer 3x3 matrix.
  167. /// @see gtc_matrix_integer
  168. typedef detail::tmat3x3<uint, highp> highp_umat3;
  169. /// High-precision unsigned integer 4x4 matrix.
  170. /// @see gtc_matrix_integer
  171. typedef detail::tmat4x4<uint, highp> highp_umat4;
  172. /// High-precision unsigned integer 2x2 matrix.
  173. /// @see gtc_matrix_integer
  174. typedef detail::tmat2x2<uint, highp> highp_umat2x2;
  175. /// High-precision unsigned integer 2x3 matrix.
  176. /// @see gtc_matrix_integer
  177. typedef detail::tmat2x3<uint, highp> highp_umat2x3;
  178. /// High-precision unsigned integer 2x4 matrix.
  179. /// @see gtc_matrix_integer
  180. typedef detail::tmat2x4<uint, highp> highp_umat2x4;
  181. /// High-precision unsigned integer 3x2 matrix.
  182. /// @see gtc_matrix_integer
  183. typedef detail::tmat3x2<uint, highp> highp_umat3x2;
  184. /// High-precision unsigned integer 3x3 matrix.
  185. /// @see gtc_matrix_integer
  186. typedef detail::tmat3x3<uint, highp> highp_umat3x3;
  187. /// High-precision unsigned integer 3x4 matrix.
  188. /// @see gtc_matrix_integer
  189. typedef detail::tmat3x4<uint, highp> highp_umat3x4;
  190. /// High-precision unsigned integer 4x2 matrix.
  191. /// @see gtc_matrix_integer
  192. typedef detail::tmat4x2<uint, highp> highp_umat4x2;
  193. /// High-precision unsigned integer 4x3 matrix.
  194. /// @see gtc_matrix_integer
  195. typedef detail::tmat4x3<uint, highp> highp_umat4x3;
  196. /// High-precision unsigned integer 4x4 matrix.
  197. /// @see gtc_matrix_integer
  198. typedef detail::tmat4x4<uint, highp> highp_umat4x4;
  199. /// Medium-precision unsigned integer 2x2 matrix.
  200. /// @see gtc_matrix_integer
  201. typedef detail::tmat2x2<uint, mediump> mediump_umat2;
  202. /// Medium-precision unsigned integer 3x3 matrix.
  203. /// @see gtc_matrix_integer
  204. typedef detail::tmat3x3<uint, mediump> mediump_umat3;
  205. /// Medium-precision unsigned integer 4x4 matrix.
  206. /// @see gtc_matrix_integer
  207. typedef detail::tmat4x4<uint, mediump> mediump_umat4;
  208. /// Medium-precision unsigned integer 2x2 matrix.
  209. /// @see gtc_matrix_integer
  210. typedef detail::tmat2x2<uint, mediump> mediump_umat2x2;
  211. /// Medium-precision unsigned integer 2x3 matrix.
  212. /// @see gtc_matrix_integer
  213. typedef detail::tmat2x3<uint, mediump> mediump_umat2x3;
  214. /// Medium-precision unsigned integer 2x4 matrix.
  215. /// @see gtc_matrix_integer
  216. typedef detail::tmat2x4<uint, mediump> mediump_umat2x4;
  217. /// Medium-precision unsigned integer 3x2 matrix.
  218. /// @see gtc_matrix_integer
  219. typedef detail::tmat3x2<uint, mediump> mediump_umat3x2;
  220. /// Medium-precision unsigned integer 3x3 matrix.
  221. /// @see gtc_matrix_integer
  222. typedef detail::tmat3x3<uint, mediump> mediump_umat3x3;
  223. /// Medium-precision unsigned integer 3x4 matrix.
  224. /// @see gtc_matrix_integer
  225. typedef detail::tmat3x4<uint, mediump> mediump_umat3x4;
  226. /// Medium-precision unsigned integer 4x2 matrix.
  227. /// @see gtc_matrix_integer
  228. typedef detail::tmat4x2<uint, mediump> mediump_umat4x2;
  229. /// Medium-precision unsigned integer 4x3 matrix.
  230. /// @see gtc_matrix_integer
  231. typedef detail::tmat4x3<uint, mediump> mediump_umat4x3;
  232. /// Medium-precision unsigned integer 4x4 matrix.
  233. /// @see gtc_matrix_integer
  234. typedef detail::tmat4x4<uint, mediump> mediump_umat4x4;
  235. /// Low-precision unsigned integer 2x2 matrix.
  236. /// @see gtc_matrix_integer
  237. typedef detail::tmat2x2<uint, lowp> lowp_umat2;
  238. /// Low-precision unsigned integer 3x3 matrix.
  239. /// @see gtc_matrix_integer
  240. typedef detail::tmat3x3<uint, lowp> lowp_umat3;
  241. /// Low-precision unsigned integer 4x4 matrix.
  242. /// @see gtc_matrix_integer
  243. typedef detail::tmat4x4<uint, lowp> lowp_umat4;
  244. /// Low-precision unsigned integer 2x2 matrix.
  245. /// @see gtc_matrix_integer
  246. typedef detail::tmat2x2<uint, lowp> lowp_umat2x2;
  247. /// Low-precision unsigned integer 2x3 matrix.
  248. /// @see gtc_matrix_integer
  249. typedef detail::tmat2x3<uint, lowp> lowp_umat2x3;
  250. /// Low-precision unsigned integer 2x4 matrix.
  251. /// @see gtc_matrix_integer
  252. typedef detail::tmat2x4<uint, lowp> lowp_umat2x4;
  253. /// Low-precision unsigned integer 3x2 matrix.
  254. /// @see gtc_matrix_integer
  255. typedef detail::tmat3x2<uint, lowp> lowp_umat3x2;
  256. /// Low-precision unsigned integer 3x3 matrix.
  257. /// @see gtc_matrix_integer
  258. typedef detail::tmat3x3<uint, lowp> lowp_umat3x3;
  259. /// Low-precision unsigned integer 3x4 matrix.
  260. /// @see gtc_matrix_integer
  261. typedef detail::tmat3x4<uint, lowp> lowp_umat3x4;
  262. /// Low-precision unsigned integer 4x2 matrix.
  263. /// @see gtc_matrix_integer
  264. typedef detail::tmat4x2<uint, lowp> lowp_umat4x2;
  265. /// Low-precision unsigned integer 4x3 matrix.
  266. /// @see gtc_matrix_integer
  267. typedef detail::tmat4x3<uint, lowp> lowp_umat4x3;
  268. /// Low-precision unsigned integer 4x4 matrix.
  269. /// @see gtc_matrix_integer
  270. typedef detail::tmat4x4<uint, lowp> lowp_umat4x4;
  271. #if(defined(GLM_PRECISION_HIGHP_INT))
  272. typedef highp_imat2 imat2;
  273. typedef highp_imat3 imat3;
  274. typedef highp_imat4 imat4;
  275. typedef highp_imat2x2 imat2x2;
  276. typedef highp_imat2x3 imat2x3;
  277. typedef highp_imat2x4 imat2x4;
  278. typedef highp_imat3x2 imat3x2;
  279. typedef highp_imat3x3 imat3x3;
  280. typedef highp_imat3x4 imat3x4;
  281. typedef highp_imat4x2 imat4x2;
  282. typedef highp_imat4x3 imat4x3;
  283. typedef highp_imat4x4 imat4x4;
  284. #elif(defined(GLM_PRECISION_LOWP_INT))
  285. typedef lowp_imat2 imat2;
  286. typedef lowp_imat3 imat3;
  287. typedef lowp_imat4 imat4;
  288. typedef lowp_imat2x2 imat2x2;
  289. typedef lowp_imat2x3 imat2x3;
  290. typedef lowp_imat2x4 imat2x4;
  291. typedef lowp_imat3x2 imat3x2;
  292. typedef lowp_imat3x3 imat3x3;
  293. typedef lowp_imat3x4 imat3x4;
  294. typedef lowp_imat4x2 imat4x2;
  295. typedef lowp_imat4x3 imat4x3;
  296. typedef lowp_imat4x4 imat4x4;
  297. #else //if(defined(GLM_PRECISION_MEDIUMP_INT))
  298. /// Signed integer 2x2 matrix.
  299. /// @see gtc_matrix_integer
  300. typedef mediump_imat2 imat2;
  301. /// Signed integer 3x3 matrix.
  302. /// @see gtc_matrix_integer
  303. typedef mediump_imat3 imat3;
  304. /// Signed integer 4x4 matrix.
  305. /// @see gtc_matrix_integer
  306. typedef mediump_imat4 imat4;
  307. /// Signed integer 2x2 matrix.
  308. /// @see gtc_matrix_integer
  309. typedef mediump_imat2x2 imat2x2;
  310. /// Signed integer 2x3 matrix.
  311. /// @see gtc_matrix_integer
  312. typedef mediump_imat2x3 imat2x3;
  313. /// Signed integer 2x4 matrix.
  314. /// @see gtc_matrix_integer
  315. typedef mediump_imat2x4 imat2x4;
  316. /// Signed integer 3x2 matrix.
  317. /// @see gtc_matrix_integer
  318. typedef mediump_imat3x2 imat3x2;
  319. /// Signed integer 3x3 matrix.
  320. /// @see gtc_matrix_integer
  321. typedef mediump_imat3x3 imat3x3;
  322. /// Signed integer 3x4 matrix.
  323. /// @see gtc_matrix_integer
  324. typedef mediump_imat3x4 imat3x4;
  325. /// Signed integer 4x2 matrix.
  326. /// @see gtc_matrix_integer
  327. typedef mediump_imat4x2 imat4x2;
  328. /// Signed integer 4x3 matrix.
  329. /// @see gtc_matrix_integer
  330. typedef mediump_imat4x3 imat4x3;
  331. /// Signed integer 4x4 matrix.
  332. /// @see gtc_matrix_integer
  333. typedef mediump_imat4x4 imat4x4;
  334. #endif//GLM_PRECISION
  335. #if(defined(GLM_PRECISION_HIGHP_UINT))
  336. typedef highp_umat2 umat2;
  337. typedef highp_umat3 umat3;
  338. typedef highp_umat4 umat4;
  339. typedef highp_umat2x2 umat2x2;
  340. typedef highp_umat2x3 umat2x3;
  341. typedef highp_umat2x4 umat2x4;
  342. typedef highp_umat3x2 umat3x2;
  343. typedef highp_umat3x3 umat3x3;
  344. typedef highp_umat3x4 umat3x4;
  345. typedef highp_umat4x2 umat4x2;
  346. typedef highp_umat4x3 umat4x3;
  347. typedef highp_umat4x4 umat4x4;
  348. #elif(defined(GLM_PRECISION_LOWP_UINT))
  349. typedef lowp_umat2 umat2;
  350. typedef lowp_umat3 umat3;
  351. typedef lowp_umat4 umat4;
  352. typedef lowp_umat2x2 umat2x2;
  353. typedef lowp_umat2x3 umat2x3;
  354. typedef lowp_umat2x4 umat2x4;
  355. typedef lowp_umat3x2 umat3x2;
  356. typedef lowp_umat3x3 umat3x3;
  357. typedef lowp_umat3x4 umat3x4;
  358. typedef lowp_umat4x2 umat4x2;
  359. typedef lowp_umat4x3 umat4x3;
  360. typedef lowp_umat4x4 umat4x4;
  361. #else //if(defined(GLM_PRECISION_MEDIUMP_UINT))
  362. /// Unsigned integer 2x2 matrix.
  363. /// @see gtc_matrix_integer
  364. typedef mediump_umat2 umat2;
  365. /// Unsigned integer 3x3 matrix.
  366. /// @see gtc_matrix_integer
  367. typedef mediump_umat3 umat3;
  368. /// Unsigned integer 4x4 matrix.
  369. /// @see gtc_matrix_integer
  370. typedef mediump_umat4 umat4;
  371. /// Unsigned integer 2x2 matrix.
  372. /// @see gtc_matrix_integer
  373. typedef mediump_umat2x2 umat2x2;
  374. /// Unsigned integer 2x3 matrix.
  375. /// @see gtc_matrix_integer
  376. typedef mediump_umat2x3 umat2x3;
  377. /// Unsigned integer 2x4 matrix.
  378. /// @see gtc_matrix_integer
  379. typedef mediump_umat2x4 umat2x4;
  380. /// Unsigned integer 3x2 matrix.
  381. /// @see gtc_matrix_integer
  382. typedef mediump_umat3x2 umat3x2;
  383. /// Unsigned integer 3x3 matrix.
  384. /// @see gtc_matrix_integer
  385. typedef mediump_umat3x3 umat3x3;
  386. /// Unsigned integer 3x4 matrix.
  387. /// @see gtc_matrix_integer
  388. typedef mediump_umat3x4 umat3x4;
  389. /// Unsigned integer 4x2 matrix.
  390. /// @see gtc_matrix_integer
  391. typedef mediump_umat4x2 umat4x2;
  392. /// Unsigned integer 4x3 matrix.
  393. /// @see gtc_matrix_integer
  394. typedef mediump_umat4x3 umat4x3;
  395. /// Unsigned integer 4x4 matrix.
  396. /// @see gtc_matrix_integer
  397. typedef mediump_umat4x4 umat4x4;
  398. #endif//GLM_PRECISION
  399. /// @}
  400. }//namespace glm
  401. #endif//GLM_GTC_matrix_integer