commit 9660a3e500ca909e1f6e69ec7b85b35010cd4c3a
parent 64f3f896e9cc64b5cba38b3eab62a74daaf3dc4f
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 28 Feb 2018 15:25:47 +0100
Fix how the voxel index is computed in htvox_scene_for_each_voxel
The index is the rank of the leaf into the interation.
Diffstat:
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/htvox_scene.c b/src/htvox_scene.c
@@ -77,7 +77,7 @@ check_octree(struct octree_buffer* buf, const struct octree_index root)
ASSERT(octree_buffer_get_attr(buf, iattr) != NULL);
} else {
struct octree_index child;
- child = octree_buffer_get_child_index(buf, root, ichild);
+ child = octree_buffer_get_child_node_index(buf, root, ichild);
check_octree(buf, child);
}
}
@@ -615,6 +615,7 @@ htvox_scene_for_each_voxel
double upp[3];
} stack[OCTREE_DEPTH_MAX*8];
int istack;
+ size_t ileaf = 0;
if(!scn || !func) return RES_BAD_ARG;
@@ -658,7 +659,6 @@ htvox_scene_for_each_voxel
if(node->is_leaf & ichild_flag) {
struct octree_index iattr;
- size_t ivoxel;
const void* val;
iattr = octree_buffer_get_child_attr_index
@@ -672,9 +672,8 @@ htvox_scene_for_each_voxel
ASSERT(low[1] >= scn->lower[1]);
ASSERT(low[2] >= scn->lower[2]);
- ivoxel =iattr.ipage * scn->buffer.pagesize / scn->buffer.voxsize
- + iattr.inode;
- func(val, ivoxel, low, upp, ctx);
+ func(val, ileaf, low, upp, ctx);
+ ileaf++;
} else {
struct stack_entry* top = stack + istack;