mirror of
https://github.com/recp/cglm.git
synced 2026-02-17 03:39:05 +00:00
Update test_ray.h
This commit is contained in:
@@ -8,13 +8,13 @@
|
|||||||
#include "test_common.h"
|
#include "test_common.h"
|
||||||
|
|
||||||
TEST_IMPL(GLM_PREFIX, ray_triangle) {
|
TEST_IMPL(GLM_PREFIX, ray_triangle) {
|
||||||
// Check whether a simple hit is recognized with the right distance
|
/* Check whether a simple hit is recognized with the right distance */
|
||||||
vec3 origin = {0.0f, 0.0f, 0.0f};
|
vec3 origin = { 0.0f, 0.0f, 0.0f};
|
||||||
vec3 direction = {1.0f, 0.0f, 0.0f};
|
vec3 direction = { 1.0f, 0.0f, 0.0f};
|
||||||
vec3 opposite = {-1.0f, 0.0f, 0.0f};
|
vec3 opposite = {-1.0f, 0.0f, 0.0f};
|
||||||
vec3 v0 = {5.0f, -1.0f, 1.0f};
|
vec3 v0 = { 5.0f, -1.0f, 1.0f};
|
||||||
vec3 v1 = {5.0f, -1.0f, -1.0f};
|
vec3 v1 = { 5.0f, -1.0f, -1.0f};
|
||||||
vec3 v2 = {5.0f, 1.0f, 0.0f};
|
vec3 v2 = { 5.0f, 1.0f, 0.0f};
|
||||||
float d;
|
float d;
|
||||||
bool hit;
|
bool hit;
|
||||||
|
|
||||||
@@ -22,11 +22,11 @@ TEST_IMPL(GLM_PREFIX, ray_triangle) {
|
|||||||
ASSERT(hit);
|
ASSERT(hit);
|
||||||
ASSERT(fabsf(d - 5.0f) <= 0.0000009);
|
ASSERT(fabsf(d - 5.0f) <= 0.0000009);
|
||||||
|
|
||||||
// Check whether a simple miss works
|
/* Check whether a simple miss works */
|
||||||
hit = GLM(ray_triangle)(origin, opposite, v0, v1, v2, &d);
|
hit = GLM(ray_triangle)(origin, opposite, v0, v1, v2, &d);
|
||||||
ASSERT(!hit);
|
ASSERT(!hit);
|
||||||
|
|
||||||
// Check that we can disregard distance and pass NULL pointer instead
|
/* Check that we can disregard distance and pass NULL pointer instead */
|
||||||
hit = GLM(ray_triangle)(origin, direction, v0, v1, v2, NULL);
|
hit = GLM(ray_triangle)(origin, direction, v0, v1, v2, NULL);
|
||||||
ASSERT(hit);
|
ASSERT(hit);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user