star-vx

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

commit 8718e005b3c2b149203a3b845607014ff437d3be
parent 86a2990d7fad7278df7cebc484b9f9970b9cfee9
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu,  8 Feb 2018 10:26:37 +0100

Adjust and add some comments

Diffstat:
Msrc/htvox.h | 14+++++++-------
Msrc/htvox_octree_buffer.h | 2+-
Msrc/htvox_scene.c | 2+-
Msrc/test_htvox_scene.c | 2--
4 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/htvox.h b/src/htvox.h @@ -91,7 +91,7 @@ htvox_scene_create const size_t nvoxels[3], /* # voxels along the 3 axis */ void (*get)(const size_t xyz[3], double* value, void* ctx), int (*merge)(const double min_val, const double max_val, void* ctx), - void* context, /* Client data send as the last param of the callbacks */ + void* context, /* Client data sent as the last param of the callbacks */ struct htvox_scene** scn); HTVOX_API res_T @@ -117,12 +117,12 @@ HTVOX_API res_T htvox_scene_for_each_voxel (struct htvox_scene* scn, void (*functor) - (const double val, - const size_t ivoxel, - const double low[3], - const double upp[3], - void* ctx), - void* context); + (const double val, /* Value of the voxel */ + const size_t ivoxel, /* Identifier of the voxel */ + const double low[3], /* World space lower bound of the voxel */ + const double upp[3], /* World space upper bound of the voxel */ + void* ctx), /* Client data */ + void* context); /* Client data sent as the last argument of the callback */ HTVOX_API res_T htvox_scene_trace_ray diff --git a/src/htvox_octree_buffer.h b/src/htvox_octree_buffer.h @@ -45,7 +45,7 @@ struct octree_xnode { * `offset' nodes *before* the node. If OCTREE_XNODE_FLAG_FAR_INDEX is set, * the index toward the children are stored N bytes *after* the node with N * defined as : N = (offset & OCTREE_XNODE_MASK)*sizeof(struct octree_xnode). - * Finally if offset is equal to OCTREE_XNODE_EMPTY, then the node does not + * Finally if the OCTREE_XNODE_EMPTY bit is set, then the node does not * contain anything and thus has no child. */ uint32_t offset; }; diff --git a/src/htvox_scene.c b/src/htvox_scene.c @@ -35,7 +35,7 @@ struct octree_node { double data; /* Data of the node */ }; -/* Per octree node stack of children */ +/* Stacked children of an octree node */ struct stack { struct octree_node nodes[8]; /* List of registered children nodes */ int len; /* Number of registered nodes in [0, 8[ */ diff --git a/src/test_htvox_scene.c b/src/test_htvox_scene.c @@ -25,8 +25,6 @@ struct check_context { size_t* nvoxels; }; - - static int no_merge(const double min_val, const double max_val, void* ctx) {