| 9 |
|
|
| 10 |
|
#include "copyright.h" |
| 11 |
|
|
| 12 |
< |
#include "standard.h" |
| 13 |
< |
#include "octree.h" |
| 14 |
< |
#include "object.h" |
| 12 |
> |
#include "ray.h" |
| 13 |
|
#include "otypes.h" |
| 14 |
|
#include "face.h" |
| 15 |
|
#include "cone.h" |
| 16 |
|
#include "instance.h" |
| 17 |
|
#include "mesh.h" |
| 20 |
– |
#include "color.h" |
| 18 |
|
#include "data.h" |
| 19 |
|
#include "func.h" |
| 20 |
< |
#include "ray.h" |
| 20 |
> |
#include "bsdf.h" |
| 21 |
|
|
| 22 |
|
|
| 23 |
|
/* KEEP THIS ROUTINE CONSISTENT WITH THE DIFFERENT OBJECT FUNCTIONS! */ |
| 24 |
|
|
| 25 |
|
|
| 26 |
< |
extern int |
| 26 |
> |
int |
| 27 |
|
load_os( /* load associated data for object */ |
| 28 |
< |
register OBJREC *op |
| 28 |
> |
OBJREC *op |
| 29 |
|
) |
| 30 |
|
{ |
| 31 |
< |
DATARRAY *dp; |
| 31 |
> |
DATARRAY *dp; |
| 32 |
> |
SDData *sd; |
| 33 |
|
|
| 34 |
+ |
SDretainSet = SDretainAll; |
| 35 |
+ |
|
| 36 |
|
switch (op->otype) { |
| 37 |
|
case OBJ_FACE: /* polygon */ |
| 38 |
|
getface(op); |
| 57 |
|
getfunc(op, 4, 0x3<<5, 0); |
| 58 |
|
return(1); |
| 59 |
|
case PAT_CDATA: /* color data */ |
| 60 |
+ |
if (op->oargs.nsargs < 4) |
| 61 |
+ |
goto sargerr; |
| 62 |
|
dp = getdata(op->oargs.sarg[3]); |
| 63 |
|
getdata(op->oargs.sarg[4]); |
| 64 |
|
getdata(op->oargs.sarg[5]); |
| 76 |
|
case PAT_CFUNC: /* color function */ |
| 77 |
|
getfunc(op, 3, 0x7, 0); |
| 78 |
|
return(1); |
| 79 |
+ |
case PAT_SPECFUNC: /* spectral function */ |
| 80 |
+ |
getfunc(op, 1, 0, 0); |
| 81 |
+ |
return(1); |
| 82 |
+ |
case PAT_SPECFILE: /* spectrum file */ |
| 83 |
+ |
if (op->oargs.nsargs < 1) |
| 84 |
+ |
goto sargerr; |
| 85 |
+ |
getdata(op->oargs.sarg[0]); |
| 86 |
+ |
return(1); |
| 87 |
+ |
case PAT_SPECDATA: /* spectral data file */ |
| 88 |
+ |
if (op->oargs.nsargs < 2) |
| 89 |
+ |
goto sargerr; |
| 90 |
+ |
dp = getdata(op->oargs.sarg[1]); |
| 91 |
+ |
getfunc(op, 2, ((1<<(dp->nd-1)) - 1)<<3, 0); |
| 92 |
+ |
return(1); |
| 93 |
+ |
case PAT_SPECPICT: /* spectral picture */ |
| 94 |
+ |
if (op->oargs.nsargs < 2) |
| 95 |
+ |
goto sargerr; |
| 96 |
+ |
getspec(op->oargs.sarg[1]); |
| 97 |
+ |
getfunc(op, 2, 0x3<<3, 0); |
| 98 |
+ |
return(1); |
| 99 |
|
case TEX_DATA: /* texture data */ |
| 100 |
|
if (op->oargs.nsargs < 6) |
| 101 |
|
goto sargerr; |
| 125 |
|
case MAT_BRTDF: /* BRDTfunc material */ |
| 126 |
|
getfunc(op, 9, 0x3f, 0); |
| 127 |
|
return(1); |
| 128 |
+ |
case MAT_BSDF: /* BSDF material */ |
| 129 |
+ |
if (op->oargs.nsargs < 6) |
| 130 |
+ |
goto sargerr; |
| 131 |
+ |
getfunc(op, 5, 0x1d, 1); |
| 132 |
+ |
sd = loadBSDF(op->oargs.sarg[1]); |
| 133 |
+ |
if (sd != NULL) SDfreeCache(sd); |
| 134 |
+ |
return(1); |
| 135 |
+ |
case MAT_ABSDF: /* aBSDF material */ |
| 136 |
+ |
if (op->oargs.nsargs < 5) |
| 137 |
+ |
goto sargerr; |
| 138 |
+ |
getfunc(op, 4, 0xe, 1); |
| 139 |
+ |
sd = loadBSDF(op->oargs.sarg[0]); |
| 140 |
+ |
if (sd != NULL) SDfreeCache(sd); |
| 141 |
+ |
return(1); |
| 142 |
|
case MAT_PDATA: /* plastic BRDF data */ |
| 143 |
|
case MAT_MDATA: /* metal BRDF data */ |
| 144 |
|
case MAT_TDATA: /* trans BRDF data */ |
| 167 |
|
} |
| 168 |
|
|
| 169 |
|
|
| 170 |
< |
extern void |
| 170 |
> |
void |
| 171 |
|
preload_objs(void) /* preload object data structures */ |
| 172 |
|
{ |
| 173 |
< |
register OBJECT on; |
| 173 |
> |
OBJECT on; |
| 174 |
|
/* note that nobjects may change during loop */ |
| 175 |
|
for (on = 0; on < nobjects; on++) |
| 176 |
|
load_os(objptr(on)); |