From 623cdaa55274168f96ee5413aa039f3b935080c6 Mon Sep 17 00:00:00 2001 From: jan p springer Date: Tue, 17 Dec 2013 22:37:34 +0000 Subject: [PATCH 01/47] reimplemented io support for basic types --- glm/gtx/io.hpp | 118 +++++++---- glm/gtx/io.inl | 468 ++++++++++++++++++++++++++++---------------- test/gtx/gtx_io.cpp | 52 +++-- 3 files changed, 429 insertions(+), 209 deletions(-) diff --git a/glm/gtx/io.hpp b/glm/gtx/io.hpp index d3bcb3db..71ae187d 100644 --- a/glm/gtx/io.hpp +++ b/glm/gtx/io.hpp @@ -33,6 +33,10 @@ /// /// @brief std::[w]ostream support for glm types /// +/// std::[w]ostream support for glm types + precision/width/etc. manipulators +/// based on howard hinnant's std::chrono io proposal +/// [http://home.roadrunner.com/~hinnant/bloomington/chrono_io.html] +/// /// needs to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// @@ -47,8 +51,11 @@ # pragma message("GLM: GLM_GTX_io extension included") #endif -#include // std::basic_ostream<> (fwd) -#include // std::pair<> +#include // basic_ios_all_saver<> (fwd) +#include // boost::noncopyable +#include // std::basic_ostream<> (fwd) +#include // std::locale, std::locale::facet, std::locale::id +#include // std::pair<> namespace glm { @@ -58,60 +65,103 @@ namespace glm namespace io { - class precision_guard { + enum class order_type { column_major, row_major, }; + + template + class format_punct : public std::locale::facet { - public: + typedef CTy char_type; - GLM_FUNC_DECL explicit precision_guard(); - GLM_FUNC_DECL ~precision_guard(); - - private: + public: - unsigned precision_; - unsigned value_width_; + static std::locale::id id; + + bool formatted; + unsigned precision; + unsigned width; + char_type separator; + char_type delim_left; + char_type delim_right; + char_type space; + char_type newline; + order_type order; + + explicit format_punct(size_t a = 0); + explicit format_punct(format_punct const&); }; - enum class order_t { column_major, row_major, }; - - class format_guard { + template > + class basic_format_saver : private boost::noncopyable { public: - GLM_FUNC_DECL explicit format_guard(); - GLM_FUNC_DECL ~format_guard(); - + explicit basic_format_saver(std::basic_ios&); + ~basic_format_saver(); + private: - order_t order_; - char cr_; + boost::io::basic_ios_all_saver const ias_; }; - // decimal places (dflt: 3) - GLM_FUNC_DECL unsigned& precision(); + typedef basic_format_saver format_saver; + typedef basic_format_saver wformat_saver; + + struct formatted { /* empty */ }; + struct unformatted { /* empty */ }; + + struct precision { - // sign + value + '.' + decimals (dflt: 1 + 4 + 1 + precision()) - GLM_FUNC_DECL unsigned& value_width(); + unsigned value; + + explicit precision(unsigned); + + }; - // matrix output order (dflt: row_major) - GLM_FUNC_DECL order_t& order(); + struct width { - // carriage/return char (dflt: '\n') - GLM_FUNC_DECL char& cr(); + unsigned value; + + explicit width(unsigned); + + }; - // matrix output order -> column_major - GLM_FUNC_DECL std::ios_base& column_major(std::ios_base&); + template + struct delimeter { - // matrix output order -> row_major - GLM_FUNC_DECL std::ios_base& row_major (std::ios_base&); + CTy value[3]; + + explicit delimeter(CTy /* left */, CTy /* right */, CTy /* separator */ = ','); + + }; - // carriage/return char -> '\n' - GLM_FUNC_DECL std::ios_base& formatted (std::ios_base&); + struct order { - // carriage/return char -> ' ' - GLM_FUNC_DECL std::ios_base& unformatted (std::ios_base&); + order_type value; + + explicit order(order_type); + + }; + + // functions, inlined (inline) + template + FTy const& get_facet(std::basic_ios&); + + template + std::basic_ostream& operator<<(std::basic_ostream&, formatted const&); + template + std::basic_ostream& operator<<(std::basic_ostream&, unformatted const&); + template + std::basic_ostream& operator<<(std::basic_ostream&, precision const&); + template + std::basic_ostream& operator<<(std::basic_ostream&, width const&); + template + std::basic_ostream& operator<<(std::basic_ostream&, delimeter const&); + template + std::basic_ostream& operator<<(std::basic_ostream&, order const&); + }//namespace io namespace detail diff --git a/glm/gtx/io.inl b/glm/gtx/io.inl index e588c480..c102f10a 100644 --- a/glm/gtx/io.inl +++ b/glm/gtx/io.inl @@ -2,12 +2,12 @@ // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2013-11-22 -// Updated : 2013-11-22 +// Updated : 2013-12-17 // Licence : This source is under MIT License // File : glm/gtx/inl.inl /////////////////////////////////////////////////////////////////////////////////////////////////// -// #include // boost::io::ios_all_saver +#include // boost::io::ios_all_saver #include // std::setfill<>, std::fixed, std::setprecision, std::right, // std::setw #include // std::basic_ostream<> @@ -17,91 +17,143 @@ namespace glm namespace io { + template /* explicit */ GLM_FUNC_QUALIFIER - precision_guard::precision_guard() - : precision_ (precision()), - value_width_(value_width()) + format_punct::format_punct(size_t a) + : std::locale::facet(a), + formatted (true), + precision (3), + width (1 + 4 + 1 + precision), + separator (','), + delim_left ('['), + delim_right (']'), + space (' '), + newline ('\n'), + order (order_type::row_major) {} - GLM_FUNC_QUALIFIER - precision_guard::~precision_guard() + template + /* explicit */ GLM_FUNC_QUALIFIER + format_punct::format_punct(format_punct const& a) + : std::locale::facet(0), + formatted (a.formatted), + precision (a.precision), + width (a.width), + separator (a.separator), + delim_left (a.delim_left), + delim_right (a.delim_right), + space (a.space), + newline (a.newline), + order (a.order) + {} + + template std::locale::id format_punct::id; + + template + /* explicit */ GLM_FUNC_QUALIFIER + basic_format_saver::basic_format_saver(std::basic_ios& a) + : boost::noncopyable(), + ias_ (a) { - value_width() = value_width_; - precision() = precision_; + a.imbue(std::locale(a.getloc(), new format_punct(get_facet>(a)))); + } + + template + GLM_FUNC_QUALIFIER + basic_format_saver::~basic_format_saver() + {} + + /* explicit */ GLM_FUNC_QUALIFIER + precision::precision(unsigned a) + : value(a) + {} + + /* explicit */ GLM_FUNC_QUALIFIER + width::width(unsigned a) + : value(a) + {} + + template + /* explicit */ GLM_FUNC_QUALIFIER + delimeter::delimeter(CTy a, CTy b, CTy c) + : value() + { + value[0] = a; + value[1] = b; + value[2] = c; } /* explicit */ GLM_FUNC_QUALIFIER - format_guard::format_guard() - : order_(order()), - cr_ (cr()) + order::order(order_type a) + : value(a) {} - - GLM_FUNC_QUALIFIER - format_guard::~format_guard() - { - cr() = cr_; - order() = order_; - } - - GLM_FUNC_QUALIFIER unsigned& - precision() - { - static unsigned p(3); - - return p; - } - GLM_FUNC_QUALIFIER unsigned& - value_width() + template + GLM_FUNC_QUALIFIER FTy const& + get_facet(std::basic_ios& ios) { - static unsigned p(9); + if (!std::has_facet(ios.getloc())) { + ios.imbue(std::locale(ios.getloc(), new FTy)); + } - return p; + return std::use_facet(ios.getloc()); } - - GLM_FUNC_QUALIFIER order_t& - order() - { - static order_t p(order_t::row_major); - return p; - } - - GLM_FUNC_QUALIFIER char& - cr() + template + GLM_FUNC_QUALIFIER std::basic_ostream& + operator<<(std::basic_ostream& os, formatted const&) { - static char p('\n'); return p; + const_cast&>(get_facet>(os)).formatted = true; + + return os; } - - GLM_FUNC_QUALIFIER std::ios_base& - column_major(std::ios_base& os) + + template + GLM_FUNC_QUALIFIER std::basic_ostream& + operator<<(std::basic_ostream& os, unformatted const&) { - order() = order_t::column_major; - + const_cast&>(get_facet>(os)).formatted = false; + return os; } - GLM_FUNC_QUALIFIER std::ios_base& - row_major(std::ios_base& os) + template + GLM_FUNC_QUALIFIER std::basic_ostream& + operator<<(std::basic_ostream& os, precision const& a) { - order() = order_t::row_major; + const_cast&>(get_facet>(os)).precision = a.value; + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream& + operator<<(std::basic_ostream& os, width const& a) + { + const_cast&>(get_facet>(os)).width = a.value; + + return os; + } + + template + std::basic_ostream& operator<<(std::basic_ostream& os, + delimeter const& a) + { + format_punct& fmt(const_cast&>(get_facet>(os))); + + fmt.delim_left = a.value[0]; + fmt.delim_right = a.value[1]; + fmt.separator = a.value[2]; return os; } - GLM_FUNC_QUALIFIER std::ios_base& - formatted(std::ios_base& os) + template + GLM_FUNC_QUALIFIER std::basic_ostream& + operator<<(std::basic_ostream& os, order const& a) { - cr() = '\n'; - - return os; - } - - GLM_FUNC_QUALIFIER std::ios_base& - unformatted(std::ios_base& os) - { - cr() = ' '; - + const_cast&>(get_facet>(os)).order = a.value; + return os; } @@ -109,8 +161,6 @@ namespace glm namespace detail { - // functions, inlined (inline) - template GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tquat const& a) @@ -118,17 +168,26 @@ namespace glm typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { - // boost::io::ios_all_saver const ias(os); - - os << std::fixed << std::setprecision(io::precision()) - << '[' - << std::right << std::setfill(' ') << std::setw(io::value_width()) << a.w << ',' - << std::right << std::setfill(' ') << std::setw(io::value_width()) << a.x << ',' - << std::right << std::setfill(' ') << std::setw(io::value_width()) << a.y << ',' - << std::right << std::setfill(' ') << std::setw(io::value_width()) << a.z - << ']'; - } + io::format_punct const& fmt(io::get_facet>(os)); + if (fmt.formatted) { + boost::io::basic_ios_all_saver const ias(os); + + os << std::fixed + << std::right + << std::setprecision(fmt.precision) + << std::setfill(fmt.space) + << fmt.delim_left + << std::setw(fmt.width) << a.w << fmt.separator + << std::setw(fmt.width) << a.x << fmt.separator + << std::setw(fmt.width) << a.y << fmt.separator + << std::setw(fmt.width) << a.z + << fmt.delim_right; + } else { + os << a.w << fmt.space << a.x << fmt.space << a.y << fmt.space << a.z; + } + } + return os; } @@ -139,13 +198,22 @@ namespace glm typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { - // boost::io::ios_all_saver const ias(os); - - os << std::fixed << std::setprecision(io::precision()) - << '[' - << std::right << std::setfill(' ') << std::setw(io::value_width()) << a.x << ',' - << std::right << std::setfill(' ') << std::setw(io::value_width()) << a.y - << ']'; + io::format_punct const& fmt(io::get_facet>(os)); + + if (fmt.formatted) { + boost::io::basic_ios_all_saver const ias(os); + + os << std::fixed + << std::right + << std::setprecision(fmt.precision) + << std::setfill(fmt.space) + << fmt.delim_left + << std::setw(fmt.width) << a.x << fmt.separator + << std::setw(fmt.width) << a.y + << fmt.delim_right; + } else { + os << a.x << fmt.space << a.y; + } } return os; @@ -158,19 +226,28 @@ namespace glm typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { - // boost::io::ios_all_saver const ias(os); - - os << std::fixed << std::setprecision(io::precision()) - << '[' - << std::right << std::setfill(' ') << std::setw(io::value_width()) << a.x << ',' - << std::right << std::setfill(' ') << std::setw(io::value_width()) << a.y << ',' - << std::right << std::setfill(' ') << std::setw(io::value_width()) << a.z - << ']'; - } + io::format_punct const& fmt(io::get_facet>(os)); + if (fmt.formatted) { + boost::io::basic_ios_all_saver const ias(os); + + os << std::fixed + << std::right + << std::setprecision(fmt.precision) + << std::setfill(fmt.space) + << fmt.delim_left + << std::setw(fmt.width) << a.x << fmt.separator + << std::setw(fmt.width) << a.y << fmt.separator + << std::setw(fmt.width) << a.z + << fmt.delim_right; + } else { + os << a.x << fmt.space << a.y << fmt.space << a.z; + } + } + return os; } - + template GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tvec4 const& a) @@ -178,17 +255,26 @@ namespace glm typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { - // boost::io::ios_all_saver const ias(os); - - os << std::fixed << std::setprecision(io::precision()) - << '[' - << std::right << std::setfill(' ') << std::setw(io::value_width()) << a.x << ',' - << std::right << std::setfill(' ') << std::setw(io::value_width()) << a.y << ',' - << std::right << std::setfill(' ') << std::setw(io::value_width()) << a.z << ',' - << std::right << std::setfill(' ') << std::setw(io::value_width()) << a.w - << ']'; - } + io::format_punct const& fmt(io::get_facet>(os)); + if (fmt.formatted) { + boost::io::basic_ios_all_saver const ias(os); + + os << std::fixed + << std::right + << std::setprecision(fmt.precision) + << std::setfill(fmt.space) + << fmt.delim_left + << std::setw(fmt.width) << a.x << fmt.separator + << std::setw(fmt.width) << a.y << fmt.separator + << std::setw(fmt.width) << a.z << fmt.separator + << std::setw(fmt.width) << a.w + << fmt.delim_right; + } else { + os << a.x << fmt.space << a.y << fmt.space << a.z << fmt.space << a.w; + } + } + return os; } @@ -199,15 +285,20 @@ namespace glm typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { - tmat2x2 m(a); + io::format_punct const& fmt(io::get_facet>(os)); + tmat2x2 m(a); - if (io::order_t::row_major == io::order()) { + if (io::order_type::row_major == fmt.order) { m = transpose(a); } - - os << io::cr() - << '[' << m[0] << io::cr() - << ' ' << m[1] << ']'; + + if (fmt.formatted) { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.delim_right; + } else { + os << m[0] << fmt.space << m[1]; + } } return os; @@ -220,16 +311,21 @@ namespace glm typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { - tmat3x2 m(a); + io::format_punct const& fmt(io::get_facet>(os)); + tmat3x2 m(a); - if (io::order_t::row_major == io::order()) { + if (io::order_type::row_major == fmt.order) { m = transpose(a); } - os << io::cr() - << '[' << m[0] << io::cr() - << ' ' << m[1] << io::cr() - << ' ' << m[2] << ']'; + if (fmt.formatted) { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.newline + << fmt.space << m[2] << fmt.delim_right; + } else { + os << m[0] << fmt.space << m[1] << fmt.space << m[2]; + } } return os; @@ -242,17 +338,22 @@ namespace glm typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { - tmat4x2 m(a); + io::format_punct const& fmt(io::get_facet>(os)); + tmat4x2 m(a); - if (io::order_t::row_major == io::order()) { + if (io::order_type::row_major == fmt.order) { m = transpose(a); } - os << io::cr() - << '[' << m[0] << io::cr() - << ' ' << m[1] << io::cr() - << ' ' << m[2] << io::cr() - << ' ' << m[3] << ']'; + if (fmt.formatted) { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.newline + << fmt.space << m[2] << fmt.newline + << fmt.space << m[3] << fmt.delim_right; + } else { + os << m[0] << fmt.space << m[1] << fmt.space << m[2] << fmt.space << m[3]; + } } return os; @@ -265,15 +366,20 @@ namespace glm typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { - tmat2x3 m(a); + io::format_punct const& fmt(io::get_facet>(os)); + tmat2x3 m(a); - if (io::order_t::row_major == io::order()) { + if (io::order_type::row_major == fmt.order) { m = transpose(a); } - os << io::cr() - << '[' << m[0] << io::cr() - << ' ' << m[1] << ']'; + if (fmt.formatted) { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.delim_right; + } else { + os << m[0] << fmt.space << m[1]; + } } return os; @@ -286,16 +392,21 @@ namespace glm typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { - tmat3x3 m(a); + io::format_punct const& fmt(io::get_facet>(os)); + tmat3x3 m(a); - if (io::order_t::row_major == io::order()) { + if (io::order_type::row_major == fmt.order) { m = transpose(a); } - os << io::cr() - << '[' << m[0] << io::cr() - << ' ' << m[1] << io::cr() - << ' ' << m[2] << ']'; + if (fmt.formatted) { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.newline + << fmt.space << m[2] << fmt.delim_right; + } else { + os << m[0] << fmt.space << m[1] << fmt.space << m[2]; + } } return os; @@ -308,17 +419,22 @@ namespace glm typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { - tmat4x3 m(a); + io::format_punct const& fmt(io::get_facet>(os)); + tmat4x3 m(a); - if (io::order_t::row_major == io::order()) { + if (io::order_type::row_major == fmt.order) { m = transpose(a); } - os << io::cr() - << '[' << m[0] << io::cr() - << ' ' << m[1] << io::cr() - << ' ' << m[2] << io::cr() - << ' ' << m[3] << ']'; + if (fmt.formatted) { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.newline + << fmt.space << m[2] << fmt.newline + << fmt.space << m[3] << fmt.delim_right; + } else { + os << m[0] << fmt.space << m[1] << fmt.space << m[2] << fmt.space << m[3]; + } } return os; @@ -331,15 +447,20 @@ namespace glm typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { - tmat2x4 m(a); + io::format_punct const& fmt(io::get_facet>(os)); + tmat2x4 m(a); - if (io::order_t::row_major == io::order()) { + if (io::order_type::row_major == fmt.order) { m = transpose(a); } - os << io::cr() - << '[' << m[0] << io::cr() - << ' ' << m[1] << ']'; + if (fmt.formatted) { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.delim_right; + } else { + os << m[0] << fmt.space << m[1]; + } } return os; @@ -352,16 +473,21 @@ namespace glm typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { - tmat3x4 m(a); + io::format_punct const& fmt(io::get_facet>(os)); + tmat3x4 m(a); - if (io::order_t::row_major == io::order()) { + if (io::order_type::row_major == fmt.order) { m = transpose(a); } - os << io::cr() - << '[' << m[0] << io::cr() - << ' ' << m[1] << io::cr() - << ' ' << m[2] << ']'; + if (fmt.formatted) { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.newline + << fmt.space << m[2] << fmt.delim_right; + } else { + os << m[0] << fmt.space << m[1] << fmt.space << m[2]; + } } return os; @@ -374,17 +500,22 @@ namespace glm typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { - tmat4x4 m(a); + io::format_punct const& fmt(io::get_facet>(os)); + tmat4x4 m(a); - if (io::order_t::row_major == io::order()) { + if (io::order_type::row_major == fmt.order) { m = transpose(a); } - os << io::cr() - << '[' << m[0] << io::cr() - << ' ' << m[1] << io::cr() - << ' ' << m[2] << io::cr() - << ' ' << m[3] << ']'; + if (fmt.formatted) { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.newline + << fmt.space << m[2] << fmt.newline + << fmt.space << m[3] << fmt.delim_right; + } else { + os << m[0] << fmt.space << m[1] << fmt.space << m[2] << fmt.space << m[3]; + } } return os; @@ -398,19 +529,28 @@ namespace glm typename std::basic_ostream::sentry const cerberus(os); if (cerberus) { - tmat4x4 ml(a.first); - tmat4x4 mr(a.second); + io::format_punct const& fmt(io::get_facet>(os)); + tmat4x4 ml(a.first); + tmat4x4 mr(a.second); - if (io::order_t::row_major == io::order()) { + if (io::order_type::row_major == fmt.order) { ml = transpose(a.first); mr = transpose(a.second); } + + if (fmt.formatted) { + CTy const& l(fmt.delim_left); + CTy const& r(fmt.delim_right); + CTy const& s(fmt.space); - os << io::cr() - << '[' << ml[0] << " [" << mr[0] << io::cr() - << ' ' << ml[1] << " " << mr[1] << io::cr() - << ' ' << ml[2] << " " << mr[2] << io::cr() - << ' ' << ml[3] << "] " << mr[3] << ']'; + os << fmt.newline + << l << ml[0] << s << s << l << mr[0] << fmt.newline + << s << ml[1] << s << s << s << mr[1] << fmt.newline + << s << ml[2] << s << s << s << mr[2] << fmt.newline + << s << ml[3] << r << s << s << mr[3] << r; + } else { + os << ml << fmt.space << mr; + } } return os; diff --git a/test/gtx/gtx_io.cpp b/test/gtx/gtx_io.cpp index 86792bc9..1f23a4f2 100644 --- a/test/gtx/gtx_io.cpp +++ b/test/gtx/gtx_io.cpp @@ -34,6 +34,32 @@ namespace { } // namespace { +template +int test_io_quat(OS& os) +{ + os << '\n' + << typeid(OS).name() + << '\n'; + + glm::detail::tquat const q(1, 0, 0, 0); + + { + glm::io::basic_format_saver const iofs(os); + + os << glm::io::precision(2) << glm::io::width(1 + 2 + 1 + 2) + << "quat<" << typeid(T).name() << ',' << P << ">: " << q << '\n'; + } + + { + glm::io::basic_format_saver const iofs(os); + + os << glm::io::unformatted() + << "quat<" << typeid(T).name() << ',' << P << ">: " << q << '\n'; + } + + return 0; +} + template int test_io_vec(OS& os) { @@ -49,12 +75,10 @@ int test_io_vec(OS& os) << "vec3<" << typeid(T).name() << ',' << P << ">: " << v3 << '\n' << "vec4<" << typeid(T).name() << ',' << P << ">: " << v4 << '\n'; - glm::io::precision_guard const iopg; + glm::io::basic_format_saver const iofs(os); - glm::io::precision() = 2; - glm::io::value_width() = 1 + 2 + 1 + glm::io::precision(); - - os << "vec2<" << typeid(T).name() << ',' << P << ">: " << v2 << '\n' + os << glm::io::precision(2) << glm::io::width(1 + 2 + 1 + 2) + << "vec2<" << typeid(T).name() << ',' << P << ">: " << v2 << '\n' << "vec3<" << typeid(T).name() << ',' << P << ">: " << v3 << '\n' << "vec4<" << typeid(T).name() << ',' << P << ">: " << v4 << '\n'; @@ -93,12 +117,10 @@ int test_io_mat(OS& os) << "mat4x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x4(v4_1, v4_2, v4_3, v4_4) << '\n'; #endif - glm::io::precision_guard const iopg; + glm::io::basic_format_saver const iofs(os); - glm::io::precision() = 2; - glm::io::value_width() = 1 + 2 + 1 + glm::io::precision(); - - os << "mat2x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x2(v2_1, v2_2) << '\n' + os << glm::io::precision(2) << glm::io::width(1 + 2 + 1 + 2) + << "mat2x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x2(v2_1, v2_2) << '\n' << "mat2x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x3(v3_1, v3_2) << '\n' << "mat2x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x4(v4_1, v4_2) << '\n' << "mat3x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x2(v2_1, v2_2, v2_3) << '\n' @@ -108,7 +130,8 @@ int test_io_mat(OS& os) << "mat4x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x3(v3_1, v3_2, v3_3, v3_4) << '\n' << "mat4x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x4(v4_1, v4_2, v4_3, v4_4) << '\n'; - os << glm::io::column_major + os << glm::io::unformatted() + << glm::io::order(glm::io::order_type::column_major) << "mat2x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x2(v2_1, v2_2) << '\n' << "mat2x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x3(v3_1, v3_2) << '\n' << "mat2x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x4(v4_1, v4_2) << '\n' @@ -126,6 +149,13 @@ int main() { int Error(0); + Error += test_io_quat(std::cout); + Error += test_io_quat(std::wcout); + Error += test_io_quat(std::cout); + Error += test_io_quat(std::wcout); + Error += test_io_quat(std::cout); + Error += test_io_quat(std::wcout); + Error += test_io_vec(std::cout); Error += test_io_vec(std::wcout); Error += test_io_vec(std::cout); From 0e3cebf23a48c0ddb3763d9d7eedaf4cfef664d8 Mon Sep 17 00:00:00 2001 From: jan p springer Date: Wed, 18 Dec 2013 10:34:06 +0000 Subject: [PATCH 02/47] removed boost dependencies --- glm/gtx/io.hpp | 46 +++++++++++++++++++++++++++++++++++++-------- glm/gtx/io.inl | 41 +++++++++++++++++++++++++++++----------- test/gtx/gtx_io.cpp | 43 ++++++++++++++++++++++++++++++++++-------- 3 files changed, 103 insertions(+), 27 deletions(-) diff --git a/glm/gtx/io.hpp b/glm/gtx/io.hpp index 71ae187d..f1b8dd53 100644 --- a/glm/gtx/io.hpp +++ b/glm/gtx/io.hpp @@ -26,7 +26,7 @@ /// @author Jan P Springer (regnirpsj@gmail.com) /// /// @see core (dependence) -/// @see gtx_quaternion (dependence) +/// @see gtc_quaternion (dependence) /// /// @defgroup gtx_io GLM_GTX_io /// @ingroup gtx @@ -51,11 +51,9 @@ # pragma message("GLM: GLM_GTX_io extension included") #endif -#include // basic_ios_all_saver<> (fwd) -#include // boost::noncopyable -#include // std::basic_ostream<> (fwd) -#include // std::locale, std::locale::facet, std::locale::id -#include // std::pair<> +#include // std::basic_ostream<> (fwd) +#include // std::locale, std::locale::facet, std::locale::id +#include // std::pair<> namespace glm { @@ -92,7 +90,37 @@ namespace glm }; template > - class basic_format_saver : private boost::noncopyable { + class basic_state_saver { + + public: + + explicit basic_state_saver(std::basic_ios&); + ~basic_state_saver(); + + private: + + typedef ::std::basic_ios state_type; + typedef typename state_type::char_type char_type; + typedef ::std::ios_base::fmtflags flags_type; + typedef ::std::streamsize streamsize_type; + typedef ::std::locale const locale_type; + + state_type& state_; + flags_type flags_; + streamsize_type precision_; + streamsize_type width_; + char_type fill_; + locale_type locale_; + + basic_state_saver& operator=(basic_state_saver const&); + + }; + + typedef basic_state_saver state_saver; + typedef basic_state_saver wstate_saver; + + template > + class basic_format_saver { public: @@ -101,7 +129,9 @@ namespace glm private: - boost::io::basic_ios_all_saver const ias_; + basic_state_saver const bss_; + + basic_format_saver& operator=(basic_format_saver const&); }; diff --git a/glm/gtx/io.inl b/glm/gtx/io.inl index c102f10a..7d3e88fc 100644 --- a/glm/gtx/io.inl +++ b/glm/gtx/io.inl @@ -2,15 +2,13 @@ // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2013-11-22 -// Updated : 2013-12-17 +// Updated : 2013-12-18 // Licence : This source is under MIT License // File : glm/gtx/inl.inl /////////////////////////////////////////////////////////////////////////////////////////////////// -#include // boost::io::ios_all_saver -#include // std::setfill<>, std::fixed, std::setprecision, std::right, - // std::setw -#include // std::basic_ostream<> +#include // std::setfill<>, std::fixed, std::setprecision, std::right, std::setw +#include // std::basic_ostream<> namespace glm { @@ -49,11 +47,32 @@ namespace glm template std::locale::id format_punct::id; + template + /* explicit */ GLM_FUNC_QUALIFIER + basic_state_saver::basic_state_saver(std::basic_ios& a) + : state_ (a), + flags_ (a.flags()), + precision_(a.precision()), + width_ (a.width()), + fill_ (a.fill()), + locale_ (a.getloc()) + {} + + template + GLM_FUNC_QUALIFIER + basic_state_saver::~basic_state_saver() + { + state_.imbue(locale_); + state_.fill(fill_); + state_.width(width_); + state_.precision(precision_); + state_.flags(flags_); + } + template /* explicit */ GLM_FUNC_QUALIFIER basic_format_saver::basic_format_saver(std::basic_ios& a) - : boost::noncopyable(), - ias_ (a) + : bss_(a) { a.imbue(std::locale(a.getloc(), new format_punct(get_facet>(a)))); } @@ -171,7 +190,7 @@ namespace glm io::format_punct const& fmt(io::get_facet>(os)); if (fmt.formatted) { - boost::io::basic_ios_all_saver const ias(os); + io::basic_state_saver const bss(os); os << std::fixed << std::right @@ -201,7 +220,7 @@ namespace glm io::format_punct const& fmt(io::get_facet>(os)); if (fmt.formatted) { - boost::io::basic_ios_all_saver const ias(os); + io::basic_state_saver const bss(os); os << std::fixed << std::right @@ -229,7 +248,7 @@ namespace glm io::format_punct const& fmt(io::get_facet>(os)); if (fmt.formatted) { - boost::io::basic_ios_all_saver const ias(os); + io::basic_state_saver const bss(os); os << std::fixed << std::right @@ -258,7 +277,7 @@ namespace glm io::format_punct const& fmt(io::get_facet>(os)); if (fmt.formatted) { - boost::io::basic_ios_all_saver const ias(os); + io::basic_state_saver const bss(os); os << std::fixed << std::right diff --git a/test/gtx/gtx_io.cpp b/test/gtx/gtx_io.cpp index 1f23a4f2..e9ab76e7 100644 --- a/test/gtx/gtx_io.cpp +++ b/test/gtx/gtx_io.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include namespace { @@ -32,6 +33,32 @@ namespace { return os; } + template + std::basic_string + type_name(std::basic_ostream& os, T const&) + { + std::basic_ostringstream ostr; + + if (typeid(T) == typeid(glm::detail::tquat)) { ostr << "quat"; } + else if (typeid(T) == typeid(glm::detail::tvec2)) { ostr << "vec2"; } + else if (typeid(T) == typeid(glm::detail::tvec3)) { ostr << "vec3"; } + else if (typeid(T) == typeid(glm::detail::tvec4)) { ostr << "vec4"; } + else if (typeid(T) == typeid(glm::detail::tmat2x2)) { ostr << "mat2x2"; } + else if (typeid(T) == typeid(glm::detail::tmat2x3)) { ostr << "mat2x3"; } + else if (typeid(T) == typeid(glm::detail::tmat2x4)) { ostr << "mat2x4"; } + else if (typeid(T) == typeid(glm::detail::tmat3x2)) { ostr << "mat3x2"; } + else if (typeid(T) == typeid(glm::detail::tmat3x3)) { ostr << "mat3x3"; } + else if (typeid(T) == typeid(glm::detail::tmat3x4)) { ostr << "mat3x4"; } + else if (typeid(T) == typeid(glm::detail::tmat4x2)) { ostr << "mat4x2"; } + else if (typeid(T) == typeid(glm::detail::tmat4x3)) { ostr << "mat4x3"; } + else if (typeid(T) == typeid(glm::detail::tmat4x4)) { ostr << "mat4x4"; } + else { ostr << "unknown"; } + + ostr << '<' << typeid(U).name() << ',' << P << '>'; + + return ostr.str(); + } + } // namespace { template @@ -47,14 +74,14 @@ int test_io_quat(OS& os) glm::io::basic_format_saver const iofs(os); os << glm::io::precision(2) << glm::io::width(1 + 2 + 1 + 2) - << "quat<" << typeid(T).name() << ',' << P << ">: " << q << '\n'; + << type_name(os, q) << ": " << q << '\n'; } { glm::io::basic_format_saver const iofs(os); os << glm::io::unformatted() - << "quat<" << typeid(T).name() << ',' << P << ">: " << q << '\n'; + << type_name(os, q) << ": " << q << '\n'; } return 0; @@ -71,16 +98,16 @@ int test_io_vec(OS& os) glm::detail::tvec3 const v3(2, 3, 4); glm::detail::tvec4 const v4(5, 6, 7, 8); - os << "vec2<" << typeid(T).name() << ',' << P << ">: " << v2 << '\n' - << "vec3<" << typeid(T).name() << ',' << P << ">: " << v3 << '\n' - << "vec4<" << typeid(T).name() << ',' << P << ">: " << v4 << '\n'; + os << type_name(os, v2) << ": " << v2 << '\n' + << type_name(os, v3) << ": " << v3 << '\n' + << type_name(os, v4) << ": " << v4 << '\n'; glm::io::basic_format_saver const iofs(os); os << glm::io::precision(2) << glm::io::width(1 + 2 + 1 + 2) - << "vec2<" << typeid(T).name() << ',' << P << ">: " << v2 << '\n' - << "vec3<" << typeid(T).name() << ',' << P << ">: " << v3 << '\n' - << "vec4<" << typeid(T).name() << ',' << P << ">: " << v4 << '\n'; + << type_name(os, v2) << ": " << v2 << '\n' + << type_name(os, v3) << ": " << v3 << '\n' + << type_name(os, v4) << ": " << v4 << '\n'; return 0; } From 39179ba1adde7f860826bc5e667f0f224758e5b3 Mon Sep 17 00:00:00 2001 From: jan p springer Date: Thu, 26 Dec 2013 15:15:53 +0000 Subject: [PATCH 03/47] un/formatted() usage to un/formatted --- glm/gtx/io.hpp | 11 ++++------- glm/gtx/io.inl | 18 +++++++++--------- test/gtx/gtx_io.cpp | 4 ++-- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/glm/gtx/io.hpp b/glm/gtx/io.hpp index f1b8dd53..9e68cd39 100644 --- a/glm/gtx/io.hpp +++ b/glm/gtx/io.hpp @@ -138,9 +138,6 @@ namespace glm typedef basic_format_saver format_saver; typedef basic_format_saver wformat_saver; - struct formatted { /* empty */ }; - struct unformatted { /* empty */ }; - struct precision { unsigned value; @@ -178,11 +175,11 @@ namespace glm template FTy const& get_facet(std::basic_ios&); + template + std::basic_ios& formatted(std::basic_ios&); + template + std::basic_ios& unformattet(std::basic_ios&); - template - std::basic_ostream& operator<<(std::basic_ostream&, formatted const&); - template - std::basic_ostream& operator<<(std::basic_ostream&, unformatted const&); template std::basic_ostream& operator<<(std::basic_ostream&, precision const&); template diff --git a/glm/gtx/io.inl b/glm/gtx/io.inl index 7d3e88fc..84fc29d9 100644 --- a/glm/gtx/io.inl +++ b/glm/gtx/io.inl @@ -119,21 +119,21 @@ namespace glm } template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, formatted const&) + GLM_FUNC_QUALIFIER std::basic_ios& + formatted(std::basic_ios& ios) { - const_cast&>(get_facet>(os)).formatted = true; + const_cast&>(get_facet>(ios)).formatted = true; - return os; + return ios; } - + template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, unformatted const&) + GLM_FUNC_QUALIFIER std::basic_ios& + unformatted(std::basic_ios& ios) { - const_cast&>(get_facet>(os)).formatted = false; + const_cast&>(get_facet>(ios)).formatted = false; - return os; + return ios; } template diff --git a/test/gtx/gtx_io.cpp b/test/gtx/gtx_io.cpp index e9ab76e7..8c479b5f 100644 --- a/test/gtx/gtx_io.cpp +++ b/test/gtx/gtx_io.cpp @@ -80,7 +80,7 @@ int test_io_quat(OS& os) { glm::io::basic_format_saver const iofs(os); - os << glm::io::unformatted() + os << glm::io::unformatted << type_name(os, q) << ": " << q << '\n'; } @@ -157,7 +157,7 @@ int test_io_mat(OS& os) << "mat4x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x3(v3_1, v3_2, v3_3, v3_4) << '\n' << "mat4x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x4(v4_1, v4_2, v4_3, v4_4) << '\n'; - os << glm::io::unformatted() + os << glm::io::unformatted << glm::io::order(glm::io::order_type::column_major) << "mat2x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x2(v2_1, v2_2) << '\n' << "mat2x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x3(v3_1, v3_2) << '\n' From 478dc697ff9c46a034c9bc4143d6498ae63f98df Mon Sep 17 00:00:00 2001 From: jan p springer Date: Mon, 14 Apr 2014 00:11:25 +0100 Subject: [PATCH 04/47] fixed: compile problems w/ non-existent header files --- glm/ext.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glm/ext.hpp b/glm/ext.hpp index 95121dc7..5ea95f2f 100644 --- a/glm/ext.hpp +++ b/glm/ext.hpp @@ -73,7 +73,7 @@ #include "./gtc/quaternion.hpp" #include "./gtc/random.hpp" #include "./gtc/reciprocal.hpp" -#include "./gtc/swizzle.hpp" +// #include "./gtc/swizzle.hpp" #include "./gtc/type_precision.hpp" #include "./gtc/type_ptr.hpp" #include "./gtc/ulp.hpp" @@ -81,7 +81,7 @@ #include "./gtx/associated_min_max.hpp" #include "./gtx/bit.hpp" #include "./gtx/closest_point.hpp" -#include "./gtx/color_cast.hpp" +// #include "./gtx/color_cast.hpp" #include "./gtx/color_space.hpp" #include "./gtx/color_space_YCoCg.hpp" #include "./gtx/compatibility.hpp" From ae691ce39ada6783f451869350425325836a6b2b Mon Sep 17 00:00:00 2001 From: jan p springer Date: Mon, 14 Apr 2014 00:12:38 +0100 Subject: [PATCH 05/47] commented out already declred types (in glm/fwd.hpp) --- glm/gtc/type_precision.hpp | 164 ++++++++++++++++++------------------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/glm/gtc/type_precision.hpp b/glm/gtc/type_precision.hpp index 5894bc58..bc4a1c91 100644 --- a/glm/gtc/type_precision.hpp +++ b/glm/gtc/type_precision.hpp @@ -255,70 +255,70 @@ namespace glm /// 8 bit signed integer scalar type. /// @see gtc_type_precision - typedef detail::tvec1 i8vec1; + // typedef detail::tvec1 i8vec1; /// 8 bit signed integer vector of 2 components type. /// @see gtc_type_precision - typedef detail::tvec2 i8vec2; + //typedef detail::tvec2 i8vec2; /// 8 bit signed integer vector of 3 components type. /// @see gtc_type_precision - typedef detail::tvec3 i8vec3; + //typedef detail::tvec3 i8vec3; /// 8 bit signed integer vector of 4 components type. /// @see gtc_type_precision - typedef detail::tvec4 i8vec4; + //typedef detail::tvec4 i8vec4; /// 16 bit signed integer scalar type. /// @see gtc_type_precision - typedef detail::tvec1 i16vec1; + //typedef detail::tvec1 i16vec1; /// 16 bit signed integer vector of 2 components type. /// @see gtc_type_precision - typedef detail::tvec2 i16vec2; + //typedef detail::tvec2 i16vec2; /// 16 bit signed integer vector of 3 components type. /// @see gtc_type_precision - typedef detail::tvec3 i16vec3; + //typedef detail::tvec3 i16vec3; /// 16 bit signed integer vector of 4 components type. /// @see gtc_type_precision - typedef detail::tvec4 i16vec4; + //typedef detail::tvec4 i16vec4; /// 32 bit signed integer scalar type. /// @see gtc_type_precision - typedef detail::tvec1 i32vec1; + //typedef detail::tvec1 i32vec1; /// 32 bit signed integer vector of 2 components type. /// @see gtc_type_precision - typedef detail::tvec2 i32vec2; + //typedef detail::tvec2 i32vec2; /// 32 bit signed integer vector of 3 components type. /// @see gtc_type_precision - typedef detail::tvec3 i32vec3; + //typedef detail::tvec3 i32vec3; /// 32 bit signed integer vector of 4 components type. /// @see gtc_type_precision - typedef detail::tvec4 i32vec4; + //typedef detail::tvec4 i32vec4; /// 64 bit signed integer scalar type. /// @see gtc_type_precision - typedef detail::tvec1 i64vec1; + //typedef detail::tvec1 i64vec1; /// 64 bit signed integer vector of 2 components type. /// @see gtc_type_precision - typedef detail::tvec2 i64vec2; + //typedef detail::tvec2 i64vec2; /// 64 bit signed integer vector of 3 components type. /// @see gtc_type_precision - typedef detail::tvec3 i64vec3; + //typedef detail::tvec3 i64vec3; /// 64 bit signed integer vector of 4 components type. /// @see gtc_type_precision - typedef detail::tvec4 i64vec4; + //typedef detail::tvec4 i64vec4; ///////////////////////////// @@ -520,70 +520,70 @@ namespace glm /// Default precision 8 bit unsigned integer scalar type. /// @see gtc_type_precision - typedef detail::tvec1 u8vec1; + //typedef detail::tvec1 u8vec1; /// Default precision 8 bit unsigned integer vector of 2 components type. /// @see gtc_type_precision - typedef detail::tvec2 u8vec2; + //typedef detail::tvec2 u8vec2; /// Default precision 8 bit unsigned integer vector of 3 components type. /// @see gtc_type_precision - typedef detail::tvec3 u8vec3; + //typedef detail::tvec3 u8vec3; /// Default precision 8 bit unsigned integer vector of 4 components type. /// @see gtc_type_precision - typedef detail::tvec4 u8vec4; + //typedef detail::tvec4 u8vec4; /// Default precision 16 bit unsigned integer scalar type. /// @see gtc_type_precision - typedef detail::tvec1 u16vec1; + //typedef detail::tvec1 u16vec1; /// Default precision 16 bit unsigned integer vector of 2 components type. /// @see gtc_type_precision - typedef detail::tvec2 u16vec2; + //typedef detail::tvec2 u16vec2; /// Default precision 16 bit unsigned integer vector of 3 components type. /// @see gtc_type_precision - typedef detail::tvec3 u16vec3; + //typedef detail::tvec3 u16vec3; /// Default precision 16 bit unsigned integer vector of 4 components type. /// @see gtc_type_precision - typedef detail::tvec4 u16vec4; + //typedef detail::tvec4 u16vec4; /// Default precision 32 bit unsigned integer scalar type. /// @see gtc_type_precision - typedef detail::tvec1 u32vec1; + //typedef detail::tvec1 u32vec1; /// Default precision 32 bit unsigned integer vector of 2 components type. /// @see gtc_type_precision - typedef detail::tvec2 u32vec2; + //typedef detail::tvec2 u32vec2; /// Default precision 32 bit unsigned integer vector of 3 components type. /// @see gtc_type_precision - typedef detail::tvec3 u32vec3; + //typedef detail::tvec3 u32vec3; /// Default precision 32 bit unsigned integer vector of 4 components type. /// @see gtc_type_precision - typedef detail::tvec4 u32vec4; + //typedef detail::tvec4 u32vec4; /// Default precision 64 bit unsigned integer scalar type. /// @see gtc_type_precision - typedef detail::tvec1 u64vec1; + //typedef detail::tvec1 u64vec1; /// Default precision 64 bit unsigned integer vector of 2 components type. /// @see gtc_type_precision - typedef detail::tvec2 u64vec2; + //typedef detail::tvec2 u64vec2; /// Default precision 64 bit unsigned integer vector of 3 components type. /// @see gtc_type_precision - typedef detail::tvec3 u64vec3; + //typedef detail::tvec3 u64vec3; /// Default precision 64 bit unsigned integer vector of 4 components type. /// @see gtc_type_precision - typedef detail::tvec4 u64vec4; + //typedef detail::tvec4 u64vec4; ////////////////////// @@ -618,53 +618,53 @@ namespace glm /// Single-precision floating-point vector of 1 component. /// @see gtc_type_precision - typedef detail::tvec1 fvec1; + //typedef detail::tvec1 fvec1; /// Single-precision floating-point vector of 2 components. /// @see gtc_type_precision - typedef detail::tvec2 fvec2; + //typedef detail::tvec2 fvec2; /// Single-precision floating-point vector of 3 components. /// @see gtc_type_precision - typedef detail::tvec3 fvec3; + //typedef detail::tvec3 fvec3; /// Single-precision floating-point vector of 4 components. /// @see gtc_type_precision - typedef detail::tvec4 fvec4; + //typedef detail::tvec4 fvec4; /// Single-precision floating-point vector of 1 component. /// @see gtc_type_precision - typedef detail::tvec1 f32vec1; + //typedef detail::tvec1 f32vec1; /// Single-precision floating-point vector of 2 components. /// @see gtc_type_precision - typedef detail::tvec2 f32vec2; + //typedef detail::tvec2 f32vec2; /// Single-precision floating-point vector of 3 components. /// @see gtc_type_precision - typedef detail::tvec3 f32vec3; + //typedef detail::tvec3 f32vec3; /// Single-precision floating-point vector of 4 components. /// @see gtc_type_precision - typedef detail::tvec4 f32vec4; + //typedef detail::tvec4 f32vec4; /// Double-precision floating-point vector of 1 component. /// @see gtc_type_precision - typedef detail::tvec1 f64vec1; + //typedef detail::tvec1 f64vec1; /// Double-precision floating-point vector of 2 components. /// @see gtc_type_precision - typedef detail::tvec2 f64vec2; + //typedef detail::tvec2 f64vec2; /// Double-precision floating-point vector of 3 components. /// @see gtc_type_precision - typedef detail::tvec3 f64vec3; + //typedef detail::tvec3 f64vec3; /// Double-precision floating-point vector of 4 components. /// @see gtc_type_precision - typedef detail::tvec4 f64vec4; + //typedef detail::tvec4 f64vec4; ////////////////////// @@ -676,15 +676,15 @@ namespace glm /// Single-precision floating-point 2x2 matrix. /// @see gtc_type_precision - typedef detail::tmat2x2 fmat2; + //typedef detail::tmat2x2 fmat2; /// Single-precision floating-point 3x3 matrix. /// @see gtc_type_precision - typedef detail::tmat3x3 fmat3; + //typedef detail::tmat3x3 fmat3; /// Single-precision floating-point 4x4 matrix. /// @see gtc_type_precision - typedef detail::tmat4x4 fmat4; + //typedef detail::tmat4x4 fmat4; /// Single-precision floating-point 1x1 matrix. @@ -693,39 +693,39 @@ namespace glm /// Single-precision floating-point 2x2 matrix. /// @see gtc_type_precision - typedef detail::tmat2x2 fmat2x2; + //typedef detail::tmat2x2 fmat2x2; /// Single-precision floating-point 2x3 matrix. /// @see gtc_type_precision - typedef detail::tmat2x3 fmat2x3; + //typedef detail::tmat2x3 fmat2x3; /// Single-precision floating-point 2x4 matrix. /// @see gtc_type_precision - typedef detail::tmat2x4 fmat2x4; + //typedef detail::tmat2x4 fmat2x4; /// Single-precision floating-point 3x2 matrix. /// @see gtc_type_precision - typedef detail::tmat3x2 fmat3x2; + //typedef detail::tmat3x2 fmat3x2; /// Single-precision floating-point 3x3 matrix. /// @see gtc_type_precision - typedef detail::tmat3x3 fmat3x3; + //typedef detail::tmat3x3 fmat3x3; /// Single-precision floating-point 3x4 matrix. /// @see gtc_type_precision - typedef detail::tmat3x4 fmat3x4; + //typedef detail::tmat3x4 fmat3x4; /// Single-precision floating-point 4x2 matrix. /// @see gtc_type_precision - typedef detail::tmat4x2 fmat4x2; + //typedef detail::tmat4x2 fmat4x2; /// Single-precision floating-point 4x3 matrix. /// @see gtc_type_precision - typedef detail::tmat4x3 fmat4x3; + //typedef detail::tmat4x3 fmat4x3; /// Single-precision floating-point 4x4 matrix. /// @see gtc_type_precision - typedef detail::tmat4x4 fmat4x4; + //typedef detail::tmat4x4 fmat4x4; /// Single-precision floating-point 1x1 matrix. @@ -734,15 +734,15 @@ namespace glm /// Single-precision floating-point 2x2 matrix. /// @see gtc_type_precision - typedef detail::tmat2x2 f32mat2; + //typedef detail::tmat2x2 f32mat2; /// Single-precision floating-point 3x3 matrix. /// @see gtc_type_precision - typedef detail::tmat3x3 f32mat3; + //typedef detail::tmat3x3 f32mat3; /// Single-precision floating-point 4x4 matrix. /// @see gtc_type_precision - typedef detail::tmat4x4 f32mat4; + //typedef detail::tmat4x4 f32mat4; /// Single-precision floating-point 1x1 matrix. @@ -751,39 +751,39 @@ namespace glm /// Single-precision floating-point 2x2 matrix. /// @see gtc_type_precision - typedef detail::tmat2x2 f32mat2x2; + //typedef detail::tmat2x2 f32mat2x2; /// Single-precision floating-point 2x3 matrix. /// @see gtc_type_precision - typedef detail::tmat2x3 f32mat2x3; + //typedef detail::tmat2x3 f32mat2x3; /// Single-precision floating-point 2x4 matrix. /// @see gtc_type_precision - typedef detail::tmat2x4 f32mat2x4; + //typedef detail::tmat2x4 f32mat2x4; /// Single-precision floating-point 3x2 matrix. /// @see gtc_type_precision - typedef detail::tmat3x2 f32mat3x2; + //typedef detail::tmat3x2 f32mat3x2; /// Single-precision floating-point 3x3 matrix. /// @see gtc_type_precision - typedef detail::tmat3x3 f32mat3x3; + //typedef detail::tmat3x3 f32mat3x3; /// Single-precision floating-point 3x4 matrix. /// @see gtc_type_precision - typedef detail::tmat3x4 f32mat3x4; + //typedef detail::tmat3x4 f32mat3x4; /// Single-precision floating-point 4x2 matrix. /// @see gtc_type_precision - typedef detail::tmat4x2 f32mat4x2; + //typedef detail::tmat4x2 f32mat4x2; /// Single-precision floating-point 4x3 matrix. /// @see gtc_type_precision - typedef detail::tmat4x3 f32mat4x3; + //typedef detail::tmat4x3 f32mat4x3; /// Single-precision floating-point 4x4 matrix. /// @see gtc_type_precision - typedef detail::tmat4x4 f32mat4x4; + //typedef detail::tmat4x4 f32mat4x4; /// Double-precision floating-point 1x1 matrix. @@ -792,15 +792,15 @@ namespace glm /// Double-precision floating-point 2x2 matrix. /// @see gtc_type_precision - typedef detail::tmat2x2 f64mat2; + //typedef detail::tmat2x2 f64mat2; /// Double-precision floating-point 3x3 matrix. /// @see gtc_type_precision - typedef detail::tmat3x3 f64mat3; + //typedef detail::tmat3x3 f64mat3; /// Double-precision floating-point 4x4 matrix. /// @see gtc_type_precision - typedef detail::tmat4x4 f64mat4; + //typedef detail::tmat4x4 f64mat4; /// Double-precision floating-point 1x1 matrix. @@ -809,39 +809,39 @@ namespace glm /// Double-precision floating-point 2x2 matrix. /// @see gtc_type_precision - typedef detail::tmat2x2 f64mat2x2; + //typedef detail::tmat2x2 f64mat2x2; /// Double-precision floating-point 2x3 matrix. /// @see gtc_type_precision - typedef detail::tmat2x3 f64mat2x3; + //typedef detail::tmat2x3 f64mat2x3; /// Double-precision floating-point 2x4 matrix. /// @see gtc_type_precision - typedef detail::tmat2x4 f64mat2x4; + //typedef detail::tmat2x4 f64mat2x4; /// Double-precision floating-point 3x2 matrix. /// @see gtc_type_precision - typedef detail::tmat3x2 f64mat3x2; + //typedef detail::tmat3x2 f64mat3x2; /// Double-precision floating-point 3x3 matrix. /// @see gtc_type_precision - typedef detail::tmat3x3 f64mat3x3; + //typedef detail::tmat3x3 f64mat3x3; /// Double-precision floating-point 3x4 matrix. /// @see gtc_type_precision - typedef detail::tmat3x4 f64mat3x4; + //typedef detail::tmat3x4 f64mat3x4; /// Double-precision floating-point 4x2 matrix. /// @see gtc_type_precision - typedef detail::tmat4x2 f64mat4x2; + //typedef detail::tmat4x2 f64mat4x2; /// Double-precision floating-point 4x3 matrix. /// @see gtc_type_precision - typedef detail::tmat4x3 f64mat4x3; + //typedef detail::tmat4x3 f64mat4x3; /// Double-precision floating-point 4x4 matrix. /// @see gtc_type_precision - typedef detail::tmat4x4 f64mat4x4; + //typedef detail::tmat4x4 f64mat4x4; ////////////////////////// @@ -849,11 +849,11 @@ namespace glm /// Single-precision floating-point quaternion. /// @see gtc_type_precision - typedef detail::tquat f32quat; + //typedef detail::tquat f32quat; /// Double-precision floating-point quaternion. /// @see gtc_type_precision - typedef detail::tquat f64quat; + //typedef detail::tquat f64quat; /// @} }//namespace glm From 37e586820080437a7e26441b2dd54398cc1d4d48 Mon Sep 17 00:00:00 2001 From: jan p springer Date: Mon, 14 Apr 2014 00:13:20 +0100 Subject: [PATCH 06/47] fixed: warning wrt. strict aliasing on gcc 4.8.2/clang3.3 --- glm/core/func_exponential.inl | 6 +++++- glm/core/func_integer.inl | 5 +++-- glm/core/func_packing.inl | 12 +++++++++--- glm/gtx/bit.inl | 4 ++-- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/glm/core/func_exponential.inl b/glm/core/func_exponential.inl index 9c03129e..e8ff4cfe 100644 --- a/glm/core/func_exponential.inl +++ b/glm/core/func_exponential.inl @@ -179,7 +179,11 @@ namespace detail genType xhalf(tmp * genType(0.5f)); genUType i = *reinterpret_cast(const_cast(&v)); i = genUType(0x5f375a86) - (i >> genUType(1)); - tmp = *reinterpret_cast(&i); + // tmp = *reinterpret_cast(&i); + { + genType* ptr(reinterpret_cast(&i)); + tmp = *ptr; + } tmp = tmp * (genType(1.5f) - xhalf * tmp * tmp); return tmp; } diff --git a/glm/core/func_integer.inl b/glm/core/func_integer.inl index 370e7770..b18696bd 100644 --- a/glm/core/func_integer.inl +++ b/glm/core/func_integer.inl @@ -172,7 +172,8 @@ namespace glm uint64 Value64 = static_cast(x) * static_cast(y); msb = *(reinterpret_cast(&Value64) + 1); - lsb = reinterpret_cast(Value64); + //lsb = reinterpret_cast(Value64); + lsb = *(reinterpret_cast(Value64)); } template <> @@ -231,7 +232,7 @@ namespace glm int64 Value64 = static_cast(x) * static_cast(y); msb = *(reinterpret_cast(&Value64) + 1); - lsb = reinterpret_cast(Value64); + // lsb = reinterpret_cast(Value64); } template <> diff --git a/glm/core/func_packing.inl b/glm/core/func_packing.inl index 7e26b91c..47b84733 100644 --- a/glm/core/func_packing.inl +++ b/glm/core/func_packing.inl @@ -35,7 +35,9 @@ namespace glm GLM_FUNC_QUALIFIER uint packUnorm2x16(vec2 const & v) { u16vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 65535.0f)); - return reinterpret_cast(Topack); + // return reinterpret_cast(Topack); + uint* ptr(reinterpret_cast(&Topack)); + return *ptr; } GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint const & p) @@ -47,7 +49,9 @@ namespace glm GLM_FUNC_QUALIFIER uint packSnorm2x16(vec2 const & v) { i16vec2 Topack(round(clamp(v ,-1.0f, 1.0f) * 32767.0f)); - return reinterpret_cast(Topack); + // return reinterpret_cast(Topack); + uint* ptr(reinterpret_cast(&Topack)); + return *ptr; } GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint const & p) @@ -100,7 +104,9 @@ namespace glm detail::toFloat16(v.x), detail::toFloat16(v.y)); - return *reinterpret_cast(&Unpack); + //return *reinterpret_cast(&Unpack); + uint* ptr(reinterpret_cast(&Unpack)); + return *ptr; } GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v) diff --git a/glm/gtx/bit.inl b/glm/gtx/bit.inl index 53ac2954..571baf25 100644 --- a/glm/gtx/bit.inl +++ b/glm/gtx/bit.inl @@ -551,7 +551,7 @@ namespace glm assert(ToBit <= sizeof(genIUType) * std::size_t(8)); genIUType Result = Value; - for(std::size_t i = 0; i <= ToBit; ++i) + for(signed i = 0; i <= ToBit; ++i) Result |= (1 << i); return Result; } @@ -568,7 +568,7 @@ namespace glm assert(ToBit <= sizeof(genIUType) * std::size_t(8)); genIUType Result = Value; - for(std::size_t i = 0; i <= ToBit; ++i) + for(signed i = 0; i <= ToBit; ++i) Result &= ~(1 << i); return Result; } From 9ecc30c5dddd31b3cfdbcf667bbded186a5db2ef Mon Sep 17 00:00:00 2001 From: jan p springer Date: Tue, 15 Apr 2014 18:37:34 +0100 Subject: [PATCH 07/47] added: missing value_type typedef --- glm/gtc/quaternion.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index cc3c76ad..7ce9468c 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -56,6 +56,7 @@ namespace detail { enum ctor{null}; + typedef T value_type; typedef tvec4 bool_type; public: From d19766fcbf190dee8155a6ebaaabbb8dc6878bcf Mon Sep 17 00:00:00 2001 From: dachziegel Date: Mon, 5 May 2014 13:45:36 +0200 Subject: [PATCH 08/47] added GLM_FUNC_QUALIFIER to be able to use in CUDA --- glm/gtc/quaternion.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 951b62c4..6422cf6b 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -255,7 +255,7 @@ namespace detail template struct compute_dot { - static T call(tquat const & x, tquat const & y) + static GLM_FUNC_QUALIFIER T call(tquat const & x, tquat const & y) { tvec4 tmp(x.x * y.x, x.y * y.y, x.z * y.z, x.w * y.w); return (tmp.x + tmp.y) + (tmp.z + tmp.w); From e04ded9e39eb1a9a0ba900d51bdce47ffaadfd59 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 5 May 2014 23:08:49 +0200 Subject: [PATCH 09/47] Fixed glm::isinf and glm::isnan for with Android NDK 9d #191 --- glm/detail/func_common.inl | 12 ++++++++++-- glm/detail/setup.hpp | 2 ++ readme.txt | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index a788eb4c..5463e574 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -717,7 +717,11 @@ namespace detail return _isnan(x) != 0; # elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)) # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) - return _isnan(x) != 0; +# if(GLM_PLATFORM_ANDROID_VERSION >= 19) + return std::isnan(x); +# else + return _isnan(x) != 0; +# endif # else return std::isnan(x); # endif @@ -788,7 +792,11 @@ namespace detail return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; # elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)) # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) - return _isinf(x) != 0; +# if(GLM_PLATFORM_ANDROID_VERSION >= 19) + return std::isinf(x); +# else + return _isinf(x) != 0; +# endif # else return std::isinf(x); # endif diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 3eb99bc9..cd56a19d 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -68,6 +68,8 @@ # define GLM_PLATFORM GLM_PLATFORM_CHROME_NACL #elif defined(__ANDROID__) # define GLM_PLATFORM GLM_PLATFORM_ANDROID +# include +# define GLM_PLATFORM_ANDROID_VERSION __ANDROID_API__ #elif defined(__linux) # define GLM_PLATFORM GLM_PLATFORM_LINUX #elif defined(__unix) diff --git a/readme.txt b/readme.txt index 8c5c6a3d..89721e88 100644 --- a/readme.txt +++ b/readme.txt @@ -42,6 +42,7 @@ GLM 0.9.5.4: 2014-0X-XX - Fixed non-utf8 character #196 - Added FindGLM install for CMake #189 - Fixed GTX_color_space - saturation #195 +- Fixed glm::isinf and glm::isnan for with Android NDK 9d #191 ================================================================================ GLM 0.9.5.3: 2014-04-02 From affd405b37de71fc0fe2408edb8ed37f3bb0b7a4 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 6 May 2014 22:45:18 +0200 Subject: [PATCH 10/47] Fixed glm::isinf and glm::isnan for with Android NDK 9d #191, take 2 --- glm/detail/func_common.inl | 16 ++++------------ glm/detail/setup.hpp | 2 -- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 5463e574..4026e0c8 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -716,12 +716,8 @@ namespace detail # if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL)) return _isnan(x) != 0; # elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)) -# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) -# if(GLM_PLATFORM_ANDROID_VERSION >= 19) - return std::isnan(x); -# else - return _isnan(x) != 0; -# endif +# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L) + return _isnan(x) != 0; # else return std::isnan(x); # endif @@ -791,12 +787,8 @@ namespace detail # if(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC)) return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; # elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)) -# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) -# if(GLM_PLATFORM_ANDROID_VERSION >= 19) - return std::isinf(x); -# else - return _isinf(x) != 0; -# endif +# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L) + return _isinf(x) != 0; # else return std::isinf(x); # endif diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index cd56a19d..3eb99bc9 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -68,8 +68,6 @@ # define GLM_PLATFORM GLM_PLATFORM_CHROME_NACL #elif defined(__ANDROID__) # define GLM_PLATFORM GLM_PLATFORM_ANDROID -# include -# define GLM_PLATFORM_ANDROID_VERSION __ANDROID_API__ #elif defined(__linux) # define GLM_PLATFORM GLM_PLATFORM_LINUX #elif defined(__unix) From a2f4df2b1d5635ac7eb14ca3a1de2a7094736d2b Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 23 May 2014 22:23:27 +0200 Subject: [PATCH 11/47] Fixed builtin GLM_ARCH_SSE4 #204 --- glm/detail/setup.hpp | 21 +++++++++++++-------- readme.txt | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 3eb99bc9..10ecc937 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -552,23 +552,26 @@ #define GLM_ARCH_PURE 0x0000 #define GLM_ARCH_SSE2 0x0001 -#define GLM_ARCH_SSE3 0x0002// | 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 +#define GLM_ARCH_SSE3 0x0002 +#define GLM_ARCH_SSE4 0x0004 +#define GLM_ARCH_AVX 0x0008 +#define GLM_ARCH_AVX2 0x0010 #if(defined(GLM_FORCE_PURE)) # define GLM_ARCH GLM_ARCH_PURE #elif(defined(GLM_FORCE_AVX2)) -# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) +# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) #elif(defined(GLM_FORCE_AVX)) -# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) +# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | 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) # if _M_IX86_FP == 2 && defined(__AVX__) -# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) +# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) # elif _M_IX86_FP == 2 # define GLM_ARCH (GLM_ARCH_SSE2) # else @@ -578,9 +581,11 @@ # define GLM_ARCH GLM_ARCH_PURE #elif(((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))) || (GLM_COMPILER & GLM_COMPILER_LLVM_GCC)) # if defined(__AVX2__) -# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) +# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) # elif defined(__AVX__) -# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) +# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) +# elif defined(__SSE4_1__ ) +# define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) # elif defined(__SSE3__) # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2) # elif defined(__SSE2__) diff --git a/readme.txt b/readme.txt index 89721e88..0c7f374b 100644 --- a/readme.txt +++ b/readme.txt @@ -43,6 +43,7 @@ GLM 0.9.5.4: 2014-0X-XX - Added FindGLM install for CMake #189 - Fixed GTX_color_space - saturation #195 - Fixed glm::isinf and glm::isnan for with Android NDK 9d #191 +- Fixed builtin GLM_ARCH_SSE4 #204 ================================================================================ GLM 0.9.5.3: 2014-04-02 From 4da58d88d4249fa43e49835c360e312a1653701e Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 23 May 2014 23:09:32 +0200 Subject: [PATCH 12/47] Optimized Quaternion vector rotation #205 --- glm/gtc/quaternion.inl | 13 ++++--------- readme.txt | 1 + 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 6422cf6b..9e926ee9 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -302,16 +302,11 @@ namespace detail detail::tvec3 const & v ) { - T Two(2); + detail::tvec3 u(q.x, q.y, q.z); + detail::tvec3 uv(glm::cross(u, v) * q.w); + detail::tvec3 uuv(glm::cross(u, uv)); - detail::tvec3 uv, uuv; - detail::tvec3 QuatVector(q.x, q.y, q.z); - uv = glm::cross(QuatVector, v); - uuv = glm::cross(QuatVector, uv); - uv *= (Two * q.w); - uuv *= Two; - - return v + uv + uuv; + return v + (uv + uuv) * static_cast(2); } template diff --git a/readme.txt b/readme.txt index 0c7f374b..3c6c6905 100644 --- a/readme.txt +++ b/readme.txt @@ -44,6 +44,7 @@ GLM 0.9.5.4: 2014-0X-XX - Fixed GTX_color_space - saturation #195 - Fixed glm::isinf and glm::isnan for with Android NDK 9d #191 - Fixed builtin GLM_ARCH_SSE4 #204 +- Optimized Quaternion vector rotation #205 ================================================================================ GLM 0.9.5.3: 2014-04-02 From f8fa1513fa911660806593f95ed7f6144999539f Mon Sep 17 00:00:00 2001 From: Florian Euchner Date: Sat, 24 May 2014 16:59:14 +0200 Subject: [PATCH 13/47] Fix missing @endcond --- glm/detail/type_mat4x4.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index de561636..85844b07 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -59,6 +59,7 @@ namespace detail private: /// @cond DETAIL col_type value[4]; + /// @endcond public: // Constructors From e610e9446e6207390548c1a7e63f2caebec55cc7 Mon Sep 17 00:00:00 2001 From: Joel Nises Date: Thu, 5 Jun 2014 17:48:53 +0200 Subject: [PATCH 14/47] fixed bug in quaternion slerp --- glm/gtc/quaternion.inl | 8 ++++---- test/gtc/gtc_quaternion.cpp | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 9e926ee9..4059d426 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -582,10 +582,10 @@ namespace detail { // Linear interpolation return detail::tquat( - mix(x.w, y.w, a), - mix(x.x, y.x, a), - mix(x.y, y.y, a), - mix(x.z, y.z, a)); + mix(x.w, z.w, a), + mix(x.x, z.x, a), + mix(x.y, z.y, a), + mix(x.z, z.z, a)); } else { diff --git a/test/gtc/gtc_quaternion.cpp b/test/gtc/gtc_quaternion.cpp index 4346e8fc..5e5b120a 100644 --- a/test/gtc/gtc_quaternion.cpp +++ b/test/gtc/gtc_quaternion.cpp @@ -196,6 +196,15 @@ int test_quat_slerp() // Must be 0 0.00X 0 0.99999 glm::quat almostid = glm::slerp(id, glm::angleAxis(0.1f, glm::vec3(0.0f, 1.0f, 0.0f)), 0.5f); + // Testing quaternions with opposite sign + { + glm::quat a(-1, 0, 0, 0); + + glm::quat result = glm::slerp(a, id, 0.5f); + + Error += glm::epsilonEqual(glm::pow(glm::dot(id, result), 2.f), 1.f, 0.01f) ? 0 : 1; + } + return Error; } From e2a565e866c7848115286733324c72453ac211b7 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 11 Jun 2014 16:39:46 +0200 Subject: [PATCH 15/47] Updated readme for issue #211 --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index 3c6c6905..cfafddb8 100644 --- a/readme.txt +++ b/readme.txt @@ -45,6 +45,7 @@ GLM 0.9.5.4: 2014-0X-XX - Fixed glm::isinf and glm::isnan for with Android NDK 9d #191 - Fixed builtin GLM_ARCH_SSE4 #204 - Optimized Quaternion vector rotation #205 +- Fixed missing doxygen @endcond tag #211 ================================================================================ GLM 0.9.5.3: 2014-04-02 From c3c180559a4d245258b03f39b1245b790d1baed8 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 11 Jun 2014 16:56:16 +0200 Subject: [PATCH 16/47] Fixed instruction set detection with Clang #158 --- glm/detail/setup.hpp | 2 +- readme.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 10ecc937..c982c469 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -579,7 +579,7 @@ # 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)) +#elif(((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))) || (GLM_COMPILER & GLM_COMPILER_LLVM_GCC) || (GLM_COMPILER & GLM_COMPILER_CLANG)) # if defined(__AVX2__) # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) # elif defined(__AVX__) diff --git a/readme.txt b/readme.txt index cfafddb8..416f3619 100644 --- a/readme.txt +++ b/readme.txt @@ -46,6 +46,7 @@ GLM 0.9.5.4: 2014-0X-XX - Fixed builtin GLM_ARCH_SSE4 #204 - Optimized Quaternion vector rotation #205 - Fixed missing doxygen @endcond tag #211 +- Fixed instruction set detection with Clang #158 ================================================================================ GLM 0.9.5.3: 2014-04-02 From ea45a7b966eb8dd6dff5a90c3578bbbb4e5fbc62 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 11 Jun 2014 22:47:37 +0200 Subject: [PATCH 17/47] Fixed orientate3 function #207 --- glm/gtx/euler_angles.inl | 2 +- readme.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/glm/gtx/euler_angles.inl b/glm/gtx/euler_angles.inl index b3102242..a1afcf3a 100644 --- a/glm/gtx/euler_angles.inl +++ b/glm/gtx/euler_angles.inl @@ -250,7 +250,7 @@ namespace glm detail::tvec3 const & angles ) { - return detail::tmat3x3(yawPitchRoll(angles.x, angles.y, angles.z)); + return detail::tmat3x3(yawPitchRoll(angles.z, angles.x, angles.y)); } template diff --git a/readme.txt b/readme.txt index 416f3619..e7dd0eb0 100644 --- a/readme.txt +++ b/readme.txt @@ -47,6 +47,7 @@ GLM 0.9.5.4: 2014-0X-XX - Optimized Quaternion vector rotation #205 - Fixed missing doxygen @endcond tag #211 - Fixed instruction set detection with Clang #158 +- Fixed orientate3 function #207 ================================================================================ GLM 0.9.5.3: 2014-04-02 From c506b43d49ac212388c2749d14a8acada4482021 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 12 Jun 2014 00:29:56 +0200 Subject: [PATCH 18/47] Quaternion vector rotation error. #209 --- glm/gtc/quaternion.inl | 8 ++++---- test/gtc/gtc_quaternion.cpp | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 9e926ee9..6396ea2e 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -302,11 +302,11 @@ namespace detail detail::tvec3 const & v ) { - detail::tvec3 u(q.x, q.y, q.z); - detail::tvec3 uv(glm::cross(u, v) * q.w); - detail::tvec3 uuv(glm::cross(u, uv)); + detail::tvec3 const QuatVector(q.x, q.y, q.z); + detail::tvec3 const uv(glm::cross(QuatVector, v)); + detail::tvec3 const uuv(glm::cross(QuatVector, uv)); - return v + (uv + uuv) * static_cast(2); + return v + ((uv * q.w) + uuv) * static_cast(2); } template diff --git a/test/gtc/gtc_quaternion.cpp b/test/gtc/gtc_quaternion.cpp index 4346e8fc..f56ad47e 100644 --- a/test/gtc/gtc_quaternion.cpp +++ b/test/gtc/gtc_quaternion.cpp @@ -247,6 +247,16 @@ int test_quat_type() return 0; } +int test_quat_mul_vec() +{ + glm::quat q = glm::angleAxis(glm::pi() * 0.5f, glm::vec3(0, 0, 1)); + glm::vec3 v(1, 0, 0); + glm::vec3 u(q * v); + glm::vec3 w(u * q); + + return glm::all(glm::epsilonEqual(v, w, 0.01f)); +} + int test_quat_ctr() { int Error(0); @@ -269,6 +279,7 @@ int main() int Error(0); Error += test_quat_ctr(); + Error += test_quat_mul_vec(); Error += test_quat_two_axis_ctr(); Error += test_quat_mul(); Error += test_quat_precision(); From d4a8c3fe5798eaf910bab96802621b331261c007 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 12 Jun 2014 19:30:53 +0200 Subject: [PATCH 19/47] Updated readme for #210 --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index e7dd0eb0..c8d11120 100644 --- a/readme.txt +++ b/readme.txt @@ -48,6 +48,7 @@ GLM 0.9.5.4: 2014-0X-XX - Fixed missing doxygen @endcond tag #211 - Fixed instruction set detection with Clang #158 - Fixed orientate3 function #207 +- Fixed lerp when cosTheta is close to 1 in quaternion slerp #210 ================================================================================ GLM 0.9.5.3: 2014-04-02 From 83f594b5ed2689f4e4ec6845396c46032b6ccacb Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 19 Jun 2014 23:05:35 +0200 Subject: [PATCH 20/47] Fixed quaternion mul/vec test --- test/gtc/gtc_quaternion.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/gtc/gtc_quaternion.cpp b/test/gtc/gtc_quaternion.cpp index 1d4c9233..fab238af 100644 --- a/test/gtc/gtc_quaternion.cpp +++ b/test/gtc/gtc_quaternion.cpp @@ -258,12 +258,16 @@ int test_quat_type() int test_quat_mul_vec() { + int Error(0); + glm::quat q = glm::angleAxis(glm::pi() * 0.5f, glm::vec3(0, 0, 1)); glm::vec3 v(1, 0, 0); glm::vec3 u(q * v); glm::vec3 w(u * q); - return glm::all(glm::epsilonEqual(v, w, 0.01f)); + Error += glm::all(glm::epsilonEqual(v, w, 0.01f)) ? 0 : 1; + + return Error; } int test_quat_ctr() From 2935cdc18e2b152f96c56e8b60cc0e2a47222b96 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 20 Jun 2014 00:21:53 +0200 Subject: [PATCH 21/47] Updated readme.txt --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index c8d11120..61dc33a0 100644 --- a/readme.txt +++ b/readme.txt @@ -49,6 +49,7 @@ GLM 0.9.5.4: 2014-0X-XX - Fixed instruction set detection with Clang #158 - Fixed orientate3 function #207 - Fixed lerp when cosTheta is close to 1 in quaternion slerp #210 +- Added GTX_io for io with #144 ================================================================================ GLM 0.9.5.3: 2014-04-02 From 7fe8a1944c66fb9acf3aa2930966cfafa4ee9e09 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 20 Jun 2014 01:09:50 +0200 Subject: [PATCH 22/47] Fixed fastDistance ambiguity #215 --- glm/detail/func_geometric.inl | 3 +-- glm/gtx/fast_square_root.inl | 32 ++++++++++++++++++++++++++++++- readme.txt | 1 + test/gtx/gtx_fast_square_root.cpp | 18 +++++++++++++++++ 4 files changed, 51 insertions(+), 3 deletions(-) diff --git a/glm/detail/func_geometric.inl b/glm/detail/func_geometric.inl index 2f8691dd..1e8cd633 100644 --- a/glm/detail/func_geometric.inl +++ b/glm/detail/func_geometric.inl @@ -92,8 +92,7 @@ namespace detail { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'length' only accept floating-point inputs"); - genType sqr = x * x; - return sqrt(sqr); + return abs(x); } template diff --git a/glm/gtx/fast_square_root.inl b/glm/gtx/fast_square_root.inl index a08bdbf2..198e03ab 100644 --- a/glm/gtx/fast_square_root.inl +++ b/glm/gtx/fast_square_root.inl @@ -101,13 +101,43 @@ namespace glm template GLM_FUNC_QUALIFIER genType fastDistance ( - genType const & x, + genType const & x, genType const & y ) { return fastLength(y - x); } + template + GLM_FUNC_QUALIFIER valType fastDistance + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { + return fastLength(y - x); + } + + template + GLM_FUNC_QUALIFIER valType fastDistance + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + return fastLength(y - x); + } + + template + GLM_FUNC_QUALIFIER valType fastDistance + ( + detail::tvec4 const & x, + detail::tvec4 const & y + ) + { + return fastLength(y - x); + } + // fastNormalize template GLM_FUNC_QUALIFIER genType fastNormalize diff --git a/readme.txt b/readme.txt index 61dc33a0..9e4e826a 100644 --- a/readme.txt +++ b/readme.txt @@ -50,6 +50,7 @@ GLM 0.9.5.4: 2014-0X-XX - Fixed orientate3 function #207 - Fixed lerp when cosTheta is close to 1 in quaternion slerp #210 - Added GTX_io for io with #144 +- Fixed fastDistance ambiguity #215 ================================================================================ GLM 0.9.5.3: 2014-04-02 diff --git a/test/gtx/gtx_fast_square_root.cpp b/test/gtx/gtx_fast_square_root.cpp index 788b341c..b9d41dcd 100644 --- a/test/gtx/gtx_fast_square_root.cpp +++ b/test/gtx/gtx_fast_square_root.cpp @@ -27,11 +27,29 @@ int test_fastInverseSqrt() return 0; } +int test_fastDistance() +{ + int Error(0); + + glm::mediump_f32 A = glm::fastDistance(glm::mediump_f32(0.0f), glm::mediump_f32(1.0f)); + glm::mediump_f32 B = glm::fastDistance(glm::mediump_f32vec2(0.0f), glm::mediump_f32vec2(1.0f, 0.0f)); + glm::mediump_f32 C = glm::fastDistance(glm::mediump_f32vec3(0.0f), glm::mediump_f32vec3(1.0f, 0.0f, 0.0f)); + glm::mediump_f32 D = glm::fastDistance(glm::mediump_f32vec4(0.0f), glm::mediump_f32vec4(1.0f, 0.0f, 0.0f, 0.0f)); + + Error += glm::epsilonEqual(A, glm::mediump_f32(1.0f), glm::mediump_f32(0.01f)) ? 0 : 1; + Error += glm::epsilonEqual(B, glm::mediump_f32(1.0f), glm::mediump_f32(0.01f)) ? 0 : 1; + Error += glm::epsilonEqual(C, glm::mediump_f32(1.0f), glm::mediump_f32(0.01f)) ? 0 : 1; + Error += glm::epsilonEqual(D, glm::mediump_f32(1.0f), glm::mediump_f32(0.01f)) ? 0 : 1; + + return Error; +} + int main() { int Error(0); Error += test_fastInverseSqrt(); + Error += test_fastDistance(); return Error; } From 84e05bbbb336095cdac880a58b4ec267b495220b Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 20 Jun 2014 01:46:28 +0200 Subject: [PATCH 23/47] Added test for issue #214 --- test/core/core_type_cast.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/core/core_type_cast.cpp b/test/core/core_type_cast.cpp index 7c002886..f86b9649 100644 --- a/test/core/core_type_cast.cpp +++ b/test/core/core_type_cast.cpp @@ -9,6 +9,9 @@ #define GLM_FORCE_RADIANS #include +#include +#include +#include struct my_vec2 { @@ -86,10 +89,23 @@ int test_vec4_cast() return Error; } +int test_std_copy() +{ + int Error = 0; + + std::vector High; + std::vector Medium(High.size()); + + std::copy(High.begin(), Medium.end(), Medium.begin()); + + return Error; +} + int main() { int Error = 0; + Error += test_std_copy(); Error += test_vec2_cast(); Error += test_vec3_cast(); Error += test_vec4_cast(); From 95cd2c8b241d2c21ad0c067ab6f064c79f984649 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 20 Jun 2014 20:06:41 +0200 Subject: [PATCH 24/47] Added #214 issue tests. --- test/core/core_type_cast.cpp | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/test/core/core_type_cast.cpp b/test/core/core_type_cast.cpp index f86b9649..f33972c6 100644 --- a/test/core/core_type_cast.cpp +++ b/test/core/core_type_cast.cpp @@ -93,10 +93,37 @@ int test_std_copy() { int Error = 0; - std::vector High; - std::vector Medium(High.size()); + { + std::vector High4; + std::vector Medium4(High4.size()); - std::copy(High.begin(), Medium.end(), Medium.begin()); + std::copy(&High4.begin()[0], &High4.end()[0], Medium4.begin()); + + *Medium4.begin() = *High4.begin(); + } + + { + std::vector High3; + std::vector Medium3(High3.size()); + + std::copy(&High3.begin()[0], &High3.end()[0], Medium3.begin()); + + *Medium3.begin() = *High3.begin(); + } + + { + std::vector High2; + std::vector Medium2(High2.size()); + + std::copy(&High2.begin()[0], &High2.end()[0], Medium2.begin()); + + *Medium2.begin() = *High2.begin(); + } + + glm::dvec4 v1; + glm::vec4 v2; + + v2 = v1; return Error; } From 7097e4c7c8f42a922b07208a291f1a0f587d682e Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 20 Jun 2014 22:13:06 +0200 Subject: [PATCH 25/47] Fixed tweakedInfinitePerspective #208 and added user-defined epsilon to tweakedInfinitePerspective --- glm/gtc/matrix_transform.hpp | 22 +++---- glm/gtc/matrix_transform.inl | 102 +++++++++++++++--------------- readme.txt | 2 + test/core/core_type_cast.cpp | 23 +++++-- test/gtc/gtc_matrix_transform.cpp | 42 +++++++++++- 5 files changed, 123 insertions(+), 68 deletions(-) diff --git a/glm/gtc/matrix_transform.hpp b/glm/gtc/matrix_transform.hpp index 2eb24cbf..1a9f0bac 100644 --- a/glm/gtc/matrix_transform.hpp +++ b/glm/gtc/matrix_transform.hpp @@ -164,8 +164,8 @@ namespace glm /// @param far /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @see gtc_matrix_transform - template - GLM_FUNC_DECL detail::tmat4x4 frustum( + template + GLM_FUNC_DECL detail::tmat4x4 frustum( T const & left, T const & right, T const & bottom, @@ -181,8 +181,8 @@ namespace glm /// @param far /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @see gtc_matrix_transform - template - GLM_FUNC_DECL detail::tmat4x4 perspective( + template + GLM_FUNC_DECL detail::tmat4x4 perspective( T const & fovy, T const & aspect, T const & near, @@ -197,8 +197,8 @@ namespace glm /// @param far /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @see gtc_matrix_transform - template - GLM_FUNC_DECL detail::tmat4x4 perspectiveFov( + template + GLM_FUNC_DECL detail::tmat4x4 perspectiveFov( T const & fov, T const & width, T const & height, @@ -212,8 +212,8 @@ namespace glm /// @param near /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @see gtc_matrix_transform - template - GLM_FUNC_DECL detail::tmat4x4 infinitePerspective( + template + GLM_FUNC_DECL detail::tmat4x4 infinitePerspective( T fovy, T aspect, T near); /// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping. @@ -223,9 +223,9 @@ namespace glm /// @param near /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @see gtc_matrix_transform - template - GLM_FUNC_DECL detail::tmat4x4 tweakedInfinitePerspective( - T fovy, T aspect, T near); + template + GLM_FUNC_DECL detail::tmat4x4 tweakedInfinitePerspective( + T fovy, T aspect, T near, T epsilon = epsilon()); /// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates. /// diff --git a/glm/gtc/matrix_transform.inl b/glm/gtc/matrix_transform.inl index 25f13751..03d201c6 100644 --- a/glm/gtc/matrix_transform.inl +++ b/glm/gtc/matrix_transform.inl @@ -192,87 +192,87 @@ namespace glm return Result; } - template - GLM_FUNC_QUALIFIER detail::tmat4x4 frustum + template + GLM_FUNC_QUALIFIER detail::tmat4x4 frustum ( - valType const & left, - valType const & right, - valType const & bottom, - valType const & top, - valType const & nearVal, - valType const & farVal + T const & left, + T const & right, + T const & bottom, + T const & top, + T const & nearVal, + T const & farVal ) { - detail::tmat4x4 Result(0); - Result[0][0] = (valType(2) * nearVal) / (right - left); - Result[1][1] = (valType(2) * nearVal) / (top - bottom); + detail::tmat4x4 Result(0); + Result[0][0] = (static_cast(2) * nearVal) / (right - left); + Result[1][1] = (static_cast(2) * nearVal) / (top - bottom); Result[2][0] = (right + left) / (right - left); Result[2][1] = (top + bottom) / (top - bottom); Result[2][2] = -(farVal + nearVal) / (farVal - nearVal); - Result[2][3] = valType(-1); - Result[3][2] = -(valType(2) * farVal * nearVal) / (farVal - nearVal); + Result[2][3] = static_cast(-1); + Result[3][2] = -(static_cast(2) * farVal * nearVal) / (farVal - nearVal); return Result; } - template - GLM_FUNC_QUALIFIER detail::tmat4x4 perspective + template + GLM_FUNC_QUALIFIER detail::tmat4x4 perspective ( - valType const & fovy, - valType const & aspect, - valType const & zNear, - valType const & zFar + T const & fovy, + T const & aspect, + T const & zNear, + T const & zFar ) { - assert(aspect != valType(0)); + assert(aspect != static_cast(0)); assert(zFar != zNear); #ifdef GLM_FORCE_RADIANS - valType const rad = fovy; + T const rad = fovy; #else # pragma message("GLM: perspective function taking degrees as a parameter is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") - valType const rad = glm::radians(fovy); + T const rad = glm::radians(fovy); #endif - valType tanHalfFovy = tan(rad / valType(2)); + T tanHalfFovy = tan(rad / static_cast(2)); - detail::tmat4x4 Result(valType(0)); - Result[0][0] = valType(1) / (aspect * tanHalfFovy); - Result[1][1] = valType(1) / (tanHalfFovy); + detail::tmat4x4 Result(static_cast(0)); + Result[0][0] = static_cast(1) / (aspect * tanHalfFovy); + Result[1][1] = static_cast(1) / (tanHalfFovy); Result[2][2] = - (zFar + zNear) / (zFar - zNear); - Result[2][3] = - valType(1); - Result[3][2] = - (valType(2) * zFar * zNear) / (zFar - zNear); + Result[2][3] = - static_cast(1); + Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); return Result; } - template - GLM_FUNC_QUALIFIER detail::tmat4x4 perspectiveFov + template + GLM_FUNC_QUALIFIER detail::tmat4x4 perspectiveFov ( - valType const & fov, - valType const & width, - valType const & height, - valType const & zNear, - valType const & zFar + T const & fov, + T const & width, + T const & height, + T const & zNear, + T const & zFar ) { - assert(width > valType(0)); - assert(height > valType(0)); - assert(fov > valType(0)); + assert(width > static_cast(0)); + assert(height > static_cast(0)); + assert(fov > static_cast(0)); #ifdef GLM_FORCE_RADIANS - valType rad = fov; + T rad = fov; #else # pragma message("GLM: perspectiveFov function taking degrees as a parameter is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") - valType rad = glm::radians(fov); + T rad = glm::radians(fov); #endif - valType h = glm::cos(valType(0.5) * rad) / glm::sin(valType(0.5) * rad); - valType w = h * height / width; ///todo max(width , Height) / min(width , Height)? + T h = glm::cos(static_cast(0.5) * rad) / glm::sin(static_cast(0.5) * rad); + T w = h * height / width; ///todo max(width , Height) / min(width , Height)? - detail::tmat4x4 Result(valType(0)); + detail::tmat4x4 Result(static_cast(0)); Result[0][0] = w; Result[1][1] = h; Result[2][2] = - (zFar + zNear) / (zFar - zNear); - Result[2][3] = - valType(1); - Result[3][2] = - (valType(2) * zFar * zNear) / (zFar - zNear); + Result[2][3] = - static_cast(1); + Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); return Result; } @@ -304,12 +304,14 @@ namespace glm return Result; } + // Infinite projection matrix: http://www.terathon.com/gdc07_lengyel.pdf template GLM_FUNC_QUALIFIER detail::tmat4x4 tweakedInfinitePerspective ( T fovy, T aspect, - T zNear + T zNear, + T epsilon ) { #ifdef GLM_FORCE_RADIANS @@ -324,11 +326,11 @@ namespace glm T top = range; detail::tmat4x4 Result(T(0)); - Result[0][0] = (T(2) * zNear) / (right - left); - Result[1][1] = (T(2) * zNear) / (top - bottom); - Result[2][2] = static_cast(0.0001) - T(1); + Result[0][0] = (static_cast(2) * zNear) / (right - left); + Result[1][1] = (static_cast(2) * zNear) / (top - bottom); + Result[2][2] = epsilon - static_cast(1); Result[2][3] = static_cast(-1); - Result[3][2] = - (T(0.0001) - T(2)) * zNear; + Result[3][2] = (epsilon - static_cast(2)) * zNear; return Result; } diff --git a/readme.txt b/readme.txt index 9e4e826a..efeff376 100644 --- a/readme.txt +++ b/readme.txt @@ -51,6 +51,8 @@ GLM 0.9.5.4: 2014-0X-XX - Fixed lerp when cosTheta is close to 1 in quaternion slerp #210 - Added GTX_io for io with #144 - Fixed fastDistance ambiguity #215 +- Fixed tweakedInfinitePerspective #208 and added user-defined epsilon to + tweakedInfinitePerspective ================================================================================ GLM 0.9.5.3: 2014-04-02 diff --git a/test/core/core_type_cast.cpp b/test/core/core_type_cast.cpp index f33972c6..97e2fdd6 100644 --- a/test/core/core_type_cast.cpp +++ b/test/core/core_type_cast.cpp @@ -94,28 +94,41 @@ int test_std_copy() int Error = 0; { - std::vector High4; - std::vector Medium4(High4.size()); + std::vector High; + High.resize(64); + std::vector Medium(High.size()); + + std::copy(High.begin(), High.end(), Medium.begin()); - std::copy(&High4.begin()[0], &High4.end()[0], Medium4.begin()); + *Medium.begin() = *High.begin(); + } + + { + std::vector High4; + High4.resize(64); + std::vector Medium4(High4.size()); + + std::copy(High4.begin(), High4.end(), Medium4.begin()); *Medium4.begin() = *High4.begin(); } { std::vector High3; + High3.resize(64); std::vector Medium3(High3.size()); - std::copy(&High3.begin()[0], &High3.end()[0], Medium3.begin()); + std::copy(High3.begin(), High3.end(), Medium3.begin()); *Medium3.begin() = *High3.begin(); } { std::vector High2; + High2.resize(64); std::vector Medium2(High2.size()); - std::copy(&High2.begin()[0], &High2.end()[0], Medium2.begin()); + std::copy(High2.begin(), High2.end(), Medium2.begin()); *Medium2.begin() = *High2.begin(); } diff --git a/test/gtc/gtc_matrix_transform.cpp b/test/gtc/gtc_matrix_transform.cpp index 05d5f50e..0ea54598 100644 --- a/test/gtc/gtc_matrix_transform.cpp +++ b/test/gtc/gtc_matrix_transform.cpp @@ -11,16 +11,54 @@ #include #include -int main() +int test_perspective() { int Error = 0; - + glm::mat4 Projection = glm::perspective(glm::pi() * 0.25f, 4.0f / 3.0f, 0.1f, 100.0f); + + return Error; +} + +int test_pick() +{ + int Error = 0; + glm::mat4 Pick = glm::pickMatrix(glm::vec2(1, 2), glm::vec2(3, 4), glm::ivec4(0, 0, 320, 240)); + return Error; +} + +int test_tweakedInfinitePerspective() +{ + int Error = 0; + + glm::mat4 ProjectionA = glm::tweakedInfinitePerspective(45.f, 640.f/480.f, 1.0f); + glm::mat4 ProjectionB = glm::tweakedInfinitePerspective(45.f, 640.f/480.f, 1.0f, 0.001f); + + + return Error; +} + +int test_translate() +{ + int Error = 0; + glm::lowp_vec3 v(1.0); glm::lowp_mat4 m(0); glm::lowp_mat4 t = glm::translate(m, v); return Error; } + +int main() +{ + int Error = 0; + + Error += test_translate(); + Error += test_tweakedInfinitePerspective(); + Error += test_pick(); + Error += test_perspective(); + + return Error; +} From d9bed5d7c93c7a7a16385bab7d73384c83d9a591 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 20 Jun 2014 22:17:04 +0200 Subject: [PATCH 26/47] Updated readme for fixed std::copy and std::vector with GLM types #214 --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index efeff376..2dd3fbc7 100644 --- a/readme.txt +++ b/readme.txt @@ -53,6 +53,7 @@ GLM 0.9.5.4: 2014-0X-XX - Fixed fastDistance ambiguity #215 - Fixed tweakedInfinitePerspective #208 and added user-defined epsilon to tweakedInfinitePerspective +- Fixed std::copy and std::vector with GLM types #214 ================================================================================ GLM 0.9.5.3: 2014-04-02 From 3651530ff09a2d9f7fe24f25815d24119cb2e9cc Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 21 Jun 2014 11:50:42 +0200 Subject: [PATCH 27/47] Fixed build --- glm/gtc/matrix_transform.hpp | 1 + glm/gtc/matrix_transform.inl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/glm/gtc/matrix_transform.hpp b/glm/gtc/matrix_transform.hpp index 1a9f0bac..6ea71aea 100644 --- a/glm/gtc/matrix_transform.hpp +++ b/glm/gtc/matrix_transform.hpp @@ -51,6 +51,7 @@ #include "../vec2.hpp" #include "../vec3.hpp" #include "../vec4.hpp" +#include "../gtc/constants.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTC_matrix_transform extension included") diff --git a/glm/gtc/matrix_transform.inl b/glm/gtc/matrix_transform.inl index 03d201c6..31fa2cc3 100644 --- a/glm/gtc/matrix_transform.inl +++ b/glm/gtc/matrix_transform.inl @@ -267,7 +267,7 @@ namespace glm T h = glm::cos(static_cast(0.5) * rad) / glm::sin(static_cast(0.5) * rad); T w = h * height / width; ///todo max(width , Height) / min(width , Height)? - detail::tmat4x4 Result(static_cast(0)); + detail::tmat4x4 Result(static_cast(0)); Result[0][0] = w; Result[1][1] = h; Result[2][2] = - (zFar + zNear) / (zFar - zNear); From 103a74f7e148bc8b4c67e814ce24f748ae8f9c19 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 21 Jun 2014 11:53:28 +0200 Subject: [PATCH 28/47] clean up --- glm/core/func_exponential.inl | 224 ---------------------------------- glm/virtrev/xstream.hpp | 166 ------------------------- 2 files changed, 390 deletions(-) delete mode 100644 glm/core/func_exponential.inl delete mode 100644 glm/virtrev/xstream.hpp diff --git a/glm/core/func_exponential.inl b/glm/core/func_exponential.inl deleted file mode 100644 index e8ff4cfe..00000000 --- a/glm/core/func_exponential.inl +++ /dev/null @@ -1,224 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2013 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 core -/// @file glm/core/func_exponential.inl -/// @date 2008-08-03 / 2011-06-15 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#include "func_vector_relational.hpp" -#include "_vectorize.hpp" -#include -#include - -namespace glm -{ - // pow - template - GLM_FUNC_QUALIFIER genType pow - ( - genType const & x, - genType const & y - ) - { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'pow' only accept floating-point inputs"); - - return std::pow(x, y); - } - - VECTORIZE_VEC_VEC(pow) - - // exp - template - GLM_FUNC_QUALIFIER genType exp - ( - genType const & x - ) - { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'exp' only accept floating-point inputs"); - - return std::exp(x); - } - - VECTORIZE_VEC(exp) - - // log - template - GLM_FUNC_QUALIFIER genType log - ( - genType const & x - ) - { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'log' only accept floating-point inputs"); - - return std::log(x); - } - - VECTORIZE_VEC(log) - - //exp2, ln2 = 0.69314718055994530941723212145818f - template - GLM_FUNC_QUALIFIER genType exp2 - ( - genType const & x - ) - { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'exp2' only accept floating-point inputs"); - - return std::exp(static_cast(0.69314718055994530941723212145818) * x); - } - - VECTORIZE_VEC(exp2) - -namespace detail -{ - template - struct compute_log2 - { - template - T operator() (T const & Value) const; - }; - - template <> - struct compute_log2 - { - template - T operator() (T const & Value) const - { - return static_cast(::std::log(Value)) * static_cast(1.4426950408889634073599246810019); - } - }; - -}//namespace detail - - // log2, ln2 = 0.69314718055994530941723212145818f - template - GLM_FUNC_QUALIFIER genType log2 - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, - "GLM core 'log2' only accept floating-point inputs. Include for additional integer support."); - - assert(x > genType(0)); // log2 is only defined on the range (0, inf] - return detail::compute_log2::is_iec559>()(x); - } - - VECTORIZE_VEC(log2) - - // sqrt - template - GLM_FUNC_QUALIFIER genType sqrt - ( - genType const & x - ) - { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'sqrt' only accept floating-point inputs"); - - assert(x >= genType(0)); - - return std::sqrt(x); - } - - VECTORIZE_VEC(sqrt) - - template - GLM_FUNC_QUALIFIER genType inversesqrt - ( - genType const & x - ) - { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'inversesqrt' only accept floating-point inputs"); - - assert(x > genType(0)); - - return genType(1) / std::sqrt(x); - } - - VECTORIZE_VEC(inversesqrt) - - namespace detail - { - template - genType fastInversesqrt(genType const & v) - { - genType tmp(v); - genType xhalf(tmp * genType(0.5f)); - genUType i = *reinterpret_cast(const_cast(&v)); - i = genUType(0x5f375a86) - (i >> genUType(1)); - // tmp = *reinterpret_cast(&i); - { - genType* ptr(reinterpret_cast(&i)); - tmp = *ptr; - } - tmp = tmp * (genType(1.5f) - xhalf * tmp * tmp); - return tmp; - } - } - - template <> - GLM_FUNC_QUALIFIER lowp_vec1 inversesqrt(lowp_vec1 const & v) - { - assert(glm::all(glm::greaterThan(v, lowp_vec1(0)))); - - return detail::fastInversesqrt(v); - } - - template <> - GLM_FUNC_QUALIFIER lowp_vec2 inversesqrt(lowp_vec2 const & v) - { - assert(glm::all(glm::greaterThan(v, lowp_vec2(0)))); - - return detail::fastInversesqrt(v); - } - - template <> - GLM_FUNC_QUALIFIER lowp_vec3 inversesqrt(lowp_vec3 const & v) - { - assert(glm::all(glm::greaterThan(v, lowp_vec3(0)))); - - return detail::fastInversesqrt(v); - } - - template <> - GLM_FUNC_QUALIFIER lowp_vec4 inversesqrt(lowp_vec4 const & v) - { - assert(glm::all(glm::greaterThan(v, lowp_vec4(0)))); - - return detail::fastInversesqrt(v); - } - -}//namespace glm diff --git a/glm/virtrev/xstream.hpp b/glm/virtrev/xstream.hpp deleted file mode 100644 index 2d16c1ac..00000000 --- a/glm/virtrev/xstream.hpp +++ /dev/null @@ -1,166 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2013 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 virtrev_xstream -/// @file glm/virtrev/xstream.hpp -/// @date 2008-05-24 / 2008-05-26 -/// @author Mathieu Roumillac (matrem84.free.fr) -/// -/// @see core (dependence) -/// @see gtc_matrix_access (dependence) -/// -/// @defgroup virtrev_xstream GLM_VIRTREV_xstream: xml like output -/// @ingroup virtrev -/// -/// @brief Streaming vector and matrix in a xml way. -/// -/// Include for this functionality. -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef GLM_VIRTREV_xstream -#define GLM_VIRTREV_xstream GLM_VERSION - -#include "../glm.hpp" -#include "../gtc/matrix_access.hpp" -#include - -#if(defined(GLM_MESSAGES) && !defined(glm_ext)) -# pragma message("GLM: GLM_VIRTREV_xstream extension included") -#endif -/* -namespace glm{ -namespace detail -{ - template - std::ostream & operator << (std::ostream & stream, glm::detail::tvec2 const & vec) - { - stream << ""; - - return stream; - } - - template - std::ostream & operator << (std::ostream & stream, glm::detail::tvec3 const & vec) - { - stream << ""; - - return stream; - } - - template - std::ostream & operator << (std::ostream & stream, glm::detail::tvec4 const & vec) - { - stream << ""; - - return stream; - } - - template - std::ostream & operator << (std::ostream & stream, glm::detail::tmat2x2 const & mat) - { - stream << "" << std::endl; - stream << "" << std::endl; - stream << "" << std::endl; - stream << ""; - - return stream; - } - - template - std::ostream & operator << (std::ostream & stream, glm::detail::tmat3x3 const & mat) - { - stream << "" << std::endl; - stream << "" << std::endl; - stream << "" << std::endl; - stream << "" << std::endl; - stream << ""; - - return stream; - } - - template - std::ostream & operator << (std::ostream & stream, glm::detail::tmat4x4 const & mat) - { - stream << "" << std::endl; - stream << "" << std::endl; - stream << "" << std::endl; - stream << "" << std::endl; - stream << "" << std::endl; - stream << ""; - - return stream; - } - -}//namespace detail -}//namespace glm -*/ -#endif//GLM_VIRTREV_xstream From f310f941c6d79f132180e1162a1db4e4ce8583fc Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 21 Jun 2014 12:14:39 +0200 Subject: [PATCH 29/47] Fixed strict aliasing issues #212 --- glm/gtc/packing.inl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/glm/gtc/packing.inl b/glm/gtc/packing.inl index 537e4648..234c6479 100644 --- a/glm/gtc/packing.inl +++ b/glm/gtc/packing.inl @@ -145,7 +145,8 @@ namespace detail else if(glm::isinf(x)) return 0x1f << 6; - return float2packed11(reinterpret_cast(x)); + uint Pack = reinterpret_cast(x); + return float2packed11(Pack); } GLM_FUNC_QUALIFIER float packed11bitToFloat(glm::uint x) @@ -170,7 +171,8 @@ namespace detail else if(glm::isinf(x)) return 0x1f << 5; - return float2packed10(reinterpret_cast(x)); + uint Pack = reinterpret_cast(x); + return float2packed10(Pack); } GLM_FUNC_QUALIFIER float packed10bitToFloat(glm::uint x) From f32cab2842c2b6d88fc9e81588202ff30c79009b Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 21 Jun 2014 13:01:54 +0200 Subject: [PATCH 30/47] Remove useless references --- glm/gtc/packing.hpp | 38 +++++++++++++++++----------------- glm/gtc/packing.inl | 50 ++++++++++++++++++++++----------------------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/glm/gtc/packing.hpp b/glm/gtc/packing.hpp index b7fb5648..73abedd5 100644 --- a/glm/gtc/packing.hpp +++ b/glm/gtc/packing.hpp @@ -62,7 +62,7 @@ namespace glm /// @see uint32 packUnorm4x8(vec4 const & v) /// @see GLSL packUnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL uint8 packUnorm1x8(float const & v); + GLM_FUNC_DECL uint8 packUnorm1x8(float v); /// Convert a single 8-bit integer to a normalized floating-point value. /// @@ -74,7 +74,7 @@ namespace glm /// @see vec4 unpackUnorm4x8(uint32 p) /// @see GLSL unpackUnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL float unpackUnorm1x8(uint8 const & p); + GLM_FUNC_DECL float unpackUnorm1x8(uint8 p); /// First, converts each component of the normalized floating-point value v into 8-bit integer values. /// Then, the results are packed into the returned 16-bit unsigned integer. @@ -106,7 +106,7 @@ namespace glm /// @see vec4 unpackUnorm4x8(uint32 p) /// @see GLSL unpackUnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL vec2 unpackUnorm2x8(uint16 const & p); + GLM_FUNC_DECL vec2 unpackUnorm2x8(uint16 p); /// First, converts the normalized floating-point value v into 8-bit integer value. /// Then, the results are packed into the returned 8-bit unsigned integer. @@ -119,7 +119,7 @@ namespace glm /// @see uint32 packSnorm4x8(vec4 const & v) /// @see GLSL packSnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL uint8 packSnorm1x8(float const & s); + GLM_FUNC_DECL uint8 packSnorm1x8(float s); /// First, unpacks a single 8-bit unsigned integer p into a single 8-bit signed integers. /// Then, the value is converted to a normalized floating-point value to generate the returned scalar. @@ -132,7 +132,7 @@ namespace glm /// @see vec4 unpackSnorm4x8(uint32 p) /// @see GLSL unpackSnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL float unpackSnorm1x8(uint8 const & p); + GLM_FUNC_DECL float unpackSnorm1x8(uint8 p); /// First, converts each component of the normalized floating-point value v into 8-bit integer values. /// Then, the results are packed into the returned 16-bit unsigned integer. @@ -164,7 +164,7 @@ namespace glm /// @see vec4 unpackSnorm4x8(uint32 p) /// @see GLSL unpackSnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL vec2 unpackSnorm2x8(uint16 const & p); + GLM_FUNC_DECL vec2 unpackSnorm2x8(uint16 p); /// First, converts the normalized floating-point value v into a 16-bit integer value. /// Then, the results are packed into the returned 16-bit unsigned integer. @@ -177,7 +177,7 @@ namespace glm /// @see uint64 packSnorm4x16(vec4 const & v) /// @see GLSL packUnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL uint16 packUnorm1x16(float const & v); + GLM_FUNC_DECL uint16 packUnorm1x16(float v); /// First, unpacks a single 16-bit unsigned integer p into a of 16-bit unsigned integers. /// Then, the value is converted to a normalized floating-point value to generate the returned scalar. @@ -190,7 +190,7 @@ namespace glm /// @see vec4 unpackUnorm4x16(uint64 p) /// @see GLSL unpackUnorm2x16 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL float unpackUnorm1x16(uint16 const & p); + GLM_FUNC_DECL float unpackUnorm1x16(uint16 p); /// First, converts each component of the normalized floating-point value v into 16-bit integer values. /// Then, the results are packed into the returned 64-bit unsigned integer. @@ -222,7 +222,7 @@ namespace glm /// @see vec2 unpackUnorm2x16(uint32 p) /// @see GLSL unpackUnorm2x16 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL vec4 unpackUnorm4x16(uint64 const & p); + GLM_FUNC_DECL vec4 unpackUnorm4x16(uint64 p); /// First, converts the normalized floating-point value v into 16-bit integer value. /// Then, the results are packed into the returned 16-bit unsigned integer. @@ -235,7 +235,7 @@ namespace glm /// @see uint64 packSnorm4x16(vec4 const & v) /// @see GLSL packSnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL uint16 packSnorm1x16(float const & v); + GLM_FUNC_DECL uint16 packSnorm1x16(float v); /// First, unpacks a single 16-bit unsigned integer p into a single 16-bit signed integers. /// Then, each component is converted to a normalized floating-point value to generate the returned scalar. @@ -248,7 +248,7 @@ namespace glm /// @see vec4 unpackSnorm4x16(uint64 p) /// @see GLSL unpackSnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL float unpackSnorm1x16(uint16 const & p); + GLM_FUNC_DECL float unpackSnorm1x16(uint16 p); /// First, converts each component of the normalized floating-point value v into 16-bit integer values. /// Then, the results are packed into the returned 64-bit unsigned integer. @@ -291,7 +291,7 @@ namespace glm /// @see uint64 packHalf4x16(vec4 const & v) /// @see GLSL packHalf2x16 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL uint16 packHalf1x16(float const & v); + GLM_FUNC_DECL uint16 packHalf1x16(float v); /// Returns a floating-point scalar with components obtained by unpacking a 16-bit unsigned integer into a 16-bit value, /// interpreted as a 16-bit floating-point number according to the OpenGL Specification, @@ -302,7 +302,7 @@ namespace glm /// @see vec4 unpackHalf4x16(uint64 const & v) /// @see GLSL unpackHalf2x16 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL float unpackHalf1x16(uint16 const & v); + GLM_FUNC_DECL float unpackHalf1x16(uint16 v); /// Returns an unsigned integer obtained by converting the components of a four-component floating-point vector /// to the 16-bit floating-point representation found in the OpenGL Specification, @@ -328,7 +328,7 @@ namespace glm /// @see vec2 unpackHalf2x16(uint32 const & v) /// @see GLSL unpackHalf2x16 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL vec4 unpackHalf4x16(uint64 const & p); + GLM_FUNC_DECL vec4 unpackHalf4x16(uint64 p); /// Returns an unsigned integer obtained by converting the components of a four-component signed integer vector /// to the 10-10-10-2-bit signed integer representation found in the OpenGL Specification, @@ -352,7 +352,7 @@ namespace glm /// @see uint32 packU3x10_1x2(uvec4 const & v) /// @see vec4 unpackSnorm3x10_1x2(uint32 const & p); /// @see uvec4 unpackI3x10_1x2(uint32 const & p); - GLM_FUNC_DECL ivec4 unpackI3x10_1x2(uint32 const & p); + GLM_FUNC_DECL ivec4 unpackI3x10_1x2(uint32 p); /// Returns an unsigned integer obtained by converting the components of a four-component unsigned integer vector /// to the 10-10-10-2-bit unsigned integer representation found in the OpenGL Specification, @@ -376,7 +376,7 @@ namespace glm /// @see uint32 packU3x10_1x2(uvec4 const & v) /// @see vec4 unpackSnorm3x10_1x2(uint32 const & p); /// @see uvec4 unpackI3x10_1x2(uint32 const & p); - GLM_FUNC_DECL uvec4 unpackU3x10_1x2(uint32 const & p); + GLM_FUNC_DECL uvec4 unpackU3x10_1x2(uint32 p); /// First, converts the first three components of the normalized floating-point value v into 10-bit signed integer values. /// Then, converts the forth component of the normalized floating-point value v into 2-bit signed integer values. @@ -411,7 +411,7 @@ namespace glm /// @see vec4 unpackUnorm3x10_1x2(uint32 const & p)) /// @see uvec4 unpackI3x10_1x2(uint32 const & p) /// @see uvec4 unpackU3x10_1x2(uint32 const & p) - GLM_FUNC_DECL vec4 unpackSnorm3x10_1x2(uint32 const & p); + GLM_FUNC_DECL vec4 unpackSnorm3x10_1x2(uint32 p); /// First, converts the first three components of the normalized floating-point value v into 10-bit unsigned integer values. /// Then, converts the forth component of the normalized floating-point value v into 2-bit signed uninteger values. @@ -446,7 +446,7 @@ namespace glm /// @see vec4 unpackInorm3x10_1x2(uint32 const & p)) /// @see uvec4 unpackI3x10_1x2(uint32 const & p) /// @see uvec4 unpackU3x10_1x2(uint32 const & p) - GLM_FUNC_DECL vec4 unpackUnorm3x10_1x2(uint32 const & p); + GLM_FUNC_DECL vec4 unpackUnorm3x10_1x2(uint32 p); /// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values. /// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value. @@ -467,7 +467,7 @@ namespace glm /// /// @see gtc_packing /// @see uint32 packF2x11_1x10(vec3 const & v) - GLM_FUNC_DECL vec3 unpackF2x11_1x10(uint32 const & p); + GLM_FUNC_DECL vec3 unpackF2x11_1x10(uint32 p); /// @} }// namespace glm diff --git a/glm/gtc/packing.inl b/glm/gtc/packing.inl index 234c6479..4f42970b 100644 --- a/glm/gtc/packing.inl +++ b/glm/gtc/packing.inl @@ -35,7 +35,7 @@ namespace glm{ namespace detail { - GLM_FUNC_QUALIFIER glm::uint16 float2half(glm::uint32 const & f) + GLM_FUNC_QUALIFIER glm::uint16 float2half(glm::uint32 f) { // 10 bits => EE EEEFFFFF // 11 bits => EEE EEFFFFFF @@ -53,7 +53,7 @@ namespace detail ((f >> 13) & 0x03ff); // Mantissa } - GLM_FUNC_QUALIFIER glm::uint32 float2packed11(glm::uint32 const & f) + GLM_FUNC_QUALIFIER glm::uint32 float2packed11(glm::uint32 f) { // 10 bits => EE EEEFFFFF // 11 bits => EEE EEFFFFFF @@ -71,7 +71,7 @@ namespace detail ((f >> 17) & 0x003f); // Mantissa } - GLM_FUNC_QUALIFIER glm::uint32 packed11ToFloat(glm::uint32 const & p) + GLM_FUNC_QUALIFIER glm::uint32 packed11ToFloat(glm::uint32 p) { // 10 bits => EE EEEFFFFF // 11 bits => EEE EEFFFFFF @@ -89,7 +89,7 @@ namespace detail ((p & 0x003f) << 17); // Mantissa } - GLM_FUNC_QUALIFIER glm::uint32 float2packed10(glm::uint32 const & f) + GLM_FUNC_QUALIFIER glm::uint32 float2packed10(glm::uint32 f) { // 10 bits => EE EEEFFFFF // 11 bits => EEE EEFFFFFF @@ -110,7 +110,7 @@ namespace detail ((f >> 18) & 0x001f); // Mantissa } - GLM_FUNC_QUALIFIER glm::uint32 packed10ToFloat(glm::uint32 const & p) + GLM_FUNC_QUALIFIER glm::uint32 packed10ToFloat(glm::uint32 p) { // 10 bits => EE EEEFFFFF // 11 bits => EEE EEFFFFFF @@ -131,7 +131,7 @@ namespace detail ((p & 0x001f) << 18); // Mantissa } - GLM_FUNC_QUALIFIER glm::uint half2float(glm::uint const & h) + GLM_FUNC_QUALIFIER glm::uint half2float(glm::uint h) { return ((h & 0x8000) << 16) | ((( h & 0x7c00) + 0x1C000) << 13) | ((h & 0x03FF) << 13); } @@ -145,7 +145,7 @@ namespace detail else if(glm::isinf(x)) return 0x1f << 6; - uint Pack = reinterpret_cast(x); + float Copy = reinterpret_cast(x); return float2packed11(Pack); } @@ -219,12 +219,12 @@ namespace detail }//namespace detail - GLM_FUNC_QUALIFIER uint8 packUnorm1x8(float const & v) + GLM_FUNC_QUALIFIER uint8 packUnorm1x8(float v) { return static_cast(round(clamp(v, 0.0f, 1.0f) * 255.0f)); } - GLM_FUNC_QUALIFIER float unpackUnorm1x8(uint8 const & p) + GLM_FUNC_QUALIFIER float unpackUnorm1x8(uint8 p) { float Unpack(static_cast(p)); return Unpack * static_cast(0.0039215686274509803921568627451); // 1 / 255 @@ -237,20 +237,20 @@ namespace detail return *Packed; } - GLM_FUNC_QUALIFIER vec2 unpackUnorm2x8(uint16 const & p) + GLM_FUNC_QUALIFIER vec2 unpackUnorm2x8(uint16 p) { u8vec2* Unpacked = reinterpret_cast(const_cast(&p)); return vec2(*Unpacked) * float(0.0039215686274509803921568627451); // 1 / 255 } - GLM_FUNC_QUALIFIER uint8 packSnorm1x8(float const & v) + GLM_FUNC_QUALIFIER uint8 packSnorm1x8(float v) { int8 Topack(static_cast(round(clamp(v ,-1.0f, 1.0f) * 127.0f))); uint8* Packed = reinterpret_cast(&Topack); return *Packed; } - GLM_FUNC_QUALIFIER float unpackSnorm1x8(uint8 const & p) + GLM_FUNC_QUALIFIER float unpackSnorm1x8(uint8 p) { float Unpack(static_cast(*const_cast(&p))); return clamp( @@ -265,7 +265,7 @@ namespace detail return *Packed; } - GLM_FUNC_QUALIFIER vec2 unpackSnorm2x8(uint16 const & p) + GLM_FUNC_QUALIFIER vec2 unpackSnorm2x8(uint16 p) { i8vec2* Unpack = reinterpret_cast(const_cast(&p)); return clamp( @@ -273,12 +273,12 @@ namespace detail -1.0f, 1.0f); } - GLM_FUNC_QUALIFIER uint16 packUnorm1x16(float const & s) + GLM_FUNC_QUALIFIER uint16 packUnorm1x16(float s) { return static_cast(round(clamp(s, 0.0f, 1.0f) * 65535.0f)); } - GLM_FUNC_QUALIFIER float unpackUnorm1x16(uint16 const & p) + GLM_FUNC_QUALIFIER float unpackUnorm1x16(uint16 p) { float Unpack = static_cast(*const_cast(&p)); return Unpack * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0 @@ -297,14 +297,14 @@ namespace detail return vec4(*Unpack) * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0 } - GLM_FUNC_QUALIFIER uint16 packSnorm1x16(float const & v) + GLM_FUNC_QUALIFIER uint16 packSnorm1x16(float v) { int16 Topack = static_cast(round(clamp(v ,-1.0f, 1.0f) * 32767.0f)); uint16* Packed = reinterpret_cast(&Topack); return *Packed; } - GLM_FUNC_QUALIFIER float unpackSnorm1x16(uint16 const & p) + GLM_FUNC_QUALIFIER float unpackSnorm1x16(uint16 p) { float Unpack = static_cast(*const_cast(&p)); return clamp( @@ -319,7 +319,7 @@ namespace detail return *Packed; } - GLM_FUNC_QUALIFIER vec4 unpackSnorm4x16(uint64 const & p) + GLM_FUNC_QUALIFIER vec4 unpackSnorm4x16(uint64 p) { i16vec4* Unpack(reinterpret_cast(const_cast(&p))); return clamp( @@ -327,14 +327,14 @@ namespace detail -1.0f, 1.0f); } - GLM_FUNC_QUALIFIER uint16 packHalf1x16(float const & v) + GLM_FUNC_QUALIFIER uint16 packHalf1x16(float v) { int16 Topack = detail::toFloat16(v); uint16* Packed = reinterpret_cast(&Topack); return *Packed; } - GLM_FUNC_QUALIFIER float unpackHalf1x16(uint16 const & v) + GLM_FUNC_QUALIFIER float unpackHalf1x16(uint16 v) { int16* Unpack = reinterpret_cast(const_cast(&v)); return detail::toFloat32(*Unpack); @@ -374,7 +374,7 @@ namespace detail return Result.pack; } - GLM_FUNC_QUALIFIER ivec4 unpackI3x10_1x2(uint32 const & v) + GLM_FUNC_QUALIFIER ivec4 unpackI3x10_1x2(uint32 v) { detail::i10i10i10i2 Unpack; Unpack.pack = v; @@ -395,7 +395,7 @@ namespace detail return Result.pack; } - GLM_FUNC_QUALIFIER uvec4 unpackU3x10_1x2(uint32 const & v) + GLM_FUNC_QUALIFIER uvec4 unpackU3x10_1x2(uint32 v) { detail::u10u10u10u2 Unpack; Unpack.pack = v; @@ -416,7 +416,7 @@ namespace detail return Result.pack; } - GLM_FUNC_QUALIFIER vec4 unpackSnorm3x10_1x2(uint32 const & v) + GLM_FUNC_QUALIFIER vec4 unpackSnorm3x10_1x2(uint32 v) { detail::i10i10i10i2 Unpack; Unpack.pack = v; @@ -438,7 +438,7 @@ namespace detail return Result.pack; } - GLM_FUNC_QUALIFIER vec4 unpackUnorm3x10_1x2(uint32 const & v) + GLM_FUNC_QUALIFIER vec4 unpackUnorm3x10_1x2(uint32 v) { detail::i10i10i10i2 Unpack; Unpack.pack = v; @@ -458,7 +458,7 @@ namespace detail ((detail::floatTo10bit(v.z) & ((1 << 10) - 1)) << 22); } - GLM_FUNC_QUALIFIER vec3 unpackF2x11_1x10(uint32 const & v) + GLM_FUNC_QUALIFIER vec3 unpackF2x11_1x10(uint32 v) { return vec3( detail::packed11bitToFloat(v >> 0), From b025413a2dd19b89f3342623e1a3850b7ab947f0 Mon Sep 17 00:00:00 2001 From: Groove Date: Sat, 21 Jun 2014 07:04:55 -0400 Subject: [PATCH 31/47] Resolve aliasing issue --- glm/gtc/packing.inl | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/glm/gtc/packing.inl b/glm/gtc/packing.inl index 234c6479..9e3fa87c 100644 --- a/glm/gtc/packing.inl +++ b/glm/gtc/packing.inl @@ -31,11 +31,12 @@ #include "../vec3.hpp" #include "../vec4.hpp" #include "../detail/type_half.hpp" +#include namespace glm{ namespace detail { - GLM_FUNC_QUALIFIER glm::uint16 float2half(glm::uint32 const & f) + GLM_FUNC_QUALIFIER glm::uint16 float2half(glm::uint32 f) { // 10 bits => EE EEEFFFFF // 11 bits => EEE EEFFFFFF @@ -53,7 +54,7 @@ namespace detail ((f >> 13) & 0x03ff); // Mantissa } - GLM_FUNC_QUALIFIER glm::uint32 float2packed11(glm::uint32 const & f) + GLM_FUNC_QUALIFIER glm::uint32 float2packed11(glm::uint32 f) { // 10 bits => EE EEEFFFFF // 11 bits => EEE EEFFFFFF @@ -71,7 +72,7 @@ namespace detail ((f >> 17) & 0x003f); // Mantissa } - GLM_FUNC_QUALIFIER glm::uint32 packed11ToFloat(glm::uint32 const & p) + GLM_FUNC_QUALIFIER glm::uint32 packed11ToFloat(glm::uint32 p) { // 10 bits => EE EEEFFFFF // 11 bits => EEE EEFFFFFF @@ -89,7 +90,7 @@ namespace detail ((p & 0x003f) << 17); // Mantissa } - GLM_FUNC_QUALIFIER glm::uint32 float2packed10(glm::uint32 const & f) + GLM_FUNC_QUALIFIER glm::uint32 float2packed10(glm::uint32 f) { // 10 bits => EE EEEFFFFF // 11 bits => EEE EEFFFFFF @@ -110,7 +111,7 @@ namespace detail ((f >> 18) & 0x001f); // Mantissa } - GLM_FUNC_QUALIFIER glm::uint32 packed10ToFloat(glm::uint32 const & p) + GLM_FUNC_QUALIFIER glm::uint32 packed10ToFloat(glm::uint32 p) { // 10 bits => EE EEEFFFFF // 11 bits => EEE EEFFFFFF @@ -131,7 +132,7 @@ namespace detail ((p & 0x001f) << 18); // Mantissa } - GLM_FUNC_QUALIFIER glm::uint half2float(glm::uint const & h) + GLM_FUNC_QUALIFIER glm::uint half2float(glm::uint h) { return ((h & 0x8000) << 16) | ((( h & 0x7c00) + 0x1C000) << 13) | ((h & 0x03FF) << 13); } @@ -145,7 +146,13 @@ namespace detail else if(glm::isinf(x)) return 0x1f << 6; - uint Pack = reinterpret_cast(x); +# if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & GLM_COMPILER_CLANG) + uint Pack = 0; + memcpy(&Pack, &x, sizeof(Pack)); +# else + uint Pack = reinterpret_cast(x); +# endif + return float2packed11(Pack); } From 9f0fe305851508dd23fb90e23fe9919bd8a02888 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 21 Jun 2014 13:22:06 +0200 Subject: [PATCH 32/47] Fixed build --- glm/gtc/packing.inl | 4 ++-- test/gtc/gtc_packing.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/glm/gtc/packing.inl b/glm/gtc/packing.inl index 4f42970b..5250352d 100644 --- a/glm/gtc/packing.inl +++ b/glm/gtc/packing.inl @@ -145,7 +145,7 @@ namespace detail else if(glm::isinf(x)) return 0x1f << 6; - float Copy = reinterpret_cast(x); + uint Pack = reinterpret_cast(x); return float2packed11(Pack); } @@ -352,7 +352,7 @@ namespace detail return *Packed; } - GLM_FUNC_QUALIFIER glm::vec4 unpackHalf4x16(uint64 const & v) + GLM_FUNC_QUALIFIER glm::vec4 unpackHalf4x16(uint64 v) { i16vec4* p = reinterpret_cast(const_cast(&v)); i16vec4 Unpack(*p); diff --git a/test/gtc/gtc_packing.cpp b/test/gtc/gtc_packing.cpp index 8acfb74f..ceec3dd2 100644 --- a/test/gtc/gtc_packing.cpp +++ b/test/gtc/gtc_packing.cpp @@ -100,7 +100,7 @@ int test_Half1x16() glm::uint32 p0 = glm::packHalf1x16(Tests[i]); float v0 = glm::unpackHalf1x16(p0); glm::uint32 p1 = glm::packHalf1x16(v0); - float v1 = glm::unpackHalf1x16(p0); + float v1 = glm::unpackHalf1x16(p1); Error += (v0 == v1) ? 0 : 1; } @@ -124,7 +124,7 @@ int test_Half4x16() glm::uint64 p0 = glm::packHalf4x16(Tests[i]); glm::vec4 v0 = glm::unpackHalf4x16(p0); glm::uint64 p1 = glm::packHalf4x16(v0); - glm::vec4 v1 = glm::unpackHalf4x16(p0); + glm::vec4 v1 = glm::unpackHalf4x16(p1); Error += glm::all(glm::equal(v0, v1)) ? 0 : 1; } @@ -148,7 +148,7 @@ int test_I3x10_1x2() glm::uint32 p0 = glm::packI3x10_1x2(Tests[i]); glm::ivec4 v0 = glm::unpackI3x10_1x2(p0); glm::uint32 p1 = glm::packI3x10_1x2(v0); - glm::ivec4 v1 = glm::unpackI3x10_1x2(p0); + glm::ivec4 v1 = glm::unpackI3x10_1x2(p1); Error += glm::all(glm::equal(v0, v1)) ? 0 : 1; } @@ -172,7 +172,7 @@ int test_U3x10_1x2() glm::uint32 p0 = glm::packU3x10_1x2(Tests[i]); glm::uvec4 v0 = glm::unpackU3x10_1x2(p0); glm::uint32 p1 = glm::packU3x10_1x2(v0); - glm::uvec4 v1 = glm::unpackU3x10_1x2(p0); + glm::uvec4 v1 = glm::unpackU3x10_1x2(p1); Error += glm::all(glm::equal(v0, v1)) ? 0 : 1; } @@ -196,7 +196,7 @@ int test_Snorm3x10_1x2() glm::uint32 p0 = glm::packSnorm3x10_1x2(Tests[i]); glm::vec4 v0 = glm::unpackSnorm3x10_1x2(p0); glm::uint32 p1 = glm::packSnorm3x10_1x2(v0); - glm::vec4 v1 = glm::unpackSnorm3x10_1x2(p0); + glm::vec4 v1 = glm::unpackSnorm3x10_1x2(p1); Error += glm::all(glm::equal(v0, v1)) ? 0 : 1; } @@ -220,7 +220,7 @@ int test_Unorm3x10_1x2() glm::uint32 p0 = glm::packSnorm3x10_1x2(Tests[i]); glm::vec4 v0 = glm::unpackSnorm3x10_1x2(p0); glm::uint32 p1 = glm::packSnorm3x10_1x2(v0); - glm::vec4 v1 = glm::unpackSnorm3x10_1x2(p0); + glm::vec4 v1 = glm::unpackSnorm3x10_1x2(p1); Error += glm::all(glm::equal(v0, v1)) ? 0 : 1; } @@ -244,7 +244,7 @@ int test_F2x11_1x10() glm::uint32 p0 = glm::packF2x11_1x10(Tests[i]); glm::vec3 v0 = glm::unpackF2x11_1x10(p0); glm::uint32 p1 = glm::packF2x11_1x10(v0); - glm::vec3 v1 = glm::unpackF2x11_1x10(p0); + glm::vec3 v1 = glm::unpackF2x11_1x10(p1); Error += glm::all(glm::equal(v0, v1)) ? 0 : 1; } From b69356cadb3b74b630bd20ce13f8fc9d25489704 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 21 Jun 2014 07:41:30 -0400 Subject: [PATCH 33/47] Resolve aliasing issues #152, #212 --- glm/gtc/packing.inl | 20 +++++++++++++++++--- readme.txt | 1 + 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/glm/gtc/packing.inl b/glm/gtc/packing.inl index 353dc6eb..571d0f4d 100644 --- a/glm/gtc/packing.inl +++ b/glm/gtc/packing.inl @@ -170,6 +170,7 @@ namespace detail # if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & GLM_COMPILER_CLANG) float Temp = 0; memcpy(&Temp, &Result, sizeof(Temp)); + return Temp; # else return reinterpret_cast(Result); # endif @@ -184,7 +185,13 @@ namespace detail else if(glm::isinf(x)) return 0x1f << 5; - uint Pack = reinterpret_cast(x); +# if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & GLM_COMPILER_CLANG) + uint Pack = 0; + memcpy(&Pack, &x, sizeof(Pack)); +# else + uint Pack = reinterpret_cast(x); +# endif + return float2packed10(Pack); } @@ -197,8 +204,15 @@ namespace detail else if(x == (0x1f << 5)) return ~0;//Inf - uint result = packed10ToFloat(x); - return reinterpret_cast(result); + uint Result = packed10ToFloat(x); + +# if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & GLM_COMPILER_CLANG) + float Temp = 0; + memcpy(&Temp, &Result, sizeof(Temp)); + return Temp; +# else + return reinterpret_cast(Result); +# endif } // GLM_FUNC_QUALIFIER glm::uint f11_f11_f10(float x, float y, float z) diff --git a/readme.txt b/readme.txt index 2dd3fbc7..dadd4c23 100644 --- a/readme.txt +++ b/readme.txt @@ -54,6 +54,7 @@ GLM 0.9.5.4: 2014-0X-XX - Fixed tweakedInfinitePerspective #208 and added user-defined epsilon to tweakedInfinitePerspective - Fixed std::copy and std::vector with GLM types #214 +- Fixed aliasing issues #212, #152 ================================================================================ GLM 0.9.5.3: 2014-04-02 From 2b38221f80f194018ef01a78bb615efb94d79c31 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 21 Jun 2014 14:02:51 +0200 Subject: [PATCH 34/47] Fixed build --- glm/gtc/matrix_transform.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glm/gtc/matrix_transform.hpp b/glm/gtc/matrix_transform.hpp index 6ea71aea..ef67a100 100644 --- a/glm/gtc/matrix_transform.hpp +++ b/glm/gtc/matrix_transform.hpp @@ -226,7 +226,7 @@ namespace glm /// @see gtc_matrix_transform template GLM_FUNC_DECL detail::tmat4x4 tweakedInfinitePerspective( - T fovy, T aspect, T near, T epsilon = epsilon()); + T fovy, T aspect, T near, T epsilon = glm::epsilon()); /// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates. /// From 08ff93925f40d791a908e7a08e3c74000828d56e Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 21 Jun 2014 15:07:03 +0200 Subject: [PATCH 35/47] Fixed std::nextafter not supported with C++11 on Android #213 --- glm/gtc/matrix_transform.hpp | 13 ++++++++++++- glm/gtc/matrix_transform.inl | 17 ++++++++++++++--- glm/gtc/ulp.inl | 16 ++++++++-------- readme.txt | 3 ++- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/glm/gtc/matrix_transform.hpp b/glm/gtc/matrix_transform.hpp index ef67a100..8cd0b651 100644 --- a/glm/gtc/matrix_transform.hpp +++ b/glm/gtc/matrix_transform.hpp @@ -226,7 +226,18 @@ namespace glm /// @see gtc_matrix_transform template GLM_FUNC_DECL detail::tmat4x4 tweakedInfinitePerspective( - T fovy, T aspect, T near, T epsilon = glm::epsilon()); + T fovy, T aspect, T near); + + /// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping. + /// + /// @param fovy Expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise. + /// @param aspect + /// @param near + /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. + /// @see gtc_matrix_transform + template + GLM_FUNC_DECL detail::tmat4x4 tweakedInfinitePerspective( + T fovy, T aspect, T near, T ep); /// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates. /// diff --git a/glm/gtc/matrix_transform.inl b/glm/gtc/matrix_transform.inl index 31fa2cc3..44578290 100644 --- a/glm/gtc/matrix_transform.inl +++ b/glm/gtc/matrix_transform.inl @@ -311,7 +311,7 @@ namespace glm T fovy, T aspect, T zNear, - T epsilon + T ep ) { #ifdef GLM_FORCE_RADIANS @@ -328,12 +328,23 @@ namespace glm detail::tmat4x4 Result(T(0)); Result[0][0] = (static_cast(2) * zNear) / (right - left); Result[1][1] = (static_cast(2) * zNear) / (top - bottom); - Result[2][2] = epsilon - static_cast(1); + Result[2][2] = ep - static_cast(1); Result[2][3] = static_cast(-1); - Result[3][2] = (epsilon - static_cast(2)) * zNear; + Result[3][2] = (ep - static_cast(2)) * zNear; return Result; } + template + GLM_FUNC_QUALIFIER detail::tmat4x4 tweakedInfinitePerspective + ( + T fovy, + T aspect, + T zNear + ) + { + return tweakedInfinitePerspective(fovy, aspect, zNear, epsilon()); + } + template GLM_FUNC_QUALIFIER detail::tvec3 project ( diff --git a/glm/gtc/ulp.inl b/glm/gtc/ulp.inl index 19ac7b47..4099812b 100644 --- a/glm/gtc/ulp.inl +++ b/glm/gtc/ulp.inl @@ -199,9 +199,9 @@ namespace glm template <> GLM_FUNC_QUALIFIER float next_float(float const & x) { -# if((GLM_LANG & GLM_LANG_CXX11_FLAG)) +# if((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_PLATFORM & GLM_PLATFORM_ANDROID)) return std::nextafter(x, std::numeric_limits::max()); -# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) +# elif((GLM_PLATFORM & GLM_PLATFORM_ANDROID) || (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); @@ -211,9 +211,9 @@ namespace glm template <> GLM_FUNC_QUALIFIER double next_float(double const & x) { -# if((GLM_LANG & GLM_LANG_CXX11_FLAG)) +# if((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_PLATFORM & GLM_PLATFORM_ANDROID)) return std::nextafter(x, std::numeric_limits::max()); -# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) +# elif((GLM_PLATFORM & GLM_PLATFORM_ANDROID) || (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) return detail::nextafter(x, std::numeric_limits::max()); # else return nextafter(x, DBL_MAX); @@ -231,9 +231,9 @@ namespace glm GLM_FUNC_QUALIFIER float prev_float(float const & x) { -# if((GLM_LANG & GLM_LANG_CXX11_FLAG)) +# if((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_PLATFORM & GLM_PLATFORM_ANDROID)) return std::nextafter(x, std::numeric_limits::min()); -# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) +# elif((GLM_PLATFORM & GLM_PLATFORM_ANDROID) || (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); @@ -242,9 +242,9 @@ namespace glm GLM_FUNC_QUALIFIER double prev_float(double const & x) { -# if((GLM_LANG & GLM_LANG_CXX11_FLAG)) +# if((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_PLATFORM & GLM_PLATFORM_ANDROID)) return std::nextafter(x, std::numeric_limits::min()); -# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) +# elif((GLM_PLATFORM & GLM_PLATFORM_ANDROID) || (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); diff --git a/readme.txt b/readme.txt index dadd4c23..29e3669b 100644 --- a/readme.txt +++ b/readme.txt @@ -54,7 +54,8 @@ GLM 0.9.5.4: 2014-0X-XX - Fixed tweakedInfinitePerspective #208 and added user-defined epsilon to tweakedInfinitePerspective - Fixed std::copy and std::vector with GLM types #214 -- Fixed aliasing issues #212, #152 +- Fixed strict aliasing issues #212, #152 +- Fixed std::nextafter not supported with C++11 on Android #213 ================================================================================ GLM 0.9.5.3: 2014-04-02 From 9b6eecc739320b468127a9848b5056b109446257 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 21 Jun 2014 15:38:49 +0200 Subject: [PATCH 36/47] Fixed corner cases in exp and log functions for quaternions #199 --- glm/gtx/quaternion.inl | 28 +++++++++++++++++----------- readme.txt | 3 ++- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/glm/gtx/quaternion.inl b/glm/gtx/quaternion.inl index 2d1a6c13..615989bc 100644 --- a/glm/gtx/quaternion.inl +++ b/glm/gtx/quaternion.inl @@ -8,6 +8,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include +#include "../gtc/constants.hpp" namespace glm { @@ -62,7 +63,10 @@ namespace glm ) { detail::tvec3 u(q.x, q.y, q.z); - float Angle = glm::length(u); + T Angle = glm::length(u); + if (Angle < epsilon()) + return detail::tquat(); + detail::tvec3 v(u / Angle); return detail::tquat(cos(Angle), sin(Angle) * v); } @@ -73,18 +77,20 @@ namespace glm detail::tquat const & q ) { - if((q.x == static_cast(0)) && (q.y == static_cast(0)) && (q.z == static_cast(0))) + detail::tvec3 u(q.x, q.y, q.z); + T Vec3Len = length(u); + + if (Vec3Len < epsilon()) { - if(q.w > T(0)) - return detail::tquat(log(q.w), T(0), T(0), T(0)); - else if(q.w < T(0)) - return detail::tquat(log(-q.w), T(3.1415926535897932384626433832795), T(0),T(0)); + if(q.w > static_cast(0)) + return detail::tquat(log(q.w), static_cast(0), static_cast(0), static_cast(0)); + else if(q.w < static_cast(0)) + return detail::tquat(log(-q.w), pi(), static_cast(0), static_cast(0)); else return detail::tquat(std::numeric_limits::infinity(), std::numeric_limits::infinity(), std::numeric_limits::infinity(), std::numeric_limits::infinity()); } else { - T Vec3Len = sqrt(q.x * q.x + q.y * q.y + q.z * q.z); T QuatLen = sqrt(Vec3Len * Vec3Len + q.w * q.w); T t = atan(Vec3Len, T(q.w)) / Vec3Len; return detail::tquat(log(QuatLen), t * q.x, t * q.y, t * q.z); @@ -98,11 +104,11 @@ namespace glm T const & y ) { - if(abs(x.w) > T(0.9999)) + if(abs(x.w) > (static_cast(1) - epsilon())) return x; - float Angle = acos(y); - float NewAngle = Angle * y; - float Div = sin(NewAngle) / sin(Angle); + T Angle = acos(y); + T NewAngle = Angle * y; + T Div = sin(NewAngle) / sin(Angle); return detail::tquat( cos(NewAngle), x.x * Div, diff --git a/readme.txt b/readme.txt index 29e3669b..9c3d238c 100644 --- a/readme.txt +++ b/readme.txt @@ -37,7 +37,7 @@ More informations in GLM manual: http://glm.g-truc.net/glm.pdf ================================================================================ -GLM 0.9.5.4: 2014-0X-XX +GLM 0.9.5.4: 2014-06-21 -------------------------------------------------------------------------------- - Fixed non-utf8 character #196 - Added FindGLM install for CMake #189 @@ -56,6 +56,7 @@ GLM 0.9.5.4: 2014-0X-XX - Fixed std::copy and std::vector with GLM types #214 - Fixed strict aliasing issues #212, #152 - Fixed std::nextafter not supported with C++11 on Android #213 +- Fixed corner cases in exp and log functions for quaternions #199 ================================================================================ GLM 0.9.5.3: 2014-04-02 From 694416701a009172f62b04d62970b384fbb21253 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 21 Jun 2014 15:42:10 +0200 Subject: [PATCH 37/47] Replaced C casts by C++ casts --- glm/gtx/quaternion.inl | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/glm/gtx/quaternion.inl b/glm/gtx/quaternion.inl index 615989bc..0dc95b0f 100644 --- a/glm/gtx/quaternion.inl +++ b/glm/gtx/quaternion.inl @@ -41,7 +41,7 @@ namespace glm detail::tquat const & s2, T const & h) { - return mix(mix(q1, q2, h), mix(s1, s2, h), T(2) * (T(1) - h) * h); + return mix(mix(q1, q2, h), mix(s1, s2, h), static_cast(2) * (static_cast(1) - h) * h); } template @@ -53,7 +53,7 @@ namespace glm ) { detail::tquat invQuat = inverse(curr); - return exp((log(next + invQuat) + log(prev + invQuat)) / T(-4)) * curr; + return exp((log(next + invQuat) + log(prev + invQuat)) / static_cast(-4)) * curr; } template @@ -152,7 +152,7 @@ namespace glm detail::tquat const & q ) { - T w = static_cast(1.0) - q.x * q.x - q.y * q.y - q.z * q.z; + T w = static_cast(1) - q.x * q.x - q.y * q.y - q.z * q.z; if(w < T(0)) return T(0); else @@ -176,12 +176,12 @@ namespace glm T const & a ) { - if(a <= T(0)) return x; - if(a >= T(1)) return y; + if(a <= static_cast(0)) return x; + if(a >= static_cast(1)) return y; T fCos = dot(x, y); detail::tquat y2(y); //BUG!!! tquat y2; - if(fCos < T(0)) + if(fCos < static_cast(0)) { y2 = -y; fCos = -fCos; @@ -189,7 +189,7 @@ namespace glm //if(fCos > 1.0f) // problem T k0, k1; - if(fCos > T(0.9999)) + if(fCos > (static_cast(1) - epsilon())) { k0 = static_cast(1) - a; k1 = static_cast(0) + a; //BUG!!! 1.0f + a; @@ -199,8 +199,8 @@ namespace glm T fSin = sqrt(T(1) - fCos * fCos); T fAngle = atan(fSin, fCos); T fOneOverSin = static_cast(1) / fSin; - k0 = sin((T(1) - a) * fAngle) * fOneOverSin; - k1 = sin((T(0) + a) * fAngle) * fOneOverSin; + k0 = sin((static_cast(1) - a) * fAngle) * fOneOverSin; + k1 = sin((static_cast(0) + a) * fAngle) * fOneOverSin; } return detail::tquat( @@ -218,7 +218,7 @@ namespace glm T const & a ) { - return glm::normalize(x * (T(1) - a) + (y * a)); + return glm::normalize(x * (static_cast(1) - a) + (y * a)); } template @@ -231,7 +231,7 @@ namespace glm T cosTheta = dot(orig, dest); detail::tvec3 rotationAxis; - if(cosTheta < T(-1) + epsilon()) + if(cosTheta < static_cast(-1) + epsilon()) { // special case when vectors in opposite directions : // there is no "ideal" rotation axis @@ -249,11 +249,11 @@ namespace glm // Implementation from Stan Melax's Game Programming Gems 1 article rotationAxis = cross(orig, dest); - T s = sqrt((T(1) + cosTheta) * T(2)); + T s = sqrt((T(1) + cosTheta) * static_cast(2)); T invs = static_cast(1) / s; return detail::tquat( - s * T(0.5f), + s * static_cast(0.5f), rotationAxis.x * invs, rotationAxis.y * invs, rotationAxis.z * invs); From 7f3c56f2782caf264427aad9a330a824093641c1 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 21 Jun 2014 16:00:17 +0200 Subject: [PATCH 38/47] Removed GCC warning --- test/core/core_func_matrix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core/core_func_matrix.cpp b/test/core/core_func_matrix.cpp index 1b609f32..a905417f 100644 --- a/test/core/core_func_matrix.cpp +++ b/test/core/core_func_matrix.cpp @@ -231,7 +231,7 @@ int test_inverse_perf(std::size_t Instance, char const * Message) printf("inverse<%s>(%f): %d\n", Message, Diff, EndTime - StartTime); return 0; -}; +} int main() { From 24cd06552cb70a028f3b95b103323072dd9c9838 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 21 Jun 2014 16:23:06 +0200 Subject: [PATCH 39/47] Fixed GLM_GTX_io coding style --- glm/gtx/io.hpp | 284 ++++++------ glm/gtx/io.inl | 1149 ++++++++++++++++++++++++------------------------ 2 files changed, 721 insertions(+), 712 deletions(-) diff --git a/glm/gtx/io.hpp b/glm/gtx/io.hpp index 25e9d74b..7dd22182 100644 --- a/glm/gtx/io.hpp +++ b/glm/gtx/io.hpp @@ -57,178 +57,168 @@ namespace glm { - /// @addtogroup gtx_io - /// @{ - - namespace io - { - - enum order_type { column_major, row_major, }; - - template - class format_punct : public std::locale::facet { + /// @addtogroup gtx_io + /// @{ - typedef CTy char_type; - - public: + namespace io + { + enum order_type { column_major, row_major}; - static std::locale::id id; + template + class format_punct : public std::locale::facet + { + typedef CTy char_type; - bool formatted; - unsigned precision; - unsigned width; - char_type separator; - char_type delim_left; - char_type delim_right; - char_type space; - char_type newline; - order_type order; - - explicit format_punct(size_t a = 0); - explicit format_punct(format_punct const&); - - }; + public: - template > - class basic_state_saver { + static std::locale::id id; - public: + bool formatted; + unsigned precision; + unsigned width; + char_type separator; + char_type delim_left; + char_type delim_right; + char_type space; + char_type newline; + order_type order; - explicit basic_state_saver(std::basic_ios&); - ~basic_state_saver(); + explicit format_punct(size_t a = 0); + explicit format_punct(format_punct const&); + }; - private: + template > + class basic_state_saver { - typedef ::std::basic_ios state_type; - typedef typename state_type::char_type char_type; - typedef ::std::ios_base::fmtflags flags_type; - typedef ::std::streamsize streamsize_type; - typedef ::std::locale const locale_type; - - state_type& state_; - flags_type flags_; - streamsize_type precision_; - streamsize_type width_; - char_type fill_; - locale_type locale_; - - basic_state_saver& operator=(basic_state_saver const&); - - }; + public: - typedef basic_state_saver state_saver; - typedef basic_state_saver wstate_saver; - - template > - class basic_format_saver { + explicit basic_state_saver(std::basic_ios&); + ~basic_state_saver(); - public: + private: - explicit basic_format_saver(std::basic_ios&); - ~basic_format_saver(); + typedef ::std::basic_ios state_type; + typedef typename state_type::char_type char_type; + typedef ::std::ios_base::fmtflags flags_type; + typedef ::std::streamsize streamsize_type; + typedef ::std::locale const locale_type; - private: + state_type& state_; + flags_type flags_; + streamsize_type precision_; + streamsize_type width_; + char_type fill_; + locale_type locale_; - basic_state_saver const bss_; + basic_state_saver& operator=(basic_state_saver const&); + }; - basic_format_saver& operator=(basic_format_saver const&); - - }; + typedef basic_state_saver state_saver; + typedef basic_state_saver wstate_saver; - typedef basic_format_saver format_saver; - typedef basic_format_saver wformat_saver; - - struct precision { + template > + class basic_format_saver + { + public: - unsigned value; - - explicit precision(unsigned); - - }; + explicit basic_format_saver(std::basic_ios&); + ~basic_format_saver(); - struct width { + private: - unsigned value; - - explicit width(unsigned); - - }; + basic_state_saver const bss_; - template - struct delimeter { + basic_format_saver& operator=(basic_format_saver const&); + }; - CTy value[3]; - - explicit delimeter(CTy /* left */, CTy /* right */, CTy /* separator */ = ','); - - }; + typedef basic_format_saver format_saver; + typedef basic_format_saver wformat_saver; - struct order { + struct precision + { + unsigned value; - order_type value; - - explicit order(order_type); - - }; - - // functions, inlined (inline) + explicit precision(unsigned); + }; - template - FTy const& get_facet(std::basic_ios&); - template - std::basic_ios& formatted(std::basic_ios&); - template - std::basic_ios& unformattet(std::basic_ios&); - - template - std::basic_ostream& operator<<(std::basic_ostream&, precision const&); - template - std::basic_ostream& operator<<(std::basic_ostream&, width const&); - template - std::basic_ostream& operator<<(std::basic_ostream&, delimeter const&); - template - std::basic_ostream& operator<<(std::basic_ostream&, order const&); - - }//namespace io + struct width + { + unsigned value; - namespace detail - { + explicit width(unsigned); + }; - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tquat const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tvec2 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tvec3 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tvec4 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat2x2 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat2x3 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat2x4 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat3x2 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat3x3 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat3x4 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat4x2 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat4x3 const&); - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat4x4 const&); - - template - GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, - std::pair const, - tmat4x4 const> const&); - - }//namespace detail - - /// @} + template + struct delimeter + { + CTy value[3]; + + explicit delimeter(CTy /* left */, CTy /* right */, CTy /* separator */ = ','); + }; + + struct order + { + order_type value; + + explicit order(order_type); + }; + + // functions, inlined (inline) + + template + FTy const& get_facet(std::basic_ios&); + template + std::basic_ios& formatted(std::basic_ios&); + template + std::basic_ios& unformattet(std::basic_ios&); + + template + std::basic_ostream& operator<<(std::basic_ostream&, precision const&); + template + std::basic_ostream& operator<<(std::basic_ostream&, width const&); + template + std::basic_ostream& operator<<(std::basic_ostream&, delimeter const&); + template + std::basic_ostream& operator<<(std::basic_ostream&, order const&); + }//namespace io + + namespace detail + { + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tquat const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tvec2 const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tvec3 const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tvec4 const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat2x2 const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat2x3 const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat2x4 const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat3x2 const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat3x3 const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat3x4 const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat4x2 const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat4x3 const&); + template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tmat4x4 const&); + + template + GLM_FUNC_DECL std::basic_ostream & operator<<( + std::basic_ostream &, + std::pair const, + tmat4x4 const> const &); + }//namespace detail + + /// @} }//namespace glm #include "io.inl" diff --git a/glm/gtx/io.inl b/glm/gtx/io.inl index 3132a88e..dbad163c 100644 --- a/glm/gtx/io.inl +++ b/glm/gtx/io.inl @@ -10,570 +10,589 @@ #include // std::setfill<>, std::fixed, std::setprecision, std::right, std::setw #include // std::basic_ostream<> -namespace glm +namespace glm{ +namespace io { - namespace io - { - - template - /* explicit */ GLM_FUNC_QUALIFIER - format_punct::format_punct(size_t a) - : std::locale::facet(a), - formatted (true), - precision (3), - width (1 + 4 + 1 + precision), - separator (','), - delim_left ('['), - delim_right (']'), - space (' '), - newline ('\n'), - order (row_major) - {} - - template - /* explicit */ GLM_FUNC_QUALIFIER - format_punct::format_punct(format_punct const& a) - : std::locale::facet(0), - formatted (a.formatted), - precision (a.precision), - width (a.width), - separator (a.separator), - delim_left (a.delim_left), - delim_right (a.delim_right), - space (a.space), - newline (a.newline), - order (a.order) - {} - - template std::locale::id format_punct::id; - - template - /* explicit */ GLM_FUNC_QUALIFIER - basic_state_saver::basic_state_saver(std::basic_ios& a) - : state_ (a), - flags_ (a.flags()), - precision_(a.precision()), - width_ (a.width()), - fill_ (a.fill()), - locale_ (a.getloc()) - {} - - template - GLM_FUNC_QUALIFIER - basic_state_saver::~basic_state_saver() - { - state_.imbue(locale_); - state_.fill(fill_); - state_.width(width_); - state_.precision(precision_); - state_.flags(flags_); - } - - template - /* explicit */ GLM_FUNC_QUALIFIER - basic_format_saver::basic_format_saver(std::basic_ios& a) - : bss_(a) - { - a.imbue(std::locale(a.getloc(), new format_punct(get_facet >(a)))); - } - - template - GLM_FUNC_QUALIFIER - basic_format_saver::~basic_format_saver() - {} - - /* explicit */ GLM_FUNC_QUALIFIER - precision::precision(unsigned a) - : value(a) - {} - - /* explicit */ GLM_FUNC_QUALIFIER - width::width(unsigned a) - : value(a) - {} - - template - /* explicit */ GLM_FUNC_QUALIFIER - delimeter::delimeter(CTy a, CTy b, CTy c) - : value() - { - value[0] = a; - value[1] = b; - value[2] = c; - } - - /* explicit */ GLM_FUNC_QUALIFIER - order::order(order_type a) - : value(a) - {} - - template - GLM_FUNC_QUALIFIER FTy const& - get_facet(std::basic_ios& ios) - { - if (!std::has_facet(ios.getloc())) { - ios.imbue(std::locale(ios.getloc(), new FTy)); - } - - return std::use_facet(ios.getloc()); - } - - template - GLM_FUNC_QUALIFIER std::basic_ios& - formatted(std::basic_ios& ios) - { - const_cast&>(get_facet >(ios)).formatted = true; - - return ios; - } - - template - GLM_FUNC_QUALIFIER std::basic_ios& - unformatted(std::basic_ios& ios) - { - const_cast&>(get_facet >(ios)).formatted = false; - - return ios; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, precision const& a) - { - const_cast&>(get_facet >(os)).precision = a.value; - - return os; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, width const& a) - { - const_cast&>(get_facet >(os)).width = a.value; - - return os; - } - - template - std::basic_ostream& operator<<(std::basic_ostream& os, - delimeter const& a) - { - format_punct& fmt(const_cast&>(get_facet >(os))); - - fmt.delim_left = a.value[0]; - fmt.delim_right = a.value[1]; - fmt.separator = a.value[2]; - - return os; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, order const& a) - { - const_cast&>(get_facet >(os)).order = a.value; - - return os; - } - - } // namespace io - - namespace detail { - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tquat const& a) - { - typename std::basic_ostream::sentry const cerberus(os); - - if (cerberus) { - io::format_punct const& fmt(io::get_facet >(os)); - - if (fmt.formatted) { - io::basic_state_saver const bss(os); - - os << std::fixed - << std::right - << std::setprecision(fmt.precision) - << std::setfill(fmt.space) - << fmt.delim_left - << std::setw(fmt.width) << a.w << fmt.separator - << std::setw(fmt.width) << a.x << fmt.separator - << std::setw(fmt.width) << a.y << fmt.separator - << std::setw(fmt.width) << a.z - << fmt.delim_right; - } else { - os << a.w << fmt.space << a.x << fmt.space << a.y << fmt.space << a.z; - } - } - - return os; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tvec2 const& a) - { - typename std::basic_ostream::sentry const cerberus(os); - - if (cerberus) { - io::format_punct const& fmt(io::get_facet >(os)); - - if (fmt.formatted) { - io::basic_state_saver const bss(os); - - os << std::fixed - << std::right - << std::setprecision(fmt.precision) - << std::setfill(fmt.space) - << fmt.delim_left - << std::setw(fmt.width) << a.x << fmt.separator - << std::setw(fmt.width) << a.y - << fmt.delim_right; - } else { - os << a.x << fmt.space << a.y; - } - } - - return os; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tvec3 const& a) - { - typename std::basic_ostream::sentry const cerberus(os); - - if (cerberus) { - io::format_punct const& fmt(io::get_facet >(os)); - - if (fmt.formatted) { - io::basic_state_saver const bss(os); - - os << std::fixed - << std::right - << std::setprecision(fmt.precision) - << std::setfill(fmt.space) - << fmt.delim_left - << std::setw(fmt.width) << a.x << fmt.separator - << std::setw(fmt.width) << a.y << fmt.separator - << std::setw(fmt.width) << a.z - << fmt.delim_right; - } else { - os << a.x << fmt.space << a.y << fmt.space << a.z; - } - } - - return os; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tvec4 const& a) - { - typename std::basic_ostream::sentry const cerberus(os); - - if (cerberus) { - io::format_punct const& fmt(io::get_facet >(os)); - - if (fmt.formatted) { - io::basic_state_saver const bss(os); - - os << std::fixed - << std::right - << std::setprecision(fmt.precision) - << std::setfill(fmt.space) - << fmt.delim_left - << std::setw(fmt.width) << a.x << fmt.separator - << std::setw(fmt.width) << a.y << fmt.separator - << std::setw(fmt.width) << a.z << fmt.separator - << std::setw(fmt.width) << a.w - << fmt.delim_right; - } else { - os << a.x << fmt.space << a.y << fmt.space << a.z << fmt.space << a.w; - } - } - - return os; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat2x2 const& a) - { - typename std::basic_ostream::sentry const cerberus(os); - - if (cerberus) { - io::format_punct const& fmt(io::get_facet >(os)); - tmat2x2 m(a); - - if (io::row_major == fmt.order) { - m = transpose(a); - } - - if (fmt.formatted) { - os << fmt.newline - << fmt.delim_left << m[0] << fmt.newline - << fmt.space << m[1] << fmt.delim_right; - } else { - os << m[0] << fmt.space << m[1]; - } - } - - return os; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat2x3 const& a) - { - typename std::basic_ostream::sentry const cerberus(os); - - if (cerberus) { - io::format_punct const& fmt(io::get_facet >(os)); - tmat3x2 m(a); - - if (io::row_major == fmt.order) { - m = transpose(a); - } - - if (fmt.formatted) { - os << fmt.newline - << fmt.delim_left << m[0] << fmt.newline - << fmt.space << m[1] << fmt.newline - << fmt.space << m[2] << fmt.delim_right; - } else { - os << m[0] << fmt.space << m[1] << fmt.space << m[2]; - } - } - - return os; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat2x4 const& a) - { - typename std::basic_ostream::sentry const cerberus(os); - - if (cerberus) { - io::format_punct const& fmt(io::get_facet >(os)); - tmat4x2 m(a); - - if (io::row_major == fmt.order) { - m = transpose(a); - } - - if (fmt.formatted) { - os << fmt.newline - << fmt.delim_left << m[0] << fmt.newline - << fmt.space << m[1] << fmt.newline - << fmt.space << m[2] << fmt.newline - << fmt.space << m[3] << fmt.delim_right; - } else { - os << m[0] << fmt.space << m[1] << fmt.space << m[2] << fmt.space << m[3]; - } - } - - return os; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat3x2 const& a) - { - typename std::basic_ostream::sentry const cerberus(os); - - if (cerberus) { - io::format_punct const& fmt(io::get_facet >(os)); - tmat2x3 m(a); - - if (io::row_major == fmt.order) { - m = transpose(a); - } - - if (fmt.formatted) { - os << fmt.newline - << fmt.delim_left << m[0] << fmt.newline - << fmt.space << m[1] << fmt.delim_right; - } else { - os << m[0] << fmt.space << m[1]; - } - } - - return os; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat3x3 const& a) - { - typename std::basic_ostream::sentry const cerberus(os); - - if (cerberus) { - io::format_punct const& fmt(io::get_facet >(os)); - tmat3x3 m(a); - - if (io::row_major == fmt.order) { - m = transpose(a); - } - - if (fmt.formatted) { - os << fmt.newline - << fmt.delim_left << m[0] << fmt.newline - << fmt.space << m[1] << fmt.newline - << fmt.space << m[2] << fmt.delim_right; - } else { - os << m[0] << fmt.space << m[1] << fmt.space << m[2]; - } - } - - return os; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat3x4 const& a) - { - typename std::basic_ostream::sentry const cerberus(os); - - if (cerberus) { - io::format_punct const& fmt(io::get_facet >(os)); - tmat4x3 m(a); - - if (io::row_major == fmt.order) { - m = transpose(a); - } - - if (fmt.formatted) { - os << fmt.newline - << fmt.delim_left << m[0] << fmt.newline - << fmt.space << m[1] << fmt.newline - << fmt.space << m[2] << fmt.newline - << fmt.space << m[3] << fmt.delim_right; - } else { - os << m[0] << fmt.space << m[1] << fmt.space << m[2] << fmt.space << m[3]; - } - } - - return os; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat4x2 const& a) - { - typename std::basic_ostream::sentry const cerberus(os); - - if (cerberus) { - io::format_punct const& fmt(io::get_facet >(os)); - tmat2x4 m(a); - - if (io::row_major == fmt.order) { - m = transpose(a); - } - - if (fmt.formatted) { - os << fmt.newline - << fmt.delim_left << m[0] << fmt.newline - << fmt.space << m[1] << fmt.delim_right; - } else { - os << m[0] << fmt.space << m[1]; - } - } - - return os; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat4x3 const& a) - { - typename std::basic_ostream::sentry const cerberus(os); - - if (cerberus) { - io::format_punct const& fmt(io::get_facet >(os)); - tmat3x4 m(a); - - if (io::row_major == fmt.order) { - m = transpose(a); - } - - if (fmt.formatted) { - os << fmt.newline - << fmt.delim_left << m[0] << fmt.newline - << fmt.space << m[1] << fmt.newline - << fmt.space << m[2] << fmt.delim_right; - } else { - os << m[0] << fmt.space << m[1] << fmt.space << m[2]; - } - } - - return os; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, tmat4x4 const& a) - { - typename std::basic_ostream::sentry const cerberus(os); - - if (cerberus) { - io::format_punct const& fmt(io::get_facet >(os)); - tmat4x4 m(a); - - if (io::row_major == fmt.order) { - m = transpose(a); - } - - if (fmt.formatted) { - os << fmt.newline - << fmt.delim_left << m[0] << fmt.newline - << fmt.space << m[1] << fmt.newline - << fmt.space << m[2] << fmt.newline - << fmt.space << m[3] << fmt.delim_right; - } else { - os << m[0] << fmt.space << m[1] << fmt.space << m[2] << fmt.space << m[3]; - } - } - - return os; - } - - template - GLM_FUNC_QUALIFIER std::basic_ostream& - operator<<(std::basic_ostream& os, - std::pair const, tmat4x4 const> const& a) - { - typename std::basic_ostream::sentry const cerberus(os); - - if (cerberus) { - io::format_punct const& fmt(io::get_facet >(os)); - tmat4x4 ml(a.first); - tmat4x4 mr(a.second); - - if (io::row_major == fmt.order) { - ml = transpose(a.first); - mr = transpose(a.second); - } - - if (fmt.formatted) { - CTy const& l(fmt.delim_left); - CTy const& r(fmt.delim_right); - CTy const& s(fmt.space); - - os << fmt.newline - << l << ml[0] << s << s << l << mr[0] << fmt.newline - << s << ml[1] << s << s << s << mr[1] << fmt.newline - << s << ml[2] << s << s << s << mr[2] << fmt.newline - << s << ml[3] << r << s << s << mr[3] << r; - } else { - os << ml << fmt.space << mr; - } - } - - return os; - } - - }//namespace detail + template + /* explicit */ GLM_FUNC_QUALIFIER + format_punct::format_punct(size_t a) + : std::locale::facet(a), + formatted (true), + precision (3), + width (1 + 4 + 1 + precision), + separator (','), + delim_left ('['), + delim_right (']'), + space (' '), + newline ('\n'), + order (row_major) + {} + + template + /* explicit */ GLM_FUNC_QUALIFIER + format_punct::format_punct(format_punct const& a) + : std::locale::facet(0), + formatted (a.formatted), + precision (a.precision), + width (a.width), + separator (a.separator), + delim_left (a.delim_left), + delim_right (a.delim_right), + space (a.space), + newline (a.newline), + order (a.order) + {} + + template std::locale::id format_punct::id; + + template + /* explicit */ GLM_FUNC_QUALIFIER basic_state_saver::basic_state_saver(std::basic_ios& a) + : state_ (a), + flags_ (a.flags()), + precision_(a.precision()), + width_ (a.width()), + fill_ (a.fill()), + locale_ (a.getloc()) + {} + + template + GLM_FUNC_QUALIFIER basic_state_saver::~basic_state_saver() + { + state_.imbue(locale_); + state_.fill(fill_); + state_.width(width_); + state_.precision(precision_); + state_.flags(flags_); + } + + template + /* explicit */ GLM_FUNC_QUALIFIER basic_format_saver::basic_format_saver(std::basic_ios& a) + : bss_(a) + { + a.imbue(std::locale(a.getloc(), new format_punct(get_facet >(a)))); + } + + template + GLM_FUNC_QUALIFIER + basic_format_saver::~basic_format_saver() + {} + + /* explicit */ GLM_FUNC_QUALIFIER precision::precision(unsigned a) + : value(a) + {} + + /* explicit */ GLM_FUNC_QUALIFIER width::width(unsigned a) + : value(a) + {} + + template + /* explicit */ GLM_FUNC_QUALIFIER delimeter::delimeter(CTy a, CTy b, CTy c) + : value() + { + value[0] = a; + value[1] = b; + value[2] = c; + } + + /* explicit */ GLM_FUNC_QUALIFIER + order::order(order_type a) + : value(a) + {} + + template + GLM_FUNC_QUALIFIER FTy const& get_facet(std::basic_ios& ios) + { + if (!std::has_facet(ios.getloc())) { + ios.imbue(std::locale(ios.getloc(), new FTy)); + } + + return std::use_facet(ios.getloc()); + } + + template + GLM_FUNC_QUALIFIER std::basic_ios& formatted(std::basic_ios& ios) + { + const_cast&>(get_facet >(ios)).formatted = true; + + return ios; + } + + template + GLM_FUNC_QUALIFIER std::basic_ios& unformatted(std::basic_ios& ios) + { + const_cast&>(get_facet >(ios)).formatted = false; + + return ios; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, precision const& a) + { + const_cast&>(get_facet >(os)).precision = a.value; + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, width const& a) + { + const_cast&>(get_facet >(os)).width = a.value; + + return os; + } + + template + std::basic_ostream& operator<<(std::basic_ostream& os, delimeter const& a) + { + format_punct & fmt(const_cast&>(get_facet >(os))); + + fmt.delim_left = a.value[0]; + fmt.delim_right = a.value[1]; + fmt.separator = a.value[2]; + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, order const& a) + { + const_cast&>(get_facet >(os)).order = a.value; + + return os; + } +} // namespace io + +namespace detail +{ + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tquat const& a) + { + typename std::basic_ostream::sentry const cerberus(os); + + if(cerberus) + { + io::format_punct const & fmt(io::get_facet >(os)); + + if(fmt.formatted) + { + io::basic_state_saver const bss(os); + + os << std::fixed + << std::right + << std::setprecision(fmt.precision) + << std::setfill(fmt.space) + << fmt.delim_left + << std::setw(fmt.width) << a.w << fmt.separator + << std::setw(fmt.width) << a.x << fmt.separator + << std::setw(fmt.width) << a.y << fmt.separator + << std::setw(fmt.width) << a.z + << fmt.delim_right; + } + else + { + os << a.w << fmt.space << a.x << fmt.space << a.y << fmt.space << a.z; + } + } + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tvec2 const& a) + { + typename std::basic_ostream::sentry const cerberus(os); + + if(cerberus) + { + io::format_punct const & fmt(io::get_facet >(os)); + + if(fmt.formatted) + { + io::basic_state_saver const bss(os); + + os << std::fixed + << std::right + << std::setprecision(fmt.precision) + << std::setfill(fmt.space) + << fmt.delim_left + << std::setw(fmt.width) << a.x << fmt.separator + << std::setw(fmt.width) << a.y + << fmt.delim_right; + } + else + { + os << a.x << fmt.space << a.y; + } + } + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tvec3 const& a) + { + typename std::basic_ostream::sentry const cerberus(os); + + if(cerberus) + { + io::format_punct const & fmt(io::get_facet >(os)); + + if(fmt.formatted) + { + io::basic_state_saver const bss(os); + + os << std::fixed + << std::right + << std::setprecision(fmt.precision) + << std::setfill(fmt.space) + << fmt.delim_left + << std::setw(fmt.width) << a.x << fmt.separator + << std::setw(fmt.width) << a.y << fmt.separator + << std::setw(fmt.width) << a.z + << fmt.delim_right; + } + else + { + os << a.x << fmt.space << a.y << fmt.space << a.z; + } + } + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tvec4 const& a) + { + typename std::basic_ostream::sentry const cerberus(os); + + if(cerberus) + { + io::format_punct const & fmt(io::get_facet >(os)); + + if(fmt.formatted) + { + io::basic_state_saver const bss(os); + + os << std::fixed + << std::right + << std::setprecision(fmt.precision) + << std::setfill(fmt.space) + << fmt.delim_left + << std::setw(fmt.width) << a.x << fmt.separator + << std::setw(fmt.width) << a.y << fmt.separator + << std::setw(fmt.width) << a.z << fmt.separator + << std::setw(fmt.width) << a.w + << fmt.delim_right; + } + else + { + os << a.x << fmt.space << a.y << fmt.space << a.z << fmt.space << a.w; + } + } + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat2x2 const& a) + { + typename std::basic_ostream::sentry const cerberus(os); + + if(cerberus) + { + io::format_punct const & fmt(io::get_facet >(os)); + tmat2x2 m(a); + + if(io::row_major == fmt.order) + m = transpose(a); + + if(fmt.formatted) + { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.delim_right; + } + else + { + os << m[0] << fmt.space << m[1]; + } + } + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat2x3 const& a) + { + typename std::basic_ostream::sentry const cerberus(os); + + if(cerberus) + { + io::format_punct const & fmt(io::get_facet >(os)); + tmat3x2 m(a); + + if(io::row_major == fmt.order) + m = transpose(a); + + if(fmt.formatted) + { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.newline + << fmt.space << m[2] << fmt.delim_right; + } + else + { + os << m[0] << fmt.space << m[1] << fmt.space << m[2]; + } + } + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat2x4 const& a) + { + typename std::basic_ostream::sentry const cerberus(os); + + if(cerberus) + { + io::format_punct const & fmt(io::get_facet >(os)); + tmat4x2 m(a); + + if(io::row_major == fmt.order) + m = transpose(a); + + + if(fmt.formatted) + { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.newline + << fmt.space << m[2] << fmt.newline + << fmt.space << m[3] << fmt.delim_right; + } + else + { + os << m[0] << fmt.space << m[1] << fmt.space << m[2] << fmt.space << m[3]; + } + } + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat3x2 const& a) + { + typename std::basic_ostream::sentry const cerberus(os); + + if(cerberus) + { + io::format_punct const & fmt(io::get_facet >(os)); + tmat2x3 m(a); + + if(io::row_major == fmt.order) + m = transpose(a); + + if(fmt.formatted) + { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.delim_right; + } + else + { + os << m[0] << fmt.space << m[1]; + } + } + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tmat3x3 const& a) + { + typename std::basic_ostream::sentry const cerberus(os); + + if(cerberus) + { + io::format_punct const & fmt(io::get_facet >(os)); + tmat3x3 m(a); + + if(io::row_major == fmt.order) + m = transpose(a); + + if(fmt.formatted) + { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.newline + << fmt.space << m[2] << fmt.delim_right; + } + else + { + os << m[0] << fmt.space << m[1] << fmt.space << m[2]; + } + } + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream & operator<<(std::basic_ostream& os, tmat3x4 const& a) + { + typename std::basic_ostream::sentry const cerberus(os); + + if(cerberus) + { + io::format_punct const & fmt(io::get_facet >(os)); + tmat4x3 m(a); + + if(io::row_major == fmt.order) + m = transpose(a); + + if (fmt.formatted) + { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.newline + << fmt.space << m[2] << fmt.newline + << fmt.space << m[3] << fmt.delim_right; + } + else + { + os << m[0] << fmt.space << m[1] << fmt.space << m[2] << fmt.space << m[3]; + } + } + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream & operator<<(std::basic_ostream& os, tmat4x2 const& a) + { + typename std::basic_ostream::sentry const cerberus(os); + + if(cerberus) + { + io::format_punct const & fmt(io::get_facet >(os)); + tmat2x4 m(a); + + if(io::row_major == fmt.order) + m = transpose(a); + + if (fmt.formatted) + { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.delim_right; + } + else + { + os << m[0] << fmt.space << m[1]; + } + } + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream & operator<<(std::basic_ostream& os, tmat4x3 const& a) + { + typename std::basic_ostream::sentry const cerberus(os); + + if(cerberus) + { + io::format_punct const & fmt(io::get_facet >(os)); + tmat3x4 m(a); + + if(io::row_major == fmt.order) + m = transpose(a); + + if(fmt.formatted) + { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.newline + << fmt.space << m[2] << fmt.delim_right; + } + else + { + os << m[0] << fmt.space << m[1] << fmt.space << m[2]; + } + } + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream & operator<<(std::basic_ostream& os, tmat4x4 const& a) + { + typename std::basic_ostream::sentry const cerberus(os); + + if(cerberus) + { + io::format_punct const & fmt(io::get_facet >(os)); + tmat4x4 m(a); + + if (io::row_major == fmt.order) + m = transpose(a); + + if(fmt.formatted) + { + os << fmt.newline + << fmt.delim_left << m[0] << fmt.newline + << fmt.space << m[1] << fmt.newline + << fmt.space << m[2] << fmt.newline + << fmt.space << m[3] << fmt.delim_right; + } + else + { + os << m[0] << fmt.space << m[1] << fmt.space << m[2] << fmt.space << m[3]; + } + } + + return os; + } + + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<( + std::basic_ostream & os, + std::pair const, tmat4x4 const> const& a) + { + typename std::basic_ostream::sentry const cerberus(os); + + if(cerberus) + { + io::format_punct const & fmt(io::get_facet >(os)); + tmat4x4 ml(a.first); + tmat4x4 mr(a.second); + + if(io::row_major == fmt.order) + { + ml = transpose(a.first); + mr = transpose(a.second); + } + + if(fmt.formatted) + { + CTy const & l(fmt.delim_left); + CTy const & r(fmt.delim_right); + CTy const & s(fmt.space); + + os << fmt.newline + << l << ml[0] << s << s << l << mr[0] << fmt.newline + << s << ml[1] << s << s << s << mr[1] << fmt.newline + << s << ml[2] << s << s << s << mr[2] << fmt.newline + << s << ml[3] << r << s << s << mr[3] << r; + } + else + { + os << ml << fmt.space << mr; + } + } + + return os; + } +}//namespace detail }//namespace glm From 4fa38c7a03df4064f9c4fff75f9d5a93f0049ae5 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 21 Jun 2014 16:29:06 +0200 Subject: [PATCH 40/47] Fixed warning --- test/core/core_func_matrix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core/core_func_matrix.cpp b/test/core/core_func_matrix.cpp index a905417f..5c95672c 100644 --- a/test/core/core_func_matrix.cpp +++ b/test/core/core_func_matrix.cpp @@ -228,7 +228,7 @@ int test_inverse_perf(std::size_t Instance, char const * Message) //glm::uint Ulp = 0; //Ulp = glm::max(glm::float_distance(*Dst, *Src), Ulp); - printf("inverse<%s>(%f): %d\n", Message, Diff, EndTime - StartTime); + printf("inverse<%s>(%f): %lu\n", Message, Diff, EndTime - StartTime); return 0; } From 6f59e64a55a2cbd0ac0c39bbb4936873207d6f08 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 22 Jun 2014 02:03:31 +0200 Subject: [PATCH 41/47] Use C++ cast --- glm/gtc/matrix_transform.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glm/gtc/matrix_transform.inl b/glm/gtc/matrix_transform.inl index 44578290..15009358 100644 --- a/glm/gtc/matrix_transform.inl +++ b/glm/gtc/matrix_transform.inl @@ -167,7 +167,7 @@ namespace glm detail::tmat4x4 Result(1); Result[0][0] = static_cast(2) / (right - left); Result[1][1] = static_cast(2) / (top - bottom); - Result[2][2] = - T(2) / (zFar - zNear); + Result[2][2] = - static_cast(2) / (zFar - zNear); Result[3][0] = - (right + left) / (right - left); Result[3][1] = - (top + bottom) / (top - bottom); Result[3][2] = - (zFar + zNear) / (zFar - zNear); @@ -186,7 +186,7 @@ namespace glm detail::tmat4x4 Result(1); Result[0][0] = static_cast(2) / (right - left); Result[1][1] = static_cast(2) / (top - bottom); - Result[2][2] = - T(1); + Result[2][2] = - static_cast(1); Result[3][0] = - (right + left) / (right - left); Result[3][1] = - (top + bottom) / (top - bottom); return Result; From 74591613643e3d3048bad5dac6844805333bcb83 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 28 Jun 2014 20:45:45 +0200 Subject: [PATCH 42/47] Updated revision fornext release --- glm/detail/setup.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index c982c469..6ad9bdc0 100644 --- a/glm/detail/setup.hpp +++ b/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 4 +#define GLM_VERSION_REVISION 5 /////////////////////////////////////////////////////////////////////////////////////////////////// // Platform From 9a3f42279ba2dd5b338a59e0ffd9479f39b4fdce Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 28 Jun 2014 20:56:12 +0200 Subject: [PATCH 43/47] - Fixed std::nextafter not supported with C++11 on Android #213 --- glm/gtc/ulp.inl | 10 +++++++--- readme.txt | 5 +++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/glm/gtc/ulp.inl b/glm/gtc/ulp.inl index 4099812b..91846b22 100644 --- a/glm/gtc/ulp.inl +++ b/glm/gtc/ulp.inl @@ -201,8 +201,10 @@ namespace glm { # if((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_PLATFORM & GLM_PLATFORM_ANDROID)) return std::nextafter(x, std::numeric_limits::max()); -# elif((GLM_PLATFORM & GLM_PLATFORM_ANDROID) || (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) +# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) return detail::nextafterf(x, FLT_MAX); +# elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID) + return _nextafterf(x, FLT_MAX); # else return nextafterf(x, FLT_MAX); # endif @@ -213,7 +215,7 @@ namespace glm { # if((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_PLATFORM & GLM_PLATFORM_ANDROID)) return std::nextafter(x, std::numeric_limits::max()); -# elif((GLM_PLATFORM & GLM_PLATFORM_ANDROID) || (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) +# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) return detail::nextafter(x, std::numeric_limits::max()); # else return nextafter(x, DBL_MAX); @@ -233,8 +235,10 @@ namespace glm { # if((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_PLATFORM & GLM_PLATFORM_ANDROID)) return std::nextafter(x, std::numeric_limits::min()); -# elif((GLM_PLATFORM & GLM_PLATFORM_ANDROID) || (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) +# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) return detail::nextafterf(x, FLT_MIN); +# elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID) + return _nextafterf(x, FLT_MIN); # else return nextafterf(x, FLT_MIN); # endif diff --git a/readme.txt b/readme.txt index 9c3d238c..7328ad1d 100644 --- a/readme.txt +++ b/readme.txt @@ -36,6 +36,11 @@ GLM is a header only library, there is nothing to build, just include it. More informations in GLM manual: http://glm.g-truc.net/glm.pdf +================================================================================ +GLM 0.9.5.5: 2014-XX-XX +-------------------------------------------------------------------------------- +- Fixed std::nextafter not supported with C++11 on Android #213 + ================================================================================ GLM 0.9.5.4: 2014-06-21 -------------------------------------------------------------------------------- From d84fa89cb850c3a1bec0f56ba735fb74d0359b05 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 28 Jun 2014 21:08:53 +0200 Subject: [PATCH 44/47] Fixed missing value_type for dual quaternion, Fixed return type of dual quaternion length --- glm/gtc/quaternion.hpp | 2 +- glm/gtx/dual_quaternion.hpp | 4 ++-- glm/gtx/dual_quaternion.inl | 2 +- readme.txt | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 1470a85d..a8b0c904 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -59,7 +59,7 @@ namespace detail { enum ctor{null}; - typedef T value_type; + typedef T value_type; typedef tvec4 bool_type; public: diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index c7c6c50a..101c28ae 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -57,13 +57,13 @@ namespace detail struct tdualquat { enum ctor{null}; - + typedef T value_type; typedef glm::detail::tquat part_type; public: glm::detail::tquat real, dual; - GLM_FUNC_DECL GLM_CONSTEXPR int length() const; + GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; // Constructors GLM_FUNC_DECL tdualquat(); diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index 7f4aadd6..bd69f537 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -33,7 +33,7 @@ namespace glm{ namespace detail { template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR int tdualquat::length() const + GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tdualquat::length() const { return 8; } diff --git a/readme.txt b/readme.txt index 7328ad1d..5320c51d 100644 --- a/readme.txt +++ b/readme.txt @@ -40,6 +40,8 @@ http://glm.g-truc.net/glm.pdf GLM 0.9.5.5: 2014-XX-XX -------------------------------------------------------------------------------- - Fixed std::nextafter not supported with C++11 on Android #213 +- Fixed missing value_type for dual quaternion +- Fixed return type of dual quaternion length ================================================================================ GLM 0.9.5.4: 2014-06-21 From cff845c2b49fc372c03b545be071fe490e7b9580 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 14 Jul 2014 01:48:27 +0200 Subject: [PATCH 45/47] Use pragma once --- glm/common.hpp | 5 +- glm/detail/_features.hpp | 5 +- glm/detail/_literals.hpp | 5 +- glm/detail/_noise.hpp | 5 +- glm/detail/_swizzle.hpp | 5 +- glm/detail/_swizzle_func.hpp | 5 +- glm/detail/_vectorize.hpp | 5 +- glm/detail/dummy.cpp | 6 +- glm/detail/func_common.hpp | 4 +- glm/detail/func_exponential.hpp | 5 +- glm/detail/func_geometric.hpp | 5 +- glm/detail/func_integer.hpp | 6 +- glm/detail/func_matrix.hpp | 5 +- glm/detail/func_noise.hpp | 5 +- glm/detail/func_packing.hpp | 5 +- glm/detail/func_trigonometric.hpp | 7 +- glm/detail/func_vector_relational.hpp | 5 +- glm/detail/hint.hpp | 5 +- glm/detail/intrinsic_common.hpp | 4 +- glm/detail/intrinsic_exponential.hpp | 4 +- glm/detail/intrinsic_geometric.hpp | 4 +- glm/detail/intrinsic_integer.hpp | 4 +- glm/detail/intrinsic_matrix.hpp | 4 +- glm/detail/intrinsic_trigonometric.hpp | 4 +- glm/detail/intrinsic_vector_relational.hpp | 4 +- glm/detail/precision.hpp | 5 +- glm/detail/setup.hpp | 5 +- glm/detail/type_float.hpp | 5 +- glm/detail/type_gentype.hpp | 5 +- glm/detail/type_half.hpp | 5 +- glm/detail/type_int.hpp | 5 +- glm/detail/type_mat.hpp | 5 +- glm/detail/type_mat2x2.hpp | 5 +- glm/detail/type_mat2x3.hpp | 5 +- glm/detail/type_mat2x4.hpp | 5 +- glm/detail/type_mat3x2.hpp | 5 +- glm/detail/type_mat3x3.hpp | 5 +- glm/detail/type_mat3x4.hpp | 5 +- glm/detail/type_mat4x2.hpp | 5 +- glm/detail/type_mat4x3.hpp | 5 +- glm/detail/type_mat4x4.hpp | 5 +- glm/detail/type_vec.hpp | 5 +- glm/detail/type_vec1.hpp | 5 +- glm/detail/type_vec2.hpp | 5 +- glm/detail/type_vec3.hpp | 5 +- glm/detail/type_vec4.hpp | 5 +- glm/exponential.hpp | 5 +- glm/ext.hpp | 5 +- glm/fwd.hpp | 5 +- glm/geometric.hpp | 5 +- glm/glm.hpp | 5 +- glm/gtc/constants.hpp | 5 +- glm/gtc/epsilon.hpp | 5 +- glm/gtc/matrix_access.hpp | 5 +- glm/gtc/matrix_integer.hpp | 5 +- glm/gtc/matrix_inverse.hpp | 5 +- glm/gtc/matrix_transform.hpp | 5 +- glm/gtc/noise.hpp | 5 +- glm/gtc/packing.hpp | 6 +- glm/gtc/quaternion.hpp | 5 +- glm/gtc/random.hpp | 5 +- glm/gtc/reciprocal.hpp | 5 +- glm/gtc/type_precision.hpp | 5 +- glm/gtc/type_ptr.hpp | 6 +- glm/gtc/ulp.hpp | 6 +- glm/gtx/associated_min_max.hpp | 5 +- glm/gtx/bit.hpp | 5 +- glm/gtx/closest_point.hpp | 5 +- glm/gtx/color_space.hpp | 5 +- glm/gtx/color_space_YCoCg.hpp | 5 +- glm/gtx/compatibility.hpp | 6 +- glm/gtx/component_wise.hpp | 5 +- glm/gtx/dual_quaternion.hpp | 5 +- glm/gtx/euler_angles.hpp | 5 +- glm/gtx/extend.hpp | 5 +- glm/gtx/extented_min_max.hpp | 5 +- glm/gtx/fast_exponential.hpp | 5 +- glm/gtx/fast_square_root.hpp | 5 +- glm/gtx/fast_trigonometry.hpp | 5 +- glm/gtx/gradient_paint.hpp | 5 +- glm/gtx/handed_coordinate_space.hpp | 5 +- glm/gtx/inertia.hpp | 5 +- glm/gtx/integer.hpp | 5 +- glm/gtx/intersect.hpp | 5 +- glm/gtx/io.hpp | 5 +- glm/gtx/log_base.hpp | 5 +- glm/gtx/matrix_cross_product.hpp | 5 +- glm/gtx/matrix_interpolation.hpp | 5 +- glm/gtx/matrix_major_storage.hpp | 5 +- glm/gtx/matrix_operation.hpp | 5 +- glm/gtx/matrix_query.hpp | 5 +- glm/gtx/matrix_transform_2d.hpp | 5 +- glm/gtx/mixed_product.hpp | 5 +- glm/gtx/multiple.hpp | 5 +- glm/gtx/norm.hpp | 5 +- glm/gtx/normal.hpp | 5 +- glm/gtx/normalize_dot.hpp | 5 +- glm/gtx/number_precision.hpp | 5 +- glm/gtx/optimum_pow.hpp | 5 +- glm/gtx/orthonormalize.hpp | 5 +- glm/gtx/perpendicular.hpp | 5 +- glm/gtx/polar_coordinates.hpp | 5 +- glm/gtx/projection.hpp | 5 +- glm/gtx/quaternion.hpp | 5 +- glm/gtx/raw_data.hpp | 5 +- glm/gtx/rotate_normalized_axis.hpp | 5 +- glm/gtx/rotate_vector.hpp | 5 +- glm/gtx/scalar_relational.hpp | 5 +- glm/gtx/simd_mat4.hpp | 5 +- glm/gtx/simd_quat.hpp | 103 ++++++++++----------- glm/gtx/simd_vec4.hpp | 5 +- glm/gtx/spline.hpp | 6 +- glm/gtx/std_based_type.hpp | 5 +- glm/gtx/string_cast.hpp | 5 +- glm/gtx/transform.hpp | 5 +- glm/gtx/transform2.hpp | 5 +- glm/gtx/vec1.hpp | 6 +- glm/gtx/vector_angle.hpp | 5 +- glm/gtx/vector_query.hpp | 5 +- glm/gtx/wrap.hpp | 5 +- glm/integer.hpp | 5 +- glm/mat2x2.hpp | 5 +- glm/mat2x3.hpp | 4 +- glm/mat2x4.hpp | 5 +- glm/mat3x2.hpp | 5 +- glm/mat3x3.hpp | 5 +- glm/mat3x4.hpp | 5 +- glm/mat4x2.hpp | 5 +- glm/mat4x3.hpp | 5 +- glm/mat4x4.hpp | 5 +- glm/matrix.hpp | 5 +- glm/packing.hpp | 5 +- glm/trigonometric.hpp | 5 +- glm/vec2.hpp | 5 +- glm/vec3.hpp | 5 +- glm/vec4.hpp | 5 +- glm/vector_relational.hpp | 5 +- readme.txt | 2 + 138 files changed, 191 insertions(+), 595 deletions(-) diff --git a/glm/common.hpp b/glm/common.hpp index 2d787dde..b22e11b0 100644 --- a/glm/common.hpp +++ b/glm/common.hpp @@ -26,9 +26,6 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_COMMON_INCLUDED -#define GLM_COMMON_INCLUDED +#pragma once #include "detail/func_common.hpp" - -#endif//GLM_COMMON_INCLUDED diff --git a/glm/detail/_features.hpp b/glm/detail/_features.hpp index 1c7fe8c9..936672fd 100644 --- a/glm/detail/_features.hpp +++ b/glm/detail/_features.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_features -#define glm_core_features +#pragma once // #define GLM_CXX98_EXCEPTIONS // #define GLM_CXX98_RTTI @@ -423,5 +422,3 @@ # endif #endif//(GLM_COMPILER & GLM_COMPILER_CLANG) - -#endif//glm_core_features diff --git a/glm/detail/_literals.hpp b/glm/detail/_literals.hpp index 79780ccf..82220874 100644 --- a/glm/detail/_literals.hpp +++ b/glm/detail/_literals.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_literals -#define glm_core_literals +#pragma once namespace glm { @@ -47,5 +46,3 @@ namespace glm #endif//GLM_CXX11_USER_LITERALS }//namespace glm - -#endif//glm_core_literals diff --git a/glm/detail/_noise.hpp b/glm/detail/_noise.hpp index e366e7c3..583ac0be 100644 --- a/glm/detail/_noise.hpp +++ b/glm/detail/_noise.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_DETAIL_NOISE_INCLUDED -#define GLM_DETAIL_NOISE_INCLUDED +#pragma once namespace glm{ namespace detail @@ -126,5 +125,3 @@ namespace detail }//namespace detail }//namespace glm -#endif//GLM_DETAIL_NOISE_INCLUDED - diff --git a/glm/detail/_swizzle.hpp b/glm/detail/_swizzle.hpp index 407ffb49..ebe37319 100644 --- a/glm/detail/_swizzle.hpp +++ b/glm/detail/_swizzle.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_swizzle -#define glm_core_swizzle +#pragma once namespace glm{ namespace detail @@ -836,5 +835,3 @@ namespace glm struct { _swizzle<4, T, P, V, 3,3,3,1> E3 ## E3 ## E3 ## E1; }; \ struct { _swizzle<4, T, P, V, 3,3,3,2> E3 ## E3 ## E3 ## E2; }; \ struct { _swizzle<4, T, P, V, 3,3,3,3> E3 ## E3 ## E3 ## E3; }; - -#endif//glm_core_swizzle diff --git a/glm/detail/_swizzle_func.hpp b/glm/detail/_swizzle_func.hpp index c287bbf5..a3f6993c 100644 --- a/glm/detail/_swizzle_func.hpp +++ b/glm/detail/_swizzle_func.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_swizzle_func -#define glm_core_swizzle_func +#pragma once #define GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \ SWIZZLED_TYPE A ## B() CONST \ @@ -720,5 +719,3 @@ GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q) //GLM_SWIZZLE_GEN_VEC_FROM_VEC4(valType, detail::vec4, detail::vec2, detail::vec3, detail::vec4) - -#endif//glm_core_swizzle_func diff --git a/glm/detail/_vectorize.hpp b/glm/detail/_vectorize.hpp index b653fa9f..48fe97f3 100644 --- a/glm/detail/_vectorize.hpp +++ b/glm/detail/_vectorize.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_CORE_DETAIL_INCLUDED -#define GLM_CORE_DETAIL_INCLUDED +#pragma once #include "type_vec1.hpp" #include "type_vec2.hpp" @@ -213,5 +212,3 @@ namespace detail }; }//namespace detail }//namespace glm - -#endif//GLM_CORE_DETAIL_INCLUDED diff --git a/glm/detail/dummy.cpp b/glm/detail/dummy.cpp index 98ca022c..69ffa7cf 100644 --- a/glm/detail/dummy.cpp +++ b/glm/detail/dummy.cpp @@ -41,7 +41,8 @@ struct material glm::vec4 diffuse; // Dcm glm::vec4 specular; // Scm float shininess; // Srm -}; +}; + struct light { glm::vec4 ambient; // Acli @@ -58,7 +59,8 @@ struct light float constantAttenuation; // K0 float linearAttenuation; // K1 float quadraticAttenuation;// K2 -}; +}; + // Sample 1 #include // glm::vec3 diff --git a/glm/detail/func_common.hpp b/glm/detail/func_common.hpp index 87734c01..879465d9 100644 --- a/glm/detail/func_common.hpp +++ b/glm/detail/func_common.hpp @@ -33,8 +33,7 @@ /// These all operate component-wise. The description is per component. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_FUNC_COMMON_INCLUDED -#define GLM_FUNC_COMMON_INCLUDED +#pragma once #include "setup.hpp" #include "precision.hpp" @@ -469,4 +468,3 @@ namespace glm #include "func_common.inl" -#endif//GLM_FUNC_COMMON_INCLUDED diff --git a/glm/detail/func_exponential.hpp b/glm/detail/func_exponential.hpp index 93820870..1e1f4418 100644 --- a/glm/detail/func_exponential.hpp +++ b/glm/detail/func_exponential.hpp @@ -33,8 +33,7 @@ /// These all operate component-wise. The description is per component. /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_func_exponential -#define glm_core_func_exponential +#pragma once #include "type_vec1.hpp" #include "type_vec2.hpp" @@ -128,5 +127,3 @@ namespace glm }//namespace glm #include "func_exponential.inl" - -#endif//glm_core_func_exponential diff --git a/glm/detail/func_geometric.hpp b/glm/detail/func_geometric.hpp index 0f83639c..491e867b 100644 --- a/glm/detail/func_geometric.hpp +++ b/glm/detail/func_geometric.hpp @@ -33,8 +33,7 @@ /// These operate on vectors as vectors, not component-wise. /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_func_geometric -#define glm_core_func_geometric +#pragma once #include "type_vec3.hpp" @@ -147,5 +146,3 @@ namespace glm }//namespace glm #include "func_geometric.inl" - -#endif//glm_core_func_geometric diff --git a/glm/detail/func_integer.hpp b/glm/detail/func_integer.hpp index d9fbdfd5..30544947 100644 --- a/glm/detail/func_integer.hpp +++ b/glm/detail/func_integer.hpp @@ -35,8 +35,7 @@ /// b, inclusive. The lowest-order bit is bit 0. /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_func_integer -#define glm_core_func_integer +#pragma once #include "setup.hpp" @@ -198,6 +197,3 @@ namespace glm }//namespace glm #include "func_integer.inl" - -#endif//glm_core_func_integer - diff --git a/glm/detail/func_matrix.hpp b/glm/detail/func_matrix.hpp index 901c196b..f7b392fe 100644 --- a/glm/detail/func_matrix.hpp +++ b/glm/detail/func_matrix.hpp @@ -37,8 +37,7 @@ /// floating point version is shown. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_CORE_func_matrix -#define GLM_CORE_func_matrix +#pragma once // Dependencies #include "../detail/precision.hpp" @@ -175,5 +174,3 @@ namespace detail }//namespace glm #include "func_matrix.inl" - -#endif//GLM_CORE_func_matrix diff --git a/glm/detail/func_noise.hpp b/glm/detail/func_noise.hpp index 7a6ae1c0..f7aca685 100644 --- a/glm/detail/func_noise.hpp +++ b/glm/detail/func_noise.hpp @@ -35,8 +35,7 @@ /// appearance of randomness, but are not truly random. /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_func_noise -#define glm_core_func_noise +#pragma once #include "type_vec1.hpp" #include "type_vec2.hpp" @@ -88,5 +87,3 @@ namespace glm }//namespace glm #include "func_noise.inl" - -#endif//glm_core_func_noise diff --git a/glm/detail/func_packing.hpp b/glm/detail/func_packing.hpp index 454c13ff..98c639e7 100644 --- a/glm/detail/func_packing.hpp +++ b/glm/detail/func_packing.hpp @@ -33,8 +33,7 @@ /// These functions do not operate component-wise, rather as described in each case. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_CORE_func_packing -#define GLM_CORE_func_packing +#pragma once #include "type_vec2.hpp" #include "type_vec4.hpp" @@ -191,5 +190,3 @@ namespace glm }//namespace glm #include "func_packing.inl" - -#endif//GLM_CORE_func_packing diff --git a/glm/detail/func_trigonometric.hpp b/glm/detail/func_trigonometric.hpp index 9c4a7b5d..b3148c14 100644 --- a/glm/detail/func_trigonometric.hpp +++ b/glm/detail/func_trigonometric.hpp @@ -37,8 +37,7 @@ /// These all operate component-wise. The description is per component. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_CORE_func_trigonometric -#define GLM_CORE_func_trigonometric +#pragma once namespace glm { @@ -197,7 +196,3 @@ namespace glm }//namespace glm #include "func_trigonometric.inl" - -#endif//GLM_CORE_func_trigonometric - - diff --git a/glm/detail/func_vector_relational.hpp b/glm/detail/func_vector_relational.hpp index b9139546..94714ab4 100644 --- a/glm/detail/func_vector_relational.hpp +++ b/glm/detail/func_vector_relational.hpp @@ -38,8 +38,7 @@ /// call must match. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_CORE_func_vector_relational -#define GLM_CORE_func_vector_relational +#pragma once #include "precision.hpp" #include "setup.hpp" @@ -141,5 +140,3 @@ namespace glm #endif #include "func_vector_relational.inl" - -#endif//GLM_CORE_func_vector_relational diff --git a/glm/detail/hint.hpp b/glm/detail/hint.hpp index 219f2bd0..2b96c0f6 100644 --- a/glm/detail/hint.hpp +++ b/glm/detail/hint.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type -#define glm_core_type +#pragma once namespace glm { @@ -36,5 +35,3 @@ namespace glm class nicest {}; class fastest {}; }//namespace glm - -#endif//glm_core_type diff --git a/glm/detail/intrinsic_common.hpp b/glm/detail/intrinsic_common.hpp index 378bdd23..405bb59a 100644 --- a/glm/detail/intrinsic_common.hpp +++ b/glm/detail/intrinsic_common.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_detail_intrinsic_common -#define glm_detail_intrinsic_common +#pragma once #include "setup.hpp" @@ -86,4 +85,3 @@ namespace detail #include "intrinsic_common.inl" #endif//GLM_ARCH -#endif//glm_detail_intrinsic_common diff --git a/glm/detail/intrinsic_exponential.hpp b/glm/detail/intrinsic_exponential.hpp index 60a7f628..7194c3cf 100644 --- a/glm/detail/intrinsic_exponential.hpp +++ b/glm/detail/intrinsic_exponential.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_detail_intrinsic_exponential -#define glm_detail_intrinsic_exponential +#pragma once #include "setup.hpp" @@ -76,4 +75,3 @@ GLM_FUNC_QUALIFIER __m128 sse_normalize_fast_ps( float * RESTRICT vOut, float * }//namespace glm #endif//GLM_ARCH -#endif//glm_detail_intrinsic_exponential diff --git a/glm/detail/intrinsic_geometric.hpp b/glm/detail/intrinsic_geometric.hpp index d229dcf9..e2175389 100644 --- a/glm/detail/intrinsic_geometric.hpp +++ b/glm/detail/intrinsic_geometric.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_intrinsic_geometric -#define glm_core_intrinsic_geometric +#pragma once #include "setup.hpp" @@ -73,4 +72,3 @@ namespace detail #include "intrinsic_geometric.inl" #endif//GLM_ARCH -#endif//glm_core_intrinsic_geometric diff --git a/glm/detail/intrinsic_integer.hpp b/glm/detail/intrinsic_integer.hpp index ec25e23c..b542ac4a 100644 --- a/glm/detail/intrinsic_integer.hpp +++ b/glm/detail/intrinsic_integer.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_detail_intrinsic_integer -#define glm_detail_intrinsic_integer +#pragma once #include "glm/glm.hpp" @@ -47,4 +46,3 @@ namespace detail #include "intrinsic_integer.inl" #endif//GLM_ARCH -#endif//glm_detail_intrinsic_integer diff --git a/glm/detail/intrinsic_matrix.hpp b/glm/detail/intrinsic_matrix.hpp index 5cfb7d2f..082f4980 100644 --- a/glm/detail/intrinsic_matrix.hpp +++ b/glm/detail/intrinsic_matrix.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_detail_intrinsic_matrix -#define glm_detail_intrinsic_matrix +#pragma once #include "setup.hpp" @@ -66,4 +65,3 @@ namespace detail #include "intrinsic_matrix.inl" #endif//GLM_ARCH -#endif//glm_detail_intrinsic_matrix diff --git a/glm/detail/intrinsic_trigonometric.hpp b/glm/detail/intrinsic_trigonometric.hpp index 3bb8e672..9176291c 100644 --- a/glm/detail/intrinsic_trigonometric.hpp +++ b/glm/detail/intrinsic_trigonometric.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_detail_intrinsic_trigonometric -#define glm_detail_intrinsic_trigonometric +#pragma once #include "setup.hpp" @@ -45,4 +44,3 @@ namespace detail #include "intrinsic_trigonometric.inl" #endif//GLM_ARCH -#endif//glm_detail_intrinsic_trigonometric diff --git a/glm/detail/intrinsic_vector_relational.hpp b/glm/detail/intrinsic_vector_relational.hpp index 9fcbb55c..af6620d6 100644 --- a/glm/detail/intrinsic_vector_relational.hpp +++ b/glm/detail/intrinsic_vector_relational.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_detail_intrinsic_vector_relational -#define glm_detail_intrinsic_vector_relational +#pragma once #include "setup.hpp" @@ -45,4 +44,3 @@ namespace detail #include "intrinsic_vector_relational.inl" #endif//GLM_ARCH -#endif//glm_detail_intrinsic_vector_relational diff --git a/glm/detail/precision.hpp b/glm/detail/precision.hpp index 983fc8ee..6be15a34 100644 --- a/glm/detail/precision.hpp +++ b/glm/detail/precision.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_CORE_PRECISION_INCLUDED -#define GLM_CORE_PRECISION_INCLUDED +#pragma once namespace glm { @@ -39,5 +38,3 @@ namespace glm defaultp = highp }; }//namespace glm - -#endif//GLM_CORE_PRECISION_INCLUDED diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 62b3e2cb..ed254fb6 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_SETUP_INCLUDED -#define GLM_SETUP_INCLUDED +#pragma once #include @@ -801,5 +800,3 @@ namespace glm #else # define GLM_CONSTEXPR #endif - -#endif//GLM_SETUP_INCLUDED diff --git a/glm/detail/type_float.hpp b/glm/detail/type_float.hpp index 0b93517b..495dbc92 100644 --- a/glm/detail/type_float.hpp +++ b/glm/detail/type_float.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_float -#define glm_core_type_float +#pragma once #include "setup.hpp" @@ -91,5 +90,3 @@ namespace detail /// @} }//namespace glm - -#endif//glm_core_type_float diff --git a/glm/detail/type_gentype.hpp b/glm/detail/type_gentype.hpp index f3571f5d..59882e4c 100644 --- a/glm/detail/type_gentype.hpp +++ b/glm/detail/type_gentype.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_gentype -#define glm_core_type_gentype +#pragma once namespace glm { @@ -219,5 +218,3 @@ namespace detail }//namespace glm //#include "type_gentype.inl" - -#endif//glm_core_type_gentype diff --git a/glm/detail/type_half.hpp b/glm/detail/type_half.hpp index 559c5673..827c28cb 100644 --- a/glm/detail/type_half.hpp +++ b/glm/detail/type_half.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_half -#define glm_core_type_half +#pragma once #include "setup.hpp" @@ -47,5 +46,3 @@ namespace detail }//namespace glm #include "type_half.inl" - -#endif//glm_core_type_half diff --git a/glm/detail/type_int.hpp b/glm/detail/type_int.hpp index b8b65c00..fcf99a3f 100644 --- a/glm/detail/type_int.hpp +++ b/glm/detail/type_int.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_int -#define glm_core_type_int +#pragma once #include "setup.hpp" @@ -187,5 +186,3 @@ namespace detail #endif//GLM_STATIC_ASSERT_NULL }//namespace glm - -#endif//glm_core_type_int diff --git a/glm/detail/type_mat.hpp b/glm/detail/type_mat.hpp index 94105240..8e2b8bb6 100644 --- a/glm/detail/type_mat.hpp +++ b/glm/detail/type_mat.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_mat -#define glm_core_type_mat +#pragma once #include "precision.hpp" @@ -791,5 +790,3 @@ namespace detail /// @} }//namespace glm - -#endif//glm_core_type_mat diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index e547825e..baa6288f 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_mat2x2 -#define glm_core_type_mat2x2 +#pragma once #include "../fwd.hpp" #include "type_vec2.hpp" @@ -259,5 +258,3 @@ namespace detail #ifndef GLM_EXTERNAL_TEMPLATE #include "type_mat2x2.inl" #endif - -#endif //glm_core_type_mat2x2 diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index e9e91883..6be15b34 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_mat2x3 -#define glm_core_type_mat2x3 +#pragma once #include "../fwd.hpp" #include "type_vec2.hpp" @@ -223,5 +222,3 @@ namespace detail #ifndef GLM_EXTERNAL_TEMPLATE #include "type_mat2x3.inl" #endif - -#endif //glm_core_type_mat2x3 diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 45e0a150..3c900278 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_mat2x4 -#define glm_core_type_mat2x4 +#pragma once #include "../fwd.hpp" #include "type_vec2.hpp" @@ -225,5 +224,3 @@ namespace detail #ifndef GLM_EXTERNAL_TEMPLATE #include "type_mat2x4.inl" #endif - -#endif //glm_core_type_mat2x4 diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index 45b98b20..f2c23f35 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_mat3x2 -#define glm_core_type_mat3x2 +#pragma once #include "../fwd.hpp" #include "type_vec2.hpp" @@ -229,5 +228,3 @@ namespace detail #ifndef GLM_EXTERNAL_TEMPLATE #include "type_mat3x2.inl" #endif - -#endif //glm_core_type_mat3x2 diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index fa4bb7a2..82c595e7 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_mat3x3 -#define glm_core_type_mat3x3 +#pragma once #include "../fwd.hpp" #include "type_vec3.hpp" @@ -263,5 +262,3 @@ namespace detail #ifndef GLM_EXTERNAL_TEMPLATE #include "type_mat3x3.inl" #endif - -#endif //glm_core_type_mat3x3 diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index 7da8a19d..af704eb9 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_mat3x4 -#define glm_core_type_mat3x4 +#pragma once #include "../fwd.hpp" #include "type_vec3.hpp" @@ -229,5 +228,3 @@ namespace detail #ifndef GLM_EXTERNAL_TEMPLATE #include "type_mat3x4.inl" #endif - -#endif //glm_core_type_mat3x4 diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index eb826950..2adc36fd 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_mat4x2 -#define glm_core_type_mat4x2 +#pragma once #include "../fwd.hpp" #include "type_vec2.hpp" @@ -236,5 +235,3 @@ namespace detail #ifndef GLM_EXTERNAL_TEMPLATE #include "type_mat4x2.inl" #endif - -#endif //glm_core_type_mat4x2 diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index 636572b3..03103d77 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_mat4x3 -#define glm_core_type_mat4x3 +#pragma once #include "../fwd.hpp" #include "type_vec3.hpp" @@ -236,5 +235,3 @@ namespace detail #ifndef GLM_EXTERNAL_TEMPLATE #include "type_mat4x3.inl" #endif //GLM_EXTERNAL_TEMPLATE - -#endif//glm_core_type_mat4x3 diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index d5f652bf..d5b24ba2 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_mat4x4 -#define glm_core_type_mat4x4 +#pragma once #include "../fwd.hpp" #include "type_vec4.hpp" @@ -264,5 +263,3 @@ namespace detail #ifndef GLM_EXTERNAL_TEMPLATE #include "type_mat4x4.inl" #endif//GLM_EXTERNAL_TEMPLATE - -#endif//glm_core_type_mat4x4 diff --git a/glm/detail/type_vec.hpp b/glm/detail/type_vec.hpp index 5a87170a..b12b8718 100644 --- a/glm/detail/type_vec.hpp +++ b/glm/detail/type_vec.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_vec -#define glm_core_type_vec +#pragma once #include "precision.hpp" #include "type_int.hpp" @@ -512,5 +511,3 @@ namespace detail /// @} }//namespace glm - -#endif//glm_core_type_vec diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index 5f319469..4d0d23c8 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_gentype1 -#define glm_core_type_gentype1 +#pragma once #include "../fwd.hpp" #include "type_vec.hpp" @@ -273,5 +272,3 @@ namespace detail #ifndef GLM_EXTERNAL_TEMPLATE #include "type_vec1.inl" #endif//GLM_EXTERNAL_TEMPLATE - -#endif//glm_core_type_gentype1 diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 42599342..95365538 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_gentype2 -#define glm_core_type_gentype2 +#pragma once //#include "../fwd.hpp" #include "type_vec.hpp" @@ -311,5 +310,3 @@ namespace detail #ifndef GLM_EXTERNAL_TEMPLATE #include "type_vec2.inl" #endif//GLM_EXTERNAL_TEMPLATE - -#endif//glm_core_type_gentype2 diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index c4872139..465e1f4c 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_gentype3 -#define glm_core_type_gentype3 +#pragma once //#include "../fwd.hpp" #include "type_vec.hpp" @@ -329,5 +328,3 @@ namespace detail #ifndef GLM_EXTERNAL_TEMPLATE #include "type_vec3.inl" #endif//GLM_EXTERNAL_TEMPLATE - -#endif//glm_core_type_gentype3 diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index a82a4aa6..dcc012eb 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_type_gentype4 -#define glm_core_type_gentype4 +#pragma once //#include "../fwd.hpp" #include "setup.hpp" @@ -418,5 +417,3 @@ namespace detail #ifndef GLM_EXTERNAL_TEMPLATE #include "type_vec4.inl" #endif//GLM_EXTERNAL_TEMPLATE - -#endif//glm_core_type_gentype4 diff --git a/glm/exponential.hpp b/glm/exponential.hpp index 4d2c9b8f..d11f58ff 100644 --- a/glm/exponential.hpp +++ b/glm/exponential.hpp @@ -26,9 +26,6 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_EXPONENTIAL_INCLUDED -#define GLM_EXPONENTIAL_INCLUDED +#pragma once #include "detail/func_exponential.hpp" - -#endif//GLM_EXPONENTIAL_INCLUDED diff --git a/glm/ext.hpp b/glm/ext.hpp index ce13a663..206cd1d7 100644 --- a/glm/ext.hpp +++ b/glm/ext.hpp @@ -55,8 +55,7 @@ /// (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showprofile&User=22660). /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_EXT_INCLUDED -#define GLM_EXT_INCLUDED +#pragma once #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_EXT_INCLUDED_DISPLAYED)) # define GLM_MESSAGE_EXT_INCLUDED_DISPLAYED @@ -133,5 +132,3 @@ # include "./gtx/simd_vec4.hpp" # include "./gtx/simd_mat4.hpp" #endif - -#endif //GLM_EXT_INCLUDED diff --git a/glm/fwd.hpp b/glm/fwd.hpp index 9fba848c..3471fb3b 100644 --- a/glm/fwd.hpp +++ b/glm/fwd.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_FWD_INCLUDED -#define GLM_FWD_INCLUDED +#pragma once #include "detail/type_int.hpp" #include "detail/type_float.hpp" @@ -2594,5 +2593,3 @@ namespace glm typedef highp_f64quat f64quat; #endif }//namespace glm - -#endif//GLM_FWD_INCLUDED diff --git a/glm/geometric.hpp b/glm/geometric.hpp index df025ea8..98a411a6 100644 --- a/glm/geometric.hpp +++ b/glm/geometric.hpp @@ -26,9 +26,6 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GEOMETRIC_INCLUDED -#define GLM_GEOMETRIC_INCLUDED +#pragma once #include "detail/func_geometric.hpp" - -#endif//GLM_GEOMETRIC_INCLUDED diff --git a/glm/glm.hpp b/glm/glm.hpp index b5103807..5526a1fd 100644 --- a/glm/glm.hpp +++ b/glm/glm.hpp @@ -77,8 +77,7 @@ #include "detail/_fixes.hpp" -#ifndef GLM_INCLUDED -#define GLM_INCLUDED +#pragma once #include #include @@ -113,5 +112,3 @@ #include "matrix.hpp" #include "vector_relational.hpp" #include "integer.hpp" - -#endif//GLM_INCLUDED diff --git a/glm/gtc/constants.hpp b/glm/gtc/constants.hpp index c0160861..76fc1eb4 100644 --- a/glm/gtc/constants.hpp +++ b/glm/gtc/constants.hpp @@ -36,8 +36,7 @@ /// need to be included to use these features. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTC_constants -#define GLM_GTC_constants +#pragma once // Dependencies #include "../detail/setup.hpp" @@ -181,5 +180,3 @@ namespace glm } //namespace glm #include "constants.inl" - -#endif//GLM_GTC_constants diff --git a/glm/gtc/epsilon.hpp b/glm/gtc/epsilon.hpp index 58a2cae5..4befdb5c 100644 --- a/glm/gtc/epsilon.hpp +++ b/glm/gtc/epsilon.hpp @@ -37,8 +37,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTC_epsilon -#define GLM_GTC_epsilon +#pragma once // Dependencies #include "../detail/setup.hpp" @@ -97,5 +96,3 @@ namespace glm }//namespace glm #include "epsilon.inl" - -#endif//GLM_GTC_epsilon diff --git a/glm/gtc/matrix_access.hpp b/glm/gtc/matrix_access.hpp index df614cc7..b78a018b 100644 --- a/glm/gtc/matrix_access.hpp +++ b/glm/gtc/matrix_access.hpp @@ -34,8 +34,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTC_matrix_access -#define GLM_GTC_matrix_access +#pragma once // Dependency: #include "../detail/setup.hpp" @@ -83,5 +82,3 @@ namespace glm }//namespace glm #include "matrix_access.inl" - -#endif//GLM_GTC_matrix_access diff --git a/glm/gtc/matrix_integer.hpp b/glm/gtc/matrix_integer.hpp index c96fad1b..76e31c0e 100644 --- a/glm/gtc/matrix_integer.hpp +++ b/glm/gtc/matrix_integer.hpp @@ -34,8 +34,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTC_matrix_integer -#define GLM_GTC_matrix_integer +#pragma once // Dependency: #include "../mat2x2.hpp" @@ -510,5 +509,3 @@ namespace glm /// @} }//namespace glm - -#endif//GLM_GTC_matrix_integer diff --git a/glm/gtc/matrix_inverse.hpp b/glm/gtc/matrix_inverse.hpp index 53e4918f..803825f0 100644 --- a/glm/gtc/matrix_inverse.hpp +++ b/glm/gtc/matrix_inverse.hpp @@ -34,8 +34,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTC_matrix_inverse -#define GLM_GTC_matrix_inverse +#pragma once // Dependencies #include "../detail/setup.hpp" @@ -70,5 +69,3 @@ namespace glm }//namespace glm #include "matrix_inverse.inl" - -#endif//GLM_GTC_matrix_inverse diff --git a/glm/gtc/matrix_transform.hpp b/glm/gtc/matrix_transform.hpp index 8cd0b651..b08ad9c1 100644 --- a/glm/gtc/matrix_transform.hpp +++ b/glm/gtc/matrix_transform.hpp @@ -43,8 +43,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTC_matrix_transform -#define GLM_GTC_matrix_transform +#pragma once // Dependency: #include "../mat4x4.hpp" @@ -302,5 +301,3 @@ namespace glm }//namespace glm #include "matrix_transform.inl" - -#endif//GLM_GTC_matrix_transform diff --git a/glm/gtc/noise.hpp b/glm/gtc/noise.hpp index bde9987b..6450129e 100644 --- a/glm/gtc/noise.hpp +++ b/glm/gtc/noise.hpp @@ -38,8 +38,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTC_noise -#define GLM_GTC_noise +#pragma once // Dependencies #include "../detail/setup.hpp" @@ -77,5 +76,3 @@ namespace glm }//namespace glm #include "noise.inl" - -#endif//GLM_GTC_noise diff --git a/glm/gtc/packing.hpp b/glm/gtc/packing.hpp index 73abedd5..1233e349 100644 --- a/glm/gtc/packing.hpp +++ b/glm/gtc/packing.hpp @@ -36,8 +36,7 @@ /// need to be included to use these features. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTC_packing -#define GLM_GTC_packing +#pragma once // Dependency: #include "type_precision.hpp" @@ -473,6 +472,3 @@ namespace glm }// namespace glm #include "packing.inl" - -#endif//GLM_GTC_packing - diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index a8b0c904..6cbb3326 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -37,8 +37,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTC_quaternion -#define GLM_GTC_quaternion +#pragma once // Dependency: #include "../mat3x3.hpp" @@ -400,5 +399,3 @@ namespace detail } //namespace glm #include "quaternion.inl" - -#endif//GLM_GTC_quaternion diff --git a/glm/gtc/random.hpp b/glm/gtc/random.hpp index 252bf1c7..395bf6a4 100644 --- a/glm/gtc/random.hpp +++ b/glm/gtc/random.hpp @@ -37,8 +37,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTC_random -#define GLM_GTC_random +#pragma once // Dependency: #include "../vec2.hpp" @@ -110,5 +109,3 @@ namespace glm }//namespace glm #include "random.inl" - -#endif//GLM_GTC_random diff --git a/glm/gtc/reciprocal.hpp b/glm/gtc/reciprocal.hpp index 428788ec..eb976575 100644 --- a/glm/gtc/reciprocal.hpp +++ b/glm/gtc/reciprocal.hpp @@ -35,8 +35,7 @@ /// need to be included to use these features. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTC_reciprocal -#define GLM_GTC_reciprocal +#pragma once // Dependencies #include "../detail/setup.hpp" @@ -129,5 +128,3 @@ namespace glm }//namespace glm #include "reciprocal.inl" - -#endif//GLM_GTC_reciprocal diff --git a/glm/gtc/type_precision.hpp b/glm/gtc/type_precision.hpp index 63370856..5e035052 100644 --- a/glm/gtc/type_precision.hpp +++ b/glm/gtc/type_precision.hpp @@ -40,8 +40,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTC_type_precision -#define GLM_GTC_type_precision +#pragma once // Dependency: #include "../gtc/quaternion.hpp" @@ -870,5 +869,3 @@ namespace glm }//namespace glm #include "type_precision.inl" - -#endif//GLM_GTC_type_precision diff --git a/glm/gtc/type_ptr.hpp b/glm/gtc/type_ptr.hpp index d33de141..314cca44 100644 --- a/glm/gtc/type_ptr.hpp +++ b/glm/gtc/type_ptr.hpp @@ -56,8 +56,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTC_type_ptr -#define GLM_GTC_type_ptr +#pragma once // Dependency: #include "../gtc/quaternion.hpp" @@ -174,6 +173,3 @@ namespace glm }//namespace glm #include "type_ptr.inl" - -#endif//GLM_GTC_type_ptr - diff --git a/glm/gtc/ulp.hpp b/glm/gtc/ulp.hpp index ee67ac61..ee7a1f0a 100644 --- a/glm/gtc/ulp.hpp +++ b/glm/gtc/ulp.hpp @@ -36,8 +36,7 @@ /// need to be included to use these features. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTC_ulp -#define GLM_GTC_ulp +#pragma once // Dependencies #include "../detail/setup.hpp" @@ -87,6 +86,3 @@ namespace glm }// namespace glm #include "ulp.inl" - -#endif//GLM_GTC_ulp - diff --git a/glm/gtx/associated_min_max.hpp b/glm/gtx/associated_min_max.hpp index 247c7f3b..23f37ca9 100644 --- a/glm/gtx/associated_min_max.hpp +++ b/glm/gtx/associated_min_max.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_associated_min_max -#define GLM_GTX_associated_min_max +#pragma once // Dependency: #include "../glm.hpp" @@ -102,5 +101,3 @@ namespace glm } //namespace glm #include "associated_min_max.inl" - -#endif//GLM_GTX_associated_min_max diff --git a/glm/gtx/bit.hpp b/glm/gtx/bit.hpp index 28a8e6c8..f358bcc4 100644 --- a/glm/gtx/bit.hpp +++ b/glm/gtx/bit.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_bit -#define GLM_GTX_bit +#pragma once // Dependencies #include "../detail/type_int.hpp" @@ -230,5 +229,3 @@ namespace glm } //namespace glm #include "bit.inl" - -#endif//GLM_GTX_bit diff --git a/glm/gtx/closest_point.hpp b/glm/gtx/closest_point.hpp index c2568060..d0f17155 100644 --- a/glm/gtx/closest_point.hpp +++ b/glm/gtx/closest_point.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_closest_point -#define GLM_GTX_closest_point +#pragma once // Dependency: #include "../glm.hpp" @@ -62,5 +61,3 @@ namespace glm }// namespace glm #include "closest_point.inl" - -#endif//GLM_GTX_closest_point diff --git a/glm/gtx/color_space.hpp b/glm/gtx/color_space.hpp index 44e2dd13..d714b627 100644 --- a/glm/gtx/color_space.hpp +++ b/glm/gtx/color_space.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_color_space -#define GLM_GTX_color_space +#pragma once // Dependency: #include "../glm.hpp" @@ -92,5 +91,3 @@ namespace glm }//namespace glm #include "color_space.inl" - -#endif//GLM_GTX_color_space diff --git a/glm/gtx/color_space_YCoCg.hpp b/glm/gtx/color_space_YCoCg.hpp index 1f6578cf..ea2abbf3 100644 --- a/glm/gtx/color_space_YCoCg.hpp +++ b/glm/gtx/color_space_YCoCg.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_gtx_color_space_YCoCg -#define glm_gtx_color_space_YCoCg +#pragma once // Dependency: #include "../glm.hpp" @@ -80,5 +79,3 @@ namespace glm }//namespace glm #include "color_space_YCoCg.inl" - -#endif//glm_gtx_color_space_YCoCg diff --git a/glm/gtx/compatibility.hpp b/glm/gtx/compatibility.hpp index c262e3fc..3435405d 100644 --- a/glm/gtx/compatibility.hpp +++ b/glm/gtx/compatibility.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_compatibility -#define GLM_GTX_compatibility +#pragma once // Dependency: #include "../glm.hpp" @@ -155,6 +154,3 @@ namespace glm }//namespace glm #include "compatibility.inl" - -#endif//GLM_GTX_compatibility - diff --git a/glm/gtx/component_wise.hpp b/glm/gtx/component_wise.hpp index 335b3b97..0e4c0e2b 100644 --- a/glm/gtx/component_wise.hpp +++ b/glm/gtx/component_wise.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_component_wise -#define GLM_GTX_component_wise +#pragma once // Dependencies #include "../detail/setup.hpp" @@ -78,5 +77,3 @@ namespace glm }//namespace glm #include "component_wise.inl" - -#endif//GLM_GTX_component_wise diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 101c28ae..459b00a1 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -38,8 +38,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_dual_quaternion -#define GLM_GTX_dual_quaternion +#pragma once // Dependency: #include "../glm.hpp" @@ -291,5 +290,3 @@ namespace detail } //namespace glm #include "dual_quaternion.inl" - -#endif//GLM_GTX_dual_quaternion diff --git a/glm/gtx/euler_angles.hpp b/glm/gtx/euler_angles.hpp index d3d6be05..d213a839 100644 --- a/glm/gtx/euler_angles.hpp +++ b/glm/gtx/euler_angles.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_euler_angles -#define GLM_GTX_euler_angles +#pragma once // Dependency: #include "../glm.hpp" @@ -151,5 +150,3 @@ namespace glm }//namespace glm #include "euler_angles.inl" - -#endif//GLM_GTX_euler_angles diff --git a/glm/gtx/extend.hpp b/glm/gtx/extend.hpp index 499a5ee1..dea53d99 100644 --- a/glm/gtx/extend.hpp +++ b/glm/gtx/extend.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_extend -#define GLM_GTX_extend +#pragma once // Dependency: #include "../glm.hpp" @@ -62,5 +61,3 @@ namespace glm }//namespace glm #include "extend.inl" - -#endif//GLM_GTX_extend diff --git a/glm/gtx/extented_min_max.hpp b/glm/gtx/extented_min_max.hpp index 5b4e74e6..ab5eb33b 100644 --- a/glm/gtx/extented_min_max.hpp +++ b/glm/gtx/extented_min_max.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_extented_min_max -#define GLM_GTX_extented_min_max +#pragma once // Dependency: #include "../glm.hpp" @@ -157,5 +156,3 @@ namespace glm }//namespace glm #include "extented_min_max.inl" - -#endif//GLM_GTX_extented_min_max diff --git a/glm/gtx/fast_exponential.hpp b/glm/gtx/fast_exponential.hpp index 8b3762cb..cc151457 100644 --- a/glm/gtx/fast_exponential.hpp +++ b/glm/gtx/fast_exponential.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_fast_exponential -#define GLM_GTX_fast_exponential +#pragma once // Dependency: #include "../glm.hpp" @@ -94,5 +93,3 @@ namespace glm }//namespace glm #include "fast_exponential.inl" - -#endif//GLM_GTX_fast_exponential diff --git a/glm/gtx/fast_square_root.hpp b/glm/gtx/fast_square_root.hpp index 0a5d030f..f62bc278 100644 --- a/glm/gtx/fast_square_root.hpp +++ b/glm/gtx/fast_square_root.hpp @@ -37,8 +37,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_fast_square_root -#define GLM_GTX_fast_square_root +#pragma once // Dependency: #include "../glm.hpp" @@ -86,5 +85,3 @@ namespace glm }// namespace glm #include "fast_square_root.inl" - -#endif//GLM_GTX_fast_square_root diff --git a/glm/gtx/fast_trigonometry.hpp b/glm/gtx/fast_trigonometry.hpp index a95e7809..f89a6df6 100644 --- a/glm/gtx/fast_trigonometry.hpp +++ b/glm/gtx/fast_trigonometry.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_fast_trigonometry -#define GLM_GTX_fast_trigonometry +#pragma once // Dependency: #include "../glm.hpp" @@ -96,5 +95,3 @@ namespace glm }//namespace glm #include "fast_trigonometry.inl" - -#endif//GLM_GTX_fast_trigonometry diff --git a/glm/gtx/gradient_paint.hpp b/glm/gtx/gradient_paint.hpp index 2a47e51c..a057ea80 100644 --- a/glm/gtx/gradient_paint.hpp +++ b/glm/gtx/gradient_paint.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_gradient_paint -#define GLM_GTX_gradient_paint +#pragma once // Dependency: #include "../glm.hpp" @@ -72,5 +71,3 @@ namespace glm }// namespace glm #include "gradient_paint.inl" - -#endif//GLM_GTX_gradient_paint diff --git a/glm/gtx/handed_coordinate_space.hpp b/glm/gtx/handed_coordinate_space.hpp index fb046327..72837d60 100644 --- a/glm/gtx/handed_coordinate_space.hpp +++ b/glm/gtx/handed_coordinate_space.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_handed_coordinate_space -#define GLM_GTX_handed_coordinate_space +#pragma once // Dependency: #include "../glm.hpp" @@ -70,5 +69,3 @@ namespace glm }// namespace glm #include "handed_coordinate_space.inl" - -#endif//GLM_GTX_handed_coordinate_space diff --git a/glm/gtx/inertia.hpp b/glm/gtx/inertia.hpp index c796bfa6..0e9f5f0d 100644 --- a/glm/gtx/inertia.hpp +++ b/glm/gtx/inertia.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_inertia -#define GLM_GTX_inertia +#pragma once // Dependency: #include "../glm.hpp" @@ -112,5 +111,3 @@ namespace glm }// namespace glm #include "inertia.inl" - -#endif//GLM_GTX_inertia diff --git a/glm/gtx/integer.hpp b/glm/gtx/integer.hpp index 21c3912f..00f1fd4a 100644 --- a/glm/gtx/integer.hpp +++ b/glm/gtx/integer.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_integer -#define GLM_GTX_integer +#pragma once // Dependency: #include "../glm.hpp" @@ -100,5 +99,3 @@ namespace glm }//namespace glm #include "integer.inl" - -#endif//GLM_GTX_integer diff --git a/glm/gtx/intersect.hpp b/glm/gtx/intersect.hpp index 0a27b02c..d7d64920 100644 --- a/glm/gtx/intersect.hpp +++ b/glm/gtx/intersect.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_intersect -#define GLM_GTX_intersect +#pragma once // Dependency: #include "../glm.hpp" @@ -107,5 +106,3 @@ namespace glm }//namespace glm #include "intersect.inl" - -#endif//GLM_GTX_intersect diff --git a/glm/gtx/io.hpp b/glm/gtx/io.hpp index 7dd22182..0ddeb490 100644 --- a/glm/gtx/io.hpp +++ b/glm/gtx/io.hpp @@ -40,8 +40,7 @@ /// needs to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_io -#define GLM_GTX_io GLM_VERSION +#pragma once // Dependency: #include "../glm.hpp" @@ -222,5 +221,3 @@ namespace glm }//namespace glm #include "io.inl" - -#endif//GLM_GTX_io diff --git a/glm/gtx/log_base.hpp b/glm/gtx/log_base.hpp index 2e2f95a7..7662ed04 100644 --- a/glm/gtx/log_base.hpp +++ b/glm/gtx/log_base.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_log_base -#define GLM_GTX_log_base +#pragma once // Dependency: #include "../glm.hpp" @@ -61,5 +60,3 @@ namespace glm }//namespace glm #include "log_base.inl" - -#endif//GLM_GTX_log_base diff --git a/glm/gtx/matrix_cross_product.hpp b/glm/gtx/matrix_cross_product.hpp index e4cc31ae..8dca0dda 100644 --- a/glm/gtx/matrix_cross_product.hpp +++ b/glm/gtx/matrix_cross_product.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_matrix_cross_product -#define GLM_GTX_matrix_cross_product +#pragma once // Dependency: #include "../glm.hpp" @@ -67,5 +66,3 @@ namespace glm }//namespace glm #include "matrix_cross_product.inl" - -#endif//GLM_GTX_matrix_cross_product diff --git a/glm/gtx/matrix_interpolation.hpp b/glm/gtx/matrix_interpolation.hpp index 60dec748..8b21814b 100644 --- a/glm/gtx/matrix_interpolation.hpp +++ b/glm/gtx/matrix_interpolation.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_matrix_interpolation -#define GLM_GTX_matrix_interpolation +#pragma once // Dependency: #include "../glm.hpp" @@ -84,5 +83,3 @@ namespace glm }//namespace glm #include "matrix_interpolation.inl" - -#endif//GLM_GTX_matrix_interpolation diff --git a/glm/gtx/matrix_major_storage.hpp b/glm/gtx/matrix_major_storage.hpp index 330fde9c..a7ea3537 100644 --- a/glm/gtx/matrix_major_storage.hpp +++ b/glm/gtx/matrix_major_storage.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_matrix_major_storage -#define GLM_GTX_matrix_major_storage +#pragma once // Dependency: #include "../glm.hpp" @@ -139,5 +138,3 @@ namespace glm }//namespace glm #include "matrix_major_storage.inl" - -#endif//GLM_GTX_matrix_major_storage diff --git a/glm/gtx/matrix_operation.hpp b/glm/gtx/matrix_operation.hpp index 8e0729ac..a0850c81 100644 --- a/glm/gtx/matrix_operation.hpp +++ b/glm/gtx/matrix_operation.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_matrix_operation -#define GLM_GTX_matrix_operation +#pragma once // Dependency: #include "../glm.hpp" @@ -108,5 +107,3 @@ namespace glm }//namespace glm #include "matrix_operation.inl" - -#endif//GLM_GTX_matrix_operation diff --git a/glm/gtx/matrix_query.hpp b/glm/gtx/matrix_query.hpp index 257f33f1..7b2f648f 100644 --- a/glm/gtx/matrix_query.hpp +++ b/glm/gtx/matrix_query.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_matrix_query -#define GLM_GTX_matrix_query +#pragma once // Dependency: #include "../glm.hpp" @@ -97,5 +96,3 @@ namespace glm }//namespace glm #include "matrix_query.inl" - -#endif//GLM_GTX_matrix_query diff --git a/glm/gtx/matrix_transform_2d.hpp b/glm/gtx/matrix_transform_2d.hpp index 302d2655..2a71c94f 100644 --- a/glm/gtx/matrix_transform_2d.hpp +++ b/glm/gtx/matrix_transform_2d.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_matrix_transform_2d -#define GLM_GTX_matrix_transform_2d +#pragma once // Dependency: #include "../mat3x3.hpp" @@ -101,5 +100,3 @@ namespace glm }//namespace glm #include "matrix_transform_2d.inl" - -#endif//GLM_GTX_matrix_transform_2d diff --git a/glm/gtx/mixed_product.hpp b/glm/gtx/mixed_product.hpp index fc37b489..2e858cde 100644 --- a/glm/gtx/mixed_product.hpp +++ b/glm/gtx/mixed_product.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_mixed_product -#define GLM_GTX_mixed_product +#pragma once // Dependency: #include "../glm.hpp" @@ -61,5 +60,3 @@ namespace glm }// namespace glm #include "mixed_product.inl" - -#endif//GLM_GTX_mixed_product diff --git a/glm/gtx/multiple.hpp b/glm/gtx/multiple.hpp index df03a6f0..a1e485b5 100644 --- a/glm/gtx/multiple.hpp +++ b/glm/gtx/multiple.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_multiple -#define GLM_GTX_multiple +#pragma once // Dependency: #include "../glm.hpp" @@ -79,5 +78,3 @@ namespace glm }//namespace glm #include "multiple.inl" - -#endif//GLM_GTX_multiple diff --git a/glm/gtx/norm.hpp b/glm/gtx/norm.hpp index 2bdc0c8d..c7c4d830 100644 --- a/glm/gtx/norm.hpp +++ b/glm/gtx/norm.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_norm -#define GLM_GTX_norm +#pragma once // Dependency: #include "../glm.hpp" @@ -123,5 +122,3 @@ namespace glm }//namespace glm #include "norm.inl" - -#endif//GLM_GTX_norm diff --git a/glm/gtx/normal.hpp b/glm/gtx/normal.hpp index 00966669..c948b8a2 100644 --- a/glm/gtx/normal.hpp +++ b/glm/gtx/normal.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_normal -#define GLM_GTX_normal +#pragma once // Dependency: #include "../glm.hpp" @@ -63,5 +62,3 @@ namespace glm }//namespace glm #include "normal.inl" - -#endif//GLM_GTX_normal diff --git a/glm/gtx/normalize_dot.hpp b/glm/gtx/normalize_dot.hpp index 1d12f6be..2fcb4a54 100644 --- a/glm/gtx/normalize_dot.hpp +++ b/glm/gtx/normalize_dot.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_normalize_dot -#define GLM_GTX_normalize_dot +#pragma once // Dependency: #include "../glm.hpp" @@ -72,5 +71,3 @@ namespace glm }//namespace glm #include "normalize_dot.inl" - -#endif//GLM_GTX_normalize_dot diff --git a/glm/gtx/number_precision.hpp b/glm/gtx/number_precision.hpp index bc3b6a7c..62f95a9d 100644 --- a/glm/gtx/number_precision.hpp +++ b/glm/gtx/number_precision.hpp @@ -37,8 +37,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_number_precision -#define GLM_GTX_number_precision +#pragma once // Dependency: #include "../glm.hpp" @@ -81,5 +80,3 @@ namespace gtx }//namespace glm #include "number_precision.inl" - -#endif//GLM_GTX_number_precision diff --git a/glm/gtx/optimum_pow.hpp b/glm/gtx/optimum_pow.hpp index e825d68c..96e72d78 100644 --- a/glm/gtx/optimum_pow.hpp +++ b/glm/gtx/optimum_pow.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_optimum_pow -#define GLM_GTX_optimum_pow +#pragma once // Dependency: #include "../glm.hpp" @@ -90,5 +89,3 @@ namespace gtx }//namespace glm #include "optimum_pow.inl" - -#endif//GLM_GTX_optimum_pow diff --git a/glm/gtx/orthonormalize.hpp b/glm/gtx/orthonormalize.hpp index d9a6446f..9db33cf6 100644 --- a/glm/gtx/orthonormalize.hpp +++ b/glm/gtx/orthonormalize.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_orthonormalize -#define GLM_GTX_orthonormalize +#pragma once // Dependency: #include "../glm.hpp" @@ -68,5 +67,3 @@ namespace glm }//namespace glm #include "orthonormalize.inl" - -#endif//GLM_GTX_orthonormalize diff --git a/glm/gtx/perpendicular.hpp b/glm/gtx/perpendicular.hpp index ff621449..d5989517 100644 --- a/glm/gtx/perpendicular.hpp +++ b/glm/gtx/perpendicular.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_perpendicular -#define GLM_GTX_perpendicular +#pragma once // Dependency: #include "../glm.hpp" @@ -63,5 +62,3 @@ namespace glm }//namespace glm #include "perpendicular.inl" - -#endif//GLM_GTX_perpendicular diff --git a/glm/gtx/polar_coordinates.hpp b/glm/gtx/polar_coordinates.hpp index c6e43143..87859c18 100644 --- a/glm/gtx/polar_coordinates.hpp +++ b/glm/gtx/polar_coordinates.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_polar_coordinates -#define GLM_GTX_polar_coordinates +#pragma once // Dependency: #include "../glm.hpp" @@ -68,5 +67,3 @@ namespace glm }//namespace glm #include "polar_coordinates.inl" - -#endif//GLM_GTX_polar_coordinates diff --git a/glm/gtx/projection.hpp b/glm/gtx/projection.hpp index 306be6cb..072a9d64 100644 --- a/glm/gtx/projection.hpp +++ b/glm/gtx/projection.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_projection -#define GLM_GTX_projection +#pragma once // Dependency: #include "../glm.hpp" @@ -61,5 +60,3 @@ namespace glm }//namespace glm #include "projection.inl" - -#endif//GLM_GTX_projection diff --git a/glm/gtx/quaternion.hpp b/glm/gtx/quaternion.hpp index 7b056234..ae01043a 100644 --- a/glm/gtx/quaternion.hpp +++ b/glm/gtx/quaternion.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_quaternion -#define GLM_GTX_quaternion +#pragma once // Dependency: #include "../glm.hpp" @@ -209,5 +208,3 @@ namespace glm }//namespace glm #include "quaternion.inl" - -#endif//GLM_GTX_quaternion diff --git a/glm/gtx/raw_data.hpp b/glm/gtx/raw_data.hpp index 71641d14..d36a11fd 100644 --- a/glm/gtx/raw_data.hpp +++ b/glm/gtx/raw_data.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_raw_data -#define GLM_GTX_raw_data +#pragma once // Dependencies #include "../detail/setup.hpp" @@ -71,5 +70,3 @@ namespace glm }// namespace glm #include "raw_data.inl" - -#endif//GLM_GTX_raw_data diff --git a/glm/gtx/rotate_normalized_axis.hpp b/glm/gtx/rotate_normalized_axis.hpp index c5113231..bb7890ae 100644 --- a/glm/gtx/rotate_normalized_axis.hpp +++ b/glm/gtx/rotate_normalized_axis.hpp @@ -37,8 +37,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_rotate_normalized_axis -#define GLM_GTX_rotate_normalized_axis +#pragma once // Dependency: #include "../glm.hpp" @@ -88,5 +87,3 @@ namespace glm }//namespace glm #include "rotate_normalized_axis.inl" - -#endif//GLM_GTX_rotate_normalized_axis diff --git a/glm/gtx/rotate_vector.hpp b/glm/gtx/rotate_vector.hpp index d5644056..06eaee01 100644 --- a/glm/gtx/rotate_vector.hpp +++ b/glm/gtx/rotate_vector.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_rotate_vector -#define GLM_GTX_rotate_vector +#pragma once // Dependency: #include "../glm.hpp" @@ -128,5 +127,3 @@ namespace glm }//namespace glm #include "rotate_vector.inl" - -#endif//GLM_GTX_rotate_vector diff --git a/glm/gtx/scalar_relational.hpp b/glm/gtx/scalar_relational.hpp index 487c5ca2..08c7470e 100644 --- a/glm/gtx/scalar_relational.hpp +++ b/glm/gtx/scalar_relational.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_scalar_relational -#define GLM_GTX_scalar_relational +#pragma once // Dependency: #include "../glm.hpp" @@ -56,5 +55,3 @@ namespace glm }//namespace glm #include "scalar_relational.inl" - -#endif//GLM_GTX_scalar_relational diff --git a/glm/gtx/simd_mat4.hpp b/glm/gtx/simd_mat4.hpp index 07794c9f..e4857c83 100644 --- a/glm/gtx/simd_mat4.hpp +++ b/glm/gtx/simd_mat4.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_simd_mat4 -#define GLM_GTX_simd_mat4 +#pragma once // Dependencies #include "../detail/setup.hpp" @@ -201,5 +200,3 @@ namespace detail #include "simd_mat4.inl" #endif//(GLM_ARCH != GLM_ARCH_PURE) - -#endif//GLM_GTX_simd_mat4 diff --git a/glm/gtx/simd_quat.hpp b/glm/gtx/simd_quat.hpp index 1658cca4..a023c988 100644 --- a/glm/gtx/simd_quat.hpp +++ b/glm/gtx/simd_quat.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_simd_quat -#define GLM_GTX_simd_quat +#pragma once // Dependency: #include "../glm.hpp" @@ -114,14 +113,14 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators - fquatSIMD& operator =(fquatSIMD const & q); - fquatSIMD& operator*=(float const & s); + fquatSIMD& operator =(fquatSIMD const & q); + fquatSIMD& operator*=(float const & s); fquatSIMD& operator/=(float const & s); }; - ////////////////////////////////////// - // Arithmetic operators + ////////////////////////////////////// + // Arithmetic operators detail::fquatSIMD operator- ( detail::fquatSIMD const & q); @@ -161,37 +160,37 @@ namespace detail /// @addtogroup gtx_simd_quat /// @{ - //! Convert a simdQuat to a quat. + //! Convert a simdQuat to a quat. //! (From GLM_GTX_simd_quat extension) quat quat_cast( detail::fquatSIMD const & x); - //! Convert a simdMat4 to a simdQuat. - //! (From GLM_GTX_simd_quat extension) - detail::fquatSIMD quatSIMD_cast( - detail::fmat4x4SIMD const & m); + //! Convert a simdMat4 to a simdQuat. + //! (From GLM_GTX_simd_quat extension) + detail::fquatSIMD quatSIMD_cast( + detail::fmat4x4SIMD const & m); - //! Converts a mat4 to a simdQuat. - //! (From GLM_GTX_simd_quat extension) - template - detail::fquatSIMD quatSIMD_cast( - detail::tmat4x4 const & m); + //! Converts a mat4 to a simdQuat. + //! (From GLM_GTX_simd_quat extension) + template + detail::fquatSIMD quatSIMD_cast( + detail::tmat4x4 const & m); - //! Converts a mat3 to a simdQuat. - //! (From GLM_GTX_simd_quat extension) - template - detail::fquatSIMD quatSIMD_cast( - detail::tmat3x3 const & m); + //! Converts a mat3 to a simdQuat. + //! (From GLM_GTX_simd_quat extension) + template + detail::fquatSIMD quatSIMD_cast( + detail::tmat3x3 const & m); - //! Convert a simdQuat to a simdMat4 - //! (From GLM_GTX_simd_quat extension) - detail::fmat4x4SIMD mat4SIMD_cast( - detail::fquatSIMD const & q); + //! Convert a simdQuat to a simdMat4 + //! (From GLM_GTX_simd_quat extension) + detail::fmat4x4SIMD mat4SIMD_cast( + detail::fquatSIMD const & q); - //! Converts a simdQuat to a standard mat4. - //! (From GLM_GTX_simd_quat extension) - mat4 mat4_cast( - detail::fquatSIMD const & q); + //! Converts a simdQuat to a standard mat4. + //! (From GLM_GTX_simd_quat extension) + mat4 mat4_cast( + detail::fquatSIMD const & q); /// Returns the length of the quaternion. @@ -206,14 +205,14 @@ namespace detail detail::fquatSIMD normalize( detail::fquatSIMD const & x); - /// Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ... + /// Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ... /// /// @see gtc_quaternion float dot( detail::fquatSIMD const & q1, detail::fquatSIMD const & q2); - /// Spherical linear interpolation of two quaternions. + /// Spherical linear interpolation of two quaternions. /// The interpolation is oriented and the rotation is performed at constant speed. /// For short path spherical linear interpolation, use the slerp function. /// @@ -228,7 +227,7 @@ namespace detail detail::fquatSIMD const & y, float const & a); - /// Linear interpolation of two quaternions. + /// Linear interpolation of two quaternions. /// The interpolation is oriented. /// /// @param x A quaternion @@ -255,14 +254,14 @@ namespace detail float const & a); - /// Faster spherical linear interpolation of two unit length quaternions. - /// - /// This is the same as mix(), except for two rules: - /// 1) The two quaternions must be unit length. - /// 2) The interpolation factor (a) must be in the range [0, 1]. - /// - /// This will use the equivalent to fastAcos() and fastSin(). - /// + /// Faster spherical linear interpolation of two unit length quaternions. + /// + /// This is the same as mix(), except for two rules: + /// 1) The two quaternions must be unit length. + /// 2) The interpolation factor (a) must be in the range [0, 1]. + /// + /// This will use the equivalent to fastAcos() and fastSin(). + /// /// @see gtc_quaternion /// @see - mix(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a) detail::fquatSIMD fastMix( @@ -270,14 +269,14 @@ namespace detail detail::fquatSIMD const & y, float const & a); - /// Identical to fastMix() except takes the shortest path. - /// - /// The same rules apply here as those in fastMix(). Both quaternions must be unit length and 'a' must be - /// in the range [0, 1]. - /// + /// Identical to fastMix() except takes the shortest path. + /// + /// The same rules apply here as those in fastMix(). Both quaternions must be unit length and 'a' must be + /// in the range [0, 1]. + /// /// @see - fastMix(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a) /// @see - slerp(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a) - detail::fquatSIMD fastSlerp( + detail::fquatSIMD fastSlerp( detail::fquatSIMD const & x, detail::fquatSIMD const & y, float const & a); @@ -295,7 +294,7 @@ namespace detail detail::fquatSIMD inverse( detail::fquatSIMD const & q); - /// Build a quaternion from an angle and a normalized axis. + /// Build a quaternion from an angle and a normalized axis. /// /// @param angle Angle expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise. /// @param axis Axis of the quaternion, must be normalized. @@ -305,7 +304,7 @@ namespace detail float const & angle, vec3 const & axis); - /// Build a quaternion from an angle and a normalized axis. + /// Build a quaternion from an angle and a normalized axis. /// /// @param angle Angle expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise. /// @param x x component of the x-axis, x, y, z must be a normalized axis @@ -320,9 +319,9 @@ namespace detail float const & z); - // TODO: Move this to somewhere more appropriate. Used with fastMix() and fastSlerp(). - /// Performs the equivalent of glm::fastSin() on each component of the given __m128. - __m128 fastSin(__m128 x); + // TODO: Move this to somewhere more appropriate. Used with fastMix() and fastSlerp(). + /// Performs the equivalent of glm::fastSin() on each component of the given __m128. + __m128 fastSin(__m128 x); /// @} @@ -337,5 +336,3 @@ namespace detail #endif//(GLM_ARCH != GLM_ARCH_PURE) - -#endif//GLM_GTX_simd_quat diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index 6259b629..cc117a4b 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_simd_vec4 -#define GLM_GTX_simd_vec4 +#pragma once // Dependency: #include "../glm.hpp" @@ -570,5 +569,3 @@ namespace detail #endif #endif//(GLM_ARCH != GLM_ARCH_PURE) - -#endif//GLM_GTX_simd_vec4 diff --git a/glm/gtx/spline.hpp b/glm/gtx/spline.hpp index d610bf7b..07d07b34 100644 --- a/glm/gtx/spline.hpp +++ b/glm/gtx/spline.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_spline -#define GLM_GTX_spline +#pragma once // Dependency: #include "../glm.hpp" @@ -85,6 +84,3 @@ namespace glm }//namespace glm #include "spline.inl" - -#endif//GLM_GTX_spline - diff --git a/glm/gtx/std_based_type.hpp b/glm/gtx/std_based_type.hpp index e13a17cb..f8597770 100644 --- a/glm/gtx/std_based_type.hpp +++ b/glm/gtx/std_based_type.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_std_based_type -#define GLM_GTX_std_based_type +#pragma once // Dependency: #include "../glm.hpp" @@ -79,5 +78,3 @@ namespace glm }//namespace glm #include "std_based_type.inl" - -#endif//GLM_GTX_std_based_type diff --git a/glm/gtx/string_cast.hpp b/glm/gtx/string_cast.hpp index bf73e7d3..9d2217bb 100644 --- a/glm/gtx/string_cast.hpp +++ b/glm/gtx/string_cast.hpp @@ -39,8 +39,7 @@ /// This extension is not supported with CUDA /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_string_cast -#define GLM_GTX_string_cast +#pragma once // Dependency: #include "../glm.hpp" @@ -70,5 +69,3 @@ namespace glm }//namespace glm #include "string_cast.inl" - -#endif//GLM_GTX_string_cast diff --git a/glm/gtx/transform.hpp b/glm/gtx/transform.hpp index bd932d03..03743c75 100644 --- a/glm/gtx/transform.hpp +++ b/glm/gtx/transform.hpp @@ -38,8 +38,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_transform -#define GLM_GTX_transform +#pragma once // Dependency: #include "../glm.hpp" @@ -80,5 +79,3 @@ namespace glm }// namespace glm #include "transform.inl" - -#endif//GLM_GTX_transform diff --git a/glm/gtx/transform2.hpp b/glm/gtx/transform2.hpp index 5c6adb24..4f8204ef 100644 --- a/glm/gtx/transform2.hpp +++ b/glm/gtx/transform2.hpp @@ -36,8 +36,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_transform2 -#define GLM_GTX_transform2 +#pragma once // Dependency: #include "../glm.hpp" @@ -131,5 +130,3 @@ namespace glm }// namespace glm #include "transform2.inl" - -#endif//GLM_GTX_transform2 diff --git a/glm/gtx/vec1.hpp b/glm/gtx/vec1.hpp index 035fc360..57e59e5e 100644 --- a/glm/gtx/vec1.hpp +++ b/glm/gtx/vec1.hpp @@ -34,8 +34,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_vec1 -#define GLM_GTX_vec1 +#pragma once // Dependency: #include "../glm.hpp" @@ -161,6 +160,3 @@ namespace glm }// namespace glm #include "vec1.inl" - -#endif//GLM_GTX_vec1 - diff --git a/glm/gtx/vector_angle.hpp b/glm/gtx/vector_angle.hpp index 0647bef2..ea663dfb 100644 --- a/glm/gtx/vector_angle.hpp +++ b/glm/gtx/vector_angle.hpp @@ -37,8 +37,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_vector_angle -#define GLM_GTX_vector_angle +#pragma once // Dependency: #include "../glm.hpp" @@ -84,5 +83,3 @@ namespace glm }// namespace glm #include "vector_angle.inl" - -#endif//GLM_GTX_vector_angle diff --git a/glm/gtx/vector_query.hpp b/glm/gtx/vector_query.hpp index e4ac2b5a..3d1dbfd0 100644 --- a/glm/gtx/vector_query.hpp +++ b/glm/gtx/vector_query.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_vector_query -#define GLM_GTX_vector_query +#pragma once // Dependency: #include "../glm.hpp" @@ -86,5 +85,3 @@ namespace glm }// namespace glm #include "vector_query.inl" - -#endif//GLM_GTX_vector_query diff --git a/glm/gtx/wrap.hpp b/glm/gtx/wrap.hpp index 8a157a51..2a11a9b7 100644 --- a/glm/gtx/wrap.hpp +++ b/glm/gtx/wrap.hpp @@ -35,8 +35,7 @@ /// need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_GTX_wrap -#define GLM_GTX_wrap +#pragma once // Dependency: #include "../glm.hpp" @@ -69,5 +68,3 @@ namespace glm }// namespace glm #include "wrap.inl" - -#endif//GLM_GTX_wrap diff --git a/glm/integer.hpp b/glm/integer.hpp index aa3f8e87..5f7c00a4 100644 --- a/glm/integer.hpp +++ b/glm/integer.hpp @@ -26,9 +26,6 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_INTEGER_INCLUDED -#define GLM_INTEGER_INCLUDED +#pragma once #include "detail/func_integer.hpp" - -#endif//GLM_INTEGER_INCLUDED diff --git a/glm/mat2x2.hpp b/glm/mat2x2.hpp index 57f7f808..b0870446 100644 --- a/glm/mat2x2.hpp +++ b/glm/mat2x2.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_MAT2X2_INCLUDED -#define GLM_MAT2X2_INCLUDED +#pragma once #include "detail/type_mat2x2.hpp" @@ -76,5 +75,3 @@ namespace glm typedef detail::tmat2x2 highp_mat2x2; }//namespace glm - -#endif//GLM_MAT2X2_INCLUDED diff --git a/glm/mat2x3.hpp b/glm/mat2x3.hpp index ea020b06..0f50d57b 100644 --- a/glm/mat2x3.hpp +++ b/glm/mat2x3.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_MAT2X3_INCLUDED -#define GLM_MAT2X3_INCLUDED +#pragma once #include "detail/type_mat2x3.hpp" @@ -56,4 +55,3 @@ namespace glm }//namespace glm -#endif//GLM_MAT2X3_INCLUDED diff --git a/glm/mat2x4.hpp b/glm/mat2x4.hpp index 24997012..8c8d136f 100644 --- a/glm/mat2x4.hpp +++ b/glm/mat2x4.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_MAT2X4_INCLUDED -#define GLM_MAT2X4_INCLUDED +#pragma once #include "detail/type_mat2x4.hpp" @@ -55,5 +54,3 @@ namespace glm typedef detail::tmat2x4 highp_mat2x4; }//namespace glm - -#endif//GLM_MAT2X4_INCLUDED diff --git a/glm/mat3x2.hpp b/glm/mat3x2.hpp index 47c1ca4e..836829c7 100644 --- a/glm/mat3x2.hpp +++ b/glm/mat3x2.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_MAT3X2_INCLUDED -#define GLM_MAT3X2_INCLUDED +#pragma once #include "detail/type_mat3x2.hpp" @@ -55,5 +54,3 @@ namespace glm typedef detail::tmat3x2 highp_mat3x2; }//namespace - -#endif//GLM_MAT3X2_INCLUDED diff --git a/glm/mat3x3.hpp b/glm/mat3x3.hpp index 5d7659c9..2ea61b7a 100644 --- a/glm/mat3x3.hpp +++ b/glm/mat3x3.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_MAT3X3_INCLUDED -#define GLM_MAT3X3_INCLUDED +#pragma once #include "detail/type_mat3x3.hpp" @@ -76,5 +75,3 @@ namespace glm typedef detail::tmat3x3 highp_mat3x3; }//namespace glm - -#endif//GLM_MAT3X3_INCLUDED diff --git a/glm/mat3x4.hpp b/glm/mat3x4.hpp index 03b5fee3..66afb7fa 100644 --- a/glm/mat3x4.hpp +++ b/glm/mat3x4.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_MAT3X4_INCLUDED -#define GLM_MAT3X4_INCLUDED +#pragma once #include "detail/type_mat3x4.hpp" @@ -55,5 +54,3 @@ namespace glm typedef detail::tmat3x4 highp_mat3x4; }//namespace glm - -#endif//GLM_MAT3X4_INCLUDED diff --git a/glm/mat4x2.hpp b/glm/mat4x2.hpp index 1e4671a0..1dc272e0 100644 --- a/glm/mat4x2.hpp +++ b/glm/mat4x2.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_MAT4X2_INCLUDED -#define GLM_MAT4X2_INCLUDED +#pragma once #include "detail/type_mat4x2.hpp" @@ -55,5 +54,3 @@ namespace glm typedef detail::tmat4x2 highp_mat4x2; }//namespace glm - -#endif//GLM_MAT4X2_INCLUDED diff --git a/glm/mat4x3.hpp b/glm/mat4x3.hpp index 14ecee92..1d28b517 100644 --- a/glm/mat4x3.hpp +++ b/glm/mat4x3.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_MAT4X3_INCLUDED -#define GLM_MAT4X3_INCLUDED +#pragma once #include "detail/type_mat4x3.hpp" @@ -55,5 +54,3 @@ namespace glm typedef detail::tmat4x3 highp_mat4x3; }//namespace glm - -#endif//GLM_MAT4X3_INCLUDED diff --git a/glm/mat4x4.hpp b/glm/mat4x4.hpp index 7e97af69..1d22846e 100644 --- a/glm/mat4x4.hpp +++ b/glm/mat4x4.hpp @@ -26,8 +26,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_MAT4X4_INCLUDED -#define GLM_MAT4X4_INCLUDED +#pragma once #include "detail/type_mat4x4.hpp" @@ -76,5 +75,3 @@ namespace glm typedef detail::tmat4x4 highp_mat4x4; }//namespace glm - -#endif//GLM_MAT4X4_INCLUDED diff --git a/glm/matrix.hpp b/glm/matrix.hpp index 6758d81e..3b4bbb3f 100644 --- a/glm/matrix.hpp +++ b/glm/matrix.hpp @@ -26,9 +26,6 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_MATRIX_INCLUDED -#define GLM_MATRIX_INCLUDED +#pragma once #include "detail/func_matrix.hpp" - -#endif//GLM_MATRIX_INCLUDED diff --git a/glm/packing.hpp b/glm/packing.hpp index e7aa7888..d62de952 100644 --- a/glm/packing.hpp +++ b/glm/packing.hpp @@ -26,9 +26,6 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_PACKING_INCLUDED -#define GLM_PACKING_INCLUDED +#pragma once #include "detail/func_packing.hpp" - -#endif//GLM_PACKING_INCLUDED diff --git a/glm/trigonometric.hpp b/glm/trigonometric.hpp index 37a79130..51edc935 100644 --- a/glm/trigonometric.hpp +++ b/glm/trigonometric.hpp @@ -26,9 +26,6 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_TRIGONOMETRIC_INCLUDED -#define GLM_TRIGONOMETRIC_INCLUDED +#pragma once #include "detail/func_trigonometric.hpp" - -#endif//GLM_TRIGONOMETRIC_INCLUDED diff --git a/glm/vec2.hpp b/glm/vec2.hpp index 6c8df7a5..6d7e17c2 100644 --- a/glm/vec2.hpp +++ b/glm/vec2.hpp @@ -26,9 +26,6 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_VEC2_INCLUDED -#define GLM_VEC2_INCLUDED +#pragma once #include "detail/type_vec2.hpp" - -#endif//GLM_VEC2_INCLUDED diff --git a/glm/vec3.hpp b/glm/vec3.hpp index 2d017e1b..9e3a8fc0 100644 --- a/glm/vec3.hpp +++ b/glm/vec3.hpp @@ -26,9 +26,6 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_VEC3_INCLUDED -#define GLM_VEC3_INCLUDED +#pragma once #include "detail/type_vec3.hpp" - -#endif//GLM_VEC3_INCLUDED diff --git a/glm/vec4.hpp b/glm/vec4.hpp index 6d7e4199..6b58a2ee 100644 --- a/glm/vec4.hpp +++ b/glm/vec4.hpp @@ -26,9 +26,6 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_VEC4_INCLUDED -#define GLM_VEC4_INCLUDED +#pragma once #include "detail/type_vec4.hpp" - -#endif//GLM_VEC4_INCLUDED diff --git a/glm/vector_relational.hpp b/glm/vector_relational.hpp index 86faf394..a0f3fd5f 100644 --- a/glm/vector_relational.hpp +++ b/glm/vector_relational.hpp @@ -26,9 +26,6 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_VECTOR_RELATIONAL_INCLUDED -#define GLM_VECTOR_RELATIONAL_INCLUDED +#pragma once #include "detail/func_vector_relational.hpp" - -#endif//GLM_VECTOR_RELATIONAL_INCLUDED diff --git a/readme.txt b/readme.txt index f570ffd8..5e1c371e 100644 --- a/readme.txt +++ b/readme.txt @@ -43,7 +43,9 @@ GLM 0.9.6.0: 2014-XX-XX - Removed degrees for function parameters - Removed GLM_FORCE_RADIANS, active by default - Added move contructors and assignment operators (#141) +- Use pragma once +================================================================================ GLM 0.9.5.5: 2014-XX-XX -------------------------------------------------------------------------------- - Fixed std::nextafter not supported with C++11 on Android #213 From 666475a84c9bb7a97ee7653026bd068af138c1c4 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 18 Jul 2014 00:59:07 +0200 Subject: [PATCH 46/47] Fixed VC14 compiler warnings --- glm/detail/type_vec4.hpp | 8 ++++---- glm/detail/type_vec4.inl | 43 +++++++++++++++++++--------------------- glm/gtc/quaternion.inl | 4 ++-- 3 files changed, 26 insertions(+), 29 deletions(-) diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index dcc012eb..dd9756e6 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -244,13 +244,13 @@ namespace detail GLM_FUNC_DECL tvec4 & operator= (tvec4 const & v); - GLM_FUNC_DECL tvec4 & operator+=(T s); + GLM_FUNC_DECL tvec4 & operator+=(T v); GLM_FUNC_DECL tvec4 & operator+=(tvec4 const & v); - GLM_FUNC_DECL tvec4 & operator-=(T s); + GLM_FUNC_DECL tvec4 & operator-=(T v); GLM_FUNC_DECL tvec4 & operator-=(tvec4 const & v); - GLM_FUNC_DECL tvec4 & operator*=(T s); + GLM_FUNC_DECL tvec4 & operator*=(T v); GLM_FUNC_DECL tvec4 & operator*=(tvec4 const & v); - GLM_FUNC_DECL tvec4 & operator/=(T s); + GLM_FUNC_DECL tvec4 & operator/=(T v); GLM_FUNC_DECL tvec4 & operator/=(tvec4 const & v); template diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 009b8e98..ef631b3a 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -295,12 +295,12 @@ namespace detail #endif template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator+= (T s) + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator+= (T v) { - this->x += s; - this->y += s; - this->z += s; - this->w += s; + this->x += v; + this->y += v; + this->z += v; + this->w += v; return *this; } @@ -331,12 +331,12 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator-= (T s) + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator-= (T v) { - this->x -= s; - this->y -= s; - this->z -= s; - this->w -= s; + this->x -= v; + this->y -= v; + this->z -= v; + this->w -= v; return *this; } @@ -351,12 +351,12 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator*= (T s) + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator*= (T v) { - this->x *= s; - this->y *= s; - this->z *= s; - this->w *= s; + this->x *= v; + this->y *= v; + this->z *= v; + this->w *= v; return *this; } @@ -371,12 +371,12 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator/= (T s) + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator/= (T v) { - this->x /= s; - this->y /= s; - this->z /= s; - this->w /= s; + this->x /= v; + this->y /= v; + this->z /= v; + this->w /= v; return *this; } @@ -390,9 +390,6 @@ namespace detail return *this; } - - - template template GLM_FUNC_QUALIFIER tvec4 & tvec4::operator= (tvec4 const & v) diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index a9d5ac52..122cdc42 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -114,9 +114,9 @@ namespace detail detail::tvec3 const & v ) { - detail::tvec3 w = cross(u, v); + detail::tvec3 const LocalW(cross(u, v)); T Dot = detail::compute_dot::call(u, v); - detail::tquat q(T(1) + Dot, w.x, w.y, w.z); + detail::tquat q(T(1) + Dot, LocalW.x, LocalW.y, LocalW.z); *this = normalize(q); } From 81bdef25aac934df2e27faeb6e9741f636d0bcf2 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 18 Jul 2014 01:15:15 +0200 Subject: [PATCH 47/47] Fixed VC14 compiler warnings --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index 5e1c371e..9dc64ad1 100644 --- a/readme.txt +++ b/readme.txt @@ -44,6 +44,7 @@ GLM 0.9.6.0: 2014-XX-XX - Removed GLM_FORCE_RADIANS, active by default - Added move contructors and assignment operators (#141) - Use pragma once +- Fixed Visual Studio 14 compiler warnings ================================================================================ GLM 0.9.5.5: 2014-XX-XX