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.

124 lines
2.9 KiB

  1. ///////////////////////////////////////////////////////////////////////////////////////////////////
  2. // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
  3. ///////////////////////////////////////////////////////////////////////////////////////////////////
  4. // Created : 2009-08-29
  5. // Updated : 2009-08-29
  6. // Licence : This source is under MIT License
  7. // File : glm/gtx/matrix_operation.inl
  8. ///////////////////////////////////////////////////////////////////////////////////////////////////
  9. namespace glm
  10. {
  11. template <typename valType>
  12. GLM_FUNC_QUALIFIER detail::tmat2x2<valType> diagonal2x2
  13. (
  14. detail::tvec2<valType> const & v
  15. )
  16. {
  17. detail::tmat2x2<valType> Result(valType(1));
  18. Result[0][0] = v[0];
  19. Result[1][1] = v[1];
  20. return Result;
  21. }
  22. template <typename valType>
  23. GLM_FUNC_QUALIFIER detail::tmat2x3<valType> diagonal2x3
  24. (
  25. detail::tvec2<valType> const & v
  26. )
  27. {
  28. detail::tmat2x3<valType> Result(valType(1));
  29. Result[0][0] = v[0];
  30. Result[1][1] = v[1];
  31. return Result;
  32. }
  33. template <typename valType>
  34. GLM_FUNC_QUALIFIER detail::tmat2x4<valType> diagonal2x4
  35. (
  36. detail::tvec2<valType> const & v
  37. )
  38. {
  39. detail::tmat2x4<valType> Result(valType(1));
  40. Result[0][0] = v[0];
  41. Result[1][1] = v[1];
  42. return Result;
  43. }
  44. template <typename valType>
  45. GLM_FUNC_QUALIFIER detail::tmat3x2<valType> diagonal3x2
  46. (
  47. detail::tvec2<valType> const & v
  48. )
  49. {
  50. detail::tmat3x2<valType> Result(valType(1));
  51. Result[0][0] = v[0];
  52. Result[1][1] = v[1];
  53. return Result;
  54. }
  55. template <typename valType>
  56. GLM_FUNC_QUALIFIER detail::tmat3x3<valType> diagonal3x3
  57. (
  58. detail::tvec3<valType> const & v
  59. )
  60. {
  61. detail::tmat3x3<valType> Result(valType(1));
  62. Result[0][0] = v[0];
  63. Result[1][1] = v[1];
  64. Result[2][2] = v[2];
  65. return Result;
  66. }
  67. template <typename valType>
  68. GLM_FUNC_QUALIFIER detail::tmat3x4<valType> diagonal3x4
  69. (
  70. detail::tvec3<valType> const & v
  71. )
  72. {
  73. detail::tmat3x4<valType> Result(valType(1));
  74. Result[0][0] = v[0];
  75. Result[1][1] = v[1];
  76. Result[2][2] = v[2];
  77. return Result;
  78. }
  79. template <typename valType>
  80. GLM_FUNC_QUALIFIER detail::tmat4x4<valType> diagonal4x4
  81. (
  82. detail::tvec4<valType> const & v
  83. )
  84. {
  85. detail::tmat4x4<valType> Result(valType(1));
  86. Result[0][0] = v[0];
  87. Result[1][1] = v[1];
  88. Result[2][2] = v[2];
  89. Result[3][3] = v[3];
  90. return Result;
  91. }
  92. template <typename valType>
  93. GLM_FUNC_QUALIFIER detail::tmat4x3<valType> diagonal4x3
  94. (
  95. detail::tvec3<valType> const & v
  96. )
  97. {
  98. detail::tmat4x3<valType> Result(valType(1));
  99. Result[0][0] = v[0];
  100. Result[1][1] = v[1];
  101. Result[2][2] = v[2];
  102. return Result;
  103. }
  104. template <typename valType>
  105. GLM_FUNC_QUALIFIER detail::tmat4x2<valType> diagonal4x2
  106. (
  107. detail::tvec2<valType> const & v
  108. )
  109. {
  110. detail::tmat4x2<valType> Result(valType(1));
  111. Result[0][0] = v[0];
  112. Result[1][1] = v[1];
  113. return Result;
  114. }
  115. }//namespace glm