mirror of
https://github.com/g-truc/glm.git
synced 2024-11-10 04:31:47 +00:00
Fixed test crash due to the normalization of a nan vector
This commit is contained in:
parent
f4f7a71964
commit
bbf9989334
@ -47,6 +47,7 @@ GLM 0.9.4.4: 2013-05-29
|
||||
- Fixed CUDA warnings #86
|
||||
- Fixed GLM natvis for VC11 #82
|
||||
- Fixed GLM_GTX_multiple with negative values #79
|
||||
- Fixed glm::perspective when zNear is zero #71
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.4.3: 2013-03-20
|
||||
|
@ -203,21 +203,21 @@ int test_compute_gtx()
|
||||
|
||||
for(std::size_t k = 0; k < Output.size(); ++k)
|
||||
{
|
||||
float i = float(k) / 1000.f;
|
||||
float i = float(k) / 1000.f + 0.001f;
|
||||
glm::vec3 A = glm::normalize(glm::vec3(i));
|
||||
glm::vec3 B = glm::cross(A, glm::vec3(0, 0, 1));
|
||||
glm::vec3 B = glm::cross(A, glm::normalize(glm::vec3(1, 1, 2)));
|
||||
glm::mat4 C = glm::rotate(glm::mat4(1.0f), i, B);
|
||||
glm::mat4 D = glm::scale(C, glm::vec3(0.8f, 1.0f, 1.2f));
|
||||
glm::mat4 E = glm::translate(D, glm::vec3(1.4f, 1.2f, 1.1f));
|
||||
glm::mat4 F = glm::perspective(i, 1.5f, 0.1f, 1000.f);
|
||||
glm::mat4 G = glm::inverse(F * E);
|
||||
glm::vec3 H = glm::unProject(glm::vec3(i), G, F, E[3]);
|
||||
glm::vec3 I = glm::project(H, G, F, E[3]);
|
||||
glm::mat4 J = glm::lookAt(glm::normalize(B), H, I);
|
||||
glm::vec3 I = glm::any(glm::isnan(glm::project(H, G, F, E[3]))) ? glm::vec3(2) : glm::vec3(1);
|
||||
glm::mat4 J = glm::lookAt(glm::normalize(glm::max(B, glm::vec3(0.001f))), H, I);
|
||||
glm::mat4 K = glm::transpose(J);
|
||||
glm::quat L = glm::normalize(glm::quat_cast(K));
|
||||
glm::vec4 M = L * glm::smoothstep(K[3], J[3], glm::vec4(i));
|
||||
glm::mat4 N = glm::mat4(glm::normalize(M), K[3], J[3], glm::vec4(i));
|
||||
glm::mat4 N = glm::mat4(glm::normalize(glm::max(M, glm::vec4(0.001f))), K[3], J[3], glm::vec4(i));
|
||||
glm::mat4 O = N * glm::inverse(N);
|
||||
glm::vec4 P = O * glm::reflect(N[3], glm::vec4(A, 1.0f));
|
||||
glm::vec4 Q = glm::vec4(glm::dot(M, P));
|
||||
|
Loading…
Reference in New Issue
Block a user