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

Comparing ray/src/rt/m_alias.c (file contents):
Revision 2.3 by greg, Tue Sep 9 03:28:43 2003 UTC vs.
Revision 2.5 by schorsch, Tue Mar 30 16:13:01 2004 UTC

# Line 6 | Line 6 | static const char RCSid[] = "$Id$";
6   */
7  
8   #include "copyright.h"
9 +
10   #include "ray.h"
11   #include "otypes.h"
12 + #include "rtotypes.h"
13   #include "otspecial.h"
14  
15   /*
# Line 21 | Line 23 | static const char RCSid[] = "$Id$";
23   *  chain at all.
24   */
25  
26 < int
27 < m_alias(m, r)                   /* transfer shading to alias target */
28 < OBJREC  *m;
29 < RAY     *r;
26 > extern int
27 > m_alias(                        /* transfer shading to alias target */
28 >        OBJREC  *m,
29 >        RAY     *r
30 > )
31   {
32          OBJECT  aobj;
33 +        OBJREC  *aop;
34          OBJREC  arec;
35 +        int     rval;
36                                          /* straight replacement? */
37          if (!m->oargs.nsargs)
38                  return(rayshade(r, m->omod));
# Line 37 | Line 42 | RAY    *r;
42          aobj = lastmod(objndx(m), m->oargs.sarg[0]);
43          if (aobj < 0)
44                  objerror(m, USER, "bad reference");
45 <        arec = *objptr(aobj);
45 >        aop = objptr(aobj);
46 >        arec = *aop;
47                                          /* irradiance hack */
48          if (do_irrad && !(r->crtype & ~(PRIMARY|TRANS)) &&
49                          m->otype != MAT_CLIP &&
# Line 52 | Line 58 | RAY    *r;
58                                          /* substitute modifier */
59          arec.omod = m->omod;
60                                          /* replacement shader */
61 <        return((*ofun[arec.otype].funp)(&arec, r));
61 >        rval = (*ofun[arec.otype].funp)(&arec, r);
62 >                                        /* save allocated struct */
63 >        if (arec.os != aop->os) {
64 >                if (aop->os != NULL)    /* should never happen */
65 >                        free_os(aop);
66 >                aop->os = arec.os;
67 >        }
68 >        return(rval);
69   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines