Browse Source

More constexpr

Christophe Riccio 7 years ago
parent
commit
8f12f96787

+ 9 - 9
glm/common.hpp

@@ -173,7 +173,7 @@ namespace glm
 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min man page</a>
 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
 	template<typename genType>
-	GLM_FUNC_DECL genType min(genType x, genType y);
+	GLM_FUNC_DECL GLM_CONSTEXPR genType min(genType x, genType y);
 
 	/// Returns y if y < x; otherwise, it returns x.
 	///
@@ -184,7 +184,7 @@ namespace glm
 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min man page</a>
 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_DECL vec<L, T, Q> min(vec<L, T, Q> const& x, T y);
+	GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> min(vec<L, T, Q> const& x, T y);
 
 	/// Returns y if y < x; otherwise, it returns x.
 	///
@@ -195,7 +195,7 @@ namespace glm
 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min man page</a>
 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_DECL vec<L, T, Q> min(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
+	GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> min(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
 
 	/// Returns y if x < y; otherwise, it returns x.
 	///
@@ -204,7 +204,7 @@ namespace glm
 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max man page</a>
 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
 	template<typename genType>
-	GLM_FUNC_DECL genType max(genType x, genType y);
+	GLM_FUNC_DECL GLM_CONSTEXPR genType max(genType x, genType y);
 
 	/// Returns y if x < y; otherwise, it returns x.
 	///
@@ -215,7 +215,7 @@ namespace glm
 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max man page</a>
 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_DECL vec<L, T, Q> max(vec<L, T, Q> const& x, T y);
+	GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> max(vec<L, T, Q> const& x, T y);
 
 	/// Returns y if x < y; otherwise, it returns x.
 	///
@@ -226,7 +226,7 @@ namespace glm
 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max man page</a>
 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_DECL vec<L, T, Q> max(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
+	GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> max(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
 
 	/// Returns min(max(x, minVal), maxVal) for each component in x
 	/// using the floating-point values minVal and maxVal.
@@ -236,7 +236,7 @@ namespace glm
 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a>
 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
 	template<typename genType>
-	GLM_FUNC_DECL genType clamp(genType x, genType minVal, genType maxVal);
+	GLM_FUNC_DECL GLM_CONSTEXPR genType clamp(genType x, genType minVal, genType maxVal);
 
 	/// Returns min(max(x, minVal), maxVal) for each component in x
 	/// using the floating-point values minVal and maxVal.
@@ -248,7 +248,7 @@ namespace glm
 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a>
 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_DECL vec<L, T, Q> clamp(vec<L, T, Q> const& x, T minVal, T maxVal);
+	GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> clamp(vec<L, T, Q> const& x, T minVal, T maxVal);
 
 	/// Returns min(max(x, minVal), maxVal) for each component in x
 	/// using the floating-point values minVal and maxVal.
@@ -260,7 +260,7 @@ namespace glm
 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a>
 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_DECL vec<L, T, Q> clamp(vec<L, T, Q> const& x, vec<L, T, Q> const& minVal, vec<L, T, Q> const& maxVal);
+	GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> clamp(vec<L, T, Q> const& x, vec<L, T, Q> const& minVal, vec<L, T, Q> const& maxVal);
 
 	/// If genTypeU is a floating scalar or vector:
 	/// Returns x * (1.0 - a) + y * a, i.e., the linear blend of

+ 9 - 9
glm/detail/func_common.inl

@@ -13,7 +13,7 @@ namespace glm
 {
 	// min
 	template<typename genType>
-	GLM_FUNC_QUALIFIER genType min(genType x, genType y)
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType min(genType x, genType y)
 	{
 		GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'min' only accept floating-point or integer inputs");
 		return (y < x) ? y : x;
@@ -21,7 +21,7 @@ namespace glm
 
 	// max
 	template<typename genType>
-	GLM_FUNC_QUALIFIER genType max(genType x, genType y)
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType max(genType x, genType y)
 	{
 		GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'max' only accept floating-point or integer inputs");
 
@@ -472,49 +472,49 @@ namespace detail
 
 	// min
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<L, T, Q> min(vec<L, T, Q> const& a, T b)
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> min(vec<L, T, Q> const& a, T b)
 	{
 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'min' only accept floating-point or integer inputs");
 		return detail::compute_min_vector<L, T, Q, detail::is_aligned<Q>::value>::call(a, vec<L, T, Q>(b));
 	}
 
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<L, T, Q> min(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> min(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
 	{
 		return detail::compute_min_vector<L, T, Q, detail::is_aligned<Q>::value>::call(a, b);
 	}
 
 	// max
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<L, T, Q> max(vec<L, T, Q> const& a, T b)
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> max(vec<L, T, Q> const& a, T b)
 	{
 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'max' only accept floating-point or integer inputs");
 		return detail::compute_max_vector<L, T, Q, detail::is_aligned<Q>::value>::call(a, vec<L, T, Q>(b));
 	}
 
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<L, T, Q> max(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> max(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
 	{
 		return detail::compute_max_vector<L, T, Q, detail::is_aligned<Q>::value>::call(a, b);
 	}
 
 	// clamp
 	template<typename genType>
-	GLM_FUNC_QUALIFIER genType clamp(genType x, genType minVal, genType maxVal)
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType clamp(genType x, genType minVal, genType maxVal)
 	{
 		GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'clamp' only accept floating-point or integer inputs");
 		return min(max(x, minVal), maxVal);
 	}
 
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<L, T, Q> clamp(vec<L, T, Q> const& x, T minVal, T maxVal)
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> clamp(vec<L, T, Q> const& x, T minVal, T maxVal)
 	{
 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'clamp' only accept floating-point or integer inputs");
 		return detail::compute_clamp_vector<L, T, Q, detail::is_aligned<Q>::value>::call(x, vec<L, T, Q>(minVal), vec<L, T, Q>(maxVal));
 	}
 
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<L, T, Q> clamp(vec<L, T, Q> const& x, vec<L, T, Q> const& minVal, vec<L, T, Q> const& maxVal)
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> clamp(vec<L, T, Q> const& x, vec<L, T, Q> const& minVal, vec<L, T, Q> const& maxVal)
 	{
 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'clamp' only accept floating-point or integer inputs");
 		return detail::compute_clamp_vector<L, T, Q, detail::is_aligned<Q>::value>::call(x, minVal, maxVal);

+ 0 - 2
glm/detail/type_mat2x2.inl

@@ -1,5 +1,3 @@
-/// @ref core
-
 #include "../matrix.hpp"
 
 namespace glm

+ 0 - 2
glm/detail/type_mat2x3.inl

@@ -1,5 +1,3 @@
-/// @ref core
-
 namespace glm
 {
 	// -- Constructors --

+ 0 - 2
glm/detail/type_mat2x4.inl

@@ -1,5 +1,3 @@
-/// @ref core
-
 namespace glm
 {
 	// -- Constructors --

+ 0 - 2
glm/detail/type_mat3x2.inl

@@ -1,5 +1,3 @@
-/// @ref core
-
 namespace glm
 {
 	// -- Constructors --

+ 0 - 2
glm/detail/type_mat3x3.inl

@@ -1,5 +1,3 @@
-/// @ref core
-
 #include "../matrix.hpp"
 
 namespace glm

+ 0 - 2
glm/detail/type_mat3x4.inl

@@ -1,5 +1,3 @@
-/// @ref core
-
 namespace glm
 {
 	// -- Constructors --

+ 0 - 2
glm/detail/type_mat4x2.inl

@@ -1,5 +1,3 @@
-/// @ref core
-
 namespace glm
 {
 	// -- Constructors --

+ 0 - 2
glm/detail/type_mat4x3.inl

@@ -1,5 +1,3 @@
-/// @ref core
-
 namespace glm
 {
 	// -- Constructors --

+ 0 - 2
glm/detail/type_mat4x4.inl

@@ -1,5 +1,3 @@
-/// @ref core
-
 #include "../matrix.hpp"
 
 namespace glm

+ 4 - 4
glm/ext/vector_common.hpp

@@ -33,7 +33,7 @@ namespace glm
 	///
 	/// @see ext_vector_common
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_DECL vec<L, T, Q> min(vec<L, T, Q> const& a, vec<L, T, Q> const& b, vec<L, T, Q> const& c);
+	GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> min(vec<L, T, Q> const& a, vec<L, T, Q> const& b, vec<L, T, Q> const& c);
 
 	/// Return the minimum component-wise values of 4 inputs
 	///
@@ -43,7 +43,7 @@ namespace glm
 	///
 	/// @see ext_vector_common
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_DECL vec<L, T, Q> min(vec<L, T, Q> const& a, vec<L, T, Q> const& b, vec<L, T, Q> const& c, vec<L, T, Q> const& d);
+	GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> min(vec<L, T, Q> const& a, vec<L, T, Q> const& b, vec<L, T, Q> const& c, vec<L, T, Q> const& d);
 
 	/// Return the maximum component-wise values of 3 inputs
 	///
@@ -53,7 +53,7 @@ namespace glm
 	///
 	/// @see ext_vector_common
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_DECL vec<L, T, Q> max(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& z);
+	GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> max(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& z);
 
 	/// Return the maximum component-wise values of 4 inputs
 	///
@@ -63,7 +63,7 @@ namespace glm
 	///
 	/// @see ext_vector_common
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_DECL vec<L, T, Q> max( vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& z, vec<L, T, Q> const& w);
+	GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> max( vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& z, vec<L, T, Q> const& w);
 
 	/// 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.
 	///

+ 4 - 4
glm/ext/vector_common.inl

@@ -3,28 +3,28 @@
 namespace glm
 {
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<L, T, Q> min(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& z)
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> min(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& z)
 	{
 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'min' only accept floating-point or integer inputs");
 		return glm::min(glm::min(x, y), z);
 	}
 
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<L, T, Q> min(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& z, vec<L, T, Q> const& w)
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> min(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& z, vec<L, T, Q> const& w)
 	{
 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'min' only accept floating-point or integer inputs");
 		return glm::min(glm::min(x, y), glm::min(z, w));
 	}
 
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<L, T, Q> max(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& z)
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> max(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& z)
 	{
 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'max' only accept floating-point or integer inputs");
 		return glm::max(glm::max(x, y), z);
 	}
 
 	template<length_t L, typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER vec<L, T, Q> max(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& z, vec<L, T, Q> const& w)
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> max(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& z, vec<L, T, Q> const& w)
 	{
 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'max' only accept floating-point or integer inputs");
 		return glm::max(glm::max(x, y), glm::max(z, w));

+ 0 - 3
glm/ext/vector_relational.inl

@@ -1,6 +1,3 @@
-/// @ref ext_vector_relational
-
-// Dependency:
 #include "../vector_relational.hpp"
 #include "../common.hpp"
 #include "../detail/qualifier.hpp"

+ 27 - 4
manual.md

@@ -30,10 +30,33 @@
 + [2.15. GLM\_FORCE\_DEFAULT\_ALIGNED_GENTYPES: Force GLM to use aligned types by default](#section2_15)
 + [2.16. GLM_\FORCE\_PLATFORM\_UNKNOWN: Force GLM to no detect the build platform](#section2_16)
 + [3. Stable extensions](#section3)
-+ [3.1. GLM_EXT_matrix_relational](#section3_1)
-+ [3.2. GLM_EXT_scalar_relational](#section3_2)
-+ [3.3. GLM_EXT_vec1](#section3_3)
-+ [3.4. GLM_EXT_vector_relational](#section3_4)
++ [3.1. GLM_EXT_matrix_clip_space](#section3_1)
++ [3.2. GLM_EXT_matrix_doubleMxN(_precision)](#section3_2)
++ [3.3. GLM_EXT_matrix_floatMxN(_precision)](#section3_3)
++ [3.4. GLM_EXT_matrix_projection](#section3_4)
++ [3.5. GLM_EXT_matrix_relational](#section3_5)
++ [3.6. GLM_EXT_matrix_transform](#section3_6)
++ [3.7. GLM_EXT_quaternion_common](#section3_7)
++ [3.8. GLM_EXT_quaternion_double(_precision)](#section3_8)
++ [3.9. GLM_EXT_quaternion_exponential](#section3_9)
++ [3.10. GLM_EXT_quaternion_float(_precision)](#section3_10)
++ [3.11. GLM_EXT_quaternion_geometric](#section3_11)
++ [3.12. GLM_EXT_quaternion_relation](#section3_12)
++ [3.13. GLM_EXT_quaternion_transform](#section3_13)
++ [3.14. GLM_EXT_quaternion_trigonometric](#section3_14)
++ [3.15. GLM_EXT_scalar_common](#section3_15)
++ [3.16. GLM_EXT_scalar_constants](#section3_16)
++ [3.17. GLM_EXT_scalar_float_sized](#section3_17)
++ [3.18. GLM_EXT_scalar_int_sized](#section3_18)
++ [3.19. GLM_EXT_scalar_relational](#section3_19)
++ [3.20. GLM_EXT_scalar_uint_sized](#section3_20)
++ [3.21. GLM_EXT_vector_boolX(_precision)](#section3_21)
++ [3.22. GLM_EXT_vector_common](#section3_22)
++ [3.23. GLM_EXT_vector_doubleX(_precision)](#section3_23)
++ [3.24. GLM_EXT_vector_floatX(_precision)](#section3_24)
++ [3.25. GLM_EXT_vector_intX(_precision)](#section3_25)
++ [3.26. GLM_EXT_vector_relational](#section3_26)
++ [3.27. GLM_EXT_vector_uintX](#section3_27)
 + [4. Recommended extensions](#section4)
 + [4.1. GLM_GTC_bitfield](#section4_1)
 + [4.2. GLM_GTC_color_space](#section4_2)