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.11 by greg, Thu Apr 13 15:33:48 1995 UTC vs.
Revision 2.16 by greg, Sat Feb 22 02:07:23 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1994 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 "standard.h"
9 > #include <ctype.h>
10   #include <string.h>
14 #include "fvect.h"
11   #include "object.h"
12   #include "color.h"
13   #include "lookup.h"
14  
19 #define PI      3.14159265358979323846
20
15   #define C_1SIDEDTHICK   0.005
16  
17   int     o_face(), o_cone(), o_sphere(), o_ring(), o_cylinder();
# Line 25 | Line 19 | int    o_instance(), o_illum();
19   int     o_plastic(), o_metal(), o_glass(), o_dielectric(),
20          o_mirror(), o_trans(), o_light();
21  
28 extern void     free();
29 extern char     *malloc();
30
22   LUTAB   rmats = LU_SINIT(free,NULL);            /* defined material table */
23  
24   LUTAB   rdispatch = LU_SINIT(NULL,NULL);        /* function dispatch table */
# Line 263 | Line 254 | char   *id;
254          if (end == NULL)
255                  end = cp;
256                                  /* copy to current object */
257 <        for (cp = id, cp2 = curobj; cp < end; *cp2++ = *cp++)
257 >        cp2 = curobj;
258 >        if (!isalpha(*id)) {    /* start with letter */
259 >                diff = *cp2 != 'O';
260 >                *cp2++ = 'O';
261 >        }
262 >        for (cp = id; cp < end; *cp2++ = *cp++) {
263 >                if (*cp < '!' | *cp > '~')      /* limit to visible chars */
264 >                        *cp = '?';
265                  diff += *cp != *cp2;
266 +        }
267          if (!diff && !*cp2)
268                  return;
269          *cp2 = '\0';
# Line 422 | Line 421 | o_face(mod, typ, id, fa)               /* print out a polygon */
421   char    *mod, *typ, *id;
422   FUNARGS *fa;
423   {
424 <        char    entbuf[512];
424 >        char    entbuf[2048], *linestart;
425          register char   *cp;
426          register int    i;
427  
# Line 430 | Line 429 | FUNARGS        *fa;
429                  return(-1);
430          setmat(mod);
431          setobj(id);
432 <        cp = entbuf;
432 >        cp = linestart = entbuf;
433          *cp++ = 'f';
434          for (i = 0; i < fa->nfargs; i += 3) {
435                  *cp++ = ' ';
436 +                if (cp - linestart > 72) {
437 +                        *cp++ = '\\'; *cp++ = '\n';
438 +                        linestart = cp;
439 +                        *cp++ = ' '; *cp++ = ' ';
440 +                }
441                  getvertid(cp, fa->farg + i);
442                  while (*cp)
443                          cp++;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines