- Moved template types from 'detail' to 'glm' namespace #239, #244

This commit is contained in:
Christophe Riccio
2014-10-05 19:37:07 +02:00
parent 4ac77c08c7
commit f9484a6e9f
143 changed files with 3859 additions and 3936 deletions

View File

@@ -38,19 +38,19 @@ namespace {
{
std::basic_ostringstream<CTy,CTr> ostr;
if (typeid(T) == typeid(glm::detail::tquat<U,P>)) { ostr << "quat"; }
else if (typeid(T) == typeid(glm::detail::tvec2<U,P>)) { ostr << "vec2"; }
else if (typeid(T) == typeid(glm::detail::tvec3<U,P>)) { ostr << "vec3"; }
else if (typeid(T) == typeid(glm::detail::tvec4<U,P>)) { ostr << "vec4"; }
else if (typeid(T) == typeid(glm::detail::tmat2x2<U,P>)) { ostr << "mat2x2"; }
else if (typeid(T) == typeid(glm::detail::tmat2x3<U,P>)) { ostr << "mat2x3"; }
else if (typeid(T) == typeid(glm::detail::tmat2x4<U,P>)) { ostr << "mat2x4"; }
else if (typeid(T) == typeid(glm::detail::tmat3x2<U,P>)) { ostr << "mat3x2"; }
else if (typeid(T) == typeid(glm::detail::tmat3x3<U,P>)) { ostr << "mat3x3"; }
else if (typeid(T) == typeid(glm::detail::tmat3x4<U,P>)) { ostr << "mat3x4"; }
else if (typeid(T) == typeid(glm::detail::tmat4x2<U,P>)) { ostr << "mat4x2"; }
else if (typeid(T) == typeid(glm::detail::tmat4x3<U,P>)) { ostr << "mat4x3"; }
else if (typeid(T) == typeid(glm::detail::tmat4x4<U,P>)) { ostr << "mat4x4"; }
if (typeid(T) == typeid(glm::tquat<U,P>)) { ostr << "quat"; }
else if (typeid(T) == typeid(glm::tvec2<U,P>)) { ostr << "vec2"; }
else if (typeid(T) == typeid(glm::tvec3<U,P>)) { ostr << "vec3"; }
else if (typeid(T) == typeid(glm::tvec4<U,P>)) { ostr << "vec4"; }
else if (typeid(T) == typeid(glm::tmat2x2<U,P>)) { ostr << "mat2x2"; }
else if (typeid(T) == typeid(glm::tmat2x3<U,P>)) { ostr << "mat2x3"; }
else if (typeid(T) == typeid(glm::tmat2x4<U,P>)) { ostr << "mat2x4"; }
else if (typeid(T) == typeid(glm::tmat3x2<U,P>)) { ostr << "mat3x2"; }
else if (typeid(T) == typeid(glm::tmat3x3<U,P>)) { ostr << "mat3x3"; }
else if (typeid(T) == typeid(glm::tmat3x4<U,P>)) { ostr << "mat3x4"; }
else if (typeid(T) == typeid(glm::tmat4x2<U,P>)) { ostr << "mat4x2"; }
else if (typeid(T) == typeid(glm::tmat4x3<U,P>)) { ostr << "mat4x3"; }
else if (typeid(T) == typeid(glm::tmat4x4<U,P>)) { ostr << "mat4x4"; }
else { ostr << "unknown"; }
ostr << '<' << typeid(U).name() << ',' << P << '>';
@@ -67,7 +67,7 @@ int test_io_quat(OS& os)
<< typeid(OS).name()
<< '\n';
glm::detail::tquat<T,P> const q(1, 0, 0, 0);
glm::tquat<T,P> const q(1, 0, 0, 0);
{
glm::io::basic_format_saver<typename OS::char_type> const iofs(os);
@@ -93,9 +93,9 @@ int test_io_vec(OS& os)
<< typeid(OS).name()
<< '\n';
glm::detail::tvec2<T,P> const v2(0, 1);
glm::detail::tvec3<T,P> const v3(2, 3, 4);
glm::detail::tvec4<T,P> const v4(5, 6, 7, 8);
glm::tvec2<T,P> const v2(0, 1);
glm::tvec3<T,P> const v3(2, 3, 4);
glm::tvec4<T,P> const v4(5, 6, 7, 8);
os << type_name<T,P>(os, v2) << ": " << v2 << '\n'
<< type_name<T,P>(os, v3) << ": " << v3 << '\n'
@@ -118,55 +118,55 @@ int test_io_mat(OS& os)
<< typeid(OS).name()
<< '\n';
glm::detail::tvec2<T,P> const v2_1( 0, 1);
glm::detail::tvec2<T,P> const v2_2( 2, 3);
glm::detail::tvec2<T,P> const v2_3( 4, 5);
glm::detail::tvec2<T,P> const v2_4( 6, 7);
glm::detail::tvec3<T,P> const v3_1( 8, 9, 10);
glm::detail::tvec3<T,P> const v3_2(11, 12, 13);
glm::detail::tvec3<T,P> const v3_3(14, 15, 16);
glm::detail::tvec3<T,P> const v3_4(17, 18, 19);
glm::detail::tvec4<T,P> const v4_1(20, 21, 22, 23);
glm::detail::tvec4<T,P> const v4_2(24, 25, 26, 27);
glm::detail::tvec4<T,P> const v4_3(28, 29, 30, 31);
glm::detail::tvec4<T,P> const v4_4(32, 33, 34, 35);
glm::tvec2<T,P> const v2_1( 0, 1);
glm::tvec2<T,P> const v2_2( 2, 3);
glm::tvec2<T,P> const v2_3( 4, 5);
glm::tvec2<T,P> const v2_4( 6, 7);
glm::tvec3<T,P> const v3_1( 8, 9, 10);
glm::tvec3<T,P> const v3_2(11, 12, 13);
glm::tvec3<T,P> const v3_3(14, 15, 16);
glm::tvec3<T,P> const v3_4(17, 18, 19);
glm::tvec4<T,P> const v4_1(20, 21, 22, 23);
glm::tvec4<T,P> const v4_2(24, 25, 26, 27);
glm::tvec4<T,P> const v4_3(28, 29, 30, 31);
glm::tvec4<T,P> const v4_4(32, 33, 34, 35);
#if 0
os << "mat2x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x2<T,P>(v2_1, v2_2) << '\n'
<< "mat2x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x3<T,P>(v3_1, v3_2) << '\n'
<< "mat2x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x4<T,P>(v4_1, v4_2) << '\n'
<< "mat3x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x2<T,P>(v2_1, v2_2, v2_3) << '\n'
<< "mat3x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x3<T,P>(v3_1, v3_2, v3_3) << '\n'
<< "mat3x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x4<T,P>(v4_1, v4_2, v4_3) << '\n'
<< "mat4x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x2<T,P>(v2_1, v2_2, v2_3, v2_4) << '\n'
<< "mat4x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x3<T,P>(v3_1, v3_2, v3_3, v3_4) << '\n'
<< "mat4x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x4<T,P>(v4_1, v4_2, v4_3, v4_4) << '\n';
os << "mat2x2<" << typeid(T).name() << ',' << P << ">: " << glm::tmat2x2<T,P>(v2_1, v2_2) << '\n'
<< "mat2x3<" << typeid(T).name() << ',' << P << ">: " << glm::tmat2x3<T,P>(v3_1, v3_2) << '\n'
<< "mat2x4<" << typeid(T).name() << ',' << P << ">: " << glm::tmat2x4<T,P>(v4_1, v4_2) << '\n'
<< "mat3x2<" << typeid(T).name() << ',' << P << ">: " << glm::tmat3x2<T,P>(v2_1, v2_2, v2_3) << '\n'
<< "mat3x3<" << typeid(T).name() << ',' << P << ">: " << glm::tmat3x3<T,P>(v3_1, v3_2, v3_3) << '\n'
<< "mat3x4<" << typeid(T).name() << ',' << P << ">: " << glm::tmat3x4<T,P>(v4_1, v4_2, v4_3) << '\n'
<< "mat4x2<" << typeid(T).name() << ',' << P << ">: " << glm::tmat4x2<T,P>(v2_1, v2_2, v2_3, v2_4) << '\n'
<< "mat4x3<" << typeid(T).name() << ',' << P << ">: " << glm::tmat4x3<T,P>(v3_1, v3_2, v3_3, v3_4) << '\n'
<< "mat4x4<" << typeid(T).name() << ',' << P << ">: " << glm::tmat4x4<T,P>(v4_1, v4_2, v4_3, v4_4) << '\n';
#endif
glm::io::basic_format_saver<typename OS::char_type> const iofs(os);
os << glm::io::precision(2) << glm::io::width(1 + 2 + 1 + 2)
<< "mat2x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x2<T,P>(v2_1, v2_2) << '\n'
<< "mat2x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x3<T,P>(v3_1, v3_2) << '\n'
<< "mat2x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x4<T,P>(v4_1, v4_2) << '\n'
<< "mat3x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x2<T,P>(v2_1, v2_2, v2_3) << '\n'
<< "mat3x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x3<T,P>(v3_1, v3_2, v3_3) << '\n'
<< "mat3x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x4<T,P>(v4_1, v4_2, v4_3) << '\n'
<< "mat4x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x2<T,P>(v2_1, v2_2, v2_3, v2_4) << '\n'
<< "mat4x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x3<T,P>(v3_1, v3_2, v3_3, v3_4) << '\n'
<< "mat4x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x4<T,P>(v4_1, v4_2, v4_3, v4_4) << '\n';
<< "mat2x2<" << typeid(T).name() << ',' << P << ">: " << glm::tmat2x2<T,P>(v2_1, v2_2) << '\n'
<< "mat2x3<" << typeid(T).name() << ',' << P << ">: " << glm::tmat2x3<T,P>(v3_1, v3_2) << '\n'
<< "mat2x4<" << typeid(T).name() << ',' << P << ">: " << glm::tmat2x4<T,P>(v4_1, v4_2) << '\n'
<< "mat3x2<" << typeid(T).name() << ',' << P << ">: " << glm::tmat3x2<T,P>(v2_1, v2_2, v2_3) << '\n'
<< "mat3x3<" << typeid(T).name() << ',' << P << ">: " << glm::tmat3x3<T,P>(v3_1, v3_2, v3_3) << '\n'
<< "mat3x4<" << typeid(T).name() << ',' << P << ">: " << glm::tmat3x4<T,P>(v4_1, v4_2, v4_3) << '\n'
<< "mat4x2<" << typeid(T).name() << ',' << P << ">: " << glm::tmat4x2<T,P>(v2_1, v2_2, v2_3, v2_4) << '\n'
<< "mat4x3<" << typeid(T).name() << ',' << P << ">: " << glm::tmat4x3<T,P>(v3_1, v3_2, v3_3, v3_4) << '\n'
<< "mat4x4<" << typeid(T).name() << ',' << P << ">: " << glm::tmat4x4<T,P>(v4_1, v4_2, v4_3, v4_4) << '\n';
os << glm::io::unformatted
<< glm::io::order(glm::io::column_major)
<< "mat2x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x2<T,P>(v2_1, v2_2) << '\n'
<< "mat2x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x3<T,P>(v3_1, v3_2) << '\n'
<< "mat2x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat2x4<T,P>(v4_1, v4_2) << '\n'
<< "mat3x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x2<T,P>(v2_1, v2_2, v2_3) << '\n'
<< "mat3x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x3<T,P>(v3_1, v3_2, v3_3) << '\n'
<< "mat3x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat3x4<T,P>(v4_1, v4_2, v4_3) << '\n'
<< "mat4x2<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x2<T,P>(v2_1, v2_2, v2_3, v2_4) << '\n'
<< "mat4x3<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x3<T,P>(v3_1, v3_2, v3_3, v3_4) << '\n'
<< "mat4x4<" << typeid(T).name() << ',' << P << ">: " << glm::detail::tmat4x4<T,P>(v4_1, v4_2, v4_3, v4_4) << '\n';
<< "mat2x2<" << typeid(T).name() << ',' << P << ">: " << glm::tmat2x2<T,P>(v2_1, v2_2) << '\n'
<< "mat2x3<" << typeid(T).name() << ',' << P << ">: " << glm::tmat2x3<T,P>(v3_1, v3_2) << '\n'
<< "mat2x4<" << typeid(T).name() << ',' << P << ">: " << glm::tmat2x4<T,P>(v4_1, v4_2) << '\n'
<< "mat3x2<" << typeid(T).name() << ',' << P << ">: " << glm::tmat3x2<T,P>(v2_1, v2_2, v2_3) << '\n'
<< "mat3x3<" << typeid(T).name() << ',' << P << ">: " << glm::tmat3x3<T,P>(v3_1, v3_2, v3_3) << '\n'
<< "mat3x4<" << typeid(T).name() << ',' << P << ">: " << glm::tmat3x4<T,P>(v4_1, v4_2, v4_3) << '\n'
<< "mat4x2<" << typeid(T).name() << ',' << P << ">: " << glm::tmat4x2<T,P>(v2_1, v2_2, v2_3, v2_4) << '\n'
<< "mat4x3<" << typeid(T).name() << ',' << P << ">: " << glm::tmat4x3<T,P>(v3_1, v3_2, v3_3, v3_4) << '\n'
<< "mat4x4<" << typeid(T).name() << ',' << P << ">: " << glm::tmat4x4<T,P>(v4_1, v4_2, v4_3, v4_4) << '\n';
return 0;
}

View File

@@ -9,9 +9,13 @@
#include <glm/glm.hpp>
#include <glm/gtc/epsilon.hpp>
#if GLM_HAS_RANGE_FOR
#include <glm/gtx/range.hpp>
int testVec(){
int testVec()
{
int Error(0);
glm::vec3 v(1, 2, 3);
@@ -24,7 +28,8 @@ int testVec(){
return Error;
}
int testMat(){
int testMat()
{
int Error(0);
glm::mat4x3 m(1);
@@ -38,9 +43,19 @@ int testMat(){
return Error;
}
int main(){
int main()
{
int Error(0);
Error += testVec();
Error += testMat();
return Error;
}
#else
int main()
{
return 0;
}
#endif//GLM_HAS_RANGE_FOR

View File

@@ -8,9 +8,9 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#include <glm/gtx/scalar_multiplication.hpp>
#if GLM_LANG & GLM_LANG_CXX0X_FLAG
#if GLM_HAS_TEMPLATE_ALIASES
#include <glm/gtx/scalar_multiplication.hpp>
int main()
{