Added test files

This commit is contained in:
Christophe Riccio 2010-04-29 16:54:07 +01:00
parent 6eda11ed2f
commit 3cb1965573
113 changed files with 6889 additions and 0 deletions

View File

@ -6,6 +6,7 @@ project(glm)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_subdirectory(glm)
add_subdirectory(test)
add_subdirectory(doc)

52
test/CMakeLists.txt Normal file
View File

@ -0,0 +1,52 @@
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
cmake_policy(VERSION 2.6)
project(glm)
set(NAME glm-test)
file(GLOB ROOT_SOURCE *.cpp)
file(GLOB ROOT_INLINE *.inl)
file(GLOB ROOT_HEADER *.hpp)
file(GLOB_RECURSE CORE_SOURCE ./core/*.cpp)
file(GLOB_RECURSE CORE_INLINE ./core/*.inl)
file(GLOB_RECURSE CORE_HEADER ./core/*.hpp)
file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp)
file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl)
file(GLOB_RECURSE GTC_HEADER ./gtc/*.hpp)
file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp)
file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl)
file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp)
file(GLOB_RECURSE IMG_SOURCE ./img/*.cpp)
file(GLOB_RECURSE IMG_INLINE ./img/*.inl)
file(GLOB_RECURSE IMG_HEADER ./img/*.hpp)
source_group("Core Files" FILES ${CORE_SOURCE})
source_group("Core Files" FILES ${CORE_INLINE})
source_group("Core Files" FILES ${CORE_HEADER})
source_group("GTC Files" FILES ${GTC_SOURCE})
source_group("GTC Files" FILES ${GTC_INLINE})
source_group("GTC Files" FILES ${GTC_HEADER})
source_group("GTX Files" FILES ${GTX_SOURCE})
source_group("GTX Files" FILES ${GTX_INLINE})
source_group("GTX Files" FILES ${GTX_HEADER})
source_group("IMG Files" FILES ${IMG_SOURCE})
source_group("IMG Files" FILES ${IMG_INLINE})
source_group("IMG Files" FILES ${IMG_HEADER})
include_directories(..)
add_executable(${NAME}
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
${IMG_SOURCE} ${IMG_INLINE} ${IMG_HEADER})
add_definitions(-D_CRT_SECURE_NO_WARNINGS)

0
test/bug.cpp Normal file
View File

27
test/core.cpp Normal file
View File

@ -0,0 +1,27 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2009-11-14
// Updated : 2009-11-14
// Licence : This source is under MIT licence
// File : test/bug.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
namespace glm{
namespace test
{
bool main_bug()
{
bool Result = true;
{
}
return Result;
}
}//namespace test
}//namespace glm

0
test/core.hpp Normal file
View File

130
test/core/cast/mat.cpp Normal file
View File

@ -0,0 +1,130 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-03-14
// Updated : 2008-03-14
// Licence : This source is under MIT License
// File : test/core/ctor/mat.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../../precompiled.hpp"
#include <glm/glm.hpp>
using namespace glm;
bool test_core_cast_mat()
{
{
mat2x3 m01(1.0f);
mat2x4 m02(1.0f);
mat3x2 m03(1.0f);
mat3x4 m04(1.0f);
mat4x2 m05(1.0f);
mat4x3 m06(1.0f);
}
{
mat2x3 m01(mat2(1.0f));
mat2x3 m02(mat3(1.0f));
mat2x3 m03(mat4(1.0f));
mat2x3 m04(mat2x3(1.0f));
mat2x3 m05(mat2x4(1.0f));
mat2x3 m06(mat3x2(1.0f));
mat2x3 m07(mat3x4(1.0f));
mat2x3 m08(mat4x2(1.0f));
mat2x3 m09(mat4x3(1.0f));
}
{
mat2x4 m01(mat2(1.0f));
mat2x4 m02(mat3(1.0f));
mat2x4 m03(mat4(1.0f));
mat2x4 m04(mat2x3(1.0f));
mat2x4 m05(mat2x4(1.0f));
mat2x4 m06(mat3x2(1.0f));
mat2x4 m07(mat3x4(1.0f));
mat2x4 m08(mat4x2(1.0f));
mat2x4 m09(mat4x3(1.0f));
}
{
mat3x2 m01(mat2(1.0f));
mat3x2 m02(mat3(1.0f));
mat3x2 m03(mat4(1.0f));
mat3x2 m04(mat2x3(1.0f));
mat3x2 m05(mat2x4(1.0f));
mat3x2 m06(mat3x2(1.0f));
mat3x2 m07(mat3x4(1.0f));
mat3x2 m08(mat4x2(1.0f));
mat3x2 m09(mat4x3(1.0f));
}
{
mat3x4 m01(mat2(1.0f));
mat3x4 m02(mat3(1.0f));
mat3x4 m03(mat4(1.0f));
mat3x4 m04(mat2x3(1.0f));
mat3x4 m05(mat2x4(1.0f));
mat3x4 m06(mat3x2(1.0f));
mat3x4 m07(mat3x4(1.0f));
mat3x4 m08(mat4x2(1.0f));
mat3x4 m09(mat4x3(1.0f));
}
{
mat4x2 m01(mat2(1.0f));
mat4x2 m02(mat3(1.0f));
mat4x2 m03(mat4(1.0f));
mat4x2 m04(mat2x3(1.0f));
mat4x2 m05(mat2x4(1.0f));
mat4x2 m06(mat3x2(1.0f));
mat4x2 m07(mat3x4(1.0f));
mat4x2 m08(mat4x2(1.0f));
mat4x2 m09(mat4x3(1.0f));
}
{
mat4x3 m01(mat2(1.0f));
mat4x3 m02(mat3(1.0f));
mat4x3 m03(mat4(1.0f));
mat4x3 m04(mat2x3(1.0f));
mat4x3 m05(mat2x4(1.0f));
mat4x3 m06(mat3x2(1.0f));
mat4x3 m07(mat3x4(1.0f));
mat4x3 m08(mat4x2(1.0f));
mat4x3 m09(mat4x3(1.0f));
}
{
mat2 m01(mat2x3(1.0f));
mat2 m02(mat2x4(1.0f));
mat2 m03(mat3x2(1.0f));
mat2 m04(mat3x4(1.0f));
mat2 m05(mat4x2(1.0f));
mat2 m06(mat4x3(1.0f));
mat2 m07(mat4(1.0f));
mat2 m08(mat3(1.0f));
}
{
mat3 m01(mat2x3(1.0f));
mat3 m02(mat2x4(1.0f));
mat3 m03(mat3x2(1.0f));
mat3 m04(mat3x4(1.0f));
mat3 m05(mat4x2(1.0f));
mat3 m06(mat4x3(1.0f));
mat3 m07(mat4(1.0f));
mat3 m08(mat2(1.0f));
}
{
mat4 m01(mat2x3(1.0f));
mat4 m02(mat2x4(1.0f));
mat4 m03(mat3x2(1.0f));
mat4 m04(mat3x4(1.0f));
mat4 m05(mat4x2(1.0f));
mat4 m06(mat4x3(1.0f));
mat4 m07(mat2(1.0f));
mat4 m08(mat3(1.0f));
}
return true;
}

6
test/core/cast/mat.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef GLM_TEST_CAST_MAT_H
#define GLM_TEST_CAST_MAT_H
bool test_core_cast_mat();
#endif//GLM_TEST_CAST_MAT_H

11
test/core/ctor/vec2.cpp Normal file
View File

@ -0,0 +1,11 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-03-14
// Updated : 2008-03-14
// Licence : This source is under MIT licence
// File : test/core/ctor/vec2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../../precompiled.hpp"
#include <glm/glm.hpp>

6
test/core/ctor/vec2.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef GLM_TEST_CORE_CTOR_VEC2_H
#define GLM_TEST_CORE_CTOR_VEC2_H
#endif//GLM_TEST_CORE_CTOR_VEC2_H

12
test/core/ctor/vec3.cpp Normal file
View File

@ -0,0 +1,12 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-03-14
// Updated : 2008-03-14
// Licence : This source is under MIT licence
// File : test/core/ctor/vec3.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../../precompiled.hpp"
#include <glm/glm.hpp>

6
test/core/ctor/vec3.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef GLM_TEST_CORE_CTOR_VEC3_H
#define GLM_TEST_CORE_CTOR_VEC3_H
#endif//GLM_TEST_CORE_CTOR_VEC3_H

14
test/core/ctor/vec4.cpp Normal file
View File

@ -0,0 +1,14 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-03-14
// Updated : 2008-03-14
// Licence : This source is under MIT licence
// File : test/core/ctor/vec4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../../precompiled.hpp"
#include <glm/glm.hpp>

6
test/core/ctor/vec4.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef GLM_TEST_CORE_CTOR_VEC4_H
#define GLM_TEST_CORE_CTOR_VEC4_H
#endif//GLM_TEST_CORE_CTOR_VEC4_H

882
test/core/func_common.cpp Normal file
View File

@ -0,0 +1,882 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/func_common.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/func_common.hpp>
namespace glm{
namespace test{
static const float epsilon = 0.00001f;
bool test_abs_type1()
{
float absolute1 = glm::abs(( 76.f));
float absolute2 = glm::abs((-76.f));
if(absolute1 != (76.f) ||
absolute2 != (76.f))
return false;
return true;
}
bool test_abs_type2()
{
glm::vec2 absolute1 = glm::abs(glm::vec2( 76.f, 76.f));
glm::vec2 absolute2 = glm::abs(glm::vec2(-76.f,-76.f));
if(absolute1.x != 76.f || absolute1.y != 76.f ||
absolute2.x != 76.f || absolute2.y != 76.f)
return false;
return true;
}
bool test_abs_type3()
{
glm::vec3 absolute1 = glm::abs(glm::vec3( 76.f, 76.f, 76.f));
glm::vec3 absolute2 = glm::abs(glm::vec3(-76.f,-76.f,-76.f));
if(absolute1.x != 76.f || absolute1.y != 76.f || absolute1.z != 76.f ||
absolute2.x != 76.f || absolute2.y != 76.f || absolute2.z != 76.f)
return false;
return true;
}
bool test_abs_type4()
{
glm::vec4 absolute1 = glm::abs(glm::vec4( 76.f, 76.f, 76.f, 76.f));
glm::vec4 absolute2 = glm::abs(glm::vec4(-76.f,-76.f,-76.f,-76.f));
if(absolute1.x != 76.f || absolute1.y != 76.f || absolute1.z != 76.f || absolute1.w != 76.f ||
absolute2.x != 76.f || absolute2.y != 76.f || absolute2.z != 76.f || absolute2.w != 76.f)
return false;
return true;
}
bool test_sign_type1()
{
float vec_sign1 = sign( 76.f);
float vec_sign2 = sign( 0.f);
float vec_sign3 = sign(-76.f);
if(vec_sign1 != 1.0f ||
vec_sign2 != 0.0f ||
vec_sign3 != -1.0f)
return false;
return true;
}
bool test_sign_type2()
{
vec2 vec_sign1 = sign(vec2( 76.f, 76.f));
vec2 vec_sign2 = sign(vec2( 0.f, 0.f));
vec2 vec_sign3 = sign(vec2(-76.f,-76.f));
if(vec_sign1.x != 1.0f ||
vec_sign1.y != 1.0f)
return false;
if(vec_sign2.x != 0.0f ||
vec_sign2.y != 0.0f)
return false;
if(vec_sign3.x != -1.0f ||
vec_sign3.y != -1.0f)
return false;
return true;
}
bool test_sign_type3()
{
vec3 vec_sign1 = sign(vec3( 76.f, 76.f, 76.f));
vec3 vec_sign2 = sign(vec3( 0.f, 0.f, 0.f));
vec3 vec_sign3 = sign(vec3(-76.f,-76.f,-76.f));
if(vec_sign1.x != 1.0f ||
vec_sign1.y != 1.0f ||
vec_sign1.z != 1.0f)
return false;
if(vec_sign2.x != 0.0f ||
vec_sign2.y != 0.0f ||
vec_sign2.z != 0.0f)
return false;
if(vec_sign3.x != -1.0f ||
vec_sign3.y != -1.0f ||
vec_sign3.z != -1.0f)
return false;
return true;
}
bool test_sign_type4()
{
vec4 vec_sign1 = sign(vec4( 76.f, 76.f, 76.f, 76.f));
vec4 vec_sign2 = sign(vec4( 0.f, 0.f, 0.f, 0.f));
vec4 vec_sign3 = sign(vec4(-76.f,-76.f,-76.f,-76.f));
if(vec_sign1.x != 1.0f ||
vec_sign1.y != 1.0f ||
vec_sign1.z != 1.0f ||
vec_sign1.w != 1.0f)
return false;
if(vec_sign2.x != 0.0f ||
vec_sign2.y != 0.0f ||
vec_sign2.z != 0.0f ||
vec_sign2.w != 0.0f)
return false;
if(vec_sign3.x != -1.0f ||
vec_sign3.y != -1.0f ||
vec_sign3.z != -1.0f ||
vec_sign3.w != -1.0f)
return false;
return true;
}
bool test_floor_type1()
{
float val_floor = glm::floor(float(0.5f));
if(val_floor != 0)
return false;
return true;
}
bool test_floor_type2()
{
glm::vec2 vec_floor = glm::floor(glm::vec2(0.5f, 0.5f));
if(vec_floor.x != 0 ||
vec_floor.y != 0)
return false;
return true;
}
bool test_floor_type3()
{
glm::vec3 vec_floor = glm::floor(glm::vec3(0.5f, 0.5f, 0.5f));
if(vec_floor.x != 0 ||
vec_floor.y != 0 ||
vec_floor.z != 0)
return false;
return true;
}
bool test_floor_type4()
{
glm::vec4 vec_floor = glm::floor(glm::vec4(0.5f, 0.5f, 0.5f, 0.5f));
if(vec_floor.x != 0 ||
vec_floor.y != 0 ||
vec_floor.z != 0 ||
vec_floor.w != 0)
return false;
return true;
}
bool test_trunc_type1()
{
return true;
}
bool test_trunc_type2()
{
return true;
}
bool test_trunc_type3()
{
return true;
}
bool test_trunc_type4()
{
return true;
}
bool test_round_type1()
{
return true;
}
bool test_round_type2()
{
return true;
}
bool test_round_type3()
{
return true;
}
bool test_round_type4()
{
return true;
}
bool test_roundEven_type1()
{
float a = glm::roundEven(3.5f);
float b = glm::roundEven(4.5f);
float c = glm::roundEven(5.5f);
float d = glm::roundEven(3.4f);
float e = glm::roundEven(4.4f);
float f = glm::roundEven(5.4f);
float g = glm::roundEven(3.6f);
float h = glm::roundEven(4.6f);
float i = glm::roundEven(5.6f);
float end = 0.0f;
return true;
}
bool test_roundEven_type2()
{
return true;
}
bool test_roundEven_type3()
{
return true;
}
bool test_roundEven_type4()
{
return true;
}
bool test_ceil_1()
{
float val_ceil = glm::ceil(float(0.5f));
if(val_ceil != 1)
return false;
return true;
}
bool test_ceil_2()
{
glm::vec2 vec_ceil = glm::ceil(glm::vec2(0.5f, 0.5f));
if(vec_ceil.x != 1 ||
vec_ceil.y != 1)
return false;
return true;
}
bool test_ceil_3()
{
glm::vec3 vec_ceil = glm::ceil(glm::vec3(0.5f, 0.5f, 0.5f));
if(vec_ceil.x != 1 ||
vec_ceil.y != 1 ||
vec_ceil.z != 1)
return false;
return true;
}
bool test_ceil_4()
{
glm::vec4 vec_ceil = glm::ceil(glm::vec4(0.5f, 0.5f, 0.5f, 0.5f));
if(vec_ceil.x != 1 ||
vec_ceil.y != 1 ||
vec_ceil.z != 1 ||
vec_ceil.w != 1)
return false;
return true;
}
bool test_fract_1()
{
float val_fract = fract(float(0.5f));
if(val_fract != 0.5f)
return false;
return true;
}
bool test_fract_2()
{
vec2 vec_fract = fract(vec2(0.5f, 0.5f));
if(vec_fract.x != 0.5f ||
vec_fract.y != 0.5f)
return false;
return true;
}
bool test_fract_3()
{
vec3 vec_fract = fract(vec3(0.5f, 0.5f, 0.5f));
if(vec_fract.x != 0.5f ||
vec_fract.y != 0.5f ||
vec_fract.z != 0.5f)
return false;
return true;
}
bool test_fract_4()
{
vec4 vec_fract = fract(vec4(0.5f, 0.5f, 0.5f, 0.5f));
if(vec_fract.x != 0.5f ||
vec_fract.y != 0.5f ||
vec_fract.z != 0.5f ||
vec_fract.w != 0.5f)
return false;
return true;
}
bool test_mod_1()
{
float val_mod = glm::mod(float(4.0f), float(2.0f));
if(val_mod != 0.0f)
return false;
return true;
}
bool test_mod_2()
{
glm::vec2 vec_mod1 = glm::mod(glm::vec2(4.0f, 4.0f), glm::vec2(2.0f, 2.0f));
glm::vec2 vec_mod2 = glm::mod(glm::vec2(4.0f, 4.0f), float(2.0f));
if(vec_mod1.x != 0.0f ||
vec_mod1.y != 0.0f)
return false;
if(vec_mod2.x != 0.0f ||
vec_mod2.y != 0.0f)
return false;
return true;
}
bool test_mod_3()
{
glm::vec3 vec_mod1 = glm::mod(glm::vec3(4.0f, 4.0f, 4.0f), glm::vec3(2.0f, 2.0f, 2.0f));
glm::vec3 vec_mod2 = glm::mod(glm::vec3(4.0f, 4.0f, 4.0f), float(2.0f));
if(vec_mod1.x != 0.0f ||
vec_mod1.y != 0.0f ||
vec_mod1.z != 0.0f)
return false;
if(vec_mod2.x != 0.0f ||
vec_mod2.y != 0.0f ||
vec_mod2.z != 0.0f)
return false;
return true;
}
bool test_mod_4()
{
glm::vec4 vec_mod1 = glm::mod(glm::vec4(4.0f, 4.0f, 4.0f, 4.0f), glm::vec4(2.0f, 2.0f, 2.0f, 2.0f));
glm::vec4 vec_mod2 = glm::mod(glm::vec4(4.0f, 4.0f, 4.0f, 4.0f), float(2.0f));
if(vec_mod1.x != 0.0f ||
vec_mod1.y != 0.0f ||
vec_mod1.z != 0.0f ||
vec_mod1.w != 0.0f)
return false;
if(vec_mod2.x != 0.0f ||
vec_mod2.y != 0.0f ||
vec_mod2.z != 0.0f ||
vec_mod2.w != 0.0f)
return false;
return true;
}
bool test_modf()
{
return true;
}
bool test_min_1()
{
float val_min = glm::min(float(0.0f), float(1.0f));
if(val_min > 0.0f)
return false;
return true;
}
bool test_min_2()
{
glm::vec2 val_min1 = glm::min(glm::vec2(0.0f, 0.0f), glm::vec2(1.0f, 1.0f));
glm::vec2 val_min2 = glm::min(glm::vec2(0.0f, 0.0f), float(1.0f));
if(val_min1.x > 0.0f ||
val_min1.y > 0.0f)
return false;
if(val_min2.x > 0.0f ||
val_min2.y > 0.0f)
return false;
return true;
}
bool test_min_3()
{
glm::vec3 val_min1 = glm::min(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(1.0f, 1.0f, 1.0f));
glm::vec3 val_min2 = glm::min(glm::vec3(0.0f, 0.0f, 0.0f), float(1.0f));
if(val_min1.x > 0.0f ||
val_min1.y > 0.0f ||
val_min1.z > 0.0f)
return false;
if(val_min2.x > 0.0f ||
val_min2.y > 0.0f ||
val_min2.z > 0.0f)
return false;
return true;
}
bool test_min_4()
{
glm::vec4 val_min1 = glm::min(glm::vec4(0.0f, 0.0f, 0.0f, 0.0f), glm::vec4(1.0f, 1.0f, 1.0f, 1.0f));
glm::vec4 val_min2 = glm::min(glm::vec4(0.0f, 0.0f, 0.0f, 0.0f), float(1.0f));
if(val_min1.x > 0.0f ||
val_min1.y > 0.0f ||
val_min1.z > 0.0f ||
val_min1.w > 0.0f)
return false;
if(val_min2.x > 0.0f ||
val_min2.y > 0.0f ||
val_min2.z > 0.0f ||
val_min2.w > 0.0f)
return false;
return true;
}
bool test_max_1()
{
float val_max = glm::max(float(0.0f), float(1.0f));
if(val_max < 1.0f)
return false;
return true;
}
bool test_max_2()
{
glm::vec2 val_max1 = glm::max(glm::vec2(0.0f, 0.0f), glm::vec2(1.0f, 1.0f));
glm::vec2 val_max2 = glm::max(glm::vec2(0.0f, 0.0f), float(1.0f));
if(val_max1.x < 1.0f ||
val_max1.y < 1.0f)
return false;
if(val_max2.x < 1.0f ||
val_max2.y < 1.0f)
return false;
return true;
}
bool test_max_3()
{
glm::vec3 val_max1 = glm::max(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(1.0f, 1.0f, 1.0f));
glm::vec3 val_max2 = glm::max(glm::vec3(0.0f, 0.0f, 0.0f), float(1.0f));
if(val_max1.x < 1.0f ||
val_max1.y < 1.0f ||
val_max1.z < 1.0f)
return false;
if(val_max2.x < 1.0f ||
val_max2.y < 1.0f ||
val_max2.z < 1.0f)
return false;
return true;
}
bool test_max_4()
{
glm::vec4 val_max1 = glm::max(glm::vec4(0.0f, 0.0f, 0.0f, 0.0f), glm::vec4(1.0f, 1.0f, 1.0f, 1.0f));
glm::vec4 val_max2 = glm::max(glm::vec4(0.0f, 0.0f, 0.0f, 0.0f), float(1.0f));
if(val_max1.x < 1.0f ||
val_max1.y < 1.0f ||
val_max1.z < 1.0f ||
val_max1.w < 1.0f)
return false;
if(val_max2.x < 1.0f ||
val_max2.y < 1.0f ||
val_max2.z < 1.0f ||
val_max2.w < 1.0f)
return false;
return true;
}
bool test_clamp_1()
{
float clamp1 = glm::clamp(float( 4.0f), float(0.0f), float(1.0f));
float clamp2 = glm::clamp(float(-4.0f), float(0.0f), float(1.0f));
if(clamp1 != 1.0f ||
clamp2 != 0.0f)
return false;
return true;
}
bool test_clamp_2()
{
glm::vec2 clamp1 = glm::clamp(
glm::vec2( 4.0f, 4.0f),
glm::vec2( 0.0f, 0.0f),
glm::vec2( 1.0f, 1.0f));
glm::vec2 clamp2 = glm::clamp(
glm::vec2(-4.0f,-4.0f),
glm::vec2( 0.0f, 0.0f),
glm::vec2( 1.0f, 1.0f));
glm::vec2 clamp3 = glm::clamp(
glm::vec2( 4.0f, 4.0f),
float(0.0f), float(1.0f));
glm::vec2 clamp4 = glm::clamp(
glm::vec2(-4.0f,-4.0f),
float(0.0f), float(1.0f));
if(clamp1.x != 1.0f ||
clamp1.y != 1.0f)
return false;
if(clamp2.x != 0.0f ||
clamp2.y != 0.0f)
return false;
if(clamp3.x != 1.0f ||
clamp3.y != 1.0f)
return false;
if(clamp4.x != 0.0f ||
clamp4.y != 0.0f)
return false;
return true;
}
bool test_clamp_3()
{
glm::vec3 clamp1 = glm::clamp(
glm::vec3( 4.0f, 4.0f, 4.0f),
glm::vec3( 0.0f, 0.0f, 0.0f),
glm::vec3( 1.0f, 1.0f, 1.0f));
glm::vec3 clamp2 = glm::clamp(
glm::vec3(-4.0f,-4.0f,-4.0f),
glm::vec3( 0.0f, 0.0f, 0.0f),
glm::vec3( 1.0f, 1.0f, 1.0f));
glm::vec3 clamp3 = glm::clamp(
glm::vec3( 4.0f, 4.0f, 4.0f),
float(0.0f), float(1.0f));
glm::vec3 clamp4 = glm::clamp(
glm::vec3(-4.0f,-4.0f,-4.0f),
float(0.0f), float(1.0f));
if(clamp1.x != 1.0f ||
clamp1.y != 1.0f ||
clamp1.z != 1.0f)
return false;
if(clamp2.x != 0.0f ||
clamp2.y != 0.0f ||
clamp2.z != 0.0f)
return false;
if(clamp3.x != 1.0f ||
clamp3.y != 1.0f ||
clamp3.z != 1.0f)
return false;
if(clamp4.x != 0.0f ||
clamp4.y != 0.0f ||
clamp4.z != 0.0f)
return false;
return true;
}
bool test_clamp_4()
{
glm::vec4 clamp1 = glm::clamp(
glm::vec4( 4.0f, 4.0f, 4.0f, 4.0f),
glm::vec4( 0.0f, 0.0f, 0.0f, 0.0f),
glm::vec4( 1.0f, 1.0f, 1.0f, 1.0f));
glm::vec4 clamp2 = glm::clamp(
glm::vec4(-4.0f,-4.0f,-4.0f,-4.0f),
glm::vec4( 0.0f, 0.0f, 0.0f, 0.0f),
glm::vec4( 1.0f, 1.0f, 1.0f, 1.0f));
glm::vec4 clamp3 = glm::clamp(
glm::vec4( 4.0f, 4.0f, 4.0f, 4.0f),
float(0.0f), float(1.0f));
glm::vec4 clamp4 = glm::clamp(
glm::vec4(-4.0f,-4.0f,-4.0f,-4.0f),
float(0.0f), float(1.0f));
if(clamp1.x != 1.0f ||
clamp1.y != 1.0f ||
clamp1.z != 1.0f ||
clamp1.w != 1.0f)
return false;
if(clamp2.x != 0.0f ||
clamp2.y != 0.0f ||
clamp2.z != 0.0f ||
clamp2.w != 0.0f)
return false;
if(clamp3.x != 1.0f ||
clamp3.y != 1.0f ||
clamp3.z != 1.0f ||
clamp3.w != 1.0f)
return false;
if(clamp4.x != 0.0f ||
clamp4.y != 0.0f ||
clamp4.z != 0.0f ||
clamp4.w != 0.0f)
return false;
return true;
}
bool test_mix_1()
{
float val_mix = glm::mix(float(1.0f), float(1.0f), float(1.0f));
if(val_mix != 1.0f)
return false;
return true;
}
bool test_mix_2()
{
glm::vec2 val_mix1 = glm::mix(glm::vec2(1.0f, 1.0f), glm::vec2(1.0f, 1.0f), glm::vec2(1.0f, 1.0f));
glm::vec2 val_mix2 = glm::mix(glm::vec2(1.0f, 1.0f), glm::vec2(1.0f, 1.0f), float(1.0f));
if(val_mix1.x != 1.0f || val_mix1.y != 1.0f ||
val_mix2.x != 1.0f || val_mix2.y != 1.0f)
return false;
return true;
}
bool test_mix_3()
{
glm::vec3 val_mix1 = glm::mix(glm::vec3(1.0f, 1.0f, 1.0f), glm::vec3(1.0f, 1.0f, 1.0f), glm::vec3(1.0f, 1.0f, 1.0f));
glm::vec3 val_mix2 = glm::mix(glm::vec3(1.0f, 1.0f, 1.0f), glm::vec3(1.0f, 1.0f, 1.0f), float(1.0f));
if(val_mix1.x != 1.0f || val_mix1.y != 1.0f || val_mix1.z != 1.0f ||
val_mix2.x != 1.0f || val_mix2.y != 1.0f || val_mix2.z != 1.0f)
return false;
return true;
}
bool test_mix_4()
{
glm::vec4 val_mix1 = glm::mix(glm::vec4(1.0f, 1.0f, 1.0f, 1.0f), glm::vec4(1.0f, 1.0f, 1.0f, 1.0f), glm::vec4(1.0f, 1.0f, 1.0f, 1.0f));
glm::vec4 val_mix2 = glm::mix(glm::vec4(1.0f, 1.0f, 1.0f, 1.0f), glm::vec4(1.0f, 1.0f, 1.0f, 1.0f), float(1.0f));
if(val_mix1.x != 1.0f || val_mix1.y != 1.0f || val_mix1.z != 1.0f || val_mix1.w != 1.0f ||
val_mix2.x != 1.0f || val_mix2.y != 1.0f || val_mix2.z != 1.0f || val_mix2.w != 1.0f)
return false;
return true;
}
bool test_step_1()
{
float vec_step1 = step(1.f, 76.f);
if(vec_step1 != 1.0f)
return false;
return true;
}
bool test_step_2()
{
vec2 vec_step1 = step(1.f, vec2(76.f, 1.f));
vec2 vec_step2 = step(vec2(1.f, 1.f), vec2(76.f, 1.f));
if(vec_step1.x != 1.0f || vec_step1.y != 0.0f ||
vec_step2.x != 1.0f || vec_step2.y != 0.0f)
return false;
return true;
}
bool test_step_3()
{
vec3 vec_step1 = step(1.f, vec3(76.f, 1.f, 0.f));
vec3 vec_step2 = step(vec3(1.f, 1.f, 1.f), vec3(76.f, 1.f, 0.f));
if(vec_step1.x != 1.0f || vec_step1.y != 0.0f || vec_step1.z != 0.0f ||
vec_step2.x != 1.0f || vec_step2.y != 0.0f || vec_step2.z != 0.0f)
return false;
return true;
}
bool test_step_4()
{
vec4 vec_step1 = step(1.f, vec4(76.f, 1.f, 0.f, 0.f));
vec4 vec_step2 = step(vec4(1.f, 1.f, 1.f, 1.f), vec4(76.f, 1.f, 0.f, 0.f));
if(vec_step1.x != 1.0f || vec_step1.y != 0.0f || vec_step1.z != 0.0f || vec_step1.w != 0.0f ||
vec_step2.x != 1.0f || vec_step2.y != 0.0f || vec_step2.z != 0.0f || vec_step2.w != 0.0f)
return false;
return true;
}
bool test_smoothstep_1()
{
float vec_smoothstep1 = smoothstep(0.f, 100.f, 50.f);
bool Result = (vec_smoothstep1 < 0.5f - epsilon || vec_smoothstep1 > 0.5f + epsilon);
assert(!Result);
float A = smoothstep(0.2f, 0.8f, 0.5f);
float B = smoothstep(0.2f, 0.8f, 0.7f);
float C = smoothstep(0.2f, 0.8f, 0.3f);
float D = smoothstep(0.2f, 0.8f, 1.2f);
float E = smoothstep(0.2f, 0.8f,-0.2f);
if(Result)
return false;
return true;
}
bool test_smoothstep_2()
{
vec2 vec_smoothstep1 = smoothstep(0.f, 100.f, vec2(50.f, 100.f));
vec2 vec_smoothstep2 = smoothstep(vec2(0.f, 0.f), vec2(100.f, 100.f), vec2(50.f, 100.f));
if(vec_smoothstep1.x < 0.50f - epsilon || vec_smoothstep1.x > 0.50f + epsilon ||
vec_smoothstep1.y < 1.00f - epsilon || vec_smoothstep1.y > 1.00f + epsilon)
return false;
if(vec_smoothstep2.x < 0.50f - epsilon || vec_smoothstep2.x > 0.50f + epsilon ||
vec_smoothstep2.y < 1.00f - epsilon || vec_smoothstep2.y > 1.00f + epsilon)
return false;
return true;
}
bool test_smoothstep_3()
{
vec3 vec_smoothstep1 = smoothstep(0.f, 100.f, vec3(50.f, 100.f, 0.f));
vec3 vec_smoothstep2 = smoothstep(vec3(0.f, 0.f, 0.f), vec3(100.f, 100.f, 100.f), vec3(50.f, 100.f, 0.f));
if(vec_smoothstep1.x < 0.50f - epsilon || vec_smoothstep1.x > 0.50f + epsilon ||
vec_smoothstep1.y < 1.00f - epsilon || vec_smoothstep1.y > 1.00f + epsilon ||
vec_smoothstep1.z < 0.00f - epsilon || vec_smoothstep1.z > 0.00f + epsilon)
return false;
if(vec_smoothstep2.x < 0.50f - epsilon || vec_smoothstep2.x > 0.50f + epsilon ||
vec_smoothstep2.y < 1.00f - epsilon || vec_smoothstep2.y > 1.00f + epsilon ||
vec_smoothstep2.z < 0.00f - epsilon || vec_smoothstep2.z > 0.00f + epsilon)
return false;
return true;
}
bool test_smoothstep_4()
{
vec4 vec_smoothstep1 = smoothstep(0.f, 100.f, vec4(50.f, 100.f, 0.f, 0.f));
vec4 vec_smoothstep2 = smoothstep(vec4(0.f, 0.f, 0.f, 0.f), vec4(100.f, 100.f, 100.f, 100.f), vec4(50.f, 100.f, 0.f, 0.f));
if(vec_smoothstep1.x < 0.50f - epsilon || vec_smoothstep1.x > 0.50f + epsilon ||
vec_smoothstep1.y < 1.00f - epsilon || vec_smoothstep1.y > 1.00f + epsilon ||
vec_smoothstep1.z < 0.00f - epsilon || vec_smoothstep1.z > 0.00f + epsilon ||
vec_smoothstep1.w < 0.00f - epsilon || vec_smoothstep1.w > 0.00f + epsilon)
return false;
if(vec_smoothstep2.x < 0.50f - epsilon || vec_smoothstep2.x > 0.50f + epsilon ||
vec_smoothstep2.y < 1.00f - epsilon || vec_smoothstep2.y > 1.00f + epsilon ||
vec_smoothstep2.z < 0.00f - epsilon || vec_smoothstep2.z > 0.00f + epsilon ||
vec_smoothstep2.w < 0.00f - epsilon || vec_smoothstep2.w > 0.00f + epsilon)
return false;
return true;
}
bool test_isnan()
{
return true;
}
bool test_isinf()
{
return true;
}
void main_core_func_common()
{
assert(test_abs_type1());
assert(test_abs_type2());
assert(test_abs_type3());
assert(test_abs_type4());
assert(test_sign_type1());
assert(test_sign_type2());
assert(test_sign_type3());
assert(test_sign_type4());
assert(test_floor_type1());
assert(test_floor_type2());
assert(test_floor_type3());
assert(test_floor_type4());
assert(test_trunc_type1());
assert(test_trunc_type2());
assert(test_trunc_type3());
assert(test_trunc_type4());
assert(test_round_type1());
assert(test_round_type2());
assert(test_round_type3());
assert(test_round_type4());
assert(test_roundEven_type1());
assert(test_roundEven_type2());
assert(test_roundEven_type3());
assert(test_roundEven_type4());
assert(test_ceil_1());
assert(test_ceil_2());
assert(test_ceil_3());
assert(test_ceil_4());
assert(test_fract_1());
assert(test_fract_2());
assert(test_fract_3());
assert(test_fract_4());
assert(test_mod_1());
assert(test_mod_2());
assert(test_mod_3());
assert(test_mod_4());
assert(test_mod_1());
assert(test_mod_2());
assert(test_mod_3());
assert(test_mod_4());
assert(test_modf());
assert(test_min_1());
assert(test_min_2());
assert(test_min_3());
assert(test_min_4());
assert(test_max_1());
assert(test_max_2());
assert(test_max_3());
assert(test_max_4());
assert(test_clamp_1());
assert(test_clamp_2());
assert(test_clamp_3());
assert(test_clamp_4());
assert(test_mix_1());
assert(test_mix_2());
assert(test_mix_3());
assert(test_mix_4());
assert(test_step_1());
assert(test_step_2());
assert(test_step_3());
assert(test_step_4());
assert(test_smoothstep_1());
assert(test_smoothstep_2());
assert(test_smoothstep_3());
assert(test_smoothstep_4());
assert(test_isnan());
assert(test_isinf());
}
}//namespace test
}//namespace glm

View File

@ -0,0 +1,351 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/func_exponential.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/func_exponential.hpp>
namespace glm{
namespace test{
static const float epsilon = 0.00001f;
bool test_pow_1()
{
float power = glm::pow(2.f, 2.f);
if(power <= 4.f + epsilon && power >= 4.f - epsilon)
return true;
return false;
}
bool test_pow_2()
{
glm::vec2 power = glm::pow(glm::vec2(2.f, 2.f), glm::vec2(2.f, 2.f));
if(power.x <= 4.f + epsilon && power.x >= 4.f - epsilon &&
power.y <= 4.f + epsilon && power.y >= 4.f - epsilon)
return true;
return false;
}
bool test_pow_3()
{
glm::vec3 power = glm::pow(glm::vec3(2.f, 2.f, 2.f), glm::vec3(2.f, 2.f, 2.f));
if(power.x <= 4.f + epsilon && power.x >= 4.f - epsilon &&
power.y <= 4.f + epsilon && power.y >= 4.f - epsilon &&
power.z <= 4.f + epsilon && power.z >= 4.f - epsilon)
return true;
return false;
}
bool test_pow_4()
{
glm::vec4 power = glm::pow(glm::vec4(2.f, 2.f, 2.f, 2.f), glm::vec4(2.f, 2.f, 2.f, 2.f));
if(power.x <= 4.f + epsilon && power.x >= 4.f - epsilon &&
power.y <= 4.f + epsilon && power.y >= 4.f - epsilon &&
power.z <= 4.f + epsilon && power.z >= 4.f - epsilon &&
power.w <= 4.f + epsilon && power.w >= 4.f - epsilon)
return true;
return false;
}
bool test_exp_1()
{
float result = glm::exp(0.f);
if(result > 1.f + epsilon || result < 1.f - epsilon)
return false;
return true;
}
bool test_exp_2()
{
glm::vec2 result = glm::exp(glm::vec2(0.f, 0.f));
if(result.x > 1.f + epsilon || result.x < 1.f - epsilon ||
result.y > 1.f + epsilon || result.y < 1.f - epsilon)
return false;
return true;
}
bool test_exp_3()
{
glm::vec3 result = glm::exp(glm::vec3(0.f, 0.f, 0.f));
if(result.x > 1.f + epsilon || result.x < 1.f - epsilon ||
result.y > 1.f + epsilon || result.y < 1.f - epsilon ||
result.z > 1.f + epsilon || result.z < 1.f - epsilon)
return false;
return true;
}
bool test_exp_4()
{
glm::vec4 result = glm::exp(glm::vec4(0.f, 0.f, 0.f, 0.f));
if(result.x > 1.f + epsilon || result.x < 1.f - epsilon ||
result.y > 1.f + epsilon || result.y < 1.f - epsilon ||
result.z > 1.f + epsilon || result.z < 1.f - epsilon ||
result.w > 1.f + epsilon || result.w < 1.f - epsilon)
return false;
return true;
}
bool test_log_1()
{
float result = glm::log(1.f);
if(result > epsilon || result < -epsilon)
return false;
return true;
}
bool test_log_2()
{
glm::vec2 result = glm::log(glm::vec2(1.f, 1.f));
if(result.x > epsilon || result.x < -epsilon ||
result.y > epsilon || result.y < -epsilon)
return false;
return true;
}
bool test_log_3()
{
glm::vec3 result = glm::log(glm::vec3(1.f, 1.f, 1.f));
if(result.x > epsilon || result.x < -epsilon ||
result.y > epsilon || result.y < -epsilon ||
result.z > epsilon || result.z < -epsilon)
return false;
return true;
}
bool test_log_4()
{
glm::vec4 result = glm::log(glm::vec4(1.f, 1.f, 1.f, 1.f));
if(result.x > epsilon || result.x < -epsilon ||
result.y > epsilon || result.y < -epsilon ||
result.z > epsilon || result.z < -epsilon ||
result.w > epsilon || result.w < -epsilon)
return false;
return true;
}
bool test_exp2_1()
{
float result = glm::exp2(2.f);
if(result > 4.f + epsilon || result < 4.f - epsilon)
return false;
return true;
}
bool test_exp2_2()
{
glm::vec2 result = glm::exp2(glm::vec2(2.f, 2.f));
if(result.x > 4.f + epsilon || result.x < 4.f - epsilon ||
result.y > 4.f + epsilon || result.y < 4.f - epsilon)
return false;
return true;
}
bool test_exp2_3()
{
glm::vec3 result = glm::exp2(glm::vec3(2.f, 2.f, 2.f));
if(result.x > 4.f + epsilon || result.x < 4.f - epsilon ||
result.y > 4.f + epsilon || result.y < 4.f - epsilon ||
result.z > 4.f + epsilon || result.z < 4.f - epsilon)
return false;
return true;
}
bool test_exp2_4()
{
glm::vec4 result = glm::exp2(glm::vec4(2.f, 2.f, 2.f, 2.f));
if(result.x > 4.f + epsilon || result.x < 4.f - epsilon ||
result.y > 4.f + epsilon || result.y < 4.f - epsilon ||
result.z > 4.f + epsilon || result.z < 4.f - epsilon ||
result.w > 4.f + epsilon || result.w < 4.f - epsilon)
return false;
return true;
}
bool test_log2_1()
{
float result = glm::log2(2.f);
if(result > 1.f + epsilon || result < 1.f - epsilon)
return false;
return true;
}
bool test_log2_2()
{
glm::vec2 result = glm::log2(glm::vec2(2.f, 4.f));
if(result.x > 1.f + epsilon || result.x < 1.f - epsilon ||
result.y > 2.f + epsilon || result.y < 2.f - epsilon)
return false;
return true;
}
bool test_log2_3()
{
glm::vec3 result = glm::log2(glm::vec3(2.f, 4.f, 8.f));
if(result.x > 1.f + epsilon || result.x < 1.f - epsilon ||
result.y > 2.f + epsilon || result.y < 2.f - epsilon ||
result.z > 3.f + epsilon || result.z < 3.f - epsilon)
return false;
return true;
}
bool test_log2_4()
{
glm::vec4 result = glm::log2(glm::vec4(2.f, 4.f, 8.f, 16.f));
if(result.x > 1.f + epsilon || result.x < 1.f - epsilon ||
result.y > 2.f + epsilon || result.y < 2.f - epsilon ||
result.z > 3.f + epsilon || result.z < 3.f - epsilon ||
result.w > 4.f + epsilon || result.w < 4.f - epsilon)
return false;
return true;
}
bool test_sqrt_1()
{
float result = glm::sqrt(4.f);
if(result < 2.f - epsilon && result > 2.f + epsilon)
return false;
return true;
}
bool test_sqrt_2()
{
glm::vec2 result = glm::sqrt(glm::vec2(4.f, 4.f));
if(result.x < 2.f - epsilon && result.x > 2.f + epsilon &&
result.y < 2.f - epsilon && result.y > 2.f + epsilon)
return false;
return true;
}
bool test_sqrt_3()
{
glm::vec3 result = glm::sqrt(glm::vec3(4.f, 4.f, 4.f));
if(result.x < 2.f - epsilon && result.x > 2.f + epsilon &&
result.y < 2.f - epsilon && result.y > 2.f + epsilon &&
result.z < 2.f - epsilon && result.z > 2.f + epsilon)
return false;
return true;
}
bool test_sqrt_4()
{
glm::vec4 result = glm::sqrt(glm::vec4(4.f, 4.f, 4.f, 4.f));
if(result.x < 2.f - epsilon && result.x > 2.f + epsilon &&
result.y < 2.f - epsilon && result.y > 2.f + epsilon &&
result.z < 2.f - epsilon && result.z > 2.f + epsilon &&
result.w < 2.f - epsilon && result.w > 2.f + epsilon)
return false;
return true;
}
bool test_inversesqrt_1()
{
float result = glm::inversesqrt(4.f);
if(result < 0.5f - epsilon && result > 0.5f + epsilon)
return false;
return true;
}
bool test_inversesqrt_2()
{
glm::vec2 result = glm::inversesqrt(glm::vec2(4.f, 4.f));
if(result.x < 0.5f - epsilon && result.x > 0.5f + epsilon &&
result.y < 0.5f - epsilon && result.y > 0.5f + epsilon)
return false;
return true;
}
bool test_inversesqrt_3()
{
glm::vec3 result = glm::inversesqrt(glm::vec3(4.f, 4.f, 4.f));
if(result.x < 0.5f - epsilon && result.x > 0.5f + epsilon &&
result.y < 0.5f - epsilon && result.y > 0.5f + epsilon &&
result.z < 0.5f - epsilon && result.z > 0.5f + epsilon)
return false;
return true;
}
bool test_inversesqrt_4()
{
glm::vec4 result = glm::inversesqrt(glm::vec4(4.f, 4.f, 4.f, 4.f));
if(result.x < 0.5f - epsilon && result.x > 0.5f + epsilon &&
result.y < 0.5f - epsilon && result.y > 0.5f + epsilon &&
result.z < 0.5f - epsilon && result.z > 0.5f + epsilon &&
result.w < 0.5f - epsilon && result.w > 0.5f + epsilon)
return false;
return true;
}
void main_core_func_exponential()
{
assert(test_pow_1());
assert(test_pow_2());
assert(test_pow_3());
assert(test_pow_4());
assert(test_exp_1());
assert(test_exp_2());
assert(test_exp_3());
assert(test_exp_4());
assert(test_log_1());
assert(test_log_2());
assert(test_log_3());
assert(test_log_4());
assert(test_exp2_1());
assert(test_exp2_2());
assert(test_exp2_3());
assert(test_exp2_4());
assert(test_log2_1());
assert(test_log2_2());
assert(test_log2_3());
assert(test_log2_4());
assert(test_sqrt_1());
assert(test_sqrt_2());
assert(test_sqrt_3());
assert(test_sqrt_4());
assert(test_inversesqrt_1());
assert(test_inversesqrt_2());
assert(test_inversesqrt_3());
assert(test_inversesqrt_4());
}
}//namespace test
}//namespace glm

View File

@ -0,0 +1,370 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/func_geometric.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/func_geometric.hpp>
namespace glm{
namespace test{
bool test_length_1()
{
float f1 = 0.0f;
float len1 = length(f1);
float f2 = 1.0f;
float len2 = length(f2);
if (len1 == 0.0f && len2 == 1.0f)
return true;
return false;
}
bool test_length_2()
{
vec2 v1 = vec2(0, 0);
float len1 = length(v1);
vec2 v2 = vec2 (1, 1);
float len2 = length(v2);
if (len1 == 0.0f && len2 > 1.41f && len2 < 1.42f)
return true;
return false;
}
bool test_length_3()
{
vec3 v1 = vec3(0, 0, 0);
float len1 = length(v1);
vec3 v2 = vec3 (1, 1, 1);
float len2 = length(v2);
if (len1 == 0.0f && len2 > 1.73f && len2 < 1.74f)
return true;
return false;
}
bool test_length_4()
{
vec4 v1 = vec4(0, 0, 0, 0);
float len1 = length(v1);
vec4 v2 = vec4(1, 1, 1, 1);
float len2 = length(v2);
if (len1 == 0.0f && len2 == 2.f)
return true;
return false;
}
bool test_distance_1()
{
float p0 = 2.f;
float p1 = -2.f;
float dist = distance(p0, p1);
if (dist == 4.0f)
return true;
return false;
}
bool test_distance_2()
{
vec2 p0 = vec2(0.f, 2.f);
vec2 p1 = vec2(0.f,-2.f);
float dist = distance(p0, p1);
if (dist == 4.0f)
return true;
return false;
}
bool test_distance_3()
{
vec3 p0 = vec3(0.f, 0.f, 2.f);
vec3 p1 = vec3(0.f, 0.f,-2.f);
float dist = distance(p0, p1);
if (dist == 4.0f)
return true;
return false;
}
bool test_distance_4()
{
vec4 p0 = vec4(0.f, 0.f, 2.f, 0.f);
vec4 p1 = vec4(0.f, 0.f,-2.f, 0.f);
float dist = distance(p0, p1);
if (dist == 4.0f)
return true;
return false;
}
bool test_dot_1()
{
float v1 = 1.0f;
float v2 = 0.0f;
float dot1 = dot (v1, v1);
float dot2 = dot (v1, v2);
if (dot1 == 1.0f && dot2 == 0.0f)
return true;
return false;
}
bool test_dot_2()
{
vec2 v1 = vec2 (1, 0);
vec2 v2 = vec2 (0, 1);
float dot1 = dot (v1, v1);
float dot2 = dot (v1, v2);
if (dot1 == 1.0f && dot2 == 0.0f)
return true;
return false;
}
bool test_dot_3()
{
vec3 v1 = vec3 (1, 0, 0);
vec3 v2 = vec3 (0, 1, 0);
float dot1 = dot (v1, v1);
float dot2 = dot (v1, v2);
if (dot1 == 1.0f && dot2 == 0.0f)
return true;
return false;
}
bool test_dot_4()
{
vec4 v1 = vec4 (1, 0, 0, 0);
vec4 v2 = vec4 (0, 1, 0, 0);
float dot1 = dot (v1, v1);
float dot2 = dot (v1, v2);
if (dot1 == 1.0f && dot2 == 0.0f)
return true;
return false;
}
bool test_cross_vec3 ()
{
vec3 v1 = vec3(1.0f, 0.0f, 0.0f);
vec3 v2 = vec3(0.0f, 1.0f, 0.0f);
vec3 v3 = cross(v1, v2);
vec3 v4 = vec3(0.0f, 0.0f, 1.0f);
if (v3.x == v4.x && v3.y == v4.y && v3.z == v4.z)
return true;
return false;
}
bool test_normalize_1()
{
float f1 = 0.0f;
f1 = normalize(f1);
float f2 = 1.0f;
f2 = normalize(f2);
if (f1 == 1.0f && f2 == 1.0f)
return true;
return false;
}
bool test_normalize_2()
{
vec2 v1 = vec2(0, 0);
v1 = normalize(v1);
vec2 v2 = vec2 (1, 1);
v2 = normalize(v2);
if (length (v2) > 0.99f && length (v2) < 1.01f)
return true;
return false;
}
bool test_normalize_3()
{
vec3 v1 = vec3(0, 0, 0);
v1 = normalize(v1);
vec3 v2 = vec3(1, 1, 1);
v2 = normalize(v2);
if (length (v2) > 0.99f && length (v2) < 1.01f)
return true;
return false;
}
bool test_normalize_4()
{
vec4 v1 = vec4(0, 0, 0, 0);
v1 = normalize(v1);
vec4 v2 = vec4(1, 1, 1, 1);
v2 = normalize(v2);
if (length (v2) > 0.99f && length (v2) < 1.01f)
return true;
return false;
}
bool test_faceforward_1()
{
float N = 1.0f;
float I = 1.0f;
float Nref = 1.0f;
N = faceforward(N, I, Nref);
if (N == -1)
return true;
return false;
}
bool test_faceforward_2()
{
vec2 N = vec2(1, 1);
vec2 I = vec2(1, 0);
vec2 Nref = vec2(0, 0);
N = faceforward(N, I, Nref);
if (N.x == -1 && N.y == -1)
return true;
return false;
}
bool test_faceforward_3()
{
vec3 N = vec3(1, 1, 1);
vec3 I = vec3(1, 0, 0);
vec3 Nref = vec3(0, 0, 0);
N = faceforward(N, I, Nref);
if (N.x == -1 && N.y == -1 && N.z == -1)
return true;
return false;
}
bool test_faceforward_4()
{
vec4 N = vec4(1, 1, 1, 1);
vec4 I = vec4(1, 0, 0, 0);
vec4 Nref = vec4(0, 0, 0, 0);
N = faceforward(N, I, Nref);
if (N.x == -1 && N.y == -1 && N.z == -1 && N.w == -1)
return true;
return false;
}
bool test_reflect_2()
{
vec2 N = vec2( 1, 0);
vec2 I = vec2(-1, 0);
vec2 result = reflect(I, N);
if (result.x != 1.0f || result.y != 0.f)
return false;
return true;
}
bool test_reflect_3()
{
vec3 N = vec3( 1, 0, 0);
vec3 I = vec3(-1, 0, 0);
vec3 result = reflect(I, N);
if (result.x != 1.0f || result.y != 0.f || result.z != 0.f)
return false;
return true;
}
bool test_reflect_4()
{
vec4 N = vec4( 1, 0, 0, 0);
vec4 I = vec4(-1, 0, 0, 0);
vec4 result = reflect(I, N);
if (result.x != 1.0f || result.y != 0.f || result.z != 0.f || result.w != 0.f)
return false;
return true;
}
bool test_refract_2()
{
glm::vec2 N = glm::vec2( 1, 0);
glm::vec2 I = glm::vec2(-1, 0);
glm::vec2 result = glm::refract(I, N, 1.0f);
if (result.x != -1.f || result.y != 0.f)
return false;
return true;
}
bool test_refract_3()
{
glm::vec3 N = glm::vec3( 1, 0, 0);
glm::vec3 I = glm::vec3(-1, 0, 0);
glm::vec3 result = glm::refract(I, N, 1.0f);
if (result.x != -1.f || result.y != 0.f || result.z != 0.f)
return false;
return true;
}
bool test_refract_4()
{
glm::vec4 N = glm::vec4( 1, 0, 0, 0);
glm::vec4 I = glm::vec4(-1, 0, 0, 0);
glm::vec4 result = glm::refract(I, N, 1.0f);
if (result.x != -1.f || result.y != 0.f || result.z != 0.f || result.w != 0.f)
return false;
return true;
}
void main_core_func_geometric()
{
assert(test_length_1());
assert(test_length_2());
assert(test_length_3());
assert(test_length_4());
assert(test_distance_1());
assert(test_distance_2());
assert(test_distance_3());
assert(test_distance_4());
assert(test_dot_1());
assert(test_dot_2());
assert(test_dot_3());
assert(test_dot_4());
assert(test_cross_vec3());
assert(test_normalize_1());
assert(test_normalize_2());
assert(test_normalize_3());
assert(test_normalize_4());
assert(test_faceforward_1());
assert(test_faceforward_2());
assert(test_faceforward_3());
assert(test_faceforward_4());
assert(test_reflect_2());
assert(test_reflect_3());
assert(test_reflect_4());
assert(test_refract_2());
assert(test_refract_3());
assert(test_refract_4());
}
}//namespace test
}//namespace glm

81
test/core/func_matrix.cpp Normal file
View File

@ -0,0 +1,81 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/func_matrix.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/func_matrix.hpp>
namespace glm{
namespace test{
bool test_matrixcompmult_2x2()
{
mat2 x = mat2(vec2(0, 1), vec2(2, 3));
mat2 result = matrixCompMult(x, x);
if(result[0][0] != 0 || result[0][1] != 1 ||
result[1][0] != 4 || result[1][1] != 9)
return false;
return true;
}
bool test_matrixcompmult_3x3()
{
mat3 x = mat3(vec3(0, 0, 0),
vec3(1, 1, 1),
vec3(2, 2, 2));
mat3 result = matrixCompMult(x, x);
if(result[0][0] != 0 || result[0][1] != 0 || result[0][2] != 0 ||
result[1][0] != 1 || result[1][1] != 1 || result[1][2] != 1 ||
result[2][0] != 4 || result[2][1] != 4 || result[2][2] != 4)
return false;
return true;
}
bool test_matrixcompmult_4x4()
{
mat4 x = mat4(vec4(0, 0, 0, 0),
vec4(1, 1, 1, 1),
vec4(2, 2, 2, 2),
vec4(3, 3, 3, 3));
mat4 result = matrixCompMult(x, x);
if(result[0][0] != 0 || result[0][1] != 0 || result[0][2] != 0 || result[0][3] != 0 ||
result[1][0] != 1 || result[1][1] != 1 || result[1][2] != 1 || result[1][3] != 1 ||
result[2][0] != 4 || result[2][1] != 4 || result[2][2] != 4 || result[2][3] != 4 ||
result[3][0] != 9 || result[3][1] != 9 || result[3][2] != 9 || result[3][3] != 9)
return false;
return true;
}
bool test_outerProduct()
{
mat2x2 m0 = glm::outerProduct(vec2(1.f), vec2(1.f));
return true;
}
bool test_transpose()
{
return true;
}
void main_core_func_matrix()
{
assert(test_matrixcompmult_2x2());
assert(test_matrixcompmult_3x3());
assert(test_matrixcompmult_4x4());
assert(test_outerProduct());
assert(test_transpose());
}
}//namespace test
}//namespace glm

27
test/core/func_noise.cpp Normal file
View File

@ -0,0 +1,27 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/func_noise.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/func_noise.hpp>
namespace glm{
namespace test{
bool test_noise()
{
return true;
}
void main_core_func_noise()
{
assert(test_noise());
}
}//namespace test
}//namespace glm

View File

@ -0,0 +1,400 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/func_trigonometric.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/func_trigonometric.hpp>
namespace glm{
namespace test{
static const float epsilon = 0.00001f;
static const float pi = 3.14159265358979323846f;
bool test_radians_1()
{
float angle = radians(360.f);
if(angle < 2.0f * pi + epsilon && angle > 2.0f * pi - epsilon)
return true;
return false;
}
bool test_radians_2()
{
vec2 angle = radians(vec2(360.f, 180.f));
if(angle.x < 2.0f * pi + epsilon && angle.x > 2.0f * pi - epsilon &&
angle.y < pi + epsilon && angle.y > pi - epsilon)
return true;
return false;
}
bool test_radians_3()
{
vec3 angle = radians(vec3(360.f, 180.f, 0.f));
if(angle.x < 2.0f * pi + epsilon && angle.x > 2.0f * pi - epsilon &&
angle.y < pi + epsilon && angle.y > pi - epsilon &&
angle.z == 0.f)
return true;
return false;
}
bool test_radians_4()
{
vec4 angle = radians(vec4 (360.f, 180.f, 0.f, -180.f));
if(angle.x < 2.0f * pi + epsilon && angle.x > 2.0f * pi - epsilon &&
angle.y < pi + epsilon && angle.y > pi - epsilon &&
angle.z == 0.f &&
angle.w > -(pi + epsilon) && angle.w < -(pi - epsilon))
return true;
return false;
}
bool test_degrees_1()
{
float angle1 = degrees(pi * 2.f);
float angle2 = degrees(0.f);
if(angle1 < 360.1f && angle1 > 359.9f && angle2 == 0.0f)
return true;
return false;
}
bool test_degrees_2()
{
vec2 angle = degrees(vec2 (pi * 2.f, pi));
if(angle.x < 360.1f && angle.x > 359.9f &&
angle.y < 180.1f && angle.y > 179.9f)
return true;
return false;
}
bool test_degrees_3()
{
vec3 angle = degrees(vec3 (pi * 2.f, pi, 0.f));
if(angle.x < 360.1f && angle.x > 359.9f &&
angle.y < 180.1f && angle.y > 179.9f &&
angle.z == 0.f)
return true;
return false;
}
bool test_degrees_4()
{
vec4 angle = degrees(vec4 (pi * 2.f, pi, 0.f, -pi));
if(angle.x < 360.1f && angle.x > 359.9f &&
angle.y < 180.1f && angle.y > 179.9f &&
angle.z == 0.f &&
angle.w > -180.1f && angle.w < -179.9f)
return true;
return false;
}
bool test_sin_1()
{
float sinus = glm::sin(0.f);
if(sinus <= epsilon && sinus >= -epsilon)
return true;
return false;
}
bool test_sin_2()
{
glm::vec2 sinus = glm::sin(glm::vec2(0.f, 0.f));
if(sinus.x <= epsilon && sinus.x >= -epsilon &&
sinus.y <= epsilon && sinus.y >= -epsilon)
return true;
return false;
}
bool test_sin_3()
{
glm::vec3 sinus = glm::sin(glm::vec3(0.f, 0.f, 0.f));
if(sinus.x <= epsilon && sinus.x >= -epsilon &&
sinus.y <= epsilon && sinus.y >= -epsilon &&
sinus.z <= epsilon && sinus.z >= -epsilon)
return true;
return false;
}
bool test_sin_4()
{
glm::vec4 sinus = glm::sin(glm::vec4(0.f, 0.f, 0.f, 0.f));
if(sinus.x <= epsilon && sinus.x >= -epsilon &&
sinus.y <= epsilon && sinus.y >= -epsilon &&
sinus.z <= epsilon && sinus.z >= -epsilon &&
sinus.w <= epsilon && sinus.w >= -epsilon)
return true;
return false;
}
bool test_cos_1()
{
float cosinus = glm::cos(0.f);
if(cosinus <= 1.0f + epsilon && cosinus >= 1.0f - epsilon)
return true;
return false;
}
bool test_cos_2()
{
glm::vec2 cosinus = glm::cos(glm::vec2(0.f, 0.f));
if(cosinus.x <= 1.0f + epsilon && cosinus.x >= 1.0f - epsilon &&
cosinus.y <= 1.0f + epsilon && cosinus.y >= 1.0f - epsilon)
return true;
return false;
}
bool test_cos_3()
{
glm::vec3 cosinus = glm::cos(glm::vec3(0.f, 0.f, 0.f));
if(cosinus.x <= 1.0f + epsilon && cosinus.x >= 1.0f - epsilon &&
cosinus.y <= 1.0f + epsilon && cosinus.y >= 1.0f - epsilon &&
cosinus.z <= 1.0f + epsilon && cosinus.z >= 1.0f - epsilon)
return true;
return false;
}
bool test_cos_4()
{
glm::vec4 cosinus = glm::cos(glm::vec4(0.f, 0.f, 0.f, 0.f));
if(cosinus.x <= 1.0f + epsilon && cosinus.x >= 1.0f - epsilon &&
cosinus.y <= 1.0f + epsilon && cosinus.y >= 1.0f - epsilon &&
cosinus.z <= 1.0f + epsilon && cosinus.z >= 1.0f - epsilon &&
cosinus.w <= 1.0f + epsilon && cosinus.w >= 1.0f - epsilon)
return true;
return false;
}
bool test_tan_1()
{
float tangent = glm::tan(0.f);
if(tangent <= epsilon && tangent >= -epsilon)
return true;
return false;
}
bool test_tan_2()
{
glm::vec2 tangent = glm::tan(glm::vec2(0.f, 0.f));
if(tangent.x <= epsilon && tangent.x >= -epsilon &&
tangent.y <= epsilon && tangent.y >= -epsilon)
return true;
return false;
}
bool test_tan_3()
{
glm::vec3 tangent = glm::tan(glm::vec3(0.f, 0.f, 0.f));
if(tangent.x <= epsilon && tangent.x >= -epsilon &&
tangent.y <= epsilon && tangent.y >= -epsilon &&
tangent.z <= epsilon && tangent.z >= -epsilon)
return true;
return false;
}
bool test_tan_4()
{
glm::vec4 tangent = glm::tan(glm::vec4(0.f, 0.f, 0.f, 0.f));
if(tangent.x <= epsilon && tangent.x >= -epsilon &&
tangent.y <= epsilon && tangent.y >= -epsilon &&
tangent.z <= epsilon && tangent.z >= -epsilon &&
tangent.w <= epsilon && tangent.w >= -epsilon)
return true;
return false;
}
bool test_asin_1()
{
float arc_sinus = glm::asin(0.f);
if(arc_sinus <= epsilon && arc_sinus >= -epsilon)
return true;
return false;
}
bool test_asin_2()
{
glm::vec2 arc_sinus = glm::asin(glm::vec2(0.f, 0.f));
if(arc_sinus.x <= epsilon && arc_sinus.x >= -epsilon &&
arc_sinus.y <= epsilon && arc_sinus.y >= -epsilon)
return true;
return false;
}
bool test_asin_3()
{
glm::vec3 arc_sinus = glm::asin(glm::vec3(0.f, 0.f, 0.f));
if(arc_sinus.x <= epsilon && arc_sinus.x >= -epsilon &&
arc_sinus.y <= epsilon && arc_sinus.y >= -epsilon &&
arc_sinus.z <= epsilon && arc_sinus.z >= -epsilon)
return true;
return false;
}
bool test_asin_4()
{
glm::vec4 arc_sinus = glm::sin(glm::vec4(0.f, 0.f, 0.f, 0.f));
if(arc_sinus.x <= epsilon && arc_sinus.x >= -epsilon &&
arc_sinus.y <= epsilon && arc_sinus.y >= -epsilon &&
arc_sinus.z <= epsilon && arc_sinus.z >= -epsilon &&
arc_sinus.w <= epsilon && arc_sinus.w >= -epsilon)
return true;
return false;
}
bool test_acos_1()
{
float arc_cosinus = glm::acos(1.f);
if(arc_cosinus <= epsilon && arc_cosinus >= -epsilon)
return true;
return false;
}
bool test_acos_2()
{
glm::vec2 arc_cosinus = glm::acos(glm::vec2(1.f, 1.f));
if(arc_cosinus.x <= epsilon && arc_cosinus.x >= -epsilon &&
arc_cosinus.y <= epsilon && arc_cosinus.y >= -epsilon)
return true;
return false;
}
bool test_acos_3()
{
glm::vec3 arc_cosinus = glm::acos(glm::vec3(1.f, 1.f, 1.f));
if(arc_cosinus.x <= epsilon && arc_cosinus.x >= -epsilon &&
arc_cosinus.y <= epsilon && arc_cosinus.y >= -epsilon &&
arc_cosinus.z <= epsilon && arc_cosinus.z >= -epsilon)
return true;
return false;
}
bool test_acos_4()
{
glm::vec4 arc_cosinus = glm::acos(glm::vec4(1.f, 1.f, 1.f, 1.f));
if(arc_cosinus.x <= epsilon && arc_cosinus.x >= -epsilon &&
arc_cosinus.y <= epsilon && arc_cosinus.y >= -epsilon &&
arc_cosinus.z <= epsilon && arc_cosinus.z >= -epsilon &&
arc_cosinus.w <= epsilon && arc_cosinus.w >= -epsilon)
return true;
return false;
}
bool test_atan_1()
{
float tangent = glm::atan(0.f);
if(tangent <= epsilon && tangent >= -epsilon)
return true;
return false;
}
bool test_atan_2()
{
glm::vec2 tangent = glm::atan(glm::vec2(0.f, 0.f));
if(tangent.x <= epsilon && tangent.x >= -epsilon &&
tangent.y <= epsilon && tangent.y >= -epsilon)
return true;
return false;
}
bool test_atan_3()
{
glm::vec3 tangent = glm::atan(glm::vec3(0.f, 0.f, 0.f));
if(tangent.x <= epsilon && tangent.x >= -epsilon &&
tangent.y <= epsilon && tangent.y >= -epsilon &&
tangent.z <= epsilon && tangent.z >= -epsilon)
return true;
return false;
}
bool test_atan_4()
{
glm::vec4 tangent = glm::atan(glm::vec4(0.f, 0.f, 0.f, 0.f));
if(tangent.x <= epsilon && tangent.x >= -epsilon &&
tangent.y <= epsilon && tangent.y >= -epsilon &&
tangent.z <= epsilon && tangent.z >= -epsilon &&
tangent.w <= epsilon && tangent.w >= -epsilon)
return true;
return false;
}
void main_core_func_trigonometric()
{
assert(test_radians_1());
assert(test_radians_2());
assert(test_radians_3());
assert(test_radians_4());
assert(test_degrees_1());
assert(test_degrees_2());
assert(test_degrees_3());
assert(test_degrees_4());
assert(test_sin_1());
assert(test_sin_2());
assert(test_sin_3());
assert(test_sin_4());
assert(test_cos_1());
assert(test_cos_2());
assert(test_cos_3());
assert(test_cos_4());
assert(test_tan_1());
assert(test_tan_2());
assert(test_tan_3());
assert(test_tan_4());
assert(test_asin_1());
assert(test_asin_2());
assert(test_asin_3());
assert(test_asin_4());
assert(test_acos_1());
assert(test_acos_2());
assert(test_acos_3());
assert(test_acos_4());
assert(test_atan_1());
assert(test_atan_2());
assert(test_atan_3());
assert(test_atan_4());
}
}//namespace test
}//namespace glm

View File

@ -0,0 +1,383 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/func_vector_relational.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/func_vector_relational.hpp>
namespace glm{
namespace test{
bool test_lessthan_2()
{
bvec2 lessThan1 = lessThan(vec2(0.f, 1.f), vec2(1.f, 0.f));
bvec2 lessThan2 = lessThan(ivec2(0, 1), ivec2(1, 0));
if(!lessThan1.x || lessThan1.y)
return false;
if(!lessThan2.x || lessThan2.y)
return false;
return true;
}
bool test_lessthan_3()
{
bvec3 lessThan1 = lessThan(vec3(0.f, 1.f, 1.f), vec3(1.f, 0.f, 1.f));
bvec3 lessThan2 = lessThan(ivec3(0, 1, 1), ivec3(1, 0, 1));
if(!lessThan1.x || lessThan1.y || lessThan1.z)
return false;
if(!lessThan2.x || lessThan2.y || lessThan2.z)
return false;
return true;
}
bool test_lessthan_4()
{
bvec4 lessThan1 = lessThan(vec4(0.f, 1.f, 1.f, 0.f), vec4(1.f, 0.f, 1.f, 0.f));
bvec4 lessThan2 = lessThan(ivec4(0, 1, 1, 0), ivec4(1, 0, 1, 0));
if(!lessThan1.x || lessThan1.y || lessThan1.z || lessThan1.w)
return false;
if(!lessThan2.x || lessThan2.y || lessThan2.z || lessThan2.w)
return false;
return true;
}
bool test_lessthanequal_2()
{
bvec2 result1 = lessThanEqual(vec2(0.f, 1.f), vec2(1.f, 0.f));
bvec2 result2 = lessThanEqual(ivec2(0, 1), ivec2(1, 0));
if(!result1.x || result1.y)
return false;
if(!result2.x || result2.y)
return false;
return true;
}
bool test_lessthanequal_3()
{
bvec3 result1 = lessThanEqual(vec3(0.f, 1.f, 1.f), vec3(1.f, 0.f, 1.f));
bvec3 result2 = lessThanEqual(ivec3(0, 1, 1), ivec3(1, 0, 1));
if(!result1.x || result1.y || !result1.z)
return false;
if(!result2.x || result2.y || !result2.z)
return false;
return true;
}
bool test_lessthanequal_4()
{
bvec4 result1 = lessThanEqual(vec4(0.f, 1.f, 1.f, 0.f), vec4(1.f, 0.f, 1.f, 0.f));
bvec4 result2 = lessThanEqual(ivec4(0, 1, 1, 0), ivec4(1, 0, 1, 0));
if(!result1.x || result1.y || !result1.z || !result1.w)
return false;
if(!result2.x || result2.y || !result2.z || !result2.w)
return false;
return true;
}
bool test_all_2()
{
bool result1 = all(bvec2(true, true));
bool result2 = all(bvec2(true, false));
bool result3 = all(bvec2(false, false));
if(!result1 || result2 || result3)
return false;
return true;
}
bool test_all_3()
{
bool result1 = all(bvec3(true, true, true));
bool result2 = all(bvec3(true, false, true));
bool result3 = all(bvec3(false, false, false));
if(!result1 || result2 || result3)
return false;
return true;
}
bool test_all_4()
{
bool result1 = all(bvec4(true, true, true, true));
bool result2 = all(bvec4(true, false, true, false));
bool result3 = all(bvec4(false, false, false, false));
if(!result1 || result2 || result3)
return false;
return true;
}
bool test_greaterthan_2()
{
bvec2 result1 = greaterThan(vec2(0.f, 1.f), vec2(1.f, 0.f));
bvec2 result2 = greaterThan(ivec2(0, 1), ivec2(1, 0));
if(result1.x || !result1.y)
return false;
if(result2.x || !result2.y)
return false;
return true;
}
bool test_greaterthan_3()
{
bvec3 result1 = greaterThan(vec3(0.f, 1.f, 1.f), vec3(1.f, 0.f, 1.f));
bvec3 result2 = greaterThan(ivec3(0, 1, 1), ivec3(1, 0, 1));
if(result1.x || !result1.y || result1.z)
return false;
if(result2.x || !result2.y || result2.z)
return false;
return true;
}
bool test_greaterthan_4()
{
bvec4 result1 = greaterThan(vec4(0.f, 1.f, 1.f, 0.f), vec4(1.f, 0.f, 1.f, 0.f));
bvec4 result2 = greaterThan(ivec4(0, 1, 1, 0), ivec4(1, 0, 1, 0));
if(result1.x || !result1.y || result1.z || result1.w)
return false;
if(result2.x || !result2.y || result2.z || result2.w)
return false;
return true;
}
bool test_greaterthanequal_2()
{
bvec2 result1 = greaterThanEqual(vec2(0.f, 1.f), vec2(1.f, 0.f));
bvec2 result2 = greaterThanEqual(ivec2(0, 1), ivec2(1, 0));
if(result1.x || !result1.y)
return false;
if(result2.x || !result2.y)
return false;
return true;
}
bool test_greaterthanequal_3()
{
bvec3 result1 = greaterThanEqual(vec3(0.f, 1.f, 1.f), vec3(1.f, 0.f, 1.f));
bvec3 result2 = greaterThanEqual(ivec3(0, 1, 1), ivec3(1, 0, 1));
if(result1.x || !result1.y || !result1.z)
return false;
if(result2.x || !result2.y || !result2.z)
return false;
return true;
}
bool test_greaterthanequal_4()
{
bvec4 result1 = greaterThanEqual(vec4(0.f, 1.f, 1.f, 0.f), vec4(1.f, 0.f, 1.f, 0.f));
bvec4 result2 = greaterThanEqual(ivec4(0, 1, 1, 0), ivec4(1, 0, 1, 0));
if(result1.x || !result1.y || !result1.z || !result1.w)
return false;
if(result2.x || !result2.y || !result2.z || !result2.w)
return false;
return true;
}
bool test_equal_2()
{
bvec2 result1 = equal(vec2(76.f, 0.f), vec2(76.f, 76.f));
bvec2 result2 = equal(ivec2(76, 0), ivec2(76, 76));
bvec2 result3 = equal(bvec2(true, false), bvec2(true, true));
if(!result1.x || result1.y)
return false;
if(!result2.x || result2.y)
return false;
if(!result3.x || result3.y)
return false;
return true;
}
bool test_equal_3()
{
bvec3 result1 = equal(vec3(76.f, 0.f, 76.f), vec3(76.f, 76.f, 76.f));
bvec3 result2 = equal(ivec3(76, 0, 76), ivec3(76, 76, 76));
bvec3 result3 = equal(bvec3(true, false, true), bvec3(true, true, true));
if(!result1.x || result1.y || !result1.z)
return false;
if(!result2.x || result2.y || !result2.z)
return false;
if(!result3.x || result3.y || !result3.z)
return false;
return true;
}
bool test_equal_4()
{
bvec4 result1 = equal(vec4(76.f, 0.f, 76.f, 0.f), vec4(76.f, 76.f, 76.f, 76.f));
bvec4 result2 = equal(ivec4(76, 0, 76, 0), ivec4(76, 76, 76, 76));
bvec4 result3 = equal(bvec4(true, false, true, false), bvec4(true, true, true, true));
if(!result1.x || result1.y || !result1.z || result1.w)
return false;
if(!result2.x || result2.y || !result2.z || result2.w)
return false;
if(!result3.x || result3.y || !result3.z || result3.w)
return false;
return true;
}
bool test_notequal_2()
{
bvec2 result1 = notEqual(vec2(76.f, 0.f), vec2(76.f, 76.f));
bvec2 result2 = notEqual(ivec2(76, 0), ivec2(76, 76));
bvec2 result3 = notEqual(bvec2(true, false), bvec2(true, true));
if(result1.x || !result1.y)
return false;
if(result2.x || !result2.y)
return false;
if(result3.x || !result3.y)
return false;
return true;
}
bool test_notequal_3()
{
bvec3 result1 = notEqual(vec3(76.f, 0.f, 76.f), vec3(76.f, 76.f, 76.f));
bvec3 result2 = notEqual(ivec3(76, 0, 76), ivec3(76, 76, 76));
bvec3 result3 = notEqual(bvec3(true, false, true), bvec3(true, true, true));
if(result1.x || !result1.y || result1.z)
return false;
if(result2.x || !result2.y || result2.z)
return false;
if(result3.x || !result3.y || result3.z)
return false;
return true;
}
bool test_notequal_4()
{
bvec4 result1 = notEqual(vec4(76.f, 0.f, 76.f, 0.f), vec4(76.f, 76.f, 76.f, 76.f));
bvec4 result2 = notEqual(ivec4(76, 0, 76, 0), ivec4(76, 76, 76, 76));
bvec4 result3 = notEqual(bvec4(true, false, true, false), bvec4(true, true, true, true));
if(result1.x || !result1.y || result1.z || !result1.w)
return false;
if(result2.x || !result2.y || result2.z || !result2.w)
return false;
if(result3.x || !result3.y || result3.z || !result3.w)
return false;
return true;
}
bool test_any_2()
{
bool result1 = any(bvec2(true, true));
bool result2 = any(bvec2(true, false));
bool result3 = any(bvec2(false, false));
if(!result1 || !result2 || result3)
return false;
return true;
}
bool test_any_3()
{
bool result1 = any(bvec3(true, true, true));
bool result2 = any(bvec3(true, false, true));
bool result3 = any(bvec3(false, false, false));
if(!result1 || !result2 || result3)
return false;
return true;
}
bool test_any_4()
{
bool result1 = any(bvec4(true, true, true, true));
bool result2 = any(bvec4(true, false, true, false));
bool result3 = any(bvec4(false, false, false, false));
if(!result1 || !result2 || result3)
return false;
return true;
}
bool test_not_2()
{
bvec2 result = not_(bvec2(true, false));
if(result.x || !result.y)
return false;
return true;
}
bool test_not_3()
{
bvec3 result = not_(bvec3(true, false, true));
if(result.x || !result.y || result.z)
return false;
return true;
}
bool test_not_4()
{
bvec4 result = not_(bvec4(true, false, true, false));
if(result.x || !result.y || result.z || !result.w)
return false;
return true;
}
void main_core_func_vector_relational()
{
assert(test_lessthan_2());
assert(test_lessthan_3());
assert(test_lessthan_4());
assert(test_lessthanequal_2());
assert(test_lessthanequal_3());
assert(test_lessthanequal_4());
assert(test_greaterthan_2());
assert(test_greaterthan_3());
assert(test_greaterthan_4());
assert(test_greaterthanequal_2());
assert(test_greaterthanequal_3());
assert(test_greaterthanequal_4());
assert(test_greaterthanequal_2());
assert(test_greaterthanequal_3());
assert(test_greaterthanequal_4());
assert(test_equal_2());
assert(test_equal_3());
assert(test_equal_4());
assert(test_notequal_2());
assert(test_notequal_3());
assert(test_notequal_4());
assert(test_any_2());
assert(test_any_3());
assert(test_any_4());
assert(test_all_2());
assert(test_all_3());
assert(test_all_4());
}
}//namespace test
}//namespace glm

10
test/core/type.cpp Normal file
View File

@ -0,0 +1,10 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"

22
test/core/type_float.cpp Normal file
View File

@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type_float.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/type_float.hpp>
namespace glm{
namespace test{
void main_float()
{
}
}//namespace test
}//namespace glm

42
test/core/type_half.cpp Normal file
View File

@ -0,0 +1,42 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT licence
// File : test/core/type_half.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/type_half.hpp>
namespace glm{
namespace test
{
typedef detail::thalf thalf;
bool main_type_half()
{
bool Result = true;
{
thalf A(1.0f);
thalf B(2.0f);
thalf C = A + B;
thalf D(C);
float E = D;
int F = C;
thalf G = B * C;
thalf H = G / C;
H += thalf(1.0f);
double J = H;
int I = H;
Result = Result && J == 3.0;
}
return Result;
}
}//namespace test
}//namespace glm

22
test/core/type_int.cpp Normal file
View File

@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type_int.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/type_int.hpp>
namespace glm{
namespace test{
void main_int()
{
}
}//namespace test
}//namespace glm

22
test/core/type_mat2x2.cpp Normal file
View File

@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type_mat2x2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/type_mat2x2.hpp>
namespace glm{
namespace test{
void main_mat2x2()
{
}
}//namespace test
}//namespace glm

22
test/core/type_mat2x3.cpp Normal file
View File

@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type_mat2x3.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/type_mat2x3.hpp>
namespace glm{
namespace test{
void main_mat2x3()
{
}
}//namespace test
}//namespace glm

22
test/core/type_mat2x4.cpp Normal file
View File

@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type_mat2x4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/type_mat2x4.hpp>
namespace glm{
namespace test{
void main_mat2x4()
{
}
}//namespace test
}//namespace glm

22
test/core/type_mat3x2.cpp Normal file
View File

@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type_mat3x2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/type_mat3x2.hpp>
namespace glm{
namespace test{
void main_mat3x2()
{
}
}//namespace test
}//namespace glm

22
test/core/type_mat3x3.cpp Normal file
View File

@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type_mat3x3.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/type_mat3x3.hpp>
namespace glm{
namespace test{
void main_mat3x3()
{
}
}//namespace test
}//namespace glm

22
test/core/type_mat3x4.cpp Normal file
View File

@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type_mat3x4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/type_mat3x4.hpp>
namespace glm{
namespace test{
void main_mat3x4()
{
}
}//namespace test
}//namespace glm

22
test/core/type_mat4x2.cpp Normal file
View File

@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type_mat4x2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/type_mat4x2.hpp>
namespace glm{
namespace test{
void main_mat4x2()
{
}
}//namespace test
}//namespace glm

22
test/core/type_mat4x3.cpp Normal file
View File

@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type_mat4x3.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/type_mat4x3.hpp>
namespace glm{
namespace test{
void main_mat4x3()
{
}
}//namespace test
}//namespace glm

22
test/core/type_mat4x4.cpp Normal file
View File

@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type_mat4x4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include "glm/core/type_mat4x4.hpp"
namespace glm{
namespace test{
void main_mat4x4()
{
}
}//namespace test
}//namespace glm

22
test/core/type_vec1.cpp Normal file
View File

@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type_vec1.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/type_vec1.hpp>
namespace glm{
namespace test{
void main_vec1()
{
}
}//namespace test
}//namespace glm

22
test/core/type_vec2.cpp Normal file
View File

@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type_vec2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/type_vec2.hpp>
namespace glm{
namespace test{
void main_vec2()
{
}
}//namespace test
}//namespace glm

22
test/core/type_vec3.cpp Normal file
View File

@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type_vec3.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/type_vec3.hpp>
namespace glm{
namespace test{
void main_vec3()
{
}
}//namespace test
}//namespace glm

22
test/core/type_vec4.cpp Normal file
View File

@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-31
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : test/core/type_vec4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../precompiled.hpp"
#include <glm/core/type_vec4.hpp>
namespace glm{
namespace test{
void main_vec4()
{
}
}//namespace test
}//namespace glm

0
test/gtc.cpp Normal file
View File

0
test/gtc.hpp Normal file
View File

14
test/gtc/double_float.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtc/double_float.hpp>
namespace glm{
namespace test
{
bool main_gtc_double_float()
{
return false;
}
}//namespace test
}//namespace glm

25
test/gtc/half_float.cpp Normal file
View File

@ -0,0 +1,25 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtc/half_float.hpp>
namespace glm{
namespace test
{
bool main_gtc_half_float()
{
bool Result = true;
{
glm::hvec2 A(1.0f, 3.0f);
glm::half B(2.0f);
glm::hvec2 C = A * B;
glm::hvec2 D = C - glm::hvec2(2.0f);
Result = Result && glm::all(glm::equal(C, glm::hvec2(0.0f, 4.0f)));
}
return Result;
}
}//namespace test
}//namespace glm

View File

@ -0,0 +1,14 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_access.hpp>
namespace glm{
namespace test
{
bool main_gtc_matrix_access()
{
return false;
}
}//namespace test
}//namespace glm

View File

@ -0,0 +1,14 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_operation.hpp>
namespace glm{
namespace test
{
bool main_gtc_matrix_operation()
{
return false;
}
}//namespace test
}//namespace glm

View File

@ -0,0 +1,14 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_projection.hpp>
namespace glm{
namespace test
{
bool main_gtc_matrix_projection()
{
return false;
}
}//namespace test
}//namespace glm

View File

@ -0,0 +1,14 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
namespace glm{
namespace test
{
bool main_gtc_matrix_transform()
{
return false;
}
}//namespace test
}//namespace glm

14
test/gtc/quaternion.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
namespace glm{
namespace test
{
bool main_gtc_quaternion()
{
return false;
}
}//namespace test
}//namespace glm

View File

@ -0,0 +1,14 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtc/type_precision.hpp>
namespace glm{
namespace test
{
bool main_gtc_type_precision()
{
return false;
}
}//namespace test
}//namespace glm

0
test/gtx.hpp Normal file
View File

View File

@ -0,0 +1,222 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/associated_min_max.hpp>
using namespace glm;
bool test_associated_min_max()
{
//{
// int ResultA = associatedMinGTX(
// 0.0f, 2,
// 1.0f, 4);
// int ResultB = associatedMaxGTX(
// 0.0f, 2,
// 1.0f, 4);
// int ResultC = associatedMinGTX(
// 0.0f, 2,
// 1.0f, 4,
// 2.0f, 8);
// int ResultD = associatedMaxGTX(
// 0.0f, 2,
// 1.0f, 4,
// 2.0f, 8);
// int ResultE = associatedMinGTX(
// 0.0f, 2,
// 1.0f, 4,
// 2.0f, 8,
// 3.0f, 6);
// int ResultF = associatedMaxGTX(
// 0.0f, 2,
// 1.0f, 4,
// 2.0f, 8,
// 3.0f, 6);
// int End = 0;
//}
//{
// glm::ivec2 ResultA = associatedMinGTX(
// glm::vec2(0), glm::ivec2(2),
// glm::vec2(1), glm::ivec2(4));
// glm::ivec3 ResultB = associatedMinGTX(
// glm::vec3(0), glm::ivec3(2),
// glm::vec3(1), glm::ivec3(4));
// glm::ivec4 ResultC = associatedMinGTX(
// glm::vec4(0), glm::ivec4(2),
// glm::vec4(1), glm::ivec4(4));
// int End = 0;
//}
//{
// glm::ivec2 ResultA = associatedMaxGTX(
// glm::vec2(0), glm::ivec2(2),
// glm::vec2(1), glm::ivec2(4));
// glm::ivec3 ResultB = associatedMaxGTX(
// glm::vec3(0), glm::ivec3(2),
// glm::vec3(1), glm::ivec3(4));
// glm::ivec4 ResultC = associatedMaxGTX(
// glm::vec4(0), glm::ivec4(2),
// glm::vec4(1), glm::ivec4(4));
// int End = 0;
//}
//{
// glm::vec2 ResultA = associatedMinGTX(
// glm::vec2(0.f), 2.f,
// glm::vec2(1.f), 4.f);
// glm::ivec3 ResultB = associatedMinGTX(
// glm::vec3(0.f), 2,
// glm::vec3(1.f), 4);
// glm::ivec4 ResultC = associatedMinGTX(
// glm::vec4(0.f), 2,
// glm::vec4(1.f), 4);
// int End = 0;
//}
//{
// glm::ivec2 ResultA = associatedMaxGTX(
// glm::vec2(0), 2,
// glm::vec2(1), 4);
// glm::ivec3 ResultB = associatedMaxGTX(
// glm::vec3(0), 2,
// glm::vec3(1), 4);
// glm::ivec4 ResultC = associatedMaxGTX(
// glm::vec4(0), 2,
// glm::vec4(1), 4);
// int End = 0;
//}
//{
// glm::ivec2 ResultA = associatedMinGTX(
// 0.0f, glm::ivec2(2),
// 1.0f, glm::ivec2(4));
// glm::ivec3 ResultB = associatedMinGTX(
// 0.0f, glm::ivec3(2),
// 1.0f, glm::ivec3(4));
// glm::ivec4 ResultC = associatedMinGTX(
// 0.0f, glm::ivec4(2),
// 1.0f, glm::ivec4(4));
// int End = 0;
//}
//{
// glm::ivec2 ResultA = associatedMaxGTX(
// 0.0f, glm::ivec2(2),
// 1.0f, glm::ivec2(4));
// glm::ivec3 ResultB = associatedMaxGTX(
// 0.0f, glm::ivec3(2),
// 1.0f, glm::ivec3(4));
// glm::ivec4 ResultC = associatedMaxGTX(
// 0.0f, glm::ivec4(2),
// 1.0f, glm::ivec4(4));
// int End = 0;
//}
//{
// glm::ivec2 ResultA = associatedMinGTX(
// glm::vec2(0), glm::ivec2(2),
// glm::vec2(1), glm::ivec2(4),
// glm::vec2(2), glm::ivec2(8));
// glm::ivec3 ResultB = associatedMinGTX(
// glm::vec3(0), glm::ivec3(2),
// glm::vec3(1), glm::ivec3(4),
// glm::vec3(2), glm::ivec3(8));
// glm::ivec4 ResultC = associatedMinGTX(
// glm::vec4(0), glm::ivec4(2),
// glm::vec4(1), glm::ivec4(4),
// glm::vec4(2), glm::ivec4(8));
// int End = 0;
//}
//{
// glm::ivec2 ResultA = associatedMaxGTX(
// glm::vec2(0), glm::ivec2(2),
// glm::vec2(1), glm::ivec2(4),
// glm::vec2(2), glm::ivec2(8));
// glm::ivec3 ResultB = associatedMaxGTX(
// glm::vec3(0), glm::ivec3(2),
// glm::vec3(1), glm::ivec3(4),
// glm::vec3(2), glm::ivec3(8));
// glm::ivec4 ResultC = associatedMaxGTX(
// glm::vec4(0), glm::ivec4(2),
// glm::vec4(1), glm::ivec4(4),
// glm::vec4(2), glm::ivec4(8));
// int End = 0;
//}
//{
// glm::ivec2 ResultA = associatedMinGTX(
// glm::vec2(0), glm::ivec2(2),
// glm::vec2(1), glm::ivec2(4),
// glm::vec2(2), glm::ivec2(8),
// glm::vec2(3), glm::ivec2(6));
// glm::ivec3 ResultB = associatedMinGTX(
// glm::vec3(0), glm::ivec3(2),
// glm::vec3(1), glm::ivec3(4),
// glm::vec3(2), glm::ivec3(8),
// glm::vec3(3), glm::ivec3(6));
// glm::ivec4 ResultC = associatedMinGTX(
// glm::vec4(0), glm::ivec4(2),
// glm::vec4(1), glm::ivec4(4),
// glm::vec4(2), glm::ivec4(8),
// glm::vec4(3), glm::ivec4(6));
// int End = 0;
//}
//{
// glm::ivec2 ResultA = associatedMaxGTX(
// glm::vec2(0), glm::ivec2(2),
// glm::vec2(1), glm::ivec2(4),
// glm::vec2(2), glm::ivec2(8),
// glm::vec2(3), glm::ivec2(6));
// glm::ivec3 ResultB = associatedMaxGTX(
// glm::vec3(0), glm::ivec3(2),
// glm::vec3(1), glm::ivec3(4),
// glm::vec3(2), glm::ivec3(8),
// glm::vec3(3), glm::ivec3(6));
// glm::ivec4 ResultC = associatedMaxGTX(
// glm::vec4(0), glm::ivec4(2),
// glm::vec4(1), glm::ivec4(4),
// glm::vec4(2), glm::ivec4(8),
// glm::vec4(3), glm::ivec4(6));
// int End = 0;
//}
return true;
}

11
test/gtx/bit.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/bit.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/closest_point.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/color_cast.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/color_cast.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/color_space.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/color_space.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/comparison.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/comparison.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/compatibility.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/component_wise.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/epsilon.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/epsilon.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/euler_angles.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/euler_angles.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/extend.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/extend.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/extented_min_max.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/fast_exponential.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/fast_square_root.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/fast_trigonometry.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/handed_coordinate_space.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/inertia.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/inertia.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/integer.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/integer.hpp>
namespace glm
{
namespace test
{
}
}

27
test/gtx/intersect.cpp Normal file
View File

@ -0,0 +1,27 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/intersect.hpp>
namespace glm{
namespace test
{
void main_gtx_intesect()
{
glm::vec3 Origin = glm::vec3(0.25f, 0.33f, 10.f);
glm::vec3 Direction = glm::vec3(0.0f, 0.0f, -1.f);
glm::vec3 Vect0 = glm::vec3(0.0f, 0.0f, 0.f);
glm::vec3 Vect1 = glm::vec3(1.0f, 0.0f, 0.f);
glm::vec3 Vect2 = glm::vec3(0.0f, 1.0f, 0.f);
glm::vec3 Position(0.0f);
bool Result = intersectRayTriangle(
Origin, Direction,
Vect0, Vect1, Vect2,
Position);
bool End = true;
}
}//namespace test
}//namespace glm

11
test/gtx/inverse.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/inverse.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/inverse_transpose.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/matrix_access.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/matrix_cross_product.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/matrix_major_storage.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/matrix_projection.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/matrix_query.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/matrix_query.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/matrix_selection.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/matx.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/matx.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/mixed_product.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/norm.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/norm.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/normal.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/normal.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/normalize_dot.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/number_precision.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/optimum_pow.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/optimum_pow.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/orthonormalize.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/perpendicular.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/polar_coordinates.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/projection.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/projection.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/quaternion.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/quaternion.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/random.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/random.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/rotate_vector.hpp>
namespace glm
{
namespace test
{
}
}

12
test/gtx/safe_limits.cpp Normal file
View File

@ -0,0 +1,12 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
//#include <glm/gtx/safe_limits.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/spline.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/spline.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/statistics_operation.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/std_based_type.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/string_cast.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/string_cast.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/transform.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/transform.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/transform2.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/transform2.hpp>
namespace glm
{
namespace test
{
}
}

10
test/gtx/transpose.cpp Normal file
View File

@ -0,0 +1,10 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/unsigned_int.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/unsigned_int.hpp>
namespace glm
{
namespace test
{
}
}

View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/vector_access.hpp>
namespace glm
{
namespace test
{
}
}

11
test/gtx/vector_angle.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "../precompiled.hpp"
#include <glm/glm.hpp>
#include <glm/gtx/vector_angle.hpp>
namespace glm
{
namespace test
{
}
}

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