dont use I macro defined in standard

This commit is contained in:
Recep Aslantas
2024-03-31 13:24:50 +03:00
parent f388df7f3e
commit bf4c5b4e26
4 changed files with 33 additions and 33 deletions

View File

@@ -1571,15 +1571,15 @@ TEST_IMPL(GLM_PREFIX, vec4_reflect) {
}
TEST_IMPL(GLM_PREFIX, vec4_refract) {
vec4 I = {sqrtf(0.5f), -sqrtf(0.5f), 0.0f, 0.0f}; /* Incoming vector */
vec4 N = {0.0f, 1.0f, 0.0f, 0.0f}; /* Surface normal */
vec4 dest;
vec4 v = {sqrtf(0.5f), -sqrtf(0.5f), 0.0f, 0.0f}; /* Incoming vector */
vec4 N = {0.0f, 1.0f, 0.0f, 0.0f}; /* Surface normal */
vec4 dest;
float eta;
float r;
/* Water to Air (eta = 1.33/1.0) */
eta = 1.33f / 1.0f;
r = GLM(vec4_refract)(I, N, eta, dest);
r = GLM(vec4_refract)(v, N, eta, dest);
if (!(dest[0] == 0.0f && dest[1] == 0.0f && dest[2] == 0.0f && dest[3] == 0.0f)) {
ASSERT(dest[1] < -sqrtf(0.5f));
ASSERT(r == true);
@@ -1590,17 +1590,17 @@ TEST_IMPL(GLM_PREFIX, vec4_refract) {
/* Air to Glass (eta = 1.0 / 1.5) */
eta = 1.0f / 1.5f;
r = GLM(vec4_refract)(I, N, eta, dest);
r = GLM(vec4_refract)(v, N, eta, dest);
ASSERT(dest[1] < -sqrtf(0.5f)); // Expect bending towards the normal
/* Glass to Water (eta = 1.5 / 1.33) */
eta = 1.5f / 1.33f;
r = GLM(vec4_refract)(I, N, eta, dest);
r = GLM(vec4_refract)(v, N, eta, dest);
ASSERT(dest[1] < -sqrtf(0.5f)); // Expect bending towards the normal, less bending than air to glass
/* Diamond to Air (eta = 2.42 / 1.0) */
eta = 2.42f / 1.0f;
r = GLM(vec4_refract)(I, N, eta, dest);
r = GLM(vec4_refract)(v, N, eta, dest);
if (!(dest[0] == 0.0f && dest[1] == 0.0f && dest[2] == 0.0f && dest[3] == 0.0f)) {
/* High potential for total internal reflection, but if it occurs, expect significant bending */
ASSERT(dest[1] < -sqrtf(0.5f));