Updated integer matrix implementation

This commit is contained in:
Christophe Riccio 2011-01-20 12:16:28 +00:00
parent 4f91b87f9b
commit d8606d1825
4 changed files with 178 additions and 137 deletions

View File

@ -17,6 +17,7 @@
#include "./gtc/half_float.hpp"
#include "./gtc/matrix_access.hpp"
#include "./gtc/matrix_integer.hpp"
#include "./gtc/matrix_inverse.hpp"
#include "./gtc/matrix_transform.hpp"
#include "./gtc/quaternion.hpp"

View File

@ -109,6 +109,13 @@ namespace glm
#include "./core/func_noise.hpp"
#include "./core/_swizzle.hpp"
namespace glm
{
using namespace core::type;
using namespace core::type::precision;
using namespace core::function;
} //namespace glm
////////////////////
// check type sizes
GLM_STATIC_ASSERT(sizeof(glm::detail::int8) == 1, "int8 size isn't 1 byte on this platform");

View File

@ -30,47 +30,177 @@ namespace glm
//! GLM_GTC_matrix_integer extension: Add integer matrices
namespace matrix_integer
{
typedef detail::tmat2x2<highp_int> highp_imat2; //!< \brief High-precision floating-point 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<highp_int> highp_imat3; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<highp_int> highp_imat4; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<highp_int> highp_imat2; //!< \brief High-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<highp_int> highp_imat3; //!< \brief High-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<highp_int> highp_imat4; //!< \brief High-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<highp_int> highp_imat2x2; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x3<highp_int> highp_imat2x3; //!< \brief Single-precision floating-point 2x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x4<highp_int> highp_imat2x4; //!< \brief Single-precision floating-point 2x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x2<highp_int> highp_imat3x2; //!< \brief Single-precision floating-point 3x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<highp_int> highp_imat3x3; //!< \brief Single-precision floating-point 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x4<highp_int> highp_imat3x4; //!< \brief Single-precision floating-point 3x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x2<highp_int> highp_imat4x2; //!< \brief Single-precision floating-point 4x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x3<highp_int> highp_imat4x3; //!< \brief Single-precision floating-point 4x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<highp_int> highp_imat4x4; //!< \brief Single-precision floating-point 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<highp_int> highp_imat2x2; //!< \brief High-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x3<highp_int> highp_imat2x3; //!< \brief High-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x4<highp_int> highp_imat2x4; //!< \brief High-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x2<highp_int> highp_imat3x2; //!< \brief High-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<highp_int> highp_imat3x3; //!< \brief High-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x4<highp_int> highp_imat3x4; //!< \brief High-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x2<highp_int> highp_imat4x2; //!< \brief High-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x3<highp_int> highp_imat4x3; //!< \brief High-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<highp_int> highp_imat4x4; //!< \brief High-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<mediump_int> mediump_imat2; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<mediump_int> mediump_imat3; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<mediump_int> mediump_imat4; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<mediump_int> mediump_imat2; //!< \brief Medium-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<mediump_int> mediump_imat3; //!< \brief Medium-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<mediump_int> mediump_imat4; //!< \brief Medium-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<mediump_int> mediump_imat2x2; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x3<mediump_int> mediump_imat2x3; //!< \brief Single-precision floating-point 2x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x4<mediump_int> mediump_imat2x4; //!< \brief Single-precision floating-point 2x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x2<mediump_int> mediump_imat3x2; //!< \brief Single-precision floating-point 3x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<mediump_int> mediump_imat3x3; //!< \brief Single-precision floating-point 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x4<mediump_int> mediump_imat3x4; //!< \brief Single-precision floating-point 3x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x2<mediump_int> mediump_imat4x2; //!< \brief Single-precision floating-point 4x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x3<mediump_int> mediump_imat4x3; //!< \brief Single-precision floating-point 4x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<mediump_int> mediump_imat4x4; //!< \brief Single-precision floating-point 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<mediump_int> mediump_imat2x2; //!< \brief Medium-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x3<mediump_int> mediump_imat2x3; //!< \brief Medium-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x4<mediump_int> mediump_imat2x4; //!< \brief Medium-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x2<mediump_int> mediump_imat3x2; //!< \brief Medium-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<mediump_int> mediump_imat3x3; //!< \brief Medium-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x4<mediump_int> mediump_imat3x4; //!< \brief Medium-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x2<mediump_int> mediump_imat4x2; //!< \brief Medium-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x3<mediump_int> mediump_imat4x3; //!< \brief Medium-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<mediump_int> mediump_imat4x4; //!< \brief Medium-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<lowp_int> lowp_imat2; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<lowp_int> lowp_imat3; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<lowp_int> lowp_imat4; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<lowp_int> lowp_imat2; //!< \brief Low-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<lowp_int> lowp_imat3; //!< \brief Low-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<lowp_int> lowp_imat4; //!< \brief Low-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<lowp_int> lowp_imat2x2; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x3<lowp_int> lowp_imat2x3; //!< \brief Single-precision floating-point 2x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x4<lowp_int> lowp_imat2x4; //!< \brief Single-precision floating-point 2x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x2<lowp_int> lowp_imat3x2; //!< \brief Single-precision floating-point 3x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<lowp_int> lowp_imat3x3; //!< \brief Single-precision floating-point 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x4<lowp_int> lowp_imat3x4; //!< \brief Single-precision floating-point 3x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x2<lowp_int> lowp_imat4x2; //!< \brief Single-precision floating-point 4x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x3<lowp_int> lowp_imat4x3; //!< \brief Single-precision floating-point 4x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<lowp_int> lowp_imat4x4; //!< \brief Single-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
typedef detail::tmat2x2<lowp_int> lowp_imat2x2; //!< \brief Low-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x3<lowp_int> lowp_imat2x3; //!< \brief Low-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x4<lowp_int> lowp_imat2x4; //!< \brief Low-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x2<lowp_int> lowp_imat3x2; //!< \brief Low-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<lowp_int> lowp_imat3x3; //!< \brief Low-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x4<lowp_int> lowp_imat3x4; //!< \brief Low-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x2<lowp_int> lowp_imat4x2; //!< \brief Low-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x3<lowp_int> lowp_imat4x3; //!< \brief Low-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<lowp_int> lowp_imat4x4; //!< \brief Low-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<highp_uint> highp_umat2; //!< \brief High-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<highp_uint> highp_umat3; //!< \brief High-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<highp_uint> highp_umat4; //!< \brief High-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<highp_uint> highp_umat2x2; //!< \brief High-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x3<highp_uint> highp_umat2x3; //!< \brief High-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x4<highp_uint> highp_umat2x4; //!< \brief High-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x2<highp_uint> highp_umat3x2; //!< \brief High-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<highp_uint> highp_umat3x3; //!< \brief High-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x4<highp_uint> highp_umat3x4; //!< \brief High-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x2<highp_uint> highp_umat4x2; //!< \brief High-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x3<highp_uint> highp_umat4x3; //!< \brief High-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<highp_uint> highp_umat4x4; //!< \brief High-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<mediump_uint> mediump_umat2; //!< \brief Medium-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<mediump_uint> mediump_umat3; //!< \brief Medium-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<mediump_uint> mediump_umat4; //!< \brief Medium-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<mediump_uint> mediump_umat2x2; //!< \brief Medium-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x3<mediump_uint> mediump_umat2x3; //!< \brief Medium-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x4<mediump_uint> mediump_umat2x4; //!< \brief Medium-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x2<mediump_uint> mediump_umat3x2; //!< \brief Medium-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<mediump_uint> mediump_umat3x3; //!< \brief Medium-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x4<mediump_uint> mediump_umat3x4; //!< \brief Medium-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x2<mediump_uint> mediump_umat4x2; //!< \brief Medium-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x3<mediump_uint> mediump_umat4x3; //!< \brief Medium-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<mediump_uint> mediump_umat4x4; //!< \brief Medium-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<lowp_uint> lowp_umat2; //!< \brief Low-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<lowp_uint> lowp_umat3; //!< \brief Low-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<lowp_uint> lowp_umat4; //!< \brief Low-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x2<lowp_uint> lowp_umat2x2; //!< \brief Low-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x3<lowp_uint> lowp_umat2x3; //!< \brief Low-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat2x4<lowp_uint> lowp_umat2x4; //!< \brief Low-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x2<lowp_uint> lowp_umat3x2; //!< \brief Low-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x3<lowp_uint> lowp_umat3x3; //!< \brief Low-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat3x4<lowp_uint> lowp_umat3x4; //!< \brief Low-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x2<lowp_uint> lowp_umat4x2; //!< \brief Low-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x3<lowp_uint> lowp_umat4x3; //!< \brief Low-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef detail::tmat4x4<lowp_uint> lowp_umat4x4; //!< \brief Low-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
#if(GLM_PRECISION & GLM_PRECISION_HIGHP_INT)
typedef highp_imat2 imat2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_imat3 imat3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_imat4 imat4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_imat2x2 imat2x2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_imat2x3 imat2x3; //!< \brief Signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_imat2x4 imat2x4; //!< \brief Signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_imat3x2 imat3x2; //!< \brief Signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_imat3x3 imat3x3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_imat3x4 imat3x4; //!< \brief Signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_imat4x2 imat4x2; //!< \brief Signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_imat4x3 imat4x3; //!< \brief Signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_imat4x4 imat4x4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
#elif(GLM_PRECISION & GLM_PRECISION_LOWP_INT)
typedef lowp_imat2 imat2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_imat3 imat3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_imat4 imat4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_imat2x2 imat2x2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_imat2x3 imat2x3; //!< \brief Signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_imat2x4 imat2x4; //!< \brief Signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_imat3x2 imat3x2; //!< \brief Signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_imat3x3 imat3x3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_imat3x4 imat3x4; //!< \brief Signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_imat4x2 imat4x2; //!< \brief Signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_imat4x3 imat4x3; //!< \brief Signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_imat4x4 imat4x4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
#else //if(GLM_PRECISION & GLM_PRECISION_MEDIUMP_INT)
typedef mediump_imat2 imat2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_imat3 imat3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_imat4 imat4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_imat2x2 imat2x2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_imat2x3 imat2x3; //!< \brief Signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_imat2x4 imat2x4; //!< \brief Signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_imat3x2 imat3x2; //!< \brief Signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_imat3x3 imat3x3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_imat3x4 imat3x4; //!< \brief Signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_imat4x2 imat4x2; //!< \brief Signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_imat4x3 imat4x3; //!< \brief Signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_imat4x4 imat4x4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
#endif//GLM_PRECISION
#if(GLM_PRECISION & GLM_PRECISION_HIGHP_UINT)
typedef highp_umat2 umat2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_umat3 umat3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_umat4 umat4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_umat2x2 umat2x2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_umat2x3 umat2x3; //!< \brief Unsigned integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_umat2x4 umat2x4; //!< \brief Unsigned integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_umat3x2 umat3x2; //!< \brief Unsigned integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_umat3x3 umat3x3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_umat3x4 umat3x4; //!< \brief Unsigned integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_umat4x2 umat4x2; //!< \brief Unsigned integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_umat4x3 umat4x3; //!< \brief Unsigned integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef highp_umat4x4 umat4x4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
#elif(GLM_PRECISION & GLM_PRECISION_LOWP_UINT)
typedef lowp_umat2 umat2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_umat3 umat3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_umat4 umat4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_umat2x2 umat2x2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_umat2x3 umat2x3; //!< \brief Unsigned integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_umat2x4 umat2x4; //!< \brief Unsigned integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_umat3x2 umat3x2; //!< \brief Unsigned integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_umat3x3 umat3x3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_umat3x4 umat3x4; //!< \brief Unsigned integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_umat4x2 umat4x2; //!< \brief Unsigned integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_umat4x3 umat4x3; //!< \brief Unsigned integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef lowp_umat4x4 umat4x4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
#else //if(GLM_PRECISION & GLM_PRECISION_MEDIUMP_UINT)
typedef mediump_umat2 umat2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_umat3 umat3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_umat4 umat4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_umat2x2 umat2x2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_umat2x3 umat2x3; //!< \brief Unsigned integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_umat2x4 umat2x4; //!< \brief Unsigned integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_umat3x2 umat3x2; //!< \brief Unsigned integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_umat3x3 umat3x3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_umat3x4 umat3x4; //!< \brief Unsigned integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_umat4x2 umat4x2; //!< \brief Unsigned integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_umat4x3 umat4x3; //!< \brief Unsigned integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
typedef mediump_umat4x4 umat4x4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
#endif//GLM_PRECISION
}//namespace matrix_integer
}//namespace gtc

