commit 1fd7e0a80b08065608d2884c6d72a180bb1ed137
parent d029ee046cb8dc7cd73395162f003f6633eeba2b
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 4 Mar 2021 15:48:43 +0100
Add -n option to the suvm_voxelize program
Enable normals precomputation
Diffstat:
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/suvm_voxelize_sth.c b/src/suvm_voxelize_sth.c
@@ -28,6 +28,7 @@ struct args {
const char* input_filename;
const char* output_filename;
unsigned def[3];
+ int precompute_normals;
int quit;
int verbose;
};
@@ -36,6 +37,7 @@ static const struct args ARGS_DEFAULT = {
NULL, /* Input file */
NULL, /* Output file */
{64, 64, 64}, /* Definition */
+ 0, /* Precompute normals */
0, /* Quit */
0 /* Verbose */
};
@@ -62,6 +64,8 @@ print_help(const char* cmd)
printf(
" -h display this help and exit.\n");
printf(
+" -n precompute the tetrahedra normals.\n");
+ printf(
" -o <output> filename of the output VTK file. If not defined, write\n"
" results to standard ouput\n");
printf(
@@ -91,7 +95,7 @@ args_init(struct args* args, const int argc, char** argv)
*args = ARGS_DEFAULT;
- while((opt = getopt(argc, argv, "d:ho:v")) != -1) {
+ while((opt = getopt(argc, argv, "d:hno:v")) != -1) {
switch(opt) {
case 'd':
res = cstr_to_list_uint(optarg, ':', args->def, &n, 3);
@@ -103,6 +107,9 @@ args_init(struct args* args, const int argc, char** argv)
args_release(args);
args->quit = 1;
break;
+ case 'n':
+ args->precompute_normals = 1;
+ break;
case 'o':
args->output_filename = optarg;
break;
@@ -356,6 +363,7 @@ main(int argc, char** argv)
msh_args.get_indices = get_indices;
msh_args.get_position = get_position;
msh_args.context = &desc;
+ msh_args.precompute_normals = args.precompute_normals;
/* Setup the volume from the loaded data */
if(args.verbose) {
diff --git a/src/test_suvm_volume.c b/src/test_suvm_volume.c
@@ -787,6 +787,7 @@ test_volume_at_ball(struct suvm_device* dev)
darray_prim_init(NULL, &prims);
+ args.precompute_normals = 1;
args.ntetrahedra = ball_ntetrahedra;
args.nvertices = ball_nvertices;
args.get_indices = get_indices;