0.9.8: range.hpp Source File

| 0.9.8

- Main Page
- Modules
- Files

- File List

range.hpp
Go to the documentation of this file.
1
13 #pragma once
14
15 // Dependencies
16 #include "../detail/setup.hpp"
17
18 #if !GLM_HAS_RANGE_FOR
19 # error "GLM_GTX_range requires C++11 suppport or 'range for'"
20 #endif
21
22 #include "../gtc/type_ptr.hpp"
23 #include "../gtc/vec1.hpp"
24
25 namespace glm
26 {
29
30 template <typename T, precision P>
31 inline length_t components(tvec1<T, P> const & v)
32 {
33 return v.length();
34 }
35
36 template <typename T, precision P>
37 inline length_t components(tvec2<T, P> const & v)
38 {
39 return v.length();
40 }
41
42 template <typename T, precision P>
43 inline length_t components(tvec3<T, P> const & v)
44 {
45 return v.length();
46 }
47
48 template <typename T, precision P>
49 inline length_t components(tvec4<T, P> const & v)
50 {
51 return v.length();
52 }
53
54 template <typename genType>
55 inline length_t components(genType const & m)
56 {
57 return m.length() * m[0].length();
58 }
59
60 template <typename genType>
61 inline typename genType::value_type const * begin(genType const & v)
62 {
63 return value_ptr(v);
64 }
65
66 template <typename genType>
67 inline typename genType::value_type const * end(genType const & v)
68 {
69 return begin(v) + components(v);
70 }
71
72 template <typename genType>
73 inline typename genType::value_type * begin(genType& v)
74 {
75 return value_ptr(v);
76 }
77
78 template <typename genType>
79 inline typename genType::value_type * end(genType& v)
80 {
81 return begin(v) + components(v);
82 }
83
85 }//namespace glm
glm
Definition: _noise.hpp:11
glm::value_ptr
GLM_FUNC_DECL genType::value_type const * value_ptr(genType const &vec)
Return the constant address to the data of the input parameter.