|
|
|
@ -69,7 +69,7 @@ if (3 == foo) {
|
|
|
|
|
return foo;
|
|
|
|
|
}
|
|
|
|
|
/* --------------------------------------------------------------------- */
|
|
|
|
|
int try_to_read_an_OBJ_file(char *fname, int notused)
|
|
|
|
|
int try_to_read_an_OBJ_file(char *infname, char *outfname, int notused)
|
|
|
|
|
{
|
|
|
|
|
FILE *fpin;
|
|
|
|
|
char line[LINE_SZ+1], *cptr;
|
|
|
|
@ -82,12 +82,12 @@ Bubulle bubulle;
|
|
|
|
|
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, fname, notused);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (NULL==(fpin=fopen(fname, "r"))) {
|
|
|
|
|
perror(fname);
|
|
|
|
|
if (NULL==(fpin=fopen(infname, "r"))) {
|
|
|
|
|
perror(infname);
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bublist = alloc_bubulles(fname, 1000, 0);
|
|
|
|
|
bublist = alloc_bubulles(infname, 1000, 0);
|
|
|
|
|
if (NULL==bublist) {
|
|
|
|
|
fprintf(stderr, "err in %s, aborting...\n", __func__);
|
|
|
|
|
abort();
|
|
|
|
@ -110,7 +110,7 @@ while(NULL!=(cptr=fgets(line, LINE_SZ, fpin))) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
tokenid = type_of_the_line(cptr);
|
|
|
|
|
fprintf(stderr, "tok '%s' --> %d\n", cptr, tokenid);
|
|
|
|
|
if (verbosity) fprintf(stderr, "token '%s' --> %d\n", cptr, tokenid);
|
|
|
|
|
|
|
|
|
|
memset(&bubulle, 0, sizeof(Bubulle));
|
|
|
|
|
|
|
|
|
@ -119,6 +119,7 @@ while(NULL!=(cptr=fgets(line, LINE_SZ, fpin))) {
|
|
|
|
|
/* do nothing */
|
|
|
|
|
break;
|
|
|
|
|
case T_vertice:
|
|
|
|
|
x = y = z = 0.0;
|
|
|
|
|
foo = parse_vertice(cptr, &x, &y, &z);
|
|
|
|
|
bubulle.p.x = x;
|
|
|
|
|
bubulle.p.y = y;
|
|
|
|
@ -126,7 +127,7 @@ while(NULL!=(cptr=fgets(line, LINE_SZ, fpin))) {
|
|
|
|
|
if (verbosity > 1) niceprint_bubulle(&bubulle, 0);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
|
|
// fprintf(stderr, "token %d ?\n", tokenid);
|
|
|
|
|
continue; /* wtf ? */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -143,7 +144,7 @@ if(verbosity) {
|
|
|
|
|
fprintf(stderr, "%s : %d vertices loaded\n", __func__, nbre);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bubulles_to_data("xyz", NULL, bublist, 0);
|
|
|
|
|
bubulles_to_data(outfname, NULL, bublist, 0);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|