1.0.0 API documentation: range.hpp Source File

| 1.0.0 API documentation

range.hpp
Go to the documentation of this file.
1
13 #pragma once
14
15 // Dependencies
16 #include "../detail/setup.hpp"
17
18 #ifndef GLM_ENABLE_EXPERIMENTAL
19 # error "GLM: GLM_GTX_range 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."
20 #elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
21 # pragma message("GLM: GLM_GTX_range extension included")
22 #endif
23
24 #include "../gtc/type_ptr.hpp"
25 #include "../gtc/vec1.hpp"
26
27 namespace glm
28 {
31
32 # if GLM_COMPILER & GLM_COMPILER_VC
33 # pragma warning(push)
34 # pragma warning(disable : 4100) // unreferenced formal parameter
35 # endif
36
37 template<typename T, qualifier Q>
38 inline length_t components(vec<1, T, Q> const& v)
39 {
40 return v.length();
41 }
42
43 template<typename T, qualifier Q>
44 inline length_t components(vec<2, T, Q> const& v)
45 {
46 return v.length();
47 }
48
49 template<typename T, qualifier Q>
50 inline length_t components(vec<3, T, Q> const& v)
51 {
52 return v.length();
53 }
54
55 template<typename T, qualifier Q>
56 inline length_t components(vec<4, T, Q> const& v)
57 {
58 return v.length();
59 }
60
61 template<typename genType>
62 inline length_t components(genType const& m)
63 {
64 return m.length() * m[0].length();
65 }
66
67 template<typename genType>
68 inline typename genType::value_type const * begin(genType const& v)
69 {
70 return value_ptr(v);
71 }
72
73 template<typename genType>
74 inline typename genType::value_type const * end(genType const& v)
75 {
76 return begin(v) + components(v);
77 }
78
79 template<typename genType>
80 inline typename genType::value_type * begin(genType& v)
81 {
82 return value_ptr(v);
83 }
84
85 template<typename genType>
86 inline typename genType::value_type * end(genType& v)
87 {
88 return begin(v) + components(v);
89 }
90
91 # if GLM_COMPILER & GLM_COMPILER_VC
92 # pragma warning(pop)
93 # endif
94
96 }//namespace glm
glm::value_ptr
GLM_FUNC_DECL genType::value_type const * value_ptr(genType const &v)
Return the constant address to the data of the input parameter.