Fixed refract for double based types

master
Christophe Riccio ago%!(EXTRA string=14 years)
parent 5b7717b7b0
commit 390498ef87
  1. 2
      glm/core/func_geometric.inl
  2. 2
      test/core/core_func_common.cpp
  3. 51
      test/core/core_func_geometric.cpp

@ -279,7 +279,7 @@ namespace glm
genType const & N genType const & N
) )
{ {
return I - N * dot(N, I) * float(2); return I - N * dot(N, I) * genType(2);
} }
// refract // refract

@ -245,7 +245,7 @@ int test_roundEven()
int main() int main()
{ {
int Error = 0; int Error(0);
Error += test_floatBitsToInt(); Error += test_floatBitsToInt();
Error += test_floatBitsToUint(); Error += test_floatBitsToUint();

@ -2,17 +2,62 @@
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2011-01-15 // Created : 2011-01-15
// Updated : 2011-09-13 // Updated : 2011-11-14
// Licence : This source is under MIT licence // Licence : This source is under MIT licence
// File : test/gtx/func_geometric.cpp // File : test/gtx/func_geometric.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp> #include <glm/glm.hpp>
int test_reflect()
{
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 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 main()
{ {
int Failed = 0; int Error(0);
Error += test_reflect();
Error += test_refract();
return Failed; return Error;
} }

Loading…
Cancel
Save