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.11 by greg, Fri Feb 18 02:41:55 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 +        SDData  *sd;
33 +
34          switch (op->otype) {
35          case OBJ_FACE:          /* polygon */
36                  getface(op);
# Line 36 | Line 45 | register OBJREC        *op;
45          case OBJ_INSTANCE:      /* octree instance */
46                  getinstance(op, IO_ALL);
47                  return(1);
48 +        case OBJ_MESH:          /* mesh instance */
49 +                getmeshinst(op, IO_ALL);
50 +                return(1);
51          case PAT_CPICT:         /* color picture */
52                  if (op->oargs.nsargs < 4)
53                          goto sargerr;
54                  getpict(op->oargs.sarg[3]);
55 +                getfunc(op, 4, 0x3<<5, 0);
56                  return(1);
57          case PAT_CDATA:         /* color data */
58 <                /* FALL THROUGH */
58 >                dp = getdata(op->oargs.sarg[3]);
59 >                getdata(op->oargs.sarg[4]);
60 >                getdata(op->oargs.sarg[5]);
61 >                getfunc(op, 6, ((1<<dp->nd)-1)<<7, 0);
62 >                return(1);
63 >        case PAT_BDATA:         /* brightness data */
64 >                if (op->oargs.nsargs < 2)
65 >                        goto sargerr;
66 >                dp = getdata(op->oargs.sarg[1]);
67 >                getfunc(op, 2, ((1<<dp->nd)-1)<<3, 0);
68 >                return(1);
69 >        case PAT_BFUNC:         /* brightness function */
70 >                getfunc(op, 1, 0x1, 0);
71 >                return(1);
72 >        case PAT_CFUNC:         /* color function */
73 >                getfunc(op, 3, 0x7, 0);
74 >                return(1);
75          case TEX_DATA:          /* texture data */
76                  if (op->oargs.nsargs < 6)
77                          goto sargerr;
78 <                getdata(op->oargs.sarg[3]);
78 >                dp = getdata(op->oargs.sarg[3]);
79                  getdata(op->oargs.sarg[4]);
80                  getdata(op->oargs.sarg[5]);
81 +                getfunc(op, 6, ((1<<dp->nd)-1)<<7, 1);
82                  return(1);
83 <        case PAT_BDATA:         /* brightness data */
84 <                /* FALL THROUGH */
83 >        case TEX_FUNC:          /* texture function */
84 >                getfunc(op, 3, 0x7, 1);
85 >                return(1);
86 >        case MIX_DATA:          /* mixture data */
87 >                dp = getdata(op->oargs.sarg[3]);
88 >                getfunc(op, 4, ((1<<dp->nd)-1)<<5, 0);
89 >                return(1);
90 >        case MIX_PICT:          /* mixture picture */
91 >                getpict(op->oargs.sarg[3]);
92 >                getfunc(op, 4, 0x3<<5, 0);
93 >                return(1);
94 >        case MIX_FUNC:          /* mixture function */
95 >                getfunc(op, 3, 0x4, 0);
96 >                return(1);
97 >        case MAT_PLASTIC2:      /* anisotropic plastic */
98 >        case MAT_METAL2:        /* anisotropic metal */
99 >                getfunc(op, 3, 0x7, 1);
100 >                return(1);
101 >        case MAT_BRTDF:         /* BRDTfunc material */
102 >                getfunc(op, 9, 0x3f, 0);
103 >                return(1);
104 >        case MAT_BSDF:          /* BSDF material */
105 >                if (op->oargs.nsargs < 6)
106 >                        goto sargerr;
107 >                getfunc(op, 5, 0x1d, 1);
108 >                loadBSDF(op->oargs.sarg[1]);
109 >                return(1);
110          case MAT_PDATA:         /* plastic BRDF data */
111          case MAT_MDATA:         /* metal BRDF data */
112          case MAT_TDATA:         /* trans BRDF data */
113                  if (op->oargs.nsargs < 2)
114                          goto sargerr;
115                  getdata(op->oargs.sarg[1]);
116 +                getfunc(op, 2, 0, 0);
117                  return(1);
118 +        case MAT_PFUNC:         /* plastic BRDF func */
119 +        case MAT_MFUNC:         /* metal BRDF func */
120 +        case MAT_TFUNC:         /* trans BRDF func */
121 +                getfunc(op, 1, 0, 0);
122 +                return(1);
123 +        case MAT_DIRECT1:       /* prism1 material */
124 +                getfunc(op, 4, 0xf, 1);
125 +                return(1);
126 +        case MAT_DIRECT2:       /* prism2 material */
127 +                getfunc(op, 8, 0xff, 1);
128 +                return(1);
129          }
130 <                        /* don't bother with others -- too tricky */
130 >                        /* nothing to load for the remaining types */
131          return(0);
132   sargerr:
133          objerror(op, USER, "too few string arguments");
134 +        return 0; /* pro forma return */
135   }
136  
137  
138 < preload_objs()          /* preload object data structures */
138 > extern void
139 > preload_objs(void)              /* preload object data structures */
140   {
141          register OBJECT on;
142                                  /* note that nobjects may change during loop */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines