star-vx

Structuring voxels for ray-tracing
git clone git://git.meso-star.fr/star-vx.git
Log | Files | Refs | README | LICENSE

commit b1d8a75d98c5eabf1fda261e8f66c64fb8c934cf
parent 76293eee22c16ebe70d800333937176f7a8a649d
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed,  4 Apr 2018 11:39:39 +0200

Fix an issue in the registration of the node attributes

The index toward the children attributes was wrongly computed. It was
encoded as a far index if the page id of the children nodes was different
of the parent node page id. Actually, it had to be encoded as a far
index if the page id of the children *attributes* was different of the
parent node page id.

Diffstat:
Msrc/svx.h | 2+-
Msrc/svx_octree.c | 7+++++--
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/svx.h b/src/svx.h @@ -132,7 +132,7 @@ typedef int /* Hit filter function data type. The caller can define a function of this type * to control the treatment at each "leaf" intersected during the octree ray - * tracing. A intersected voxel is considered as a "leaf" if it is really a + * tracing. An intersected voxel is considered as a "leaf" if it is really a * leaf, or if the svx_hit_challenge_T function returns a not null value. If * the filter function returns 0, the octree traversal is stopped while a value * !=0 lets the ray to pursue its traversal. Such functions can be used to diff --git a/src/svx_octree.c b/src/svx_octree.c @@ -219,9 +219,7 @@ stack_write /* Setup the offset toward the children and children attribs */ if(node->ichild_node.ipage == nodes_id.ipage) { node_offset = node->ichild_node.inode; - attr_offset = node->ichild_attr.inode; } - /* The page id of the children is not the same as that of node */ if(node_offset > OCTREE_XNODE_MAX_CHILDREN_OFFSET) { res = octree_buffer_alloc_far_index(buf, &index); @@ -230,6 +228,11 @@ stack_write node_offset = OCTREE_XNODE_FLAG_FAR_INDEX | index.inode; } + /* Setup the offset toward the children attribs */ + if(node->ichild_attr.ipage == nodes_id.ipage) { + attr_offset = node->ichild_attr.inode; + } + /* The page id of the attribs is not tthe same as that of node */ if(attr_offset > OCTREE_XNODE_FLAG_FAR_INDEX) { res = octree_buffer_alloc_far_index(buf, &index);