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

Comparing ray/src/rt/raytrace.c (file contents):
Revision 2.36 by greg, Tue Mar 4 19:02:22 2003 UTC vs.
Revision 2.44 by greg, Wed Dec 31 01:50:02 2003 UTC

# Line 20 | Line 20 | static const char RCSid[] = "$Id$";
20   unsigned long  raynum = 0;              /* next unique ray number */
21   unsigned long  nrays = 0;               /* number of calls to localhit */
22  
23 < static FLOAT  Lambfa[5] = {PI, PI, PI, 0.0, 0.0};
23 > static RREAL  Lambfa[5] = {PI, PI, PI, 0.0, 0.0};
24   OBJREC  Lamb = {
25          OVOID, MAT_PLASTIC, "Lambertian",
26          {0, 5, NULL, Lambfa}, NULL,
# Line 31 | Line 31 | OBJREC  Aftplane;                      /* aft clipping plane object */
31   static int  raymove(), checkhit();
32   static void  checkset();
33  
34 #ifndef  MAXLOOP
35 #define  MAXLOOP        0               /* modifier loop detection */
36 #endif
37
34   #define  RAYHIT         (-1)            /* return value for intercepted ray */
35  
36  
# Line 101 | Line 97 | register RAY  *r;
97          r->rox = NULL;
98          r->rt = r->rot = FHUGE;
99          r->pert[0] = r->pert[1] = r->pert[2] = 0.0;
100 +        r->uv[0] = r->uv[1] = 0.0;
101          setcolor(r->pcol, 1.0, 1.0, 1.0);
102          setcolor(r->rcol, 0.0, 0.0, 0.0);
103   }
# Line 157 | Line 154 | int  mod;
154   {
155          int  gotmat;
156          register OBJREC  *m;
160 #if  MAXLOOP
161        static int  depth = 0;
162                                        /* check for infinite loop */
163        if (depth++ >= MAXLOOP)
164                objerror(r->ro, USER, "possible modifier loop");
165 #endif
157          r->rt = r->rot;                 /* set effective ray length */
158          for (gotmat = 0; !gotmat && mod != OVOID; mod = m->omod) {
159                  m = objptr(mod);
# Line 173 | Line 164 | int  mod;
164                  }
165                  ******/
166                                          /* hack for irradiance calculation */
167 <                if (do_irrad && !(r->crtype & ~(PRIMARY|TRANS))) {
167 >                if (do_irrad && !(r->crtype & ~(PRIMARY|TRANS)) &&
168 >                                m->otype != MAT_CLIP &&
169 >                                (ofun[m->otype].flags & (T_M|T_X))) {
170                          if (irr_ignore(m->otype)) {
178 #if  MAXLOOP
179                                depth--;
180 #endif
171                                  raytrans(r);
172                                  return(1);
173                          }
# Line 187 | Line 177 | int  mod;
177                                          /* materials call raytexture */
178                  gotmat = (*ofun[m->otype].funp)(m, r);
179          }
190 #if  MAXLOOP
191        depth--;
192 #endif
180          return(gotmat);
181   }
182  
# Line 226 | Line 213 | register RAY  *r;
213   }
214  
215  
216 + void
217   raytexture(r, mod)                      /* get material modifiers */
218   RAY  *r;
219 < int  mod;
219 > OBJECT  mod;
220   {
221          register OBJREC  *m;
234 #if  MAXLOOP
235        static int  depth = 0;
236                                        /* check for infinite loop */
237        if (depth++ >= MAXLOOP)
238                objerror(r->ro, USER, "modifier loop");
239 #endif
222                                          /* execute textures and patterns */
223          for ( ; mod != OVOID; mod = m->omod) {
224                  m = objptr(mod);
# Line 252 | Line 234 | int  mod;
234                          objerror(r->ro, USER, errmsg);
235                  }
236          }
255 #if  MAXLOOP
256        depth--;                        /* end here */
257 #endif
237   }
238  
239  
# Line 275 | Line 254 | double  coef;
254                                          /* compute foreground and background */
255          foremat = backmat = 0;
256                                          /* foreground */
257 <        copystruct(&fr, r);
257 >        fr = *r;
258          if (coef > FTINY)
259                  foremat = rayshade(&fr, fore);
260                                          /* background */
261 <        copystruct(&br, r);
261 >        br = *r;
262          if (coef < 1.0-FTINY)
263                  backmat = rayshade(&br, back);
264                                          /* check for transparency */
265 <        if (backmat ^ foremat)
265 >        if (backmat ^ foremat) {
266                  if (backmat && coef > FTINY)
267                          raytrans(&fr);
268                  else if (foremat && coef < 1.0-FTINY)
269                          raytrans(&br);
270 +        }
271                                          /* mix perturbations */
272          for (i = 0; i < 3; i++)
273                  r->pert[i] = coef*fr.pert[i] + (1.0-coef)*br.pert[i];
# Line 484 | Line 464 | register CUBE  *scene;
464          }
465          cxset[0] = 0;
466          raymove(curpos, cxset, sflags, r, scene);
467 <        return(r->ro != NULL & r->ro != &Aftplane);
467 >        return((r->ro != NULL) & (r->ro != &Aftplane));
468   }
469  
470  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines