| 1 |
< |
/* Copyright (c) 1994 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1995 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 8 |
|
* Convert Radiance scene description to MGF |
| 9 |
|
*/ |
| 10 |
|
|
| 11 |
< |
#include <stdio.h> |
| 12 |
< |
#include <math.h> |
| 11 |
> |
#include "standard.h" |
| 12 |
> |
#include <ctype.h> |
| 13 |
|
#include <string.h> |
| 14 |
– |
#include "fvect.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(); |
| 22 |
|
int o_plastic(), o_metal(), o_glass(), o_dielectric(), |
| 23 |
|
o_mirror(), o_trans(), o_light(); |
| 24 |
|
|
| 25 |
< |
extern void free(); |
| 29 |
< |
extern char *malloc(); |
| 25 |
> |
extern int free(); |
| 26 |
|
|
| 27 |
|
LUTAB rmats = LU_SINIT(free,NULL); /* defined material table */ |
| 28 |
|
|
| 259 |
|
if (end == NULL) |
| 260 |
|
end = cp; |
| 261 |
|
/* copy to current object */ |
| 262 |
< |
for (cp = id, cp2 = curobj; cp < end; *cp2++ = *cp++) |
| 262 |
> |
cp2 = curobj; |
| 263 |
> |
if (!isalpha(*id)) { /* start with letter */ |
| 264 |
> |
diff = *cp2 != 'O'; |
| 265 |
> |
*cp2++ = 'O'; |
| 266 |
> |
} |
| 267 |
> |
for (cp = id; cp < end; *cp2++ = *cp++) { |
| 268 |
> |
if (*cp < '!' | *cp > '~') /* limit to visible chars */ |
| 269 |
> |
*cp = '?'; |
| 270 |
|
diff += *cp != *cp2; |
| 271 |
+ |
} |
| 272 |
|
if (!diff && !*cp2) |
| 273 |
|
return; |
| 274 |
|
*cp2 = '\0'; |
| 426 |
|
char *mod, *typ, *id; |
| 427 |
|
FUNARGS *fa; |
| 428 |
|
{ |
| 429 |
< |
char entbuf[512]; |
| 429 |
> |
char entbuf[2048]; |
| 430 |
|
register char *cp; |
| 431 |
|
register int i; |
| 432 |
|
|