--- ray/src/hd/rhdobj.c 2003/02/22 02:07:24 3.11 +++ ray/src/hd/rhdobj.c 2003/07/21 22:30:18 3.15 @@ -1,15 +1,18 @@ #ifndef lint -static const char RCSid[] = "$Id: rhdobj.c,v 3.11 2003/02/22 02:07:24 greg Exp $"; +static const char RCSid[] = "$Id: rhdobj.c,v 3.15 2003/07/21 22:30:18 schorsch Exp $"; #endif /* * Routines for loading and displaying Radiance objects in rholo with GLX. */ +#include + #include "radogl.h" #include "tonemap.h" #include "rhdisp.h" #include "rhdriver.h" #include "rhdobj.h" +#include "rtprocess.h" extern FILE *sstdout; /* user standard output */ @@ -50,10 +53,10 @@ typedef struct dobject { struct dobject *next; /* next object in list */ char name[64]; /* object name */ FVECT center; /* orig. object center */ - FLOAT radius; /* orig. object radius */ + RREAL radius; /* orig. object radius */ int listid; /* GL display list identifier */ int nlists; /* number of lists allocated */ - int rtp[3]; /* associated rtrace process */ + SUBPROC rtp; /* associated rtrace process */ DLIGHTS *ol; /* object lights */ FULLXF xfb; /* coordinate transform */ short drawcode; /* drawing code */ @@ -118,7 +121,7 @@ register DOBJECT *op; dobjects = ohead.next; if (!foundlink) { glDeleteLists(op->listid, op->nlists); - close_process(op->rtp); + close_process(&(op->rtp)); } while (op->xfac) freestr(op->xfav[--op->xfac]); @@ -337,7 +340,7 @@ ssph_compute() /* compute source set from sphere sam d = 1.0/ncells; scalecolor(dlightsets->lamb, d); done: /* clear sphere sample array */ - bzero((char *)ssamp, sizeof(ssamp)); + memset((void *)ssamp, '\0', sizeof(ssamp)); return(ncells); } @@ -370,7 +373,7 @@ int force; if (!force) return(0); /* need to compute new light set */ - copystruct(&cvw, &stdview); + cvw = stdview; cvw.type = VT_PER; VCOPY(cvw.vp, ocent); cvw.vup[0] = 1.; cvw.vup[1] = cvw.vup[2] = 0.; @@ -535,7 +538,6 @@ toomany: dobj_load(oct, nam) /* create/load an octree object */ char *oct, *nam; { - extern char *getlibpath(), *getpath(); char *fpp, fpath[128]; register DOBJECT *op; /* check arguments */ @@ -556,7 +558,7 @@ char *oct, *nam; return(0); } /* get octree path */ - if ((fpp = getpath(oct, getlibpath(), R_OK)) == NULL) { + if ((fpp = getpath(oct, getrlibpath(), R_OK)) == NULL) { sprintf(errmsg, "cannot find octree \"%s\"", oct); error(COMMAND, errmsg); return(0); @@ -579,7 +581,7 @@ char *oct, *nam; /* start rtrace */ rtargv[RTARGC-1] = fpath; rtargv[RTARGC] = NULL; - open_process(op->rtp, rtargv); + open_process(&(op->rtp), rtargv); /* insert into main list */ op->next = dobjects; curobj = dobjects = op; @@ -731,13 +733,13 @@ dobj_unmove() /* undo last transform change */ return(0); } /* hold last transform */ - bcopy((char *)lastxfav, (char *)txfav, + memcpy((void *)txfav, (void *)lastxfav, (txfac=lastxfac)*sizeof(char *)); /* save this transform */ - bcopy((char *)curobj->xfav, (char *)lastxfav, + memcpy((void *)lastxfav, (void *)curobj->xfav, (lastxfac=curobj->xfac)*sizeof(char *)); /* copy back last transform */ - bcopy((char *)txfav, (char *)curobj->xfav, + memcpy((void *)curobj->xfav, (void *)txfav, (curobj->xfac=txfac)*sizeof(char *)); /* set matrices */ fullxf(&curobj->xfb, curobj->xfac, curobj->xfav); @@ -772,7 +774,7 @@ char *oldnm, *nam; opdup = (DOBJECT *)malloc(sizeof(DOBJECT)); if (opdup == NULL) error(SYSTEM, "out of memory in dobj_dup"); - copystruct(opdup, op); + *opdup = *op; /* rename */ strcpy(opdup->name, nam); /* get our own copy of transform */ @@ -860,7 +862,7 @@ FVECT rorg, rdir; VCOPY(darr, rorg); VCOPY(darr+3, rdir); } /* trace it */ - if (process(op->rtp, (char *)darr, (char *)darr, sizeof(double), + if (process(&(op->rtp), (char *)darr, (char *)darr, sizeof(double), 6*sizeof(double)) != sizeof(double)) error(SYSTEM, "rtrace communication error"); /* return distance */