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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines