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 "rtprocess.h" |
15 |
|
#include "object.h" |
16 |
|
#include "color.h" |
17 |
|
#include "lookup.h" |
18 |
|
|
20 |
– |
#define PI 3.14159265358979323846 |
21 |
– |
|
19 |
|
#define C_1SIDEDTHICK 0.005 |
20 |
|
|
21 |
|
int o_face(), o_cone(), o_sphere(), o_ring(), o_cylinder(); |
23 |
|
int o_plastic(), o_metal(), o_glass(), o_dielectric(), |
24 |
|
o_mirror(), o_trans(), o_light(); |
25 |
|
|
29 |
– |
extern void free(); |
30 |
– |
extern char *malloc(); |
31 |
– |
|
26 |
|
LUTAB rmats = LU_SINIT(free,NULL); /* defined material table */ |
27 |
|
|
28 |
|
LUTAB rdispatch = LU_SINIT(NULL,NULL); /* function dispatch table */ |
264 |
|
*cp2++ = 'O'; |
265 |
|
} |
266 |
|
for (cp = id; cp < end; *cp2++ = *cp++) { |
267 |
< |
if (*cp < '!' | *cp > '~') /* limit to visible chars */ |
267 |
> |
if ((*cp < '!') | (*cp > '~')) /* limit to visible chars */ |
268 |
|
*cp = '?'; |
269 |
|
diff += *cp != *cp2; |
270 |
|
} |
289 |
|
add2dispatch("tube", o_cylinder); |
290 |
|
add2dispatch("ring", o_ring); |
291 |
|
add2dispatch("instance", o_instance); |
292 |
+ |
add2dispatch("mesh", o_instance); |
293 |
|
add2dispatch("plastic", o_plastic); |
294 |
|
add2dispatch("plastic2", o_plastic); |
295 |
|
add2dispatch("metal", o_metal); |
426 |
|
char *mod, *typ, *id; |
427 |
|
FUNARGS *fa; |
428 |
|
{ |
429 |
< |
char entbuf[512]; |
429 |
> |
char entbuf[2048], *linestart; |
430 |
|
register char *cp; |
431 |
|
register int i; |
432 |
|
|
433 |
< |
if (fa->nfargs < 9 | fa->nfargs % 3) |
433 |
> |
if ((fa->nfargs < 9) | (fa->nfargs % 3)) |
434 |
|
return(-1); |
435 |
|
setmat(mod); |
436 |
|
setobj(id); |
437 |
< |
cp = entbuf; |
437 |
> |
cp = linestart = entbuf; |
438 |
|
*cp++ = 'f'; |
439 |
|
for (i = 0; i < fa->nfargs; i += 3) { |
440 |
|
*cp++ = ' '; |
441 |
+ |
if (cp - linestart > 72) { |
442 |
+ |
*cp++ = '\\'; *cp++ = '\n'; |
443 |
+ |
linestart = cp; |
444 |
+ |
*cp++ = ' '; *cp++ = ' '; |
445 |
+ |
} |
446 |
|
getvertid(cp, fa->farg + i); |
447 |
|
while (*cp) |
448 |
|
cp++; |
535 |
|
|
536 |
|
|
537 |
|
int |
538 |
< |
o_instance(mod, typ, id, fa) /* convert an instance */ |
538 |
> |
o_instance(mod, typ, id, fa) /* convert an instance (or mesh) */ |
539 |
|
char *mod, *typ, *id; |
540 |
|
FUNARGS *fa; |
541 |
|
{ |