Back to index

radiance  4R0+20100331
Functions | Variables
m_alias.c File Reference
#include "copyright.h"
#include "ray.h"
#include "otypes.h"
#include "rtotypes.h"
#include "otspecial.h"

Go to the source code of this file.

Functions

int m_alias (OBJREC *m, RAY *r)

Variables

static const char RCSid [] = "$Id: m_alias.c,v 2.6 2006/07/12 05:47:05 greg Exp $"

Function Documentation

int m_alias ( OBJREC m,
RAY r 
)

Definition at line 27 of file m_alias.c.

{
       OBJECT aobj;
       OBJREC *aop;
       OBJREC arec;
       int    rval;
                                   /* straight replacement? */
       if (!m->oargs.nsargs)
              return(rayshade(r, m->omod));
                                   /* else replace alias */
       if (m->oargs.nsargs != 1)
              objerror(m, INTERNAL, "bad # string arguments");
       aop = m;
       aobj = objndx(aop);
       do {                        /* follow alias trail */
              if (aop->oargs.nsargs == 1)
                     aobj = lastmod(aobj, aop->oargs.sarg[0]);
              else
                     aobj = aop->omod;
              if (aobj < 0)
                     objerror(aop, USER, "bad reference");
              aop = objptr(aobj);
       } while (aop->otype == MOD_ALIAS);
                                   /* copy struct */
       arec = *aop;
                                   /* irradiance hack */
       if (do_irrad && !(r->crtype & ~(PRIMARY|TRANS)) &&
                     m->otype != MAT_CLIP &&
                     (ofun[arec.otype].flags & (T_M|T_X))) {
              if (irr_ignore(arec.otype)) {
                     raytrans(r);
                     return(1);
              }
              if (!islight(arec.otype))
                     return((*ofun[Lamb.otype].funp)(&Lamb, r));
       }
                                   /* substitute modifier */
       arec.omod = m->omod;
                                   /* replacement shader */
       rval = (*ofun[arec.otype].funp)(&arec, r);
                                   /* save allocated struct */
       if (arec.os != aop->os) {
              if (aop->os != NULL) /* should never happen */
                     free_os(aop);
              aop->os = arec.os;
       }
       return(rval);
}

Here is the call graph for this function:


Variable Documentation

const char RCSid[] = "$Id: m_alias.c,v 2.6 2006/07/12 05:47:05 greg Exp $" [static]

Definition at line 2 of file m_alias.c.