From bfad7296f3e4bfea165f3498e26d3a3a4e3be5a1 Mon Sep 17 00:00:00 2001 From: Philip Trettner <Philip.Trettner@rwth-aachen.de> Date: Thu, 24 Apr 2014 12:24:32 +0200 Subject: [PATCH] Updated glm --- include/glm/detail/dummy.cpp | 170 ++++++++++++++++---- include/glm/detail/func_exponential.inl | 28 ++-- include/glm/detail/func_geometric.inl | 15 +- include/glm/detail/func_integer.inl | 18 ++- include/glm/detail/intrinsic_geometric.inl | 2 +- include/glm/detail/setup.hpp | 61 +++---- include/glm/detail/type_mat2x3.hpp | 2 +- include/glm/ext.hpp | 4 +- include/glm/gtc/matrix_access.hpp | 8 +- include/glm/gtc/matrix_inverse.hpp | 4 +- include/glm/gtc/matrix_transform.inl | 21 --- include/glm/gtc/noise.hpp | 6 +- include/glm/gtc/packing.inl | 12 +- include/glm/gtc/ulp.inl | 44 +++-- include/glm/gtx/associated_min_max.hpp | 12 +- include/glm/gtx/bit.inl | 136 ++++++++++++---- include/glm/gtx/closest_point.hpp | 2 +- include/glm/gtx/color_space.hpp | 12 +- include/glm/gtx/color_space_YCoCg.hpp | 8 +- include/glm/gtx/compatibility.hpp | 8 +- include/glm/gtx/compatibility.inl | 14 +- include/glm/gtx/component_wise.hpp | 8 +- include/glm/gtx/dual_quaternion.hpp | 54 +++---- include/glm/gtx/euler_angles.hpp | 30 ++-- include/glm/gtx/euler_angles.inl | 36 ++++- include/glm/gtx/extented_min_max.hpp | 72 +++------ include/glm/gtx/extented_min_max.inl | 48 +----- include/glm/gtx/fast_exponential.hpp | 14 +- include/glm/gtx/fast_square_root.inl | 14 +- include/glm/gtx/fast_trigonometry.hpp | 26 +-- include/glm/gtx/gradient_paint.hpp | 4 +- include/glm/gtx/gradient_paint.inl | 4 +- include/glm/gtx/handed_coordinate_space.hpp | 4 +- include/glm/gtx/int_10_10_10_2.hpp | 2 +- include/glm/gtx/integer.hpp | 20 +-- include/glm/gtx/intersect.hpp | 12 +- include/glm/gtx/log_base.hpp | 2 +- include/glm/gtx/matrix_cross_product.hpp | 4 +- include/glm/gtx/matrix_interpolation.hpp | 8 +- include/glm/gtx/matrix_major_storage.hpp | 24 +-- include/glm/gtx/matrix_operation.hpp | 18 +-- include/glm/gtx/matrix_query.hpp | 16 +- include/glm/gtx/matrix_query.inl | 47 +----- include/glm/gtx/matrix_transform_2d.hpp | 105 ++++++++++++ include/glm/gtx/matrix_transform_2d.inl | 97 +++++++++++ include/glm/gtx/mixed_product.hpp | 2 +- include/glm/gtx/multiple.hpp | 4 +- include/glm/gtx/norm.hpp | 20 +-- include/glm/gtx/normal.hpp | 4 +- include/glm/gtx/normalize_dot.hpp | 4 +- include/glm/gtx/optimum_pow.hpp | 14 +- include/glm/gtx/orthonormalize.hpp | 6 +- include/glm/gtx/perpendicular.hpp | 2 +- include/glm/gtx/polar_coordinates.hpp | 4 +- include/glm/gtx/projection.hpp | 2 +- include/glm/gtx/quaternion.hpp | 36 ++--- include/glm/gtx/raw_data.hpp | 1 + include/glm/gtx/rotate_normalized_axis.hpp | 4 +- include/glm/gtx/rotate_vector.hpp | 20 +-- include/glm/gtx/simd_quat.hpp | 2 - include/glm/gtx/simd_quat.inl | 2 +- include/glm/gtx/string_cast.hpp | 7 +- include/glm/gtx/string_cast.inl | 6 +- include/glm/gtx/transform.hpp | 6 +- include/glm/gtx/transform2.hpp | 18 +-- include/glm/gtx/vector_angle.hpp | 6 +- include/glm/gtx/vector_query.hpp | 12 +- include/glm/gtx/vector_query.inl | 16 +- 68 files changed, 893 insertions(+), 561 deletions(-) create mode 100644 include/glm/gtx/matrix_transform_2d.hpp create mode 100644 include/glm/gtx/matrix_transform_2d.inl diff --git a/include/glm/detail/dummy.cpp b/include/glm/detail/dummy.cpp index f725933c..98ca022c 100644 --- a/include/glm/detail/dummy.cpp +++ b/include/glm/detail/dummy.cpp @@ -33,50 +33,158 @@ #define GLM_MESSAGES #include "../glm.hpp" #include <limits> -/* -#if(GLM_ARCH & GLM_ARCH_SSE2) -struct float4 -{ - union - { - struct {float r, g, b, a;}; - struct {float s, t, p, q;}; - struct {float x, y, z, w;}; - __m128 data; - }; -}; -int test_simd() +struct material { - float4 f; - + glm::vec4 emission; // Ecm + glm::vec4 ambient; // Acm + glm::vec4 diffuse; // Dcm + glm::vec4 specular; // Scm + float shininess; // Srm +}; +struct light +{ + glm::vec4 ambient; // Acli + glm::vec4 diffuse; // Dcli + glm::vec4 specular; // Scli + glm::vec4 position; // Ppli + glm::vec4 halfVector; // Derived: Hi + glm::vec3 spotDirection; // Sdli + float spotExponent; // Srli + float spotCutoff; // Crli + // (range: [0.0,90.0], 180.0) + float spotCosCutoff; // Derived: cos(Crli) + // (range: [1.0,0.0],-1.0) + float constantAttenuation; // K0 + float linearAttenuation; // K1 + float quadraticAttenuation;// K2 +}; +// Sample 1 +#include <glm/vec3.hpp>// glm::vec3 +#include <glm/geometric.hpp>// glm::cross, glm::normalize - return 0; +glm::vec3 computeNormal +( + glm::vec3 const & a, + glm::vec3 const & b, + glm::vec3 const & c +) +{ + return glm::normalize(glm::cross(c - a, b - a)); } -#endif//GLM_ARCH -*/ +typedef unsigned int GLuint; +#define GL_FALSE 0 +void glUniformMatrix4fv(GLuint, int, int, float*){} -template <class T = int> -class C; +// Sample 2 +#include <glm/vec3.hpp> // glm::vec3 +#include <glm/vec4.hpp> // glm::vec4, glm::ivec4 +#include <glm/mat4x4.hpp> // glm::mat4 +#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective +#include <glm/gtc/type_ptr.hpp> // glm::value_ptr +void func(GLuint LocationMVP, float Translate, glm::vec2 const & Rotate) +{ + glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.f); + glm::mat4 ViewTranslate = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate)); + glm::mat4 ViewRotateX = glm::rotate(ViewTranslate, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f)); + glm::mat4 View = glm::rotate(ViewRotateX, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f)); + glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f)); + glm::mat4 MVP = Projection * View * Model; + glUniformMatrix4fv(LocationMVP, 1, GL_FALSE, glm::value_ptr(MVP)); +} -template <class T> -class C +// Sample 3 +#include <glm/vec2.hpp>// glm::vec2 +#include <glm/packing.hpp>// glm::packUnorm2x16 +#include <glm/integer.hpp>// glm::uint +#include <glm/gtc/type_precision.hpp>// glm::i8vec2, glm::i32vec2 +std::size_t const VertexCount = 4; +// Float quad geometry +std::size_t const PositionSizeF32 = VertexCount * sizeof(glm::vec2); +glm::vec2 const PositionDataF32[VertexCount] = +{ + glm::vec2(-1.0f,-1.0f), + glm::vec2( 1.0f,-1.0f), + glm::vec2( 1.0f, 1.0f), + glm::vec2(-1.0f, 1.0f) + }; +// Half-float quad geometry +std::size_t const PositionSizeF16 = VertexCount * sizeof(glm::uint); +glm::uint const PositionDataF16[VertexCount] = { -public: - T value; + glm::uint(glm::packUnorm2x16(glm::vec2(-1.0f, -1.0f))), + glm::uint(glm::packUnorm2x16(glm::vec2( 1.0f, -1.0f))), + glm::uint(glm::packUnorm2x16(glm::vec2( 1.0f, 1.0f))), + glm::uint(glm::packUnorm2x16(glm::vec2(-1.0f, 1.0f))) +}; +// 8 bits signed integer quad geometry +std::size_t const PositionSizeI8 = VertexCount * sizeof(glm::i8vec2); +glm::i8vec2 const PositionDataI8[VertexCount] = +{ + glm::i8vec2(-1,-1), + glm::i8vec2( 1,-1), + glm::i8vec2( 1, 1), + glm::i8vec2(-1, 1) +}; +// 32 bits signed integer quad geometry +std::size_t const PositionSizeI32 = VertexCount * sizeof(glm::i32vec2); +glm::i32vec2 const PositionDataI32[VertexCount] = +{ + glm::i32vec2 (-1,-1), + glm::i32vec2 ( 1,-1), + glm::i32vec2 ( 1, 1), + glm::i32vec2 (-1, 1) }; -int main() +struct intersection { -/* -# if(GLM_ARCH & GLM_ARCH_SSE2) - test_simd(); -# endif -*/ + glm::vec4 position; + glm::vec3 normal; +}; - C<> c; +/* +// Sample 4 +#include <glm/vec3.hpp>// glm::vec3 +#include <glm/geometric.hpp>// glm::normalize, glm::dot, glm::reflect +#include <glm/exponential.hpp>// glm::pow +#include <glm/gtc/random.hpp>// glm::vecRand3 +glm::vec3 lighting +( + intersection const & Intersection, + material const & Material, + light const & Light, + glm::vec3 const & View +) +{ + glm::vec3 Color(0.0f); + glm::vec3 LightVertor(glm::normalize( + Light.position - Intersection.position + + glm::vecRand3(0.0f, Light.inaccuracy)); + if(!shadow(Intersection.position, Light.position, LightVertor)) + { + float Diffuse = glm::dot(Intersection.normal, LightVector); + if(Diffuse <= 0.0f) + return Color; + if(Material.isDiffuse()) + Color += Light.color() * Material.diffuse * Diffuse; + if(Material.isSpecular()) + { + glm::vec3 Reflect(glm::reflect( + glm::normalize(-LightVector), + glm::normalize(Intersection.normal))); + float Dot = glm::dot(Reflect, View); + float Base = Dot > 0.0f ? Dot : 0.0f; + float Specular = glm::pow(Base, Material.exponent); + Color += Material.specular * Specular; + } + } + return Color; +} +*/ +int main() +{ return 0; } diff --git a/include/glm/detail/func_exponential.inl b/include/glm/detail/func_exponential.inl index 2033b507..f8bd5093 100644 --- a/include/glm/detail/func_exponential.inl +++ b/include/glm/detail/func_exponential.inl @@ -45,7 +45,7 @@ namespace detail struct compute_log2<true> { template <typename T> - T operator() (T const & Value) const + GLM_FUNC_QUALIFIER T operator() (T const & Value) const { return static_cast<T>(::std::log(Value)) * static_cast<T>(1.4426950408889634073599246810019); } @@ -54,7 +54,7 @@ namespace detail template <template <class, precision> class vecType, typename T, precision P> struct compute_inversesqrt { - static vecType<T, P> call(vecType<T, P> const & x) + GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x) { return static_cast<T>(1) / sqrt(x); } @@ -63,7 +63,7 @@ namespace detail template <template <class, precision> class vecType> struct compute_inversesqrt<vecType, float, lowp> { - static vecType<float, lowp> call(vecType<float, lowp> const & x) + GLM_FUNC_QUALIFIER static vecType<float, lowp> call(vecType<float, lowp> const & x) { vecType<float, lowp> tmp(x); vecType<float, lowp> xhalf(tmp * 0.5f); @@ -160,7 +160,7 @@ namespace detail template <typename T, precision P> struct compute_sqrt<detail::tvec1, T, P> { - static detail::tvec1<T, P> call(detail::tvec1<T, P> const & x) + GLM_FUNC_QUALIFIER static detail::tvec1<T, P> call(detail::tvec1<T, P> const & x) { return detail::tvec1<T, P>(std::sqrt(x.x)); } @@ -169,7 +169,7 @@ namespace detail template <typename T, precision P> struct compute_sqrt<detail::tvec2, T, P> { - static detail::tvec2<T, P> call(detail::tvec2<T, P> const & x) + GLM_FUNC_QUALIFIER static detail::tvec2<T, P> call(detail::tvec2<T, P> const & x) { return detail::tvec2<T, P>(std::sqrt(x.x), std::sqrt(x.y)); } @@ -178,7 +178,7 @@ namespace detail template <typename T, precision P> struct compute_sqrt<detail::tvec3, T, P> { - static detail::tvec3<T, P> call(detail::tvec3<T, P> const & x) + GLM_FUNC_QUALIFIER static detail::tvec3<T, P> call(detail::tvec3<T, P> const & x) { return detail::tvec3<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z)); } @@ -187,7 +187,7 @@ namespace detail template <typename T, precision P> struct compute_sqrt<detail::tvec4, T, P> { - static detail::tvec4<T, P> call(detail::tvec4<T, P> const & x) + GLM_FUNC_QUALIFIER static detail::tvec4<T, P> call(detail::tvec4<T, P> const & x) { return detail::tvec4<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z), std::sqrt(x.w)); } @@ -197,12 +197,22 @@ namespace detail // sqrt GLM_FUNC_QUALIFIER float sqrt(float x) { - return detail::compute_sqrt<detail::tvec1, float, highp>::call(x).x; +# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6 + detail::tvec1<float, highp> tmp(detail::compute_sqrt<detail::tvec1, float, highp>::call(x)); + return tmp.x; +# else + return detail::compute_sqrt<detail::tvec1, float, highp>::call(x).x; +# endif } GLM_FUNC_QUALIFIER double sqrt(double x) { - return detail::compute_sqrt<detail::tvec1, double, highp>::call(x).x; +# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6 + detail::tvec1<double, highp> tmp(detail::compute_sqrt<detail::tvec1, double, highp>::call(x)); + return tmp.x; +# else + return detail::compute_sqrt<detail::tvec1, double, highp>::call(x).x; +# endif } template <typename T, precision P, template <typename, precision> class vecType> diff --git a/include/glm/detail/func_geometric.inl b/include/glm/detail/func_geometric.inl index 8c116cbe..9542ab8a 100644 --- a/include/glm/detail/func_geometric.inl +++ b/include/glm/detail/func_geometric.inl @@ -41,16 +41,21 @@ namespace detail template <typename T, precision P> struct compute_dot<detail::tvec1, T, P> { - static T call(detail::tvec1<T, P> const & x, detail::tvec1<T, P> const & y) + GLM_FUNC_QUALIFIER static T call(detail::tvec1<T, P> const & x, detail::tvec1<T, P> const & y) { - return detail::tvec1<T, P>(x * y).x; +# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6 + detail::tvec1<T, P> tmp(x * y); + return tmp.x; +# else + return detail::tvec1<T, P>(x * y).x; +# endif } }; template <typename T, precision P> struct compute_dot<detail::tvec2, T, P> { - static T call(detail::tvec2<T, P> const & x, detail::tvec2<T, P> const & y) + GLM_FUNC_QUALIFIER static T call(detail::tvec2<T, P> const & x, detail::tvec2<T, P> const & y) { detail::tvec2<T, P> tmp(x * y); return tmp.x + tmp.y; @@ -60,7 +65,7 @@ namespace detail template <typename T, precision P> struct compute_dot<detail::tvec3, T, P> { - static T call(detail::tvec3<T, P> const & x, detail::tvec3<T, P> const & y) + GLM_FUNC_QUALIFIER static T call(detail::tvec3<T, P> const & x, detail::tvec3<T, P> const & y) { detail::tvec3<T, P> tmp(x * y); return tmp.x + tmp.y + tmp.z; @@ -70,7 +75,7 @@ namespace detail template <typename T, precision P> struct compute_dot<detail::tvec4, T, P> { - static T call(detail::tvec4<T, P> const & x, detail::tvec4<T, P> const & y) + GLM_FUNC_QUALIFIER static T call(detail::tvec4<T, P> const & x, detail::tvec4<T, P> const & y) { detail::tvec4<T, P> tmp(x * y); return (tmp.x + tmp.y) + (tmp.z + tmp.w); diff --git a/include/glm/detail/func_integer.inl b/include/glm/detail/func_integer.inl index b8aa71f9..b2eb5e04 100644 --- a/include/glm/detail/func_integer.inl +++ b/include/glm/detail/func_integer.inl @@ -110,10 +110,10 @@ namespace glm GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch"); Borrow = x >= y ? static_cast<uint32>(0) : static_cast<uint32>(1); - if(x > y) - return static_cast<uint32>(static_cast<int64>(x) -static_cast<int64>(y)); + if(y >= x) + return y - x; else - return static_cast<uint32>((static_cast<int64>(1) << static_cast<int64>(32)) + static_cast<int64>(x) - static_cast<int64>(y)); + return static_cast<uint32>((static_cast<int64>(1) << static_cast<int64>(32)) + (static_cast<int64>(y) - static_cast<int64>(x))); } template <> @@ -171,8 +171,10 @@ namespace glm GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch"); uint64 Value64 = static_cast<uint64>(x) * static_cast<uint64>(y); - msb = *(reinterpret_cast<uint32*>(&Value64) + 1); - lsb = reinterpret_cast<uint32&>(Value64); + uint32* PointerMSB = (reinterpret_cast<uint32*>(&Value64) + 1); + msb = *PointerMSB; + uint32* PointerLSB = (reinterpret_cast<uint32*>(&Value64) + 0); + lsb = *PointerLSB; } template <> @@ -230,8 +232,10 @@ namespace glm GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch"); int64 Value64 = static_cast<int64>(x) * static_cast<int64>(y); - msb = *(reinterpret_cast<int32*>(&Value64) + 1); - lsb = reinterpret_cast<int32&>(Value64); + int32* PointerMSB = (reinterpret_cast<int32*>(&Value64) + 1); + msb = *PointerMSB; + int32* PointerLSB = (reinterpret_cast<int32*>(&Value64)); + lsb = *PointerLSB; } template <> diff --git a/include/glm/detail/intrinsic_geometric.inl b/include/glm/detail/intrinsic_geometric.inl index 4197c5c9..9949a105 100644 --- a/include/glm/detail/intrinsic_geometric.inl +++ b/include/glm/detail/intrinsic_geometric.inl @@ -48,7 +48,7 @@ GLM_FUNC_QUALIFIER __m128 sse_dst_ps(__m128 p0, __m128 p1) //dot GLM_FUNC_QUALIFIER __m128 sse_dot_ps(__m128 v1, __m128 v2) { -# if((GLM_ARCH & GLM_ARCH_SSE4) == GLM_ARCH_SSE4) +# if((GLM_ARCH & GLM_ARCH_AVX) == GLM_ARCH_AVX) return _mm_dp_ps(v1, v2, 0xff); # else __m128 mul0 = _mm_mul_ps(v1, v2); diff --git a/include/glm/detail/setup.hpp b/include/glm/detail/setup.hpp index b27f343c..1af56837 100644 --- a/include/glm/detail/setup.hpp +++ b/include/glm/detail/setup.hpp @@ -38,7 +38,7 @@ #define GLM_VERSION_MAJOR 0 #define GLM_VERSION_MINOR 9 #define GLM_VERSION_PATCH 5 -#define GLM_VERSION_REVISION 2 +#define GLM_VERSION_REVISION 3 /////////////////////////////////////////////////////////////////////////////////////////////////// // Platform @@ -211,6 +211,9 @@ // CUDA #elif defined(__CUDACC__) +# if !defined(CUDA_VERSION) && !defined(GLM_FORCE_CUDA) +# include <cuda.h> // make sure version is defined since nvcc does not define it itself! +# endif # if CUDA_VERSION < 3000 # error "GLM requires CUDA 3.0 or higher" # else @@ -550,9 +553,8 @@ #define GLM_ARCH_PURE 0x0000 #define GLM_ARCH_SSE2 0x0001 #define GLM_ARCH_SSE3 0x0002// | GLM_ARCH_SSE2 -#define GLM_ARCH_SSE4 0x0004// | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 -#define GLM_ARCH_AVX 0x0008// | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 -#define GLM_ARCH_AVX2 0x0010// | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 +#define GLM_ARCH_AVX 0x0008// | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 +#define GLM_ARCH_AVX2 0x0010// | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 #if(defined(GLM_FORCE_PURE)) # define GLM_ARCH GLM_ARCH_PURE @@ -560,51 +562,32 @@ # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) #elif(defined(GLM_FORCE_AVX)) # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) -#elif(defined(GLM_FORCE_SSE4)) -# define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) #elif(defined(GLM_FORCE_SSE3)) # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2) #elif(defined(GLM_FORCE_SSE2)) # define GLM_ARCH (GLM_ARCH_SSE2) -#elif((GLM_COMPILER & GLM_COMPILER_VC) && (defined(_M_IX86) || defined(_M_X64))) -# if(GLM_PLATFORM == GLM_PLATFORM_WINCE) -# define GLM_ARCH GLM_ARCH_PURE -# elif(defined(_M_CEE_PURE)) -# define GLM_ARCH GLM_ARCH_PURE -/* TODO: Explore auto detection of instruction set support -# elif(defined(_M_IX86_FP)) -# if(_M_IX86_FP >= 3) -# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) -# elif(_M_IX86_FP >= 2) -# define GLM_ARCH (GLM_ARCH_SSE2) -# else -# define GLM_ARCH GLM_ARCH_PURE -# endif -*/ -# elif(GLM_COMPILER >= GLM_COMPILER_VC11) +#elif(GLM_COMPILER & GLM_COMPILER_VC) +# if _M_IX86_FP == 2 && defined(__AVX__) # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) -# elif(GLM_COMPILER >= GLM_COMPILER_VC10) -# if(_MSC_FULL_VER >= 160031118) //160031118: VC2010 SP1 beta full version -# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)//GLM_ARCH_AVX (Require SP1) -# else -# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2) -# endif -# elif(GLM_COMPILER >= GLM_COMPILER_VC9) -# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2) -# elif(GLM_COMPILER >= GLM_COMPILER_VC8) -# define GLM_ARCH GLM_ARCH_SSE2 +# elif _M_IX86_FP == 2 +# define GLM_ARCH (GLM_ARCH_SSE2) # else -# define GLM_ARCH GLM_ARCH_PURE +# define GLM_ARCH (GLM_ARCH_PURE) # endif #elif((GLM_PLATFORM & GLM_PLATFORM_APPLE) && (GLM_COMPILER & GLM_COMPILER_GCC)) # define GLM_ARCH GLM_ARCH_PURE #elif(((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))) || (GLM_COMPILER & GLM_COMPILER_LLVM_GCC)) -# define GLM_ARCH (GLM_ARCH_PURE \ -| (defined(__AVX2__) ? GLM_ARCH_AVX2 : 0) \ -| (defined(__AVX__) ? GLM_ARCH_AVX : 0) \ -| (defined(__SSE4__) ? GLM_ARCH_SSE4 : 0) \ -| (defined(__SSE3__) ? GLM_ARCH_SSE3 : 0) \ -| (defined(__SSE2__) ? GLM_ARCH_SSE2 : 0)) +# if defined(__AVX2__) +# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) +# elif defined(__AVX__) +# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) +# elif defined(__SSE3__) +# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2) +# elif defined(__SSE2__) +# define GLM_ARCH (GLM_ARCH_SSE2) +# else +# define GLM_ARCH (GLM_ARCH_PURE) +# endif #else # define GLM_ARCH GLM_ARCH_PURE #endif diff --git a/include/glm/detail/type_mat2x3.hpp b/include/glm/detail/type_mat2x3.hpp index 40741282..4b0d7cce 100644 --- a/include/glm/detail/type_mat2x3.hpp +++ b/include/glm/detail/type_mat2x3.hpp @@ -137,7 +137,7 @@ namespace detail T const & s); template <typename T, precision P> - tmat2x3<T, P> operator+ ( + GLM_FUNC_DECL tmat2x3<T, P> operator+ ( tmat2x3<T, P> const & m1, tmat2x3<T, P> const & m2); diff --git a/include/glm/ext.hpp b/include/glm/ext.hpp index 5f39ea2f..6f6e4d20 100644 --- a/include/glm/ext.hpp +++ b/include/glm/ext.hpp @@ -120,7 +120,9 @@ #include "./gtx/rotate_vector.hpp" #include "./gtx/spline.hpp" #include "./gtx/std_based_type.hpp" -#include "./gtx/string_cast.hpp" +#if(!(GLM_COMPILER & GLM_COMPILER_CUDA)) +# include "./gtx/string_cast.hpp" +#endif #include "./gtx/transform.hpp" #include "./gtx/transform2.hpp" #include "./gtx/vec1.hpp" diff --git a/include/glm/gtc/matrix_access.hpp b/include/glm/gtc/matrix_access.hpp index 13201873..5d7480cb 100644 --- a/include/glm/gtc/matrix_access.hpp +++ b/include/glm/gtc/matrix_access.hpp @@ -52,14 +52,14 @@ namespace glm /// Get a specific row of a matrix. /// @see gtc_matrix_access template <typename genType> - typename genType::row_type row( + GLM_FUNC_DECL typename genType::row_type row( genType const & m, length_t const & index); /// Set a specific row to a matrix. /// @see gtc_matrix_access template <typename genType> - genType row( + GLM_FUNC_DECL genType row( genType const & m, length_t const & index, typename genType::row_type const & x); @@ -67,14 +67,14 @@ namespace glm /// Get a specific column of a matrix. /// @see gtc_matrix_access template <typename genType> - typename genType::col_type column( + GLM_FUNC_DECL typename genType::col_type column( genType const & m, length_t const & index); /// Set a specific column to a matrix. /// @see gtc_matrix_access template <typename genType> - genType column( + GLM_FUNC_DECL genType column( genType const & m, length_t const & index, typename genType::col_type const & x); diff --git a/include/glm/gtc/matrix_inverse.hpp b/include/glm/gtc/matrix_inverse.hpp index 62ae35be..05aeb121 100644 --- a/include/glm/gtc/matrix_inverse.hpp +++ b/include/glm/gtc/matrix_inverse.hpp @@ -55,7 +55,7 @@ namespace glm /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate. /// @see gtc_matrix_inverse template <typename genType> - GLM_FUNC_QUALIFIER genType affineInverse(genType const & m); + GLM_FUNC_DECL genType affineInverse(genType const & m); /// Compute the inverse transpose of a matrix. /// @@ -63,7 +63,7 @@ namespace glm /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate. /// @see gtc_matrix_inverse template <typename genType> - GLM_FUNC_QUALIFIER typename genType::value_type inverseTranspose( + GLM_FUNC_DECL typename genType::value_type inverseTranspose( genType const & m); /// @} diff --git a/include/glm/gtc/matrix_transform.inl b/include/glm/gtc/matrix_transform.inl index 32c7e3a9..bafeefa1 100644 --- a/include/glm/gtc/matrix_transform.inl +++ b/include/glm/gtc/matrix_transform.inl @@ -44,27 +44,6 @@ namespace glm return Result; } - - template <typename T, precision P> - GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> translate_slow - ( - detail::tmat4x4<T, P> const & m, - detail::tvec3<T, P> const & v - ) - { - detail::tmat4x4<T, P> Result(T(1)); - Result[3] = detail::tvec4<T, P>(v, T(1)); - return m * Result; - - //detail::tmat4x4<valType> Result(m); - Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3]; - //Result[3][0] = m[0][0] * v[0] + m[1][0] * v[1] + m[2][0] * v[2] + m[3][0]; - //Result[3][1] = m[0][1] * v[0] + m[1][1] * v[1] + m[2][1] * v[2] + m[3][1]; - //Result[3][2] = m[0][2] * v[0] + m[1][2] * v[1] + m[2][2] * v[2] + m[3][2]; - //Result[3][3] = m[0][3] * v[0] + m[1][3] * v[1] + m[2][3] * v[2] + m[3][3]; - //return Result; - } - template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> rotate ( diff --git a/include/glm/gtc/noise.hpp b/include/glm/gtc/noise.hpp index f79c42eb..cf058abd 100644 --- a/include/glm/gtc/noise.hpp +++ b/include/glm/gtc/noise.hpp @@ -57,20 +57,20 @@ namespace glm /// Classic perlin noise. /// @see gtc_noise template <typename T, precision P, template<typename, precision> class vecType> - T perlin( + GLM_FUNC_DECL T perlin( vecType<T, P> const & p); /// Periodic perlin noise. /// @see gtc_noise template <typename T, precision P, template<typename, precision> class vecType> - T perlin( + GLM_FUNC_DECL T perlin( vecType<T, P> const & p, vecType<T, P> const & rep); /// Simplex noise. /// @see gtc_noise template <typename T, precision P, template<typename, precision> class vecType> - T simplex( + GLM_FUNC_DECL T simplex( vecType<T, P> const & p); /// @} diff --git a/include/glm/gtc/packing.inl b/include/glm/gtc/packing.inl index 88d706b6..4619add1 100644 --- a/include/glm/gtc/packing.inl +++ b/include/glm/gtc/packing.inl @@ -141,7 +141,7 @@ namespace detail if(x == 0.0f) return 0; else if(glm::isnan(x)) - return ~0u; + return ~0; else if(glm::isinf(x)) return 0x1f << 6; @@ -153,9 +153,9 @@ namespace detail if(x == 0) return 0.0f; else if(x == ((1 << 11) - 1)) - return ~0u;//NaN + return ~0;//NaN else if(x == (0x1f << 6)) - return ~0u;//Inf + return ~0;//Inf uint result = packed11ToFloat(x); return reinterpret_cast<float&>(result); @@ -164,11 +164,11 @@ namespace detail GLM_FUNC_QUALIFIER glm::uint floatTo10bit(float x) { if(x == 0.0f) - return 0u; + return 0; else if(glm::isnan(x)) - return ~0u; + return ~0; else if(glm::isinf(x)) - return 0x1fu << 5; + return 0x1f << 5; return float2packed10(reinterpret_cast<uint&>(x)); } diff --git a/include/glm/gtc/ulp.inl b/include/glm/gtc/ulp.inl index 80b0d746..252e6638 100644 --- a/include/glm/gtc/ulp.inl +++ b/include/glm/gtc/ulp.inl @@ -194,24 +194,30 @@ namespace detail # pragma warning(pop) #endif -#if((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) -# define GLM_NEXT_AFTER_FLT(x, toward) glm::detail::nextafterf((x), (toward)) -# define GLM_NEXT_AFTER_DBL(x, toward) _nextafter((x), (toward)) -#else -# define GLM_NEXT_AFTER_FLT(x, toward) nextafterf((x), (toward)) -# define GLM_NEXT_AFTER_DBL(x, toward) nextafter((x), (toward)) -#endif - namespace glm { + template <> GLM_FUNC_QUALIFIER float next_float(float const & x) { - return GLM_NEXT_AFTER_FLT(x, std::numeric_limits<float>::max()); +# if((GLM_LANG & GLM_LANG_CXX11_FLAG)) + return std::nextafter(x, std::numeric_limits<float>::max()); +# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) + return detail::nextafterf(x, FLT_MAX); +# else + return nextafterf(x, FLT_MAX); +# endif } + template <> GLM_FUNC_QUALIFIER double next_float(double const & x) { - return GLM_NEXT_AFTER_DBL(x, std::numeric_limits<double>::max()); +# if((GLM_LANG & GLM_LANG_CXX11_FLAG)) + return std::nextafter(x, std::numeric_limits<double>::max()); +# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) + return detail::nextafter(x, std::numeric_limits<double>::max()); +# else + return nextafter(x, DBL_MAX); +# endif } template<typename T, precision P, template<typename, precision> class vecType> @@ -225,12 +231,24 @@ namespace glm GLM_FUNC_QUALIFIER float prev_float(float const & x) { - return GLM_NEXT_AFTER_FLT(x, std::numeric_limits<float>::min()); +# if((GLM_LANG & GLM_LANG_CXX11_FLAG)) + return std::nextafter(x, std::numeric_limits<float>::min()); +# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) + return detail::nextafterf(x, FLT_MIN); +# else + return nextafterf(x, FLT_MIN); +# endif } GLM_FUNC_QUALIFIER double prev_float(double const & x) { - return GLM_NEXT_AFTER_DBL(x, std::numeric_limits<double>::min()); +# if((GLM_LANG & GLM_LANG_CXX11_FLAG)) + return std::nextafter(x, std::numeric_limits<double>::min()); +# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) + return _nextafter(x, DBL_MIN); +# else + return nextafter(x, DBL_MIN); +# endif } template<typename T, precision P, template<typename, precision> class vecType> @@ -255,7 +273,7 @@ namespace glm GLM_FUNC_QUALIFIER vecType<T, P> next_float(vecType<T, P> const & x, vecType<uint, P> const & ulps) { vecType<T, P> Result; - for(uint i = 0; i < Result.length(); ++i) + for(length_t i = 0; i < Result.length(); ++i) Result[i] = next_float(x[i], ulps[i]); return Result; } diff --git a/include/glm/gtx/associated_min_max.hpp b/include/glm/gtx/associated_min_max.hpp index f56e7e9c..8b55e873 100644 --- a/include/glm/gtx/associated_min_max.hpp +++ b/include/glm/gtx/associated_min_max.hpp @@ -53,14 +53,14 @@ namespace glm /// Min comparison between 2 variables /// @see gtx_associated_min_max template<typename genTypeT, typename genTypeU> - genTypeU associatedMin( + GLM_FUNC_DECL genTypeU associatedMin( const genTypeT& x, const genTypeU& a, const genTypeT& y, const genTypeU& b); /// Min comparison between 3 variables /// @see gtx_associated_min_max template<typename genTypeT, typename genTypeU> - genTypeU associatedMin( + GLM_FUNC_DECL genTypeU associatedMin( const genTypeT& x, const genTypeU& a, const genTypeT& y, const genTypeU& b, const genTypeT& z, const genTypeU& c); @@ -68,7 +68,7 @@ namespace glm /// Min comparison between 4 variables /// @see gtx_associated_min_max template<typename genTypeT, typename genTypeU> - genTypeU associatedMin( + GLM_FUNC_DECL genTypeU associatedMin( const genTypeT& x, const genTypeU& a, const genTypeT& y, const genTypeU& b, const genTypeT& z, const genTypeU& c, @@ -77,14 +77,14 @@ namespace glm /// Max comparison between 2 variables /// @see gtx_associated_min_max template<typename genTypeT, typename genTypeU> - genTypeU associatedMax( + GLM_FUNC_DECL genTypeU associatedMax( const genTypeT& x, const genTypeU& a, const genTypeT& y, const genTypeU& b); /// Max comparison between 3 variables /// @see gtx_associated_min_max template<typename genTypeT, typename genTypeU> - genTypeU associatedMax( + GLM_FUNC_DECL genTypeU associatedMax( const genTypeT& x, const genTypeU& a, const genTypeT& y, const genTypeU& b, const genTypeT& z, const genTypeU& c); @@ -92,7 +92,7 @@ namespace glm /// Max comparison between 4 variables /// @see gtx_associated_min_max template<typename genTypeT, typename genTypeU> - genTypeU associatedMax( + GLM_FUNC_DECL genTypeU associatedMax( const genTypeT& x, const genTypeU& a, const genTypeT& y, const genTypeU& b, const genTypeT& z, const genTypeU& c, diff --git a/include/glm/gtx/bit.inl b/include/glm/gtx/bit.inl index 4a20bced..9947bd29 100644 --- a/include/glm/gtx/bit.inl +++ b/include/glm/gtx/bit.inl @@ -312,13 +312,13 @@ namespace glm namespace detail { template <typename PARAM, typename RET> - RET bitfieldInterleave(PARAM x, PARAM y); + GLM_FUNC_DECL RET bitfieldInterleave(PARAM x, PARAM y); template <typename PARAM, typename RET> - RET bitfieldInterleave(PARAM x, PARAM y, PARAM z); + GLM_FUNC_DECL RET bitfieldInterleave(PARAM x, PARAM y, PARAM z); template <typename PARAM, typename RET> - RET bitfieldInterleave(PARAM x, PARAM y, PARAM z, PARAM w); + GLM_FUNC_DECL RET bitfieldInterleave(PARAM x, PARAM y, PARAM z, PARAM w); /* template <typename PARAM, typename RET> @@ -358,7 +358,7 @@ namespace glm } */ template <> - inline glm::uint16 bitfieldInterleave(glm::uint8 x, glm::uint8 y) + GLM_FUNC_QUALIFIER glm::uint16 bitfieldInterleave(glm::uint8 x, glm::uint8 y) { glm::uint16 REG1(x); glm::uint16 REG2(y); @@ -376,7 +376,7 @@ namespace glm } template <> - inline glm::uint32 bitfieldInterleave(glm::uint16 x, glm::uint16 y) + GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave(glm::uint16 x, glm::uint16 y) { glm::uint32 REG1(x); glm::uint32 REG2(y); @@ -397,7 +397,7 @@ namespace glm } template <> - inline glm::uint64 bitfieldInterleave(glm::uint32 x, glm::uint32 y) + GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint32 x, glm::uint32 y) { glm::uint64 REG1(x); glm::uint64 REG2(y); @@ -421,7 +421,63 @@ namespace glm } template <> - inline glm::uint64 bitfieldInterleave(glm::uint32 x, glm::uint32 y, glm::uint32 z) + GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave(glm::uint8 x, glm::uint8 y, glm::uint8 z) + { + glm::uint32 REG1(x); + glm::uint32 REG2(y); + glm::uint32 REG3(z); + + REG1 = ((REG1 << 16) | REG1) & glm::uint32(0x00FF0000FF0000FF); + REG2 = ((REG2 << 16) | REG2) & glm::uint32(0x00FF0000FF0000FF); + REG3 = ((REG3 << 16) | REG3) & glm::uint32(0x00FF0000FF0000FF); + + REG1 = ((REG1 << 8) | REG1) & glm::uint32(0xF00F00F00F00F00F); + REG2 = ((REG2 << 8) | REG2) & glm::uint32(0xF00F00F00F00F00F); + REG3 = ((REG3 << 8) | REG3) & glm::uint32(0xF00F00F00F00F00F); + + REG1 = ((REG1 << 4) | REG1) & glm::uint32(0x30C30C30C30C30C3); + REG2 = ((REG2 << 4) | REG2) & glm::uint32(0x30C30C30C30C30C3); + REG3 = ((REG3 << 4) | REG3) & glm::uint32(0x30C30C30C30C30C3); + + REG1 = ((REG1 << 2) | REG1) & glm::uint32(0x9249249249249249); + REG2 = ((REG2 << 2) | REG2) & glm::uint32(0x9249249249249249); + REG3 = ((REG3 << 2) | REG3) & glm::uint32(0x9249249249249249); + + return REG1 | (REG2 << 1) | (REG3 << 2); + } + + template <> + GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint16 x, glm::uint16 y, glm::uint16 z) + { + glm::uint64 REG1(x); + glm::uint64 REG2(y); + glm::uint64 REG3(z); + + REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFF); + REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFF); + REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFF); + + REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FF); + REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FF); + REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FF); + + REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00F); + REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00F); + REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00F); + + REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3); + REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3); + REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3); + + REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249); + REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249); + REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249); + + return REG1 | (REG2 << 1) | (REG3 << 2); + } + + template <> + GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint32 x, glm::uint32 y, glm::uint32 z) { glm::uint64 REG1(x); glm::uint64 REG2(y); @@ -451,7 +507,33 @@ namespace glm } template <> - inline glm::uint64 bitfieldInterleave(glm::uint16 x, glm::uint16 y, glm::uint16 z, glm::uint16 w) + GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave(glm::uint8 x, glm::uint8 y, glm::uint8 z, glm::uint8 w) + { + glm::uint32 REG1(x); + glm::uint32 REG2(y); + glm::uint32 REG3(z); + glm::uint32 REG4(w); + + REG1 = ((REG1 << 12) | REG1) & glm::uint32(0x000F000F000F000F); + REG2 = ((REG2 << 12) | REG2) & glm::uint32(0x000F000F000F000F); + REG3 = ((REG3 << 12) | REG3) & glm::uint32(0x000F000F000F000F); + REG4 = ((REG4 << 12) | REG4) & glm::uint32(0x000F000F000F000F); + + REG1 = ((REG1 << 6) | REG1) & glm::uint32(0x0303030303030303); + REG2 = ((REG2 << 6) | REG2) & glm::uint32(0x0303030303030303); + REG3 = ((REG3 << 6) | REG3) & glm::uint32(0x0303030303030303); + REG4 = ((REG4 << 6) | REG4) & glm::uint32(0x0303030303030303); + + REG1 = ((REG1 << 3) | REG1) & glm::uint32(0x1111111111111111); + REG2 = ((REG2 << 3) | REG2) & glm::uint32(0x1111111111111111); + REG3 = ((REG3 << 3) | REG3) & glm::uint32(0x1111111111111111); + REG4 = ((REG4 << 3) | REG4) & glm::uint32(0x1111111111111111); + + return REG1 | (REG2 << 1) | (REG3 << 2) | (REG4 << 3); + } + + template <> + GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint16 x, glm::uint16 y, glm::uint16 z, glm::uint16 w) { glm::uint64 REG1(x); glm::uint64 REG2(y); @@ -482,7 +564,7 @@ namespace glm } }//namespace detail - inline int16 bitfieldInterleave(int8 x, int8 y) + GLM_FUNC_QUALIFIER int16 bitfieldInterleave(int8 x, int8 y) { union sign8 { @@ -503,12 +585,12 @@ namespace glm return result.i; } - inline uint16 bitfieldInterleave(uint8 x, uint8 y) + GLM_FUNC_QUALIFIER uint16 bitfieldInterleave(uint8 x, uint8 y) { return detail::bitfieldInterleave<uint8, uint16>(x, y); } - inline int32 bitfieldInterleave(int16 x, int16 y) + GLM_FUNC_QUALIFIER int32 bitfieldInterleave(int16 x, int16 y) { union sign16 { @@ -529,12 +611,12 @@ namespace glm return result.i; } - inline uint32 bitfieldInterleave(uint16 x, uint16 y) + GLM_FUNC_QUALIFIER uint32 bitfieldInterleave(uint16 x, uint16 y) { return detail::bitfieldInterleave<uint16, uint32>(x, y); } - inline int64 bitfieldInterleave(int32 x, int32 y) + GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int32 x, int32 y) { union sign32 { @@ -555,12 +637,12 @@ namespace glm return result.i; } - inline uint64 bitfieldInterleave(uint32 x, uint32 y) + GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint32 x, uint32 y) { return detail::bitfieldInterleave<uint32, uint64>(x, y); } - inline int32 bitfieldInterleave(int8 x, int8 y, int8 z) + GLM_FUNC_QUALIFIER int32 bitfieldInterleave(int8 x, int8 y, int8 z) { union sign8 { @@ -582,12 +664,12 @@ namespace glm return result.i; } - inline uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z) + GLM_FUNC_QUALIFIER uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z) { return detail::bitfieldInterleave<uint8, uint32>(x, y, z); } - inline int64 bitfieldInterleave(int16 x, int16 y, int16 z) + GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int16 x, int16 y, int16 z) { union sign16 { @@ -609,12 +691,12 @@ namespace glm return result.i; } - inline uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z) + GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z) { return detail::bitfieldInterleave<uint32, uint64>(x, y, z); } - inline int64 bitfieldInterleave(int32 x, int32 y, int32 z) + GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int32 x, int32 y, int32 z) { union sign16 { @@ -636,12 +718,12 @@ namespace glm return result.i; } - inline uint64 bitfieldInterleave(uint32 x, uint32 y, uint32 z) + GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint32 x, uint32 y, uint32 z) { return detail::bitfieldInterleave<uint32, uint64>(x, y, z); } - inline int32 bitfieldInterleave(int8 x, int8 y, int8 z, int8 w) + GLM_FUNC_QUALIFIER int32 bitfieldInterleave(int8 x, int8 y, int8 z, int8 w) { union sign8 { @@ -659,17 +741,17 @@ namespace glm sign_y.i = y; sign_z.i = z; sign_w.i = w; - result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u); + result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u, sign_w.u); return result.i; } - inline uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z, uint8 w) + GLM_FUNC_QUALIFIER uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z, uint8 w) { - return detail::bitfieldInterleave<uint8, uint32>(x, y, z); + return detail::bitfieldInterleave<uint8, uint32>(x, y, z, w); } - inline int64 bitfieldInterleave(int16 x, int16 y, int16 z, int16 w) + GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int16 x, int16 y, int16 z, int16 w) { union sign16 { @@ -687,12 +769,12 @@ namespace glm sign_y.i = y; sign_z.i = z; sign_w.i = w; - result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u); + result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u, sign_w.u); return result.i; } - inline uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z, uint16 w) + GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z, uint16 w) { return detail::bitfieldInterleave<uint16, uint64>(x, y, z, w); } diff --git a/include/glm/gtx/closest_point.hpp b/include/glm/gtx/closest_point.hpp index 4540451a..790f6768 100644 --- a/include/glm/gtx/closest_point.hpp +++ b/include/glm/gtx/closest_point.hpp @@ -53,7 +53,7 @@ namespace glm /// Find the point on a straight line which is the closet of a point. /// @see gtx_closest_point template <typename T, precision P> - detail::tvec3<T, P> closestPointOnLine( + GLM_FUNC_DECL detail::tvec3<T, P> closestPointOnLine( detail::tvec3<T, P> const & point, detail::tvec3<T, P> const & a, detail::tvec3<T, P> const & b); diff --git a/include/glm/gtx/color_space.hpp b/include/glm/gtx/color_space.hpp index 13a32a19..3df160bb 100644 --- a/include/glm/gtx/color_space.hpp +++ b/include/glm/gtx/color_space.hpp @@ -53,39 +53,39 @@ namespace glm /// Converts a color from HSV color space to its color in RGB color space. /// @see gtx_color_space template <typename T, precision P> - detail::tvec3<T, P> rgbColor( + GLM_FUNC_DECL detail::tvec3<T, P> rgbColor( detail::tvec3<T, P> const & hsvValue); /// Converts a color from RGB color space to its color in HSV color space. /// @see gtx_color_space template <typename T, precision P> - detail::tvec3<T, P> hsvColor( + GLM_FUNC_DECL detail::tvec3<T, P> hsvColor( detail::tvec3<T, P> const & rgbValue); /// Build a saturation matrix. /// @see gtx_color_space template <typename T, precision P> - detail::tmat4x4<T, P> saturation( + GLM_FUNC_DECL detail::tmat4x4<T, P> saturation( T const s); /// Modify the saturation of a color. /// @see gtx_color_space template <typename T, precision P> - detail::tvec3<T, P> saturation( + GLM_FUNC_DECL detail::tvec3<T, P> saturation( T const s, detail::tvec3<T, P> const & color); /// Modify the saturation of a color. /// @see gtx_color_space template <typename T, precision P> - detail::tvec4<T, P> saturation( + GLM_FUNC_DECL detail::tvec4<T, P> saturation( T const s, detail::tvec4<T, P> const & color); /// Compute color luminosity associating ratios (0.33, 0.59, 0.11) to RGB canals. /// @see gtx_color_space template <typename T, precision P> - T luminosity( + GLM_FUNC_DECL T luminosity( detail::tvec3<T, P> const & color); /// @} diff --git a/include/glm/gtx/color_space_YCoCg.hpp b/include/glm/gtx/color_space_YCoCg.hpp index 65465679..a5ce30a6 100644 --- a/include/glm/gtx/color_space_YCoCg.hpp +++ b/include/glm/gtx/color_space_YCoCg.hpp @@ -53,27 +53,27 @@ namespace glm /// Convert a color from RGB color space to YCoCg color space. /// @see gtx_color_space_YCoCg template <typename T, precision P> - detail::tvec3<T, P> rgb2YCoCg( + GLM_FUNC_DECL detail::tvec3<T, P> rgb2YCoCg( detail::tvec3<T, P> const & rgbColor); /// Convert a color from YCoCg color space to RGB color space. /// @see gtx_color_space_YCoCg template <typename T, precision P> - detail::tvec3<T, P> YCoCg2rgb( + GLM_FUNC_DECL detail::tvec3<T, P> YCoCg2rgb( detail::tvec3<T, P> const & YCoCgColor); /// Convert a color from RGB color space to YCoCgR color space. /// @see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range" /// @see gtx_color_space_YCoCg template <typename T, precision P> - detail::tvec3<T, P> rgb2YCoCgR( + GLM_FUNC_DECL detail::tvec3<T, P> rgb2YCoCgR( detail::tvec3<T, P> const & rgbColor); /// Convert a color from YCoCgR color space to RGB color space. /// @see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range" /// @see gtx_color_space_YCoCg template <typename T, precision P> - detail::tvec3<T, P> YCoCgR2rgb( + GLM_FUNC_DECL detail::tvec3<T, P> YCoCgR2rgb( detail::tvec3<T, P> const & YCoCgColor); /// @} diff --git a/include/glm/gtx/compatibility.hpp b/include/glm/gtx/compatibility.hpp index 19b519c5..eb3b49c4 100644 --- a/include/glm/gtx/compatibility.hpp +++ b/include/glm/gtx/compatibility.hpp @@ -82,10 +82,10 @@ namespace glm template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec3<T, P> atan2(const detail::tvec3<T, P>& x, const detail::tvec3<T, P>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec4<T, P> atan2(const detail::tvec4<T, P>& x, const detail::tvec4<T, P>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) - template <typename genType> bool isfinite(genType const & x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) - template <typename T, precision P> detail::tvec2<bool, P> isfinite(const detail::tvec2<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) - template <typename T, precision P> detail::tvec3<bool, P> isfinite(const detail::tvec3<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) - template <typename T, precision P> detail::tvec4<bool, P> isfinite(const detail::tvec4<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) + template <typename genType> GLM_FUNC_DECL bool isfinite(genType const & x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) + template <typename T, precision P> GLM_FUNC_DECL detail::tvec2<bool, P> isfinite(const detail::tvec2<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) + template <typename T, precision P> GLM_FUNC_DECL detail::tvec3<bool, P> isfinite(const detail::tvec3<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) + template <typename T, precision P> GLM_FUNC_DECL detail::tvec4<bool, P> isfinite(const detail::tvec4<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) typedef bool bool1; //!< \brief boolean type with 1 component. (From GLM_GTX_compatibility extension) typedef detail::tvec2<bool, highp> bool2; //!< \brief boolean type with 2 components. (From GLM_GTX_compatibility extension) diff --git a/include/glm/gtx/compatibility.inl b/include/glm/gtx/compatibility.inl index 6a411d23..7b41c162 100644 --- a/include/glm/gtx/compatibility.inl +++ b/include/glm/gtx/compatibility.inl @@ -14,16 +14,14 @@ namespace glm GLM_FUNC_QUALIFIER bool isfinite( genType const & x) { -# if(GLM_COMPILER & GLM_COMPILER_VC) +# if(GLM_LANG & GLM_LANG_CXX11_FLAG) + return std::isfinite(x) != 0; +# elif(GLM_COMPILER & GLM_COMPILER_VC) return _finite(x); -# elif(GLM_COMPILER & GLM_COMPILER_GCC) -# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) - return _isfinite(x) != 0; -# else - return std::isfinite(x) != 0; -# endif +# elif(GLM_COMPILER & GLM_COMPILER_GCC && GLM_PLATFORM & GLM_PLATFORM_ANDROID) + return _isfinite(x) != 0; # else - return std::isfinite(x) != 0; + return isfinite(x) != 0; # endif } diff --git a/include/glm/gtx/component_wise.hpp b/include/glm/gtx/component_wise.hpp index 34eee7e4..edfc0548 100644 --- a/include/glm/gtx/component_wise.hpp +++ b/include/glm/gtx/component_wise.hpp @@ -53,25 +53,25 @@ namespace glm /// Add all vector components together. /// @see gtx_component_wise template <typename genType> - typename genType::value_type compAdd( + GLM_FUNC_DECL typename genType::value_type compAdd( genType const & v); /// Multiply all vector components together. /// @see gtx_component_wise template <typename genType> - typename genType::value_type compMul( + GLM_FUNC_DECL typename genType::value_type compMul( genType const & v); /// Find the minimum value between single vector components. /// @see gtx_component_wise template <typename genType> - typename genType::value_type compMin( + GLM_FUNC_DECL typename genType::value_type compMin( genType const & v); /// Find the maximum value between single vector components. /// @see gtx_component_wise template <typename genType> - typename genType::value_type compMax( + GLM_FUNC_DECL typename genType::value_type compMax( genType const & v); /// @} diff --git a/include/glm/gtx/dual_quaternion.hpp b/include/glm/gtx/dual_quaternion.hpp index 5a497ca5..2c07dd05 100644 --- a/include/glm/gtx/dual_quaternion.hpp +++ b/include/glm/gtx/dual_quaternion.hpp @@ -66,71 +66,71 @@ namespace detail GLM_FUNC_DECL GLM_CONSTEXPR int length() const; // Constructors - tdualquat(); - explicit tdualquat(tquat<T, P> const & real); - tdualquat(tquat<T, P> const & real,tquat<T, P> const & dual); - tdualquat(tquat<T, P> const & orientation,tvec3<T, P> const& translation); + GLM_FUNC_DECL tdualquat(); + GLM_FUNC_DECL explicit tdualquat(tquat<T, P> const & real); + GLM_FUNC_DECL tdualquat(tquat<T, P> const & real,tquat<T, P> const & dual); + GLM_FUNC_DECL tdualquat(tquat<T, P> const & orientation,tvec3<T, P> const& translation); ////////////////////////////////////////////////////////////// // tdualquat conversions - explicit tdualquat(tmat2x4<T, P> const & holder_mat); - explicit tdualquat(tmat3x4<T, P> const & aug_mat); + GLM_FUNC_DECL explicit tdualquat(tmat2x4<T, P> const & holder_mat); + GLM_FUNC_DECL explicit tdualquat(tmat3x4<T, P> const & aug_mat); // Accesses - part_type & operator[](int i); - part_type const & operator[](int i) const; + GLM_FUNC_DECL part_type & operator[](int i); + GLM_FUNC_DECL part_type const & operator[](int i) const; // Operators - tdualquat<T, P> & operator*=(T const & s); - tdualquat<T, P> & operator/=(T const & s); + GLM_FUNC_DECL tdualquat<T, P> & operator*=(T const & s); + GLM_FUNC_DECL tdualquat<T, P> & operator/=(T const & s); }; template <typename T, precision P> - detail::tquat<T, P> operator- ( + GLM_FUNC_DECL detail::tquat<T, P> operator- ( detail::tquat<T, P> const & q); template <typename T, precision P> - detail::tdualquat<T, P> operator+ ( + GLM_FUNC_DECL detail::tdualquat<T, P> operator+ ( detail::tdualquat<T, P> const & q, detail::tdualquat<T, P> const & p); template <typename T, precision P> - detail::tdualquat<T, P> operator* ( + GLM_FUNC_DECL detail::tdualquat<T, P> operator* ( detail::tdualquat<T, P> const & q, detail::tdualquat<T, P> const & p); template <typename T, precision P> - detail::tvec3<T, P> operator* ( + GLM_FUNC_DECL detail::tvec3<T, P> operator* ( detail::tquat<T, P> const & q, detail::tvec3<T, P> const & v); template <typename T, precision P> - detail::tvec3<T, P> operator* ( + GLM_FUNC_DECL detail::tvec3<T, P> operator* ( detail::tvec3<T, P> const & v, detail::tquat<T, P> const & q); template <typename T, precision P> - detail::tvec4<T, P> operator* ( + GLM_FUNC_DECL detail::tvec4<T, P> operator* ( detail::tquat<T, P> const & q, detail::tvec4<T, P> const & v); template <typename T, precision P> - detail::tvec4<T, P> operator* ( + GLM_FUNC_DECL detail::tvec4<T, P> operator* ( detail::tvec4<T, P> const & v, detail::tquat<T, P> const & q); template <typename T, precision P> - detail::tdualquat<T, P> operator* ( + GLM_FUNC_DECL detail::tdualquat<T, P> operator* ( detail::tdualquat<T, P> const & q, T const & s); template <typename T, precision P> - detail::tdualquat<T, P> operator* ( + GLM_FUNC_DECL detail::tdualquat<T, P> operator* ( T const & s, detail::tdualquat<T, P> const & q); template <typename T, precision P> - detail::tdualquat<T, P> operator/ ( + GLM_FUNC_DECL detail::tdualquat<T, P> operator/ ( detail::tdualquat<T, P> const & q, T const & s); } //namespace detail @@ -142,14 +142,14 @@ namespace detail /// /// @see gtc_dual_quaternion template <typename T, precision P> - detail::tdualquat<T, P> normalize( + GLM_FUNC_DECL detail::tdualquat<T, P> normalize( detail::tdualquat<T, P> const & q); /// Returns the linear interpolation of two dual quaternion. /// /// @see gtc_dual_quaternion template <typename T, precision P> - detail::tdualquat<T, P> lerp( + GLM_FUNC_DECL detail::tdualquat<T, P> lerp( detail::tdualquat<T, P> const & x, detail::tdualquat<T, P> const & y, T const & a); @@ -158,7 +158,7 @@ namespace detail /// /// @see gtc_dual_quaternion template <typename T, precision P> - detail::tdualquat<T, P> inverse( + GLM_FUNC_DECL detail::tdualquat<T, P> inverse( detail::tdualquat<T, P> const & q); /* @@ -175,28 +175,28 @@ namespace detail /// /// @see gtc_dual_quaternion template <typename T, precision P> - detail::tmat2x4<T, P> mat2x4_cast( + GLM_FUNC_DECL detail::tmat2x4<T, P> mat2x4_cast( detail::tdualquat<T, P> const & x); /// Converts a quaternion to a 3 * 4 matrix. /// /// @see gtc_dual_quaternion template <typename T, precision P> - detail::tmat3x4<T, P> mat3x4_cast( + GLM_FUNC_DECL detail::tmat3x4<T, P> mat3x4_cast( detail::tdualquat<T, P> const & x); /// Converts a 2 * 4 matrix (matrix which holds real and dual parts) to a quaternion. /// /// @see gtc_dual_quaternion template <typename T, precision P> - detail::tdualquat<T, P> dualquat_cast( + GLM_FUNC_DECL detail::tdualquat<T, P> dualquat_cast( detail::tmat2x4<T, P> const & x); /// Converts a 3 * 4 matrix (augmented matrix rotation + translation) to a quaternion. /// /// @see gtc_dual_quaternion template <typename T, precision P> - detail::tdualquat<T, P> dualquat_cast( + GLM_FUNC_DECL detail::tdualquat<T, P> dualquat_cast( detail::tmat3x4<T, P> const & x); diff --git a/include/glm/gtx/euler_angles.hpp b/include/glm/gtx/euler_angles.hpp index 6a751f61..8ae50c1a 100644 --- a/include/glm/gtx/euler_angles.hpp +++ b/include/glm/gtx/euler_angles.hpp @@ -54,67 +54,67 @@ namespace glm /// Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle X. /// @see gtx_euler_angles template <typename T> - detail::tmat4x4<T, defaultp> eulerAngleX( + GLM_FUNC_DECL detail::tmat4x4<T, defaultp> eulerAngleX( T const & angleX); /// Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle Y. /// @see gtx_euler_angles template <typename T> - detail::tmat4x4<T, defaultp> eulerAngleY( + GLM_FUNC_DECL detail::tmat4x4<T, defaultp> eulerAngleY( T const & angleY); /// Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle Z. /// @see gtx_euler_angles template <typename T> - detail::tmat4x4<T, defaultp> eulerAngleZ( + GLM_FUNC_DECL detail::tmat4x4<T, defaultp> eulerAngleZ( T const & angleZ); /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Y). /// @see gtx_euler_angles template <typename T> - detail::tmat4x4<T, defaultp> eulerAngleXY( + GLM_FUNC_DECL detail::tmat4x4<T, defaultp> eulerAngleXY( T const & angleX, T const & angleY); /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X). /// @see gtx_euler_angles template <typename T> - detail::tmat4x4<T, defaultp> eulerAngleYX( + GLM_FUNC_DECL detail::tmat4x4<T, defaultp> eulerAngleYX( T const & angleY, T const & angleX); /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Z). /// @see gtx_euler_angles template <typename T> - detail::tmat4x4<T, defaultp> eulerAngleXZ( + GLM_FUNC_DECL detail::tmat4x4<T, defaultp> eulerAngleXZ( T const & angleX, T const & angleZ); /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * X). /// @see gtx_euler_angles template <typename T> - detail::tmat4x4<T, defaultp> eulerAngleZX( + GLM_FUNC_DECL detail::tmat4x4<T, defaultp> eulerAngleZX( T const & angle, T const & angleX); /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * Z). /// @see gtx_euler_angles template <typename T> - detail::tmat4x4<T, defaultp> eulerAngleYZ( + GLM_FUNC_DECL detail::tmat4x4<T, defaultp> eulerAngleYZ( T const & angleY, T const & angleZ); /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * Y). /// @see gtx_euler_angles template <typename T> - detail::tmat4x4<T, defaultp> eulerAngleZY( + GLM_FUNC_DECL detail::tmat4x4<T, defaultp> eulerAngleZY( T const & angleZ, T const & angleY); /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z). /// @see gtx_euler_angles template <typename T> - detail::tmat4x4<T, defaultp> eulerAngleYXZ( + GLM_FUNC_DECL detail::tmat4x4<T, defaultp> eulerAngleYXZ( T const & yaw, T const & pitch, T const & roll); @@ -122,7 +122,7 @@ namespace glm /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z). /// @see gtx_euler_angles template <typename T> - detail::tmat4x4<T, defaultp> yawPitchRoll( + GLM_FUNC_DECL detail::tmat4x4<T, defaultp> yawPitchRoll( T const & yaw, T const & pitch, T const & roll); @@ -130,22 +130,22 @@ namespace glm /// Creates a 2D 2 * 2 rotation matrix from an euler angle. /// @see gtx_euler_angles template <typename T> - detail::tmat2x2<T, defaultp> orientate2(T const & angle); + GLM_FUNC_DECL detail::tmat2x2<T, defaultp> orientate2(T const & angle); /// Creates a 2D 4 * 4 homogeneous rotation matrix from an euler angle. /// @see gtx_euler_angles template <typename T> - detail::tmat3x3<T, defaultp> orientate3(T const & angle); + GLM_FUNC_DECL detail::tmat3x3<T, defaultp> orientate3(T const & angle); /// Creates a 3D 3 * 3 rotation matrix from euler angles (Y * X * Z). /// @see gtx_euler_angles template <typename T, precision P> - detail::tmat3x3<T, P> orientate3(detail::tvec3<T, P> const & angles); + GLM_FUNC_DECL detail::tmat3x3<T, P> orientate3(detail::tvec3<T, P> const & angles); /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z). /// @see gtx_euler_angles template <typename T, precision P> - detail::tmat4x4<T, P> orientate4(detail::tvec3<T, P> const & angles); + GLM_FUNC_DECL detail::tmat4x4<T, P> orientate4(detail::tvec3<T, P> const & angles); /// @} }//namespace glm diff --git a/include/glm/gtx/euler_angles.inl b/include/glm/gtx/euler_angles.inl index 93aef084..33cd6b6d 100644 --- a/include/glm/gtx/euler_angles.inl +++ b/include/glm/gtx/euler_angles.inl @@ -70,10 +70,10 @@ namespace glm T sinY = glm::sin(angleY); return detail::tmat4x4<T, defaultp>( - cosY, -sinX * sinY, cosX * sinY, T(0), - T(0), cosX, sinX, T(0), - -sinY, -sinX * cosY, cosX * cosY, T(0), - T(0), T(0), T(0), T(1)); + cosY, -sinX * -sinY, cosX * -sinY, T(0), + T(0), cosX, sinX, T(0), + sinY, -sinX * cosY, cosX * cosY, T(0), + T(0), T(0), T(0), T(1)); } template <typename T> @@ -89,10 +89,10 @@ namespace glm T sinY = glm::sin(angleY); return detail::tmat4x4<T, defaultp>( - cosY, T(0), sinY, T(0), - -sinX * sinY, cosX, sinX * cosY, T(0), - -cosX * sinY, -sinX, cosX * cosY, T(0), - T(0), T(0), T(0), T(1)); + cosY, 0, -sinY, T(0), + sinY * sinX, cosX, cosY * sinX, T(0), + sinY * cosX, -sinX, cosY * cosX, T(0), + T(0), T(0), T(0), T(1)); } template <typename T> @@ -115,6 +115,26 @@ namespace glm return eulerAngleZ(angleZ) * eulerAngleX(angleX); } + template <typename T> + GLM_FUNC_QUALIFIER detail::tmat4x4<T, defaultp> eulerAngleYZ + ( + T const & angleY, + T const & angleZ + ) + { + return eulerAngleY(angleY) * eulerAngleZ(angleZ); + } + + template <typename T> + GLM_FUNC_QUALIFIER detail::tmat4x4<T, defaultp> eulerAngleZY + ( + T const & angleZ, + T const & angleY + ) + { + return eulerAngleZ(angleZ) * eulerAngleY(angleY); + } + template <typename T> GLM_FUNC_QUALIFIER detail::tmat4x4<T, defaultp> eulerAngleYXZ ( diff --git a/include/glm/gtx/extented_min_max.hpp b/include/glm/gtx/extented_min_max.hpp index 62901c09..17ca6551 100644 --- a/include/glm/gtx/extented_min_max.hpp +++ b/include/glm/gtx/extented_min_max.hpp @@ -54,31 +54,23 @@ namespace glm /// Return the minimum component-wise values of 3 inputs /// @see gtx_extented_min_max template <typename T> - T min( + GLM_FUNC_DECL T min( T const & x, T const & y, T const & z); /// Return the minimum component-wise values of 3 inputs /// @see gtx_extented_min_max - template - < - typename T, - template <typename> class C - > - C<T> min( + template <typename T, template <typename> class C> + GLM_FUNC_DECL C<T> min( C<T> const & x, typename C<T>::T const & y, typename C<T>::T const & z); /// Return the minimum component-wise values of 3 inputs /// @see gtx_extented_min_max - template - < - typename T, - template <typename> class C - > - C<T> min( + template <typename T, template <typename> class C> + GLM_FUNC_DECL C<T> min( C<T> const & x, C<T> const & y, C<T> const & z); @@ -86,7 +78,7 @@ namespace glm /// Return the minimum component-wise values of 4 inputs /// @see gtx_extented_min_max template <typename T> - T min( + GLM_FUNC_DECL T min( T const & x, T const & y, T const & z, @@ -94,12 +86,8 @@ namespace glm /// Return the minimum component-wise values of 4 inputs /// @see gtx_extented_min_max - template - < - typename T, - template <typename> class C - > - C<T> min( + template <typename T, template <typename> class C> + GLM_FUNC_DECL C<T> min( C<T> const & x, typename C<T>::T const & y, typename C<T>::T const & z, @@ -107,12 +95,8 @@ namespace glm /// Return the minimum component-wise values of 4 inputs /// @see gtx_extented_min_max - template - < - typename T, - template <typename> class C - > - C<T> min( + template <typename T, template <typename> class C> + GLM_FUNC_DECL C<T> min( C<T> const & x, C<T> const & y, C<T> const & z, @@ -121,31 +105,23 @@ namespace glm /// Return the maximum component-wise values of 3 inputs /// @see gtx_extented_min_max template <typename T> - T max( + GLM_FUNC_DECL T max( T const & x, T const & y, T const & z); /// Return the maximum component-wise values of 3 inputs /// @see gtx_extented_min_max - template - < - typename T, - template <typename> class C - > - C<T> max( + template <typename T, template <typename> class C> + GLM_FUNC_DECL C<T> max( C<T> const & x, typename C<T>::T const & y, typename C<T>::T const & z); /// Return the maximum component-wise values of 3 inputs /// @see gtx_extented_min_max - template - < - typename T, - template <typename> class C - > - C<T> max( + template <typename T, template <typename> class C> + GLM_FUNC_DECL C<T> max( C<T> const & x, C<T> const & y, C<T> const & z); @@ -153,7 +129,7 @@ namespace glm /// Return the maximum component-wise values of 4 inputs /// @see gtx_extented_min_max template <typename T> - T max( + GLM_FUNC_DECL T max( T const & x, T const & y, T const & z, @@ -161,12 +137,8 @@ namespace glm /// Return the maximum component-wise values of 4 inputs /// @see gtx_extented_min_max - template - < - typename T, - template <typename> class C - > - C<T> max( + template <typename T, template <typename> class C> + GLM_FUNC_DECL C<T> max( C<T> const & x, typename C<T>::T const & y, typename C<T>::T const & z, @@ -174,12 +146,8 @@ namespace glm /// Return the maximum component-wise values of 4 inputs /// @see gtx_extented_min_max - template - < - typename T, - template <typename> class C - > - C<T> max( + template <typename T, template <typename> class C> + GLM_FUNC_DECL C<T> max( C<T> const & x, C<T> const & y, C<T> const & z, diff --git a/include/glm/gtx/extented_min_max.inl b/include/glm/gtx/extented_min_max.inl index 5e045e01..0edb0079 100644 --- a/include/glm/gtx/extented_min_max.inl +++ b/include/glm/gtx/extented_min_max.inl @@ -18,11 +18,7 @@ namespace glm return glm::min(glm::min(x, y), z); } - template - < - typename T, - template <typename> class C - > + template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> min ( C<T> const & x, @@ -33,11 +29,7 @@ namespace glm return glm::min(glm::min(x, y), z); } - template - < - typename T, - template <typename> class C - > + template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> min ( C<T> const & x, @@ -60,11 +52,7 @@ namespace glm return glm::min(glm::min(x, y), glm::min(z, w)); } - template - < - typename T, - template <typename> class C - > + template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> min ( C<T> const & x, @@ -76,11 +64,7 @@ namespace glm return glm::min(glm::min(x, y), glm::min(z, w)); } - template - < - typename T, - template <typename> class C - > + template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> min ( C<T> const & x, @@ -101,11 +85,7 @@ namespace glm return glm::max(glm::max(x, y), z); } - template - < - typename T, - template <typename> class C - > + template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> max ( C<T> const & x, @@ -116,11 +96,7 @@ namespace glm return glm::max(glm::max(x, y), z); } - template - < - typename T, - template <typename> class C - > + template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> max ( C<T> const & x, @@ -143,11 +119,7 @@ namespace glm return glm::max(glm::max(x, y), glm::max(z, w)); } - template - < - typename T, - template <typename> class C - > + template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> max ( C<T> const & x, @@ -159,11 +131,7 @@ namespace glm return glm::max(glm::max(x, y), glm::max(z, w)); } - template - < - typename T, - template <typename> class C - > + template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> max ( C<T> const & x, diff --git a/include/glm/gtx/fast_exponential.hpp b/include/glm/gtx/fast_exponential.hpp index 2a2674ab..7e950fb2 100644 --- a/include/glm/gtx/fast_exponential.hpp +++ b/include/glm/gtx/fast_exponential.hpp @@ -54,41 +54,41 @@ namespace glm /// Faster than the common pow function but less accurate. /// @see gtx_fast_exponential template <typename genType> - genType fastPow( + GLM_FUNC_DECL genType fastPow( genType const & x, genType const & y); /// Faster than the common pow function but less accurate. /// @see gtx_fast_exponential template <typename genTypeT, typename genTypeU> - genTypeT fastPow( + GLM_FUNC_DECL genTypeT fastPow( genTypeT const & x, genTypeU const & y); /// Faster than the common exp function but less accurate. /// @see gtx_fast_exponential template <typename T> - T fastExp(const T& x); + GLM_FUNC_DECL T fastExp(const T& x); /// Faster than the common log function but less accurate. /// @see gtx_fast_exponential template <typename T> - T fastLog(const T& x); + GLM_FUNC_DECL T fastLog(const T& x); /// Faster than the common exp2 function but less accurate. /// @see gtx_fast_exponential template <typename T> - T fastExp2(const T& x); + GLM_FUNC_DECL T fastExp2(const T& x); /// Faster than the common log2 function but less accurate. /// @see gtx_fast_exponential template <typename T> - T fastLog2(const T& x); + GLM_FUNC_DECL T fastLog2(const T& x); /// Faster than the common ln function but less accurate. /// @see gtx_fast_exponential template <typename T> - T fastLn(const T& x); + GLM_FUNC_DECL T fastLn(const T& x); /// @} }//namespace glm diff --git a/include/glm/gtx/fast_square_root.inl b/include/glm/gtx/fast_square_root.inl index 87d52876..9b8e02db 100644 --- a/include/glm/gtx/fast_square_root.inl +++ b/include/glm/gtx/fast_square_root.inl @@ -27,13 +27,23 @@ namespace glm template <> GLM_FUNC_QUALIFIER float fastInverseSqrt<float>(float const & x) { - return detail::compute_inversesqrt<detail::tvec1, float, lowp>::call(detail::tvec1<float, lowp>(x)).x; +# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6 + detail::tvec1<T, P> tmp(detail::compute_inversesqrt<detail::tvec1, float, lowp>::call(detail::tvec1<float, lowp>(x))); + return tmp.x; +# else + return detail::compute_inversesqrt<detail::tvec1, float, lowp>::call(detail::tvec1<float, lowp>(x)).x; +# endif } template <> GLM_FUNC_QUALIFIER double fastInverseSqrt<double>(double const & x) { - return detail::compute_inversesqrt<detail::tvec1, double, lowp>::call(detail::tvec1<double, lowp>(x)).x; +# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6 + detail::tvec1<T, P> tmp(detail::compute_inversesqrt<detail::tvec1, double, lowp>::call(detail::tvec1<double, lowp>(x))); + return tmp.x; +# else + return detail::compute_inversesqrt<detail::tvec1, double, lowp>::call(detail::tvec1<double, lowp>(x)).x; +# endif } template <template <class, precision> class vecType, typename T, precision P> diff --git a/include/glm/gtx/fast_trigonometry.hpp b/include/glm/gtx/fast_trigonometry.hpp index 8dd14677..01910d53 100644 --- a/include/glm/gtx/fast_trigonometry.hpp +++ b/include/glm/gtx/fast_trigonometry.hpp @@ -53,44 +53,44 @@ namespace glm //! Faster than the common sin function but less accurate. //! Defined between -2pi and 2pi. //! From GLM_GTX_fast_trigonometry extension. - template <typename T> - T fastSin(const T& angle); + template <typename T> + GLM_FUNC_DECL T fastSin(const T& angle); - //! Faster than the common cos function but less accurate. + //! Faster than the common cos function but less accurate. //! Defined between -2pi and 2pi. //! From GLM_GTX_fast_trigonometry extension. template <typename T> - T fastCos(const T& angle); + GLM_FUNC_DECL T fastCos(const T& angle); - //! Faster than the common tan function but less accurate. + //! Faster than the common tan function but less accurate. //! Defined between -2pi and 2pi. //! From GLM_GTX_fast_trigonometry extension. template <typename T> - T fastTan(const T& angle); + GLM_FUNC_DECL T fastTan(const T& angle); - //! Faster than the common asin function but less accurate. + //! Faster than the common asin function but less accurate. //! Defined between -2pi and 2pi. //! From GLM_GTX_fast_trigonometry extension. template <typename T> - T fastAsin(const T& angle); + GLM_FUNC_DECL T fastAsin(const T& angle); //! Faster than the common acos function but less accurate. //! Defined between -2pi and 2pi. //! From GLM_GTX_fast_trigonometry extension. - template <typename T> - T fastAcos(const T& angle); + template <typename T> + GLM_FUNC_DECL T fastAcos(const T& angle); //! Faster than the common atan function but less accurate. //! Defined between -2pi and 2pi. //! From GLM_GTX_fast_trigonometry extension. template <typename T> - T fastAtan(const T& y, const T& x); + GLM_FUNC_DECL T fastAtan(const T& y, const T& x); //! Faster than the common atan function but less accurate. //! Defined between -2pi and 2pi. //! From GLM_GTX_fast_trigonometry extension. - template <typename T> - T fastAtan(const T& angle); + template <typename T> + GLM_FUNC_DECL T fastAtan(const T& angle); /// @} }//namespace glm diff --git a/include/glm/gtx/gradient_paint.hpp b/include/glm/gtx/gradient_paint.hpp index 2105a75e..248a25ee 100644 --- a/include/glm/gtx/gradient_paint.hpp +++ b/include/glm/gtx/gradient_paint.hpp @@ -54,7 +54,7 @@ namespace glm /// Return a color from a radial gradient. /// @see - gtx_gradient_paint template <typename T, precision P> - T radialGradient( + GLM_FUNC_DECL T radialGradient( detail::tvec2<T, P> const & Center, T const & Radius, detail::tvec2<T, P> const & Focal, @@ -63,7 +63,7 @@ namespace glm /// Return a color from a linear gradient. /// @see - gtx_gradient_paint template <typename T, precision P> - T linearGradient( + GLM_FUNC_DECL T linearGradient( detail::tvec2<T, P> const & Point0, detail::tvec2<T, P> const & Point1, detail::tvec2<T, P> const & Position); diff --git a/include/glm/gtx/gradient_paint.inl b/include/glm/gtx/gradient_paint.inl index b2f6f491..65117ab3 100644 --- a/include/glm/gtx/gradient_paint.inl +++ b/include/glm/gtx/gradient_paint.inl @@ -10,7 +10,7 @@ namespace glm { template <typename T, precision P> - T radialGradient + GLM_FUNC_QUALIFIER T radialGradient ( detail::tvec2<T, P> const & Center, T const & Radius, @@ -30,7 +30,7 @@ namespace glm } template <typename T, precision P> - T linearGradient + GLM_FUNC_QUALIFIER T linearGradient ( detail::tvec2<T, P> const & Point0, detail::tvec2<T, P> const & Point1, diff --git a/include/glm/gtx/handed_coordinate_space.hpp b/include/glm/gtx/handed_coordinate_space.hpp index e97df2ff..3c24fc35 100644 --- a/include/glm/gtx/handed_coordinate_space.hpp +++ b/include/glm/gtx/handed_coordinate_space.hpp @@ -53,7 +53,7 @@ namespace glm //! Return if a trihedron right handed or not. //! From GLM_GTX_handed_coordinate_space extension. template <typename T, precision P> - bool rightHanded( + GLM_FUNC_DECL bool rightHanded( detail::tvec3<T, P> const & tangent, detail::tvec3<T, P> const & binormal, detail::tvec3<T, P> const & normal); @@ -61,7 +61,7 @@ namespace glm //! Return if a trihedron left handed or not. //! From GLM_GTX_handed_coordinate_space extension. template <typename T, precision P> - bool leftHanded( + GLM_FUNC_DECL bool leftHanded( detail::tvec3<T, P> const & tangent, detail::tvec3<T, P> const & binormal, detail::tvec3<T, P> const & normal); diff --git a/include/glm/gtx/int_10_10_10_2.hpp b/include/glm/gtx/int_10_10_10_2.hpp index 6dc8d70f..70973722 100644 --- a/include/glm/gtx/int_10_10_10_2.hpp +++ b/include/glm/gtx/int_10_10_10_2.hpp @@ -35,7 +35,7 @@ namespace glm { //! Deprecated, use packUnorm3x10_1x2 instead. - GLM_DEPRECATED dword uint10_10_10_2_cast(glm::vec4 const & v); + GLM_DEPRECATED GLM_FUNC_DECL dword uint10_10_10_2_cast(glm::vec4 const & v); }//namespace glm diff --git a/include/glm/gtx/integer.hpp b/include/glm/gtx/integer.hpp index 92ab35a8..21193ff0 100644 --- a/include/glm/gtx/integer.hpp +++ b/include/glm/gtx/integer.hpp @@ -52,29 +52,29 @@ namespace glm //! Returns x raised to the y power. //! From GLM_GTX_integer extension. - int pow(int x, int y); + GLM_FUNC_DECL int pow(int x, int y); //! Returns the positive square root of x. //! From GLM_GTX_integer extension. - int sqrt(int x); + GLM_FUNC_DECL int sqrt(int x); //! Returns the log2 of x. Can be reliably using to compute mipmap count from the texture size. //! From GLM_GTX_integer extension. template <typename genIUType> - genIUType log2(genIUType x); + GLM_FUNC_DECL genIUType log2(genIUType x); //! Returns the floor log2 of x. //! From GLM_GTX_integer extension. - unsigned int floor_log2(unsigned int x); + GLM_FUNC_DECL unsigned int floor_log2(unsigned int x); //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. //! From GLM_GTX_integer extension. - int mod(int x, int y); + GLM_FUNC_DECL int mod(int x, int y); //! Return the factorial value of a number (!12 max, integer only) //! From GLM_GTX_integer extension. template <typename genType> - genType factorial(genType const & x); + GLM_FUNC_DECL genType factorial(genType const & x); //! 32bit signed integer. //! From GLM_GTX_integer extension. @@ -82,19 +82,19 @@ namespace glm //! Returns x raised to the y power. //! From GLM_GTX_integer extension. - uint pow(uint x, uint y); + GLM_FUNC_DECL uint pow(uint x, uint y); //! Returns the positive square root of x. //! From GLM_GTX_integer extension. - uint sqrt(uint x); + GLM_FUNC_DECL uint sqrt(uint x); //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. //! From GLM_GTX_integer extension. - uint mod(uint x, uint y); + GLM_FUNC_DECL uint mod(uint x, uint y); //! Returns the number of leading zeros. //! From GLM_GTX_integer extension. - uint nlz(uint x); + GLM_FUNC_DECL uint nlz(uint x); /// @} }//namespace glm diff --git a/include/glm/gtx/intersect.hpp b/include/glm/gtx/intersect.hpp index 22224960..a924cafe 100644 --- a/include/glm/gtx/intersect.hpp +++ b/include/glm/gtx/intersect.hpp @@ -56,7 +56,7 @@ namespace glm //! Ray direction and plane normal must be unit length. //! From GLM_GTX_intersect extension. template <typename genType> - bool intersectRayPlane( + GLM_FUNC_DECL bool intersectRayPlane( genType const & orig, genType const & dir, genType const & planeOrig, genType const & planeNormal, typename genType::value_type & intersectionDistance); @@ -64,7 +64,7 @@ namespace glm //! Compute the intersection of a ray and a triangle. //! From GLM_GTX_intersect extension. template <typename genType> - bool intersectRayTriangle( + GLM_FUNC_DECL bool intersectRayTriangle( genType const & orig, genType const & dir, genType const & vert0, genType const & vert1, genType const & vert2, genType & baryPosition); @@ -72,7 +72,7 @@ namespace glm //! Compute the intersection of a line and a triangle. //! From GLM_GTX_intersect extension. template <typename genType> - bool intersectLineTriangle( + GLM_FUNC_DECL bool intersectLineTriangle( genType const & orig, genType const & dir, genType const & vert0, genType const & vert1, genType const & vert2, genType & position); @@ -81,7 +81,7 @@ namespace glm //! The ray direction vector is unit length. //! From GLM_GTX_intersect extension. template <typename genType> - bool intersectRaySphere( + GLM_FUNC_DECL bool intersectRaySphere( genType const & rayStarting, genType const & rayNormalizedDirection, genType const & sphereCenter, typename genType::value_type const sphereRadiusSquered, typename genType::value_type & intersectionDistance); @@ -89,7 +89,7 @@ namespace glm //! Compute the intersection of a ray and a sphere. //! From GLM_GTX_intersect extension. template <typename genType> - bool intersectRaySphere( + GLM_FUNC_DECL bool intersectRaySphere( genType const & rayStarting, genType const & rayNormalizedDirection, genType const & sphereCenter, const typename genType::value_type sphereRadius, genType & intersectionPosition, genType & intersectionNormal); @@ -97,7 +97,7 @@ namespace glm //! Compute the intersection of a line and a sphere. //! From GLM_GTX_intersect extension template <typename genType> - bool intersectLineSphere( + GLM_FUNC_DECL bool intersectLineSphere( genType const & point0, genType const & point1, genType const & sphereCenter, typename genType::value_type sphereRadius, genType & intersectionPosition1, genType & intersectionNormal1, diff --git a/include/glm/gtx/log_base.hpp b/include/glm/gtx/log_base.hpp index ea20f2c2..032a6fca 100644 --- a/include/glm/gtx/log_base.hpp +++ b/include/glm/gtx/log_base.hpp @@ -53,7 +53,7 @@ namespace glm //! Logarithm for any base. //! From GLM_GTX_log_base. template <typename genType> - genType log( + GLM_FUNC_DECL genType log( genType const & x, genType const & base); diff --git a/include/glm/gtx/matrix_cross_product.hpp b/include/glm/gtx/matrix_cross_product.hpp index 14a3f20e..5c982636 100644 --- a/include/glm/gtx/matrix_cross_product.hpp +++ b/include/glm/gtx/matrix_cross_product.hpp @@ -54,13 +54,13 @@ namespace glm //! Build a cross product matrix. //! From GLM_GTX_matrix_cross_product extension. template <typename T, precision P> - detail::tmat3x3<T, P> matrixCross3( + GLM_FUNC_DECL detail::tmat3x3<T, P> matrixCross3( detail::tvec3<T, P> const & x); //! Build a cross product matrix. //! From GLM_GTX_matrix_cross_product extension. template <typename T, precision P> - detail::tmat4x4<T, P> matrixCross4( + GLM_FUNC_DECL detail::tmat4x4<T, P> matrixCross4( detail::tvec3<T, P> const & x); /// @} diff --git a/include/glm/gtx/matrix_interpolation.hpp b/include/glm/gtx/matrix_interpolation.hpp index 6dddfec5..069033bd 100644 --- a/include/glm/gtx/matrix_interpolation.hpp +++ b/include/glm/gtx/matrix_interpolation.hpp @@ -53,7 +53,7 @@ namespace glm /// Get the axis and angle of the rotation from a matrix. /// From GLM_GTX_matrix_interpolation extension. template <typename T, precision P> - void axisAngle( + GLM_FUNC_DECL void axisAngle( detail::tmat4x4<T, P> const & mat, detail::tvec3<T, P> & axis, T & angle); @@ -61,21 +61,21 @@ namespace glm /// Build a matrix from axis and angle. /// From GLM_GTX_matrix_interpolation extension. template <typename T, precision P> - detail::tmat4x4<T, P> axisAngleMatrix( + GLM_FUNC_DECL detail::tmat4x4<T, P> axisAngleMatrix( detail::tvec3<T, P> const & axis, T const angle); /// Extracts the rotation part of a matrix. /// From GLM_GTX_matrix_interpolation extension. template <typename T, precision P> - detail::tmat4x4<T, P> extractMatrixRotation( + GLM_FUNC_DECL detail::tmat4x4<T, P> extractMatrixRotation( detail::tmat4x4<T, P> const & mat); /// Build a interpolation of 4 * 4 matrixes. /// From GLM_GTX_matrix_interpolation extension. /// Warning! works only with rotation and/or translation matrixes, scale will generate unexpected results. template <typename T, precision P> - detail::tmat4x4<T, P> interpolate( + GLM_FUNC_DECL detail::tmat4x4<T, P> interpolate( detail::tmat4x4<T, P> const & m1, detail::tmat4x4<T, P> const & m2, T const delta); diff --git a/include/glm/gtx/matrix_major_storage.hpp b/include/glm/gtx/matrix_major_storage.hpp index 40b9e8cc..22fa3476 100644 --- a/include/glm/gtx/matrix_major_storage.hpp +++ b/include/glm/gtx/matrix_major_storage.hpp @@ -54,20 +54,20 @@ namespace glm //! Build a row major matrix from row vectors. //! From GLM_GTX_matrix_major_storage extension. template <typename T, precision P> - detail::tmat2x2<T, P> rowMajor2( + GLM_FUNC_DECL detail::tmat2x2<T, P> rowMajor2( detail::tvec2<T, P> const & v1, detail::tvec2<T, P> const & v2); //! Build a row major matrix from other matrix. //! From GLM_GTX_matrix_major_storage extension. template <typename T, precision P> - detail::tmat2x2<T, P> rowMajor2( + GLM_FUNC_DECL detail::tmat2x2<T, P> rowMajor2( detail::tmat2x2<T, P> const & m); //! Build a row major matrix from row vectors. //! From GLM_GTX_matrix_major_storage extension. template <typename T, precision P> - detail::tmat3x3<T, P> rowMajor3( + GLM_FUNC_DECL detail::tmat3x3<T, P> rowMajor3( detail::tvec3<T, P> const & v1, detail::tvec3<T, P> const & v2, detail::tvec3<T, P> const & v3); @@ -75,13 +75,13 @@ namespace glm //! Build a row major matrix from other matrix. //! From GLM_GTX_matrix_major_storage extension. template <typename T, precision P> - detail::tmat3x3<T, P> rowMajor3( + GLM_FUNC_DECL detail::tmat3x3<T, P> rowMajor3( detail::tmat3x3<T, P> const & m); //! Build a row major matrix from row vectors. //! From GLM_GTX_matrix_major_storage extension. template <typename T, precision P> - detail::tmat4x4<T, P> rowMajor4( + GLM_FUNC_DECL detail::tmat4x4<T, P> rowMajor4( detail::tvec4<T, P> const & v1, detail::tvec4<T, P> const & v2, detail::tvec4<T, P> const & v3, @@ -90,26 +90,26 @@ namespace glm //! Build a row major matrix from other matrix. //! From GLM_GTX_matrix_major_storage extension. template <typename T, precision P> - detail::tmat4x4<T, P> rowMajor4( + GLM_FUNC_DECL detail::tmat4x4<T, P> rowMajor4( detail::tmat4x4<T, P> const & m); //! Build a column major matrix from column vectors. //! From GLM_GTX_matrix_major_storage extension. template <typename T, precision P> - detail::tmat2x2<T, P> colMajor2( + GLM_FUNC_DECL detail::tmat2x2<T, P> colMajor2( detail::tvec2<T, P> const & v1, detail::tvec2<T, P> const & v2); //! Build a column major matrix from other matrix. //! From GLM_GTX_matrix_major_storage extension. template <typename T, precision P> - detail::tmat2x2<T, P> colMajor2( + GLM_FUNC_DECL detail::tmat2x2<T, P> colMajor2( detail::tmat2x2<T, P> const & m); //! Build a column major matrix from column vectors. //! From GLM_GTX_matrix_major_storage extension. template <typename T, precision P> - detail::tmat3x3<T, P> colMajor3( + GLM_FUNC_DECL detail::tmat3x3<T, P> colMajor3( detail::tvec3<T, P> const & v1, detail::tvec3<T, P> const & v2, detail::tvec3<T, P> const & v3); @@ -117,13 +117,13 @@ namespace glm //! Build a column major matrix from other matrix. //! From GLM_GTX_matrix_major_storage extension. template <typename T, precision P> - detail::tmat3x3<T, P> colMajor3( + GLM_FUNC_DECL detail::tmat3x3<T, P> colMajor3( detail::tmat3x3<T, P> const & m); //! Build a column major matrix from column vectors. //! From GLM_GTX_matrix_major_storage extension. template <typename T, precision P> - detail::tmat4x4<T, P> colMajor4( + GLM_FUNC_DECL detail::tmat4x4<T, P> colMajor4( detail::tvec4<T, P> const & v1, detail::tvec4<T, P> const & v2, detail::tvec4<T, P> const & v3, @@ -132,7 +132,7 @@ namespace glm //! Build a column major matrix from other matrix. //! From GLM_GTX_matrix_major_storage extension. template <typename T, precision P> - detail::tmat4x4<T, P> colMajor4( + GLM_FUNC_DECL detail::tmat4x4<T, P> colMajor4( detail::tmat4x4<T, P> const & m); /// @} diff --git a/include/glm/gtx/matrix_operation.hpp b/include/glm/gtx/matrix_operation.hpp index 93676cd5..8f810f94 100644 --- a/include/glm/gtx/matrix_operation.hpp +++ b/include/glm/gtx/matrix_operation.hpp @@ -53,55 +53,55 @@ namespace glm //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. template <typename T, precision P> - detail::tmat2x2<T, P> diagonal2x2( + GLM_FUNC_DECL detail::tmat2x2<T, P> diagonal2x2( detail::tvec2<T, P> const & v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. template <typename T, precision P> - detail::tmat2x3<T, P> diagonal2x3( + GLM_FUNC_DECL detail::tmat2x3<T, P> diagonal2x3( detail::tvec2<T, P> const & v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. template <typename T, precision P> - detail::tmat2x4<T, P> diagonal2x4( + GLM_FUNC_DECL detail::tmat2x4<T, P> diagonal2x4( detail::tvec2<T, P> const & v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. template <typename T, precision P> - detail::tmat3x2<T, P> diagonal3x2( + GLM_FUNC_DECL detail::tmat3x2<T, P> diagonal3x2( detail::tvec2<T, P> const & v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. template <typename T, precision P> - detail::tmat3x3<T, P> diagonal3x3( + GLM_FUNC_DECL detail::tmat3x3<T, P> diagonal3x3( detail::tvec3<T, P> const & v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. template <typename T, precision P> - detail::tmat3x4<T, P> diagonal3x4( + GLM_FUNC_DECL detail::tmat3x4<T, P> diagonal3x4( detail::tvec3<T, P> const & v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. template <typename T, precision P> - detail::tmat4x2<T, P> diagonal4x2( + GLM_FUNC_DECL detail::tmat4x2<T, P> diagonal4x2( detail::tvec2<T, P> const & v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. template <typename T, precision P> - detail::tmat4x3<T, P> diagonal4x3( + GLM_FUNC_DECL detail::tmat4x3<T, P> diagonal4x3( detail::tvec3<T, P> const & v); //! Build a diagonal matrix. //! From GLM_GTX_matrix_operation extension. template <typename T, precision P> - detail::tmat4x4<T, P> diagonal4x4( + GLM_FUNC_DECL detail::tmat4x4<T, P> diagonal4x4( detail::tvec4<T, P> const & v); /// @} diff --git a/include/glm/gtx/matrix_query.hpp b/include/glm/gtx/matrix_query.hpp index d8a05248..9ef11a5e 100644 --- a/include/glm/gtx/matrix_query.hpp +++ b/include/glm/gtx/matrix_query.hpp @@ -56,42 +56,42 @@ namespace glm /// Return whether a matrix a null matrix. /// From GLM_GTX_matrix_query extension. template<typename T, precision P> - bool isNull(detail::tmat2x2<T, P> const & m, T const & epsilon); + GLM_FUNC_DECL bool isNull(detail::tmat2x2<T, P> const & m, T const & epsilon); /// Return whether a matrix a null matrix. /// From GLM_GTX_matrix_query extension. template<typename T, precision P> - bool isNull(detail::tmat3x3<T, P> const & m, T const & epsilon); + GLM_FUNC_DECL bool isNull(detail::tmat3x3<T, P> const & m, T const & epsilon); /// Return whether a matrix is a null matrix. /// From GLM_GTX_matrix_query extension. template<typename T, precision P> - bool isNull(detail::tmat4x4<T, P> const & m, T const & epsilon); + GLM_FUNC_DECL bool isNull(detail::tmat4x4<T, P> const & m, T const & epsilon); /// Return whether a matrix is an identity matrix. /// From GLM_GTX_matrix_query extension. template<typename T, precision P, template <typename, precision> class matType> - bool isIdentity(matType<T, P> const & m, T const & epsilon); + GLM_FUNC_DECL bool isIdentity(matType<T, P> const & m, T const & epsilon); /// Return whether a matrix is a normalized matrix. /// From GLM_GTX_matrix_query extension. template<typename T, precision P> - bool isNormalized(detail::tmat2x2<T, P> const & m, T const & epsilon); + GLM_FUNC_DECL bool isNormalized(detail::tmat2x2<T, P> const & m, T const & epsilon); /// Return whether a matrix is a normalized matrix. /// From GLM_GTX_matrix_query extension. template<typename T, precision P> - bool isNormalized(detail::tmat3x3<T, P> const & m, T const & epsilon); + GLM_FUNC_DECL bool isNormalized(detail::tmat3x3<T, P> const & m, T const & epsilon); /// Return whether a matrix is a normalized matrix. /// From GLM_GTX_matrix_query extension. template<typename T, precision P> - bool isNormalized(detail::tmat4x4<T, P> const & m, T const & epsilon); + GLM_FUNC_DECL bool isNormalized(detail::tmat4x4<T, P> const & m, T const & epsilon); /// Return whether a matrix is an orthonormalized matrix. /// From GLM_GTX_matrix_query extension. template<typename T, precision P, template <typename, precision> class matType> - bool isOrthogonal(matType<T, P> const & m, T const & epsilon); + GLM_FUNC_DECL bool isOrthogonal(matType<T, P> const & m, T const & epsilon); /// @} }//namespace glm diff --git a/include/glm/gtx/matrix_query.inl b/include/glm/gtx/matrix_query.inl index 77f4b22b..3ef56063 100644 --- a/include/glm/gtx/matrix_query.inl +++ b/include/glm/gtx/matrix_query.inl @@ -13,10 +13,7 @@ namespace glm { template<typename T, precision P> - GLM_FUNC_QUALIFIER bool isNull - ( - detail::tmat2x2<T, P> const & m, - T const & epsilon) + GLM_FUNC_QUALIFIER bool isNull(detail::tmat2x2<T, P> const & m, T const & epsilon) { bool result = true; for(length_t i = 0; result && i < 2 ; ++i) @@ -25,11 +22,7 @@ namespace glm } template<typename T, precision P> - GLM_FUNC_QUALIFIER bool isNull - ( - detail::tmat3x3<T, P> const & m, - T const & epsilon - ) + GLM_FUNC_QUALIFIER bool isNull(detail::tmat3x3<T, P> const & m, T const & epsilon) { bool result = true; for(length_t i = 0; result && i < 3 ; ++i) @@ -38,11 +31,7 @@ namespace glm } template<typename T, precision P> - GLM_FUNC_QUALIFIER bool isNull - ( - detail::tmat4x4<T, P> const & m, - T const & epsilon - ) + GLM_FUNC_QUALIFIER bool isNull(detail::tmat4x4<T, P> const & m, T const & epsilon) { bool result = true; for(length_t i = 0; result && i < 4 ; ++i) @@ -51,11 +40,7 @@ namespace glm } template<typename T, precision P, template <typename, precision> class matType> - GLM_FUNC_QUALIFIER bool isIdentity - ( - matType<T, P> const & m, - T const & epsilon - ) + GLM_FUNC_QUALIFIER bool isIdentity(matType<T, P> const & m, T const & epsilon) { bool result = true; for(length_t i(0); result && i < m[0].length(); ++i) @@ -71,11 +56,7 @@ namespace glm } template<typename T, precision P> - GLM_FUNC_QUALIFIER bool isNormalized - ( - detail::tmat2x2<T, P> const & m, - T const & epsilon - ) + GLM_FUNC_QUALIFIER bool isNormalized(detail::tmat2x2<T, P> const & m, T const & epsilon) { bool result(true); for(length_t i(0); result && i < m.length(); ++i) @@ -91,11 +72,7 @@ namespace glm } template<typename T, precision P> - GLM_FUNC_QUALIFIER bool isNormalized - ( - detail::tmat3x3<T, P> const & m, - T const & epsilon - ) + GLM_FUNC_QUALIFIER bool isNormalized(detail::tmat3x3<T, P> const & m, T const & epsilon) { bool result(true); for(length_t i(0); result && i < m.length(); ++i) @@ -111,11 +88,7 @@ namespace glm } template<typename T, precision P> - GLM_FUNC_QUALIFIER bool isNormalized - ( - detail::tmat4x4<T, P> const & m, - T const & epsilon - ) + GLM_FUNC_QUALIFIER bool isNormalized(detail::tmat4x4<T, P> const & m, T const & epsilon) { bool result(true); for(length_t i(0); result && i < m.length(); ++i) @@ -131,11 +104,7 @@ namespace glm } template<typename T, precision P, template <typename, precision> class matType> - GLM_FUNC_QUALIFIER bool isOrthogonal - ( - matType<T, P> const & m, - T const & epsilon - ) + GLM_FUNC_QUALIFIER bool isOrthogonal(matType<T, P> const & m, T const & epsilon) { bool result(true); for(length_t i(0); result && i < m.length() - 1; ++i) diff --git a/include/glm/gtx/matrix_transform_2d.hpp b/include/glm/gtx/matrix_transform_2d.hpp new file mode 100644 index 00000000..b2f4cd2a --- /dev/null +++ b/include/glm/gtx/matrix_transform_2d.hpp @@ -0,0 +1,105 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2014 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. +/// +/// 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 gtx_matrix_transform_2d +/// @file glm/gtx/matrix_transform_2d.hpp +/// @date 2014-02-20 +/// @author Miguel Ángel Pérez Martínez +/// +/// @see core (dependence) +/// +/// @defgroup gtx_matrix_transform_2d GLM_GTX_matrix_transform_2d +/// @ingroup gtx +/// +/// @brief Defines functions that generate common 2d transformation matrices. +/// +/// <glm/gtx/matrix_transform_2d.hpp> need to be included to use these functionalities. +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef GLM_GTX_matrix_transform_2d +#define GLM_GTX_matrix_transform_2d + +// Dependency: +#include "../mat3x3.hpp" +#include "../vec2.hpp" + + +#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) +# pragma message("GLM: GLM_GTX_matrix_transform_2d extension included") +#endif + +namespace glm +{ + /// @addtogroup gtx_matrix_transform_2d + /// @{ + + /// Builds a translation 3 * 3 matrix created from a vector of 2 components. + /// + /// @param m Input matrix multiplied by this translation matrix. + /// @param v Coordinates of a translation vector. + template <typename T, precision P> + GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> translate( + detail::tmat3x3<T, P> const & m, + detail::tvec2<T, P> const & v); + + /// Builds a rotation 3 * 3 matrix created from an angle. + /// + /// @param m Input matrix multiplied by this translation matrix. + /// @param angle Rotation angle expressed in radians if GLM_FORCE_RADIANS is defined or degrees otherwise. + template <typename T, precision P> + GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> rotate( + detail::tmat3x3<T, P> const & m, + T const & angle); + + /// Builds a scale 3 * 3 matrix created from a vector of 2 components. + /// + /// @param m Input matrix multiplied by this translation matrix. + /// @param v Coordinates of a scale vector. + template <typename T, precision P> + GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> scale( + detail::tmat3x3<T, P> const & m, + detail::tvec2<T, P> const & v); + + /// Builds an horizontal (parallel to the x axis) shear 3 * 3 matrix. + /// + /// @param m Input matrix multiplied by this translation matrix. + /// @param y Shear factor. + template <typename T, precision P> + GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> shearX( + detail::tmat3x3<T, P> const & m, + T const & y); + + /// Builds a vertical (parallel to the y axis) shear 3 * 3 matrix. + /// + /// @param m Input matrix multiplied by this translation matrix. + /// @param x Shear factor. + template <typename T, precision P> + GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> shearY( + detail::tmat3x3<T, P> const & m, + T const & x); + + /// @} +}//namespace glm + +#include "matrix_transform_2d.inl" + +#endif//GLM_GTX_matrix_transform_2d diff --git a/include/glm/gtx/matrix_transform_2d.inl b/include/glm/gtx/matrix_transform_2d.inl new file mode 100644 index 00000000..8be55c46 --- /dev/null +++ b/include/glm/gtx/matrix_transform_2d.inl @@ -0,0 +1,97 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2014 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. +/// +/// 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 gtx_matrix_transform_2d +/// @file glm/gtc/matrix_transform_2d.inl +/// @date 2014-02-20 +/// @author Miguel Ángel Pérez Martínez +/////////////////////////////////////////////////////////////////////////////////// + +#include "../trigonometric.hpp" + +namespace glm +{ + + template <typename T, precision P> + GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> translate( + detail::tmat3x3<T, P> const & m, + detail::tvec2<T, P> const & v) + { + detail::tmat3x3<T, P> Result(m); + Result[2] = m[0] * v[0] + m[1] * v[1] + m[2]; + return Result; + } + + + template <typename T, precision P> + GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> rotate( + detail::tmat3x3<T, P> const & m, + T const & angle) + { + #ifdef GLM_FORCE_RADIANS + T a = angle; + #else + T a = radians(angle); + #endif + T c = cos(a); + T s = sin(a); + + detail::tmat3x3<T, P> Result(detail::tmat3x3<T, P>::_null); + Result[0] = m[0] * c + m[1] * s; + Result[1] = m[0] * -s + m[1] * c; + Result[2] = m[2]; + return Result; + } + + template <typename T, precision P> + GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> scale( + detail::tmat3x3<T, P> const & m, + detail::tvec2<T, P> const & v) + { + detail::tmat3x3<T, P> Result(detail::tmat3x3<T, P>::_null); + Result[0] = m[0] * v[0]; + Result[1] = m[1] * v[1]; + Result[2] = m[2]; + return Result; + } + + template <typename T, precision P> + GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> shearX( + detail::tmat3x3<T, P> const & m, + T const & y) + { + detail::tmat3x3<T, P> Result(); + Result[0][1] = y; + return m * Result; + } + + template <typename T, precision P> + GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> shearY( + detail::tmat3x3<T, P> const & m, + T const & x) + { + detail::tmat3x3<T, P> Result(); + Result[1][0] = x; + return m * Result; + } + +}//namespace glm diff --git a/include/glm/gtx/mixed_product.hpp b/include/glm/gtx/mixed_product.hpp index 6226a515..b71e5583 100644 --- a/include/glm/gtx/mixed_product.hpp +++ b/include/glm/gtx/mixed_product.hpp @@ -52,7 +52,7 @@ namespace glm /// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension) template <typename T, precision P> - T mixedProduct( + GLM_FUNC_DECL T mixedProduct( detail::tvec3<T, P> const & v1, detail::tvec3<T, P> const & v2, detail::tvec3<T, P> const & v3); diff --git a/include/glm/gtx/multiple.hpp b/include/glm/gtx/multiple.hpp index d3c1e52f..6493e6e2 100644 --- a/include/glm/gtx/multiple.hpp +++ b/include/glm/gtx/multiple.hpp @@ -59,7 +59,7 @@ namespace glm /// /// @see gtx_multiple template <typename genType> - genType higherMultiple( + GLM_FUNC_DECL genType higherMultiple( genType const & Source, genType const & Multiple); @@ -71,7 +71,7 @@ namespace glm /// /// @see gtx_multiple template <typename genType> - genType lowerMultiple( + GLM_FUNC_DECL genType lowerMultiple( genType const & Source, genType const & Multiple); diff --git a/include/glm/gtx/norm.hpp b/include/glm/gtx/norm.hpp index caea6e36..0deb096b 100644 --- a/include/glm/gtx/norm.hpp +++ b/include/glm/gtx/norm.hpp @@ -55,59 +55,59 @@ namespace glm //! Returns the squared length of x. //! From GLM_GTX_norm extension. template <typename T> - T length2( + GLM_FUNC_DECL T length2( T const & x); //! Returns the squared length of x. //! From GLM_GTX_norm extension. template <typename genType> - typename genType::value_type length2( + GLM_FUNC_DECL typename genType::value_type length2( genType const & x); //! Returns the squared distance between p0 and p1, i.e., length(p0 - p1). //! From GLM_GTX_norm extension. template <typename T> - T distance2( + GLM_FUNC_DECL T distance2( T const & p0, T const & p1); //! Returns the squared distance between p0 and p1, i.e., length(p0 - p1). //! From GLM_GTX_norm extension. template <typename genType> - typename genType::value_type distance2( + GLM_FUNC_DECL typename genType::value_type distance2( genType const & p0, genType const & p1); //! Returns the L1 norm between x and y. //! From GLM_GTX_norm extension. template <typename T, precision P> - T l1Norm( + GLM_FUNC_DECL T l1Norm( detail::tvec3<T, P> const & x, detail::tvec3<T, P> const & y); //! Returns the L1 norm of v. //! From GLM_GTX_norm extension. template <typename T, precision P> - T l1Norm( + GLM_FUNC_DECL T l1Norm( detail::tvec3<T, P> const & v); //! Returns the L2 norm between x and y. //! From GLM_GTX_norm extension. template <typename T, precision P> - T l2Norm( + GLM_FUNC_DECL T l2Norm( detail::tvec3<T, P> const & x, detail::tvec3<T, P> const & y); //! Returns the L2 norm of v. //! From GLM_GTX_norm extension. template <typename T, precision P> - T l2Norm( + GLM_FUNC_DECL T l2Norm( detail::tvec3<T, P> const & x); //! Returns the L norm between x and y. //! From GLM_GTX_norm extension. template <typename T, precision P> - T lxNorm( + GLM_FUNC_DECL T lxNorm( detail::tvec3<T, P> const & x, detail::tvec3<T, P> const & y, unsigned int Depth); @@ -115,7 +115,7 @@ namespace glm //! Returns the L norm of v. //! From GLM_GTX_norm extension. template <typename T, precision P> - T lxNorm( + GLM_FUNC_DECL T lxNorm( detail::tvec3<T, P> const & x, unsigned int Depth); diff --git a/include/glm/gtx/normal.hpp b/include/glm/gtx/normal.hpp index f29b1415..254f0e78 100644 --- a/include/glm/gtx/normal.hpp +++ b/include/glm/gtx/normal.hpp @@ -53,8 +53,8 @@ namespace glm //! Computes triangle normal from triangle points. //! From GLM_GTX_normal extension. - template <typename T, precision P> - detail::tvec3<T, P> triangleNormal( + template <typename T, precision P> + GLM_FUNC_DECL detail::tvec3<T, P> triangleNormal( detail::tvec3<T, P> const & p1, detail::tvec3<T, P> const & p2, detail::tvec3<T, P> const & p3); diff --git a/include/glm/gtx/normalize_dot.hpp b/include/glm/gtx/normalize_dot.hpp index ded0c219..6cab4de3 100644 --- a/include/glm/gtx/normalize_dot.hpp +++ b/include/glm/gtx/normalize_dot.hpp @@ -56,7 +56,7 @@ namespace glm //! It's faster that dot(normalize(x), normalize(y)). //! From GLM_GTX_normalize_dot extension. template <typename genType> - typename genType::value_type normalizeDot( + GLM_FUNC_DECL typename genType::value_type normalizeDot( genType const & x, genType const & y); @@ -64,7 +64,7 @@ namespace glm //! Faster that dot(fastNormalize(x), fastNormalize(y)). //! From GLM_GTX_normalize_dot extension. template <typename genType> - typename genType::value_type fastNormalizeDot( + GLM_FUNC_DECL typename genType::value_type fastNormalizeDot( genType const & x, genType const & y); diff --git a/include/glm/gtx/optimum_pow.hpp b/include/glm/gtx/optimum_pow.hpp index 009f5e36..052ded62 100644 --- a/include/glm/gtx/optimum_pow.hpp +++ b/include/glm/gtx/optimum_pow.hpp @@ -54,36 +54,36 @@ namespace gtx //! Returns x raised to the power of 2. //! From GLM_GTX_optimum_pow extension. template <typename genType> - genType pow2(const genType& x); + GLM_FUNC_DECL genType pow2(const genType& x); //! Returns x raised to the power of 3. //! From GLM_GTX_optimum_pow extension. template <typename genType> - genType pow3(const genType& x); + GLM_FUNC_DECL genType pow3(const genType& x); //! Returns x raised to the power of 4. //! From GLM_GTX_optimum_pow extension. template <typename genType> - genType pow4(const genType& x); + GLM_FUNC_DECL genType pow4(const genType& x); //! Checks if the parameter is a power of 2 number. //! From GLM_GTX_optimum_pow extension. - bool powOfTwo(int num); + GLM_FUNC_DECL bool powOfTwo(int num); //! Checks to determine if the parameter component are power of 2 numbers. //! From GLM_GTX_optimum_pow extension. template <precision P> - detail::tvec2<bool, P> powOfTwo(detail::tvec2<int, P> const & x); + GLM_FUNC_DECL detail::tvec2<bool, P> powOfTwo(detail::tvec2<int, P> const & x); //! Checks to determine if the parameter component are power of 2 numbers. //! From GLM_GTX_optimum_pow extension. template <precision P> - detail::tvec3<bool, P> powOfTwo(detail::tvec3<int, P> const & x); + GLM_FUNC_DECL detail::tvec3<bool, P> powOfTwo(detail::tvec3<int, P> const & x); //! Checks to determine if the parameter component are power of 2 numbers. //! From GLM_GTX_optimum_pow extension. template <precision P> - detail::tvec4<bool, P> powOfTwo(detail::tvec4<int, P> const & x); + GLM_FUNC_DECL detail::tvec4<bool, P> powOfTwo(detail::tvec4<int, P> const & x); /// @} }//namespace gtx diff --git a/include/glm/gtx/orthonormalize.hpp b/include/glm/gtx/orthonormalize.hpp index 2cd4c06a..b0b89881 100644 --- a/include/glm/gtx/orthonormalize.hpp +++ b/include/glm/gtx/orthonormalize.hpp @@ -54,13 +54,13 @@ namespace glm //! Returns the orthonormalized matrix of m. //! From GLM_GTX_orthonormalize extension. template <typename T, precision P> - detail::tmat3x3<T, P> orthonormalize( + GLM_FUNC_DECL detail::tmat3x3<T, P> orthonormalize( const detail::tmat3x3<T, P>& m); - //! Orthonormalizes x according y. + //! Orthonormalizes x according y. //! From GLM_GTX_orthonormalize extension. template <typename T, precision P> - detail::tvec3<T, P> orthonormalize( + GLM_FUNC_DECL detail::tvec3<T, P> orthonormalize( const detail::tvec3<T, P>& x, const detail::tvec3<T, P>& y); diff --git a/include/glm/gtx/perpendicular.hpp b/include/glm/gtx/perpendicular.hpp index 7f13b9b3..c9bb681c 100644 --- a/include/glm/gtx/perpendicular.hpp +++ b/include/glm/gtx/perpendicular.hpp @@ -55,7 +55,7 @@ namespace glm //! Projects x a perpendicular axis of Normal. //! From GLM_GTX_perpendicular extension. template <typename vecType> - vecType perp( + GLM_FUNC_DECL vecType perp( vecType const & x, vecType const & Normal); diff --git a/include/glm/gtx/polar_coordinates.hpp b/include/glm/gtx/polar_coordinates.hpp index 576f21c5..8f81327b 100644 --- a/include/glm/gtx/polar_coordinates.hpp +++ b/include/glm/gtx/polar_coordinates.hpp @@ -54,14 +54,14 @@ namespace glm /// /// @see gtx_polar_coordinates template <typename T, precision P> - detail::tvec3<T, P> polar( + GLM_FUNC_DECL detail::tvec3<T, P> polar( detail::tvec3<T, P> const & euclidean); /// Convert Polar to Euclidean coordinates. /// /// @see gtx_polar_coordinates template <typename T, precision P> - detail::tvec3<T, P> euclidean( + GLM_FUNC_DECL detail::tvec3<T, P> euclidean( detail::tvec2<T, P> const & polar); /// @} diff --git a/include/glm/gtx/projection.hpp b/include/glm/gtx/projection.hpp index c2274205..aea96048 100644 --- a/include/glm/gtx/projection.hpp +++ b/include/glm/gtx/projection.hpp @@ -53,7 +53,7 @@ namespace glm //! Projects x on Normal. //! From GLM_GTX_projection extension. template <typename vecType> - vecType proj( + GLM_FUNC_DECL vecType proj( vecType const & x, vecType const & Normal); diff --git a/include/glm/gtx/quaternion.hpp b/include/glm/gtx/quaternion.hpp index f56931aa..fef2d055 100644 --- a/include/glm/gtx/quaternion.hpp +++ b/include/glm/gtx/quaternion.hpp @@ -58,7 +58,7 @@ namespace glm /// /// @see gtx_quaternion template<typename T, precision P> - detail::tvec3<T, P> cross( + GLM_FUNC_DECL detail::tvec3<T, P> cross( detail::tquat<T, P> const & q, detail::tvec3<T, P> const & v); @@ -66,7 +66,7 @@ namespace glm /// /// @see gtx_quaternion template<typename T, precision P> - detail::tvec3<T, P> cross( + GLM_FUNC_DECL detail::tvec3<T, P> cross( detail::tvec3<T, P> const & v, detail::tquat<T, P> const & q); @@ -75,7 +75,7 @@ namespace glm /// /// @see gtx_quaternion template<typename T, precision P> - detail::tquat<T, P> squad( + GLM_FUNC_DECL detail::tquat<T, P> squad( detail::tquat<T, P> const & q1, detail::tquat<T, P> const & q2, detail::tquat<T, P> const & s1, @@ -86,7 +86,7 @@ namespace glm /// /// @see gtx_quaternion template<typename T, precision P> - detail::tquat<T, P> intermediate( + GLM_FUNC_DECL detail::tquat<T, P> intermediate( detail::tquat<T, P> const & prev, detail::tquat<T, P> const & curr, detail::tquat<T, P> const & next); @@ -95,21 +95,21 @@ namespace glm /// /// @see gtx_quaternion template<typename T, precision P> - detail::tquat<T, P> exp( + GLM_FUNC_DECL detail::tquat<T, P> exp( detail::tquat<T, P> const & q); //! Returns a log of a quaternion. /// /// @see gtx_quaternion template<typename T, precision P> - detail::tquat<T, P> log( + GLM_FUNC_DECL detail::tquat<T, P> log( detail::tquat<T, P> const & q); /// Returns x raised to the y power. /// /// @see gtx_quaternion template<typename T, precision P> - detail::tquat<T, P> pow( + GLM_FUNC_DECL detail::tquat<T, P> pow( detail::tquat<T, P> const & x, T const & y); @@ -124,7 +124,7 @@ namespace glm /// /// @see gtx_quaternion template<typename T, precision P> - detail::tvec3<T, P> rotate( + GLM_FUNC_DECL detail::tvec3<T, P> rotate( detail::tquat<T, P> const & q, detail::tvec3<T, P> const & v); @@ -132,7 +132,7 @@ namespace glm /// /// @see gtx_quaternion template<typename T, precision P> - detail::tvec4<T, P> rotate( + GLM_FUNC_DECL detail::tvec4<T, P> rotate( detail::tquat<T, P> const & q, detail::tvec4<T, P> const & v); @@ -140,42 +140,42 @@ namespace glm /// /// @see gtx_quaternion template<typename T, precision P> - T extractRealComponent( + GLM_FUNC_DECL T extractRealComponent( detail::tquat<T, P> const & q); /// Converts a quaternion to a 3 * 3 matrix. /// /// @see gtx_quaternion template<typename T, precision P> - detail::tmat3x3<T, P> toMat3( + GLM_FUNC_DECL detail::tmat3x3<T, P> toMat3( detail::tquat<T, P> const & x){return mat3_cast(x);} /// Converts a quaternion to a 4 * 4 matrix. /// /// @see gtx_quaternion template<typename T, precision P> - detail::tmat4x4<T, P> toMat4( + GLM_FUNC_DECL detail::tmat4x4<T, P> toMat4( detail::tquat<T, P> const & x){return mat4_cast(x);} /// Converts a 3 * 3 matrix to a quaternion. /// /// @see gtx_quaternion template<typename T, precision P> - detail::tquat<T, P> toQuat( + GLM_FUNC_DECL detail::tquat<T, P> toQuat( detail::tmat3x3<T, P> const & x){return quat_cast(x);} /// Converts a 4 * 4 matrix to a quaternion. /// /// @see gtx_quaternion template<typename T, precision P> - detail::tquat<T, P> toQuat( + GLM_FUNC_DECL detail::tquat<T, P> toQuat( detail::tmat4x4<T, P> const & x){return quat_cast(x);} /// Quaternion interpolation using the rotation short path. /// /// @see gtx_quaternion template<typename T, precision P> - detail::tquat<T, P> shortMix( + GLM_FUNC_DECL detail::tquat<T, P> shortMix( detail::tquat<T, P> const & x, detail::tquat<T, P> const & y, T const & a); @@ -184,7 +184,7 @@ namespace glm /// /// @see gtx_quaternion template<typename T, precision P> - detail::tquat<T, P> fastMix( + GLM_FUNC_DECL detail::tquat<T, P> fastMix( detail::tquat<T, P> const & x, detail::tquat<T, P> const & y, T const & a); @@ -195,7 +195,7 @@ namespace glm /// /// @see gtx_quaternion template<typename T, precision P> - detail::tquat<T, P> rotation( + GLM_FUNC_DECL detail::tquat<T, P> rotation( detail::tvec3<T, P> const & orig, detail::tvec3<T, P> const & dest); @@ -203,7 +203,7 @@ namespace glm /// /// @see gtx_quaternion template<typename T, precision P> - T length2(detail::tquat<T, P> const & q); + GLM_FUNC_DECL T length2(detail::tquat<T, P> const & q); /// @} }//namespace glm diff --git a/include/glm/gtx/raw_data.hpp b/include/glm/gtx/raw_data.hpp index 02f9dd02..e74548a7 100644 --- a/include/glm/gtx/raw_data.hpp +++ b/include/glm/gtx/raw_data.hpp @@ -40,6 +40,7 @@ // Dependencies #include "../detail/setup.hpp" +#include "../detail/type_int.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTX_raw_data extension included") diff --git a/include/glm/gtx/rotate_normalized_axis.hpp b/include/glm/gtx/rotate_normalized_axis.hpp index a414b465..e81eeeeb 100644 --- a/include/glm/gtx/rotate_normalized_axis.hpp +++ b/include/glm/gtx/rotate_normalized_axis.hpp @@ -66,7 +66,7 @@ namespace glm /// @see - rotate(detail::tmat4x4<T, P> const & m, T angle, T x, T y, T z) /// @see - rotate(T angle, detail::tvec3<T, P> const & v) template <typename T, precision P> - detail::tmat4x4<T, P> rotateNormalizedAxis( + GLM_FUNC_DECL detail::tmat4x4<T, P> rotateNormalizedAxis( detail::tmat4x4<T, P> const & m, T const & angle, detail::tvec3<T, P> const & axis); @@ -79,7 +79,7 @@ namespace glm /// /// @see gtx_rotate_normalized_axis template <typename T, precision P> - detail::tquat<T, P> rotateNormalizedAxis( + GLM_FUNC_DECL detail::tquat<T, P> rotateNormalizedAxis( detail::tquat<T, P> const & q, T const & angle, detail::tvec3<T, P> const & axis); diff --git a/include/glm/gtx/rotate_vector.hpp b/include/glm/gtx/rotate_vector.hpp index 0361f361..33c99099 100644 --- a/include/glm/gtx/rotate_vector.hpp +++ b/include/glm/gtx/rotate_vector.hpp @@ -55,14 +55,14 @@ namespace glm //! Rotate a two dimensional vector. //! From GLM_GTX_rotate_vector extension. template <typename T, precision P> - detail::tvec2<T, P> rotate( + GLM_FUNC_DECL detail::tvec2<T, P> rotate( detail::tvec2<T, P> const & v, T const & angle); //! Rotate a three dimensional vector around an axis. //! From GLM_GTX_rotate_vector extension. template <typename T, precision P> - detail::tvec3<T, P> rotate( + GLM_FUNC_DECL detail::tvec3<T, P> rotate( detail::tvec3<T, P> const & v, T const & angle, detail::tvec3<T, P> const & normal); @@ -70,7 +70,7 @@ namespace glm //! Rotate a four dimensional vector around an axis. //! From GLM_GTX_rotate_vector extension. template <typename T, precision P> - detail::tvec4<T, P> rotate( + GLM_FUNC_DECL detail::tvec4<T, P> rotate( detail::tvec4<T, P> const & v, T const & angle, detail::tvec3<T, P> const & normal); @@ -78,49 +78,49 @@ namespace glm //! Rotate a three dimensional vector around the X axis. //! From GLM_GTX_rotate_vector extension. template <typename T, precision P> - detail::tvec3<T, P> rotateX( + GLM_FUNC_DECL detail::tvec3<T, P> rotateX( detail::tvec3<T, P> const & v, T const & angle); //! Rotate a three dimensional vector around the Y axis. //! From GLM_GTX_rotate_vector extension. template <typename T, precision P> - detail::tvec3<T, P> rotateY( + GLM_FUNC_DECL detail::tvec3<T, P> rotateY( detail::tvec3<T, P> const & v, T const & angle); //! Rotate a three dimensional vector around the Z axis. //! From GLM_GTX_rotate_vector extension. template <typename T, precision P> - detail::tvec3<T, P> rotateZ( + GLM_FUNC_DECL detail::tvec3<T, P> rotateZ( detail::tvec3<T, P> const & v, T const & angle); //! Rotate a four dimentionnals vector around the X axis. //! From GLM_GTX_rotate_vector extension. template <typename T, precision P> - detail::tvec4<T, P> rotateX( + GLM_FUNC_DECL detail::tvec4<T, P> rotateX( detail::tvec4<T, P> const & v, T const & angle); //! Rotate a four dimensional vector around the X axis. //! From GLM_GTX_rotate_vector extension. template <typename T, precision P> - detail::tvec4<T, P> rotateY( + GLM_FUNC_DECL detail::tvec4<T, P> rotateY( detail::tvec4<T, P> const & v, T const & angle); //! Rotate a four dimensional vector around the X axis. //! From GLM_GTX_rotate_vector extension. template <typename T, precision P> - detail::tvec4<T, P> rotateZ( + GLM_FUNC_DECL detail::tvec4<T, P> rotateZ( detail::tvec4<T, P> const & v, T const & angle); //! Build a rotation matrix from a normal and a up vector. //! From GLM_GTX_rotate_vector extension. template <typename T, precision P> - detail::tmat4x4<T, P> orientation( + GLM_FUNC_DECL detail::tmat4x4<T, P> orientation( detail::tvec3<T, P> const & Normal, detail::tvec3<T, P> const & Up); diff --git a/include/glm/gtx/simd_quat.hpp b/include/glm/gtx/simd_quat.hpp index ad95f0c1..7c1d8c94 100644 --- a/include/glm/gtx/simd_quat.hpp +++ b/include/glm/gtx/simd_quat.hpp @@ -46,8 +46,6 @@ #if(GLM_ARCH != GLM_ARCH_PURE) #if(GLM_ARCH & GLM_ARCH_SSE2) -# include "../core/intrinsic_common.hpp" -# include "../core/intrinsic_geometric.hpp" # include "../gtx/simd_mat4.hpp" #else # error "GLM: GLM_GTX_simd_quat requires compiler support of SSE2 through intrinsics" diff --git a/include/glm/gtx/simd_quat.inl b/include/glm/gtx/simd_quat.inl index 4546d3a5..10a24e7d 100644 --- a/include/glm/gtx/simd_quat.inl +++ b/include/glm/gtx/simd_quat.inl @@ -194,7 +194,7 @@ GLM_FUNC_QUALIFIER fvec4SIMD operator* (fquatSIMD const & q, fvec4SIMD const & v GLM_FUNC_QUALIFIER fvec4SIMD operator* (fvec4SIMD const & v, fquatSIMD const & q) { - return inverse(q) * v; + return glm::inverse(q) * v; } GLM_FUNC_QUALIFIER fquatSIMD operator* (fquatSIMD const & q, float s) diff --git a/include/glm/gtx/string_cast.hpp b/include/glm/gtx/string_cast.hpp index 5c41221b..a633d902 100644 --- a/include/glm/gtx/string_cast.hpp +++ b/include/glm/gtx/string_cast.hpp @@ -36,6 +36,7 @@ /// @brief Setup strings for GLM type values /// /// <glm/gtx/string_cast.hpp> need to be included to use these functionalities. +/// This extension is not supported with CUDA /////////////////////////////////////////////////////////////////////////////////// #ifndef GLM_GTX_string_cast @@ -47,6 +48,10 @@ #include "../gtx/quaternion.hpp" #include <string> +#if(GLM_COMPILER & GLM_COMPILER_CUDA) +# error "GLM_GTX_string_cast is not supported on CUDA compiler" +#endif + #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTX_string_cast extension included") #endif @@ -59,7 +64,7 @@ namespace glm /// Create a string from a GLM type value. /// @see gtx_string_cast extension. template <typename genType> - std::string to_string(genType const & x); + GLM_FUNC_DECL std::string to_string(genType const & x); /// @} }//namespace glm diff --git a/include/glm/gtx/string_cast.inl b/include/glm/gtx/string_cast.inl index 17a89d1a..3d9c0313 100644 --- a/include/glm/gtx/string_cast.inl +++ b/include/glm/gtx/string_cast.inl @@ -23,11 +23,11 @@ namespace detail return std::string(); va_start(list, msg); -#if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8)) +# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8)) vsprintf_s(text, STRING_BUFFER, msg, list); -#else// +# else// vsprintf(text, msg, list); -#endif// +# endif// va_end(list); return std::string(text); diff --git a/include/glm/gtx/transform.hpp b/include/glm/gtx/transform.hpp index 9ebdf93b..18780d83 100644 --- a/include/glm/gtx/transform.hpp +++ b/include/glm/gtx/transform.hpp @@ -58,14 +58,14 @@ namespace glm /// - From \link gtx_transform GLM_GTX_transform \endlink extension /// - See also: \link glm::translate GLM_GTC_matrix_transform \endlink template <typename T, precision P> - detail::tmat4x4<T, P> translate( + GLM_FUNC_DECL detail::tmat4x4<T, P> translate( detail::tvec3<T, P> const & v); /// Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in degrees. /// - From \link gtx_transform GLM_GTX_transform \endlink extension /// - See also: \link glm::rotate GLM_GTC_matrix_transform \endlink template <typename T, precision P> - detail::tmat4x4<T, P> rotate( + GLM_FUNC_DECL detail::tmat4x4<T, P> rotate( T angle, detail::tvec3<T, P> const & v); @@ -73,7 +73,7 @@ namespace glm /// - From \link gtx_transform GLM_GTX_transform \endlink extension /// - See also: \link glm::scale GLM_GTC_matrix_transform \endlink template <typename T, precision P> - detail::tmat4x4<T, P> scale( + GLM_FUNC_DECL detail::tmat4x4<T, P> scale( detail::tvec3<T, P> const & v); /// @} diff --git a/include/glm/gtx/transform2.hpp b/include/glm/gtx/transform2.hpp index 9dbb83f9..1403dd84 100644 --- a/include/glm/gtx/transform2.hpp +++ b/include/glm/gtx/transform2.hpp @@ -55,21 +55,21 @@ namespace glm //! Transforms a matrix with a shearing on X axis. //! From GLM_GTX_transform2 extension. template <typename T, precision P> - detail::tmat3x3<T, P> shearX2D( + GLM_FUNC_DECL detail::tmat3x3<T, P> shearX2D( detail::tmat3x3<T, P> const & m, T y); //! Transforms a matrix with a shearing on Y axis. //! From GLM_GTX_transform2 extension. template <typename T, precision P> - detail::tmat3x3<T, P> shearY2D( + GLM_FUNC_DECL detail::tmat3x3<T, P> shearY2D( detail::tmat3x3<T, P> const & m, T x); //! Transforms a matrix with a shearing on X axis //! From GLM_GTX_transform2 extension. template <typename T, precision P> - detail::tmat4x4<T, P> shearX3D( + GLM_FUNC_DECL detail::tmat4x4<T, P> shearX3D( const detail::tmat4x4<T, P> & m, T y, T z); @@ -77,7 +77,7 @@ namespace glm //! Transforms a matrix with a shearing on Y axis. //! From GLM_GTX_transform2 extension. template <typename T, precision P> - detail::tmat4x4<T, P> shearY3D( + GLM_FUNC_DECL detail::tmat4x4<T, P> shearY3D( const detail::tmat4x4<T, P> & m, T x, T z); @@ -85,7 +85,7 @@ namespace glm //! Transforms a matrix with a shearing on Z axis. //! From GLM_GTX_transform2 extension. template <typename T, precision P> - detail::tmat4x4<T, P> shearZ3D( + GLM_FUNC_DECL detail::tmat4x4<T, P> shearZ3D( const detail::tmat4x4<T, P> & m, T x, T y); @@ -101,28 +101,28 @@ namespace glm //! Build planar projection matrix along normal axis. //! From GLM_GTX_transform2 extension. template <typename T, precision P> - detail::tmat3x3<T, P> proj2D( + GLM_FUNC_DECL detail::tmat3x3<T, P> proj2D( const detail::tmat3x3<T, P> & m, const detail::tvec3<T, P>& normal); //! Build planar projection matrix along normal axis. //! From GLM_GTX_transform2 extension. template <typename T, precision P> - detail::tmat4x4<T, P> proj3D( + GLM_FUNC_DECL detail::tmat4x4<T, P> proj3D( const detail::tmat4x4<T, P> & m, const detail::tvec3<T, P>& normal); //! Build a scale bias matrix. //! From GLM_GTX_transform2 extension. template <typename valType, precision P> - detail::tmat4x4<valType, P> scaleBias( + GLM_FUNC_DECL detail::tmat4x4<valType, P> scaleBias( valType scale, valType bias); //! Build a scale bias matrix. //! From GLM_GTX_transform2 extension. template <typename valType, precision P> - detail::tmat4x4<valType, P> scaleBias( + GLM_FUNC_DECL detail::tmat4x4<valType, P> scaleBias( detail::tmat4x4<valType, P> const & m, valType scale, valType bias); diff --git a/include/glm/gtx/vector_angle.hpp b/include/glm/gtx/vector_angle.hpp index 90cfdca4..49c744cd 100644 --- a/include/glm/gtx/vector_angle.hpp +++ b/include/glm/gtx/vector_angle.hpp @@ -59,7 +59,7 @@ namespace glm //! Parameters need to be normalized. /// @see gtx_vector_angle extension template <typename vecType> - GLM_FUNC_QUALIFIER typename vecType::value_type angle( + GLM_FUNC_DECL typename vecType::value_type angle( vecType const & x, vecType const & y); @@ -67,7 +67,7 @@ namespace glm //! Parameters need to be normalized. /// @see gtx_vector_angle extension. template <typename T, precision P> - GLM_FUNC_QUALIFIER T orientedAngle( + GLM_FUNC_DECL T orientedAngle( detail::tvec2<T, P> const & x, detail::tvec2<T, P> const & y); @@ -75,7 +75,7 @@ namespace glm //! Parameters need to be normalized. /// @see gtx_vector_angle extension. template <typename T, precision P> - GLM_FUNC_QUALIFIER T orientedAngle( + GLM_FUNC_DECL T orientedAngle( detail::tvec3<T, P> const & x, detail::tvec3<T, P> const & y, detail::tvec3<T, P> const & ref); diff --git a/include/glm/gtx/vector_query.hpp b/include/glm/gtx/vector_query.hpp index 8e8ac5b3..f896c3af 100644 --- a/include/glm/gtx/vector_query.hpp +++ b/include/glm/gtx/vector_query.hpp @@ -55,32 +55,32 @@ namespace glm //! Check whether two vectors are collinears. /// @see gtx_vector_query extensions. template <typename T, precision P, template <typename, precision> class vecType> - bool areCollinear(vecType<T, P> const & v0, vecType<T, P> const & v1, T const & epsilon); + GLM_FUNC_DECL bool areCollinear(vecType<T, P> const & v0, vecType<T, P> const & v1, T const & epsilon); //! Check whether two vectors are orthogonals. /// @see gtx_vector_query extensions. template <typename T, precision P, template <typename, precision> class vecType> - bool areOrthogonal(vecType<T, P> const & v0, vecType<T, P> const & v1, T const & epsilon); + GLM_FUNC_DECL bool areOrthogonal(vecType<T, P> const & v0, vecType<T, P> const & v1, T const & epsilon); //! Check whether a vector is normalized. /// @see gtx_vector_query extensions. template <typename T, precision P, template <typename, precision> class vecType> - bool isNormalized(vecType<T, P> const & v, T const & epsilon); + GLM_FUNC_DECL bool isNormalized(vecType<T, P> const & v, T const & epsilon); //! Check whether a vector is null. /// @see gtx_vector_query extensions. template <typename T, precision P, template <typename, precision> class vecType> - bool isNull(vecType<T, P> const & v, T const & epsilon); + GLM_FUNC_DECL bool isNull(vecType<T, P> const & v, T const & epsilon); //! Check whether a each component of a vector is null. /// @see gtx_vector_query extensions. template <typename T, precision P, template <typename, precision> class vecType> - vecType<bool, P> isCompNull(vecType<T, P> const & v, T const & epsilon); + GLM_FUNC_DECL vecType<bool, P> isCompNull(vecType<T, P> const & v, T const & epsilon); //! Check whether two vectors are orthonormal. /// @see gtx_vector_query extensions. template <typename T, precision P, template <typename, precision> class vecType> - bool areOrthonormal(vecType<T, P> const & v0, vecType<T, P> const & v1, T const & epsilon); + GLM_FUNC_DECL bool areOrthonormal(vecType<T, P> const & v0, vecType<T, P> const & v1, T const & epsilon); /// @} }// namespace glm diff --git a/include/glm/gtx/vector_query.inl b/include/glm/gtx/vector_query.inl index 8d14fb23..94881e02 100644 --- a/include/glm/gtx/vector_query.inl +++ b/include/glm/gtx/vector_query.inl @@ -21,7 +21,7 @@ namespace detail template <typename T, precision P> struct compute_areCollinear<T, P, tvec2> { - static bool call(detail::tvec2<T, P> const & v0, detail::tvec2<T, P> const & v1, T const & epsilon) + GLM_FUNC_QUALIFIER static bool call(detail::tvec2<T, P> const & v0, detail::tvec2<T, P> const & v1, T const & epsilon) { return length(cross(detail::tvec3<T, P>(v0, static_cast<T>(0)), detail::tvec3<T, P>(v1, static_cast<T>(0)))) < epsilon; } @@ -30,7 +30,7 @@ namespace detail template <typename T, precision P> struct compute_areCollinear<T, P, tvec3> { - static bool call(detail::tvec3<T, P> const & v0, detail::tvec3<T, P> const & v1, T const & epsilon) + GLM_FUNC_QUALIFIER static bool call(detail::tvec3<T, P> const & v0, detail::tvec3<T, P> const & v1, T const & epsilon) { return length(cross(v0, v1)) < epsilon; } @@ -39,7 +39,7 @@ namespace detail template <typename T, precision P> struct compute_areCollinear<T, P, tvec4> { - static bool call(detail::tvec4<T, P> const & v0, detail::tvec4<T, P> const & v1, T const & epsilon) + GLM_FUNC_QUALIFIER static bool call(detail::tvec4<T, P> const & v0, detail::tvec4<T, P> const & v1, T const & epsilon) { return length(cross(detail::tvec3<T, P>(v0), detail::tvec3<T, P>(v1))) < epsilon; } @@ -51,7 +51,7 @@ namespace detail template <typename T, precision P> struct compute_isCompNull<T, P, tvec2> { - static detail::tvec2<bool, P> call(detail::tvec2<T, P> const & v, T const & epsilon) + GLM_FUNC_QUALIFIER static detail::tvec2<bool, P> call(detail::tvec2<T, P> const & v, T const & epsilon) { return detail::tvec2<bool, P>( (abs(v.x) < epsilon), @@ -62,7 +62,7 @@ namespace detail template <typename T, precision P> struct compute_isCompNull<T, P, tvec3> { - static detail::tvec3<bool, P> call(detail::tvec3<T, P> const & v, T const & epsilon) + GLM_FUNC_QUALIFIER static detail::tvec3<bool, P> call(detail::tvec3<T, P> const & v, T const & epsilon) { return detail::tvec3<bool, P>( (abs(v.x) < epsilon), @@ -74,7 +74,7 @@ namespace detail template <typename T, precision P> struct compute_isCompNull<T, P, tvec4> { - static detail::tvec4<bool, P> call(detail::tvec4<T, P> const & v, T const & epsilon) + GLM_FUNC_QUALIFIER static detail::tvec4<bool, P> call(detail::tvec4<T, P> const & v, T const & epsilon) { return detail::tvec4<bool, P>( (abs(v.x) < epsilon), @@ -156,7 +156,9 @@ namespace detail detail::tvec2<T, P> const & v, T const & epsilon) { - + return detail::tvec2<bool, P>( + abs(v.x) < epsilon, + abs(v.y) < epsilon); } template <typename T, precision P> -- GitLab