star-vx

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

commit bdcf2435076972f31f252793fc870ce6f023565e
parent 060895c3430ad05f3cb7900706f98119bb73a202
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 28 Feb 2018 15:57:49 +0100

Rename htvox_scene_get_voxels_count in htvox_scene_get_leaves_count

Diffstat:
Msrc/htvox.h | 6+++---
Msrc/htvox_scene.c | 6+++---
Msrc/test_htvox_scene.c | 10+++++-----
3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/htvox.h b/src/htvox.h @@ -141,9 +141,9 @@ htvox_scene_ref_put (struct htvox_scene* scn); HTVOX_API res_T -htvox_scene_get_voxels_count +htvox_scene_get_leaves_count (const struct htvox_scene* scn, - size_t* nvoxels); + size_t* nleaves); HTVOX_API res_T htvox_scene_get_aabb @@ -156,7 +156,7 @@ htvox_scene_for_each_leaf (struct htvox_scene* scn, void (*functor) (const void* val, /* Value of the voxel */ - const size_t ivoxel, /* Identifier of the leaf */ + const size_t ileaf, /* Identifier of the leaf in [0, #leafs[ */ 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 */ diff --git a/src/htvox_scene.c b/src/htvox_scene.c @@ -591,10 +591,10 @@ htvox_scene_get_aabb } res_T -htvox_scene_get_voxels_count(const struct htvox_scene* scn, size_t* nvoxels) +htvox_scene_get_leaves_count(const struct htvox_scene* scn, size_t* nleaves) { - if(!scn || !nvoxels) return RES_BAD_ARG; - *nvoxels = scn->nleaves; + if(!scn || !nleaves) return RES_BAD_ARG; + *nleaves = scn->nleaves; return RES_OK; } diff --git a/src/test_htvox_scene.c b/src/test_htvox_scene.c @@ -215,7 +215,7 @@ dump_data(FILE* stream, struct htvox_scene* scn) fprintf(stream, "ASCII\n"); fprintf(stream, "DATASET UNSTRUCTURED_GRID\n"); - CHK(htvox_scene_get_voxels_count(scn, &nvxls) == RES_OK); + CHK(htvox_scene_get_leaves_count(scn, &nvxls) == RES_OK); fprintf(stream, "POINTS %lu float\n", (unsigned long)(nvxls * 8)); CHK(htvox_scene_for_each_leaf(scn, write_points, stream) == RES_OK); @@ -316,9 +316,9 @@ main(int argc, char** argv) CHK(htvox_scene_for_each_leaf(scn, check_voxel, &ctx) == RES_OK); - CHK(htvox_scene_get_voxels_count(NULL, &nvoxels) == RES_BAD_ARG); - CHK(htvox_scene_get_voxels_count(scn, NULL) == RES_BAD_ARG); - CHK(htvox_scene_get_voxels_count(scn, &nvoxels) == RES_OK); + CHK(htvox_scene_get_leaves_count(NULL, &nvoxels) == RES_BAD_ARG); + CHK(htvox_scene_get_leaves_count(scn, NULL) == RES_BAD_ARG); + CHK(htvox_scene_get_leaves_count(scn, &nvoxels) == RES_OK); CHK(nvoxels == nvxls[0]*nvxls[1]*nvxls[2]); delta[0] = (upp[0] - low[0])/(double)nvxls[0]; @@ -363,7 +363,7 @@ main(int argc, char** argv) nvxls[0] = nvxls[1] = nvxls[2] = 32; desc.challenge_merge = merge_level0; CHK(NEW_SCN(dev, low, upp, nvxls, &desc, &scn) == RES_OK); - CHK(htvox_scene_get_voxels_count(scn, &nvoxels) == RES_OK); + CHK(htvox_scene_get_leaves_count(scn, &nvoxels) == RES_OK); CHK(nvoxels == nvxls[0]*nvxls[1]*nvxls[2] / 8); dump_data(stdout, scn);