master
ブランチ master
VulkanExample / dep / include / glm / gtc / round.hpp
5.3 KB、160行 生 Blame 履歴
1/// @ref gtc_round
2/// @file glm/gtc/round.hpp
3///
4/// @see core (dependence)
5/// @see gtc_round (dependence)
6///
7/// @defgroup gtc_round GLM_GTC_round
8/// @ingroup gtc
9///
10/// Include <glm/gtc/round.hpp> to use the features of this extension.
11///
12/// Rounding value to specific boundings
13
14#pragma once
15
16// Dependencies
17#include "../detail/setup.hpp"
18#include "../detail/qualifier.hpp"
19#include "../detail/_vectorize.hpp"
20#include "../vector_relational.hpp"
21#include "../common.hpp"
22#include <limits>
23
24#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
25# pragma message("GLM: GLM_GTC_round extension included")
26#endif
27
28namespace glm
29{
30 /// @addtogroup gtc_round
31 /// @{
32
33 /// Return the power of two number which value is just higher the input value,
34 /// round up to a power of two.
35 ///
36 /// @see gtc_round
37 template<typename genIUType>
38 GLM_FUNC_DECL genIUType ceilPowerOfTwo(genIUType v);
39
40 /// Return the power of two number which value is just higher the input value,
41 /// round up to a power of two.
42 ///
43 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
44 /// @tparam T Floating-point or integer scalar types
45 /// @tparam Q Value from qualifier enum
46 ///
47 /// @see gtc_round
48 template<length_t L, typename T, qualifier Q>
49 GLM_FUNC_DECL vec<L, T, Q> ceilPowerOfTwo(vec<L, T, Q> const& v);
50
51 /// Return the power of two number which value is just lower the input value,
52 /// round down to a power of two.
53 ///
54 /// @see gtc_round
55 template<typename genIUType>
56 GLM_FUNC_DECL genIUType floorPowerOfTwo(genIUType v);
57
58 /// Return the power of two number which value is just lower the input value,
59 /// round down to a power of two.
60 ///
61 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
62 /// @tparam T Floating-point or integer scalar types
63 /// @tparam Q Value from qualifier enum
64 ///
65 /// @see gtc_round
66 template<length_t L, typename T, qualifier Q>
67 GLM_FUNC_DECL vec<L, T, Q> floorPowerOfTwo(vec<L, T, Q> const& v);
68
69 /// Return the power of two number which value is the closet to the input value.
70 ///
71 /// @see gtc_round
72 template<typename genIUType>
73 GLM_FUNC_DECL genIUType roundPowerOfTwo(genIUType v);
74
75 /// Return the power of two number which value is the closet to the input value.
76 ///
77 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
78 /// @tparam T Floating-point or integer scalar types
79 /// @tparam Q Value from qualifier enum
80 ///
81 /// @see gtc_round
82 template<length_t L, typename T, qualifier Q>
83 GLM_FUNC_DECL vec<L, T, Q> roundPowerOfTwo(vec<L, T, Q> const& v);
84
85 /// Higher multiple number of Source.
86 ///
87 /// @tparam genType Floating-point or integer scalar or vector types.
88 ///
89 /// @param v Source value to which is applied the function
90 /// @param Multiple Must be a null or positive value
91 ///
92 /// @see gtc_round
93 template<typename genType>
94 GLM_FUNC_DECL genType ceilMultiple(genType v, genType Multiple);
95
96 /// Higher multiple number of Source.
97 ///
98 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
99 /// @tparam T Floating-point or integer scalar types
100 /// @tparam Q Value from qualifier enum
101 ///
102 /// @param v Source values to which is applied the function
103 /// @param Multiple Must be a null or positive value
104 ///
105 /// @see gtc_round
106 template<length_t L, typename T, qualifier Q>
107 GLM_FUNC_DECL vec<L, T, Q> ceilMultiple(vec<L, T, Q> const& v, vec<L, T, Q> const& Multiple);
108
109 /// Lower multiple number of Source.
110 ///
111 /// @tparam genType Floating-point or integer scalar or vector types.
112 ///
113 /// @param v Source value to which is applied the function
114 /// @param Multiple Must be a null or positive value
115 ///
116 /// @see gtc_round
117 template<typename genType>
118 GLM_FUNC_DECL genType floorMultiple(genType v, genType Multiple);
119
120 /// Lower multiple number of Source.
121 ///
122 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
123 /// @tparam T Floating-point or integer scalar types
124 /// @tparam Q Value from qualifier enum
125 ///
126 /// @param v Source values to which is applied the function
127 /// @param Multiple Must be a null or positive value
128 ///
129 /// @see gtc_round
130 template<length_t L, typename T, qualifier Q>
131 GLM_FUNC_DECL vec<L, T, Q> floorMultiple(vec<L, T, Q> const& v, vec<L, T, Q> const& Multiple);
132
133 /// Lower multiple number of Source.
134 ///
135 /// @tparam genType Floating-point or integer scalar or vector types.
136 ///
137 /// @param v Source value to which is applied the function
138 /// @param Multiple Must be a null or positive value
139 ///
140 /// @see gtc_round
141 template<typename genType>
142 GLM_FUNC_DECL genType roundMultiple(genType v, genType Multiple);
143
144 /// Lower multiple number of Source.
145 ///
146 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
147 /// @tparam T Floating-point or integer scalar types
148 /// @tparam Q Value from qualifier enum
149 ///
150 /// @param v Source values to which is applied the function
151 /// @param Multiple Must be a null or positive value
152 ///
153 /// @see gtc_round
154 template<length_t L, typename T, qualifier Q>
155 GLM_FUNC_DECL vec<L, T, Q> roundMultiple(vec<L, T, Q> const& v, vec<L, T, Q> const& Multiple);
156
157 /// @}
158} //namespace glm
159
160#include "round.inl"