--- ray/src/rt/preload.c 2004/03/30 16:13:01 2.8 +++ ray/src/rt/preload.c 2018/06/26 14:42:18 2.16 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: preload.c,v 2.8 2004/03/30 16:13:01 schorsch Exp $"; +static const char RCSid[] = "$Id: preload.c,v 2.16 2018/06/26 14:42:18 greg Exp $"; #endif /* * Preload associated object structures to maximize memory sharing. @@ -9,29 +9,30 @@ static const char RCSid[] = "$Id: preload.c,v 2.8 2004 #include "copyright.h" -#include "standard.h" -#include "octree.h" -#include "object.h" +#include "ray.h" #include "otypes.h" #include "face.h" #include "cone.h" #include "instance.h" -#include "color.h" +#include "mesh.h" #include "data.h" #include "func.h" -#include "ray.h" +#include "bsdf.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; + DATARRAY *dp; + SDData *sd; + SDretainSet = SDretainAll; + switch (op->otype) { case OBJ_FACE: /* polygon */ getface(op); @@ -46,6 +47,9 @@ load_os( /* load associated data for object */ case OBJ_INSTANCE: /* octree instance */ getinstance(op, IO_ALL); return(1); + case OBJ_MESH: /* mesh instance */ + getmeshinst(op, IO_ALL); + return(1); case PAT_CPICT: /* color picture */ if (op->oargs.nsargs < 4) goto sargerr; @@ -99,6 +103,20 @@ load_os( /* load associated data for object */ case MAT_BRTDF: /* BRDTfunc material */ getfunc(op, 9, 0x3f, 0); return(1); + case MAT_BSDF: /* BSDF material */ + if (op->oargs.nsargs < 6) + goto sargerr; + getfunc(op, 5, 0x1d, 1); + sd = loadBSDF(op->oargs.sarg[1]); + if (sd != NULL) SDfreeCache(sd); + return(1); + case MAT_ABSDF: /* aBSDF material */ + if (op->oargs.nsargs < 5) + goto sargerr; + getfunc(op, 4, 0xe, 1); + sd = loadBSDF(op->oargs.sarg[0]); + if (sd != NULL) SDfreeCache(sd); + return(1); case MAT_PDATA: /* plastic BRDF data */ case MAT_MDATA: /* metal BRDF data */ case MAT_TDATA: /* trans BRDF data */ @@ -127,10 +145,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));