Merge branch '0.9.6' of https://github.com/g-truc/glm into 0.9.6

This commit is contained in:
Christophe Riccio 2014-08-31 18:12:53 -04:00
commit 67c62d8b1c
160 changed files with 1429 additions and 1332 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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<T, P>, 3,3,3,1> E3 ## E3 ## E3 ## E1; }; \
struct { _swizzle<4, T, P, V<T, P>, 3,3,3,2> E3 ## E3 ## E3 ## E2; }; \
struct { _swizzle<4, T, P, V<T, P>, 3,3,3,3> E3 ## E3 ## E3 ## E3; };
#endif//glm_core_swizzle

View File

@ -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<TMPL_TYPE, PRECISION> 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

View File

@ -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

View File

@ -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.hpp>// glm::vec3

View File

@ -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

View File

@ -716,7 +716,7 @@ 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 & GLM_PLATFORM_ANDROID && __cplusplus < 201103L)
return _isnan(x) != 0;
# else
return std::isnan(x);
@ -787,7 +787,7 @@ 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 & GLM_PLATFORM_ANDROID && __cplusplus < 201103L)
return _isinf(x) != 0;
# else
return std::isinf(x);

View File

@ -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

View File

@ -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

View File

@ -92,8 +92,7 @@ namespace detail
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length' only accept floating-point inputs");
genType sqr = x * x;
return sqrt(sqr);
return abs(x);
}
template <typename T, precision P>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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<uint&>(Topack);
// return reinterpret_cast<uint&>(Topack);
uint* ptr(reinterpret_cast<uint*>(&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<uint32&>(Topack);
// return reinterpret_cast<uint32&>(Topack);
uint* ptr(reinterpret_cast<uint*>(&Topack));
return *ptr;
}
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint const & p)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -26,8 +26,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_SETUP_INCLUDED
#define GLM_SETUP_INCLUDED
#pragma once
#include <cassert>
@ -578,16 +577,19 @@
#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))
@ -606,14 +608,26 @@
# endif
#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
# define GLM_ARCH (GLM_ARCH_PURE)
# endif
#elif((GLM_PLATFORM & GLM_PLATFORM_APPLE) && (GLM_COMPILER & GLM_COMPILER_GCC))
# define GLM_ARCH GLM_ARCH_PURE
#elif(((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))) || (GLM_COMPILER & GLM_COMPILER_LLVM_GCC) || (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__)
# 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__)
# define GLM_ARCH (GLM_ARCH_SSE2)
# else
# define GLM_ARCH (GLM_ARCH_PURE)
# endif
#else
# define GLM_ARCH GLM_ARCH_PURE
#endif
@ -786,5 +800,3 @@ namespace glm
#else
# define GLM_CONSTEXPR
#endif
#endif//GLM_SETUP_INCLUDED

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"
@ -59,6 +58,7 @@ namespace detail
private:
/// @cond DETAIL
col_type value[4];
/// @endcond
public:
// Constructors
@ -263,5 +263,3 @@ namespace detail
#ifndef GLM_EXTERNAL_TEMPLATE
#include "type_mat4x4.inl"
#endif//GLM_EXTERNAL_TEMPLATE
#endif//glm_core_type_mat4x4

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"
@ -245,13 +244,13 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> & operator+=(T s);
GLM_FUNC_DECL tvec4<T, P> & operator+=(T v);
GLM_FUNC_DECL tvec4<T, P> & operator+=(tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> & operator-=(T s);
GLM_FUNC_DECL tvec4<T, P> & operator-=(T v);
GLM_FUNC_DECL tvec4<T, P> & operator-=(tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> & operator*=(T s);
GLM_FUNC_DECL tvec4<T, P> & operator*=(T v);
GLM_FUNC_DECL tvec4<T, P> & operator*=(tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> & operator/=(T s);
GLM_FUNC_DECL tvec4<T, P> & operator/=(T v);
GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec4<T, P> const & v);
template <typename U, precision Q>
@ -418,5 +417,3 @@ namespace detail
#ifndef GLM_EXTERNAL_TEMPLATE
#include "type_vec4.inl"
#endif//GLM_EXTERNAL_TEMPLATE
#endif//glm_core_type_gentype4

View File

@ -295,12 +295,12 @@ namespace detail
#endif
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator+= (T s)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::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 <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator-= (T s)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::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 <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator*= (T s)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::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 <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator/= (T s)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::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 <typename T, precision P>
template <typename U, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator= (tvec4<U, Q> const & v)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -77,8 +77,7 @@
#include "detail/_fixes.hpp"
#ifndef GLM_INCLUDED
#define GLM_INCLUDED
#pragma once
#include <cmath>
#include <climits>
@ -113,5 +112,3 @@
#include "matrix.hpp"
#include "vector_relational.hpp"
#include "integer.hpp"
#endif//GLM_INCLUDED

View File

@ -36,8 +36,7 @@
/// <glm/gtc/constants.hpp> 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

View File

@ -37,8 +37,7 @@
/// <glm/gtc/epsilon.hpp> 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

View File

@ -34,8 +34,7 @@
/// <glm/gtc/matrix_access.hpp> 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

View File

@ -34,8 +34,7 @@
/// <glm/gtc/matrix_integer.hpp> 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

View File

@ -34,8 +34,7 @@
/// <glm/gtc/matrix_inverse.hpp> 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

View File

@ -43,14 +43,14 @@
/// <glm/gtc/matrix_transform.hpp> need to be included to use these functionalities.
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_matrix_transform
#define GLM_GTC_matrix_transform
#pragma once
// Dependencies
#include "../mat4x4.hpp"
#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")
@ -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 <typename T, precision P>
GLM_FUNC_DECL detail::tmat4x4<T, P> frustum(
template <typename T>
GLM_FUNC_DECL detail::tmat4x4<T, defaultp> 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 <typename T, precision P>
GLM_FUNC_DECL detail::tmat4x4<T, P> perspective(
template <typename T>
GLM_FUNC_DECL detail::tmat4x4<T, defaultp> 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 <typename T, precision P>
GLM_FUNC_DECL detail::tmat4x4<T, P> perspectiveFov(
template <typename T>
GLM_FUNC_DECL detail::tmat4x4<T, defaultp> 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 <typename T, precision P>
GLM_FUNC_DECL detail::tmat4x4<T, P> infinitePerspective(
template <typename T>
GLM_FUNC_DECL detail::tmat4x4<T, defaultp> 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,10 +223,21 @@ 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 <typename T, precision P>
GLM_FUNC_DECL detail::tmat4x4<T, P> tweakedInfinitePerspective(
template <typename T>
GLM_FUNC_DECL detail::tmat4x4<T, defaultp> tweakedInfinitePerspective(
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 <typename T>
GLM_FUNC_DECL detail::tmat4x4<T, defaultp> tweakedInfinitePerspective(
T fovy, T aspect, T near, T ep);
/// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.
///
/// @param obj
@ -290,5 +301,3 @@ namespace glm
}//namespace glm
#include "matrix_transform.inl"
#endif//GLM_GTC_matrix_transform

View File

@ -167,7 +167,7 @@ namespace glm
detail::tmat4x4<T, defaultp> Result(1);
Result[0][0] = static_cast<T>(2) / (right - left);
Result[1][1] = static_cast<T>(2) / (top - bottom);
Result[2][2] = - T(2) / (zFar - zNear);
Result[2][2] = - static_cast<T>(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,93 +186,93 @@ namespace glm
detail::tmat4x4<T, defaultp> Result(1);
Result[0][0] = static_cast<T>(2) / (right - left);
Result[1][1] = static_cast<T>(2) / (top - bottom);
Result[2][2] = - T(1);
Result[2][2] = - static_cast<T>(1);
Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom);
return Result;
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat4x4<valType, defaultp> frustum
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T, defaultp> 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<valType, defaultp> Result(0);
Result[0][0] = (valType(2) * nearVal) / (right - left);
Result[1][1] = (valType(2) * nearVal) / (top - bottom);
detail::tmat4x4<T, defaultp> Result(0);
Result[0][0] = (static_cast<T>(2) * nearVal) / (right - left);
Result[1][1] = (static_cast<T>(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<T>(-1);
Result[3][2] = -(static_cast<T>(2) * farVal * nearVal) / (farVal - nearVal);
return Result;
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat4x4<valType, defaultp> perspective
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T, defaultp> 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<T>(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<T>(2));
detail::tmat4x4<valType, defaultp> Result(valType(0));
Result[0][0] = valType(1) / (aspect * tanHalfFovy);
Result[1][1] = valType(1) / (tanHalfFovy);
detail::tmat4x4<T, defaultp> Result(static_cast<T>(0));
Result[0][0] = static_cast<T>(1) / (aspect * tanHalfFovy);
Result[1][1] = static_cast<T>(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<T>(1);
Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
return Result;
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat4x4<valType, defaultp> perspectiveFov
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T, defaultp> 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<T>(0));
assert(height > static_cast<T>(0));
assert(fov > static_cast<T>(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<T>(0.5) * rad) / glm::sin(static_cast<T>(0.5) * rad);
T w = h * height / width; ///todo max(width , Height) / min(width , Height)?
detail::tmat4x4<valType, defaultp> Result(valType(0));
detail::tmat4x4<T, defaultp> Result(static_cast<T>(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<T>(1);
Result[3][2] = - (static_cast<T>(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 <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T, defaultp> tweakedInfinitePerspective
(
T fovy,
T aspect,
T zNear
T zNear,
T ep
)
{
#ifdef GLM_FORCE_RADIANS
@ -324,14 +326,25 @@ namespace glm
T top = range;
detail::tmat4x4<T, defaultp> Result(T(0));
Result[0][0] = (T(2) * zNear) / (right - left);
Result[1][1] = (T(2) * zNear) / (top - bottom);
Result[2][2] = static_cast<T>(0.0001) - T(1);
Result[0][0] = (static_cast<T>(2) * zNear) / (right - left);
Result[1][1] = (static_cast<T>(2) * zNear) / (top - bottom);
Result[2][2] = ep - static_cast<T>(1);
Result[2][3] = static_cast<T>(-1);
Result[3][2] = - (T(0.0001) - T(2)) * zNear;
Result[3][2] = (ep - static_cast<T>(2)) * zNear;
return Result;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T, defaultp> tweakedInfinitePerspective
(
T fovy,
T aspect,
T zNear
)
{
return tweakedInfinitePerspective(fovy, aspect, zNear, epsilon<T>());
}
template <typename T, typename U, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> project
(

View File

@ -38,8 +38,7 @@
/// <glm/gtc/noise.hpp> 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

View File

@ -36,8 +36,7 @@
/// <glm/gtc/packing.hpp> need to be included to use these features.
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_packing
#define GLM_GTC_packing
#pragma once
// Dependency:
#include "type_precision.hpp"
@ -62,7 +61,7 @@ namespace glm
/// @see uint32 packUnorm4x8(vec4 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
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 +73,7 @@ namespace glm
/// @see vec4 unpackUnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
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 +105,7 @@ namespace glm
/// @see vec4 unpackUnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
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 +118,7 @@ namespace glm
/// @see uint32 packSnorm4x8(vec4 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
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 +131,7 @@ namespace glm
/// @see vec4 unpackSnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
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 +163,7 @@ namespace glm
/// @see vec4 unpackSnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
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 +176,7 @@ namespace glm
/// @see uint64 packSnorm4x16(vec4 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
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 +189,7 @@ namespace glm
/// @see vec4 unpackUnorm4x16(uint64 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
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 +221,7 @@ namespace glm
/// @see vec2 unpackUnorm2x16(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
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 +234,7 @@ namespace glm
/// @see uint64 packSnorm4x16(vec4 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
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 +247,7 @@ namespace glm
/// @see vec4 unpackSnorm4x16(uint64 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm1x16.xml">GLSL unpackSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
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 +290,7 @@ namespace glm
/// @see uint64 packHalf4x16(vec4 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
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 +301,7 @@ namespace glm
/// @see vec4 unpackHalf4x16(uint64 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
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 +327,7 @@ namespace glm
/// @see vec2 unpackHalf2x16(uint32 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
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 +351,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 +375,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 +410,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 +445,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,12 +466,9 @@ 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
#include "packing.inl"
#endif//GLM_GTC_packing

View File

@ -31,11 +31,12 @@
#include "../vec3.hpp"
#include "../vec4.hpp"
#include "../detail/type_half.hpp"
#include <cstring>
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,14 @@ namespace detail
else if(glm::isinf(x))
return 0x1f << 6;
return float2packed11(reinterpret_cast<uint&>(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<uint&>(x);
# endif
return float2packed11(Pack);
}
GLM_FUNC_QUALIFIER float packed11bitToFloat(glm::uint x)
@ -157,8 +165,15 @@ namespace detail
else if(x == (0x1f << 6))
return ~0;//Inf
uint result = packed11ToFloat(x);
return reinterpret_cast<float&>(result);
uint Result = packed11ToFloat(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<float&>(Result);
# endif
}
GLM_FUNC_QUALIFIER glm::uint floatTo10bit(float x)
@ -170,7 +185,14 @@ namespace detail
else if(glm::isinf(x))
return 0x1f << 5;
return float2packed10(reinterpret_cast<uint&>(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<uint&>(x);
# endif
return float2packed10(Pack);
}
GLM_FUNC_QUALIFIER float packed10bitToFloat(glm::uint x)
@ -182,8 +204,15 @@ namespace detail
else if(x == (0x1f << 5))
return ~0;//Inf
uint result = packed10ToFloat(x);
return reinterpret_cast<float&>(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<float&>(Result);
# endif
}
// GLM_FUNC_QUALIFIER glm::uint f11_f11_f10(float x, float y, float z)
@ -217,12 +246,12 @@ namespace detail
}//namespace detail
GLM_FUNC_QUALIFIER uint8 packUnorm1x8(float const & v)
GLM_FUNC_QUALIFIER uint8 packUnorm1x8(float v)
{
return static_cast<uint8>(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<float>(p));
return Unpack * static_cast<float>(0.0039215686274509803921568627451); // 1 / 255
@ -235,20 +264,20 @@ namespace detail
return *Packed;
}
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x8(uint16 const & p)
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x8(uint16 p)
{
u8vec2* Unpacked = reinterpret_cast<u8vec2*>(const_cast<uint16*>(&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<int8>(round(clamp(v ,-1.0f, 1.0f) * 127.0f)));
uint8* Packed = reinterpret_cast<uint8*>(&Topack);
return *Packed;
}
GLM_FUNC_QUALIFIER float unpackSnorm1x8(uint8 const & p)
GLM_FUNC_QUALIFIER float unpackSnorm1x8(uint8 p)
{
float Unpack(static_cast<float>(*const_cast<uint8*>(&p)));
return clamp(
@ -263,7 +292,7 @@ namespace detail
return *Packed;
}
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x8(uint16 const & p)
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x8(uint16 p)
{
i8vec2* Unpack = reinterpret_cast<i8vec2*>(const_cast<uint16*>(&p));
return clamp(
@ -271,12 +300,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<uint16>(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<float>(*const_cast<uint16*>(&p));
return Unpack * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0
@ -289,20 +318,20 @@ namespace detail
return *Packed;
}
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x16(uint64 const & p)
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x16(uint64 p)
{
u16vec4* Unpack = reinterpret_cast<u16vec4*>(const_cast<uint64*>(&p));
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<int16>(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
uint16* Packed = reinterpret_cast<uint16*>(&Topack);
return *Packed;
}
GLM_FUNC_QUALIFIER float unpackSnorm1x16(uint16 const & p)
GLM_FUNC_QUALIFIER float unpackSnorm1x16(uint16 p)
{
float Unpack = static_cast<float>(*const_cast<uint16*>(&p));
return clamp(
@ -317,7 +346,7 @@ namespace detail
return *Packed;
}
GLM_FUNC_QUALIFIER vec4 unpackSnorm4x16(uint64 const & p)
GLM_FUNC_QUALIFIER vec4 unpackSnorm4x16(uint64 p)
{
i16vec4* Unpack(reinterpret_cast<i16vec4*>(const_cast<uint64*>(&p)));
return clamp(
@ -325,14 +354,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<uint16*>(&Topack);
return *Packed;
}
GLM_FUNC_QUALIFIER float unpackHalf1x16(uint16 const & v)
GLM_FUNC_QUALIFIER float unpackHalf1x16(uint16 v)
{
int16* Unpack = reinterpret_cast<int16*>(const_cast<uint16*>(&v));
return detail::toFloat32(*Unpack);
@ -350,7 +379,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<i16vec4*>(const_cast<uint64*>(&v));
i16vec4 Unpack(*p);
@ -372,7 +401,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;
@ -393,7 +422,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;
@ -414,7 +443,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;
@ -436,7 +465,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;
@ -456,7 +485,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),

View File

@ -37,8 +37,7 @@
/// <glm/gtc/quaternion.hpp> need to be included to use these functionalities.
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_quaternion
#define GLM_GTC_quaternion
#pragma once
// Dependency:
#include "../mat3x3.hpp"
@ -59,6 +58,7 @@ namespace detail
{
enum ctor{null};
typedef T value_type;
typedef tvec4<bool, P> bool_type;
public:
@ -399,5 +399,3 @@ namespace detail
} //namespace glm
#include "quaternion.inl"
#endif//GLM_GTC_quaternion

View File

@ -114,9 +114,9 @@ namespace detail
detail::tvec3<T, P> const & v
)
{
detail::tvec3<T, P> w = cross(u, v);
detail::tvec3<T, P> const LocalW(cross(u, v));
T Dot = detail::compute_dot<detail::tvec3, T, P>::call(u, v);
detail::tquat<T, P> q(T(1) + Dot, w.x, w.y, w.z);
detail::tquat<T, P> q(T(1) + Dot, LocalW.x, LocalW.y, LocalW.z);
*this = normalize(q);
}
@ -255,7 +255,7 @@ namespace detail
template <typename T, precision P>
struct compute_dot<tquat, T, P>
{
static T call(tquat<T, P> const & x, tquat<T, P> const & y)
static GLM_FUNC_QUALIFIER T call(tquat<T, P> const & x, tquat<T, P> const & y)
{
tvec4<T, P> 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);
@ -302,16 +302,11 @@ namespace detail
detail::tvec3<T, P> const & v
)
{
T Two(2);
detail::tvec3<T, P> const QuatVector(q.x, q.y, q.z);
detail::tvec3<T, P> const uv(glm::cross(QuatVector, v));
detail::tvec3<T, P> const uuv(glm::cross(QuatVector, uv));
detail::tvec3<T, P> uv, uuv;
detail::tvec3<T, P> 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 * q.w) + uuv) * static_cast<T>(2);
}
template <typename T, precision P>
@ -587,10 +582,10 @@ namespace detail
{
// Linear interpolation
return detail::tquat<T, P>(
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
{

View File

@ -37,8 +37,7 @@
/// <glm/gtc/random.hpp> 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

View File

@ -35,8 +35,7 @@
/// <glm/gtc/reciprocal.hpp> 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

View File

@ -40,8 +40,7 @@
/// <glm/gtc/type_precision.hpp> 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

View File

@ -56,8 +56,7 @@
/// <glm/gtc/type_ptr.hpp> 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

View File

@ -36,8 +36,7 @@
/// <glm/gtc/ulp.hpp> 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

View File

@ -199,10 +199,12 @@ 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<float>::max());
# 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
@ -211,7 +213,7 @@ 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<double>::max());
# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)))
return detail::nextafter(x, std::numeric_limits<double>::max());
@ -231,10 +233,12 @@ 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<float>::min());
# 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
@ -242,9 +246,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<double>::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);

View File

@ -35,8 +35,7 @@
/// <glm/gtx/associated_min_max.hpp> 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

View File

@ -36,8 +36,7 @@
/// <glm/gtx/bit.hpp> 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

View File

@ -287,7 +287,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;
}
@ -304,7 +304,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;
}

View File

@ -35,8 +35,7 @@
/// <glm/gtx/closest_point.hpp> 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

View File

@ -35,8 +35,7 @@
/// <glm/gtx/color_space.hpp> 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

View File

@ -35,8 +35,7 @@
/// <glm/gtx/color_space_YCoCg.hpp> 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

View File

@ -36,8 +36,7 @@
/// <glm/gtx/compatibility.hpp> 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

View File

@ -35,8 +35,7 @@
/// <glm/gtx/component_wise.hpp> 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

View File

@ -38,8 +38,7 @@
/// <glm/gtx/dual_quaternion.hpp> need to be included to use these functionalities.
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_dual_quaternion
#define GLM_GTX_dual_quaternion
#pragma once
// Dependency:
#include "../glm.hpp"
@ -57,13 +56,13 @@ namespace detail
struct tdualquat
{
enum ctor{null};
typedef T value_type;
typedef glm::detail::tquat<T, P> part_type;
public:
glm::detail::tquat<T, P> real, dual;
GLM_FUNC_DECL GLM_CONSTEXPR int length() const;
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
// Constructors
GLM_FUNC_DECL tdualquat();
@ -291,5 +290,3 @@ namespace detail
} //namespace glm
#include "dual_quaternion.inl"
#endif//GLM_GTX_dual_quaternion

View File

@ -33,7 +33,7 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR int tdualquat<T, P>::length() const
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tdualquat<T, P>::length() const
{
return 8;
}

View File

@ -36,8 +36,7 @@
/// <glm/gtx/euler_angles.hpp> 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

View File

@ -250,7 +250,7 @@ namespace glm
detail::tvec3<T, P> const & angles
)
{
return detail::tmat3x3<T, P>(yawPitchRoll(angles.x, angles.y, angles.z));
return detail::tmat3x3<T, P>(yawPitchRoll(angles.z, angles.x, angles.y));
}
template <typename T, precision P>

View File

@ -35,8 +35,7 @@
/// <glm/gtx/extend.hpp> 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

View File

@ -36,8 +36,7 @@
/// <glm/gtx/extented_min_max.hpp> 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

View File

@ -36,8 +36,7 @@
/// <glm/gtx/fast_exponential.hpp> 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

View File

@ -37,8 +37,7 @@
/// <glm/gtx/fast_square_root.hpp> 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

View File

@ -101,13 +101,43 @@ namespace glm
template <typename genType>
GLM_FUNC_QUALIFIER genType fastDistance
(
genType const & x,
genType const & x,
genType const & y
)
{
return fastLength(y - x);
}
template <typename valType, precision P>
GLM_FUNC_QUALIFIER valType fastDistance
(
detail::tvec2<valType, P> const & x,
detail::tvec2<valType, P> const & y
)
{
return fastLength(y - x);
}
template <typename valType, precision P>
GLM_FUNC_QUALIFIER valType fastDistance
(
detail::tvec3<valType, P> const & x,
detail::tvec3<valType, P> const & y
)
{
return fastLength(y - x);
}
template <typename valType, precision P>
GLM_FUNC_QUALIFIER valType fastDistance
(
detail::tvec4<valType, P> const & x,
detail::tvec4<valType, P> const & y
)
{
return fastLength(y - x);
}
// fastNormalize
template <typename genType>
GLM_FUNC_QUALIFIER genType fastNormalize

View File

@ -35,8 +35,7 @@
/// <glm/gtx/fast_trigonometry.hpp> 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

View File

@ -35,8 +35,7 @@
/// <glm/gtx/gradient_paint.hpp> 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

View File

@ -35,8 +35,7 @@
/// <glm/gtx/handed_coordinate_system.hpp> 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

View File

@ -36,8 +36,7 @@
/// <glm/gtx/inertia.hpp> 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

View File

@ -35,8 +35,7 @@
/// <glm/gtx/integer.hpp> 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

View File

@ -36,8 +36,7 @@
/// <glm/gtx/intersect.hpp> 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

View File

@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.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
@ -26,125 +26,198 @@
/// @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
///
/// @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]
///
/// <glm/gtx/io.hpp> needs to be included to use these functionalities.
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_io
#define GLM_GTX_io
#pragma once
// Dependency:
#include "../detail/setup.hpp"
#include "../gtc/quaternion.hpp"
#include "../glm.hpp"
#include "../gtx/quaternion.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTX_io extension included")
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
# pragma message("GLM: GLM_GTX_io extension included")
#endif
#include <iosfwd> // std::basic_ostream<> (fwd)
#include <locale> // std::locale, std::locale::facet, std::locale::id
#include <utility> // std::pair<>
namespace glm
{
/// @addtogroup gtx_io
/// @{
namespace io
{
class precision_guard {
public:
GLM_FUNC_DECL explicit precision_guard();
GLM_FUNC_DECL ~precision_guard();
private:
unsigned precision_;
unsigned value_width_;
};
class format_guard
namespace io
{
public:
enum order_t { column_major, row_major, };
enum order_type { column_major, row_major};
GLM_FUNC_DECL explicit format_guard();
GLM_FUNC_DECL ~format_guard();
template <typename CTy>
class format_punct : public std::locale::facet
{
typedef CTy char_type;
private:
public:
order_t order_;
char cr_;
};
static std::locale::id id;
// decimal places (dflt: 3)
GLM_FUNC_DECL unsigned& precision();
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;
// sign + value + '.' + decimals (dflt: 1 + 4 + 1 + precision())
GLM_FUNC_DECL unsigned& value_width();
explicit format_punct(size_t a = 0);
explicit format_punct(format_punct const&);
};
// matrix output order (dflt: row_major)
GLM_FUNC_DECL format_guard::order_t& order();
template <typename CTy, typename CTr = std::char_traits<CTy> >
class basic_state_saver {
// carriage/return char (dflt: '\n')
GLM_FUNC_DECL char& cr();
public:
// matrix output order -> column_major
GLM_FUNC_DECL std::ios_base& column_major(std::ios_base&);
explicit basic_state_saver(std::basic_ios<CTy,CTr>&);
~basic_state_saver();
// matrix output order -> row_major
GLM_FUNC_DECL std::ios_base& row_major (std::ios_base&);
private:
// carriage/return char -> '\n'
GLM_FUNC_DECL std::ios_base& formatted (std::ios_base&);
typedef ::std::basic_ios<CTy,CTr> 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;
// carriage/return char -> ' '
GLM_FUNC_DECL std::ios_base& unformatted (std::ios_base&);
state_type& state_;
flags_type flags_;
streamsize_type precision_;
streamsize_type width_;
char_type fill_;
locale_type locale_;
}//namespace io
basic_state_saver& operator=(basic_state_saver const&);
};
namespace detail
{
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tquat<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec4<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x4<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x4<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x4<T,P> const&);
typedef basic_state_saver<char> state_saver;
typedef basic_state_saver<wchar_t> wstate_saver;
/// @}
}//namespace detail
template <typename CTy, typename CTr = std::char_traits<CTy> >
class basic_format_saver
{
public:
explicit basic_format_saver(std::basic_ios<CTy,CTr>&);
~basic_format_saver();
private:
basic_state_saver<CTy> const bss_;
basic_format_saver& operator=(basic_format_saver const&);
};
typedef basic_format_saver<char> format_saver;
typedef basic_format_saver<wchar_t> wformat_saver;
struct precision
{
unsigned value;
explicit precision(unsigned);
};
struct width
{
unsigned value;
explicit width(unsigned);
};
template <typename CTy>
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 <typename FTy, typename CTy, typename CTr>
FTy const& get_facet(std::basic_ios<CTy,CTr>&);
template <typename FTy, typename CTy, typename CTr>
std::basic_ios<CTy,CTr>& formatted(std::basic_ios<CTy,CTr>&);
template <typename FTy, typename CTy, typename CTr>
std::basic_ios<CTy,CTr>& unformattet(std::basic_ios<CTy,CTr>&);
template <typename CTy, typename CTr>
std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, precision const&);
template <typename CTy, typename CTr>
std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, width const&);
template <typename CTy, typename CTr>
std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, delimeter<CTy> const&);
template <typename CTy, typename CTr>
std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, order const&);
}//namespace io
namespace detail
{
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tquat<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec4<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x4<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x4<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x4<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr> & operator<<(
std::basic_ostream<CTy,CTr> &,
std::pair<tmat4x4<T,P> const,
tmat4x4<T,P> const> const &);
}//namespace detail
/// @}
}//namespace glm
#include "io.inl"
#endif//GLM_GTX_io

View File

@ -1,328 +1,598 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2013-11-22
// Updated : 2013-11-22
// Updated : 2013-12-18
// Licence : This source is under MIT License
// File : glm/gtx/inl.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../matrix.hpp"
// #include <boost/io/ios_state.hpp> // boost::io::ios_all_saver
#include <iomanip> // std::setfill<>, std::fixed, std::setprecision, std::right,
// std::setw
#include <ostream> // std::basic_ostream<>
#include <iomanip> // std::setfill<>, std::fixed, std::setprecision, std::right, std::setw
#include <ostream> // std::basic_ostream<>
namespace glm{
namespace io
{
/* explicit */ GLM_FUNC_QUALIFIER
precision_guard::precision_guard()
: precision_ (precision()),
value_width_(value_width())
{}
template <typename CTy>
/* explicit */ GLM_FUNC_QUALIFIER
format_punct<CTy>::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)
{}
GLM_FUNC_QUALIFIER
precision_guard::~precision_guard()
{
value_width() = value_width_;
precision() = precision_;
}
template <typename CTy>
/* explicit */ GLM_FUNC_QUALIFIER
format_punct<CTy>::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)
{}
/* explicit */ GLM_FUNC_QUALIFIER
format_guard::format_guard()
: order_(order()),
cr_ (cr())
{}
template <typename CTy> std::locale::id format_punct<CTy>::id;
GLM_FUNC_QUALIFIER
format_guard::~format_guard()
{
cr() = cr_;
order() = order_;
}
template <typename CTy, typename CTr>
/* explicit */ GLM_FUNC_QUALIFIER basic_state_saver<CTy,CTr>::basic_state_saver(std::basic_ios<CTy,CTr>& a)
: state_ (a),
flags_ (a.flags()),
precision_(a.precision()),
width_ (a.width()),
fill_ (a.fill()),
locale_ (a.getloc())
{}
GLM_FUNC_QUALIFIER unsigned& precision()
{
static unsigned p(3);
template <typename CTy, typename CTr>
GLM_FUNC_QUALIFIER basic_state_saver<CTy,CTr>::~basic_state_saver()
{
state_.imbue(locale_);
state_.fill(fill_);
state_.width(width_);
state_.precision(precision_);
state_.flags(flags_);
}
return p;
}
GLM_FUNC_QUALIFIER unsigned& value_width()
{
static unsigned p(9);
template <typename CTy, typename CTr>
/* explicit */ GLM_FUNC_QUALIFIER basic_format_saver<CTy,CTr>::basic_format_saver(std::basic_ios<CTy,CTr>& a)
: bss_(a)
{
a.imbue(std::locale(a.getloc(), new format_punct<CTy>(get_facet<format_punct<CTy> >(a))));
}
return p;
}
GLM_FUNC_QUALIFIER format_guard::order_t& order()
{
static format_guard::order_t p(format_guard::row_major);
template <typename CTy, typename CTr>
GLM_FUNC_QUALIFIER
basic_format_saver<CTy,CTr>::~basic_format_saver()
{}
return p;
}
GLM_FUNC_QUALIFIER char&
cr()
{
static char p('\n'); return p;
}
GLM_FUNC_QUALIFIER std::ios_base& column_major(std::ios_base& os)
{
order() = format_guard::column_major;
return os;
}
GLM_FUNC_QUALIFIER std::ios_base& row_major(std::ios_base& os)
{
order() = format_guard::row_major;
return os;
}
/* explicit */ GLM_FUNC_QUALIFIER precision::precision(unsigned a)
: value(a)
{}
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)
{
cr() = ' ';
return os;
}
/* explicit */ GLM_FUNC_QUALIFIER width::width(unsigned a)
: value(a)
{}
template <typename CTy>
/* explicit */ GLM_FUNC_QUALIFIER delimeter<CTy>::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 <typename FTy, typename CTy, typename CTr>
GLM_FUNC_QUALIFIER FTy const& get_facet(std::basic_ios<CTy,CTr>& ios)
{
if (!std::has_facet<FTy>(ios.getloc())) {
ios.imbue(std::locale(ios.getloc(), new FTy));
}
return std::use_facet<FTy>(ios.getloc());
}
template <typename CTy, typename CTr>
GLM_FUNC_QUALIFIER std::basic_ios<CTy,CTr>& formatted(std::basic_ios<CTy,CTr>& ios)
{
const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(ios)).formatted = true;
return ios;
}
template <typename CTy, typename CTr>
GLM_FUNC_QUALIFIER std::basic_ios<CTy,CTr>& unformatted(std::basic_ios<CTy,CTr>& ios)
{
const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(ios)).formatted = false;
return ios;
}
template <typename CTy, typename CTr>
GLM_FUNC_QUALIFIER std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>& os, precision const& a)
{
const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(os)).precision = a.value;
return os;
}
template <typename CTy, typename CTr>
GLM_FUNC_QUALIFIER std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>& os, width const& a)
{
const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(os)).width = a.value;
return os;
}
template <typename CTy, typename CTr>
std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>& os, delimeter<CTy> const& a)
{
format_punct<CTy> & fmt(const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(os)));
fmt.delim_left = a.value[0];
fmt.delim_right = a.value[1];
fmt.separator = a.value[2];
return os;
}
template <typename CTy, typename CTr>
GLM_FUNC_QUALIFIER std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>& os, order const& a)
{
const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(os)).order = a.value;
return os;
}
} // 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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
if (cerberus) {
// boost::io::ios_all_saver const ias(os);
os << std::fixed << std::setprecision(io::precision())
<< '['
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.w << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.x << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.y << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.z
<< ']';
}
if(fmt.formatted)
{
io::basic_state_saver<CTy> const bss(os);
return os;
}
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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(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;
}
}
if (cerberus) {
// boost::io::ios_all_saver const ias(os);
os << std::fixed << std::setprecision(io::precision())
<< '['
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.x << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.y
<< ']';
}
return os;
}
return os;
}
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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
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)
{
typename std::basic_ostream<CTy,CTr>::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<CTy>(' ') << std::setw(io::value_width()) << a.x << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.y << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.z
<< ']';
}
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
return os;
}
if(fmt.formatted)
{
io::basic_state_saver<CTy> const bss(os);
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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(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;
}
}
if (cerberus) {
// boost::io::ios_all_saver const ias(os);
os << std::fixed << std::setprecision(io::precision())
<< '['
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.x << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.y << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.z << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.w
<< ']';
}
return os;
}
return os;
}
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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
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& m)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
if (cerberus) {
os << io::cr()
<< '[' << m[0] << io::cr()
<< ' ' << m[1] << ']';
}
if(fmt.formatted)
{
io::basic_state_saver<CTy> const bss(os);
return 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;
}
}
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& m)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
return os;
}
if (cerberus) {
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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
os << io::cr()
<< '[' << m[0] << io::cr()
<< ' ' << m[1] << ']';
}
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
return os;
}
if(fmt.formatted)
{
io::basic_state_saver<CTy> const bss(os);
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& m)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(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;
}
}
if (cerberus) {
return os;
}
os << io::cr()
<< '[' << m[0] << io::cr()
<< ' ' << m[1] << ']';
}
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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
return os;
}
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat2x2<T,P> m(a);
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& m)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(io::row_major == fmt.order)
m = transpose(a);
if (cerberus) {
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];
}
}
os << io::cr()
<< '[' << m[0] << io::cr()
<< ' ' << m[1] << io::cr()
<< ' ' << m[2] << ']';
}
return os;
}
return os;
}
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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
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& m)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat3x2<T,P> m(a);
if (cerberus) {
if(io::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;
}
return os;
}
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& m)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if (cerberus) {
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat4x2<T,P> m(a);
os << io::cr()
<< '[' << m[0] << io::cr()
<< ' ' << m[1] << io::cr()
<< ' ' << m[2] << ']';
}
if(io::row_major == fmt.order)
m = transpose(a);
return os;
}
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& m)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
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];
}
}
if (cerberus) {
return os;
}
os << io::cr()
<< '[' << m[0] << io::cr()
<< ' ' << m[1] << io::cr()
<< ' ' << m[2] << io::cr()
<< ' ' << m[3] << ']';
}
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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
return os;
}
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat2x3<T,P> m(a);
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& m)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(io::row_major == fmt.order)
m = transpose(a);
if (cerberus) {
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];
}
}
os << io::cr()
<< '[' << m[0] << io::cr()
<< ' ' << m[1] << io::cr()
<< ' ' << m[2] << io::cr()
<< ' ' << m[3] << ']';
}
return os;
}
return os;
}
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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
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& m)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat3x3<T,P> m(a);
if (cerberus) {
if(io::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.delim_right;
}
else
{
os << m[0] << fmt.space << m[1] << fmt.space << m[2];
}
}
return os;
}
return os;
}
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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat4x3<T,P> 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 <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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat2x4<T,P> 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 <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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat3x4<T,P> 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 <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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat4x4<T,P> 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 <typename CTy, typename CTr, typename T, precision P>
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)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat4x4<T,P> ml(a.first);
tmat4x4<T,P> 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

View File

@ -35,8 +35,7 @@
/// <glm/gtx/log_base.hpp> 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

View File

@ -36,8 +36,7 @@
/// <glm/gtx/matrix_cross_product.hpp> 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

Some files were not shown because too many files have changed in this diff Show More