ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/preload.c
Revision: 2.5
Committed: Wed Jul 3 17:31:02 1996 UTC (27 years, 10 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.4: +29 -2 lines
Log Message:
added preloading of data files to preload.c

File Contents

# Content
1 /* Copyright (c) 1996 Regents of the University of California */
2
3 #ifndef lint
4 static char SCCSid[] = "$SunId$ LBL";
5 #endif
6
7 /*
8 * Preload associated object structures to maximize memory sharing.
9 */
10
11 #include "standard.h"
12 #include "object.h"
13 #include "otypes.h"
14 #include "face.h"
15 #include "cone.h"
16 #include "instance.h"
17 #include "color.h"
18 #include "data.h"
19
20
21 int
22 load_os(op) /* load associated data for object */
23 register OBJREC *op;
24 {
25 switch (op->otype) {
26 case OBJ_FACE: /* polygon */
27 getface(op);
28 return(1);
29 case OBJ_CONE: /* cone */
30 case OBJ_RING: /* disk */
31 case OBJ_CYLINDER: /* cylinder */
32 case OBJ_CUP: /* inverted cone */
33 case OBJ_TUBE: /* inverted cylinder */
34 getcone(op, 1);
35 return(1);
36 case OBJ_INSTANCE: /* octree instance */
37 getinstance(op, IO_ALL);
38 return(1);
39 case PAT_CPICT: /* color picture */
40 if (op->oargs.nsargs < 4)
41 goto sargerr;
42 getpict(op->oargs.sarg[3]);
43 return(1);
44 case PAT_CDATA: /* color data */
45 /* FALL THROUGH */
46 case TEX_DATA: /* texture data */
47 if (op->oargs.nsargs < 6)
48 goto sargerr;
49 getdata(op->oargs.sarg[3]);
50 getdata(op->oargs.sarg[4]);
51 getdata(op->oargs.sarg[5]);
52 return(1);
53 case PAT_BDATA: /* brightness data */
54 /* FALL THROUGH */
55 case MAT_PDATA: /* plastic BRDF data */
56 case MAT_MDATA: /* metal BRDF data */
57 case MAT_TDATA: /* trans BRDF data */
58 if (op->oargs.nsargs < 2)
59 goto sargerr;
60 getdata(op->oargs.sarg[1]);
61 return(1);
62 }
63 /* don't bother with others -- too tricky */
64 return(0);
65 sargerr:
66 objerror(op, USER, "too few string arguments");
67 }
68
69
70 preload_objs() /* preload object data structures */
71 {
72 register OBJECT on;
73 /* note that nobjects may change during loop */
74 for (on = 0; on < nobjects; on++)
75 load_os(objptr(on));
76 }