diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2014-09-03 15:55:19 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2015-10-25 11:03:56 -0400 |
commit | b554b20c8d59d6046bdcec7c79fb61cd0e65811c (patch) | |
tree | a6c6f257cfaffcec953be7c0cce180f7a8855c68 /libdimension/tests | |
parent | b2cf35c26d5263f3079480208429e3a1d7dd2373 (diff) | |
download | dimension-b554b20c8d59d6046bdcec7c79fb61cd0e65811c.tar.xz |
math: Make vectors have an array instead of different fields.
Diffstat (limited to 'libdimension/tests')
-rw-r--r-- | libdimension/tests/bvh/prtree.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/libdimension/tests/bvh/prtree.c b/libdimension/tests/bvh/prtree.c index fb0cea6..31f1490 100644 --- a/libdimension/tests/bvh/prtree.c +++ b/libdimension/tests/bvh/prtree.c @@ -30,13 +30,13 @@ #include <stdio.h> #include <stdlib.h> -unsigned int calls = 0; +static unsigned int calls = 0; static bool dmnsn_fake_intersection_fn(const dmnsn_object *object, dmnsn_ray ray, dmnsn_intersection *intersection) { - intersection->t = (object->aabb.min.z - ray.x0.z)/ray.n.z; + intersection->t = (object->aabb.min.Z - ray.x0.Z)/ray.n.Z; intersection->normal = dmnsn_x; ++calls; return true; @@ -47,13 +47,10 @@ dmnsn_randomize_aabb(dmnsn_object *object) { dmnsn_vector a, b; - a.x = 2.0*((double)rand())/RAND_MAX - 1.0; - a.y = 2.0*((double)rand())/RAND_MAX - 1.0; - a.z = 2.0*((double)rand())/RAND_MAX - 1.0; - - b.x = 2.0*((double)rand())/RAND_MAX - 1.0; - b.y = 2.0*((double)rand())/RAND_MAX - 1.0; - b.z = 2.0*((double)rand())/RAND_MAX - 1.0; + for (unsigned int i = 0; i < 3; ++i) { + a.n[i] = 2.0*((double)rand())/RAND_MAX - 1.0; + b.n[i] = 2.0*((double)rand())/RAND_MAX - 1.0; + } object->aabb.min = dmnsn_vector_min(a, b); object->aabb.max = dmnsn_vector_max(a, b); |