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/csg.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'libdimension/csg.c') diff --git a/libdimension/csg.c b/libdimension/csg.c index d65a300..2595f7d 100644 --- a/libdimension/csg.c +++ b/libdimension/csg.c @@ -1,5 +1,5 @@ /************************************************************************* - * Copyright (C) 2010-2011 Tavian Barnes * + * Copyright (C) 2010-2012 Tavian Barnes * * * * This file is part of The Dimension Library. * * * @@ -36,16 +36,16 @@ dmnsn_csg_union_intersection_fn(const dmnsn_object *csg, dmnsn_line line, dmnsn_intersection *intersection) { - dmnsn_prtree *prtree = csg->ptr; - return dmnsn_prtree_intersection(prtree, line, intersection, true); + dmnsn_bvh *bvh = csg->ptr; + return dmnsn_bvh_intersection(bvh, line, intersection, true); } /** CSG union inside callback. */ static bool dmnsn_csg_union_inside_fn(const dmnsn_object *csg, dmnsn_vector point) { - dmnsn_prtree *prtree = csg->ptr; - return dmnsn_prtree_inside(prtree, point); + dmnsn_bvh *bvh = csg->ptr; + return dmnsn_bvh_inside(bvh, point); } /** CSG union initialization callback. */ @@ -54,16 +54,16 @@ dmnsn_csg_union_initialize_fn(dmnsn_object *csg) { csg->trans = dmnsn_identity_matrix(); - dmnsn_prtree *prtree = dmnsn_new_prtree(csg->children); - csg->ptr = prtree; - csg->bounding_box = prtree->bounding_box; + dmnsn_bvh *bvh = dmnsn_new_bvh(csg->children, DMNSN_BVH_PRTREE); + csg->ptr = bvh; + csg->bounding_box = dmnsn_bvh_bounding_box(bvh); } /** CSG union destruction callback. */ static void dmnsn_csg_union_free_fn(void *ptr) { - dmnsn_delete_prtree(ptr); + dmnsn_delete_bvh(ptr); } /* Bulk-load a union */ -- cgit v1.2.3