diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 57f73e8d..2647d5e3 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -701,7 +701,7 @@ # if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8)) # define GLM_INLINE __forceinline # elif((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC34)) -# define GLM_INLINE __attribute__((always_inline)) +# define GLM_INLINE __attribute__((always_inline)) inline # elif(GLM_COMPILER & GLM_COMPILER_CLANG) # define GLM_INLINE __attribute__((always_inline)) # else diff --git a/glm/gtx/io.hpp b/glm/gtx/io.hpp index e5608712..59cef57f 100644 --- a/glm/gtx/io.hpp +++ b/glm/gtx/io.hpp @@ -52,7 +52,7 @@ namespace glm { - /// @addtogroup gtx_io + /// @addtogroup gtx_io /// @{ namespace io @@ -72,21 +72,19 @@ namespace glm }; - enum class order_t { column_major, row_major, }; + class format_guard + { + public: + enum order_t { column_major, row_major, }; - class format_guard { + GLM_FUNC_DECL explicit format_guard(); + GLM_FUNC_DECL ~format_guard(); - public: + private: - GLM_FUNC_DECL explicit format_guard(); - GLM_FUNC_DECL ~format_guard(); - - private: - - order_t order_; - char cr_; - - }; + order_t order_; + char cr_; + }; // decimal places (dflt: 3) GLM_FUNC_DECL unsigned& precision(); @@ -95,7 +93,7 @@ namespace glm GLM_FUNC_DECL unsigned& value_width(); // matrix output order (dflt: row_major) - GLM_FUNC_DECL order_t& order(); + GLM_FUNC_DECL format_guard::order_t& order(); // carriage/return char (dflt: '\n') GLM_FUNC_DECL char& cr(); diff --git a/glm/gtx/io.inl b/glm/gtx/io.inl index e588c480..ebf87bad 100644 --- a/glm/gtx/io.inl +++ b/glm/gtx/io.inl @@ -12,10 +12,9 @@ // std::setw #include // std::basic_ostream<> -namespace glm +namespace glm{ +namespace io { - namespace io - { /* explicit */ GLM_FUNC_QUALIFIER precision_guard::precision_guard() @@ -43,26 +42,23 @@ namespace glm order() = order_; } - GLM_FUNC_QUALIFIER unsigned& - precision() + GLM_FUNC_QUALIFIER unsigned& precision() { static unsigned p(3); return p; } - GLM_FUNC_QUALIFIER unsigned& - value_width() + GLM_FUNC_QUALIFIER unsigned& value_width() { static unsigned p(9); return p; } - GLM_FUNC_QUALIFIER order_t& - order() + GLM_FUNC_QUALIFIER format_guard::order_t& order() { - static order_t p(order_t::row_major); + static format_guard::order_t p(format_guard::row_major); return p; } @@ -73,47 +69,41 @@ namespace glm static char p('\n'); return p; } - GLM_FUNC_QUALIFIER std::ios_base& - column_major(std::ios_base& os) + GLM_FUNC_QUALIFIER std::ios_base& column_major(std::ios_base& os) { - order() = order_t::column_major; + order() = format_guard::column_major; return os; } - GLM_FUNC_QUALIFIER std::ios_base& - row_major(std::ios_base& os) + GLM_FUNC_QUALIFIER std::ios_base& row_major(std::ios_base& os) { - order() = order_t::row_major; + order() = format_guard::row_major; return os; } - GLM_FUNC_QUALIFIER std::ios_base& - formatted(std::ios_base& os) + GLM_FUNC_QUALIFIER std::ios_base& formatted(std::ios_base& os) { cr() = '\n'; return os; } - GLM_FUNC_QUALIFIER std::ios_base& - unformatted(std::ios_base& os) + GLM_FUNC_QUALIFIER std::ios_base& unformatted(std::ios_base& os) { cr() = ' '; return os; } - } // namespace io - - namespace detail { - +} // namespace io +namespace detail +{ // functions, inlined (inline) template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tquat const& a) + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tquat const& a) { typename std::basic_ostream::sentry const cerberus(os); @@ -133,8 +123,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tvec2 const& a) + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tvec2 const& a) { typename std::basic_ostream::sentry const cerberus(os); @@ -152,8 +141,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tvec3 const& a) + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tvec3 const& a) { typename std::basic_ostream::sentry const cerberus(os); @@ -172,8 +160,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tvec4 const& a) + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tvec4 const& a) { typename std::basic_ostream::sentry const cerberus(os); @@ -193,15 +180,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat2x2 const& a) + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat2x2 const& a) { typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { tmat2x2 m(a); - if (io::order_t::row_major == io::order()) { + if (io::format_guard::order_t::row_major == io::order()) { m = transpose(a); } @@ -214,15 +200,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat2x3 const& a) + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat2x3 const& a) { typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { tmat3x2 m(a); - if (io::order_t::row_major == io::order()) { + if (io::format_guard::row_major == io::order()) { m = transpose(a); } @@ -236,15 +221,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat2x4 const& a) + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat2x4 const& a) { typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { tmat4x2 m(a); - if (io::order_t::row_major == io::order()) { + if (io::format_guard::row_major == io::order()) { m = transpose(a); } @@ -259,15 +243,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat3x2 const& a) + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat3x2 const& a) { typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { tmat2x3 m(a); - if (io::order_t::row_major == io::order()) { + if (io::format_guard::row_major == io::order()) { m = transpose(a); } @@ -280,15 +263,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat3x3 const& a) + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat3x3 const& a) { typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { tmat3x3 m(a); - if (io::order_t::row_major == io::order()) { + if (io::format_guard::row_major == io::order()) { m = transpose(a); } @@ -302,15 +284,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat3x4 const& a) + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat3x4 const& a) { typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { tmat4x3 m(a); - if (io::order_t::row_major == io::order()) { + if (io::format_guard::row_major == io::order()) { m = transpose(a); } @@ -325,15 +306,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat4x2 const& a) + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat4x2 const& a) { typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { tmat2x4 m(a); - if (io::order_t::row_major == io::order()) { + if (io::format_guard::row_major == io::order()) { m = transpose(a); } @@ -346,15 +326,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat4x3 const& a) + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat4x3 const& a) { typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { tmat3x4 m(a); - if (io::order_t::row_major == io::order()) { + if (io::format_guard::row_major == io::order()) { m = transpose(a); } @@ -368,15 +347,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat4x4 const& a) + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat4x4 const& a) { typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { tmat4x4 m(a); - if (io::order_t::row_major == io::order()) { + if (io::format_guard::row_major == io::order()) { m = transpose(a); } @@ -391,7 +369,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER std::basic_ostream& + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, std::pair const, tmat4x4 const> const& a) { @@ -401,7 +379,7 @@ namespace glm tmat4x4 ml(a.first); tmat4x4 mr(a.second); - if (io::order_t::row_major == io::order()) { + if (io::format_guard::row_major == io::order()) { ml = transpose(a.first); mr = transpose(a.second); } @@ -415,6 +393,5 @@ namespace glm return os; } - - }//namespace detail +}//namespace detail }//namespace glm diff --git a/glm/gtx/simd_mat4.hpp b/glm/gtx/simd_mat4.hpp index d87b1c02..fee62522 100644 --- a/glm/gtx/simd_mat4.hpp +++ b/glm/gtx/simd_mat4.hpp @@ -38,8 +38,8 @@ #ifndef GLM_GTX_simd_mat4 #define GLM_GTX_simd_mat4 -// Dependency: -#include "../glm.hpp" +// Dependencies +#include "../detail/setup.hpp" #if(GLM_ARCH != GLM_ARCH_PURE) @@ -61,14 +61,15 @@ namespace detail /// \ingroup gtx_simd_mat4 GLM_ALIGNED_STRUCT(16) fmat4x4SIMD { - enum ctor{null}; - + enum ctor{_null}; typedef float value_type; typedef fvec4SIMD col_type; typedef fvec4SIMD row_type; typedef std::size_t size_type; - static size_type value_size(); - static bool is_matrix(); + typedef fmat4x4SIMD type; + typedef fmat4x4SIMD transpose_type; + + GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; fvec4SIMD Data[4]; diff --git a/glm/gtx/simd_mat4.inl b/glm/gtx/simd_mat4.inl index 4c2aa00b..8a27b460 100644 --- a/glm/gtx/simd_mat4.inl +++ b/glm/gtx/simd_mat4.inl @@ -10,9 +10,9 @@ namespace glm{ namespace detail{ -GLM_FUNC_QUALIFIER fmat4x4SIMD::size_type fmat4x4SIMD::value_size() +GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t fmat4x4SIMD::length() const { - return sizeof(value_type); + return 4; } GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD() @@ -551,7 +551,7 @@ GLM_FUNC_QUALIFIER detail::fmat4x4SIMD outerProduct __m128 Shu2 = _mm_shuffle_ps(r.Data, r.Data, _MM_SHUFFLE(2, 2, 2, 2)); __m128 Shu3 = _mm_shuffle_ps(r.Data, r.Data, _MM_SHUFFLE(3, 3, 3, 3)); - detail::fmat4x4SIMD result(detail::fmat4x4SIMD::null); + detail::fmat4x4SIMD result(detail::fmat4x4SIMD::_null); result[0].Data = _mm_mul_ps(c.Data, Shu0); result[1].Data = _mm_mul_ps(c.Data, Shu1); result[2].Data = _mm_mul_ps(c.Data, Shu2);