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

Comparing ray/src/cv/rad2mgf.c (file contents):
Revision 2.12 by greg, Wed May 10 19:46:05 1995 UTC vs.
Revision 2.20 by greg, Wed Oct 22 02:06:34 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1995 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Convert Radiance scene description to MGF
6   */
7  
8 < #include <stdio.h>
9 < #include <math.h>
8 > #include "platform.h"
9 > #include "standard.h"
10   #include <ctype.h>
11   #include <string.h>
12 < #include "fvect.h"
12 > #include <stdio.h>
13 >
14   #include "object.h"
15   #include "color.h"
16   #include "lookup.h"
17  
20 #define PI      3.14159265358979323846
21
18   #define C_1SIDEDTHICK   0.005
19  
20   int     o_face(), o_cone(), o_sphere(), o_ring(), o_cylinder();
# Line 26 | Line 22 | int    o_instance(), o_illum();
22   int     o_plastic(), o_metal(), o_glass(), o_dielectric(),
23          o_mirror(), o_trans(), o_light();
24  
29 extern void     free();
30 extern char     *malloc();
31
25   LUTAB   rmats = LU_SINIT(free,NULL);            /* defined material table */
26  
27   LUTAB   rdispatch = LU_SINIT(NULL,NULL);        /* function dispatch table */
# Line 270 | Line 263 | char   *id;
263                  *cp2++ = 'O';
264          }
265          for (cp = id; cp < end; *cp2++ = *cp++) {
266 <                if (*cp < '!' | *cp > '~')      /* limit to visible chars */
266 >                if ((*cp < '!') | (*cp > '~'))  /* limit to visible chars */
267                          *cp = '?';
268                  diff += *cp != *cp2;
269          }
# Line 295 | Line 288 | init()                 /* initialize dispatch table and output */
288          add2dispatch("tube", o_cylinder);
289          add2dispatch("ring", o_ring);
290          add2dispatch("instance", o_instance);
291 +        add2dispatch("mesh", o_instance);
292          add2dispatch("plastic", o_plastic);
293          add2dispatch("plastic2", o_plastic);
294          add2dispatch("metal", o_metal);
# Line 431 | Line 425 | o_face(mod, typ, id, fa)               /* print out a polygon */
425   char    *mod, *typ, *id;
426   FUNARGS *fa;
427   {
428 <        char    entbuf[512];
428 >        char    entbuf[2048], *linestart;
429          register char   *cp;
430          register int    i;
431  
432 <        if (fa->nfargs < 9 | fa->nfargs % 3)
432 >        if ((fa->nfargs < 9) | (fa->nfargs % 3))
433                  return(-1);
434          setmat(mod);
435          setobj(id);
436 <        cp = entbuf;
436 >        cp = linestart = entbuf;
437          *cp++ = 'f';
438          for (i = 0; i < fa->nfargs; i += 3) {
439                  *cp++ = ' ';
440 +                if (cp - linestart > 72) {
441 +                        *cp++ = '\\'; *cp++ = '\n';
442 +                        linestart = cp;
443 +                        *cp++ = ' '; *cp++ = ' ';
444 +                }
445                  getvertid(cp, fa->farg + i);
446                  while (*cp)
447                          cp++;
# Line 535 | Line 534 | register FUNARGS       *fa;
534  
535  
536   int
537 < o_instance(mod, typ, id, fa)    /* convert an instance */
537 > o_instance(mod, typ, id, fa)    /* convert an instance (or mesh) */
538   char    *mod, *typ, *id;
539   FUNARGS *fa;
540   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines