star-geometry-3d

Clean and decorate 3D geometries
git clone git://git.meso-star.fr/star-geometry-3d.git
Log | Files | Refs | README | LICENSE

commit 45d38e97b3298fab0adc311009f41cf35a2def33
parent 38054c1b6d91471140c8defb776e2d1fbd55a341
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Tue,  3 Mar 2020 14:00:11 +0100

Small changes in asserts

Diffstat:
Msrc/sg3d_sXd_helper.h | 12++++--------
Msrc/sg3d_sdisXd_helper.h | 8++++----
Msrc/sg3d_sencXd_helper.h | 12+++---------
3 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/src/sg3d_sXd_helper.h b/src/sg3d_sXd_helper.h @@ -20,7 +20,6 @@ #include <star/senc3d.h> #include <rsys/rsys.h> -#include <rsys/float3.h> /* Get vertex indices for the itri_th triangle. * Suitable for use as get_indice callback in s3d_mesh_setup_indexed_vertices @@ -32,10 +31,8 @@ sg3d_sXd_geometry_get_indices void* ctx) { const struct sg3d_geometry* geometry = ctx; - res_T r; ASSERT(indices && geometry); - r = sg3d_geometry_get_unique_triangle_vertices(geometry, itri, indices); - ASSERT(r == RES_OK); (void)r; + SG3D(geometry_get_unique_triangle_vertices(geometry, itri, indices)); } /* Get coordinates for the ivert_th vertex. @@ -49,11 +46,10 @@ sg3d_sXd_geometry_get_position { const struct sg3d_geometry* geometry = ctx; double tmp[3]; - res_T r; + int i; ASSERT(coord && geometry); - r = sg3d_geometry_get_unique_vertex(geometry, ivert, tmp); - ASSERT(r == RES_OK); (void)r; - f3_set_d3(coord, tmp); + SG3D(geometry_get_unique_vertex(geometry, ivert, tmp)); + FOR_EACH(i, 0, SG3D_GEOMETRY_DIMENSION) coord[i] = (float)tmp[i]; } END_DECLS diff --git a/src/sg3d_sdisXd_helper.h b/src/sg3d_sdisXd_helper.h @@ -34,14 +34,14 @@ struct sg3d_sdisXd_scene_create_context { static FINLINE void sg3d_sdisXd_geometry_get_indices (const size_t itri, - size_t indices[3], + size_t indices[SG3D_GEOMETRY_DIMENSION], void* ctx__) { const struct sg3d_sdisXd_scene_create_context* ctx = ctx__; unsigned i, tmp[3]; - ASSERT(indices && ctx && ctx->geometry && itri < UINT_MAX); + ASSERT(indices && ctx && ctx->geometry && itri <= UINT_MAX); SG3D(geometry_get_unique_triangle_vertices(ctx->geometry, (unsigned)itri, tmp)); - FOR_EACH(i, 0, 3) indices[i] = tmp[i]; + FOR_EACH(i, 0, SG3D_GEOMETRY_DIMENSION) indices[i] = tmp[i]; } /* Get vertex indices for the itri_th triangle. @@ -53,7 +53,7 @@ sg3d_sdisXd_geometry_get_position void* ctx__) { const struct sg3d_sdisXd_scene_create_context* ctx = ctx__; - ASSERT(coord && ctx && ctx->geometry && ivert < UINT_MAX); + ASSERT(coord && ctx && ctx->geometry && ivert <= UINT_MAX); SG3D(geometry_get_unique_vertex(ctx->geometry, (unsigned)ivert, coord)); } diff --git a/src/sg3d_sencXd_helper.h b/src/sg3d_sencXd_helper.h @@ -30,10 +30,8 @@ sg3d_sencXd_geometry_get_indices void* ctx) { const struct sg3d_geometry* geometry = ctx; - res_T r; ASSERT(indices && geometry); - r = sg3d_geometry_get_unique_triangle_vertices(geometry, itri, indices); - ASSERT(r == RES_OK); (void)r; + SG3D(geometry_get_unique_triangle_vertices(geometry, itri, indices)); } /* Get vertex indices for the itri_th triangle. @@ -46,10 +44,8 @@ sg3d_sencXd_geometry_get_media { const struct sg3d_geometry* geometry = ctx; unsigned tmp[SG3D_PROP_TYPES_COUNT__]; - res_T r; ASSERT(media && geometry); - r = sg3d_geometry_get_unique_triangle_properties(geometry, itri, tmp); - ASSERT(r == RES_OK); (void)r; + SG3D(geometry_get_unique_triangle_properties(geometry, itri, tmp)); media[SENC3D_FRONT] = (tmp[SG3D_FRONT] == SG3D_UNSPECIFIED_PROPERTY) ? SENC3D_UNSPECIFIED_MEDIUM : tmp[SG3D_FRONT]; media[SENC3D_BACK] = (tmp[SG3D_BACK] == SG3D_UNSPECIFIED_PROPERTY) @@ -65,10 +61,8 @@ sg3d_sencXd_geometry_get_position void* ctx) { const struct sg3d_geometry* geometry = ctx; - res_T r; ASSERT(coord && geometry); - r = sg3d_geometry_get_unique_vertex(geometry, ivert, coord); - ASSERT(r == RES_OK); (void)r; + SG3D(geometry_get_unique_vertex(geometry, ivert, coord)); } END_DECLS