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/csg.c | |
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/csg.c')
-rw-r--r-- | libdimension/csg.c | 18 |
1 files changed, 9 insertions, 9 deletions
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 <tavianator@tavianator.com> * + * Copyright (C) 2010-2012 Tavian Barnes <tavianator@tavianator.com> * * * * 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 */ |