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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines