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

Comparing ray/src/gen/xform.c (file contents):
Revision 1.4 by greg, Wed Jun 7 08:40:59 1989 UTC vs.
Revision 1.7 by greg, Wed Oct 4 16:28:14 1989 UTC

# Line 40 | Line 40 | extern int  o_face();
40   extern int  o_cone();
41   extern int  o_cylinder();
42   extern int  o_ring();
43 + extern int  m_glow();
44 + extern int  m_spot();
45   extern int  m_dielectric();
46   extern int  m_interface();
47   extern int  text();
# Line 60 | Line 62 | FUN  ofun[] = {
62          { "instance", addxform },
63          { "alias", alias },
64          { "antimatter", passargs },
65 +        { "glow", m_glow },
66 +        { "spotlight", m_spot },
67          { "dielectric", m_dielectric },
68          { "interface", m_interface },
69          { "colortext", text },
# Line 76 | Line 80 | FUN  ofun[] = {
80          { "mixtext", text },
81          { "light", passargs },
82          { "illum", passargs },
79        { "glow", passargs },
83          { "plastic", passargs },
84          { "metal", passargs },
85          { "trans", passargs },
# Line 178 | Line 181 | register FILE  *fin;
181                          } while (c != '\n');
182                  } else if (c == '!') {                  /* command */
183                          ungetc(c, fin);
184 <                        if (expand)
182 <                                xfcomm(name, fin);
183 <                        else {
184 <                                putchar('\n');
185 <                                while ((c = getc(fin)) != EOF && c != '\n')
186 <                                        putchar(c);
187 <                                printf(" |");
188 <                                for (c = 0; c < xac; c++)
189 <                                        printf(" %s", xav[c]);
190 <                                putchar('\n');
191 <                        }
184 >                        xfcomm(name, fin);
185                  } else {                                /* object */
186                          ungetc(c, fin);
187                          xfobject(name, fin);
# Line 197 | Line 190 | register FILE  *fin;
190   }
191  
192  
193 < xfcomm(fname, fin)                              /* expand a command */
193 > xfcomm(fname, fin)                      /* transform a command */
194   FILE  *fin;
195   {
196          FILE  *popen();
197 <        char  *fgets();
197 >        char  *fgetline();
198          FILE  *pin;
199          char  buf[512];
200 +        int  i;
201  
202 <        fgets(buf, sizeof(buf), fin);
203 <        if (buf[strlen(buf)-1] == '\n')
204 <                buf[strlen(buf)-1] = '\0';
205 <        if ((pin = popen(buf+1, "r")) == NULL) {
206 <                fprintf(stderr, "%s: (%s): cannot execute \"%s\"\n",
207 <                                progname, fname, buf);
208 <                exit(1);
202 >        fgetline(buf, sizeof(buf), fin);
203 >        if (expand) {
204 >                if ((pin = popen(buf+1, "r")) == NULL) {
205 >                        fprintf(stderr, "%s: (%s): cannot execute \"%s\"\n",
206 >                                        progname, fname, buf);
207 >                        exit(1);
208 >                }
209 >                xform(buf, pin);
210 >                pclose(pin);
211 >        } else {
212 >                printf("\n%s | %s -e", buf, xav[0]);
213 >                for (i = 1; i < xac; i++)
214 >                        printf(" %s", xav[i]);
215 >                putchar('\n');
216          }
216        xform(buf, pin);
217        pclose(pin);
217   }
218  
219  
# Line 328 | Line 327 | FILE  *fin;
327          if (fscanf(fin, "%s", alias) != 1)
328                  return(-1);
329          printf("\t%s\n", alias);
330 +        return(0);
331 + }
332 +
333 +
334 + m_glow(fin)                     /* transform arguments for proximity light */
335 + FILE  *fin;
336 + {
337 +        register FUNARGS  *fa;
338 +
339 +        if ((fa = getfargs(fin)) == NULL)
340 +                return(-1);
341 +        if (fa->nsargs != 0 || fa->niargs != 0 || fa->nfargs != 4)
342 +                return(-1);
343 +        printf("0\n0\n4");
344 +        printf(" %18.12g %18.12g %18.12g",
345 +                        fa->farg[0], fa->farg[1], fa->farg[2]);
346 +        printf(" %18.12g\n", fa->farg[3] * totscale);
347 +        freefargs(fa);
348 +        return(0);
349 + }
350 +
351 +
352 + m_spot(fin)                     /* transform arguments for spotlight */
353 + FILE  *fin;
354 + {
355 +        double  v[3];
356 +        register FUNARGS  *fa;
357 +
358 +        if ((fa = getfargs(fin)) == NULL)
359 +                return(-1);
360 +        if (fa->nsargs != 0 || fa->niargs != 0 || fa->nfargs != 7)
361 +                return(-1);
362 +        printf("0\n0\n7");
363 +        printf(" %18.12g %18.12g %18.12g %18.12g\n",
364 +                        fa->farg[0], fa->farg[1], fa->farg[2], fa->farg[3]);
365 +        multv3(v, fa->farg+4, totxform);
366 +        printf("\t%18.12g %18.12g %18.12g\n", v[0], v[1], v[2]);
367 +        freefargs(fa);
368          return(0);
369   }
370  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines