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

Comparing ray/src/rt/func.c (file contents):
Revision 2.2 by greg, Mon Nov 25 09:51:00 1991 UTC vs.
Revision 2.6 by greg, Tue Mar 3 13:58:12 1992 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1991 Regents of the University of California */
1 > /* Copyright (c) 1992 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 59 | Line 59 | int  dofwd;
59                  scompile("Dx=$1;Dy=$2;Dz=$3;", NULL, 0);
60                  scompile("Nx=$4;Ny=$5;Nz=$6;", NULL, 0);
61                  scompile("Px=$7;Py=$8;Pz=$9;", NULL, 0);
62 <                scompile("T=$10;Rdot=$11;", NULL, 0);
62 >                scompile("T=$10;Ts=$25;Rdot=$11;", NULL, 0);
63                  scompile("S=$12;Tx=$13;Ty=$14;Tz=$15;", NULL, 0);
64                  scompile("Ix=$16;Iy=$17;Iz=$18;", NULL, 0);
65                  scompile("Jx=$19;Jy=$20;Jz=$21;", NULL, 0);
# Line 80 | Line 80 | int  dofwd;
80          if (i == 1 && arg[ff][0] == '.')
81                  setcontext(f->ctx = "");        /* "." means no file */
82          else {
83 <                strcpy(sbuf,m->oargs.sarg[ff]); /* file name is context */
83 >                strcpy(sbuf,arg[ff]);   /* file name is context */
84                  if (i > LCALSUF && !strcmp(sbuf+i-LCALSUF, CALSUF))
85                          sbuf[i-LCALSUF] = '\0'; /* remove suffix */
86                  setcontext(f->ctx = savestr(sbuf));
87                  if (!vardefined(REFVNAME)) {    /* file loaded? */
88 <                        loadfunc(m->oargs.sarg[ff]);
88 >                        loadfunc(arg[ff]);
89                          varset(REFVNAME, '=', 1.0);
90                  } else                          /* reference_count++ */
91                          varset(REFVNAME, '=', varvalue(REFVNAME)+1.0);
# Line 111 | Line 111 | int  dofwd;
111                  f->f = f->b = &unitxf;
112          else {                          /* get transform */
113                  if ((f->b = (XF *)malloc(sizeof(XF))) == NULL)
114 <                        goto memerr;;
114 >                        goto memerr;
115                  if (invxf(f->b, na-i, arg+i) != na-i)
116                          objerror(m, USER, "bad transform");
117                  if (f->b->sca < 0.0)
118                          f->b->sca = -f->b->sca;
119                  if (dofwd) {                    /* do both transforms */
120                          if ((f->f = (XF *)malloc(sizeof(XF))) == NULL)
121 <                                goto memerr;;
121 >                                goto memerr;
122                          xf(f->f, na-i, arg+i);
123                          if (f->f->sca < 0.0)
124                                  f->f->sca = -f->f->sca;
# Line 127 | Line 127 | int  dofwd;
127          m->os = (char *)f;
128          return(f);
129   toofew:
130 <        objerror(m, USER, "too few arguments");
130 >        objerror(m, USER, "too few string arguments");
131   memerr:
132          error(SYSTEM, "out of memory in getfunc");
133   }
# Line 273 | Line 273 | register int  n;
273                                  fray->rop[2]*funcxf.xfm[2][n-6] +
274                                               funcxf.xfm[3][n-6] );
275  
276 <        if (n == 9) {                   /* distance */
277 <
276 >        if (n == 9) {                   /* total distance */
277                  sum = fray->rot;
278                  for (r = fray->parent; r != NULL; r = r->parent)
279                          sum += r->rot;
280                  return(sum * funcxf.sca);
281  
282          }
283 +
284          if (n == 10)                    /* dot product (range [-1,1]) */
285                  return( fray->rod <= -1.0 ? -1.0 :
286                          fray->rod >= 1.0 ? 1.0 :
# Line 300 | Line 300 | register int  n;
300  
301          if (n < 24)                     /* k unit vector */
302                  return(funcxf.xfm[2][n-21] / funcxf.sca);
303 +
304 +        if (n == 24) {                  /* single ray (shadow) distance */
305 +                sum = fray->rot;
306 +                for (r = fray->parent; r != NULL && r->crtype&SHADOW;
307 +                                r = r->parent)
308 +                        sum += r->rot;
309 +                return(sum * funcxf.sca);
310 +        }
311   badchan:
312          error(USER, "illegal channel number");
313   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines