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.17 by schorsch, Sun Jun 8 12:03:09 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>
11 < #include "fvect.h"
11 > #include <stdio.h>
12 >
13 > #include "platform.h"
14   #include "object.h"
15   #include "color.h"
16   #include "lookup.h"
17  
19 #define PI      3.14159265358979323846
20
18   #define C_1SIDEDTHICK   0.005
19  
20   int     o_face(), o_cone(), o_sphere(), o_ring(), o_cylinder();
# Line 25 | 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  
28 extern void     free();
29 extern char     *malloc();
30
25   LUTAB   rmats = LU_SINIT(free,NULL);            /* defined material table */
26  
27   LUTAB   rdispatch = LU_SINIT(NULL,NULL);        /* function dispatch table */
# Line 263 | Line 257 | char   *id;
257          if (end == NULL)
258                  end = cp;
259                                  /* copy to current object */
260 <        for (cp = id, cp2 = curobj; cp < end; *cp2++ = *cp++)
260 >        cp2 = curobj;
261 >        if (!isalpha(*id)) {    /* start with letter */
262 >                diff = *cp2 != 'O';
263 >                *cp2++ = 'O';
264 >        }
265 >        for (cp = id; cp < end; *cp2++ = *cp++) {
266 >                if (*cp < '!' | *cp > '~')      /* limit to visible chars */
267 >                        *cp = '?';
268                  diff += *cp != *cp2;
269 +        }
270          if (!diff && !*cp2)
271                  return;
272          *cp2 = '\0';
# Line 422 | Line 424 | o_face(mod, typ, id, fa)               /* print out a polygon */
424   char    *mod, *typ, *id;
425   FUNARGS *fa;
426   {
427 <        char    entbuf[512];
427 >        char    entbuf[2048], *linestart;
428          register char   *cp;
429          register int    i;
430  
# Line 430 | Line 432 | FUNARGS        *fa;
432                  return(-1);
433          setmat(mod);
434          setobj(id);
435 <        cp = entbuf;
435 >        cp = linestart = entbuf;
436          *cp++ = 'f';
437          for (i = 0; i < fa->nfargs; i += 3) {
438                  *cp++ = ' ';
439 +                if (cp - linestart > 72) {
440 +                        *cp++ = '\\'; *cp++ = '\n';
441 +                        linestart = cp;
442 +                        *cp++ = ' '; *cp++ = ' ';
443 +                }
444                  getvertid(cp, fa->farg + i);
445                  while (*cp)
446                          cp++;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines