- Fixed ldexp implementation

- Increased assert coverage
- Increased static_assert coverage
- Replaced GLM traits by STL traits when possible
- Allowed including individual core feature
This commit is contained in:
Christophe Riccio
2013-09-16 03:03:49 +02:00
parent cd0519d24b
commit d37d3539ed
46 changed files with 506 additions and 259 deletions

View File

@@ -7,66 +7,66 @@
// File : test/core/func_matrix.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#include <glm/core/func_matrix.hpp>
int test_matrixCompMult()
{
int Error(0);
{
glm::mat2 m(0, 1, 2, 3);
glm::mat2 n = glm::matrixCompMult(m, m);
Error += n == glm::mat2(0, 1, 4, 9) ? 0 : 1;
}
int Error(0);
{
glm::mat2 m(0, 1, 2, 3);
glm::mat2 n = glm::matrixCompMult(m, m);
Error += n == glm::mat2(0, 1, 4, 9) ? 0 : 1;
}
{
glm::mat2x3 m(0, 1, 2, 3, 4, 5);
glm::mat2x3 n = glm::matrixCompMult(m, m);
Error += n == glm::mat2x3(0, 1, 4, 9, 16, 25) ? 0 : 1;
}
{
glm::mat2x4 m(0, 1, 2, 3, 4, 5, 6, 7);
glm::mat2x4 n = glm::matrixCompMult(m, m);
Error += n == glm::mat2x4(0, 1, 4, 9, 16, 25, 36, 49) ? 0 : 1;
}
{
glm::mat3 m(0, 1, 2, 3, 4, 5, 6, 7, 8);
glm::mat3 n = glm::matrixCompMult(m, m);
Error += n == glm::mat3(0, 1, 4, 9, 16, 25, 36, 49, 64) ? 0 : 1;
}
{
glm::mat3x2 m(0, 1, 2, 3, 4, 5);
glm::mat3x2 n = glm::matrixCompMult(m, m);
Error += n == glm::mat3x2(0, 1, 4, 9, 16, 25) ? 0 : 1;
}
{
glm::mat3x4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
glm::mat3x4 n = glm::matrixCompMult(m, m);
Error += n == glm::mat3x4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121) ? 0 : 1;
}
{
glm::mat4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
glm::mat4 n = glm::matrixCompMult(m, m);
Error += n == glm::mat4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225) ? 0 : 1;
}
{
glm::mat4x2 m(0, 1, 2, 3, 4, 5, 6, 7);
glm::mat4x2 n = glm::matrixCompMult(m, m);
Error += n == glm::mat4x2(0, 1, 4, 9, 16, 25, 36, 49) ? 0 : 1;
}
{
glm::mat4x3 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
glm::mat4x3 n = glm::matrixCompMult(m, m);
Error += n == glm::mat4x3(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121) ? 0 : 1;
}
{
glm::mat2x3 m(0, 1, 2, 3, 4, 5);
glm::mat2x3 n = glm::matrixCompMult(m, m);
Error += n == glm::mat2x3(0, 1, 4, 9, 16, 25) ? 0 : 1;
}
{
glm::mat2x4 m(0, 1, 2, 3, 4, 5, 6, 7);
glm::mat2x4 n = glm::matrixCompMult(m, m);
Error += n == glm::mat2x4(0, 1, 4, 9, 16, 25, 36, 49) ? 0 : 1;
}
{
glm::mat3 m(0, 1, 2, 3, 4, 5, 6, 7, 8);
glm::mat3 n = glm::matrixCompMult(m, m);
Error += n == glm::mat3(0, 1, 4, 9, 16, 25, 36, 49, 64) ? 0 : 1;
}
{
glm::mat3x2 m(0, 1, 2, 3, 4, 5);
glm::mat3x2 n = glm::matrixCompMult(m, m);
Error += n == glm::mat3x2(0, 1, 4, 9, 16, 25) ? 0 : 1;
}
{
glm::mat3x4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
glm::mat3x4 n = glm::matrixCompMult(m, m);
Error += n == glm::mat3x4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121) ? 0 : 1;
}
{
glm::mat4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
glm::mat4 n = glm::matrixCompMult(m, m);
Error += n == glm::mat4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225) ? 0 : 1;
}
{
glm::mat4x2 m(0, 1, 2, 3, 4, 5, 6, 7);
glm::mat4x2 n = glm::matrixCompMult(m, m);
Error += n == glm::mat4x2(0, 1, 4, 9, 16, 25, 36, 49) ? 0 : 1;
}
{
glm::mat4x3 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
glm::mat4x3 n = glm::matrixCompMult(m, m);
Error += n == glm::mat4x3(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121) ? 0 : 1;
}
return Error;
}

View File

@@ -7,7 +7,7 @@
// File : test/core/type_mat2x2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#include <glm/core/type_mat2x2.hpp>
#include <glm/gtc/epsilon.hpp>
int test_operators()

View File

@@ -7,7 +7,7 @@
// File : test/core/type_mat2x3.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#include <glm/core/type_mat2x3.hpp>
static int test_operators()
{

View File

@@ -7,7 +7,7 @@
// File : test/core/type_mat2x4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#include <glm/core/type_mat2x4.hpp>
static int test_operators()
{

View File

@@ -7,7 +7,7 @@
// File : test/core/type_mat3x2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#include <glm/core/type_mat3x2.hpp>
static bool test_operators()
{

View File

@@ -7,7 +7,7 @@
// File : test/core/type_mat3x3.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#include <glm/core/type_mat3x3.hpp>
#include <glm/gtc/epsilon.hpp>
#include <cstdio>

View File

@@ -7,7 +7,7 @@
// File : test/core/type_mat3x4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#include <glm/core/type_mat3x4.hpp>
static bool test_operators()
{

View File

@@ -7,7 +7,7 @@
// File : test/core/type_mat4x2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#include <glm/core/type_mat4x2.hpp>
static int test_operators()
{

View File

@@ -7,7 +7,7 @@
// File : test/core/type_mat4x3.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#include <glm/core/type_mat4x3.hpp>
static int test_operators()
{

View File

@@ -7,8 +7,7 @@
// File : test/core/type_mat4x4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
//#define GLM_PRECISION_HIGHP_FLOAT
#include <glm/glm.hpp>
#include <glm/core/type_mat4x4.hpp>
#include <glm/gtc/epsilon.hpp>
#include <cstdio>

View File

@@ -7,7 +7,8 @@
// File : test/core/type_vec2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#include <glm/core/func_vector_relational.hpp>
#include <glm/core/type_vec2.hpp>
int test_vec2_operators()
{

View File

@@ -8,7 +8,11 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_SWIZZLE
#include <glm/glm.hpp>
#include <glm/core/type_vec2.hpp>
#include <glm/core/type_vec3.hpp>
#include <glm/core/type_vec4.hpp>
#include <glm/core/func_vector_relational.hpp>
#include <glm/core/func_geometric.hpp>
#include <cstdio>
#include <vector>

View File

@@ -7,7 +7,10 @@
// File : test/core/type_vec4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#include <glm/core/type_vec2.hpp>
#include <glm/core/type_vec3.hpp>
#include <glm/core/type_vec4.hpp>
#include <glm/core/func_vector_relational.hpp>
#include <vector>
template <int Value>

View File

@@ -14,6 +14,22 @@
namespace gli
{
enum comp
{
X = 0,
R = 0,
S = 0,
Y = 1,
G = 1,
T = 1,
Z = 2,
B = 2,
P = 2,
W = 3,
A = 3,
Q = 3
};
//template <template <typename> class mem>
class texture2D
{
@@ -45,7 +61,7 @@ namespace gli
void resize(level_type const & Levels);
template <typename genType>
void swizzle(glm::comp X, glm::comp Y, glm::comp Z, glm::comp W);
void swizzle(gli::comp X, gli::comp Y, gli::comp Z, gli::comp W);
private:
std::vector<image2D> Images;

View File

@@ -86,7 +86,7 @@ namespace gli
}
template <typename genType>
inline void texture2D::swizzle(glm::comp X, glm::comp Y, glm::comp Z, glm::comp W)
inline void texture2D::swizzle(gli::comp X, gli::comp Y, gli::comp Z, gli::comp W)
{
for(texture2D::level_type Level = 0; Level < this->levels(); ++Level)
{

View File

@@ -91,9 +91,9 @@ namespace loader_tga
// TGA images are saved in BGR or BGRA format.
if(TexelSize == 24)
Image.swizzle<glm::u8vec3>(glm::B, glm::G, glm::R, glm::A);
Image.swizzle<glm::u8vec3>(gli::B, gli::G, gli::R, gli::A);
if(TexelSize == 32)
Image.swizzle<glm::u8vec4>(glm::B, glm::G, glm::R, glm::A);
Image.swizzle<glm::u8vec4>(gli::B, gli::G, gli::R, gli::A);
return Image;
}
@@ -124,9 +124,9 @@ namespace loader_tga
unsigned char Descriptor = 0;
if(TexelSize == 24)
Image.swizzle<glm::u8vec3>(glm::B, glm::G, glm::R, glm::A);
Image.swizzle<glm::u8vec3>(gli::B, gli::G, gli::R, gli::A);
if(TexelSize == 32)
Image.swizzle<glm::u8vec4>(glm::B, glm::G, glm::R, glm::A);
Image.swizzle<glm::u8vec4>(gli::B, gli::G, gli::R, gli::A);
FileOut.write((char*)&IdentificationFieldSize, sizeof(IdentificationFieldSize));
FileOut.write((char*)&ColorMapType, sizeof(ColorMapType));