-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vague documentation with glm::refract #806
Comments
Hi, |
I can't manage to reproduce the issue, would you share a code where the issue happen? |
Sorry, my bad! #include <iostream>
#include <string>
#include <glm/glm.hpp>
#include <glm/geometric.hpp>
#include <glm/gtc/constants.hpp>
using namespace glm;
using std::string;
void PrintVec3(string name, vec3 v, int tabs) {
while (tabs--) printf("\t");
printf("%s = (%.3f, %.3f, %.3f)\n", name.c_str(), v[0], v[1], v[2]);
}
int main() {
float eta = 1.5;
vec3 n(0, 1, 0);
PrintVec3("N", n, 0);
for (double outer_theta = 0; outer_theta < pi<double>() / 2; outer_theta += 0.1) {
puts("{");
vec3 i(sin(outer_theta), cos(outer_theta), 0);
i = -normalize(i);
PrintVec3("I", i, 1);
auto o = refract(i, n, eta);
PrintVec3("O", o, 1);
puts("}");
}
return 0;
} And that gives the following output:
|
This issue is resolved in master branch for GLM 0.9.9.1. Thanks for contributing! |
Documentation with
glm::refract
doesn't describe what will be returned when full reflection happened. Actually, it refers to GLSL refract man page while the official man page indicates that the result vector will bevec3(0)
.I found a little bug with my project and debugged it for about an hour. At last, I found that the reason is that
glm
returnedvec3(nan, nan, nan)
which is different fromGLSL
.This really confused me and I hope that we can make documentation more precise if possible.
The text was updated successfully, but these errors were encountered: