mirror of
https://github.com/g-truc/glm.git
synced 2024-11-22 17:04:35 +00:00
Merge branch '0.9.5' of https://github.com/g-truc/glm into 0.9.5
This commit is contained in:
commit
e818afba4d
@ -49,10 +49,10 @@ if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") OR (("${CMAKE_CXX_COMPILER_ID}"
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(GLM_TEST_ENABLE_SSE2 "Enable SSE2 optimizations" OFF)
|
||||
option(GLM_TEST_ENABLE_SSE3 "Enable SSE3 optimizations" OFF)
|
||||
option(GLM_TEST_ENABLE_AVX "Enable AVX optimizations" OFF)
|
||||
option(GLM_TEST_ENABLE_AVX2 "Enable AVX2 optimizations" OFF)
|
||||
option(GLM_TEST_ENABLE_SIMD_SSE2 "Enable SSE2 optimizations" OFF)
|
||||
option(GLM_TEST_ENABLE_SIMD_SSE3 "Enable SSE3 optimizations" OFF)
|
||||
option(GLM_TEST_ENABLE_SIMD_AVX "Enable AVX optimizations" OFF)
|
||||
option(GLM_TEST_ENABLE_SIMD_AVX2 "Enable AVX2 optimizations" OFF)
|
||||
option(GLM_TEST_FORCE_PURE "Force 'pure' instructions" OFF)
|
||||
|
||||
if(GLM_TEST_FORCE_PURE)
|
||||
|
@ -73,7 +73,7 @@ int main()
|
||||
# if(GLM_ARCH & GLM_ARCH_SSE2)
|
||||
test_simd();
|
||||
# endif
|
||||
*/
|
||||
*/
|
||||
|
||||
C<> c;
|
||||
|
||||
|
@ -1003,7 +1003,7 @@ GLM_FUNC_QUALIFIER void sse_rotate_ps(__m128 const in[4], float Angle, float con
|
||||
__m128 Sin0 = _mm_set_ss(s);
|
||||
__m128 SinA = _mm_shuffle_ps(Sin0, Sin0, _MM_SHUFFLE(0, 0, 0, 0));
|
||||
|
||||
// detail::tvec3<valType> temp = (valType(1) - c) * axis;
|
||||
// detail::tvec3<T, P> temp = (valType(1) - c) * axis;
|
||||
__m128 Temp0 = _mm_sub_ps(one, CosA);
|
||||
__m128 Temp1 = _mm_mul_ps(Temp0, AxisC);
|
||||
|
||||
|
@ -28,10 +28,10 @@
|
||||
//
|
||||
//// lessThan
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type lessThan
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type lessThan
|
||||
//(
|
||||
// detail::tvec2<valType> const & x,
|
||||
// detail::tvec2<valType> const & y
|
||||
// detail::tvec2<T, P> const & x,
|
||||
// detail::tvec2<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -43,10 +43,10 @@
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type lessThan
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type lessThan
|
||||
//(
|
||||
// detail::tvec3<valType> const & x,
|
||||
// detail::tvec3<valType> const & y
|
||||
// detail::tvec3<T, P> const & x,
|
||||
// detail::tvec3<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -58,10 +58,10 @@
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type lessThan
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type lessThan
|
||||
//(
|
||||
// detail::tvec4<valType> const & x,
|
||||
// detail::tvec4<valType> const & y
|
||||
// detail::tvec4<T, P> const & x,
|
||||
// detail::tvec4<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -74,10 +74,10 @@
|
||||
//
|
||||
//// lessThanEqual
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type lessThanEqual
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type lessThanEqual
|
||||
//(
|
||||
// detail::tvec2<valType> const & x,
|
||||
// detail::tvec2<valType> const & y
|
||||
// detail::tvec2<T, P> const & x,
|
||||
// detail::tvec2<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -89,10 +89,10 @@
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type lessThanEqual
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type lessThanEqual
|
||||
//(
|
||||
// detail::tvec3<valType> const & x,
|
||||
// detail::tvec3<valType> const & y
|
||||
// detail::tvec3<T, P> const & x,
|
||||
// detail::tvec3<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -104,10 +104,10 @@
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type lessThanEqual
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type lessThanEqual
|
||||
//(
|
||||
// detail::tvec4<valType> const & x,
|
||||
// detail::tvec4<valType> const & y
|
||||
// detail::tvec4<T, P> const & x,
|
||||
// detail::tvec4<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -120,10 +120,10 @@
|
||||
//
|
||||
//// greaterThan
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type greaterThan
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type greaterThan
|
||||
//(
|
||||
// detail::tvec2<valType> const & x,
|
||||
// detail::tvec2<valType> const & y
|
||||
// detail::tvec2<T, P> const & x,
|
||||
// detail::tvec2<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -135,10 +135,10 @@
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type greaterThan
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type greaterThan
|
||||
//(
|
||||
// detail::tvec3<valType> const & x,
|
||||
// detail::tvec3<valType> const & y
|
||||
// detail::tvec3<T, P> const & x,
|
||||
// detail::tvec3<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -150,10 +150,10 @@
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type greaterThan
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type greaterThan
|
||||
//(
|
||||
// detail::tvec4<valType> const & x,
|
||||
// detail::tvec4<valType> const & y
|
||||
// detail::tvec4<T, P> const & x,
|
||||
// detail::tvec4<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -166,10 +166,10 @@
|
||||
//
|
||||
//// greaterThanEqual
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type greaterThanEqual
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type greaterThanEqual
|
||||
//(
|
||||
// detail::tvec2<valType> const & x,
|
||||
// detail::tvec2<valType> const & y
|
||||
// detail::tvec2<T, P> const & x,
|
||||
// detail::tvec2<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -181,10 +181,10 @@
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type greaterThanEqual
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type greaterThanEqual
|
||||
//(
|
||||
// detail::tvec3<valType> const & x,
|
||||
// detail::tvec3<valType> const & y
|
||||
// detail::tvec3<T, P> const & x,
|
||||
// detail::tvec3<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -196,10 +196,10 @@
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type greaterThanEqual
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type greaterThanEqual
|
||||
//(
|
||||
// detail::tvec4<valType> const & x,
|
||||
// detail::tvec4<valType> const & y
|
||||
// detail::tvec4<T, P> const & x,
|
||||
// detail::tvec4<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -212,10 +212,10 @@
|
||||
//
|
||||
//// equal
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type equal
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type equal
|
||||
//(
|
||||
// detail::tvec2<valType> const & x,
|
||||
// detail::tvec2<valType> const & y
|
||||
// detail::tvec2<T, P> const & x,
|
||||
// detail::tvec2<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -224,14 +224,14 @@
|
||||
// detail::type<valType>::is_uint ||
|
||||
// detail::type<valType>::is_bool);
|
||||
//
|
||||
// return typename detail::tvec2<valType>::bool_type(x.x == y.x, x.y == y.y);
|
||||
// return typename detail::tvec2<T, P>::bool_type(x.x == y.x, x.y == y.y);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type equal
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type equal
|
||||
//(
|
||||
// detail::tvec3<valType> const & x,
|
||||
// detail::tvec3<valType> const & y
|
||||
// detail::tvec3<T, P> const & x,
|
||||
// detail::tvec3<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -240,14 +240,14 @@
|
||||
// detail::type<valType>::is_uint ||
|
||||
// detail::type<valType>::is_bool);
|
||||
//
|
||||
// return typename detail::tvec3<valType>::bool_type(x.x == y.x, x.y == y.y, x.z == y.z);
|
||||
// return typename detail::tvec3<T, P>::bool_type(x.x == y.x, x.y == y.y, x.z == y.z);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type equal
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type equal
|
||||
//(
|
||||
// detail::tvec4<valType> const & x,
|
||||
// detail::tvec4<valType> const & y
|
||||
// detail::tvec4<T, P> const & x,
|
||||
// detail::tvec4<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -256,15 +256,15 @@
|
||||
// detail::type<valType>::is_uint ||
|
||||
// detail::type<valType>::is_bool);
|
||||
//
|
||||
// return typename detail::tvec4<valType>::bool_type(x.x == y.x, x.y == y.y, x.z == y.z, x.w == y.w);
|
||||
// return typename detail::tvec4<T, P>::bool_type(x.x == y.x, x.y == y.y, x.z == y.z, x.w == y.w);
|
||||
//}
|
||||
//
|
||||
//// notEqual
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type notEqual
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type notEqual
|
||||
//(
|
||||
// detail::tvec2<valType> const & x,
|
||||
// detail::tvec2<valType> const & y
|
||||
// detail::tvec2<T, P> const & x,
|
||||
// detail::tvec2<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -273,14 +273,14 @@
|
||||
// detail::type<valType>::is_uint ||
|
||||
// detail::type<valType>::is_bool);
|
||||
//
|
||||
// return typename detail::tvec2<valType>::bool_type(x.x != y.x, x.y != y.y);
|
||||
// return typename detail::tvec2<T, P>::bool_type(x.x != y.x, x.y != y.y);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type notEqual
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type notEqual
|
||||
//(
|
||||
// detail::tvec3<valType> const & x,
|
||||
// detail::tvec3<valType> const & y
|
||||
// detail::tvec3<T, P> const & x,
|
||||
// detail::tvec3<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -289,14 +289,14 @@
|
||||
// detail::type<valType>::is_uint ||
|
||||
// detail::type<valType>::is_bool);
|
||||
//
|
||||
// return typename detail::tvec3<valType>::bool_type(x.x != y.x, x.y != y.y, x.z != y.z);
|
||||
// return typename detail::tvec3<T, P>::bool_type(x.x != y.x, x.y != y.y, x.z != y.z);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type notEqual
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type notEqual
|
||||
//(
|
||||
// detail::tvec4<valType> const & x,
|
||||
// detail::tvec4<valType> const & y
|
||||
// detail::tvec4<T, P> const & x,
|
||||
// detail::tvec4<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -305,7 +305,7 @@
|
||||
// detail::type<valType>::is_uint ||
|
||||
// detail::type<valType>::is_bool);
|
||||
//
|
||||
// return typename detail::tvec4<valType>::bool_type(x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w);
|
||||
// return typename detail::tvec4<T, P>::bool_type(x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w);
|
||||
//}
|
||||
//
|
||||
//// any
|
||||
|
@ -718,7 +718,7 @@
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED))
|
||||
# define GLM_MESSAGE_SWIZZLE_DISPLAYED
|
||||
# if defined(GLM_SWIZZL)
|
||||
# if defined(GLM_SWIZZLE)
|
||||
# pragma message("GLM: Swizzling operators enabled")
|
||||
# else
|
||||
# pragma message("GLM: Swizzling operators disabled")
|
||||
|
@ -57,11 +57,12 @@ namespace detail
|
||||
typedef tvec2<T, P> type;
|
||||
typedef tvec2<bool, P> bool_type;
|
||||
typedef T value_type;
|
||||
typedef int size_type;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Helper
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR int length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR int tvec2<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec2<T, P>::size_type tvec2<T, P>::length() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
@ -57,11 +57,12 @@ namespace detail
|
||||
typedef tvec3<T, P> type;
|
||||
typedef tvec3<bool, P> bool_type;
|
||||
typedef T value_type;
|
||||
typedef int size_type;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Helper
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR int length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR int tvec3<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec3<T, P>::size_type tvec3<T, P>::length() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
@ -58,11 +58,12 @@ namespace detail
|
||||
typedef tvec4<T, P> type;
|
||||
typedef tvec4<bool, P> bool_type;
|
||||
typedef T value_type;
|
||||
typedef int size_type;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Helper
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR int length() const;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
@ -30,7 +30,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR int tvec4<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec4<T, P>::size_type tvec4<T, P>::length() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
@ -65,7 +65,6 @@
|
||||
|
||||
#include "./gtc/constants.hpp"
|
||||
#include "./gtc/epsilon.hpp"
|
||||
#include "./gtc/half_float.hpp"
|
||||
#include "./gtc/matrix_access.hpp"
|
||||
#include "./gtc/matrix_integer.hpp"
|
||||
#include "./gtc/matrix_inverse.hpp"
|
||||
@ -100,6 +99,7 @@
|
||||
#include "./gtx/int_10_10_10_2.hpp"
|
||||
#include "./gtx/integer.hpp"
|
||||
#include "./gtx/intersect.hpp"
|
||||
#include "./gtx/io.hpp"
|
||||
#include "./gtx/log_base.hpp"
|
||||
#include "./gtx/matrix_cross_product.hpp"
|
||||
#include "./gtx/matrix_interpolation.hpp"
|
||||
|
@ -167,7 +167,7 @@ namespace detail
|
||||
return float2packed10(reinterpret_cast<uint&>(x));
|
||||
}
|
||||
|
||||
float packed10bitToFloat(glm::uint x)
|
||||
GLM_FUNC_QUALIFIER float packed10bitToFloat(glm::uint x)
|
||||
{
|
||||
if(x == 0)
|
||||
return 0.0f;
|
||||
@ -180,10 +180,10 @@ namespace detail
|
||||
return reinterpret_cast<float&>(result);
|
||||
}
|
||||
|
||||
glm::uint f11_f11_f10(float x, float y, float z)
|
||||
{
|
||||
return ((floatTo11bit(x) & ((1 << 11) - 1)) << 0) | ((floatTo11bit(y) & ((1 << 11) - 1)) << 11) | ((floatTo10bit(z) & ((1 << 10) - 1)) << 22);
|
||||
}
|
||||
// GLM_FUNC_QUALIFIER glm::uint f11_f11_f10(float x, float y, float z)
|
||||
// {
|
||||
// return ((floatTo11bit(x) & ((1 << 11) - 1)) << 0) | ((floatTo11bit(y) & ((1 << 11) - 1)) << 11) | ((floatTo10bit(z) & ((1 << 10) - 1)) << 22);
|
||||
// }
|
||||
|
||||
union u10u10u10u2
|
||||
{
|
||||
|
@ -106,6 +106,8 @@ namespace detail
|
||||
GLM_FUNC_DECL T const & operator[](int i) const;
|
||||
|
||||
// Operators
|
||||
GLM_FUNC_DECL tquat<T, P> & operator+=(tquat<T, P> const & q);
|
||||
GLM_FUNC_DECL tquat<T, P> & operator*=(tquat<T, P> const & q);
|
||||
GLM_FUNC_DECL tquat<T, P> & operator*=(T const & s);
|
||||
GLM_FUNC_DECL tquat<T, P> & operator/=(T const & s);
|
||||
};
|
||||
@ -258,25 +260,26 @@ namespace detail
|
||||
detail::tvec3<T, P> const & axis);
|
||||
|
||||
/// Returns euler angles, yitch as x, yaw as y, roll as z.
|
||||
/// The result is expressed in radians if GLM_FORCE_RADIANS is defined or degrees otherwise.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL detail::tvec3<T, P> eulerAngles(
|
||||
detail::tquat<T, P> const & x);
|
||||
|
||||
/// Returns roll value of euler angles expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise.
|
||||
/// Returns roll value of euler angles expressed in radians if GLM_FORCE_RADIANS is defined or degrees otherwise.
|
||||
///
|
||||
/// @see gtx_quaternion
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL T roll(detail::tquat<T, P> const & x);
|
||||
|
||||
/// Returns pitch value of euler angles expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise.
|
||||
/// Returns pitch value of euler angles expressed in radians if GLM_FORCE_RADIANS is defined or degrees otherwise.
|
||||
///
|
||||
/// @see gtx_quaternion
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL T pitch(detail::tquat<T, P> const & x);
|
||||
|
||||
/// Returns yaw value of euler angles expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise.
|
||||
/// Returns yaw value of euler angles expressed in radians if GLM_FORCE_RADIANS is defined or degrees otherwise.
|
||||
///
|
||||
/// @see gtx_quaternion
|
||||
template <typename T, precision P>
|
||||
|
@ -182,6 +182,34 @@ namespace detail
|
||||
//////////////////////////////////////////////////////////////
|
||||
// tquat<valType> operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator +=
|
||||
(
|
||||
tquat<T, P> const & q
|
||||
)
|
||||
{
|
||||
this->w += q.w;
|
||||
this->x += q.x;
|
||||
this->y += q.y;
|
||||
this->z += q.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator *=
|
||||
(
|
||||
tquat<T, P> const & q
|
||||
)
|
||||
{
|
||||
tquat<T, P> const p(*this);
|
||||
|
||||
this->w = p.w * q.w - p.x * q.x - p.y * q.y - p.z * q.z;
|
||||
this->x = p.w * q.x + p.x * q.w + p.y * q.z - p.z * q.y;
|
||||
this->y = p.w * q.y + p.y * q.w + p.z * q.x - p.x * q.z;
|
||||
this->z = p.w * q.z + p.z * q.w + p.x * q.y - p.y * q.x;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator *=
|
||||
(
|
||||
@ -194,7 +222,7 @@ namespace detail
|
||||
this->z *= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator /=
|
||||
(
|
||||
@ -227,11 +255,7 @@ namespace detail
|
||||
detail::tquat<T, P> const & p
|
||||
)
|
||||
{
|
||||
return detail::tquat<T, P>(
|
||||
q.w + p.w,
|
||||
q.x + p.x,
|
||||
q.y + p.y,
|
||||
q.z + p.z);
|
||||
return detail::tquat<T, P>(q) += p;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
@ -241,11 +265,7 @@ namespace detail
|
||||
detail::tquat<T, P> const & p
|
||||
)
|
||||
{
|
||||
return detail::tquat<T, P>(
|
||||
q.w * p.w - q.x * p.x - q.y * p.y - q.z * p.z,
|
||||
q.w * p.x + q.x * p.w + q.y * p.z - q.z * p.y,
|
||||
q.w * p.y + q.y * p.w + q.z * p.x - q.x * p.z,
|
||||
q.w * p.z + q.z * p.w + q.x * p.y - q.y * p.x);
|
||||
return detail::tquat<T, P>(q) *= p;
|
||||
}
|
||||
|
||||
// Transformation
|
||||
|
@ -284,7 +284,7 @@ namespace glm
|
||||
if(x < y)
|
||||
{
|
||||
T temp = x;
|
||||
while(temp != y && ulp < std::numeric_limits<std::size_t>::max())
|
||||
while(temp != y)// && ulp < std::numeric_limits<std::size_t>::max())
|
||||
{
|
||||
++ulp;
|
||||
temp = next_float(temp);
|
||||
@ -293,7 +293,7 @@ namespace glm
|
||||
else if(y < x)
|
||||
{
|
||||
T temp = y;
|
||||
while(temp != x && ulp < std::numeric_limits<std::size_t>::max())
|
||||
while(temp != x)// && ulp < std::numeric_limits<std::size_t>::max())
|
||||
{
|
||||
++ulp;
|
||||
temp = next_float(temp);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -52,9 +52,9 @@ namespace glm
|
||||
|
||||
/// Find the point on a straight line which is the closet of a point.
|
||||
/// @see gtx_closest_point
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tvec3<T, P> closestPointOnLine(
|
||||
detail::tvec3<T, P> const & point,
|
||||
detail::tvec3<T, P> const & point,
|
||||
detail::tvec3<T, P> const & a,
|
||||
detail::tvec3<T, P> const & b);
|
||||
|
||||
|
@ -12,22 +12,22 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> closestPointOnLine
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> closestPointOnLine
|
||||
(
|
||||
detail::tvec3<valType> const & point,
|
||||
detail::tvec3<valType> const & a,
|
||||
detail::tvec3<valType> const & b
|
||||
detail::tvec3<T, P> const & point,
|
||||
detail::tvec3<T, P> const & a,
|
||||
detail::tvec3<T, P> const & b
|
||||
)
|
||||
{
|
||||
valType LineLength = distance(a, b);
|
||||
detail::tvec3<valType> Vector = point - a;
|
||||
detail::tvec3<valType> LineDirection = (b - a) / LineLength;
|
||||
T LineLength = distance(a, b);
|
||||
detail::tvec3<T, P> Vector = point - a;
|
||||
detail::tvec3<T, P> LineDirection = (b - a) / LineLength;
|
||||
|
||||
// Project Vector to LineDirection to get the distance of point from a
|
||||
valType Distance = dot(Vector, LineDirection);
|
||||
T Distance = dot(Vector, LineDirection);
|
||||
|
||||
if(Distance <= valType(0)) return a;
|
||||
if(Distance <= T(0)) return a;
|
||||
if(Distance >= LineLength) return b;
|
||||
return a + LineDirection * Distance;
|
||||
}
|
||||
|
@ -1,143 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref gtx_color_cast
|
||||
/// @file glm/gtx/color_cast.hpp
|
||||
/// @date 2007-06-21 / 2011-06-07
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see core (dependence)
|
||||
/// @see gtx_number_precision (dependence)
|
||||
///
|
||||
/// @defgroup gtx_color_cast GLM_GTX_color_cast
|
||||
/// @ingroup gtx
|
||||
///
|
||||
/// @brief Conversion between two color types.
|
||||
///
|
||||
/// <glm/gtx/color_cast.hpp> need to be included to use these functionalities.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_GTX_color_cast
|
||||
#define GLM_GTX_color_cast GLM_VERSION
|
||||
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
#include "../gtx/number_precision.hpp"
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||
# pragma message("GLM: GLM_GTX_color_cast extension included")
|
||||
#endif
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup gtx_color_cast
|
||||
/// @{
|
||||
|
||||
//! Conversion of a floating value into a 8bit unsigned int value.
|
||||
/// @see gtx_color_cast
|
||||
template <typename valType>
|
||||
GLM_DEPRECATED uint8 u8channel_cast(valType a);
|
||||
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint32 u32_rgbx_cast(const detail::tvec3<T, P>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint32 u32_xrgb_cast(const detail::tvec3<T, P>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint32 u32_bgrx_cast(const detail::tvec3<T, P>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint32 u32_xbgr_cast(const detail::tvec3<T, P>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint32 u32_rgba_cast(const detail::tvec4<T, P>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint32 u32_argb_cast(const detail::tvec4<T, P>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint32 u32_bgra_cast(const detail::tvec4<T, P>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint32 u32_abgr_cast(const detail::tvec4<T, P>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint64 u64_rgbx_cast(const detail::tvec3<T, P>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint64 u64_xrgb_cast(const detail::tvec3<T, P>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint64 u64_bgrx_cast(const detail::tvec3<T, P>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint64 u64_xbgr_cast(const detail::tvec3<T, P>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint64 u64_rgba_cast(const detail::tvec4<T, P>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint64 u64_argb_cast(const detail::tvec4<T, P>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint64 u64_bgra_cast(const detail::tvec4<T, P>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED uint64 u64_abgr_cast(const detail::tvec4<T, P>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
|
||||
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f32 f32_channel_cast(T a); //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension)
|
||||
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f32vec3 f32_rgbx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f32vec3 f32_xrgb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f32vec3 f32_bgrx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f32vec3 f32_xbgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
|
||||
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f32vec4 f32_rgba_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f32vec4 f32_argb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f32vec4 f32_bgra_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f32vec4 f32_abgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
|
||||
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f64 f64_channel_cast(T a); //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension)
|
||||
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f64vec3 f64_rgbx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f64vec3 f64_xrgb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f64vec3 f64_bgrx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f64vec3 f64_xbgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
|
||||
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f64vec4 f64_rgba_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f64vec4 f64_argb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f64vec4 f64_bgra_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
|
||||
template <typename T>
|
||||
GLM_DEPRECATED f64vec4 f64_abgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "color_cast.inl"
|
||||
|
||||
#endif//GLM_GTX_color_cast
|
@ -1,733 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2007-06-21
|
||||
// Updated : 2007-08-03
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtx/color_cast.inl
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint8 u8channel_cast(T a)
|
||||
{
|
||||
return static_cast<uint8>(a * T(255));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint16 u16channel_cast(T a)
|
||||
{
|
||||
return static_cast<uint16>(a * T(65535));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint32 u32_rgbx_cast(const detail::tvec3<T, P>& c)
|
||||
{
|
||||
uint32 result = 0;
|
||||
result += static_cast<uint32>(c.x * detail::tvec3<T, P>::value_type(255)) << 0;
|
||||
result += static_cast<uint32>(c.y * detail::tvec3<T, P>::value_type(255)) << 8;
|
||||
result += static_cast<uint32>(c.z * detail::tvec3<T, P>::value_type(255)) << 16;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint32 u32_xrgb_cast(const detail::tvec3<T, P>& c)
|
||||
{
|
||||
uint32 result = 0;
|
||||
result += static_cast<uint32>(c.x * detail::tvec3<T, P>::value_type(255)) << 8;
|
||||
result += static_cast<uint32>(c.y * detail::tvec3<T, P>::value_type(255)) << 16;
|
||||
result += static_cast<uint32>(c.z * detail::tvec3<T, P>::value_type(255)) << 24;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint32 u32_bgrx_cast(const detail::tvec3<T, P>& c)
|
||||
{
|
||||
uint32 result = 0;
|
||||
result += static_cast<uint32>(c.x * detail::tvec3<T, P>::value_type(255)) << 16;
|
||||
result += static_cast<uint32>(c.y * detail::tvec3<T, P>::value_type(255)) << 8;
|
||||
result += static_cast<uint32>(c.z * detail::tvec3<T, P>::value_type(255)) << 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint32 u32_xbgr_cast(const detail::tvec3<T, P>& c)
|
||||
{
|
||||
uint32 result = 0;
|
||||
result += static_cast<uint32>(c.x * detail::tvec3<T, P>::value_type(255)) << 24;
|
||||
result += static_cast<uint32>(c.y * detail::tvec3<T, P>::value_type(255)) << 16;
|
||||
result += static_cast<uint32>(c.z * detail::tvec3<T, P>::value_type(255)) << 8;
|
||||
result += static_cast<uint32>(c.w * detail::tvec3<T, P>::value_type(255)) << 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint32 u32_rgba_cast(const detail::tvec4<T, P>& c)
|
||||
{
|
||||
uint32 result = 0;
|
||||
result += static_cast<uint32>(c.x * detail::tvec4<T, P>::value_type(255)) << 0;
|
||||
result += static_cast<uint32>(c.y * detail::tvec4<T, P>::value_type(255)) << 8;
|
||||
result += static_cast<uint32>(c.z * detail::tvec4<T, P>::value_type(255)) << 16;
|
||||
result += static_cast<uint32>(c.w * detail::tvec4<T, P>::value_type(255)) << 24;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint32 u32_argb_cast(const detail::tvec4<T, P>& c)
|
||||
{
|
||||
uint32 result = 0;
|
||||
result += static_cast<uint32>(c.x * detail::tvec4<T, P>::value_type(255)) << 8;
|
||||
result += static_cast<uint32>(c.y * detail::tvec4<T, P>::value_type(255)) << 16;
|
||||
result += static_cast<uint32>(c.z * detail::tvec4<T, P>::value_type(255)) << 24;
|
||||
result += static_cast<uint32>(c.w * detail::tvec4<T, P>::value_type(255)) << 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint32 u32_bgra_cast(const detail::tvec4<T, P>& c)
|
||||
{
|
||||
uint32 result = 0;
|
||||
result += static_cast<uint32>(c.x * detail::tvec4<T, P>::value_type(255)) << 16;
|
||||
result += static_cast<uint32>(c.y * detail::tvec4<T, P>::value_type(255)) << 8;
|
||||
result += static_cast<uint32>(c.z * detail::tvec4<T, P>::value_type(255)) << 0;
|
||||
result += static_cast<uint32>(c.w * detail::tvec4<T, P>::value_type(255)) << 24;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint32 u32_abgr_cast(const detail::tvec4<T, P>& c)
|
||||
{
|
||||
uint32 result = 0;
|
||||
result += static_cast<uint32>(c.x * detail::tvec4<T, P>::value_type(255)) << 24;
|
||||
result += static_cast<uint32>(c.y * detail::tvec4<T, P>::value_type(255)) << 16;
|
||||
result += static_cast<uint32>(c.z * detail::tvec4<T, P>::value_type(255)) << 8;
|
||||
result += static_cast<uint32>(c.w * detail::tvec4<T, P>::value_type(255)) << 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint64 u64_rgbx_cast(const detail::tvec3<T, P>& c)
|
||||
{
|
||||
uint64 result = 0;
|
||||
result += static_cast<uint64>(c.x * detail::tvec3<T, P>::value_type(65535)) << 0;
|
||||
result += static_cast<uint64>(c.y * detail::tvec3<T, P>::value_type(65535)) << 16;
|
||||
result += static_cast<uint64>(c.z * detail::tvec3<T, P>::value_type(65535)) << 32;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint64 u32_xrgb_cast(const detail::tvec3<T, P>& c)
|
||||
{
|
||||
uint64 result = 0;
|
||||
result += static_cast<uint64>(c.x * detail::tvec3<T, P>::value_type(65535)) << 16;
|
||||
result += static_cast<uint64>(c.y * detail::tvec3<T, P>::value_type(65535)) << 32;
|
||||
result += static_cast<uint64>(c.z * detail::tvec3<T, P>::value_type(65535)) << 48;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint64 u32_bgrx_cast(const detail::tvec3<T, P>& c)
|
||||
{
|
||||
uint64 result = 0;
|
||||
result += static_cast<uint64>(c.x * detail::tvec3<T, P>::value_type(65535)) << 32;
|
||||
result += static_cast<uint64>(c.y * detail::tvec3<T, P>::value_type(65535)) << 16;
|
||||
result += static_cast<uint64>(c.z * detail::tvec3<T, P>::value_type(65535)) << 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint64 u32_xbgr_cast(const detail::tvec3<T, P>& c)
|
||||
{
|
||||
uint64 result = 0;
|
||||
result += static_cast<uint64>(c.x * detail::tvec3<T, P>::value_type(65535)) << 48;
|
||||
result += static_cast<uint64>(c.y * detail::tvec3<T, P>::value_type(65535)) << 32;
|
||||
result += static_cast<uint64>(c.z * detail::tvec3<T, P>::value_type(65535)) << 16;
|
||||
result += static_cast<uint64>(c.w * detail::tvec3<T, P>::value_type(65535)) << 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint64 u64_rgba_cast(const detail::tvec4<T, P>& c)
|
||||
{
|
||||
uint64 result = 0;
|
||||
result += static_cast<uint64>(c.x * detail::tvec4<T, P>::value_type(65535)) << 0;
|
||||
result += static_cast<uint64>(c.y * detail::tvec4<T, P>::value_type(65535)) << 16;
|
||||
result += static_cast<uint64>(c.z * detail::tvec4<T, P>::value_type(65535)) << 32;
|
||||
result += static_cast<uint64>(c.w * detail::tvec4<T, P>::value_type(65535)) << 48;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint64 u64_argb_cast(const detail::tvec4<T, P>& c)
|
||||
{
|
||||
uint64 result = 0;
|
||||
result += static_cast<uint64>(c.x * detail::tvec4<T, P>::value_type(65535)) << 16;
|
||||
result += static_cast<uint64>(c.y * detail::tvec4<T, P>::value_type(65535)) << 32;
|
||||
result += static_cast<uint64>(c.z * detail::tvec4<T, P>::value_type(65535)) << 48;
|
||||
result += static_cast<uint64>(c.w * detail::tvec4<T, P>::value_type(65535)) << 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint64 u64_bgra_cast(const detail::tvec4<T, P>& c)
|
||||
{
|
||||
uint64 result = 0;
|
||||
result += static_cast<uint64>(c.x * detail::tvec4<T, P>::value_type(65535)) << 32;
|
||||
result += static_cast<uint64>(c.y * detail::tvec4<T, P>::value_type(65535)) << 16;
|
||||
result += static_cast<uint64>(c.z * detail::tvec4<T, P>::value_type(65535)) << 0;
|
||||
result += static_cast<uint64>(c.w * detail::tvec4<T, P>::value_type(65535)) << 48;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER uint64 u64_abgr_cast(const detail::tvec4<T, P>& c)
|
||||
{
|
||||
uint64 result = 0;
|
||||
result += static_cast<uint64>(c.x * detail::tvec4<T, P>::value_type(65535)) << 48;
|
||||
result += static_cast<uint64>(c.y * detail::tvec4<T, P>::value_type(65535)) << 32;
|
||||
result += static_cast<uint64>(c.z * detail::tvec4<T, P>::value_type(65535)) << 16;
|
||||
result += static_cast<uint64>(c.w * detail::tvec4<T, P>::value_type(65535)) << 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER f16 f16_channel_cast<uint32>(uint32 color)
|
||||
{
|
||||
return f16(static_cast<float>(color >> 0) / static_cast<float>(255));
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER f16vec3 f16_rgbx_cast<uint32>(uint32 color)
|
||||
{
|
||||
f16vec3 result;
|
||||
result.x = f16(static_cast<float>((color >> 0) & 0xFF) / static_cast<float>(255));
|
||||
result.y = f16(static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255));
|
||||
result.z = f16(static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER f16vec3 f16_xrgb_cast<uint32>(uint32 color)
|
||||
{
|
||||
f16vec3 result;
|
||||
result.x = f16(static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255));
|
||||
result.y = f16(static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255));
|
||||
result.z = f16(static_cast<float>((color >> 24) & 0xFF) / static_cast<float>(255));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER f16vec3 f16_bgrx_cast<uint32>(uint32 color)
|
||||
{
|
||||
f16vec3 result;
|
||||
result.x = f16(static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255));
|
||||
result.y = f16(static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255));
|
||||
result.z = f16(static_cast<float>((color >> 0) & 0xFF) / static_cast<float>(255));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER f16vec3 f16_xbgr_cast<uint32>(uint32 color)
|
||||
{
|
||||
f16vec3 result;
|
||||
result.x = f16(static_cast<float>((color >> 24) & 0xFF) / static_cast<float>(255));
|
||||
result.y = f16(static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255));
|
||||
result.z = f16(static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER f16vec4 f16_rgba_cast<uint32>(uint32 color)
|
||||
{
|
||||
f16vec4 result;
|
||||
result.x = f16(static_cast<float>((color >> 0) & 0xFF) / static_cast<float>(255));
|
||||
result.y = f16(static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255));
|
||||
result.z = f16(static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255));
|
||||
result.w = f16(static_cast<float>((color >> 24) & 0xFF) / static_cast<float>(255));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER f16vec4 f16_argb_cast<uint32>(uint32 color)
|
||||
{
|
||||
f16vec4 result;
|
||||
result.x = f16(static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255));
|
||||
result.y = f16(static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255));
|
||||
result.z = f16(static_cast<float>((color >> 24) & 0xFF) / static_cast<float>(255));
|
||||
result.w = f16(static_cast<float>((color >> 0) & 0xFF) / static_cast<float>(255));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER f16vec4 f16_bgra_cast<uint32>(uint32 color)
|
||||
{
|
||||
f16vec4 result;
|
||||
result.x = f16(static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255));
|
||||
result.y = f16(static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255));
|
||||
result.z = f16(static_cast<float>((color >> 0) & 0xFF) / static_cast<float>(255));
|
||||
result.w = f16(static_cast<float>((color >> 24) & 0xFF) / static_cast<float>(255));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER f16vec4 f16_abgr_cast<uint32>(uint32 color)
|
||||
{
|
||||
f16vec4 result;
|
||||
result.x = f16(static_cast<float>((color >> 24) & 0xFF) / static_cast<float>(255));
|
||||
result.y = f16(static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255));
|
||||
result.z = f16(static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255));
|
||||
result.w = f16(static_cast<float>((color >> 0) & 0xFF) / static_cast<float>(255));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER float f32_channel_cast<uint8>(uint8 color)
|
||||
{
|
||||
return static_cast<float>(color >> 0) / static_cast<float>(255);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<float> f32_rgbx_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec3<float> result;
|
||||
result.x = static_cast<float>((color >> 0) & 0xFF) / static_cast<float>(255);
|
||||
result.y = static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255);
|
||||
result.z = static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<float> f32_xrgb_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec3<float> result;
|
||||
result.x = static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255);
|
||||
result.y = static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255);
|
||||
result.z = static_cast<float>((color >> 24) & 0xFF) / static_cast<float>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<float> f32_bgrx_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec3<float> result;
|
||||
result.x = static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255);
|
||||
result.y = static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255);
|
||||
result.z = static_cast<float>((color >> 0) & 0xFF) / static_cast<float>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<float> f32_xbgr_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec3<float> result;
|
||||
result.x = static_cast<float>((color >> 24) & 0xFF) / static_cast<float>(255);
|
||||
result.y = static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255);
|
||||
result.z = static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<float> f32_rgba_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec4<float> result;
|
||||
result.x = static_cast<float>((color >> 0) & 0xFF) / static_cast<float>(255);
|
||||
result.y = static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255);
|
||||
result.z = static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255);
|
||||
result.w = static_cast<float>((color >> 24) & 0xFF) / static_cast<float>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<float> f32_argb_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec4<float> result;
|
||||
result.x = static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255);
|
||||
result.y = static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255);
|
||||
result.z = static_cast<float>((color >> 24) & 0xFF) / static_cast<float>(255);
|
||||
result.w = static_cast<float>((color >> 0) & 0xFF) / static_cast<float>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<float> f32_bgra_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec4<float> result;
|
||||
result.x = static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255);
|
||||
result.y = static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255);
|
||||
result.z = static_cast<float>((color >> 0) & 0xFF) / static_cast<float>(255);
|
||||
result.w = static_cast<float>((color >> 24) & 0xFF) / static_cast<float>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<float> f32_abgr_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec4<float> result;
|
||||
result.x = static_cast<float>((color >> 24) & 0xFF) / static_cast<float>(255);
|
||||
result.y = static_cast<float>((color >> 16) & 0xFF) / static_cast<float>(255);
|
||||
result.z = static_cast<float>((color >> 8) & 0xFF) / static_cast<float>(255);
|
||||
result.w = static_cast<float>((color >> 0) & 0xFF) / static_cast<float>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER double f64_channel_cast<uint8>(uint8 color)
|
||||
{
|
||||
return static_cast<double>(color >> 0) / static_cast<double>(255);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<double> f64_rgbx_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec3<double> result;
|
||||
result.x = static_cast<double>((color >> 0) & 0xFF) / static_cast<double>(255);
|
||||
result.y = static_cast<double>((color >> 8) & 0xFF) / static_cast<double>(255);
|
||||
result.z = static_cast<double>((color >> 16) & 0xFF) / static_cast<double>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<double> f64_xrgb_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec3<double> result;
|
||||
result.x = static_cast<double>((color >> 8) & 0xFF) / static_cast<double>(255);
|
||||
result.y = static_cast<double>((color >> 16) & 0xFF) / static_cast<double>(255);
|
||||
result.z = static_cast<double>((color >> 24) & 0xFF) / static_cast<double>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<double> f64_bgrx_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec3<double> result;
|
||||
result.x = static_cast<double>((color >> 16) & 0xFF) / static_cast<double>(255);
|
||||
result.y = static_cast<double>((color >> 8) & 0xFF) / static_cast<double>(255);
|
||||
result.z = static_cast<double>((color >> 0) & 0xFF) / static_cast<double>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<double> f64_xbgr_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec3<double> result;
|
||||
result.x = static_cast<double>((color >> 24) & 0xFF) / static_cast<double>(255);
|
||||
result.y = static_cast<double>((color >> 16) & 0xFF) / static_cast<double>(255);
|
||||
result.z = static_cast<double>((color >> 8) & 0xFF) / static_cast<double>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<double> f64_rgba_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec4<double> result;
|
||||
result.x = static_cast<double>((color >> 0) & 0xFF) / static_cast<double>(255);
|
||||
result.y = static_cast<double>((color >> 8) & 0xFF) / static_cast<double>(255);
|
||||
result.z = static_cast<double>((color >> 16) & 0xFF) / static_cast<double>(255);
|
||||
result.w = static_cast<double>((color >> 24) & 0xFF) / static_cast<double>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<double> f64_argb_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec4<double> result;
|
||||
result.x = static_cast<double>((color >> 8) & 0xFF) / static_cast<double>(255);
|
||||
result.y = static_cast<double>((color >> 16) & 0xFF) / static_cast<double>(255);
|
||||
result.z = static_cast<double>((color >> 24) & 0xFF) / static_cast<double>(255);
|
||||
result.w = static_cast<double>((color >> 0) & 0xFF) / static_cast<double>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<double> f64_bgra_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec4<double> result;
|
||||
result.x = static_cast<double>((color >> 16) & 0xFF) / static_cast<double>(255);
|
||||
result.y = static_cast<double>((color >> 8) & 0xFF) / static_cast<double>(255);
|
||||
result.z = static_cast<double>((color >> 0) & 0xFF) / static_cast<double>(255);
|
||||
result.w = static_cast<double>((color >> 24) & 0xFF) / static_cast<double>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<double> f64_abgr_cast<uint32>(uint32 color)
|
||||
{
|
||||
detail::tvec4<double> result;
|
||||
result.x = static_cast<double>((color >> 24) & 0xFF) / static_cast<double>(255);
|
||||
result.y = static_cast<double>((color >> 16) & 0xFF) / static_cast<double>(255);
|
||||
result.z = static_cast<double>((color >> 8) & 0xFF) / static_cast<double>(255);
|
||||
result.w = static_cast<double>((color >> 0) & 0xFF) / static_cast<double>(255);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::half f16_channel_cast<uint16>(uint16 color)
|
||||
{
|
||||
return detail::half(static_cast<float>(color >> 0) / static_cast<float>(65535));
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<detail::half> f16_rgbx_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec3<detail::half> result;
|
||||
result.x = detail::half(static_cast<float>((color >> 0) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.y = detail::half(static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.z = detail::half(static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<detail::half> f16_xrgb_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec3<detail::half> result;
|
||||
result.x = detail::half(static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.y = detail::half(static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.z = detail::half(static_cast<float>((color >> 48) & 0xFFFF) / static_cast<float>(65535));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<detail::half> f16_bgrx_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec3<detail::half> result;
|
||||
result.x = detail::half(static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.y = detail::half(static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.z = detail::half(static_cast<float>((color >> 0) & 0xFFFF) / static_cast<float>(65535));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<detail::half> f16_xbgr_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec3<detail::half> result;
|
||||
result.x = detail::half(static_cast<float>((color >> 48) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.y = detail::half(static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.z = detail::half(static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<detail::half> f16_rgba_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec4<detail::half> result;
|
||||
result.x = detail::half(static_cast<float>((color >> 0) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.y = detail::half(static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.z = detail::half(static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.w = detail::half(static_cast<float>((color >> 48) & 0xFFFF) / static_cast<float>(65535));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<detail::half> f16_argb_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec4<detail::half> result;
|
||||
result.x = detail::half(static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.y = detail::half(static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.z = detail::half(static_cast<float>((color >> 48) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.w = detail::half(static_cast<float>((color >> 0) & 0xFFFF) / static_cast<float>(65535));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<detail::half> f16_bgra_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec4<detail::half> result;
|
||||
result.x = detail::half(static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.y = detail::half(static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.z = detail::half(static_cast<float>((color >> 0) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.w = detail::half(static_cast<float>((color >> 48) & 0xFFFF) / static_cast<float>(65535));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<detail::half> f16_abgr_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec4<detail::half> result;
|
||||
result.x = detail::half(static_cast<float>((color >> 48) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.y = detail::half(static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.z = detail::half(static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535));
|
||||
result.w = detail::half(static_cast<float>((color >> 0) & 0xFFFF) / static_cast<float>(65535));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER float f32_channel_cast<uint16>(uint16 color)
|
||||
{
|
||||
return static_cast<float>(color >> 0) / static_cast<float>(65535);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<float> f32_rgbx_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec3<float> result;
|
||||
result.x = static_cast<float>((color >> 0) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.y = static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.z = static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<float> f32_xrgb_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec3<float> result;
|
||||
result.x = static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.y = static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.z = static_cast<float>((color >> 48) & 0xFFFF) / static_cast<float>(65535);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<float> f32_bgrx_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec3<float> result;
|
||||
result.x = static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.y = static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.z = static_cast<float>((color >> 0) & 0xFFFF) / static_cast<float>(65535);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<float> f32_xbgr_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec3<float> result;
|
||||
result.x = static_cast<float>((color >> 48) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.y = static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.z = static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<float> f32_rgba_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec4<float> result;
|
||||
result.x = static_cast<float>((color >> 0) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.y = static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.z = static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.w = static_cast<float>((color >> 48) & 0xFFFF) / static_cast<float>(65535);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<float> f32_argb_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec4<float> result;
|
||||
result.x = static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.y = static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.z = static_cast<float>((color >> 48) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.w = static_cast<float>((color >> 0) & 0xFFFF) / static_cast<float>(65535);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<float> f32_bgra_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec4<float> result;
|
||||
result.x = static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.y = static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.z = static_cast<float>((color >> 0) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.w = static_cast<float>((color >> 48) & 0xFFFF) / static_cast<float>(65535);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<float> f32_abgr_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec4<float> result;
|
||||
result.x = static_cast<float>((color >> 48) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.y = static_cast<float>((color >> 32) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.z = static_cast<float>((color >> 16) & 0xFFFF) / static_cast<float>(65535);
|
||||
result.w = static_cast<float>((color >> 0) & 0xFFFF) / static_cast<float>(65535);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER double f64_channel_cast<uint16>(uint16 color)
|
||||
{
|
||||
return static_cast<double>(color >> 0) / static_cast<double>(65535);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<double> f64_rgbx_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec3<double> result;
|
||||
result.x = static_cast<double>((color >> 0) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.y = static_cast<double>((color >> 16) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.z = static_cast<double>((color >> 32) & 0xFFFF) / static_cast<double>(65535);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<double> f64_xrgb_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec3<double> result;
|
||||
result.x = static_cast<double>((color >> 16) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.y = static_cast<double>((color >> 32) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.z = static_cast<double>((color >> 48) & 0xFFFF) / static_cast<double>(65535);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<double> f64_bgrx_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec3<double> result;
|
||||
result.x = static_cast<double>((color >> 32) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.y = static_cast<double>((color >> 16) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.z = static_cast<double>((color >> 0) & 0xFFFF) / static_cast<double>(65535);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<double> f64_xbgr_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec3<double> result;
|
||||
result.x = static_cast<double>((color >> 48) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.y = static_cast<double>((color >> 32) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.z = static_cast<double>((color >> 16) & 0xFFFF) / static_cast<double>(65535);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<double> f64_rgba_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec4<double> result;
|
||||
result.x = static_cast<double>((color >> 0) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.y = static_cast<double>((color >> 16) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.z = static_cast<double>((color >> 32) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.w = static_cast<double>((color >> 48) & 0xFFFF) / static_cast<double>(65535);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<double> f64_argb_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec4<double> result;
|
||||
result.x = static_cast<double>((color >> 16) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.y = static_cast<double>((color >> 32) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.z = static_cast<double>((color >> 48) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.w = static_cast<double>((color >> 0) & 0xFFFF) / static_cast<double>(65535);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<double> f64_bgra_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec4<double> result;
|
||||
result.x = static_cast<double>((color >> 32) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.y = static_cast<double>((color >> 16) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.z = static_cast<double>((color >> 0) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.w = static_cast<double>((color >> 48) & 0xFFFF) / static_cast<double>(65535);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<double> f64_abgr_cast<uint64>(uint64 color)
|
||||
{
|
||||
detail::tvec4<double> result;
|
||||
result.x = static_cast<double>((color >> 48) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.y = static_cast<double>((color >> 32) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.z = static_cast<double>((color >> 16) & 0xFFFF) / static_cast<double>(65535);
|
||||
result.w = static_cast<double>((color >> 0) & 0xFFFF) / static_cast<double>(65535);
|
||||
return result;
|
||||
}
|
||||
}//namespace glm
|
@ -52,41 +52,41 @@ namespace glm
|
||||
|
||||
/// Converts a color from HSV color space to its color in RGB color space.
|
||||
/// @see gtx_color_space
|
||||
template <typename valType>
|
||||
detail::tvec3<valType> rgbColor(
|
||||
detail::tvec3<valType> const & hsvValue);
|
||||
template <typename T, precision P>
|
||||
detail::tvec3<T, P> rgbColor(
|
||||
detail::tvec3<T, P> const & hsvValue);
|
||||
|
||||
/// Converts a color from RGB color space to its color in HSV color space.
|
||||
/// @see gtx_color_space
|
||||
template <typename valType>
|
||||
detail::tvec3<valType> hsvColor(
|
||||
detail::tvec3<valType> const & rgbValue);
|
||||
template <typename T, precision P>
|
||||
detail::tvec3<T, P> hsvColor(
|
||||
detail::tvec3<T, P> const & rgbValue);
|
||||
|
||||
/// Build a saturation matrix.
|
||||
/// @see gtx_color_space
|
||||
template <typename valType>
|
||||
detail::tmat4x4<valType> saturation(
|
||||
valType const s);
|
||||
template <typename T, precision P>
|
||||
detail::tmat4x4<T, P> saturation(
|
||||
T const s);
|
||||
|
||||
/// Modify the saturation of a color.
|
||||
/// @see gtx_color_space
|
||||
template <typename valType>
|
||||
detail::tvec3<valType> saturation(
|
||||
valType const s,
|
||||
detail::tvec3<valType> const & color);
|
||||
template <typename T, precision P>
|
||||
detail::tvec3<T, P> saturation(
|
||||
T const s,
|
||||
detail::tvec3<T, P> const & color);
|
||||
|
||||
/// Modify the saturation of a color.
|
||||
/// @see gtx_color_space
|
||||
template <typename valType>
|
||||
detail::tvec4<valType> saturation(
|
||||
valType const s,
|
||||
detail::tvec4<valType> const & color);
|
||||
template <typename T, precision P>
|
||||
detail::tvec4<T, P> saturation(
|
||||
T const s,
|
||||
detail::tvec4<T, P> const & color);
|
||||
|
||||
/// Compute color luminosity associating ratios (0.33, 0.59, 0.11) to RGB canals.
|
||||
/// @see gtx_color_space
|
||||
template <typename valType>
|
||||
valType luminosity(
|
||||
detail::tvec3<valType> const & color);
|
||||
template <typename T, precision P>
|
||||
T luminosity(
|
||||
detail::tvec3<T, P> const & color);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> rgbColor(const detail::tvec3<T, P>& hsvColor)
|
||||
{
|
||||
detail::tvec3<T, P> hsv = hsvColor;
|
||||
@ -66,7 +66,7 @@ namespace glm
|
||||
return rgbColor;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> hsvColor(const detail::tvec3<T, P>& rgbColor)
|
||||
{
|
||||
detail::tvec3<T, P> hsv = rgbColor;
|
||||
@ -75,7 +75,7 @@ namespace glm
|
||||
float Delta = Max - Min;
|
||||
|
||||
hsv.z = Max;
|
||||
|
||||
|
||||
if(Max != static_cast<T>(0))
|
||||
{
|
||||
hsv.y = Delta / hsv.z;
|
||||
@ -90,7 +90,7 @@ namespace glm
|
||||
else
|
||||
// between magenta & cyan
|
||||
h = static_cast<T>(240) + T(60) * (rgbColor.r - rgbColor.g) / Delta;
|
||||
|
||||
|
||||
if(h < T(0))
|
||||
hsv.x = h + T(360);
|
||||
else
|
||||
@ -106,7 +106,7 @@ namespace glm
|
||||
return hsv;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> saturation(const T s)
|
||||
{
|
||||
detail::tvec3<T, P> rgbw = detail::tvec3<T, P>(T(0.2126), T(0.7152), T(0.0722));
|
||||
@ -128,19 +128,19 @@ namespace glm
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> saturation(const T s, const detail::tvec3<T, P>& color)
|
||||
{
|
||||
return detail::tvec3<T, P>(saturation(s) * detail::tvec4<T, P>(color, T(0)));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> saturation(const T s, const detail::tvec4<T, P>& color)
|
||||
{
|
||||
return saturation(s) * color;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T luminosity(const detail::tvec3<T, P>& color)
|
||||
{
|
||||
const detail::tvec3<T, P> tmp = detail::tvec3<T, P>(0.33, 0.59, 0.11);
|
||||
|
@ -52,29 +52,29 @@ namespace glm
|
||||
|
||||
/// Convert a color from RGB color space to YCoCg color space.
|
||||
/// @see gtx_color_space_YCoCg
|
||||
template <typename valType>
|
||||
detail::tvec3<valType> rgb2YCoCg(
|
||||
detail::tvec3<valType> const & rgbColor);
|
||||
template <typename T, precision P>
|
||||
detail::tvec3<T, P> rgb2YCoCg(
|
||||
detail::tvec3<T, P> const & rgbColor);
|
||||
|
||||
/// Convert a color from YCoCg color space to RGB color space.
|
||||
/// @see gtx_color_space_YCoCg
|
||||
template <typename valType>
|
||||
detail::tvec3<valType> YCoCg2rgb(
|
||||
detail::tvec3<valType> const & YCoCgColor);
|
||||
template <typename T, precision P>
|
||||
detail::tvec3<T, P> YCoCg2rgb(
|
||||
detail::tvec3<T, P> const & YCoCgColor);
|
||||
|
||||
/// Convert a color from RGB color space to YCoCgR color space.
|
||||
/// @see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range"
|
||||
/// @see gtx_color_space_YCoCg
|
||||
template <typename valType>
|
||||
detail::tvec3<valType> rgb2YCoCgR(
|
||||
detail::tvec3<valType> const & rgbColor);
|
||||
template <typename T, precision P>
|
||||
detail::tvec3<T, P> rgb2YCoCgR(
|
||||
detail::tvec3<T, P> const & rgbColor);
|
||||
|
||||
/// Convert a color from YCoCgR color space to RGB color space.
|
||||
/// @see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range"
|
||||
/// @see gtx_color_space_YCoCg
|
||||
template <typename valType>
|
||||
detail::tvec3<valType> YCoCgR2rgb(
|
||||
detail::tvec3<valType> const & YCoCgColor);
|
||||
template <typename T, precision P>
|
||||
detail::tvec3<T, P> YCoCgR2rgb(
|
||||
detail::tvec3<T, P> const & YCoCgColor);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
@ -9,55 +9,55 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> rgb2YCoCg
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> rgb2YCoCg
|
||||
(
|
||||
detail::tvec3<valType> const & rgbColor
|
||||
detail::tvec3<T, P> const & rgbColor
|
||||
)
|
||||
{
|
||||
detail::tvec3<valType> result;
|
||||
result.x/*Y */ = rgbColor.r / valType(4) + rgbColor.g / valType(2) + rgbColor.b / valType(4);
|
||||
result.y/*Co*/ = rgbColor.r / valType(2) + rgbColor.g * valType(0) - rgbColor.b / valType(2);
|
||||
result.z/*Cg*/ = - rgbColor.r / valType(4) + rgbColor.g / valType(2) - rgbColor.b / valType(4);
|
||||
detail::tvec3<T, P> result;
|
||||
result.x/*Y */ = rgbColor.r / T(4) + rgbColor.g / T(2) + rgbColor.b / T(4);
|
||||
result.y/*Co*/ = rgbColor.r / T(2) + rgbColor.g * T(0) - rgbColor.b / T(2);
|
||||
result.z/*Cg*/ = - rgbColor.r / T(4) + rgbColor.g / T(2) - rgbColor.b / T(4);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> rgb2YCoCgR
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> rgb2YCoCgR
|
||||
(
|
||||
detail::tvec3<valType> const & rgbColor
|
||||
detail::tvec3<T, P> const & rgbColor
|
||||
)
|
||||
{
|
||||
detail::tvec3<valType> result;
|
||||
result.x/*Y */ = rgbColor.g / valType(2) + (rgbColor.r + rgbColor.b) / valType(4);
|
||||
detail::tvec3<T, P> result;
|
||||
result.x/*Y */ = rgbColor.g / T(2) + (rgbColor.r + rgbColor.b) / T(4);
|
||||
result.y/*Co*/ = rgbColor.r - rgbColor.b;
|
||||
result.z/*Cg*/ = rgbColor.g - (rgbColor.r + rgbColor.b) / valType(2);
|
||||
result.z/*Cg*/ = rgbColor.g - (rgbColor.r + rgbColor.b) / T(2);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> YCoCg2rgb
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> YCoCg2rgb
|
||||
(
|
||||
detail::tvec3<valType> const & YCoCgColor
|
||||
detail::tvec3<T, P> const & YCoCgColor
|
||||
)
|
||||
{
|
||||
detail::tvec3<valType> result;
|
||||
detail::tvec3<T, P> result;
|
||||
result.r = YCoCgColor.x + YCoCgColor.y - YCoCgColor.z;
|
||||
result.g = YCoCgColor.x + YCoCgColor.z;
|
||||
result.b = YCoCgColor.x - YCoCgColor.y - YCoCgColor.z;
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> YCoCgR2rgb
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> YCoCgR2rgb
|
||||
(
|
||||
detail::tvec3<valType> const & YCoCgRColor
|
||||
detail::tvec3<T, P> const & YCoCgRColor
|
||||
)
|
||||
{
|
||||
detail::tvec3<valType> result;
|
||||
valType tmp = YCoCgRColor.x - (YCoCgRColor.z / valType(2));
|
||||
detail::tvec3<T, P> result;
|
||||
T tmp = YCoCgRColor.x - (YCoCgRColor.z / T(2));
|
||||
result.g = YCoCgRColor.z + tmp;
|
||||
result.b = tmp - (YCoCgRColor.y / valType(2));
|
||||
result.b = tmp - (YCoCgRColor.y / T(2));
|
||||
result.r = result.b + YCoCgRColor.y;
|
||||
return result;
|
||||
}
|
||||
|
@ -62,29 +62,30 @@ namespace glm
|
||||
/// @{
|
||||
|
||||
template <typename T> GLM_FUNC_QUALIFIER T lerp(T x, T y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
|
||||
template <typename T> GLM_FUNC_QUALIFIER detail::tvec2<T, P> lerp(const detail::tvec2<T, P>& x, const detail::tvec2<T, P>& y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
|
||||
template <typename T> GLM_FUNC_QUALIFIER detail::tvec3<T, P> lerp(const detail::tvec3<T, P>& x, const detail::tvec3<T, P>& y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
|
||||
template <typename T> GLM_FUNC_QUALIFIER detail::tvec4<T, P> lerp(const detail::tvec4<T, P>& x, const detail::tvec4<T, P>& y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
|
||||
template <typename T> GLM_FUNC_QUALIFIER detail::tvec2<T, P> lerp(const detail::tvec2<T, P>& x, const detail::tvec2<T, P>& y, const detail::tvec2<T, P>& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
|
||||
template <typename T> GLM_FUNC_QUALIFIER detail::tvec3<T, P> lerp(const detail::tvec3<T, P>& x, const detail::tvec3<T, P>& y, const detail::tvec3<T, P>& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
|
||||
template <typename T> GLM_FUNC_QUALIFIER detail::tvec4<T, P> lerp(const detail::tvec4<T, P>& x, const detail::tvec4<T, P>& y, const detail::tvec4<T, P>& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec2<T, P> lerp(const detail::tvec2<T, P>& x, const detail::tvec2<T, P>& y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
|
||||
|
||||
template <typename T> GLM_FUNC_QUALIFIER T slerp(detail::tquat<T, P> const & x, detail::tquat<T, P> const & y, T const & a){return mix(x, y, a);} //!< \brief Returns the slurp interpolation between two quaternions.
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec3<T, P> lerp(const detail::tvec3<T, P>& x, const detail::tvec3<T, P>& y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec4<T, P> lerp(const detail::tvec4<T, P>& x, const detail::tvec4<T, P>& y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec2<T, P> lerp(const detail::tvec2<T, P>& x, const detail::tvec2<T, P>& y, const detail::tvec2<T, P>& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec3<T, P> lerp(const detail::tvec3<T, P>& x, const detail::tvec3<T, P>& y, const detail::tvec3<T, P>& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec4<T, P> lerp(const detail::tvec4<T, P>& x, const detail::tvec4<T, P>& y, const detail::tvec4<T, P>& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)
|
||||
|
||||
template <typename T> GLM_FUNC_QUALIFIER T saturate(T x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)
|
||||
template <typename T> GLM_FUNC_QUALIFIER detail::tvec2<T, P> saturate(const detail::tvec2<T, P>& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)
|
||||
template <typename T> GLM_FUNC_QUALIFIER detail::tvec3<T, P> saturate(const detail::tvec3<T, P>& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)
|
||||
template <typename T> GLM_FUNC_QUALIFIER detail::tvec4<T, P> saturate(const detail::tvec4<T, P>& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER T slerp(detail::tquat<T, P> const & x, detail::tquat<T, P> const & y, T const & a){return mix(x, y, a);} //!< \brief Returns the slurp interpolation between two quaternions.
|
||||
|
||||
template <typename T> GLM_FUNC_QUALIFIER T atan2(T x, T y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)
|
||||
template <typename T> GLM_FUNC_QUALIFIER detail::tvec2<T, P> atan2(const detail::tvec2<T, P>& x, const detail::tvec2<T, P>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)
|
||||
template <typename T> GLM_FUNC_QUALIFIER detail::tvec3<T, P> atan2(const detail::tvec3<T, P>& x, const detail::tvec3<T, P>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)
|
||||
template <typename T> GLM_FUNC_QUALIFIER detail::tvec4<T, P> atan2(const detail::tvec4<T, P>& x, const detail::tvec4<T, P>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER T saturate(T x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec2<T, P> saturate(const detail::tvec2<T, P>& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec3<T, P> saturate(const detail::tvec3<T, P>& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec4<T, P> saturate(const detail::tvec4<T, P>& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)
|
||||
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER T atan2(T x, T y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec2<T, P> atan2(const detail::tvec2<T, P>& x, const detail::tvec2<T, P>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec3<T, P> atan2(const detail::tvec3<T, P>& x, const detail::tvec3<T, P>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec4<T, P> atan2(const detail::tvec4<T, P>& x, const detail::tvec4<T, P>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)
|
||||
|
||||
template <typename genType> bool isfinite(genType const & x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
|
||||
template <typename valType> detail::tvec2<bool> isfinite(const detail::tvec2<valType>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
|
||||
template <typename valType> detail::tvec3<bool> isfinite(const detail::tvec3<valType>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
|
||||
template <typename valType> detail::tvec4<bool> isfinite(const detail::tvec4<valType>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> detail::tvec2<bool, P> isfinite(const detail::tvec2<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> detail::tvec3<bool, P> isfinite(const detail::tvec3<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> detail::tvec4<bool, P> isfinite(const detail::tvec4<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
|
||||
|
||||
typedef bool bool1; //!< \brief boolean type with 1 component. (From GLM_GTX_compatibility extension)
|
||||
typedef detail::tvec2<bool, highp> bool2; //!< \brief boolean type with 2 components. (From GLM_GTX_compatibility extension)
|
||||
|
@ -10,7 +10,7 @@
|
||||
namespace glm
|
||||
{
|
||||
// isfinite
|
||||
template <typename genType>
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER bool isfinite(
|
||||
genType const & x)
|
||||
{
|
||||
@ -27,30 +27,30 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<bool> isfinite(
|
||||
detail::tvec2<valType> const & x)
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<bool, P> isfinite(
|
||||
detail::tvec2<T, P> const & x)
|
||||
{
|
||||
return detail::tvec2<bool>(
|
||||
return detail::tvec2<bool, P>(
|
||||
isfinite(x.x),
|
||||
isfinite(x.y));
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<bool> isfinite(
|
||||
detail::tvec3<valType> const & x)
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<bool, P> isfinite(
|
||||
detail::tvec3<T, P> const & x)
|
||||
{
|
||||
return detail::tvec3<bool>(
|
||||
return detail::tvec3<bool, P>(
|
||||
isfinite(x.x),
|
||||
isfinite(x.y),
|
||||
isfinite(x.z));
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<bool> isfinite(
|
||||
detail::tvec4<valType> const & x)
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<bool, P> isfinite(
|
||||
detail::tvec4<T, P> const & x)
|
||||
{
|
||||
return detail::tvec4<bool>(
|
||||
return detail::tvec4<bool, P>(
|
||||
isfinite(x.x),
|
||||
isfinite(x.y),
|
||||
isfinite(x.z),
|
||||
|
@ -20,34 +20,34 @@ namespace glm
|
||||
return Origin + (Source - Origin) * Distance;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> extend
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> extend
|
||||
(
|
||||
detail::tvec2<valType> const & Origin,
|
||||
detail::tvec2<valType> const & Source,
|
||||
valType const & Distance
|
||||
detail::tvec2<T, P> const & Origin,
|
||||
detail::tvec2<T, P> const & Source,
|
||||
T const & Distance
|
||||
)
|
||||
{
|
||||
return Origin + (Source - Origin) * Distance;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> extend
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> extend
|
||||
(
|
||||
detail::tvec3<valType> const & Origin,
|
||||
detail::tvec3<valType> const & Source,
|
||||
valType const & Distance
|
||||
detail::tvec3<T, P> const & Origin,
|
||||
detail::tvec3<T, P> const & Source,
|
||||
T const & Distance
|
||||
)
|
||||
{
|
||||
return Origin + (Source - Origin) * Distance;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> extend
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> extend
|
||||
(
|
||||
detail::tvec4<valType> const & Origin,
|
||||
detail::tvec4<valType> const & Source,
|
||||
valType const & Distance
|
||||
detail::tvec4<T, P> const & Origin,
|
||||
detail::tvec4<T, P> const & Source,
|
||||
T const & Distance
|
||||
)
|
||||
{
|
||||
return Origin + (Source - Origin) * Distance;
|
||||
|
@ -41,7 +41,6 @@
|
||||
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
#include "../gtc/half_float.hpp"
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||
# pragma message("GLM: GLM_GTX_extented_min_max extension included")
|
||||
|
@ -52,18 +52,18 @@ namespace glm
|
||||
|
||||
//! Return if a trihedron right handed or not.
|
||||
//! From GLM_GTX_handed_coordinate_space extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
bool rightHanded(
|
||||
detail::tvec3<T, P> const & tangent,
|
||||
detail::tvec3<T, P> const & binormal,
|
||||
detail::tvec3<T, P> const & tangent,
|
||||
detail::tvec3<T, P> const & binormal,
|
||||
detail::tvec3<T, P> const & normal);
|
||||
|
||||
//! Return if a trihedron left handed or not.
|
||||
//! From GLM_GTX_handed_coordinate_space extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
bool leftHanded(
|
||||
detail::tvec3<T, P> const & tangent,
|
||||
detail::tvec3<T, P> const & binormal,
|
||||
detail::tvec3<T, P> const & tangent,
|
||||
detail::tvec3<T, P> const & binormal,
|
||||
detail::tvec3<T, P> const & normal);
|
||||
|
||||
/// @}
|
||||
|
@ -9,10 +9,10 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool rightHanded
|
||||
(
|
||||
detail::tvec3<T, P> const & tangent,
|
||||
detail::tvec3<T, P> const & tangent,
|
||||
detail::tvec3<T, P> const & binormal,
|
||||
detail::tvec3<T, P> const & normal
|
||||
)
|
||||
@ -20,11 +20,11 @@ namespace glm
|
||||
return dot(cross(normal, tangent), binormal) > T(0);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool leftHanded
|
||||
(
|
||||
detail::tvec3<T, P> const & tangent,
|
||||
detail::tvec3<T, P> const & binormal,
|
||||
detail::tvec3<T, P> const & tangent,
|
||||
detail::tvec3<T, P> const & binormal,
|
||||
detail::tvec3<T, P> const & normal
|
||||
)
|
||||
{
|
||||
|
@ -48,65 +48,66 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/*
|
||||
/// @addtogroup gtx_inertia
|
||||
/// @{
|
||||
|
||||
//! Build an inertia matrix for a box.
|
||||
//! From GLM_GTX_inertia extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat3x3<T, P> boxInertia3(
|
||||
T const & Mass,
|
||||
detail::tvec3<T, P> const & Scale);
|
||||
|
||||
//! Build an inertia matrix for a box.
|
||||
//! From GLM_GTX_inertia extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat4x4<T, P> boxInertia4(
|
||||
T const & Mass,
|
||||
detail::tvec3<T, P> const & Scale);
|
||||
|
||||
//! Build an inertia matrix for a disk.
|
||||
//! From GLM_GTX_inertia extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat3x3<T, P> diskInertia3(
|
||||
T const & Mass,
|
||||
T const & Radius);
|
||||
|
||||
//! Build an inertia matrix for a disk.
|
||||
//! From GLM_GTX_inertia extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat4x4<T, P> diskInertia4(
|
||||
T const & Mass,
|
||||
T const & Radius);
|
||||
|
||||
//! Build an inertia matrix for a ball.
|
||||
//! From GLM_GTX_inertia extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat3x3<T, P> ballInertia3(
|
||||
T const & Mass,
|
||||
T const & Radius);
|
||||
|
||||
//! Build an inertia matrix for a ball.
|
||||
//! From GLM_GTX_inertia extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat4x4<T, P> ballInertia4(
|
||||
T const & Mass,
|
||||
T const & Radius);
|
||||
|
||||
//! Build an inertia matrix for a sphere.
|
||||
//! From GLM_GTX_inertia extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat3x3<T, P> sphereInertia3(
|
||||
T const & Mass,
|
||||
T const & Radius);
|
||||
|
||||
//! Build an inertia matrix for a sphere.
|
||||
//! From GLM_GTX_inertia extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat4x4<T, P> sphereInertia4(
|
||||
T const & Mass,
|
||||
T const & Radius);
|
||||
|
||||
*/
|
||||
/// @}
|
||||
}// namespace glm
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/*
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> boxInertia3
|
||||
(
|
||||
@ -111,4 +112,5 @@ namespace glm
|
||||
Result[3][3] = static_cast<T>(1);
|
||||
return Result;
|
||||
}
|
||||
*/
|
||||
}//namespace glm
|
||||
|
159
glm/gtx/io.hpp
Normal file
159
glm/gtx/io.hpp
Normal file
@ -0,0 +1,159 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref gtx_io
|
||||
/// @file glm/gtx/io.hpp
|
||||
/// @date 2013-11-22
|
||||
/// @author Jan P Springer (regnirpsj@gmail.com)
|
||||
///
|
||||
/// @see core (dependence)
|
||||
/// @see gtx_quaternion (dependence)
|
||||
///
|
||||
/// @defgroup gtx_io GLM_GTX_io
|
||||
/// @ingroup gtx
|
||||
///
|
||||
/// @brief std::[w]ostream support for glm types
|
||||
///
|
||||
/// <glm/gtx/io.hpp> needs to be included to use these functionalities.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_GTX_io
|
||||
#define GLM_GTX_io GLM_VERSION
|
||||
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
#include "../gtx/quaternion.hpp"
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||
# pragma message("GLM: GLM_GTX_io extension included")
|
||||
#endif
|
||||
|
||||
#include <iosfwd> // std::basic_ostream<> (fwd)
|
||||
#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_;
|
||||
|
||||
};
|
||||
|
||||
enum class order_t { column_major, row_major, };
|
||||
|
||||
class format_guard {
|
||||
|
||||
public:
|
||||
|
||||
GLM_FUNC_DECL explicit format_guard();
|
||||
GLM_FUNC_DECL ~format_guard();
|
||||
|
||||
private:
|
||||
|
||||
order_t order_;
|
||||
char cr_;
|
||||
|
||||
};
|
||||
|
||||
// decimal places (dflt: 3)
|
||||
GLM_FUNC_DECL unsigned& precision();
|
||||
|
||||
// sign + value + '.' + decimals (dflt: 1 + 4 + 1 + precision())
|
||||
GLM_FUNC_DECL unsigned& value_width();
|
||||
|
||||
// matrix output order (dflt: row_major)
|
||||
GLM_FUNC_DECL order_t& order();
|
||||
|
||||
// carriage/return char (dflt: '\n')
|
||||
GLM_FUNC_DECL char& cr();
|
||||
|
||||
// matrix output order -> column_major
|
||||
GLM_FUNC_DECL std::ios_base& column_major(std::ios_base&);
|
||||
|
||||
// matrix output order -> row_major
|
||||
GLM_FUNC_DECL std::ios_base& row_major (std::ios_base&);
|
||||
|
||||
// carriage/return char -> '\n'
|
||||
GLM_FUNC_DECL std::ios_base& formatted (std::ios_base&);
|
||||
|
||||
// carriage/return char -> ' '
|
||||
GLM_FUNC_DECL std::ios_base& unformatted (std::ios_base&);
|
||||
|
||||
}//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
|
420
glm/gtx/io.inl
Normal file
420
glm/gtx/io.inl
Normal file
@ -0,0 +1,420 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-11-22
|
||||
// Updated : 2013-11-22
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtx/inl.inl
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// #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<>
|
||||
|
||||
namespace glm
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
|
||||
/* explicit */ GLM_FUNC_QUALIFIER
|
||||
precision_guard::precision_guard()
|
||||
: precision_ (precision()),
|
||||
value_width_(value_width())
|
||||
{}
|
||||
|
||||
GLM_FUNC_QUALIFIER
|
||||
precision_guard::~precision_guard()
|
||||
{
|
||||
value_width() = value_width_;
|
||||
precision() = precision_;
|
||||
}
|
||||
|
||||
/* explicit */ GLM_FUNC_QUALIFIER
|
||||
format_guard::format_guard()
|
||||
: order_(order()),
|
||||
cr_ (cr())
|
||||
{}
|
||||
|
||||
GLM_FUNC_QUALIFIER
|
||||
format_guard::~format_guard()
|
||||
{
|
||||
cr() = cr_;
|
||||
order() = order_;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER unsigned&
|
||||
precision()
|
||||
{
|
||||
static unsigned p(3);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER unsigned&
|
||||
value_width()
|
||||
{
|
||||
static unsigned p(9);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER order_t&
|
||||
order()
|
||||
{
|
||||
static order_t p(order_t::row_major);
|
||||
|
||||
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() = order_t::column_major;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER std::ios_base&
|
||||
row_major(std::ios_base& os)
|
||||
{
|
||||
order() = order_t::row_major;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER std::ios_base&
|
||||
formatted(std::ios_base& os)
|
||||
{
|
||||
cr() = '\n';
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER std::ios_base&
|
||||
unformatted(std::ios_base& os)
|
||||
{
|
||||
cr() = ' ';
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
<< ']';
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
<< ']';
|
||||
}
|
||||
|
||||
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, tvec4<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 << ','
|
||||
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.w
|
||||
<< ']';
|
||||
}
|
||||
|
||||
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, tmat2x2<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
tmat2x2<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
os << io::cr()
|
||||
<< '[' << m[0] << io::cr()
|
||||
<< ' ' << 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, tmat2x3<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
tmat3x2<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
os << io::cr()
|
||||
<< '[' << m[0] << io::cr()
|
||||
<< ' ' << m[1] << io::cr()
|
||||
<< ' ' << 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, tmat2x4<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
tmat4x2<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
os << io::cr()
|
||||
<< '[' << m[0] << io::cr()
|
||||
<< ' ' << m[1] << io::cr()
|
||||
<< ' ' << m[2] << io::cr()
|
||||
<< ' ' << 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, tmat3x2<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
tmat2x3<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
os << io::cr()
|
||||
<< '[' << m[0] << io::cr()
|
||||
<< ' ' << 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, tmat3x3<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
tmat3x3<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
os << io::cr()
|
||||
<< '[' << m[0] << io::cr()
|
||||
<< ' ' << m[1] << io::cr()
|
||||
<< ' ' << 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, tmat3x4<T,P> const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
tmat4x3<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
os << io::cr()
|
||||
<< '[' << m[0] << io::cr()
|
||||
<< ' ' << m[1] << io::cr()
|
||||
<< ' ' << m[2] << io::cr()
|
||||
<< ' ' << 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) {
|
||||
tmat2x4<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
os << io::cr()
|
||||
<< '[' << m[0] << io::cr()
|
||||
<< ' ' << 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) {
|
||||
tmat3x4<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
os << io::cr()
|
||||
<< '[' << m[0] << io::cr()
|
||||
<< ' ' << m[1] << io::cr()
|
||||
<< ' ' << 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) {
|
||||
tmat4x4<T,P> m(a);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
m = transpose(a);
|
||||
}
|
||||
|
||||
os << io::cr()
|
||||
<< '[' << m[0] << io::cr()
|
||||
<< ' ' << m[1] << io::cr()
|
||||
<< ' ' << m[2] << io::cr()
|
||||
<< ' ' << 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) {
|
||||
tmat4x4<T,P> ml(a.first);
|
||||
tmat4x4<T,P> mr(a.second);
|
||||
|
||||
if (io::order_t::row_major == io::order()) {
|
||||
ml = transpose(a.first);
|
||||
mr = transpose(a.second);
|
||||
}
|
||||
|
||||
os << io::cr()
|
||||
<< '[' << ml[0] << " [" << mr[0] << io::cr()
|
||||
<< ' ' << ml[1] << " " << mr[1] << io::cr()
|
||||
<< ' ' << ml[2] << " " << mr[2] << io::cr()
|
||||
<< ' ' << ml[3] << "] " << mr[3] << ']';
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
@ -53,13 +53,13 @@ namespace glm
|
||||
|
||||
//! Build a cross product matrix.
|
||||
//! From GLM_GTX_matrix_cross_product extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat3x3<T, P> matrixCross3(
|
||||
detail::tvec3<T, P> const & x);
|
||||
|
||||
//! Build a cross product matrix.
|
||||
//! From GLM_GTX_matrix_cross_product extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat4x4<T, P> matrixCross4(
|
||||
detail::tvec3<T, P> const & x);
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> matrixCross3
|
||||
(
|
||||
detail::tvec3<T, P> const & x
|
||||
@ -25,7 +25,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> matrixCross4
|
||||
(
|
||||
detail::tvec3<T, P> const & x
|
||||
|
@ -53,20 +53,20 @@ namespace glm
|
||||
|
||||
//! Build a row major matrix from row vectors.
|
||||
//! From GLM_GTX_matrix_major_storage extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat2x2<T, P> rowMajor2(
|
||||
detail::tvec2<T, P> const & v1,
|
||||
detail::tvec2<T, P> const & v2);
|
||||
|
||||
//! Build a row major matrix from other matrix.
|
||||
//! From GLM_GTX_matrix_major_storage extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat2x2<T, P> rowMajor2(
|
||||
detail::tmat2x2<T, P> const & m);
|
||||
|
||||
//! Build a row major matrix from row vectors.
|
||||
//! From GLM_GTX_matrix_major_storage extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat3x3<T, P> rowMajor3(
|
||||
detail::tvec3<T, P> const & v1,
|
||||
detail::tvec3<T, P> const & v2,
|
||||
@ -74,13 +74,13 @@ namespace glm
|
||||
|
||||
//! Build a row major matrix from other matrix.
|
||||
//! From GLM_GTX_matrix_major_storage extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat3x3<T, P> rowMajor3(
|
||||
detail::tmat3x3<T, P> const & m);
|
||||
|
||||
//! Build a row major matrix from row vectors.
|
||||
//! From GLM_GTX_matrix_major_storage extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat4x4<T, P> rowMajor4(
|
||||
detail::tvec4<T, P> const & v1,
|
||||
detail::tvec4<T, P> const & v2,
|
||||
@ -89,26 +89,26 @@ namespace glm
|
||||
|
||||
//! Build a row major matrix from other matrix.
|
||||
//! From GLM_GTX_matrix_major_storage extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat4x4<T, P> rowMajor4(
|
||||
detail::tmat4x4<T, P> const & m);
|
||||
|
||||
//! Build a column major matrix from column vectors.
|
||||
//! From GLM_GTX_matrix_major_storage extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat2x2<T, P> colMajor2(
|
||||
detail::tvec2<T, P> const & v1,
|
||||
detail::tvec2<T, P> const & v2);
|
||||
|
||||
//! Build a column major matrix from other matrix.
|
||||
//! From GLM_GTX_matrix_major_storage extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat2x2<T, P> colMajor2(
|
||||
detail::tmat2x2<T, P> const & m);
|
||||
|
||||
//! Build a column major matrix from column vectors.
|
||||
//! From GLM_GTX_matrix_major_storage extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat3x3<T, P> colMajor3(
|
||||
detail::tvec3<T, P> const & v1,
|
||||
detail::tvec3<T, P> const & v2,
|
||||
@ -116,13 +116,13 @@ namespace glm
|
||||
|
||||
//! Build a column major matrix from other matrix.
|
||||
//! From GLM_GTX_matrix_major_storage extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat3x3<T, P> colMajor3(
|
||||
detail::tmat3x3<T, P> const & m);
|
||||
|
||||
//! Build a column major matrix from column vectors.
|
||||
//! From GLM_GTX_matrix_major_storage extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat4x4<T, P> colMajor4(
|
||||
detail::tvec4<T, P> const & v1,
|
||||
detail::tvec4<T, P> const & v2,
|
||||
@ -131,7 +131,7 @@ namespace glm
|
||||
|
||||
//! Build a column major matrix from other matrix.
|
||||
//! From GLM_GTX_matrix_major_storage extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat4x4<T, P> colMajor4(
|
||||
detail::tmat4x4<T, P> const & m);
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat2x2<T, P> rowMajor2
|
||||
(
|
||||
detail::tvec2<T, P> const & v1,
|
||||
@ -24,7 +24,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat2x2<T, P> rowMajor2(
|
||||
const detail::tmat2x2<T, P>& m)
|
||||
{
|
||||
@ -36,7 +36,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> rowMajor3(
|
||||
const detail::tvec3<T, P>& v1,
|
||||
const detail::tvec3<T, P>& v2,
|
||||
@ -55,7 +55,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> rowMajor3(
|
||||
const detail::tmat3x3<T, P>& m)
|
||||
{
|
||||
@ -72,7 +72,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> rowMajor4(
|
||||
const detail::tvec4<T, P>& v1,
|
||||
const detail::tvec4<T, P>& v2,
|
||||
@ -99,7 +99,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> rowMajor4(
|
||||
const detail::tmat4x4<T, P>& m)
|
||||
{
|
||||
@ -123,7 +123,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat2x2<T, P> colMajor2(
|
||||
const detail::tvec2<T, P>& v1,
|
||||
const detail::tvec2<T, P>& v2)
|
||||
@ -131,14 +131,14 @@ namespace glm
|
||||
return detail::tmat2x2<T, P>(v1, v2);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat2x2<T, P> colMajor2(
|
||||
const detail::tmat2x2<T, P>& m)
|
||||
{
|
||||
return detail::tmat2x2<T, P>(m);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> colMajor3(
|
||||
const detail::tvec3<T, P>& v1,
|
||||
const detail::tvec3<T, P>& v2,
|
||||
@ -147,14 +147,14 @@ namespace glm
|
||||
return detail::tmat3x3<T, P>(v1, v2, v3);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> colMajor3(
|
||||
const detail::tmat3x3<T, P>& m)
|
||||
{
|
||||
return detail::tmat3x3<T, P>(m);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> colMajor4(
|
||||
const detail::tvec4<T, P>& v1,
|
||||
const detail::tvec4<T, P>& v2,
|
||||
@ -164,7 +164,7 @@ namespace glm
|
||||
return detail::tmat4x4<T, P>(v1, v2, v3, v4);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> colMajor4(
|
||||
const detail::tmat4x4<T, P>& m)
|
||||
{
|
||||
|
@ -52,57 +52,57 @@ namespace glm
|
||||
|
||||
//! Build a diagonal matrix.
|
||||
//! From GLM_GTX_matrix_operation extension.
|
||||
template <typename valType>
|
||||
detail::tmat2x2<valType> diagonal2x2(
|
||||
detail::tvec2<valType> const & v);
|
||||
template <typename T, precision P>
|
||||
detail::tmat2x2<T, P> diagonal2x2(
|
||||
detail::tvec2<T, P> const & v);
|
||||
|
||||
//! Build a diagonal matrix.
|
||||
//! From GLM_GTX_matrix_operation extension.
|
||||
template <typename valType>
|
||||
detail::tmat2x3<valType> diagonal2x3(
|
||||
detail::tvec2<valType> const & v);
|
||||
template <typename T, precision P>
|
||||
detail::tmat2x3<T, P> diagonal2x3(
|
||||
detail::tvec2<T, P> const & v);
|
||||
|
||||
//! Build a diagonal matrix.
|
||||
//! From GLM_GTX_matrix_operation extension.
|
||||
template <typename valType>
|
||||
detail::tmat2x4<valType> diagonal2x4(
|
||||
detail::tvec2<valType> const & v);
|
||||
template <typename T, precision P>
|
||||
detail::tmat2x4<T, P> diagonal2x4(
|
||||
detail::tvec2<T, P> const & v);
|
||||
|
||||
//! Build a diagonal matrix.
|
||||
//! From GLM_GTX_matrix_operation extension.
|
||||
template <typename valType>
|
||||
detail::tmat3x2<valType> diagonal3x2(
|
||||
detail::tvec2<valType> const & v);
|
||||
template <typename T, precision P>
|
||||
detail::tmat3x2<T, P> diagonal3x2(
|
||||
detail::tvec2<T, P> const & v);
|
||||
|
||||
//! Build a diagonal matrix.
|
||||
//! From GLM_GTX_matrix_operation extension.
|
||||
template <typename valType>
|
||||
detail::tmat3x3<valType> diagonal3x3(
|
||||
detail::tvec3<valType> const & v);
|
||||
template <typename T, precision P>
|
||||
detail::tmat3x3<T, P> diagonal3x3(
|
||||
detail::tvec3<T, P> const & v);
|
||||
|
||||
//! Build a diagonal matrix.
|
||||
//! From GLM_GTX_matrix_operation extension.
|
||||
template <typename valType>
|
||||
detail::tmat3x4<valType> diagonal3x4(
|
||||
detail::tvec3<valType> const & v);
|
||||
template <typename T, precision P>
|
||||
detail::tmat3x4<T, P> diagonal3x4(
|
||||
detail::tvec3<T, P> const & v);
|
||||
|
||||
//! Build a diagonal matrix.
|
||||
//! From GLM_GTX_matrix_operation extension.
|
||||
template <typename valType>
|
||||
detail::tmat4x2<valType> diagonal4x2(
|
||||
detail::tvec2<valType> const & v);
|
||||
template <typename T, precision P>
|
||||
detail::tmat4x2<T, P> diagonal4x2(
|
||||
detail::tvec2<T, P> const & v);
|
||||
|
||||
//! Build a diagonal matrix.
|
||||
//! From GLM_GTX_matrix_operation extension.
|
||||
template <typename valType>
|
||||
detail::tmat4x3<valType> diagonal4x3(
|
||||
detail::tvec3<valType> const & v);
|
||||
template <typename T, precision P>
|
||||
detail::tmat4x3<T, P> diagonal4x3(
|
||||
detail::tvec3<T, P> const & v);
|
||||
|
||||
//! Build a diagonal matrix.
|
||||
//! From GLM_GTX_matrix_operation extension.
|
||||
template <typename valType>
|
||||
detail::tmat4x4<valType> diagonal4x4(
|
||||
detail::tvec4<valType> const & v);
|
||||
template <typename T, precision P>
|
||||
detail::tmat4x4<T, P> diagonal4x4(
|
||||
detail::tvec4<T, P> const & v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
@ -9,87 +9,87 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat2x2<valType> diagonal2x2
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat2x2<T, P> diagonal2x2
|
||||
(
|
||||
detail::tvec2<valType> const & v
|
||||
detail::tvec2<T, P> const & v
|
||||
)
|
||||
{
|
||||
detail::tmat2x2<valType> Result(valType(1));
|
||||
detail::tmat2x2<T, P> Result(static_cast<T>(1));
|
||||
Result[0][0] = v[0];
|
||||
Result[1][1] = v[1];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat2x3<valType> diagonal2x3
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat2x3<T, P> diagonal2x3
|
||||
(
|
||||
detail::tvec2<valType> const & v
|
||||
detail::tvec2<T, P> const & v
|
||||
)
|
||||
{
|
||||
detail::tmat2x3<valType> Result(valType(1));
|
||||
detail::tmat2x3<T, P> Result(static_cast<T>(1));
|
||||
Result[0][0] = v[0];
|
||||
Result[1][1] = v[1];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat2x4<valType> diagonal2x4
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat2x4<T, P> diagonal2x4
|
||||
(
|
||||
detail::tvec2<valType> const & v
|
||||
detail::tvec2<T, P> const & v
|
||||
)
|
||||
{
|
||||
detail::tmat2x4<valType> Result(valType(1));
|
||||
detail::tmat2x4<T, P> Result(static_cast<T>(1));
|
||||
Result[0][0] = v[0];
|
||||
Result[1][1] = v[1];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x2<valType> diagonal3x2
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x2<T, P> diagonal3x2
|
||||
(
|
||||
detail::tvec2<valType> const & v
|
||||
detail::tvec2<T, P> const & v
|
||||
)
|
||||
{
|
||||
detail::tmat3x2<valType> Result(valType(1));
|
||||
detail::tmat3x2<T, P> Result(static_cast<T>(1));
|
||||
Result[0][0] = v[0];
|
||||
Result[1][1] = v[1];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<valType> diagonal3x3
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> diagonal3x3
|
||||
(
|
||||
detail::tvec3<valType> const & v
|
||||
detail::tvec3<T, P> const & v
|
||||
)
|
||||
{
|
||||
detail::tmat3x3<valType> Result(valType(1));
|
||||
detail::tmat3x3<T, P> Result(static_cast<T>(1));
|
||||
Result[0][0] = v[0];
|
||||
Result[1][1] = v[1];
|
||||
Result[2][2] = v[2];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x4<valType> diagonal3x4
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x4<T, P> diagonal3x4
|
||||
(
|
||||
detail::tvec3<valType> const & v
|
||||
detail::tvec3<T, P> const & v
|
||||
)
|
||||
{
|
||||
detail::tmat3x4<valType> Result(valType(1));
|
||||
detail::tmat3x4<T, P> Result(static_cast<T>(1));
|
||||
Result[0][0] = v[0];
|
||||
Result[1][1] = v[1];
|
||||
Result[2][2] = v[2];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> diagonal4x4
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> diagonal4x4
|
||||
(
|
||||
detail::tvec4<valType> const & v
|
||||
detail::tvec4<T, P> const & v
|
||||
)
|
||||
{
|
||||
detail::tmat4x4<valType> Result(valType(1));
|
||||
detail::tmat4x4<T, P> Result(static_cast<T>(1));
|
||||
Result[0][0] = v[0];
|
||||
Result[1][1] = v[1];
|
||||
Result[2][2] = v[2];
|
||||
@ -97,26 +97,26 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x3<valType> diagonal4x3
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x3<T, P> diagonal4x3
|
||||
(
|
||||
detail::tvec3<valType> const & v
|
||||
detail::tvec3<T, P> const & v
|
||||
)
|
||||
{
|
||||
detail::tmat4x3<valType> Result(valType(1));
|
||||
detail::tmat4x3<T, P> Result(static_cast<T>(1));
|
||||
Result[0][0] = v[0];
|
||||
Result[1][1] = v[1];
|
||||
Result[2][2] = v[2];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x2<valType> diagonal4x2
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x2<T, P> diagonal4x2
|
||||
(
|
||||
detail::tvec2<valType> const & v
|
||||
detail::tvec2<T, P> const & v
|
||||
)
|
||||
{
|
||||
detail::tmat4x2<valType> Result(valType(1));
|
||||
detail::tmat4x2<T, P> Result(static_cast<T>(1));
|
||||
Result[0][0] = v[0];
|
||||
Result[1][1] = v[1];
|
||||
return Result;
|
||||
|
@ -53,9 +53,9 @@ namespace glm
|
||||
/// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension)
|
||||
template <typename valType>
|
||||
valType mixedProduct(
|
||||
detail::tvec3<valType> const & v1,
|
||||
detail::tvec3<valType> const & v2,
|
||||
detail::tvec3<valType> const & v3);
|
||||
detail::tvec3<T, P> const & v1,
|
||||
detail::tvec3<T, P> const & v2,
|
||||
detail::tvec3<T, P> const & v3);
|
||||
|
||||
/// @}
|
||||
}// namespace glm
|
||||
|
@ -12,9 +12,9 @@ namespace glm
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER valType mixedProduct
|
||||
(
|
||||
detail::tvec3<valType> const & v1,
|
||||
detail::tvec3<valType> const & v2,
|
||||
detail::tvec3<valType> const & v3
|
||||
detail::tvec3<T, P> const & v1,
|
||||
detail::tvec3<T, P> const & v2,
|
||||
detail::tvec3<T, P> const & v3
|
||||
)
|
||||
{
|
||||
return dot(cross(v1, v2), v3);
|
||||
|
@ -10,8 +10,45 @@
|
||||
// - GLM core
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <bool Signed>
|
||||
struct higherMultiple
|
||||
{
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType operator()
|
||||
(
|
||||
genType const & Source,
|
||||
genType const & Multiple
|
||||
)
|
||||
{
|
||||
if (Source > genType(0))
|
||||
{
|
||||
genType Tmp = Source - genType(1);
|
||||
return Tmp + (Multiple - (Tmp % Multiple));
|
||||
}
|
||||
else
|
||||
return Source + (-Source % Multiple);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct higherMultiple<false>
|
||||
{
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType operator()
|
||||
(
|
||||
genType const & Source,
|
||||
genType const & Multiple
|
||||
)
|
||||
{
|
||||
genType Tmp = Source - genType(1);
|
||||
return Tmp + (Multiple - (Tmp % Multiple));
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
//////////////////////
|
||||
// higherMultiple
|
||||
|
||||
@ -22,13 +59,8 @@ namespace glm
|
||||
genType const & Multiple
|
||||
)
|
||||
{
|
||||
if (Source > genType(0))
|
||||
{
|
||||
genType Tmp = Source - genType(1);
|
||||
return Tmp + (Multiple - (Tmp % Multiple));
|
||||
}
|
||||
else
|
||||
return Source + (-Source % Multiple);
|
||||
detail::higherMultiple<std::numeric_limits<genType>::is_signed> Compute;
|
||||
return Compute(Source, Multiple);
|
||||
}
|
||||
|
||||
template <>
|
||||
|
@ -22,11 +22,11 @@ namespace glm
|
||||
glm::dot(y, y));
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER valType normalizeDot
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T normalizeDot
|
||||
(
|
||||
detail::tvec2<valType> const & x,
|
||||
detail::tvec2<valType> const & y
|
||||
detail::tvec2<T, P> const & x,
|
||||
detail::tvec2<T, P> const & y
|
||||
)
|
||||
{
|
||||
return
|
||||
@ -35,11 +35,11 @@ namespace glm
|
||||
glm::dot(y, y));
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER valType normalizeDot
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T normalizeDot
|
||||
(
|
||||
detail::tvec3<valType> const & x,
|
||||
detail::tvec3<valType> const & y
|
||||
detail::tvec3<T, P> const & x,
|
||||
detail::tvec3<T, P> const & y
|
||||
)
|
||||
{
|
||||
return
|
||||
@ -48,11 +48,11 @@ namespace glm
|
||||
glm::dot(y, y));
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER valType normalizeDot
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T normalizeDot
|
||||
(
|
||||
detail::tvec4<valType> const & x,
|
||||
detail::tvec4<valType> const & y
|
||||
detail::tvec4<T, P> const & x,
|
||||
detail::tvec4<T, P> const & y
|
||||
)
|
||||
{
|
||||
return
|
||||
@ -74,11 +74,11 @@ namespace glm
|
||||
glm::dot(y, y));
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER valType fastNormalizeDot
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T fastNormalizeDot
|
||||
(
|
||||
detail::tvec2<valType> const & x,
|
||||
detail::tvec2<valType> const & y
|
||||
detail::tvec2<T, P> const & x,
|
||||
detail::tvec2<T, P> const & y
|
||||
)
|
||||
{
|
||||
return
|
||||
@ -87,11 +87,11 @@ namespace glm
|
||||
glm::dot(y, y));
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER valType fastNormalizeDot
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T fastNormalizeDot
|
||||
(
|
||||
detail::tvec3<valType> const & x,
|
||||
detail::tvec3<valType> const & y
|
||||
detail::tvec3<T, P> const & x,
|
||||
detail::tvec3<T, P> const & y
|
||||
)
|
||||
{
|
||||
return
|
||||
@ -100,11 +100,11 @@ namespace glm
|
||||
glm::dot(y, y));
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER valType fastNormalizeDot
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T fastNormalizeDot
|
||||
(
|
||||
detail::tvec4<valType> const & x,
|
||||
detail::tvec4<valType> const & y
|
||||
detail::tvec4<T, P> const & x,
|
||||
detail::tvec4<T, P> const & y
|
||||
)
|
||||
{
|
||||
return
|
||||
|
@ -53,14 +53,14 @@ namespace glm
|
||||
/// Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude.
|
||||
///
|
||||
/// @see gtx_polar_coordinates
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tvec3<T, P> polar(
|
||||
detail::tvec3<T, P> const & euclidean);
|
||||
|
||||
/// Convert Polar to Euclidean coordinates.
|
||||
///
|
||||
/// @see gtx_polar_coordinates
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tvec3<T, P> euclidean(
|
||||
detail::tvec2<T, P> const & polar);
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> polar
|
||||
(
|
||||
detail::tvec3<T, P> const & euclidean
|
||||
@ -32,7 +32,7 @@ namespace glm
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> euclidean
|
||||
(
|
||||
detail::tvec2<T, P> const & polar
|
||||
|
@ -54,7 +54,7 @@ namespace glm
|
||||
|
||||
//! Transforms a matrix with a shearing on X axis.
|
||||
//! From GLM_GTX_transform2 extension.
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
detail::tmat3x3<T, P> shearX2D(
|
||||
detail::tmat3x3<T, P> const & m,
|
||||
T y);
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> shearX2D(
|
||||
const detail::tmat3x3<T, P>& m,
|
||||
T s)
|
||||
@ -19,7 +19,7 @@ namespace glm
|
||||
return m * r;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> shearY2D(
|
||||
const detail::tmat3x3<T, P>& m,
|
||||
T s)
|
||||
@ -29,7 +29,7 @@ namespace glm
|
||||
return m * r;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> shearX3D(
|
||||
const detail::tmat4x4<T, P>& m,
|
||||
T s,
|
||||
@ -41,7 +41,7 @@ namespace glm
|
||||
return m * r;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> shearY3D(
|
||||
const detail::tmat4x4<T, P>& m,
|
||||
T s,
|
||||
@ -53,7 +53,7 @@ namespace glm
|
||||
return m * r;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> shearZ3D(
|
||||
const detail::tmat4x4<T, P>& m,
|
||||
T s,
|
||||
@ -65,7 +65,7 @@ namespace glm
|
||||
return m * r;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> reflect2D(
|
||||
const detail::tmat3x3<T, P>& m,
|
||||
const detail::tvec3<T, P>& normal)
|
||||
@ -78,7 +78,7 @@ namespace glm
|
||||
return m * r;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> reflect3D(
|
||||
const detail::tmat4x4<T, P>& m,
|
||||
const detail::tvec3<T, P>& normal)
|
||||
@ -98,7 +98,7 @@ namespace glm
|
||||
return m * r;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> proj2D(
|
||||
const detail::tmat3x3<T, P>& m,
|
||||
const detail::tvec3<T, P>& normal)
|
||||
@ -111,7 +111,7 @@ namespace glm
|
||||
return m * r;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> proj3D(
|
||||
const detail::tmat4x4<T, P>& m,
|
||||
const detail::tvec3<T, P>& normal)
|
||||
@ -129,7 +129,7 @@ namespace glm
|
||||
return m * r;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> scaleBias(
|
||||
T scale,
|
||||
T bias)
|
||||
@ -142,7 +142,7 @@ namespace glm
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> scaleBias(
|
||||
const detail::tmat4x4<T, P>& m,
|
||||
T scale,
|
||||
|
@ -54,7 +54,7 @@ namespace glm
|
||||
/// @see gtx_vector_access extension.
|
||||
template <typename valType>
|
||||
void set(
|
||||
detail::tvec2<valType> & v,
|
||||
detail::tvec2<T, P> & v,
|
||||
valType const & x,
|
||||
valType const & y);
|
||||
|
||||
@ -62,7 +62,7 @@ namespace glm
|
||||
/// @see gtx_vector_access extension.
|
||||
template <typename valType>
|
||||
void set(
|
||||
detail::tvec3<valType> & v,
|
||||
detail::tvec3<T, P> & v,
|
||||
valType const & x,
|
||||
valType const & y,
|
||||
valType const & z);
|
||||
@ -71,7 +71,7 @@ namespace glm
|
||||
/// @see gtx_vector_access extension.
|
||||
template <typename valType>
|
||||
void set(
|
||||
detail::tvec4<valType> & v,
|
||||
detail::tvec4<T, P> & v,
|
||||
valType const & x,
|
||||
valType const & y,
|
||||
valType const & z,
|
||||
|
@ -12,7 +12,7 @@ namespace glm
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER void set
|
||||
(
|
||||
detail::tvec2<valType>& v,
|
||||
detail::tvec2<T, P>& v,
|
||||
valType const & x,
|
||||
valType const & y
|
||||
)
|
||||
@ -24,7 +24,7 @@ namespace glm
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER void set
|
||||
(
|
||||
detail::tvec3<valType>& v,
|
||||
detail::tvec3<T, P>& v,
|
||||
valType const & x,
|
||||
valType const & y,
|
||||
valType const & z
|
||||
@ -38,7 +38,7 @@ namespace glm
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER void set
|
||||
(
|
||||
detail::tvec4<valType>& v,
|
||||
detail::tvec4<T, P>& v,
|
||||
valType const & x,
|
||||
valType const & y,
|
||||
valType const & z,
|
||||
|
@ -69,6 +69,7 @@ GLM 0.9.5.0: 2013-XX-XX
|
||||
- Added C++11 initializer lists
|
||||
- Fixed umulExtended and imulExtended implementations for vector types (#76)
|
||||
- Fixed CUDA coverage for GTC extensions
|
||||
- Added GTX_io extension
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.4.6: 2013-09-20
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <glm/core/type_vec3.hpp>
|
||||
#include <glm/core/type_vec4.hpp>
|
||||
#include <glm/core/func_vector_relational.hpp>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <vector>
|
||||
|
||||
@ -317,7 +318,7 @@ int test_vec4_perf_AoS(std::size_t Size)
|
||||
|
||||
std::clock_t EndTime = std::clock();
|
||||
|
||||
printf("AoS: %d\n", EndTime - StartTime);
|
||||
std::printf("AoS: %d\n", EndTime - StartTime);
|
||||
|
||||
return Error;
|
||||
}
|
||||
@ -356,7 +357,7 @@ int test_vec4_perf_SoA(std::size_t Size)
|
||||
|
||||
std::clock_t EndTime = std::clock();
|
||||
|
||||
printf("SoA: %d\n", EndTime - StartTime);
|
||||
std::printf("SoA: %d\n", EndTime - StartTime);
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
@ -210,6 +210,15 @@ int test_quat_mul()
|
||||
glm::quat temp5 = glm::normalize(temp1 * temp2);
|
||||
glm::vec3 temp6 = temp5 * glm::vec3(0.0, 1.0, 0.0) * glm::inverse(temp5);
|
||||
|
||||
{
|
||||
glm::quat temp7;
|
||||
|
||||
temp7 *= temp5;
|
||||
temp7 *= glm::inverse(temp5);
|
||||
|
||||
Error += temp7 != glm::quat();
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,38 @@
|
||||
glmCreateTestGTC(gtx_associated_min_max)
|
||||
glmCreateTestGTC(gtx_bit)
|
||||
glmCreateTestGTC(gtx_closest_point)
|
||||
glmCreateTestGTC(gtx_color_space_YCoCg)
|
||||
glmCreateTestGTC(gtx_color_space)
|
||||
glmCreateTestGTC(gtx_compatibility)
|
||||
glmCreateTestGTC(gtx_component_wise)
|
||||
glmCreateTestGTC(gtx_euler_angle)
|
||||
glmCreateTestGTC(gtx_extend)
|
||||
glmCreateTestGTC(gtx_extented_min_max)
|
||||
glmCreateTestGTC(gtx_fast_exponential)
|
||||
glmCreateTestGTC(gtx_fast_square_root)
|
||||
glmCreateTestGTC(gtx_fast_trigonometry)
|
||||
glmCreateTestGTC(gtx_gradient_paint)
|
||||
glmCreateTestGTC(gtx_handed_coordinate_space)
|
||||
glmCreateTestGTC(gtx_inertia)
|
||||
glmCreateTestGTC(gtx_integer)
|
||||
glmCreateTestGTC(gtx_intersect)
|
||||
glmCreateTestGTC(gtx_io)
|
||||
glmCreateTestGTC(gtx_log_base)
|
||||
glmCreateTestGTC(gtx_matrix_cross_product)
|
||||
glmCreateTestGTC(gtx_matrix_interpolation)
|
||||
glmCreateTestGTC(gtx_matrix_major_storage)
|
||||
glmCreateTestGTC(gtx_matrix_operation)
|
||||
glmCreateTestGTC(gtx_matrix_query)
|
||||
glmCreateTestGTC(gtx_multiple)
|
||||
glmCreateTestGTC(gtx_norm)
|
||||
glmCreateTestGTC(gtx_normal)
|
||||
glmCreateTestGTC(gtx_normalize_dot)
|
||||
glmCreateTestGTC(gtx_number_precision)
|
||||
glmCreateTestGTC(gtx_orthonormalize)
|
||||
glmCreateTestGTC(gtx_optimum_pow)
|
||||
glmCreateTestGTC(gtx_perpendicular)
|
||||
glmCreateTestGTC(gtx_polar_coordinates)
|
||||
glmCreateTestGTC(gtx_projection)
|
||||
glmCreateTestGTC(gtx_quaternion)
|
||||
glmCreateTestGTC(gtx_dual_quaternion)
|
||||
glmCreateTestGTC(gtx_rotate_normalized_axis)
|
||||
@ -12,6 +40,7 @@ glmCreateTestGTC(gtx_rotate_vector)
|
||||
glmCreateTestGTC(gtx_scalar_relational)
|
||||
glmCreateTestGTC(gtx_simd_vec4)
|
||||
glmCreateTestGTC(gtx_simd_mat4)
|
||||
glmCreateTestGTC(gtx_spline)
|
||||
glmCreateTestGTC(gtx_string_cast)
|
||||
glmCreateTestGTC(gtx_vector_angle)
|
||||
glmCreateTestGTC(gtx_vector_query)
|
||||
|
21
test/gtx/gtx_associated_min_max.cpp
Normal file
21
test/gtx/gtx_associated_min_max.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/associated_min_max.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/associated_min_max.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
21
test/gtx/gtx_closest_point.cpp
Normal file
21
test/gtx/gtx_closest_point.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/associated_min_max.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/associated_min_max.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
21
test/gtx/gtx_color_space.cpp
Normal file
21
test/gtx/gtx_color_space.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/color_space.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/color_space.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
21
test/gtx/gtx_color_space_YCoCg.cpp
Normal file
21
test/gtx/gtx_color_space_YCoCg.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/color_space_YCoCg.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/color_space_YCoCg.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_compatibility.cpp
Normal file
19
test/gtx/gtx_compatibility.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/compatibility.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/compatibility.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
21
test/gtx/gtx_component_wise.cpp
Normal file
21
test/gtx/gtx_component_wise.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/component_wise.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/component_wise.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_extend.cpp
Normal file
19
test/gtx/gtx_extend.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/extend.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/extend.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
21
test/gtx/gtx_extented_min_max.cpp
Normal file
21
test/gtx/gtx_extented_min_max.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/associated_min_max.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/associated_min_max.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_fast_exponential.cpp
Normal file
19
test/gtx/gtx_fast_exponential.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/associated_min_max.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/fast_exponential.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_fast_square_root.cpp
Normal file
19
test/gtx/gtx_fast_square_root.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/fast_square_root.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/fast_square_root.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_fast_trigonometry.cpp
Normal file
19
test/gtx/gtx_fast_trigonometry.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/fast_trigonometry.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/fast_trigonometry.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_handed_coordinate_space.cpp
Normal file
19
test/gtx/gtx_handed_coordinate_space.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/handed_coordinate_space.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/handed_coordinate_space.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_inertia.cpp
Normal file
19
test/gtx/gtx_inertia.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/inertia.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/inertia.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
21
test/gtx/gtx_int_10_10_10_2.cpp
Normal file
21
test/gtx/gtx_int_10_10_10_2.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/associated_min_max.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/associated_min_max.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_intersect.cpp
Normal file
19
test/gtx/gtx_intersect.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/intersect.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/intersect.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
140
test/gtx/gtx_io.cpp
Normal file
140
test/gtx/gtx_io.cpp
Normal file
@ -0,0 +1,140 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-11-22
|
||||
// Updated : 2013-11-22
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/io.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/io.hpp>
|
||||
#include <iostream>
|
||||
#include <typeinfo>
|
||||
|
||||
namespace {
|
||||
|
||||
template <typename CTy, typename CTr>
|
||||
std::basic_ostream<CTy,CTr>&
|
||||
operator<<(std::basic_ostream<CTy,CTr>& os, glm::precision const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
|
||||
if (cerberus) {
|
||||
switch (a) {
|
||||
case glm::highp: os << "hi"; break;
|
||||
case glm::mediump: os << "md"; break;
|
||||
case glm::lowp: os << "lo"; break;
|
||||
}
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace {
|
||||
|
||||
template <typename T, glm::precision P, typename OS>
|
||||
int test_io_vec(OS& os)
|
||||
{
|
||||
os << '\n'
|
||||
<< typeid(OS).name()
|
||||
<< '\n';
|
||||
|
||||
glm::detail::tvec2<T,P> const v2(0, 1);
|
||||
glm::detail::tvec3<T,P> const v3(2, 3, 4);
|
||||
glm::detail::tvec4<T,P> const v4(5, 6, 7, 8);
|
||||
|
||||
os << "vec2<" << typeid(T).name() << ',' << P << ">: " << v2 << '\n'
|
||||
<< "vec3<" << typeid(T).name() << ',' << P << ">: " << v3 << '\n'
|
||||
<< "vec4<" << typeid(T).name() << ',' << P << ">: " << v4 << '\n';
|
||||
|
||||
glm::io::precision_guard const iopg;
|
||||
|
||||
glm::io::precision() = 2;
|
||||
glm::io::value_width() = 1 + 2 + 1 + glm::io::precision();
|
||||
|
||||
os << "vec2<" << typeid(T).name() << ',' << P << ">: " << v2 << '\n'
|
||||
<< "vec3<" << typeid(T).name() << ',' << P << ">: " << v3 << '\n'
|
||||
<< "vec4<" << typeid(T).name() << ',' << P << ">: " << v4 << '\n';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename T, glm::precision P, typename OS>
|
||||
int test_io_mat(OS& os)
|
||||
{
|
||||
os << '\n'
|
||||
<< typeid(OS).name()
|
||||
<< '\n';
|
||||
|
||||
glm::detail::tvec2<T,P> const v2_1( 0, 1);
|
||||
glm::detail::tvec2<T,P> const v2_2( 2, 3);
|
||||
glm::detail::tvec2<T,P> const v2_3( 4, 5);
|
||||
glm::detail::tvec2<T,P> const v2_4( 6, 7);
|
||||
glm::detail::tvec3<T,P> const v3_1( 8, 9, 10);
|
||||
glm::detail::tvec3<T,P> const v3_2(11, 12, 13);
|
||||
glm::detail::tvec3<T,P> const v3_3(14, 15, 16);
|
||||
glm::detail::tvec3<T,P> const v3_4(17, 18, 19);
|
||||
glm::detail::tvec4<T,P> const v4_1(20, 21, 22, 23);
|
||||
glm::detail::tvec4<T,P> const v4_2(24, 25, 26, 27);
|
||||
glm::detail::tvec4<T,P> const v4_3(28, 29, 30, 31);
|
||||
glm::detail::tvec4<T,P> const v4_4(32, 33, 34, 35);
|
||||
|
||||
#if 0
|
||||
os << "mat2x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x2<T,P>(v2_1, v2_2) << '\n'
|
||||
<< "mat2x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x3<T,P>(v3_1, v3_2) << '\n'
|
||||
<< "mat2x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x4<T,P>(v4_1, v4_2) << '\n'
|
||||
<< "mat3x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x2<T,P>(v2_1, v2_2, v2_3) << '\n'
|
||||
<< "mat3x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x3<T,P>(v3_1, v3_2, v3_3) << '\n'
|
||||
<< "mat3x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x4<T,P>(v4_1, v4_2, v4_3) << '\n'
|
||||
<< "mat4x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x2<T,P>(v2_1, v2_2, v2_3, v2_4) << '\n'
|
||||
<< "mat4x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x3<T,P>(v3_1, v3_2, v3_3, v3_4) << '\n'
|
||||
<< "mat4x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x4<T,P>(v4_1, v4_2, v4_3, v4_4) << '\n';
|
||||
#endif
|
||||
|
||||
glm::io::precision_guard const iopg;
|
||||
|
||||
glm::io::precision() = 2;
|
||||
glm::io::value_width() = 1 + 2 + 1 + glm::io::precision();
|
||||
|
||||
os << "mat2x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x2<T,P>(v2_1, v2_2) << '\n'
|
||||
<< "mat2x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x3<T,P>(v3_1, v3_2) << '\n'
|
||||
<< "mat2x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x4<T,P>(v4_1, v4_2) << '\n'
|
||||
<< "mat3x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x2<T,P>(v2_1, v2_2, v2_3) << '\n'
|
||||
<< "mat3x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x3<T,P>(v3_1, v3_2, v3_3) << '\n'
|
||||
<< "mat3x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x4<T,P>(v4_1, v4_2, v4_3) << '\n'
|
||||
<< "mat4x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x2<T,P>(v2_1, v2_2, v2_3, v2_4) << '\n'
|
||||
<< "mat4x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x3<T,P>(v3_1, v3_2, v3_3, v3_4) << '\n'
|
||||
<< "mat4x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x4<T,P>(v4_1, v4_2, v4_3, v4_4) << '\n';
|
||||
|
||||
os << glm::io::column_major
|
||||
<< "mat2x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x2<T,P>(v2_1, v2_2) << '\n'
|
||||
<< "mat2x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x3<T,P>(v3_1, v3_2) << '\n'
|
||||
<< "mat2x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x4<T,P>(v4_1, v4_2) << '\n'
|
||||
<< "mat3x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x2<T,P>(v2_1, v2_2, v2_3) << '\n'
|
||||
<< "mat3x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x3<T,P>(v3_1, v3_2, v3_3) << '\n'
|
||||
<< "mat3x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x4<T,P>(v4_1, v4_2, v4_3) << '\n'
|
||||
<< "mat4x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x2<T,P>(v2_1, v2_2, v2_3, v2_4) << '\n'
|
||||
<< "mat4x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x3<T,P>(v3_1, v3_2, v3_3, v3_4) << '\n'
|
||||
<< "mat4x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x4<T,P>(v4_1, v4_2, v4_3, v4_4) << '\n';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
Error += test_io_vec<float, glm::highp>(std::cout);
|
||||
Error += test_io_vec<float, glm::highp>(std::wcout);
|
||||
Error += test_io_vec<int, glm::mediump>(std::cout);
|
||||
Error += test_io_vec<int, glm::mediump>(std::wcout);
|
||||
Error += test_io_vec<glm::uint, glm::lowp>(std::cout);
|
||||
Error += test_io_vec<glm::uint, glm::lowp>(std::wcout);
|
||||
|
||||
Error += test_io_mat<float, glm::highp>(std::cout);
|
||||
Error += test_io_mat<float, glm::lowp>(std::wcout);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_log_base.cpp
Normal file
19
test/gtx/gtx_log_base.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/log_base.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/log_base.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_matrix_cross_product.cpp
Normal file
19
test/gtx/gtx_matrix_cross_product.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/matrix_cross_product.hpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/matrix_cross_product.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_matrix_major_storage.cpp
Normal file
19
test/gtx/gtx_matrix_major_storage.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/matrix_major_storage.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/matrix_major_storage.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_matrix_operation.cpp
Normal file
19
test/gtx/gtx_matrix_operation.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/matrix_operation.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/matrix_operation.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
21
test/gtx/gtx_mixed_product.cpp
Normal file
21
test/gtx/gtx_mixed_product.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/associated_min_max.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/associated_min_max.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_norm.cpp
Normal file
19
test/gtx/gtx_norm.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/norm.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/norm.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_normal.cpp
Normal file
19
test/gtx/gtx_normal.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/normal.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/normal.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_normalize_dot.cpp
Normal file
19
test/gtx/gtx_normalize_dot.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/normalize_dot.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/normalize_dot.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_number_precision.cpp
Normal file
19
test/gtx/gtx_number_precision.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/number_precision.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/number_precision.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_optimum_pow.cpp
Normal file
19
test/gtx/gtx_optimum_pow.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/optimum_pow.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/optimum_pow.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_orthonormalize.cpp
Normal file
19
test/gtx/gtx_orthonormalize.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/orthonormalize.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/orthonormalize.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_perpendicular.cpp
Normal file
19
test/gtx/gtx_perpendicular.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/perpendicular.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/perpendicular.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_polar_coordinates.cpp
Normal file
19
test/gtx/gtx_polar_coordinates.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/polar_coordinates.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/polar_coordinates.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
19
test/gtx/gtx_projection.cpp
Normal file
19
test/gtx/gtx_projection.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/projection.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/projection.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
@ -28,6 +28,14 @@ int main()
|
||||
//printf("C1(%2.3f, %2.3f, %2.3f, %2.3f)\n", C1.x, C1.y, C1.z, C1.w);
|
||||
//printf("D1(%2.3f, %2.3f, %2.3f, %2.3f)\n", D1.x, D1.y, D1.z, D1.w);
|
||||
|
||||
__m128 value;
|
||||
__m128 data = _mm_cmpeq_ps(value, value);
|
||||
__m128 add0 = _mm_add_ps(data, data);
|
||||
|
||||
glm::simdVec4 GNI(add0);
|
||||
|
||||
printf("%f\n", GNI.Data /* .m128_f32 */);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
19
test/gtx/gtx_spline.cpp
Normal file
19
test/gtx/gtx_spline.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2013-10-25
|
||||
// Updated : 2013-10-25
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/associated_min_max.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/spline.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
|
||||
int test_areCollinear()
|
||||
{
|
||||
int Error(0);
|
||||
int Error(0);
|
||||
|
||||
{
|
||||
bool TestA = glm::areCollinear(glm::vec2(-1), glm::vec2(1), 0.00001f);
|
||||
@ -29,47 +29,47 @@ int test_areCollinear()
|
||||
Error += TestA ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_areOrthogonal()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
int Error(0);
|
||||
|
||||
bool TestA = glm::areOrthogonal(glm::vec2(1, 0), glm::vec2(0, 1), 0.00001f);
|
||||
Error += TestA ? 0 : 1;
|
||||
Error += TestA ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_isNormalized()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
int Error(0);
|
||||
|
||||
bool TestA = glm::isNormalized(glm::vec4(1, 0, 0, 0), 0.00001f);
|
||||
Error += TestA ? 0 : 1;
|
||||
Error += TestA ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_isNull()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
int Error(0);
|
||||
|
||||
bool TestA = glm::isNull(glm::vec4(0), 0.00001f);
|
||||
Error += TestA ? 0 : 1;
|
||||
Error += TestA ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_areOrthonormal()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
bool TestA = glm::areOrthonormal(glm::vec2(1, 0), glm::vec2(0, 1), 0.00001f);
|
||||
Error += TestA ? 0 : 1;
|
||||
int Error(0);
|
||||
|
||||
return Error;
|
||||
bool TestA = glm::areOrthonormal(glm::vec2(1, 0), glm::vec2(0, 1), 0.00001f);
|
||||
Error += TestA ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
|
Loading…
Reference in New Issue
Block a user