From 51bf67e1708062bfc3cb3eb40bc17222aff9cdee Mon Sep 17 00:00:00 2001 From: epoch Date: Sun, 24 Dec 2017 03:14:57 -0600 Subject: added group_rot to export, set default mode to movement instead of passthru, removed useless comment, commented out annoying error, made comments in hackvr continue reading instead of breaking out of loop --- src/hackvr.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/hackvr.c') diff --git a/src/hackvr.c b/src/hackvr.c index 78a4759..b088087 100644 --- a/src/hackvr.c +++ b/src/hackvr.c @@ -32,6 +32,7 @@ extern struct gra_global gra_global; struct global global; +//might be able to make this faster by just using fgets() and not using recursion and malloc. /* does not return the newline. */ char *read_line_hack(FILE *fp,int len) { short in; @@ -118,9 +119,9 @@ int load_stdin() {//this function returns -1 to quit, 0 to not ask for a redraw, if(FD_ISSET(0,&readfs)) {*/ //#endif while((line=line?free(line),read_line_hack(stdin,0):read_line_hack(stdin,0))) {//load as long there's something to load - if(*line == '#') return 0; + if(*line == '#') continue; // fprintf(stderr,"# read command: %s\n",line); - if(a) free(a); + if(a) free(a);//use a static char pointer array so I don't have to use the heap. possible optimization. a=line_splitter(line,&len); // for(i=0;i 2) { for(i=0;global.shape[i];i++) {//require a[2], if not it'll segfault. derrrr, epoch. - if(!strcmp(global.shape[i]->id,a[2])) { - printf("%s addshape %d",a[2],global.shape[i]->len); + if(a[2][0]=='*' || !strcmp(global.shape[i]->id,a[2])) { + printf("%s_%s addshape %d",id,a[2],global.shape[i]->len); for(j=0;j < global.shape[i]->len+(global.shape[i]->len==1);j++) { printf(" %Lf %Lf %Lf",global.shape[i]->p[j].x,global.shape[i]->p[j].y,global.shape[i]->p[j].z); - } + }//possible TODO: should I combine the string and output it all at once instead of throughout a loop? printf("\n"); } } + for(i=0;global.group_rot[i];i++) { + if(a[2][0]=='*' || !strcmp(global.group_rot[i]->id,a[2])) { + printf("%s_%s rotate %d %d %d\n",id,a[2],global.group_rot[i]->p.x,global.group_rot[i]->p.y,global.group_rot[i]->p.z); + } + } } continue; } -- cgit v1.2.3