View File

@ -9,118 +9,21 @@
#define GLM_MESSAGES
#include <glm/glm.hpp>
#include <glm/gtc/swizzle.hpp>
#include <glm/gtc/matrix_integer.hpp>
int test_swizzle_vec4_ref_dynamic()
int test_int_matrix()
{
{
glm::ivec4 A(0, 1, 2, 3);
glm::ivec4 B(2, 1, 0, 3);
glm::swizzle(A, glm::Z, glm::Y, glm::X, glm::W) = B;
assert(A.x == B.x && A.y == B.y && A.z == B.z && A.w == B.w);
glm::mediump_uint A(0);
}
{
glm::ivec4 A(0, 1, 2, 3);
glm::ivec3 B(2, 1, 0);
glm::swizzle(A, glm::Z, glm::Y, glm::X) = B;
assert(A.x == B.x && A.y == B.y && A.z == B.z);
}
{
glm::ivec4 A(0, 1, 2, 3);
glm::ivec2 B(2, 1);
glm::swizzle(A, glm::Z, glm::Y) = B;
assert(A.x == B.x && A.y == B.y);
}
{
glm::ivec4 A(0, 1, 2, 3);
int B(2);
glm::swizzle(A, glm::Z) = B;
assert(A.x == B);
}
return 0;
}
int test_swizzle_vec4_ref_static()
{
{
glm::ivec4 A(0, 1, 2, 3);
glm::ivec4 B(2, 1, 0, 3);
glm::swizzle<glm::Z, glm::Y, glm::X, glm::W>(A) = B;
assert(A.x == B.x && A.y == B.y && A.z == B.z && A.w == B.w);
}
{
glm::ivec4 A(0, 1, 2, 3);
glm::ivec3 B(2, 1, 0);
glm::swizzle<glm::Z, glm::Y, glm::X>(A) = B;
assert(A.x == B.x && A.y == B.y && A.z == B.z);
}
{
glm::ivec4 A(0, 1, 2, 3);
glm::ivec2 B(2, 1);
glm::swizzle<glm::Z, glm::Y>(A) = B;
assert(A.x == B.x && A.y == B.y);
}
{
glm::ivec4 A(0, 1, 2, 3);
int B(2);
glm::swizzle<glm::Z>(A) = B;
assert(A.x == B);
}
return 0;
}
int test_swizzle_vec4_const_dynamic()
{
glm::ivec4 A(0, 1, 2, 3);
glm::ivec4 B = glm::swizzle(A, glm::B, glm::G, glm::R, glm::A);
assert(glm::all(glm::equal(A, B)));
glm::ivec3 C = glm::swizzle(A, glm::W, glm::Y, glm::Z);
assert(glm::all(glm::equal(glm::ivec3(A), C)));
glm::ivec2 D = glm::swizzle(A, glm::W, glm::X);
assert(glm::all(glm::equal(glm::ivec2(A), D)));
int E = glm::swizzle(A, glm::Q);
assert(E == A.q);
return 0;
}
int test_swizzle_vec4_const_static()
{
glm::ivec4 A(0, 1, 2, 3);
glm::ivec4 B = glm::swizzle<glm::B, glm::G, glm::R, glm::A>(A);
assert(glm::all(glm::equal(A, B)));
glm::ivec3 C = glm::swizzle<glm::W, glm::Y, glm::Z>(A);
assert(glm::all(glm::equal(glm::ivec3(A), C)));
glm::ivec2 D = glm::swizzle<glm::W, glm::X>(A);
assert(glm::all(glm::equal(glm::ivec2(A), D)));
int E = glm::swizzle<glm::Q>(A);
assert(E == A.q);
return 0;
}
int main(int argc, void* argv[])
{
int Failed = 0;
Failed += test_swizzle_vec4_ref_dynamic();
Failed += test_swizzle_vec4_ref_static();
Failed += test_swizzle_vec4_const_dynamic();
Failed += test_swizzle_vec4_const_static();
Failed += test_int_matrix();
return Failed;
}