From 9defe68bb518bb7e4c7d6b9954a6f604191b7abd Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 17 Dec 2012 15:53:56 -0500 Subject: 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. --- libdimension/bench/prtree.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'libdimension/bench/prtree.c') 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 * + * Copyright (C) 2009-2012 Tavian Barnes * * * * This file is part of The Dimension Benchmark Suite. * * * @@ -17,6 +17,7 @@ * along with this program. If not, see . * *************************************************************************/ +#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); } -- cgit v1.2.3