--- ray/src/cv/rad2mgf.c 1995/05/10 19:46:05 2.12 +++ ray/src/cv/rad2mgf.c 2003/07/27 22:12:02 2.18 @@ -1,24 +1,20 @@ -/* Copyright (c) 1995 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: rad2mgf.c,v 2.18 2003/07/27 22:12:02 schorsch Exp $"; #endif - /* * Convert Radiance scene description to MGF */ -#include -#include +#include "standard.h" #include #include -#include "fvect.h" +#include + +#include "platform.h" #include "object.h" #include "color.h" #include "lookup.h" -#define PI 3.14159265358979323846 - #define C_1SIDEDTHICK 0.005 int o_face(), o_cone(), o_sphere(), o_ring(), o_cylinder(); @@ -26,9 +22,6 @@ int o_instance(), o_illum(); int o_plastic(), o_metal(), o_glass(), o_dielectric(), o_mirror(), o_trans(), o_light(); -extern void free(); -extern char *malloc(); - LUTAB rmats = LU_SINIT(free,NULL); /* defined material table */ LUTAB rdispatch = LU_SINIT(NULL,NULL); /* function dispatch table */ @@ -270,7 +263,7 @@ char *id; *cp2++ = 'O'; } for (cp = id; cp < end; *cp2++ = *cp++) { - if (*cp < '!' | *cp > '~') /* limit to visible chars */ + if ((*cp < '!') | (*cp > '~')) /* limit to visible chars */ *cp = '?'; diff += *cp != *cp2; } @@ -431,18 +424,23 @@ o_face(mod, typ, id, fa) /* print out a polygon */ char *mod, *typ, *id; FUNARGS *fa; { - char entbuf[512]; + char entbuf[2048], *linestart; register char *cp; register int i; - if (fa->nfargs < 9 | fa->nfargs % 3) + if ((fa->nfargs < 9) | (fa->nfargs % 3)) return(-1); setmat(mod); setobj(id); - cp = entbuf; + cp = linestart = entbuf; *cp++ = 'f'; for (i = 0; i < fa->nfargs; i += 3) { *cp++ = ' '; + if (cp - linestart > 72) { + *cp++ = '\\'; *cp++ = '\n'; + linestart = cp; + *cp++ = ' '; *cp++ = ' '; + } getvertid(cp, fa->farg + i); while (*cp) cp++;