ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/m_alias.c
Revision: 2.3
Committed: Tue Sep 9 03:28:43 2003 UTC (20 years, 7 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.2: +2 -1 lines
Log Message:
Bug fix for -i option using antimatter.

File Contents

# User Rev Content
1 greg 2.1 #ifndef lint
2 greg 2.3 static const char RCSid[] = "$Id: m_alias.c,v 2.2 2003/07/21 22:30:19 schorsch Exp $";
3 greg 2.1 #endif
4     /*
5     * Handler for modifier alias
6     */
7    
8     #include "copyright.h"
9     #include "ray.h"
10     #include "otypes.h"
11     #include "otspecial.h"
12    
13     /*
14     * If the alias has a single string argument, it's the
15     * name of the target modifier, and we must substitute the
16     * target and its arguments in place of this alias. The
17     * only difference is that we use our modifier rather than
18     * theirs.
19     * If the alias has no string arguments, then we simply
20     * pass through to our modifier as if we weren't in the
21     * chain at all.
22     */
23    
24     int
25     m_alias(m, r) /* transfer shading to alias target */
26     OBJREC *m;
27     RAY *r;
28     {
29     OBJECT aobj;
30     OBJREC arec;
31     /* straight replacement? */
32     if (!m->oargs.nsargs)
33     return(rayshade(r, m->omod));
34     /* else replace alias */
35     if (m->oargs.nsargs != 1)
36     objerror(m, INTERNAL, "bad # string arguments");
37     aobj = lastmod(objndx(m), m->oargs.sarg[0]);
38     if (aobj < 0)
39     objerror(m, USER, "bad reference");
40 schorsch 2.2 arec = *objptr(aobj);
41 greg 2.1 /* irradiance hack */
42     if (do_irrad && !(r->crtype & ~(PRIMARY|TRANS)) &&
43 greg 2.3 m->otype != MAT_CLIP &&
44 greg 2.1 (ofun[arec.otype].flags & (T_M|T_X))) {
45     if (irr_ignore(arec.otype)) {
46     raytrans(r);
47     return(1);
48     }
49     if (!islight(arec.otype))
50     return((*ofun[Lamb.otype].funp)(&Lamb, r));
51     }
52     /* substitute modifier */
53     arec.omod = m->omod;
54     /* replacement shader */
55     return((*ofun[arec.otype].funp)(&arec, r));
56     }