| 5 |
|
* Routines for loading and displaying Radiance objects in rholo with GLX. |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
+ |
#include <string.h> |
| 9 |
+ |
|
| 10 |
|
#include "radogl.h" |
| 11 |
|
#include "tonemap.h" |
| 12 |
|
#include "rhdisp.h" |
| 13 |
|
#include "rhdriver.h" |
| 14 |
|
#include "rhdobj.h" |
| 15 |
+ |
#include "rtprocess.h" |
| 16 |
|
|
| 17 |
|
extern FILE *sstdout; /* user standard output */ |
| 18 |
|
|
| 53 |
|
struct dobject *next; /* next object in list */ |
| 54 |
|
char name[64]; /* object name */ |
| 55 |
|
FVECT center; /* orig. object center */ |
| 56 |
< |
FLOAT radius; /* orig. object radius */ |
| 56 |
> |
RREAL radius; /* orig. object radius */ |
| 57 |
|
int listid; /* GL display list identifier */ |
| 58 |
|
int nlists; /* number of lists allocated */ |
| 59 |
< |
int rtp[3]; /* associated rtrace process */ |
| 59 |
> |
SUBPROC rtp; /* associated rtrace process */ |
| 60 |
|
DLIGHTS *ol; /* object lights */ |
| 61 |
|
FULLXF xfb; /* coordinate transform */ |
| 62 |
|
short drawcode; /* drawing code */ |
| 121 |
|
dobjects = ohead.next; |
| 122 |
|
if (!foundlink) { |
| 123 |
|
glDeleteLists(op->listid, op->nlists); |
| 124 |
< |
close_process(op->rtp); |
| 124 |
> |
close_process(&(op->rtp)); |
| 125 |
|
} |
| 126 |
|
while (op->xfac) |
| 127 |
|
freestr(op->xfav[--op->xfac]); |
| 340 |
|
d = 1.0/ncells; |
| 341 |
|
scalecolor(dlightsets->lamb, d); |
| 342 |
|
done: /* clear sphere sample array */ |
| 343 |
< |
bzero((char *)ssamp, sizeof(ssamp)); |
| 343 |
> |
memset((void *)ssamp, '\0', sizeof(ssamp)); |
| 344 |
|
return(ncells); |
| 345 |
|
} |
| 346 |
|
|
| 373 |
|
if (!force) |
| 374 |
|
return(0); |
| 375 |
|
/* need to compute new light set */ |
| 376 |
< |
copystruct(&cvw, &stdview); |
| 376 |
> |
cvw = stdview; |
| 377 |
|
cvw.type = VT_PER; |
| 378 |
|
VCOPY(cvw.vp, ocent); |
| 379 |
|
cvw.vup[0] = 1.; cvw.vup[1] = cvw.vup[2] = 0.; |
| 538 |
|
dobj_load(oct, nam) /* create/load an octree object */ |
| 539 |
|
char *oct, *nam; |
| 540 |
|
{ |
| 538 |
– |
extern char *getlibpath(), *getpath(); |
| 541 |
|
char *fpp, fpath[128]; |
| 542 |
|
register DOBJECT *op; |
| 543 |
|
/* check arguments */ |
| 558 |
|
return(0); |
| 559 |
|
} |
| 560 |
|
/* get octree path */ |
| 561 |
< |
if ((fpp = getpath(oct, getlibpath(), R_OK)) == NULL) { |
| 561 |
> |
if ((fpp = getpath(oct, getrlibpath(), R_OK)) == NULL) { |
| 562 |
|
sprintf(errmsg, "cannot find octree \"%s\"", oct); |
| 563 |
|
error(COMMAND, errmsg); |
| 564 |
|
return(0); |
| 581 |
|
/* start rtrace */ |
| 582 |
|
rtargv[RTARGC-1] = fpath; |
| 583 |
|
rtargv[RTARGC] = NULL; |
| 584 |
< |
open_process(op->rtp, rtargv); |
| 584 |
> |
open_process(&(op->rtp), rtargv); |
| 585 |
|
/* insert into main list */ |
| 586 |
|
op->next = dobjects; |
| 587 |
|
curobj = dobjects = op; |
| 733 |
|
return(0); |
| 734 |
|
} |
| 735 |
|
/* hold last transform */ |
| 736 |
< |
bcopy((char *)lastxfav, (char *)txfav, |
| 736 |
> |
memcpy((void *)txfav, (void *)lastxfav, |
| 737 |
|
(txfac=lastxfac)*sizeof(char *)); |
| 738 |
|
/* save this transform */ |
| 739 |
< |
bcopy((char *)curobj->xfav, (char *)lastxfav, |
| 739 |
> |
memcpy((void *)lastxfav, (void *)curobj->xfav, |
| 740 |
|
(lastxfac=curobj->xfac)*sizeof(char *)); |
| 741 |
|
/* copy back last transform */ |
| 742 |
< |
bcopy((char *)txfav, (char *)curobj->xfav, |
| 742 |
> |
memcpy((void *)curobj->xfav, (void *)txfav, |
| 743 |
|
(curobj->xfac=txfac)*sizeof(char *)); |
| 744 |
|
/* set matrices */ |
| 745 |
|
fullxf(&curobj->xfb, curobj->xfac, curobj->xfav); |
| 774 |
|
opdup = (DOBJECT *)malloc(sizeof(DOBJECT)); |
| 775 |
|
if (opdup == NULL) |
| 776 |
|
error(SYSTEM, "out of memory in dobj_dup"); |
| 777 |
< |
copystruct(opdup, op); |
| 777 |
> |
*opdup = *op; |
| 778 |
|
/* rename */ |
| 779 |
|
strcpy(opdup->name, nam); |
| 780 |
|
/* get our own copy of transform */ |
| 862 |
|
VCOPY(darr, rorg); VCOPY(darr+3, rdir); |
| 863 |
|
} |
| 864 |
|
/* trace it */ |
| 865 |
< |
if (process(op->rtp, (char *)darr, (char *)darr, sizeof(double), |
| 865 |
> |
if (process(&(op->rtp), (char *)darr, (char *)darr, sizeof(double), |
| 866 |
|
6*sizeof(double)) != sizeof(double)) |
| 867 |
|
error(SYSTEM, "rtrace communication error"); |
| 868 |
|
/* return distance */ |