star-enclosures-3d

Extract enclosures from 3D geometry
git clone git://git.meso-star.fr/star-enclosures-3d.git
Log | Files | Refs | README | LICENSE

commit 8a24265fd63c2a2de409c3b46f36ab6e38581b3b
parent 3f864fc7d4d70c571c9474f26bb559ede06b024a
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Tue,  6 Mar 2018 16:11:20 +0100

Increase test counts; as reduced memory consumption now allows it.

Diffstat:
Msrc/test_senc_many_enclosures.c | 12++++++------
Msrc/test_senc_many_triangles.c | 19+++++++++----------
2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/src/test_senc_many_enclosures.c b/src/test_senc_many_enclosures.c @@ -36,7 +36,7 @@ get_s3dut_indices(const unsigned itri, unsigned ids[3], void* context) ASSERT(ctx->data.indices[itri * 3 + 0] < UINT_MAX && ctx->data.indices[itri * 3 + 1] < UINT_MAX && ctx->data.indices[itri * 3 + 2] < UINT_MAX); - ids[0] = (unsigned) ctx->data.indices[itri * 3 + 0]; + ids[0] = (unsigned)ctx->data.indices[itri * 3 + 0]; ids[ctx->ctx.reverse_vrtx ? 2 : 1] = (unsigned)ctx->data.indices[itri * 3 + 1]; ids[ctx->ctx.reverse_vrtx ? 1 : 2] = (unsigned)ctx->data.indices[itri * 3 + 2]; } @@ -59,10 +59,10 @@ static void get_s3dut_media(const unsigned itri, unsigned medium[2], void* context) { struct s3dut_context* ctx = context; - (void) itri; + (void)itri; ASSERT(medium && ctx); - medium[ctx->ctx.reverse_med ? 1 : 0] = ctx->ctx.front_media[0]; - medium[ctx->ctx.reverse_med ? 0 : 1] = ctx->ctx.back_media[0]; + medium[ctx->ctx.reverse_med ? 1 : 0] = *ctx->ctx.front_media; + medium[ctx->ctx.reverse_med ? 0 : 1] = *ctx->ctx.back_media; } int @@ -78,13 +78,13 @@ main(int argc, char** argv) unsigned cyl_trg_count, cyl_vrtx_count, i; char dump[64]; struct time t0, t1; - (void) argc, (void) argv; + (void)argc, (void)argv; CHK(mem_init_regular_allocator(&allocator) == RES_OK); CHK(senc_device_create(NULL, &allocator, SENC_NTHREADS_DEFAULT, 1, &dev) == RES_OK); -#define NB_CYL 4096 +#define NB_CYL 16384 /* Create the scene */ CHK(senc_scene_create(dev, NB_CYL + 1, &scn) == RES_OK); diff --git a/src/test_senc_many_triangles.c b/src/test_senc_many_triangles.c @@ -36,7 +36,7 @@ get_s3dut_indices(const unsigned itri, unsigned ids[3], void* context) ASSERT(ctx->data.indices[itri * 3 + 0] < UINT_MAX && ctx->data.indices[itri * 3 + 1] < UINT_MAX && ctx->data.indices[itri * 3 + 2] < UINT_MAX); - ids[0] = (unsigned) ctx->data.indices[itri * 3 + 0]; + ids[0] = (unsigned)ctx->data.indices[itri * 3 + 0]; ids[ctx->ctx.reverse_vrtx ? 2 : 1] = (unsigned)ctx->data.indices[itri * 3 + 1]; ids[ctx->ctx.reverse_vrtx ? 1 : 2] = (unsigned)ctx->data.indices[itri * 3 + 2]; } @@ -59,10 +59,10 @@ static void get_s3dut_media(const unsigned itri, unsigned medium[2], void* context) { struct s3dut_context* ctx = context; - (void) itri; + (void)itri; ASSERT(medium && ctx); - medium[ctx->ctx.reverse_med ? 1 : 0] = ctx->ctx.front_media[0]; - medium[ctx->ctx.reverse_med ? 0 : 1] = ctx->ctx.back_media[1]; + medium[ctx->ctx.reverse_med ? 1 : 0] = *ctx->ctx.front_media; + medium[ctx->ctx.reverse_med ? 0 : 1] = *ctx->ctx.back_media; } int @@ -78,15 +78,15 @@ main(int argc, char** argv) unsigned cyl_trg_count, cyl_vrtx_count, i; char dump[64]; struct time t0, t1; - (void) argc, (void) argv; + (void)argc, (void)argv; CHK(mem_init_regular_allocator(&allocator) == RES_OK); CHK(senc_device_create (NULL, &allocator, SENC_NTHREADS_DEFAULT, 1, &dev) == RES_OK); -#define NB_CYL 10 +#define NB_CYL 8 /* Create the scene */ - CHK(senc_scene_create(dev, NB_CYL/2+1, &scn) == RES_OK); + CHK(senc_scene_create(dev, NB_CYL+1, &scn) == RES_OK); ctx.ctx.positions = NULL; ctx.ctx.indices = NULL; @@ -95,14 +95,14 @@ main(int argc, char** argv) ctx.ctx.reverse_med = 0; ctx.ctx.back_media = medium0; /* Create a cylinder (320 K trg, 160 K vrtx). */ - CHK(s3dut_create_cylinder(&allocator, 1, 2, 400, 400, &cyl) == RES_OK); + CHK(s3dut_create_cylinder(&allocator, 1, 2, 640, 500, &cyl) == RES_OK); S3DUT(mesh_get_data(cyl, &ctx.data)); ASSERT(ctx.data.nprimitives < UINT_MAX); ASSERT(ctx.data.nvertices < UINT_MAX); cyl_trg_count = (unsigned)ctx.data.nprimitives; cyl_vrtx_count = (unsigned)ctx.data.nvertices; FOR_EACH(i, 0, NB_CYL) { - unsigned mmm = i/2; + unsigned mmm = i; ctx.ctx.front_media = &mmm; d3(ctx.ctx.offset, 0, 0, i * 10); CHK(senc_scene_add_geometry(scn, cyl_trg_count, get_s3dut_indices, @@ -124,7 +124,6 @@ main(int argc, char** argv) CHK(senc_descriptor_get_enclosure_count(desc, &count) == RES_OK); CHK(count == 1 + NB_CYL); - FOR_EACH(i, 0, count) { struct senc_enclosure* enclosure; const struct enclosure_header* header;