Fixed refract for double based types
This commit is contained in:
parent
5b7717b7b0
commit
390498ef87
@ -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 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user