mirror of
https://github.com/g-truc/glm.git
synced 2024-11-10 12:41:54 +00:00
Fixed build with C++98 compilers
This commit is contained in:
parent
edbe66cb00
commit
7fd1cdc477
@ -701,7 +701,7 @@
|
||||
# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8))
|
||||
# define GLM_INLINE __forceinline
|
||||
# elif((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC34))
|
||||
# define GLM_INLINE __attribute__((always_inline))
|
||||
# define GLM_INLINE __attribute__((always_inline)) inline
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||
# define GLM_INLINE __attribute__((always_inline))
|
||||
# else
|
||||
|
@ -52,7 +52,7 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup gtx_io
|
||||
/// @addtogroup gtx_io
|
||||
/// @{
|
||||
|
||||
namespace io
|
||||
@ -72,21 +72,19 @@ namespace glm
|
||||
|
||||
};
|
||||
|
||||
enum class order_t { column_major, row_major, };
|
||||
class format_guard
|
||||
{
|
||||
public:
|
||||
enum order_t { column_major, row_major, };
|
||||
|
||||
class format_guard {
|
||||
GLM_FUNC_DECL explicit format_guard();
|
||||
GLM_FUNC_DECL ~format_guard();
|
||||
|
||||
public:
|
||||
private:
|
||||
|
||||
GLM_FUNC_DECL explicit format_guard();
|
||||
GLM_FUNC_DECL ~format_guard();
|
||||
|
||||
private:
|
||||
|
||||
order_t order_;
|
||||
char cr_;
|
||||
|
||||
};
|
||||
order_t order_;
|
||||
char cr_;
|
||||
};
|
||||
|
||||
// decimal places (dflt: 3)
|
||||
GLM_FUNC_DECL unsigned& precision();
|
||||
@ -95,7 +93,7 @@ namespace glm
|
||||
GLM_FUNC_DECL unsigned& value_width();
|
||||
|
||||
// matrix output order (dflt: row_major)
|
||||
GLM_FUNC_DECL order_t& order();
|
||||
GLM_FUNC_DECL format_guard::order_t& order();
|
||||
|
||||
// carriage/return char (dflt: '\n')
|
||||
GLM_FUNC_DECL char& cr();
|
||||
|
103
glm/gtx/io.inl
103
glm/gtx/io.inl
@ -12,10 +12,9 @@
|
||||
// std::setw
|
||||
#include <ostream> // std::basic_ostream<>
|
||||
|
||||
namespace glm
|
||||
namespace glm{
|
||||
namespace io
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
|
||||
/* explicit */ GLM_FUNC_QUALIFIER
|
||||
precision_guard::precision_guard()
|
||||
@ -43,26 +42,23 @@ namespace glm
|
||||
order() = order_;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER unsigned&
|
||||
precision()
|
||||
GLM_FUNC_QUALIFIER unsigned& precision()
|
||||
{
|
||||
static unsigned p(3);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER unsigned&
|
||||
value_width()
|
||||
GLM_FUNC_QUALIFIER unsigned& value_width()
|
||||
{
|
||||
static unsigned p(9);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER order_t&
|
||||
order()
|
||||
GLM_FUNC_QUALIFIER format_guard::order_t& order()
|
||||
{
|
||||
static order_t p(order_t::row_major);
|
||||
static format_guard::order_t p(format_guard::row_major);
|
||||
|
||||
return p;
|
||||
}
|
||||
@ -73,47 +69,41 @@ namespace glm
|
||||
static char p('\n'); return p;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER std::ios_base&
|
||||
column_major(std::ios_base& os)
|
||||
GLM_FUNC_QUALIFIER std::ios_base& column_major(std::ios_base& os)
|
||||
{
|
||||
order() = order_t::column_major;
|
||||
order() = format_guard::column_major;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER std::ios_base&
|
||||
row_major(std::ios_base& os)
|
||||
GLM_FUNC_QUALIFIER std::ios_base& row_major(std::ios_base& os)
|
||||
{
|
||||
order() = order_t::row_major;
|
||||
order() = format_guard::row_major;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER std::ios_base&
|
||||
formatted(std::ios_base& os)
|
||||
GLM_FUNC_QUALIFIER std::ios_base& formatted(std::ios_base& os)
|
||||
{
|
||||
cr() = '\n';
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER std::ios_base&
|
||||
unformatted(std::ios_base& os)
|
||||
GLM_FUNC_QUALIFIER std::ios_base& unformatted(std::ios_base& os)
|
||||
{
|
||||
cr() = ' ';
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace io
|
||||
|
||||
namespace detail {
|
||||
|
||||
} // namespace io
|
||||
namespace detail
|
||||
{
|
||||
// functions, inlined (inline)
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>&
|
||||
operator<<(std::basic_ostream<CTy,CTr>& os, tquat<T,P> const& a)
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tquat<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
@ -133,8 +123,7 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>&
|
||||
operator<<(std::basic_ostream<CTy,CTr>& os, tvec2<T,P> const& a)
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec2<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
@ -152,8 +141,7 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>&
|
||||
operator<<(std::basic_ostream<CTy,CTr>& os, tvec3<T,P> const& a)
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec3<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
@ -172,8 +160,7 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>&
|
||||
operator<<(std::basic_ostream<CTy,CTr>& os, tvec4<T,P> const& a)
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec4<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
@ -193,15 +180,14 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>&
|
||||
operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x2<T,P> const& a)
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x2<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
tmat2x2<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
if (io::format_guard::order_t::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
@ -214,15 +200,14 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>&
|
||||
operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x3<T,P> const& a)
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x3<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
tmat3x2<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
if (io::format_guard::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
@ -236,15 +221,14 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>&
|
||||
operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x4<T,P> const& a)
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x4<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
tmat4x2<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
if (io::format_guard::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
@ -259,15 +243,14 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>&
|
||||
operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x2<T,P> const& a)
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x2<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
tmat2x3<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
if (io::format_guard::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
@ -280,15 +263,14 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>&
|
||||
operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x3<T,P> const& a)
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x3<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
tmat3x3<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
if (io::format_guard::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
@ -302,15 +284,14 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>&
|
||||
operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x4<T,P> const& a)
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x4<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
tmat4x3<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
if (io::format_guard::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
@ -325,15 +306,14 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>&
|
||||
operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x2<T,P> const& a)
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x2<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
tmat2x4<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
if (io::format_guard::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
@ -346,15 +326,14 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>&
|
||||
operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x3<T,P> const& a)
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x3<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
tmat3x4<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
if (io::format_guard::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
@ -368,15 +347,14 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>&
|
||||
operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x4<T,P> const& a)
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x4<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
tmat4x4<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
if (io::format_guard::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
@ -391,7 +369,7 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>&
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>&
|
||||
operator<<(std::basic_ostream<CTy,CTr>& os,
|
||||
std::pair<tmat4x4<T,P> const, tmat4x4<T,P> const> const& a)
|
||||
{
|
||||
@ -401,7 +379,7 @@ namespace glm
|
||||
tmat4x4<T,P> ml(a.first);
|
||||
tmat4x4<T,P> mr(a.second);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
if (io::format_guard::row_major == io::order()) {
|
||||
ml = transpose(a.first);
|
||||
mr = transpose(a.second);
|
||||
}
|
||||
@ -415,6 +393,5 @@ namespace glm
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
}//namespace detail
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
@ -38,8 +38,8 @@
|
||||
#ifndef GLM_GTX_simd_mat4
|
||||
#define GLM_GTX_simd_mat4
|
||||
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
// Dependencies
|
||||
#include "../detail/setup.hpp"
|
||||
|
||||
#if(GLM_ARCH != GLM_ARCH_PURE)
|
||||
|
||||
@ -61,14 +61,15 @@ namespace detail
|
||||
/// \ingroup gtx_simd_mat4
|
||||
GLM_ALIGNED_STRUCT(16) fmat4x4SIMD
|
||||
{
|
||||
enum ctor{null};
|
||||
|
||||
enum ctor{_null};
|
||||
typedef float value_type;
|
||||
typedef fvec4SIMD col_type;
|
||||
typedef fvec4SIMD row_type;
|
||||
typedef std::size_t size_type;
|
||||
static size_type value_size();
|
||||
static bool is_matrix();
|
||||
typedef fmat4x4SIMD type;
|
||||
typedef fmat4x4SIMD transpose_type;
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
fvec4SIMD Data[4];
|
||||
|
||||
|
@ -10,9 +10,9 @@
|
||||
namespace glm{
|
||||
namespace detail{
|
||||
|
||||
GLM_FUNC_QUALIFIER fmat4x4SIMD::size_type fmat4x4SIMD::value_size()
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t fmat4x4SIMD::length() const
|
||||
{
|
||||
return sizeof(value_type);
|
||||
return 4;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD()
|
||||
@ -551,7 +551,7 @@ GLM_FUNC_QUALIFIER detail::fmat4x4SIMD outerProduct
|
||||
__m128 Shu2 = _mm_shuffle_ps(r.Data, r.Data, _MM_SHUFFLE(2, 2, 2, 2));
|
||||
__m128 Shu3 = _mm_shuffle_ps(r.Data, r.Data, _MM_SHUFFLE(3, 3, 3, 3));
|
||||
|
||||
detail::fmat4x4SIMD result(detail::fmat4x4SIMD::null);
|
||||
detail::fmat4x4SIMD result(detail::fmat4x4SIMD::_null);
|
||||
result[0].Data = _mm_mul_ps(c.Data, Shu0);
|
||||
result[1].Data = _mm_mul_ps(c.Data, Shu1);
|
||||
result[2].Data = _mm_mul_ps(c.Data, Shu2);
|
||||
|
Loading…
Reference in New Issue
Block a user