star-3d

Surface structuring for efficient 3D geometric queries
git clone git://git.meso-star.fr/star-3d.git
Log | Files | Refs | README | LICENSE

commit 65018f89dc08b219023fd204963f4d7ee47f8bbe
parent 78a75c0d7842224cf31dd86cfc0f46f668f85a11
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri, 15 Oct 2021 11:40:41 +0200

Fix compilation warnings detected by gcc 11

Diffstat:
Msrc/test_s3d_cbox.h | 8++++----
Msrc/test_s3d_primitive.c | 4++--
Msrc/test_s3d_sampler.c | 8++++----
Msrc/test_s3d_scene.c | 4++--
Msrc/test_s3d_scene_view.c | 8++++----
Msrc/test_s3d_seams.c | 4++--
Msrc/test_s3d_shape.c | 4++--
Msrc/test_s3d_trace_ray_instance.c | 4++--
8 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/test_s3d_cbox.h b/src/test_s3d_cbox.h @@ -54,7 +54,7 @@ static const float cbox_walls[] = { 0.f, 559.f, 548.f, 552.f, 559.f, 548.f }; -const unsigned cbox_walls_nverts = sizeof(cbox_walls) / sizeof(float[3]); +const unsigned cbox_walls_nverts = sizeof(cbox_walls) / (sizeof(float)*3); const unsigned cbox_walls_ids[] = { 0, 1, 2, 2, 3, 0, /* Bottom */ @@ -63,7 +63,7 @@ const unsigned cbox_walls_ids[] = { 0, 3, 7, 7, 4, 0, /* Right */ 2, 3, 7, 7, 6, 2 /* Back */ }; -const unsigned cbox_walls_ntris = sizeof(cbox_walls_ids) / sizeof(unsigned[3]); +const unsigned cbox_walls_ntris = sizeof(cbox_walls_ids) / (sizeof(unsigned)*3); static const struct cbox_desc cbox_walls_desc = { cbox_walls, cbox_walls_ids }; @@ -100,8 +100,8 @@ static const unsigned cbox_block_ids[] = { 0, 1, 5, 5, 4, 0 }; -const unsigned cbox_block_nverts = sizeof(cbox_short_block) / sizeof(float[3]); -const unsigned cbox_block_ntris = sizeof(cbox_block_ids) / sizeof(unsigned[3]); +const unsigned cbox_block_nverts = sizeof(cbox_short_block) / (sizeof(float)*3); +const unsigned cbox_block_ntris = sizeof(cbox_block_ids) / (sizeof(unsigned)*3); /******************************************************************************* * Callbacks diff --git a/src/test_s3d_primitive.c b/src/test_s3d_primitive.c @@ -44,10 +44,10 @@ static const float plane_verts[] = { 1.f, 1.f, 0.f, 0.f, 1.f, 0.f }; -static const unsigned plane_nverts = sizeof(plane_verts) / sizeof(float[3]); +static const unsigned plane_nverts = sizeof(plane_verts) / (sizeof(float)*3); static const unsigned plane_ids[] = { 0, 1, 2, 2, 3, 0 }; -static const unsigned plane_ntris = sizeof(plane_ids) / sizeof(unsigned[3]); +static const unsigned plane_ntris = sizeof(plane_ids) / (sizeof(unsigned)*3); static void plane_get_ids(const unsigned itri, unsigned ids[3], void* data) diff --git a/src/test_s3d_sampler.c b/src/test_s3d_sampler.c @@ -103,8 +103,8 @@ main(int argc, char** argv) attribs.type = S3D_FLOAT3; attribs.get = cbox_get_position; - ntris = sizeof(cbox_walls_ids)/sizeof(unsigned[3]); - nverts = sizeof(cbox_walls)/sizeof(float[3]); + ntris = cbox_walls_ntris; + nverts = cbox_walls_nverts; desc.vertices = cbox_walls; desc.indices = cbox_walls_ids; CHK(s3d_mesh_setup_indexed_vertices @@ -148,8 +148,8 @@ main(int argc, char** argv) CHK(s3d_scene_view_ref_put(scnview) == RES_OK); CHK(s3d_shape_enable(walls, 1) == RES_OK); - ntris = sizeof(cbox_block_ids)/sizeof(unsigned[3]); - nverts = sizeof(cbox_short_block)/sizeof(float[3]); + ntris = cbox_block_ntris; + nverts = cbox_block_nverts; desc.vertices = cbox_short_block; desc.indices = cbox_block_ids; CHK(s3d_mesh_setup_indexed_vertices diff --git a/src/test_s3d_scene.c b/src/test_s3d_scene.c @@ -46,7 +46,7 @@ static const float cube_verts[] = { 5.f, 6.f, 6.f, 6.f, 6.f, 6.f }; -static const unsigned cube_nverts = sizeof(cube_verts) / sizeof(float[3]); +static const unsigned cube_nverts = sizeof(cube_verts) / (sizeof(float)*3); /* Front faces are CW. The normals point into the cube */ static const unsigned cube_ids[] = { @@ -57,7 +57,7 @@ static const unsigned cube_ids[] = { 2, 6, 3, 3, 6, 7, /* Top */ 0, 1, 4, 4, 1, 5 /* Bottom */ }; -static const unsigned cube_ntris = sizeof(cube_ids) / sizeof(unsigned[3]); +static const unsigned cube_ntris = sizeof(cube_ids) / (sizeof(unsigned)*3); static void cube_get_ids(const unsigned itri, unsigned ids[3], void* data) diff --git a/src/test_s3d_scene_view.c b/src/test_s3d_scene_view.c @@ -70,7 +70,7 @@ static const float cube_verts[] = { 0.f, 1.f, 1.f, 1.f, 1.f, 1.f }; -static const unsigned cube_nverts = sizeof(cube_verts) / sizeof(float[3]); +static const unsigned cube_nverts = sizeof(cube_verts) / (sizeof(float)*3); /* Front faces are CW. The normals point into the cube */ static const unsigned cube_ids[] = { @@ -81,7 +81,7 @@ static const unsigned cube_ids[] = { 2, 6, 3, 3, 6, 7, /* Top */ 0, 1, 4, 4, 1, 5 /* Bottom */ }; -static const unsigned cube_ntris = sizeof(cube_ids) / sizeof(unsigned[3]); +static const unsigned cube_ntris = sizeof(cube_ids) / (sizeof(unsigned)*3); /******************************************************************************* * Plane data @@ -92,10 +92,10 @@ static const float plane_verts[] = { 1.f, 1.f, 0.5f, 0.f, 1.f, 0.5f }; -static const unsigned plane_nverts = sizeof(plane_verts) / sizeof(float[3]); +static const unsigned plane_nverts = sizeof(plane_verts) / (sizeof(float)*3); static const unsigned plane_ids[] = { 0, 1, 2, 2, 3, 0 }; -static const unsigned plane_ntris = sizeof(plane_ids) / sizeof(unsigned[3]); +static const unsigned plane_ntris = sizeof(plane_ids) / (sizeof(unsigned)*3); /******************************************************************************* * helper function diff --git a/src/test_s3d_seams.c b/src/test_s3d_seams.c @@ -103,9 +103,9 @@ static const float SQUARE_EDGES__ [] = { 0.1f, 0.1f, 0.f, -0.1f, 0.1f, 0.f }; -static const unsigned SQUARE_NVERTS__ = sizeof(SQUARE_EDGES__) / sizeof(float[3]); +static const unsigned SQUARE_NVERTS__ = sizeof(SQUARE_EDGES__) / (sizeof(float)*3); static const unsigned SQUARE_TRG_IDS__ [] = { 0, 2, 1, 2, 0, 3 }; -static const unsigned SQUARE_NTRIS__ = sizeof(SQUARE_TRG_IDS__) / sizeof(unsigned[3]); +static const unsigned SQUARE_NTRIS__ = sizeof(SQUARE_TRG_IDS__) / (sizeof(unsigned)*3); static const struct desc SQUARE_DESC__ = { SQUARE_EDGES__, SQUARE_TRG_IDS__ }; static int diff --git a/src/test_s3d_shape.c b/src/test_s3d_shape.c @@ -65,8 +65,8 @@ main(int argc, char** argv) unsigned ids[3]; float pos[3]; float trans[12]; - const unsigned cbox_ntris = sizeof(cbox_walls_ids) / sizeof(unsigned[3]); - const unsigned cbox_nverts = sizeof(cbox_walls) / sizeof(float[3]); + const unsigned cbox_ntris = cbox_walls_ntris; + const unsigned cbox_nverts = cbox_walls_nverts; unsigned id; void* data = (void*)&cbox_walls_desc; char c; diff --git a/src/test_s3d_trace_ray_instance.c b/src/test_s3d_trace_ray_instance.c @@ -46,9 +46,9 @@ static const float quad_verts[] = { 1.f, 1.f, 0.f, 1.f, -1.f, 0.f }; -static const unsigned quad_nverts = sizeof(quad_verts)/sizeof(float[3]); +static const unsigned quad_nverts = sizeof(quad_verts)/(sizeof(float)*3); static const unsigned quad_ids[] = { 0, 1, 3, 3, 1, 2 }; -static const unsigned quad_ntris = sizeof(quad_ids)/sizeof(unsigned[3]); +static const unsigned quad_ntris = sizeof(quad_ids)/(sizeof(unsigned)*3); struct ray { float org[3];