From 6b3887da4d7414cdc3e4eb6589484a8376e2a307 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 1 Oct 2019 13:02:44 +0200 Subject: Cleanup: slightly more efficient access to PBVH multires grid key --- source/blender/blenkernel/BKE_pbvh.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'source/blender/blenkernel/BKE_pbvh.h') diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index 0d3b00cf927..fbf593496cf 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -25,6 +25,9 @@ #include "BLI_bitmap.h" #include "BLI_ghash.h" +/* For embedding CCGKey in iterator. */ +#include "BKE_ccg.h" + struct BMLog; struct BMesh; struct CCGElem; @@ -209,7 +212,7 @@ int BKE_pbvh_count_grid_quads(BLI_bitmap **grid_hidden, int gridsize); /* multires level, only valid for type == PBVH_GRIDS */ -void BKE_pbvh_get_grid_key(const PBVH *pbvh, struct CCGKey *key); +const struct CCGKey *BKE_pbvh_get_grid_key(const PBVH *pbvh); struct CCGElem **BKE_pbvh_get_grids(const PBVH *pbvh, int *num_grids); @@ -320,9 +323,9 @@ typedef struct PBVHVertexIter { int index; /* grid */ + struct CCGKey key; struct CCGElem **grids; struct CCGElem *grid; - struct CCGKey *key; BLI_bitmap **grid_hidden, *gh; int *grid_indices; int totgrid; @@ -371,10 +374,10 @@ void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node, PBVHVertexIter *vi, int mo for (vi.gy = 0; vi.gy < vi.height; vi.gy++) { \ for (vi.gx = 0; vi.gx < vi.width; vi.gx++, vi.i++) { \ if (vi.grid) { \ - vi.co = CCG_elem_co(vi.key, vi.grid); \ - vi.fno = CCG_elem_no(vi.key, vi.grid); \ - vi.mask = vi.key->has_mask ? CCG_elem_mask(vi.key, vi.grid) : NULL; \ - vi.grid = CCG_elem_next(vi.key, vi.grid); \ + vi.co = CCG_elem_co(&vi.key, vi.grid); \ + vi.fno = CCG_elem_no(&vi.key, vi.grid); \ + vi.mask = vi.key.has_mask ? CCG_elem_mask(&vi.key, vi.grid) : NULL; \ + vi.grid = CCG_elem_next(&vi.key, vi.grid); \ if (vi.gh) { \ if (BLI_BITMAP_TEST(vi.gh, vi.gy * vi.gridsize + vi.gx)) \ continue; \ -- cgit v1.2.3