master
ブランチ master
ShaderPlayground / deps / glm / glm / gtx / extended_min_max.hpp
5.5 KB、182行 生 Blame 履歴
1/// @ref gtx_extended_min_max
2/// @file glm/gtx/extended_min_max.hpp
3///
4/// @see core (dependence)
5///
6/// @defgroup gtx_extended_min_max GLM_GTX_extented_min_max
7/// @ingroup gtx
8///
9/// Include <glm/gtx/extented_min_max.hpp> to use the features of this extension.
10///
11/// Min and max functions for 3 to 4 parameters.
12
13#pragma once
14
15// Dependency:
16#include "../glm.hpp"
17
18#ifndef GLM_ENABLE_EXPERIMENTAL
19# error "GLM: GLM_GTX_extented_min_max 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#endif
21
22#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
23# pragma message("GLM: GLM_GTX_extented_min_max extension included")
24#endif
25
26namespace glm
27{
28 /// @addtogroup gtx_extended_min_max
29 /// @{
30
31 /// Return the minimum component-wise values of 3 inputs
32 /// @see gtx_extented_min_max
33 template<typename T>
34 GLM_FUNC_DECL T min(
35 T const& x,
36 T const& y,
37 T const& z);
38
39 /// Return the minimum component-wise values of 3 inputs
40 /// @see gtx_extented_min_max
41 template<typename T, template<typename> class C>
42 GLM_FUNC_DECL C<T> min(
43 C<T> const& x,
44 typename C<T>::T const& y,
45 typename C<T>::T const& z);
46
47 /// Return the minimum component-wise values of 3 inputs
48 /// @see gtx_extented_min_max
49 template<typename T, template<typename> class C>
50 GLM_FUNC_DECL C<T> min(
51 C<T> const& x,
52 C<T> const& y,
53 C<T> const& z);
54
55 /// Return the minimum component-wise values of 4 inputs
56 /// @see gtx_extented_min_max
57 template<typename T>
58 GLM_FUNC_DECL T min(
59 T const& x,
60 T const& y,
61 T const& z,
62 T const& w);
63
64 /// Return the minimum component-wise values of 4 inputs
65 /// @see gtx_extented_min_max
66 template<typename T, template<typename> class C>
67 GLM_FUNC_DECL C<T> min(
68 C<T> const& x,
69 typename C<T>::T const& y,
70 typename C<T>::T const& z,
71 typename C<T>::T const& w);
72
73 /// Return the minimum component-wise values of 4 inputs
74 /// @see gtx_extented_min_max
75 template<typename T, template<typename> class C>
76 GLM_FUNC_DECL C<T> min(
77 C<T> const& x,
78 C<T> const& y,
79 C<T> const& z,
80 C<T> const& w);
81
82 /// Return the maximum component-wise values of 3 inputs
83 /// @see gtx_extented_min_max
84 template<typename T>
85 GLM_FUNC_DECL T max(
86 T const& x,
87 T const& y,
88 T const& z);
89
90 /// Return the maximum component-wise values of 3 inputs
91 /// @see gtx_extented_min_max
92 template<typename T, template<typename> class C>
93 GLM_FUNC_DECL C<T> max(
94 C<T> const& x,
95 typename C<T>::T const& y,
96 typename C<T>::T const& z);
97
98 /// Return the maximum component-wise values of 3 inputs
99 /// @see gtx_extented_min_max
100 template<typename T, template<typename> class C>
101 GLM_FUNC_DECL C<T> max(
102 C<T> const& x,
103 C<T> const& y,
104 C<T> const& z);
105
106 /// Return the maximum component-wise values of 4 inputs
107 /// @see gtx_extented_min_max
108 template<typename T>
109 GLM_FUNC_DECL T max(
110 T const& x,
111 T const& y,
112 T const& z,
113 T const& w);
114
115 /// Return the maximum component-wise values of 4 inputs
116 /// @see gtx_extented_min_max
117 template<typename T, template<typename> class C>
118 GLM_FUNC_DECL C<T> max(
119 C<T> const& x,
120 typename C<T>::T const& y,
121 typename C<T>::T const& z,
122 typename C<T>::T const& w);
123
124 /// Return the maximum component-wise values of 4 inputs
125 /// @see gtx_extented_min_max
126 template<typename T, template<typename> class C>
127 GLM_FUNC_DECL C<T> max(
128 C<T> const& x,
129 C<T> const& y,
130 C<T> const& z,
131 C<T> const& w);
132
133 /// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.
134 ///
135 /// @tparam genType Floating-point or integer; scalar or vector types.
136 ///
137 /// @see gtx_extented_min_max
138 template<typename genType>
139 GLM_FUNC_DECL genType fmin(genType x, genType y);
140
141 /// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.
142 ///
143 /// @tparam genType Floating-point; scalar or vector types.
144 ///
145 /// @see gtx_extented_min_max
146 /// @see <a href="http://en.cppreference.com/w/cpp/numeric/math/fmax">std::fmax documentation</a>
147 template<typename genType>
148 GLM_FUNC_DECL genType fmax(genType x, genType y);
149
150 /// Returns min(max(x, minVal), maxVal) for each component in x. If one of the two arguments is NaN, the value of the other argument is returned.
151 ///
152 /// @tparam genType Floating-point scalar or vector types.
153 ///
154 /// @see gtx_extented_min_max
155 template<typename genType>
156 GLM_FUNC_DECL genType fclamp(genType x, genType minVal, genType maxVal);
157
158 /// Returns min(max(x, minVal), maxVal) for each component in x. If one of the two arguments is NaN, the value of the other argument is returned.
159 ///
160 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
161 /// @tparam T Floating-point scalar types
162 /// @tparam Q Value from qualifier enum
163 ///
164 /// @see gtx_extented_min_max
165 template<length_t L, typename T, qualifier Q>
166 GLM_FUNC_DECL vec<L, T, Q> fclamp(vec<L, T, Q> const& x, T minVal, T maxVal);
167
168 /// Returns min(max(x, minVal), maxVal) for each component in x. If one of the two arguments is NaN, the value of the other argument is returned.
169 ///
170 /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
171 /// @tparam T Floating-point scalar types
172 /// @tparam Q Value from qualifier enum
173 ///
174 /// @see gtx_extented_min_max
175 template<length_t L, typename T, qualifier Q>
176 GLM_FUNC_DECL vec<L, T, Q> fclamp(vec<L, T, Q> const& x, vec<L, T, Q> const& minVal, vec<L, T, Q> const& maxVal);
177
178
179 /// @}
180}//namespace glm
181
182#include "extended_min_max.inl"