mirror of
https://github.com/g-truc/glm.git
synced 2024-11-22 17:04:35 +00:00
- Added GLM_FORCE_UNRESTRICTED_GENTYPE allowing non basic genType #543
This commit is contained in:
parent
1c5fd06c2d
commit
10dc67e2b5
@ -524,11 +524,21 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Swizzle operators
|
||||
|
||||
// User defines: GLM_SWIZZLE
|
||||
// User defines: GLM_FORCE_SWIZZLE
|
||||
|
||||
#define GLM_SWIZZLE_ENABLED 1
|
||||
#define GLM_SWIZZLE_DISABLE 0
|
||||
#if defined(GLM_FORCE_SWIZZLE) || defined(GLM_SWIZZLE)
|
||||
#undef GLM_SWIZZLE
|
||||
#define GLM_SWIZZLE GLM_SWIZZLE_ENABLED
|
||||
#else
|
||||
#undef GLM_SWIZZLE
|
||||
#define GLM_SWIZZLE GLM_SWIZZLE_DISABLE
|
||||
#endif
|
||||
|
||||
#if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED)
|
||||
# define GLM_MESSAGE_SWIZZLE_DISPLAYED
|
||||
# if defined(GLM_SWIZZLE)
|
||||
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
# pragma message("GLM: Swizzling operators enabled")
|
||||
# else
|
||||
# pragma message("GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators")
|
||||
@ -551,6 +561,11 @@
|
||||
# define GLM_DEPTH_CLIP_SPACE GLM_DEPTH_NEGATIVE_ONE_TO_ONE
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Allows using not basic types as genType
|
||||
|
||||
// #define GLM_FORCE_UNRESTRICTED_GENTYPE
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Coordinate system, define GLM_FORCE_LEFT_HANDED before including GLM
|
||||
// to use left handed coordinate system by default.
|
||||
@ -617,7 +632,7 @@
|
||||
# define GLM_VECTOR_CALL
|
||||
#endif//GLM_COMPILER
|
||||
|
||||
#if GLM_HAS_DEFAULTED_FUNCTIONS
|
||||
#if GLM_HAS_DEFAULTED_FUNCTIONS && !defined(GLM_FORCE_UNRESTRICTED_GENTYPE)
|
||||
# define GLM_DEFAULT = default
|
||||
# ifdef GLM_FORCE_NO_CTOR_INIT
|
||||
# define GLM_DEFAULT_CTOR = default
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec.hpp"
|
||||
#ifdef GLM_SWIZZLE
|
||||
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
# if GLM_HAS_UNRESTRICTED_UNIONS
|
||||
# include "_swizzle.hpp"
|
||||
# else
|
||||
@ -44,7 +44,7 @@ namespace glm
|
||||
T r;
|
||||
T s;
|
||||
/*
|
||||
# ifdef GLM_SWIZZLE
|
||||
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
_GLM_SWIZZLE1_2_MEMBERS(T, P, tvec2, x)
|
||||
_GLM_SWIZZLE1_2_MEMBERS(T, P, tvec2, r)
|
||||
_GLM_SWIZZLE1_2_MEMBERS(T, P, tvec2, s)
|
||||
@ -66,7 +66,7 @@ namespace glm
|
||||
# else
|
||||
union {T x, r, s;};
|
||||
/*
|
||||
# ifdef GLM_SWIZZLE
|
||||
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC1(T, P, tvec2, tvec2, tvec3, tvec4)
|
||||
# endif//GLM_SWIZZLE*/
|
||||
# endif
|
||||
@ -110,13 +110,13 @@ namespace glm
|
||||
|
||||
// -- Swizzle constructors --
|
||||
/*
|
||||
# if(GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE))
|
||||
# if(GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED))
|
||||
template <int E0>
|
||||
GLM_FUNC_DECL tvec1(detail::_swizzle<1, T, P, tvec1, E0, -1,-2,-3> const & that)
|
||||
{
|
||||
*this = that();
|
||||
}
|
||||
# endif//(GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE))
|
||||
# endif//(GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED))
|
||||
*/
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "type_vec.hpp"
|
||||
#ifdef GLM_SWIZZLE
|
||||
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
# if GLM_HAS_UNRESTRICTED_UNIONS
|
||||
# include "_swizzle.hpp"
|
||||
# else
|
||||
@ -43,7 +43,7 @@ namespace glm
|
||||
struct{ T r, g; };
|
||||
struct{ T s, t; };
|
||||
|
||||
# ifdef GLM_SWIZZLE
|
||||
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
_GLM_SWIZZLE2_2_MEMBERS(T, P, glm::tvec2, x, y)
|
||||
_GLM_SWIZZLE2_2_MEMBERS(T, P, glm::tvec2, r, g)
|
||||
_GLM_SWIZZLE2_2_MEMBERS(T, P, glm::tvec2, s, t)
|
||||
@ -67,7 +67,7 @@ namespace glm
|
||||
union {T x, r, s;};
|
||||
union {T y, g, t;};
|
||||
|
||||
# ifdef GLM_SWIZZLE
|
||||
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, P, tvec2, tvec2, tvec3, tvec4)
|
||||
# endif//GLM_SWIZZLE
|
||||
# endif
|
||||
@ -116,13 +116,13 @@ namespace glm
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec2(tvec2<U, Q> const & v);
|
||||
|
||||
// -- Swizzle constructors --
|
||||
# if GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE)
|
||||
# if GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
|
||||
template <int E0, int E1>
|
||||
GLM_FUNC_DECL tvec2(detail::_swizzle<2, T, P, glm::tvec2, E0, E1,-1,-2> const& that)
|
||||
{
|
||||
*this = that();
|
||||
}
|
||||
# endif// GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE)
|
||||
# endif// GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "type_vec.hpp"
|
||||
#ifdef GLM_SWIZZLE
|
||||
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
# if GLM_HAS_UNRESTRICTED_UNIONS
|
||||
# include "_swizzle.hpp"
|
||||
# else
|
||||
# include "_swizzle_func.hpp"
|
||||
# endif
|
||||
#endif //GLM_SWIZZLE
|
||||
#endif //GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm
|
||||
@ -43,7 +43,7 @@ namespace glm
|
||||
struct{ T r, g, b; };
|
||||
struct{ T s, t, p; };
|
||||
|
||||
# ifdef GLM_SWIZZLE
|
||||
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
_GLM_SWIZZLE3_2_MEMBERS(T, P, glm::tvec2, x, y, z)
|
||||
_GLM_SWIZZLE3_2_MEMBERS(T, P, glm::tvec2, r, g, b)
|
||||
_GLM_SWIZZLE3_2_MEMBERS(T, P, glm::tvec2, s, t, p)
|
||||
@ -67,7 +67,7 @@ namespace glm
|
||||
union { T y, g, t; };
|
||||
union { T z, b, p; };
|
||||
|
||||
# ifdef GLM_SWIZZLE
|
||||
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P, tvec3, tvec2, tvec3, tvec4)
|
||||
# endif//GLM_SWIZZLE
|
||||
# endif//GLM_LANG
|
||||
@ -125,7 +125,7 @@ namespace glm
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec3(tvec3<U, Q> const & v);
|
||||
|
||||
// -- Swizzle constructors --
|
||||
# if GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE)
|
||||
# if GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
|
||||
template <int E0, int E1, int E2>
|
||||
GLM_FUNC_DECL tvec3(detail::_swizzle<3, T, P, glm::tvec3, E0, E1, E2, -1> const & that)
|
||||
{
|
||||
@ -143,7 +143,7 @@ namespace glm
|
||||
{
|
||||
*this = tvec3<T, P>(scalar, v());
|
||||
}
|
||||
# endif// GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE)
|
||||
# endif// GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "type_vec.hpp"
|
||||
#ifdef GLM_SWIZZLE
|
||||
#if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
# if GLM_HAS_UNRESTRICTED_UNIONS
|
||||
# include "_swizzle.hpp"
|
||||
# else
|
||||
@ -45,7 +45,7 @@ namespace glm
|
||||
|
||||
typename detail::storage<T, sizeof(T) * 4, detail::is_aligned<P>::value>::type data;
|
||||
|
||||
# ifdef GLM_SWIZZLE
|
||||
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
_GLM_SWIZZLE4_2_MEMBERS(T, P, glm::tvec2, x, y, z, w)
|
||||
_GLM_SWIZZLE4_2_MEMBERS(T, P, glm::tvec2, r, g, b, a)
|
||||
_GLM_SWIZZLE4_2_MEMBERS(T, P, glm::tvec2, s, t, p, q)
|
||||
@ -70,7 +70,7 @@ namespace glm
|
||||
union { T z, b, p; };
|
||||
union { T w, a, q; };
|
||||
|
||||
# ifdef GLM_SWIZZLE
|
||||
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, P, tvec4, tvec2, tvec3, tvec4)
|
||||
# endif//GLM_SWIZZLE
|
||||
# endif
|
||||
@ -146,7 +146,7 @@ namespace glm
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec4(tvec4<U, Q> const& v);
|
||||
|
||||
// -- Swizzle constructors --
|
||||
# if GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE)
|
||||
# if GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
|
||||
template <int E0, int E1, int E2, int E3>
|
||||
GLM_FUNC_DECL tvec4(detail::_swizzle<4, T, P, glm::tvec4, E0, E1, E2, E3> const & that)
|
||||
{
|
||||
@ -188,7 +188,7 @@ namespace glm
|
||||
{
|
||||
*this = tvec4<T, P>(x, v());
|
||||
}
|
||||
# endif// GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE)
|
||||
# endif// GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
# ifdef GLM_SWIZZLE
|
||||
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
template <precision P, int E0, int E1, int E2, int E3>
|
||||
struct _swizzle_base1<4, float, P, glm::tvec4, E0,E1,E2,E3, true> : public _swizzle_base0<float, 4>
|
||||
{
|
||||
@ -49,7 +49,7 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
# endif//GLM_SWIZZLE
|
||||
# endif// GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
|
||||
|
||||
template <precision P>
|
||||
struct compute_vec4_add<float, P, true>
|
||||
|
@ -68,6 +68,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
|
||||
- Added GTC_functions extension
|
||||
- Added quaternion version of isnan and isinf #521
|
||||
- Added lowestBitValue to GTX_bit #536
|
||||
- Added GLM_FORCE_UNRESTRICTED_GENTYPE allowing non basic genType #543
|
||||
|
||||
##### Improvements:
|
||||
- Improved SIMD and swizzle operators interactions with GCC and Clang #474
|
||||
@ -99,6 +100,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
|
||||
- Deprecated GLM_GTX_simd_vec4 extension
|
||||
- Deprecated GLM_GTX_simd_mat4 extension
|
||||
- Deprecated GLM_GTX_simd_quat extension
|
||||
- Deprecated GLM_SWIZZLE, use GLM_FORCE_SWIZZLE instead
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
#### [GLM 0.9.7.6](https://github.com/g-truc/glm/releases/tag/0.9.7.6) - 2016-07-16
|
||||
|
@ -1,5 +1,5 @@
|
||||
#define GLM_MESSAGES
|
||||
#define GLM_SWIZZLE
|
||||
#define GLM_FORCE_SWIZZLE
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
int test_ivec2_swizzle()
|
||||
|
@ -1,4 +1,4 @@
|
||||
#define GLM_SWIZZLE
|
||||
#define GLM_FORCE_SWIZZLE
|
||||
#include <glm/vector_relational.hpp>
|
||||
#include <glm/gtc/vec1.hpp>
|
||||
#include <vector>
|
||||
@ -65,7 +65,7 @@ int test_vec1_ctor()
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
#if GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE)
|
||||
#if GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
|
||||
{
|
||||
glm::vec2 A = glm::vec2(1.0f, 2.0f);
|
||||
glm::vec2 B = A.xy;
|
||||
@ -76,7 +76,7 @@ int test_vec1_ctor()
|
||||
Error += glm::all(glm::equal(A, C)) ? 0 : 1;
|
||||
Error += glm::all(glm::equal(A, D)) ? 0 : 1;
|
||||
}
|
||||
#endif//GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE)
|
||||
#endif//GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
|
||||
|
||||
{
|
||||
glm::vec2 A = glm::vec2(2.0f);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#define GLM_SWIZZLE
|
||||
#define GLM_FORCE_SWIZZLE
|
||||
#include <glm/vector_relational.hpp>
|
||||
#include <glm/vec2.hpp>
|
||||
#include <vector>
|
||||
@ -230,7 +230,7 @@ int test_vec2_ctor()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE)
|
||||
#if GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
|
||||
{
|
||||
glm::vec2 A = glm::vec2(1.0f, 2.0f);
|
||||
glm::vec2 B = A.xy;
|
||||
@ -241,7 +241,7 @@ int test_vec2_ctor()
|
||||
Error += glm::all(glm::equal(A, C)) ? 0 : 1;
|
||||
Error += glm::all(glm::equal(A, D)) ? 0 : 1;
|
||||
}
|
||||
#endif//GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE)
|
||||
#endif//GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
|
||||
|
||||
{
|
||||
glm::vec2 A = glm::vec2(2.0f);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#define GLM_SWIZZLE
|
||||
#define GLM_FORCE_SWIZZLE
|
||||
#include <glm/vector_relational.hpp>
|
||||
#include <glm/geometric.hpp>
|
||||
#include <glm/vec2.hpp>
|
||||
@ -40,7 +40,7 @@ int test_vec3_ctor()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if(GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE))
|
||||
#if(GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE))
|
||||
{
|
||||
glm::vec3 A = glm::vec3(1.0f, 2.0f, 3.0f);
|
||||
glm::vec3 B = A.xyz;
|
||||
@ -59,7 +59,7 @@ int test_vec3_ctor()
|
||||
Error += glm::all(glm::equal(A, G)) ? 0 : 1;
|
||||
Error += glm::all(glm::equal(A, H)) ? 0 : 1;
|
||||
}
|
||||
#endif//(GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE))
|
||||
#endif//(GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE))
|
||||
|
||||
{
|
||||
glm::vec3 A(1);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#define GLM_FORCE_ALIGNED
|
||||
#define GLM_SWIZZLE
|
||||
#define GLM_FORCE_SWIZZLE
|
||||
#include <glm/vector_relational.hpp>
|
||||
#include <glm/vec2.hpp>
|
||||
#include <glm/vec3.hpp>
|
||||
@ -68,7 +68,7 @@ int test_vec4_ctor()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE)
|
||||
#if GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
|
||||
{
|
||||
glm::vec4 A = glm::vec4(1.0f, 2.0f, 3.0f, 4.0f);
|
||||
glm::vec4 B = A.xyzw;
|
||||
@ -97,7 +97,7 @@ int test_vec4_ctor()
|
||||
Error += glm::all(glm::equal(A, L)) ? 0 : 1;
|
||||
Error += glm::all(glm::equal(A, M)) ? 0 : 1;
|
||||
}
|
||||
#endif// GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_SWIZZLE)
|
||||
#endif// GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
|
||||
|
||||
{
|
||||
glm::vec4 A(1);
|
||||
|
Loading…
Reference in New Issue
Block a user