--- ray/src/rt/preload.c 2011/02/18 00:40:25 2.10 +++ ray/src/rt/preload.c 2017/07/14 23:19:32 2.14 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: preload.c,v 2.10 2011/02/18 00:40:25 greg Exp $"; +static const char RCSid[] = "$Id: preload.c,v 2.14 2017/07/14 23:19:32 greg Exp $"; #endif /* * Preload associated object structures to maximize memory sharing. @@ -18,20 +18,21 @@ static const char RCSid[] = "$Id: preload.c,v 2.10 201 #include "data.h" #include "func.h" #include "bsdf.h" -#include "paths.h" /* KEEP THIS ROUTINE CONSISTENT WITH THE DIFFERENT OBJECT FUNCTIONS! */ -extern int +int load_os( /* load associated data for object */ - register OBJREC *op + OBJREC *op ) { - DATARRAY *dp; - SDData *sd; + DATARRAY *dp; + SDData *sd; + SDretainSet = SDretainAll; + switch (op->otype) { case OBJ_FACE: /* polygon */ getface(op); @@ -106,10 +107,8 @@ load_os( /* load associated data for object */ if (op->oargs.nsargs < 6) goto sargerr; getfunc(op, 5, 0x1d, 1); - sd = SDgetCache(op->oargs.sarg[1]); - if (sd != NULL && !SDisLoaded(sd)) - SDloadFile(sd, getpath(op->oargs.sarg[1], - getrlibpath(), R_OK)); + sd = loadBSDF(op->oargs.sarg[1]); + if (sd != NULL) SDfreeCache(sd); return(1); case MAT_PDATA: /* plastic BRDF data */ case MAT_MDATA: /* metal BRDF data */ @@ -139,10 +138,10 @@ sargerr: } -extern void +void preload_objs(void) /* preload object data structures */ { - register OBJECT on; + OBJECT on; /* note that nobjects may change during loop */ for (on = 0; on < nobjects; on++) load_os(objptr(on));