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> |
12 |
< |
#include <math.h> |
8 |
> |
#include "standard.h" |
9 |
|
#include <ctype.h> |
10 |
|
#include <string.h> |
15 |
– |
#include "fvect.h" |
11 |
|
#include "object.h" |
12 |
|
#include "color.h" |
13 |
|
#include "lookup.h" |
14 |
|
|
20 |
– |
#define PI 3.14159265358979323846 |
21 |
– |
|
15 |
|
#define C_1SIDEDTHICK 0.005 |
16 |
|
|
17 |
|
int o_face(), o_cone(), o_sphere(), o_ring(), o_cylinder(); |
19 |
|
int o_plastic(), o_metal(), o_glass(), o_dielectric(), |
20 |
|
o_mirror(), o_trans(), o_light(); |
21 |
|
|
29 |
– |
extern void free(); |
30 |
– |
extern char *malloc(); |
31 |
– |
|
22 |
|
LUTAB rmats = LU_SINIT(free,NULL); /* defined material table */ |
23 |
|
|
24 |
|
LUTAB rdispatch = LU_SINIT(NULL,NULL); /* function dispatch table */ |
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 |
|
|
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++; |