diff --git a/includes/glm/CMakeLists.txt b/includes/glm/CMakeLists.txt
new file mode 100644
index 0000000..01c594f
--- /dev/null
+++ b/includes/glm/CMakeLists.txt
@@ -0,0 +1,62 @@
+file(GLOB ROOT_SOURCE *.cpp)
+file(GLOB ROOT_INLINE *.inl)
+file(GLOB ROOT_HEADER *.hpp)
+file(GLOB ROOT_TEXT ../*.txt)
+file(GLOB ROOT_MD ../*.md)
+file(GLOB ROOT_NAT ../util/glm.natvis)
+
+file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp)
+file(GLOB_RECURSE CORE_INLINE ./detail/*.inl)
+file(GLOB_RECURSE CORE_HEADER ./detail/*.hpp)
+
+file(GLOB_RECURSE EXT_SOURCE ./ext/*.cpp)
+file(GLOB_RECURSE EXT_INLINE ./ext/*.inl)
+file(GLOB_RECURSE EXT_HEADER ./ext/*.hpp)
+
+file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp)
+file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl)
+file(GLOB_RECURSE GTC_HEADER ./gtc/*.hpp)
+
+file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp)
+file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl)
+file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp)
+
+file(GLOB_RECURSE SIMD_SOURCE ./simd/*.cpp)
+file(GLOB_RECURSE SIMD_INLINE ./simd/*.inl)
+file(GLOB_RECURSE SIMD_HEADER ./simd/*.h)
+
+source_group("Text Files" FILES ${ROOT_TEXT} ${ROOT_MD})
+source_group("Core Files" FILES ${CORE_SOURCE})
+source_group("Core Files" FILES ${CORE_INLINE})
+source_group("Core Files" FILES ${CORE_HEADER})
+source_group("EXT Files" FILES ${EXT_SOURCE})
+source_group("EXT Files" FILES ${EXT_INLINE})
+source_group("EXT Files" FILES ${EXT_HEADER})
+source_group("GTC Files" FILES ${GTC_SOURCE})
+source_group("GTC Files" FILES ${GTC_INLINE})
+source_group("GTC Files" FILES ${GTC_HEADER})
+source_group("GTX Files" FILES ${GTX_SOURCE})
+source_group("GTX Files" FILES ${GTX_INLINE})
+source_group("GTX Files" FILES ${GTX_HEADER})
+source_group("SIMD Files" FILES ${SIMD_SOURCE})
+source_group("SIMD Files" FILES ${SIMD_INLINE})
+source_group("SIMD Files" FILES ${SIMD_HEADER})
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
+
+add_library(glm_static STATIC ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
+ ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
+ ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
+ ${EXT_SOURCE} ${EXT_INLINE} ${EXT_HEADER}
+ ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
+ ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
+ ${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
+
+add_library(glm_shared SHARED ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
+ ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
+ ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
+ ${EXT_SOURCE} ${EXT_INLINE} ${EXT_HEADER}
+ ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
+ ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
+ ${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
+
diff --git a/includes/glm/common.hpp b/includes/glm/common.hpp
index b2ff9da..25e7a37 100644
--- a/includes/glm/common.hpp
+++ b/includes/glm/common.hpp
@@ -1,35 +1,533 @@
-///////////////////////////////////////////////////////////////////////////////////
-/// OpenGL Mathematics (glm.g-truc.net)
-///
-/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
-/// Permission is hereby granted, free of charge, to any person obtaining a copy
-/// of this software and associated documentation files (the "Software"), to deal
-/// in the Software without restriction, including without limitation the rights
-/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-/// copies of the Software, and to permit persons to whom the Software is
-/// furnished to do so, subject to the following conditions:
-///
-/// The above copyright notice and this permission notice shall be included in
-/// all copies or substantial portions of the Software.
-///
-/// Restrictions:
-/// By making use of the Software for military purposes, you choose to make
-/// a Bunny unhappy.
-///
-/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-/// THE SOFTWARE.
-///
/// @ref core
/// @file glm/common.hpp
-/// @date 2013-12-24 / 2013-12-24
-/// @author Christophe Riccio
-///////////////////////////////////////////////////////////////////////////////////
+///
+/// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+///
+/// @defgroup core_func_common Common functions
+/// @ingroup core
+///
+/// Provides GLSL common functions
+///
+/// These all operate component-wise. The description is per component.
+///
+/// Include to use these core features.
#pragma once
-#include "detail/func_common.hpp"
+#include "detail/qualifier.hpp"
+#include "detail/_fixes.hpp"
+
+namespace glm
+{
+ /// @addtogroup core_func_common
+ /// @{
+
+ /// Returns x if x >= 0; otherwise, it returns -x.
+ ///
+ /// @tparam genType floating-point or signed integer; scalar or vector types.
+ ///
+ /// @see GLSL abs man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL GLM_CONSTEXPR genType abs(genType x);
+
+ /// Returns x if x >= 0; otherwise, it returns -x.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or signed integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL abs man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL GLM_CONSTEXPR vec abs(vec const& x);
+
+ /// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL sign man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL vec sign(vec const& x);
+
+ /// Returns a value equal to the nearest integer that is less then or equal to x.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL floor man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL vec floor(vec const& x);
+
+ /// Returns a value equal to the nearest integer to x
+ /// whose absolute value is not larger than the absolute value of x.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL trunc man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL vec trunc(vec const& x);
+
+ /// Returns a value equal to the nearest integer to x.
+ /// The fraction 0.5 will round in a direction chosen by the
+ /// implementation, presumably the direction that is fastest.
+ /// This includes the possibility that round(x) returns the
+ /// same value as roundEven(x) for all values of x.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL round man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL vec round(vec const& x);
+
+ /// Returns a value equal to the nearest integer to x.
+ /// A fractional part of 0.5 will round toward the nearest even
+ /// integer. (Both 3.5 and 4.5 for x will return 4.0.)
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL roundEven man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ /// @see New round to even technique
+ template
+ GLM_FUNC_DECL vec roundEven(vec const& x);
+
+ /// Returns a value equal to the nearest integer
+ /// that is greater than or equal to x.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL ceil man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL vec ceil(vec const& x);
+
+ /// Return x - floor(x).
+ ///
+ /// @tparam genType Floating-point scalar or vector types.
+ ///
+ /// @see GLSL fract man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL genType fract(genType x);
+
+ /// Return x - floor(x).
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL fract man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL vec fract(vec const& x);
+
+ template
+ GLM_FUNC_DECL genType mod(genType x, genType y);
+
+ template
+ GLM_FUNC_DECL vec mod(vec const& x, T y);
+
+ /// Modulus. Returns x - y * floor(x / y)
+ /// for each component in x using the floating point value y.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point scalar types, include glm/gtc/integer for integer scalar types support
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL mod man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL vec mod(vec const& x, vec const& y);
+
+ /// Returns the fractional part of x and sets i to the integer
+ /// part (as a whole number floating point value). Both the
+ /// return value and the output parameter will have the same
+ /// sign as x.
+ ///
+ /// @tparam genType Floating-point scalar or vector types.
+ ///
+ /// @see GLSL modf man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL genType modf(genType x, genType& i);
+
+ /// Returns y if y < x; otherwise, it returns x.
+ ///
+ /// @tparam genType Floating-point or integer; scalar or vector types.
+ ///
+ /// @see GLSL min man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL GLM_CONSTEXPR genType min(genType x, genType y);
+
+ /// Returns y if y < x; otherwise, it returns x.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL min man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL GLM_CONSTEXPR vec min(vec const& x, T y);
+
+ /// Returns y if y < x; otherwise, it returns x.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL min man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL GLM_CONSTEXPR vec min(vec const& x, vec const& y);
+
+ /// Returns y if x < y; otherwise, it returns x.
+ ///
+ /// @tparam genType Floating-point or integer; scalar or vector types.
+ ///
+ /// @see GLSL max man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL GLM_CONSTEXPR genType max(genType x, genType y);
+
+ /// Returns y if x < y; otherwise, it returns x.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL max man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL GLM_CONSTEXPR vec max(vec const& x, T y);
+
+ /// Returns y if x < y; otherwise, it returns x.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL max man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL GLM_CONSTEXPR vec max(vec const& x, vec const& y);
+
+ /// Returns min(max(x, minVal), maxVal) for each component in x
+ /// using the floating-point values minVal and maxVal.
+ ///
+ /// @tparam genType Floating-point or integer; scalar or vector types.
+ ///
+ /// @see GLSL clamp man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ 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.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL clamp man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL GLM_CONSTEXPR vec clamp(vec 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.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL clamp man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL GLM_CONSTEXPR vec clamp(vec const& x, vec const& minVal, vec const& maxVal);
+
+ /// If genTypeU is a floating scalar or vector:
+ /// Returns x * (1.0 - a) + y * a, i.e., the linear blend of
+ /// x and y using the floating-point value a.
+ /// The value for a is not restricted to the range [0, 1].
+ ///
+ /// If genTypeU is a boolean scalar or vector:
+ /// Selects which vector each returned component comes
+ /// from. For a component of 'a' that is false, the
+ /// corresponding component of 'x' is returned. For a
+ /// component of 'a' that is true, the corresponding
+ /// component of 'y' is returned. Components of 'x' and 'y' that
+ /// are not selected are allowed to be invalid floating point
+ /// values and will have no effect on the results. Thus, this
+ /// provides different functionality than
+ /// genType mix(genType x, genType y, genType(a))
+ /// where a is a Boolean vector.
+ ///
+ /// @see GLSL mix man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ ///
+ /// @param[in] x Value to interpolate.
+ /// @param[in] y Value to interpolate.
+ /// @param[in] a Interpolant.
+ ///
+ /// @tparam genTypeT Floating point scalar or vector.
+ /// @tparam genTypeU Floating point or boolean scalar or vector. It can't be a vector if it is the length of genTypeT.
+ ///
+ /// @code
+ /// #include
+ /// ...
+ /// float a;
+ /// bool b;
+ /// glm::dvec3 e;
+ /// glm::dvec3 f;
+ /// glm::vec4 g;
+ /// glm::vec4 h;
+ /// ...
+ /// glm::vec4 r = glm::mix(g, h, a); // Interpolate with a floating-point scalar two vectors.
+ /// glm::vec4 s = glm::mix(g, h, b); // Returns g or h;
+ /// glm::dvec3 t = glm::mix(e, f, a); // Types of the third parameter is not required to match with the first and the second.
+ /// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter.
+ /// @endcode
+ template
+ GLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a);
+
+ template
+ GLM_FUNC_DECL vec mix(vec const& x, vec const& y, vec const& a);
+
+ template
+ GLM_FUNC_DECL vec mix(vec const& x, vec const& y, U a);
+
+ /// Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType.
+ ///
+ /// @see GLSL step man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL genType step(genType edge, genType x);
+
+ /// Returns 0.0 if x < edge, otherwise it returns 1.0.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL step man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL vec step(T edge, vec const& x);
+
+ /// Returns 0.0 if x < edge, otherwise it returns 1.0.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL step man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL vec step(vec const& edge, vec const& x);
+
+ /// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and
+ /// performs smooth Hermite interpolation between 0 and 1
+ /// when edge0 < x < edge1. This is useful in cases where
+ /// you would want a threshold function with a smooth
+ /// transition. This is equivalent to:
+ /// genType t;
+ /// t = clamp ((x - edge0) / (edge1 - edge0), 0, 1);
+ /// return t * t * (3 - 2 * t);
+ /// Results are undefined if edge0 >= edge1.
+ ///
+ /// @tparam genType Floating-point scalar or vector types.
+ ///
+ /// @see GLSL smoothstep man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL genType smoothstep(genType edge0, genType edge1, genType x);
+
+ template
+ GLM_FUNC_DECL vec smoothstep(T edge0, T edge1, vec const& x);
+
+ template
+ GLM_FUNC_DECL vec smoothstep(vec const& edge0, vec const& edge1, vec const& x);
+
+ /// Returns true if x holds a NaN (not a number)
+ /// representation in the underlying implementation's set of
+ /// floating point representations. Returns false otherwise,
+ /// including for implementations with no NaN
+ /// representations.
+ ///
+ /// /!\ When using compiler fast math, this function may fail.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL isnan man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL vec isnan(vec const& x);
+
+ /// Returns true if x holds a positive infinity or negative
+ /// infinity representation in the underlying implementation's
+ /// set of floating point representations. Returns false
+ /// otherwise, including for implementations with no infinity
+ /// representations.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL isinf man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL vec isinf(vec const& x);
+
+ /// Returns a signed integer value representing
+ /// the encoding of a floating-point value. The floating-point
+ /// value's bit-level representation is preserved.
+ ///
+ /// @see GLSL floatBitsToInt man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ GLM_FUNC_DECL int floatBitsToInt(float const& v);
+
+ /// Returns a signed integer value representing
+ /// the encoding of a floating-point value. The floatingpoint
+ /// value's bit-level representation is preserved.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL floatBitsToInt man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL vec floatBitsToInt(vec const& v);
+
+ /// Returns a unsigned integer value representing
+ /// the encoding of a floating-point value. The floatingpoint
+ /// value's bit-level representation is preserved.
+ ///
+ /// @see GLSL floatBitsToUint man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ GLM_FUNC_DECL uint floatBitsToUint(float const& v);
+
+ /// Returns a unsigned integer value representing
+ /// the encoding of a floating-point value. The floatingpoint
+ /// value's bit-level representation is preserved.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL floatBitsToUint man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL vec floatBitsToUint(vec const& v);
+
+ /// Returns a floating-point value corresponding to a signed
+ /// integer encoding of a floating-point value.
+ /// If an inf or NaN is passed in, it will not signal, and the
+ /// resulting floating point value is unspecified. Otherwise,
+ /// the bit-level representation is preserved.
+ ///
+ /// @see GLSL intBitsToFloat man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ GLM_FUNC_DECL float intBitsToFloat(int const& v);
+
+ /// Returns a floating-point value corresponding to a signed
+ /// integer encoding of a floating-point value.
+ /// If an inf or NaN is passed in, it will not signal, and the
+ /// resulting floating point value is unspecified. Otherwise,
+ /// the bit-level representation is preserved.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL intBitsToFloat man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL vec intBitsToFloat(vec const& v);
+
+ /// Returns a floating-point value corresponding to a
+ /// unsigned integer encoding of a floating-point value.
+ /// If an inf or NaN is passed in, it will not signal, and the
+ /// resulting floating point value is unspecified. Otherwise,
+ /// the bit-level representation is preserved.
+ ///
+ /// @see GLSL uintBitsToFloat man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ GLM_FUNC_DECL float uintBitsToFloat(uint const& v);
+
+ /// Returns a floating-point value corresponding to a
+ /// unsigned integer encoding of a floating-point value.
+ /// If an inf or NaN is passed in, it will not signal, and the
+ /// resulting floating point value is unspecified. Otherwise,
+ /// the bit-level representation is preserved.
+ ///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @see GLSL uintBitsToFloat man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL vec uintBitsToFloat(vec const& v);
+
+ /// Computes and returns a * b + c.
+ ///
+ /// @tparam genType Floating-point scalar or vector types.
+ ///
+ /// @see GLSL fma man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL genType fma(genType const& a, genType const& b, genType const& c);
+
+ /// Splits x into a floating-point significand in the range
+ /// [0.5, 1.0) and an integral exponent of two, such that:
+ /// x = significand * exp(2, exponent)
+ ///
+ /// The significand is returned by the function and the
+ /// exponent is returned in the parameter exp. For a
+ /// floating-point value of zero, the significant and exponent
+ /// are both zero. For a floating-point value that is an
+ /// infinity or is not a number, the results are undefined.
+ ///
+ /// @tparam genType Floating-point scalar or vector types.
+ ///
+ /// @see GLSL frexp man page
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL genType frexp(genType const& x, genIType& exp);
+
+ /// Builds a floating-point number from x and the
+ /// corresponding integral exponent of two in exp, returning:
+ /// significand * exp(2, exponent)
+ ///
+ /// If this product is too large to be represented in the
+ /// floating-point type, the result is undefined.
+ ///
+ /// @tparam genType Floating-point scalar or vector types.
+ ///
+ /// @see GLSL ldexp man page;
+ /// @see GLSL 4.20.8 specification, section 8.3 Common Functions
+ template
+ GLM_FUNC_DECL genType ldexp(genType const& x, genIType const& exp);
+
+ /// @}
+}//namespace glm
+
+#include "detail/func_common.inl"
+
diff --git a/includes/glm/detail/_features.hpp b/includes/glm/detail/_features.hpp
index b0aa303..b0cbe9f 100644
--- a/includes/glm/detail/_features.hpp
+++ b/includes/glm/detail/_features.hpp
@@ -1,35 +1,3 @@
-///////////////////////////////////////////////////////////////////////////////////
-/// OpenGL Mathematics (glm.g-truc.net)
-///
-/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
-/// Permission is hereby granted, free of charge, to any person obtaining a copy
-/// of this software and associated documentation files (the "Software"), to deal
-/// in the Software without restriction, including without limitation the rights
-/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-/// copies of the Software, and to permit persons to whom the Software is
-/// furnished to do so, subject to the following conditions:
-///
-/// The above copyright notice and this permission notice shall be included in
-/// all copies or substantial portions of the Software.
-///
-/// Restrictions:
-/// By making use of the Software for military purposes, you choose to make
-/// a Bunny unhappy.
-///
-/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-/// THE SOFTWARE.
-///
-/// @ref core
-/// @file glm/detail/_features.hpp
-/// @date 2013-02-20 / 2013-02-20
-/// @author Christophe Riccio
-///////////////////////////////////////////////////////////////////////////////////
-
#pragma once
// #define GLM_CXX98_EXCEPTIONS
@@ -55,7 +23,7 @@
// Variadic templates - GCC 4.3
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf
-//
+//
// Extending variadic template template parameters - GCC 4.4
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf
@@ -63,7 +31,7 @@
// Initializer lists - GCC 4.4
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm
-// #define GLM_CXX11_STATIC_ASSERT
+// #define GLM_CXX11_STATIC_ASSERT
// Static assertions - GCC 4.3
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1720.html
@@ -91,15 +59,15 @@
// Declared type of an expression - GCC 4.3
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf
-//
+//
// Right angle brackets - GCC 4.3
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html
-//
+//
// Default template arguments for function templates DR226 GCC 4.3
// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#226
-//
+//
// Solving the SFINAE problem for expressions DR339 GCC 4.4
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2634.html
@@ -107,7 +75,7 @@
// Template aliases N2258 GCC 4.7
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
-//
+//
// Extern templates N1987 Yes
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm
@@ -119,19 +87,19 @@
// Strongly-typed enums N2347 GCC 4.4
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf
-//
+//
// Forward declarations for enums N2764 GCC 4.6
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf
-//
+//
// Generalized attributes N2761 GCC 4.8
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf
-//
+//
// Generalized constant expressions N2235 GCC 4.6
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf
-//
+//
// Alignment support N2341 GCC 4.8
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf
@@ -139,7 +107,7 @@
// Delegating constructors N1986 GCC 4.7
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf
-//
+//
// Inheriting constructors N2540 GCC 4.8
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm
@@ -147,19 +115,19 @@
// Explicit conversion operators N2437 GCC 4.5
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf
-//
+//
// New character types N2249 GCC 4.4
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2249.html
-//
+//
// Unicode string literals N2442 GCC 4.5
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm
-//
+//
// Raw string literals N2442 GCC 4.5
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm
-//
+//
// Universal character name literals N2170 GCC 4.5
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2170.html
@@ -167,7 +135,7 @@
// User-defined literals N2765 GCC 4.7
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf
-//
+//
// Standard Layout Types N2342 GCC 4.5
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2342.htm
@@ -176,11 +144,11 @@
// Defaulted and deleted functions N2346 GCC 4.4
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm
-//
+//
// Extended friend declarations N1791 GCC 4.7
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf
-//
+//
// Extending sizeof N2253 GCC 4.4
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html
@@ -206,7 +174,7 @@
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3272.htm
-//
+//
// Minimal support for garbage collection and reachability-based leak detection N2670 No
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2670.htm
@@ -214,77 +182,75 @@
// Allowing move constructors to throw [noexcept] N3050 GCC 4.6 (core language only)
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3050.html
-//
+//
// Defining move special member functions N3053 GCC 4.6
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3053.html
-//
+//
// Sequence points N2239 Yes
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html
-//
+//
// Atomic operations N2427 GCC 4.4
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html
-//
+//
// Strong Compare and Exchange N2748 GCC 4.5
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html
-//
+//
// Bidirectional Fences N2752 GCC 4.8
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2752.htm
-//
+//
// Memory model N2429 GCC 4.8
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2429.htm
-//
+//
// Data-dependency ordering: atomics and memory model N2664 GCC 4.4
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2664.htm
-//
+//
// Propagating exceptions N2179 GCC 4.4
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html
-//
+//
// Abandoning a process and at_quick_exit N2440 GCC 4.8
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2440.htm
-//
+//
// Allow atomics use in signal handlers N2547 Yes
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2547.htm
-//
+//
// Thread-local storage N2659 GCC 4.8
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2659.htm
-//
+//
// Dynamic initialization and destruction with concurrency N2660 GCC 4.3
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2660.htm
-//
+//
// __func__ predefined identifier N2340 GCC 4.3
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2340.htm
-//
+//
// C99 preprocessor N1653 GCC 4.3
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm
-//
+//
// long long N1811 GCC 4.3
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1811.pdf
-//
+//
// Extended integral types N1988 Yes
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1988.pdf
#if(GLM_COMPILER & GLM_COMPILER_GCC)
-# if(GLM_COMPILER >= GLM_COMPILER_GCC43)
-# define GLM_CXX11_STATIC_ASSERT
-# endif
+# define GLM_CXX11_STATIC_ASSERT
-#elif(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
+#elif(GLM_COMPILER & GLM_COMPILER_CLANG)
# if(__has_feature(cxx_exceptions))
# define GLM_CXX98_EXCEPTIONS
# endif
@@ -425,4 +391,4 @@
# define GLM_CXX11_VARIADIC_TEMPLATES
# endif
-#endif//(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
+#endif//(GLM_COMPILER & GLM_COMPILER_CLANG)
diff --git a/includes/glm/detail/_fixes.hpp b/includes/glm/detail/_fixes.hpp
index 0405f33..a503c7c 100644
--- a/includes/glm/detail/_fixes.hpp
+++ b/includes/glm/detail/_fixes.hpp
@@ -1,35 +1,3 @@
-///////////////////////////////////////////////////////////////////////////////////
-/// OpenGL Mathematics (glm.g-truc.net)
-///
-/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
-/// Permission is hereby granted, free of charge, to any person obtaining a copy
-/// of this software and associated documentation files (the "Software"), to deal
-/// in the Software without restriction, including without limitation the rights
-/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-/// copies of the Software, and to permit persons to whom the Software is
-/// furnished to do so, subject to the following conditions:
-///
-/// The above copyright notice and this permission notice shall be included in
-/// all copies or substantial portions of the Software.
-///
-/// Restrictions:
-/// By making use of the Software for military purposes, you choose to make
-/// a Bunny unhappy.
-///
-/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-/// THE SOFTWARE.
-///
-/// @ref core
-/// @file glm/detail/_fixes.hpp
-/// @date 2011-02-21 / 2011-11-22
-/// @author Christophe Riccio
-///////////////////////////////////////////////////////////////////////////////////
-
#include
//! Workaround for compatibility with other libraries
diff --git a/includes/glm/detail/_noise.hpp b/includes/glm/detail/_noise.hpp
index e887597..5a874a0 100644
--- a/includes/glm/detail/_noise.hpp
+++ b/includes/glm/detail/_noise.hpp
@@ -1,136 +1,81 @@
-///////////////////////////////////////////////////////////////////////////////////
-/// OpenGL Mathematics (glm.g-truc.net)
-///
-/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
-/// Permission is hereby granted, free of charge, to any person obtaining a copy
-/// of this software and associated documentation files (the "Software"), to deal
-/// in the Software without restriction, including without limitation the rights
-/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-/// copies of the Software, and to permit persons to whom the Software is
-/// furnished to do so, subject to the following conditions:
-///
-/// The above copyright notice and this permission notice shall be included in
-/// all copies or substantial portions of the Software.
-///
-/// Restrictions:
-/// By making use of the Software for military purposes, you choose to make
-/// a Bunny unhappy.
-///
-/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-/// THE SOFTWARE.
-///
-/// @ref core
-/// @file glm/detail/_noise.hpp
-/// @date 2013-12-24 / 2013-12-24
-/// @author Christophe Riccio
-///////////////////////////////////////////////////////////////////////////////////
-
#pragma once
-#include "../vec2.hpp"
-#include "../vec3.hpp"
-#include "../vec4.hpp"
#include "../common.hpp"
namespace glm{
namespace detail
{
- template
- GLM_FUNC_QUALIFIER T mod289(T const & x)
+ template
+ GLM_FUNC_QUALIFIER T mod289(T const& x)
{
- return x - floor(x * static_cast(1.0) / static_cast(289.0)) * static_cast(289.0);
+ return x - floor(x * (static_cast(1.0) / static_cast(289.0))) * static_cast(289.0);
}
- template
- GLM_FUNC_QUALIFIER T permute(T const & x)
+ template
+ GLM_FUNC_QUALIFIER T permute(T const& x)
{
return mod289(((x * static_cast(34)) + static_cast(1)) * x);
}
- template
- GLM_FUNC_QUALIFIER tvec2 permute(tvec2 const & x)
+ template
+ GLM_FUNC_QUALIFIER vec<2, T, Q> permute(vec<2, T, Q> const& x)
{
return mod289(((x * static_cast(34)) + static_cast(1)) * x);
}
-
- template
- GLM_FUNC_QUALIFIER tvec3 permute(tvec3 const & x)
+
+ template
+ GLM_FUNC_QUALIFIER vec<3, T, Q> permute(vec<3, T, Q> const& x)
{
return mod289(((x * static_cast(34)) + static_cast(1)) * x);
}
-
- template
- GLM_FUNC_QUALIFIER tvec4 permute(tvec4 const & x)
+
+ template
+ GLM_FUNC_QUALIFIER vec<4, T, Q> permute(vec<4, T, Q> const& x)
{
return mod289(((x * static_cast(34)) + static_cast(1)) * x);
}
-/*
- template class vecType>
- GLM_FUNC_QUALIFIER vecType permute(vecType const & x)
+
+ template
+ GLM_FUNC_QUALIFIER T taylorInvSqrt(T const& r)
{
- return mod289(((x * T(34)) + T(1)) * x);
+ return static_cast(1.79284291400159) - static_cast(0.85373472095314) * r;
}
-*/
- template
- GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r)
+
+ template
+ GLM_FUNC_QUALIFIER vec<2, T, Q> taylorInvSqrt(vec<2, T, Q> const& r)
{
- return T(1.79284291400159) - T(0.85373472095314) * r;
+ return static_cast(1.79284291400159) - static_cast(0.85373472095314) * r;
}
-
- template
- GLM_FUNC_QUALIFIER tvec2 taylorInvSqrt(tvec2 const & r)
+
+ template
+ GLM_FUNC_QUALIFIER vec<3, T, Q> taylorInvSqrt(vec<3, T, Q> const& r)
{
- return T(1.79284291400159) - T(0.85373472095314) * r;
+ return static_cast(1.79284291400159) - static_cast(0.85373472095314) * r;
}
-
- template
- GLM_FUNC_QUALIFIER tvec3 taylorInvSqrt(tvec3 const & r)
+
+ template
+ GLM_FUNC_QUALIFIER vec<4, T, Q> taylorInvSqrt(vec<4, T, Q> const& r)
{
- return T(1.79284291400159) - T(0.85373472095314) * r;
+ return static_cast(1.79284291400159) - static_cast(0.85373472095314) * r;
}
-
- template
- GLM_FUNC_QUALIFIER tvec4 taylorInvSqrt(tvec4 const & r)
+
+ template
+ GLM_FUNC_QUALIFIER vec<2, T, Q> fade(vec<2, T, Q> const& t)
{
- return T(1.79284291400159) - T(0.85373472095314) * r;
+ return (t * t * t) * (t * (t * static_cast(6) - static_cast(15)) + static_cast(10));
}
-/*
- template class vecType>
- GLM_FUNC_QUALIFIER vecType taylorInvSqrt(vecType const & r)
+
+ template
+ GLM_FUNC_QUALIFIER vec<3, T, Q> fade(vec<3, T, Q> const& t)
{
- return T(1.79284291400159) - T(0.85373472095314) * r;
+ return (t * t * t) * (t * (t * static_cast(6) - static_cast(15)) + static_cast(10));
}
-*/
-
- template
- GLM_FUNC_QUALIFIER tvec2 fade(tvec2 const & t)
+
+ template
+ GLM_FUNC_QUALIFIER vec<4, T, Q> fade(vec<4, T, Q> const& t)
{
- return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
+ return (t * t * t) * (t * (t * static_cast(6) - static_cast(15)) + static_cast(10));
}
-
- template
- GLM_FUNC_QUALIFIER tvec3 fade(tvec3 const & t)
- {
- return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
- }
-
- template
- GLM_FUNC_QUALIFIER tvec4 fade(tvec4 const & t)
- {
- return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
- }
-/*
- template class vecType>
- GLM_FUNC_QUALIFIER vecType fade(vecType const & t)
- {
- return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
- }
-*/
}//namespace detail
}//namespace glm
diff --git a/includes/glm/detail/_swizzle.hpp b/includes/glm/detail/_swizzle.hpp
index 2f23d0e..87896ef 100644
--- a/includes/glm/detail/_swizzle.hpp
+++ b/includes/glm/detail/_swizzle.hpp
@@ -1,164 +1,137 @@
-///////////////////////////////////////////////////////////////////////////////////
-/// OpenGL Mathematics (glm.g-truc.net)
-///
-/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
-/// Permission is hereby granted, free of charge, to any person obtaining a copy
-/// of this software and associated documentation files (the "Software"), to deal
-/// in the Software without restriction, including without limitation the rights
-/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-/// copies of the Software, and to permit persons to whom the Software is
-/// furnished to do so, subject to the following conditions:
-///
-/// The above copyright notice and this permission notice shall be included in
-/// all copies or substantial portions of the Software.
-///
-/// Restrictions:
-/// By making use of the Software for military purposes, you choose to make
-/// a Bunny unhappy.
-///
-/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-/// THE SOFTWARE.
-///
-/// @ref core
-/// @file glm/detail/_swizzle.hpp
-/// @date 2006-04-20 / 2011-02-16
-/// @author Christophe Riccio
-///////////////////////////////////////////////////////////////////////////////////
-
#pragma once
namespace glm{
namespace detail
{
// Internal class for implementing swizzle operators
- template
+ template
struct _swizzle_base0
{
- typedef T value_type;
-
protected:
- GLM_FUNC_QUALIFIER value_type& elem (size_t i) { return (reinterpret_cast(_buffer))[i]; }
- GLM_FUNC_QUALIFIER const value_type& elem (size_t i) const { return (reinterpret_cast(_buffer))[i]; }
+ GLM_FUNC_QUALIFIER T& elem(size_t i){ return (reinterpret_cast(_buffer))[i]; }
+ GLM_FUNC_QUALIFIER T const& elem(size_t i) const{ return (reinterpret_cast(_buffer))[i]; }
// Use an opaque buffer to *ensure* the compiler doesn't call a constructor.
// The size 1 buffer is assumed to aligned to the actual members so that the
- // elem()
+ // elem()
char _buffer[1];
};
- template
+ template
struct _swizzle_base1 : public _swizzle_base0
{
};
- template
- struct _swizzle_base1 : public _swizzle_base0
+ template
+ struct _swizzle_base1<2, T, Q, E0,E1,-1,-2, Aligned> : public _swizzle_base0
{
- GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1)); }
+ GLM_FUNC_QUALIFIER vec<2, T, Q> operator ()() const { return vec<2, T, Q>(this->elem(E0), this->elem(E1)); }
};
- template
- struct _swizzle_base1 : public _swizzle_base0
+ template
+ struct _swizzle_base1<3, T, Q, E0,E1,E2,-1, Aligned> : public _swizzle_base0
{
- GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2)); }
+ GLM_FUNC_QUALIFIER vec<3, T, Q> operator ()() const { return vec<3, T, Q>(this->elem(E0), this->elem(E1), this->elem(E2)); }
};
- template
- struct _swizzle_base1 : public _swizzle_base0
- {
- GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); }
+ template
+ struct _swizzle_base1<4, T, Q, E0,E1,E2,E3, Aligned> : public _swizzle_base0
+ {
+ GLM_FUNC_QUALIFIER vec<4, T, Q> operator ()() const { return vec<4, T, Q>(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); }
};
// Internal class for implementing swizzle operators
/*
Template parameters:
- ValueType = type of scalar values (e.g. float, double)
- VecType = class the swizzle is applies to (e.g. tvec3)
- N = number of components in the vector (e.g. 3)
- E0...3 = what index the n-th element of this swizzle refers to in the unswizzled vec
+ T = type of scalar values (e.g. float, double)
+ N = number of components in the vector (e.g. 3)
+ E0...3 = what index the n-th element of this swizzle refers to in the unswizzled vec
DUPLICATE_ELEMENTS = 1 if there is a repeated element, 0 otherwise (used to specialize swizzles
- containing duplicate elements so that they cannot be used as r-values).
+ containing duplicate elements so that they cannot be used as r-values).
*/
- template
- struct _swizzle_base2 : public _swizzle_base1
+ template
+ struct _swizzle_base2 : public _swizzle_base1::value>
{
- typedef VecType vec_type;
- typedef ValueType value_type;
+ struct op_equal
+ {
+ GLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e = t; }
+ };
- GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const ValueType& t)
+ struct op_minus
+ {
+ GLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e -= t; }
+ };
+
+ struct op_plus
+ {
+ GLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e += t; }
+ };
+
+ struct op_mul
+ {
+ GLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e *= t; }
+ };
+
+ struct op_div
+ {
+ GLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e /= t; }
+ };
+
+ public:
+ GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const T& t)
{
for (int i = 0; i < N; ++i)
(*this)[i] = t;
return *this;
}
- GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const VecType& that)
+ GLM_FUNC_QUALIFIER _swizzle_base2& operator= (vec const& that)
{
- struct op {
- GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e = t; }
- };
- _apply_op(that, op());
+ _apply_op(that, op_equal());
return *this;
}
- GLM_FUNC_QUALIFIER void operator -= (const VecType& that)
+ GLM_FUNC_QUALIFIER void operator -= (vec const& that)
{
- struct op {
- GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e -= t; }
- };
- _apply_op(that, op());
+ _apply_op(that, op_minus());
}
- GLM_FUNC_QUALIFIER void operator += (const VecType& that)
+ GLM_FUNC_QUALIFIER void operator += (vec const& that)
{
- struct op {
- GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e += t; }
- };
- _apply_op(that, op());
+ _apply_op(that, op_plus());
}
- GLM_FUNC_QUALIFIER void operator *= (const VecType& that)
+ GLM_FUNC_QUALIFIER void operator *= (vec const& that)
{
- struct op {
- GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e *= t; }
- };
- _apply_op(that, op());
+ _apply_op(that, op_mul());
}
- GLM_FUNC_QUALIFIER void operator /= (const VecType& that)
+ GLM_FUNC_QUALIFIER void operator /= (vec const& that)
{
- struct op {
- GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e /= t; }
- };
- _apply_op(that, op());
+ _apply_op(that, op_div());
}
- GLM_FUNC_QUALIFIER value_type& operator[] (size_t i)
+ GLM_FUNC_QUALIFIER T& operator[](size_t i)
{
const int offset_dst[4] = { E0, E1, E2, E3 };
return this->elem(offset_dst[i]);
}
- GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const
+ GLM_FUNC_QUALIFIER T operator[](size_t i) const
{
const int offset_dst[4] = { E0, E1, E2, E3 };
return this->elem(offset_dst[i]);
}
protected:
- template
- GLM_FUNC_QUALIFIER void _apply_op(const VecType& that, T op)
+ template
+ GLM_FUNC_QUALIFIER void _apply_op(vec const& that, const U& op)
{
// Make a copy of the data in this == &that.
// The copier should optimize out the copy in cases where the function is
// properly inlined and the copy is not necessary.
- ValueType t[N];
+ T t[N];
for (int i = 0; i < N; ++i)
t[i] = that[i];
for (int i = 0; i < N; ++i)
@@ -167,56 +140,54 @@ namespace detail
};
// Specialization for swizzles containing duplicate elements. These cannot be modified.
- template
- struct _swizzle_base2 : public _swizzle_base1
+ template
+ struct _swizzle_base2 : public _swizzle_base1::value>
{
- typedef VecType vec_type;
- typedef ValueType value_type;
-
struct Stub {};
- GLM_FUNC_QUALIFIER _swizzle_base2& operator= (Stub const &) { return *this; }
- GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const
+ GLM_FUNC_QUALIFIER _swizzle_base2& operator= (Stub const&) { return *this; }
+
+ GLM_FUNC_QUALIFIER T operator[] (size_t i) const
{
const int offset_dst[4] = { E0, E1, E2, E3 };
return this->elem(offset_dst[i]);
}
};
- template
- struct _swizzle : public _swizzle_base2
+ template
+ struct _swizzle : public _swizzle_base2
{
- typedef _swizzle_base2 base_type;
+ typedef _swizzle_base2 base_type;
using base_type::operator=;
- GLM_FUNC_QUALIFIER operator VecType () const { return (*this)(); }
+ GLM_FUNC_QUALIFIER operator vec () const { return (*this)(); }
};
//
// To prevent the C++ syntax from getting entirely overwhelming, define some alias macros
//
-#define _GLM_SWIZZLE_TEMPLATE1 template
-#define _GLM_SWIZZLE_TEMPLATE2 template
-#define _GLM_SWIZZLE_TYPE1 _swizzle
-#define _GLM_SWIZZLE_TYPE2 _swizzle
+#define GLM_SWIZZLE_TEMPLATE1 template
+#define GLM_SWIZZLE_TEMPLATE2 template
+#define GLM_SWIZZLE_TYPE1 _swizzle
+#define GLM_SWIZZLE_TYPE2 _swizzle
//
// Wrapper for a binary operator (e.g. u.yy + v.zy)
//
-#define _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \
- _GLM_SWIZZLE_TEMPLATE2 \
- GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \
+#define GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \
+ GLM_SWIZZLE_TEMPLATE2 \
+ GLM_FUNC_QUALIFIER vec operator OPERAND ( const GLM_SWIZZLE_TYPE1& a, const GLM_SWIZZLE_TYPE2& b) \
{ \
return a() OPERAND b(); \
} \
- _GLM_SWIZZLE_TEMPLATE1 \
- GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const V& b) \
+ GLM_SWIZZLE_TEMPLATE1 \
+ GLM_FUNC_QUALIFIER vec operator OPERAND ( const GLM_SWIZZLE_TYPE1& a, const vec& b) \
{ \
return a() OPERAND b; \
} \
- _GLM_SWIZZLE_TEMPLATE1 \
- GLM_FUNC_QUALIFIER V operator OPERAND ( const V& a, const _GLM_SWIZZLE_TYPE1& b) \
+ GLM_SWIZZLE_TEMPLATE1 \
+ GLM_FUNC_QUALIFIER vec