diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2012-12-17 15:53:56 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2012-12-17 16:34:51 -0500 |
commit | 9defe68bb518bb7e4c7d6b9954a6f604191b7abd (patch) | |
tree | 401d40c16652635e924b7d9dcf0a8c81ceeda82a /libdimension/bench | |
parent | 77d871406b15d101cae330947d72a4484eebc698 (diff) | |
download | dimension-9defe68bb518bb7e4c7d6b9954a6f604191b7abd.tar.xz |
Allow other BVH implementations to be used.
dmnsn_bvh is now a generic API, which could potentially support
octrees, etc, in addition to PR-trees.
Diffstat (limited to 'libdimension/bench')
-rw-r--r-- | libdimension/bench/prtree.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/libdimension/bench/prtree.c b/libdimension/bench/prtree.c index b168890..953c7b4 100644 --- a/libdimension/bench/prtree.c +++ b/libdimension/bench/prtree.c @@ -1,5 +1,5 @@ /************************************************************************* - * Copyright (C) 2009-2011 Tavian Barnes <tavianator@tavianator.com> * + * Copyright (C) 2009-2012 Tavian Barnes <tavianator@tavianator.com> * * * * This file is part of The Dimension Benchmark Suite. * * * @@ -17,6 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *************************************************************************/ +#include "../bvh.c" #include "../prtree.c" #include "../threads.c" #include "../future.c" @@ -88,13 +89,13 @@ main(void) dmnsn_array_push(objects, &object); } - dmnsn_prtree *tree; + dmnsn_bvh *bvh; sandglass_bench_noprecache(&sandglass, { - tree = dmnsn_new_prtree(objects); + bvh = dmnsn_new_bvh(objects, DMNSN_BVH_PRTREE); }); - printf("dmnsn_new_prtree(): %ld\n", sandglass.grains); + printf("dmnsn_new_bvh(DMNSN_BVH_PRTREE): %ld\n", sandglass.grains); - /* dmnsn_prtree_intersection() */ + /* dmnsn_bvh_intersection() */ dmnsn_line ray = dmnsn_new_line( dmnsn_new_vector( 1.0, 1.0, -2.0), dmnsn_new_vector(-0.5, -0.5, 1.0) @@ -102,23 +103,23 @@ main(void) dmnsn_intersection intersection; sandglass_bench_fine(&sandglass, { - dmnsn_prtree_intersection(tree, ray, &intersection, true); + dmnsn_bvh_intersection(bvh, ray, &intersection, true); }); - printf("dmnsn_prtree_intersection(): %ld\n", sandglass.grains); + printf("dmnsn_bvh_intersection(): %ld\n", sandglass.grains); sandglass_bench_fine(&sandglass, { - dmnsn_prtree_intersection(tree, ray, &intersection, false); + dmnsn_bvh_intersection(bvh, ray, &intersection, false); }); - printf("dmnsn_prtree_intersection(nocache): %ld\n", sandglass.grains); + printf("dmnsn_bvh_intersection(nocache): %ld\n", sandglass.grains); - /* dmnsn_prtree_inside() */ + /* dmnsn_bvh_inside() */ sandglass_bench_fine(&sandglass, { - dmnsn_prtree_inside(tree, dmnsn_zero); + dmnsn_bvh_inside(bvh, dmnsn_zero); }); - printf("dmnsn_prtree_inside(): %ld\n", sandglass.grains); + printf("dmnsn_bvh_inside(): %ld\n", sandglass.grains); /* Cleanup */ - dmnsn_delete_prtree(tree); + dmnsn_delete_bvh(bvh); DMNSN_ARRAY_FOREACH (dmnsn_object **, object, objects) { dmnsn_delete_object(*object); } |