Fixed merge
This commit is contained in:
commit
c5389b595f
@ -200,7 +200,7 @@
|
||||
</list-element>
|
||||
</list>
|
||||
<paragraph>
|
||||
|
||||
|
||||
</paragraph>
|
||||
|
||||
<source type="Download" href="https://sourceforge.net/projects/ogl-math/files/glm-0.9.3.A/glm-0.9.3.A.zip/download">GLM 0.9.3.A (zip)</source>
|
||||
@ -209,7 +209,7 @@
|
||||
<source type="Link" href="http://glm.g-truc.net/glm-0.9.3.pdf">GLM 0.9.3 Manual</source>
|
||||
<source type="Link" href="http://glm.g-truc.net/api-0.9.3/index.html">GLM 0.9.3 API</source>
|
||||
</news>
|
||||
|
||||
|
||||
<news index="0072" date="24/10/2011" title="GLM 0.9.2.7 released" image="goodies/logo.png" image-mini="image/logo-mini.png">
|
||||
<paragraph>
|
||||
This revision fixes two problems: First, it adds all matrix products for all possible combinations of none-squared matrices. Thanks to <a href="http://www.zeuscmd.com">Grant James</a> who has provide the code for that.
|
||||
|
@ -279,10 +279,29 @@ namespace glm
|
||||
genType const & N
|
||||
)
|
||||
{
|
||||
return I - N * dot(N, I) * float(2);
|
||||
return I - N * dot(N, I) * genType(2);
|
||||
}
|
||||
|
||||
// refract
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType refract
|
||||
(
|
||||
genType const & I,
|
||||
genType const & N,
|
||||
genType const & eta
|
||||
)
|
||||
{
|
||||
//It could be a vector
|
||||
//GLM_STATIC_ASSERT(detail::type<genType>::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 <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType refract
|
||||
(
|
||||
|
@ -289,7 +289,7 @@ int test_roundEven()
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
int Error(0);
|
||||
|
||||
Error += test_modf();
|
||||
Error += test_floatBitsToInt();
|
||||
|
@ -2,17 +2,69 @@
|
||||
// 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 <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;
|
||||
|
||||
{
|
||||
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::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::refract(A, B, 0.5);
|
||||
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…
Reference in New Issue
Block a user