libbubulle/tools/read_obj.c
2023-04-30 01:03:49 +02:00

68 lines
1.2 KiB
C

/*
tentatives de lecture des OBJ
*/
#include <stdio.h>
#include <stdlib.h>
#include <libgen.h> // for basename(3)
#include <unistd.h>
#include "../bubulles.h"
#include "../edges.h"
#include "objtrucs.h"
int verbosity = 0;
/* --------------------------------------------------------------------- */
void help(void)
{
printf("nothing to say...\n");
exit(0);
}
/* --------------------------------------------------------------------- */
int main(int argc, char *argv[])
{
int foo, opt;
char *ofname = NULL;
fprintf(stderr, "\n### READ_OBJ compiled %s at %s\n", __DATE__, __TIME__);
if (1 == argc) {
bubulles_version(1);
exit(0);
}
while ((opt = getopt(argc, argv, "ho:v")) != -1) {
switch(opt) {
case 'h':
help(); break;
case 'o':
ofname = optarg;
break;
case 'v':
verbosity++; break;
default:
exit(1);
break;
}
}
if (optind < argc) {
fprintf(stderr, "arg = %s\n", argv[optind]);
foo = try_to_read_an_OBJ_file(argv[optind], ofname, 0);
if (foo) {
fprintf(stderr, "Error number %d on '%s'\n", foo, argv[optind]);
exit(1);
}
}
else {
fprintf(stderr, "%s need a input filename\n", argv[0]);
exit(1);
}
return 0;
}