Rev Author Line No. Line
23 ovan 1 ///////////////////////////////////////////////////////////////////////////////////
2 /// OpenGL Mathematics (glm.g-truc.net)
3 ///
4 /// Copyright (c) 2005 - 2015 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 /// Restrictions:
16 /// By making use of the Software for military purposes, you choose to make
17 /// a Bunny unhappy.
18 ///
19 /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 /// THE SOFTWARE.
26 ///
27 /// @ref gtx_matrix_operation
28 /// @file glm/gtx/matrix_operation.inl
29 /// @date 2009-08-29 / 2009-08-29
30 /// @author Christophe Riccio
31 ///////////////////////////////////////////////////////////////////////////////////
32  
33 namespace glm
34 {
35 template <typename T, precision P>
36 GLM_FUNC_QUALIFIER tmat2x2<T, P> diagonal2x2
37 (
38 tvec2<T, P> const & v
39 )
40 {
41 tmat2x2<T, P> Result(static_cast<T>(1));
42 Result[0][0] = v[0];
43 Result[1][1] = v[1];
44 return Result;
45 }
46  
47 template <typename T, precision P>
48 GLM_FUNC_QUALIFIER tmat2x3<T, P> diagonal2x3
49 (
50 tvec2<T, P> const & v
51 )
52 {
53 tmat2x3<T, P> Result(static_cast<T>(1));
54 Result[0][0] = v[0];
55 Result[1][1] = v[1];
56 return Result;
57 }
58  
59 template <typename T, precision P>
60 GLM_FUNC_QUALIFIER tmat2x4<T, P> diagonal2x4
61 (
62 tvec2<T, P> const & v
63 )
64 {
65 tmat2x4<T, P> Result(static_cast<T>(1));
66 Result[0][0] = v[0];
67 Result[1][1] = v[1];
68 return Result;
69 }
70  
71 template <typename T, precision P>
72 GLM_FUNC_QUALIFIER tmat3x2<T, P> diagonal3x2
73 (
74 tvec2<T, P> const & v
75 )
76 {
77 tmat3x2<T, P> Result(static_cast<T>(1));
78 Result[0][0] = v[0];
79 Result[1][1] = v[1];
80 return Result;
81 }
82  
83 template <typename T, precision P>
84 GLM_FUNC_QUALIFIER tmat3x3<T, P> diagonal3x3
85 (
86 tvec3<T, P> const & v
87 )
88 {
89 tmat3x3<T, P> Result(static_cast<T>(1));
90 Result[0][0] = v[0];
91 Result[1][1] = v[1];
92 Result[2][2] = v[2];
93 return Result;
94 }
95  
96 template <typename T, precision P>
97 GLM_FUNC_QUALIFIER tmat3x4<T, P> diagonal3x4
98 (
99 tvec3<T, P> const & v
100 )
101 {
102 tmat3x4<T, P> Result(static_cast<T>(1));
103 Result[0][0] = v[0];
104 Result[1][1] = v[1];
105 Result[2][2] = v[2];
106 return Result;
107 }
108  
109 template <typename T, precision P>
110 GLM_FUNC_QUALIFIER tmat4x4<T, P> diagonal4x4
111 (
112 tvec4<T, P> const & v
113 )
114 {
115 tmat4x4<T, P> Result(static_cast<T>(1));
116 Result[0][0] = v[0];
117 Result[1][1] = v[1];
118 Result[2][2] = v[2];
119 Result[3][3] = v[3];
120 return Result;
121 }
122  
123 template <typename T, precision P>
124 GLM_FUNC_QUALIFIER tmat4x3<T, P> diagonal4x3
125 (
126 tvec3<T, P> const & v
127 )
128 {
129 tmat4x3<T, P> Result(static_cast<T>(1));
130 Result[0][0] = v[0];
131 Result[1][1] = v[1];
132 Result[2][2] = v[2];
133 return Result;
134 }
135  
136 template <typename T, precision P>
137 GLM_FUNC_QUALIFIER tmat4x2<T, P> diagonal4x2
138 (
139 tvec2<T, P> const & v
140 )
141 {
142 tmat4x2<T, P> Result(static_cast<T>(1));
143 Result[0][0] = v[0];
144 Result[1][1] = v[1];
145 return Result;
146 }
147 }//namespace glm