• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/// @ref gtx_matrix_operation
2/// @file glm/gtx/matrix_operation.inl
3
4namespace glm
5{
6	template <typename T, precision P>
7	GLM_FUNC_QUALIFIER tmat2x2<T, P> diagonal2x2
8	(
9		tvec2<T, P> const & v
10	)
11	{
12		tmat2x2<T, P> Result(static_cast<T>(1));
13		Result[0][0] = v[0];
14		Result[1][1] = v[1];
15		return Result;
16	}
17
18	template <typename T, precision P>
19	GLM_FUNC_QUALIFIER tmat2x3<T, P> diagonal2x3
20	(
21		tvec2<T, P> const & v
22	)
23	{
24		tmat2x3<T, P> Result(static_cast<T>(1));
25		Result[0][0] = v[0];
26		Result[1][1] = v[1];
27		return Result;
28	}
29
30	template <typename T, precision P>
31	GLM_FUNC_QUALIFIER tmat2x4<T, P> diagonal2x4
32	(
33		tvec2<T, P> const & v
34	)
35	{
36		tmat2x4<T, P> Result(static_cast<T>(1));
37		Result[0][0] = v[0];
38		Result[1][1] = v[1];
39		return Result;
40	}
41
42	template <typename T, precision P>
43	GLM_FUNC_QUALIFIER tmat3x2<T, P> diagonal3x2
44	(
45		tvec2<T, P> const & v
46	)
47	{
48		tmat3x2<T, P> Result(static_cast<T>(1));
49		Result[0][0] = v[0];
50		Result[1][1] = v[1];
51		return Result;
52	}
53
54	template <typename T, precision P>
55	GLM_FUNC_QUALIFIER tmat3x3<T, P> diagonal3x3
56	(
57		tvec3<T, P> const & v
58	)
59	{
60		tmat3x3<T, P> Result(static_cast<T>(1));
61		Result[0][0] = v[0];
62		Result[1][1] = v[1];
63		Result[2][2] = v[2];
64		return Result;
65	}
66
67	template <typename T, precision P>
68	GLM_FUNC_QUALIFIER tmat3x4<T, P> diagonal3x4
69	(
70		tvec3<T, P> const & v
71	)
72	{
73		tmat3x4<T, P> Result(static_cast<T>(1));
74		Result[0][0] = v[0];
75		Result[1][1] = v[1];
76		Result[2][2] = v[2];
77		return Result;
78	}
79
80	template <typename T, precision P>
81	GLM_FUNC_QUALIFIER tmat4x4<T, P> diagonal4x4
82	(
83		tvec4<T, P> const & v
84	)
85	{
86		tmat4x4<T, P> Result(static_cast<T>(1));
87		Result[0][0] = v[0];
88		Result[1][1] = v[1];
89		Result[2][2] = v[2];
90		Result[3][3] = v[3];
91		return Result;
92	}
93
94	template <typename T, precision P>
95	GLM_FUNC_QUALIFIER tmat4x3<T, P> diagonal4x3
96	(
97		tvec3<T, P> const & v
98	)
99	{
100		tmat4x3<T, P> Result(static_cast<T>(1));
101		Result[0][0] = v[0];
102		Result[1][1] = v[1];
103		Result[2][2] = v[2];
104		return Result;
105	}
106
107	template <typename T, precision P>
108	GLM_FUNC_QUALIFIER tmat4x2<T, P> diagonal4x2
109	(
110		tvec2<T, P> const & v
111	)
112	{
113		tmat4x2<T, P> Result(static_cast<T>(1));
114		Result[0][0] = v[0];
115		Result[1][1] = v[1];
116		return Result;
117	}
118}//namespace glm
119