ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/preload.c
(Generate patch)

Comparing ray/src/rt/preload.c (file contents):
Revision 2.5 by greg, Wed Jul 3 17:31:02 1996 UTC vs.
Revision 2.12 by greg, Tue Aug 16 18:09:53 2011 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1996 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Preload associated object structures to maximize memory sharing.
6 + *
7 + *  External symbols declared in ray.h
8   */
9  
10 < #include "standard.h"
11 < #include "object.h"
10 > #include "copyright.h"
11 >
12 > #include "ray.h"
13   #include "otypes.h"
14   #include "face.h"
15   #include "cone.h"
16   #include "instance.h"
17 < #include "color.h"
17 > #include "mesh.h"
18   #include "data.h"
19 + #include "func.h"
20 + #include "bsdf.h"
21  
22  
23 < int
24 < load_os(op)                     /* load associated data for object */
25 < register OBJREC *op;
23 > /* KEEP THIS ROUTINE CONSISTENT WITH THE DIFFERENT OBJECT FUNCTIONS! */
24 >
25 >
26 > extern int
27 > load_os(                        /* load associated data for object */
28 >        register OBJREC *op
29 > )
30   {
31 +        DATARRAY  *dp;
32 +
33          switch (op->otype) {
34          case OBJ_FACE:          /* polygon */
35                  getface(op);
# Line 36 | Line 44 | register OBJREC        *op;
44          case OBJ_INSTANCE:      /* octree instance */
45                  getinstance(op, IO_ALL);
46                  return(1);
47 +        case OBJ_MESH:          /* mesh instance */
48 +                getmeshinst(op, IO_ALL);
49 +                return(1);
50          case PAT_CPICT:         /* color picture */
51                  if (op->oargs.nsargs < 4)
52                          goto sargerr;
53                  getpict(op->oargs.sarg[3]);
54 +                getfunc(op, 4, 0x3<<5, 0);
55                  return(1);
56          case PAT_CDATA:         /* color data */
57 <                /* FALL THROUGH */
57 >                dp = getdata(op->oargs.sarg[3]);
58 >                getdata(op->oargs.sarg[4]);
59 >                getdata(op->oargs.sarg[5]);
60 >                getfunc(op, 6, ((1<<dp->nd)-1)<<7, 0);
61 >                return(1);
62 >        case PAT_BDATA:         /* brightness data */
63 >                if (op->oargs.nsargs < 2)
64 >                        goto sargerr;
65 >                dp = getdata(op->oargs.sarg[1]);
66 >                getfunc(op, 2, ((1<<dp->nd)-1)<<3, 0);
67 >                return(1);
68 >        case PAT_BFUNC:         /* brightness function */
69 >                getfunc(op, 1, 0x1, 0);
70 >                return(1);
71 >        case PAT_CFUNC:         /* color function */
72 >                getfunc(op, 3, 0x7, 0);
73 >                return(1);
74          case TEX_DATA:          /* texture data */
75                  if (op->oargs.nsargs < 6)
76                          goto sargerr;
77 <                getdata(op->oargs.sarg[3]);
77 >                dp = getdata(op->oargs.sarg[3]);
78                  getdata(op->oargs.sarg[4]);
79                  getdata(op->oargs.sarg[5]);
80 +                getfunc(op, 6, ((1<<dp->nd)-1)<<7, 1);
81                  return(1);
82 <        case PAT_BDATA:         /* brightness data */
83 <                /* FALL THROUGH */
82 >        case TEX_FUNC:          /* texture function */
83 >                getfunc(op, 3, 0x7, 1);
84 >                return(1);
85 >        case MIX_DATA:          /* mixture data */
86 >                dp = getdata(op->oargs.sarg[3]);
87 >                getfunc(op, 4, ((1<<dp->nd)-1)<<5, 0);
88 >                return(1);
89 >        case MIX_PICT:          /* mixture picture */
90 >                getpict(op->oargs.sarg[3]);
91 >                getfunc(op, 4, 0x3<<5, 0);
92 >                return(1);
93 >        case MIX_FUNC:          /* mixture function */
94 >                getfunc(op, 3, 0x4, 0);
95 >                return(1);
96 >        case MAT_PLASTIC2:      /* anisotropic plastic */
97 >        case MAT_METAL2:        /* anisotropic metal */
98 >                getfunc(op, 3, 0x7, 1);
99 >                return(1);
100 >        case MAT_BRTDF:         /* BRDTfunc material */
101 >                getfunc(op, 9, 0x3f, 0);
102 >                return(1);
103 >        case MAT_BSDF:          /* BSDF material */
104 >                if (op->oargs.nsargs < 6)
105 >                        goto sargerr;
106 >                getfunc(op, 5, 0x1d, 1);
107 >                loadBSDF(op->oargs.sarg[1]);
108 >                return(1);
109          case MAT_PDATA:         /* plastic BRDF data */
110          case MAT_MDATA:         /* metal BRDF data */
111          case MAT_TDATA:         /* trans BRDF data */
112                  if (op->oargs.nsargs < 2)
113                          goto sargerr;
114                  getdata(op->oargs.sarg[1]);
115 +                getfunc(op, 2, 0, 0);
116                  return(1);
117 +        case MAT_PFUNC:         /* plastic BRDF func */
118 +        case MAT_MFUNC:         /* metal BRDF func */
119 +        case MAT_TFUNC:         /* trans BRDF func */
120 +                getfunc(op, 1, 0, 0);
121 +                return(1);
122 +        case MAT_DIRECT1:       /* prism1 material */
123 +                getfunc(op, 4, 0xf, 1);
124 +                return(1);
125 +        case MAT_DIRECT2:       /* prism2 material */
126 +                getfunc(op, 8, 0xff, 1);
127 +                return(1);
128          }
129 <                        /* don't bother with others -- too tricky */
129 >                        /* nothing to load for the remaining types */
130          return(0);
131   sargerr:
132          objerror(op, USER, "too few string arguments");
133 +        return 0; /* pro forma return */
134   }
135  
136  
137 < preload_objs()          /* preload object data structures */
137 > extern void
138 > preload_objs(void)              /* preload object data structures */
139   {
140          register OBJECT on;
141                                  /* note that nobjects may change during loop */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines