From 5b7717b7b0bb65e8b2acad29d6a49fcbf6f0af73 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 14 Nov 2011 12:28:33 +0000 Subject: [PATCH 1/3] Added post 73 for GLM 0.9.3.A release --- doc/src/data.xml | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/doc/src/data.xml b/doc/src/data.xml index 75269441..49b8f6e8 100644 --- a/doc/src/data.xml +++ b/doc/src/data.xml @@ -164,6 +164,50 @@ + + + GLM 0.9.3 is making progress which is illustrated by the release of this first alpha. + + + + Improved doxygen documentation + + + Added new swizzle operators for C++11 compilers + + + Added new swizzle operators declared as functions + + + Added GLSL 4.20 length for vector and matrix types + + + Added GLSL core noise functions + + + Promoted GLM_GTC_noise extension: simplex, perlin, periodic noise functions + + + Promoted GLM_GTC_random extension: linear, gaussian and various random number generation distribution + + + Added GLM_GTX_constants: provides usefull constants + + + Fixed half based type contructors + + + + + + + GLM 0.9.3.A (zip) + GLM 0.9.3.A (7z) + Submit a bug report + GLM 0.9.3 Manual + GLM 0.9.3 API + + This revision fixes two problems: First, it adds all matrix products for all possible combinations of none-squared matrices. Thanks to Grant James who has provide the code for that. From 390498ef876745b208fcacf7c37174df5af9e2c0 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 14 Nov 2011 17:48:39 +0000 Subject: [PATCH 2/3] Fixed refract for double based types --- glm/core/func_geometric.inl | 2 +- test/core/core_func_common.cpp | 2 +- test/core/core_func_geometric.cpp | 53 ++++++++++++++++++++++++++++--- 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/glm/core/func_geometric.inl b/glm/core/func_geometric.inl index 438bef9d..494c875f 100644 --- a/glm/core/func_geometric.inl +++ b/glm/core/func_geometric.inl @@ -279,7 +279,7 @@ namespace glm genType const & N ) { - return I - N * dot(N, I) * float(2); + return I - N * dot(N, I) * genType(2); } // refract diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index c34838b4..a0a47f8e 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -245,7 +245,7 @@ int test_roundEven() int main() { - int Error = 0; + int Error(0); Error += test_floatBitsToInt(); Error += test_floatBitsToUint(); diff --git a/test/core/core_func_geometric.cpp b/test/core/core_func_geometric.cpp index ebdb159b..05dbbade 100644 --- a/test/core/core_func_geometric.cpp +++ b/test/core/core_func_geometric.cpp @@ -2,17 +2,62 @@ // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2011-01-15 -// Updated : 2011-09-13 +// Updated : 2011-11-14 // Licence : This source is under MIT licence // File : test/gtx/func_geometric.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// #include -int main() +int test_reflect() { - int Failed = 0; + int Error = 0; - return Failed; + { + glm::vec2 A(1.0f, 0.0f); + glm::vec2 B(0.0f, 1.0f); + glm::vec2 C = glm::reflect(A, B); + Error += C == glm::vec2(-1.0, 0.0) ? 0 : 1; + } + + { + glm::dvec2 A(1.0f, 0.0f); + glm::dvec2 B(0.0f, 1.0f); + glm::dvec2 C = glm::reflect(A, B); + Error += C == glm::dvec2(-1.0, 0.0) ? 0 : 1; + } + + return Error; +} + +int test_refract() +{ + int Error = 0; + + { + glm::vec2 A(1.0f, 0.0f); + glm::vec2 B(0.0f, 1.0f); + glm::vec2 C = glm::reflect(A, B); + Error += C == glm::vec2(-1.0, 0.0) ? 0 : 1; + } + + { + glm::dvec2 A(1.0f, 0.0f); + glm::dvec2 B(0.0f, 1.0f); + glm::dvec2 C = glm::reflect(A, B); + Error += C == glm::dvec2(-1.0, 0.0) ? 0 : 1; + } + + return Error; +} + +int main() +{ + int Error(0); + + Error += test_reflect(); + Error += test_refract(); + + return Error; } From 369e9299105fab7aeca64ce9a9f39c33ce3ec887 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 14 Nov 2011 18:13:18 +0000 Subject: [PATCH 3/3] Fixed ticket #147 refract for scalar --- glm/core/func_geometric.inl | 19 +++++++++++++++++++ test/core/core_func_geometric.cpp | 11 +++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/glm/core/func_geometric.inl b/glm/core/func_geometric.inl index 494c875f..8d479210 100644 --- a/glm/core/func_geometric.inl +++ b/glm/core/func_geometric.inl @@ -283,6 +283,25 @@ namespace glm } // refract + template + GLM_FUNC_QUALIFIER genType refract + ( + genType const & I, + genType const & N, + genType const & eta + ) + { + //It could be a vector + //GLM_STATIC_ASSERT(detail::type::is_float); + + genType dotValue = dot(N, I); + genType k = genType(1) - eta * eta * (genType(1) - dotValue * dotValue); + if(k < genType(0)) + return genType(0); + else + return eta * I - (eta * dotValue + sqrt(k)) * N; + } + template GLM_FUNC_QUALIFIER genType refract ( diff --git a/test/core/core_func_geometric.cpp b/test/core/core_func_geometric.cpp index 05dbbade..7ef85fc4 100644 --- a/test/core/core_func_geometric.cpp +++ b/test/core/core_func_geometric.cpp @@ -34,17 +34,24 @@ int test_refract() { int Error = 0; + { + float A(1.0f); + float B(1.0f); + float C = glm::refract(A, B, 0.5f); + Error += C == 1.0f ? 0 : 1; + } + { glm::vec2 A(1.0f, 0.0f); glm::vec2 B(0.0f, 1.0f); - glm::vec2 C = glm::reflect(A, B); + glm::vec2 C = glm::refract(A, B, 0.5f); Error += C == glm::vec2(-1.0, 0.0) ? 0 : 1; } { glm::dvec2 A(1.0f, 0.0f); glm::dvec2 B(0.0f, 1.0f); - glm::dvec2 C = glm::reflect(A, B); + glm::dvec2 C = glm::refract(A, B, 0.5); Error += C == glm::dvec2(-1.0, 0.0) ? 0 : 1; }