0.9.9 API documenation
type_trait.hpp
Go to the documentation of this file.
1 
13 #pragma once
14 
15 #ifndef GLM_ENABLE_EXPERIMENTAL
16 # error "GLM: GLM_GTX_type_trait is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."
17 #endif
18 
19 // Dependency:
20 #include "../detail/type_vec2.hpp"
21 #include "../detail/type_vec3.hpp"
22 #include "../detail/type_vec4.hpp"
23 #include "../detail/type_mat2x2.hpp"
24 #include "../detail/type_mat2x3.hpp"
25 #include "../detail/type_mat2x4.hpp"
26 #include "../detail/type_mat3x2.hpp"
27 #include "../detail/type_mat3x3.hpp"
28 #include "../detail/type_mat3x4.hpp"
29 #include "../detail/type_mat4x2.hpp"
30 #include "../detail/type_mat4x3.hpp"
31 #include "../detail/type_mat4x4.hpp"
32 #include "../gtc/quaternion.hpp"
33 #include "../gtx/dual_quaternion.hpp"
34 
35 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
36 # pragma message("GLM: GLM_GTX_type_trait extension included")
37 #endif
38 
39 namespace glm
40 {
43 
44  template<typename T>
45  struct type
46  {
47  static bool const is_vec = false;
48  static bool const is_mat = false;
49  static bool const is_quat = false;
50  static length_t const components = 0;
51  static length_t const cols = 0;
52  static length_t const rows = 0;
53  };
54 
55  template<length_t L, typename T, qualifier Q>
56  struct type<vec<L, T, Q> >
57  {
58  static bool const is_vec = true;
59  static bool const is_mat = false;
60  static bool const is_quat = false;
61  enum
62  {
63  components = L
64  };
65  };
66 
67  template<typename T, qualifier Q>
68  struct type<mat<2, 2, T, Q> >
69  {
70  static bool const is_vec = false;
71  static bool const is_mat = true;
72  static bool const is_quat = false;
73  enum
74  {
75  components = 2,
76  cols = 2,
77  rows = 2
78  };
79  };
80 
81  template<typename T, qualifier Q>
82  struct type<mat<2, 3, T, Q> >
83  {
84  static bool const is_vec = false;
85  static bool const is_mat = true;
86  static bool const is_quat = false;
87  enum
88  {
89  components = 2,
90  cols = 2,
91  rows = 3
92  };
93  };
94 
95  template<typename T, qualifier Q>
96  struct type<mat<2, 4, T, Q> >
97  {
98  static bool const is_vec = false;
99  static bool const is_mat = true;
100  static bool const is_quat = false;
101  enum
102  {
103  components = 2,
104  cols = 2,
105  rows = 4
106  };
107  };
108 
109  template<typename T, qualifier Q>
110  struct type<mat<3, 2, T, Q> >
111  {
112  static bool const is_vec = false;
113  static bool const is_mat = true;
114  static bool const is_quat = false;
115  enum
116  {
117  components = 3,
118  cols = 3,
119  rows = 2
120  };
121  };
122 
123  template<typename T, qualifier Q>
124  struct type<mat<3, 3, T, Q> >
125  {
126  static bool const is_vec = false;
127  static bool const is_mat = true;
128  static bool const is_quat = false;
129  enum
130  {
131  components = 3,
132  cols = 3,
133  rows = 3
134  };
135  };
136 
137  template<typename T, qualifier Q>
138  struct type<mat<3, 4, T, Q> >
139  {
140  static bool const is_vec = false;
141  static bool const is_mat = true;
142  static bool const is_quat = false;
143  enum
144  {
145  components = 3,
146  cols = 3,
147  rows = 4
148  };
149  };
150 
151  template<typename T, qualifier Q>
152  struct type<mat<4, 2, T, Q> >
153  {
154  static bool const is_vec = false;
155  static bool const is_mat = true;
156  static bool const is_quat = false;
157  enum
158  {
159  components = 4,
160  cols = 4,
161  rows = 2
162  };
163  };
164 
165  template<typename T, qualifier Q>
166  struct type<mat<4, 3, T, Q> >
167  {
168  static bool const is_vec = false;
169  static bool const is_mat = true;
170  static bool const is_quat = false;
171  enum
172  {
173  components = 4,
174  cols = 4,
175  rows = 3
176  };
177  };
178 
179  template<typename T, qualifier Q>
180  struct type<mat<4, 4, T, Q> >
181  {
182  static bool const is_vec = false;
183  static bool const is_mat = true;
184  static bool const is_quat = false;
185  enum
186  {
187  components = 4,
188  cols = 4,
189  rows = 4
190  };
191  };
192 
193  template<typename T, qualifier Q>
194  struct type<tquat<T, Q> >
195  {
196  static bool const is_vec = false;
197  static bool const is_mat = false;
198  static bool const is_quat = true;
199  enum
200  {
201  components = 4
202  };
203  };
204 
205  template<typename T, qualifier Q>
206  struct type<tdualquat<T, Q> >
207  {
208  static bool const is_vec = false;
209  static bool const is_mat = false;
210  static bool const is_quat = true;
211  enum
212  {
213  components = 8
214  };
215  };
216 
218 }//namespace glm
219 
220 #include "type_trait.inl"
Definition: common.hpp:20