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

Comparing ray/src/rt/m_clip.c (file contents):
Revision 1.1 by greg, Thu Feb 2 10:41:26 1989 UTC vs.
Revision 2.8 by schorsch, Tue Mar 30 16:13:01 2004 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1986 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   *  m_clip.c - routine for clipped (cut) objects.
9 *
10 *     3/17/86
6   */
7  
8 + #include "copyright.h"
9 +
10   #include  "ray.h"
11 + #include  "rtotypes.h"
12  
13   /*
14   *  Clipping objects permit holes and sections to be taken out
# Line 21 | Line 19 | static char SCCSid[] = "$SunId$ LBL";
19   */
20  
21  
22 < m_clip(m, r)                    /* clip objects from ray */
23 < register OBJREC  *m;
24 < register RAY  *r;
22 > extern int
23 > m_clip(                 /* clip objects from ray */
24 >        register OBJREC  *m,
25 >        register RAY  *r
26 > )
27   {
28          OBJECT  cset[MAXSET+1], *modset;
29 +        OBJECT  obj, mod;
30          int  entering;
31          register int  i;
32  
33 +        obj = objndx(m);
34          if ((modset = (OBJECT *)m->os) == NULL) {
33                register OBJECT  mod;
34
35                  if (m->oargs.nsargs < 1 || m->oargs.nsargs > MAXSET)
36                          objerror(m, USER, "bad # arguments");
37                  modset = (OBJECT *)malloc((m->oargs.nsargs+1)*sizeof(OBJECT));
# Line 41 | Line 41 | register RAY  *r;
41                  for (i = 0; i < m->oargs.nsargs; i++) {
42                          if (!strcmp(m->oargs.sarg[i], VOIDID))
43                                  continue;
44 <                        if ((mod = modifier(m->oargs.sarg[i])) == OVOID) {
44 >                        if ((mod = lastmod(obj, m->oargs.sarg[i])) == OVOID) {
45                                  sprintf(errmsg, "unknown modifier \"%s\"",
46                                                  m->oargs.sarg[i]);
47                                  objerror(m, WARNING, errmsg);
# Line 53 | Line 53 | register RAY  *r;
53                          }
54                          insertelem(modset, mod);
55                  }
56 <                (OBJECT *)m->os = modset;
56 >                m->os = (char *)modset;
57          }
58          if (r->clipset != NULL)
59                  setcopy(cset, r->clipset);
# Line 82 | Line 82 | register RAY  *r;
82                                          /* check for penetration */
83                  for (rp = r; rp->parent != NULL; rp = rp->parent)
84                          if (!(rp->rtype & RAYREFL) && rp->parent->ro != NULL
85 <                                        && inset(modset, rp->parent->ro->omod))
85 >                                        && inset(modset, rp->parent->ro->omod)) {
86                                  if (rp->parent->rod > 0.0)
87                                          inside++;
88                                  else
89                                          inside--;
90 +                        }
91                  if (inside > 0) {       /* we just hit the object */
92                          flipsurface(r);
93 <                        rayshade(r, modifier(m->oargs.sarg[0]));
93 <                        return;
93 >                        return(rayshade(r, lastmod(obj, m->oargs.sarg[0])));
94                  }
95          }
96          raytrans(r);                    /* else transfer ray */
97 +        return(1);
98   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines