| 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"; |
| 10 |
|
|
| 11 |
|
#include <stdio.h> |
| 12 |
|
#include <math.h> |
| 13 |
+ |
#include <ctype.h> |
| 14 |
|
#include <string.h> |
| 15 |
|
#include "fvect.h" |
| 16 |
|
#include "object.h" |
| 22 |
|
#define C_1SIDEDTHICK 0.005 |
| 23 |
|
|
| 24 |
|
int o_face(), o_cone(), o_sphere(), o_ring(), o_cylinder(); |
| 25 |
< |
int o_instance(), o_source(), o_illum(); |
| 25 |
> |
int o_instance(), o_illum(); |
| 26 |
|
int o_plastic(), o_metal(), o_glass(), o_dielectric(), |
| 27 |
< |
o_mirror(), o_trans(), o_light(); |
| 27 |
> |
o_mirror(), o_trans(), o_light(); |
| 28 |
|
|
| 29 |
|
extern void free(); |
| 30 |
|
extern char *malloc(); |
| 195 |
|
fprintf(stderr, "%s: bad %s \"%s\"\n", typ, id); |
| 196 |
|
exit(1); |
| 197 |
|
} |
| 198 |
< |
} else if (lu_find(&rmats, mod)->data != NULL) /* make alias */ |
| 199 |
< |
newmat(id, mod); |
| 198 |
> |
} else { /* unsupported */ |
| 199 |
> |
o_unsupported(mod, typ, id, fa); |
| 200 |
> |
if (lu_find(&rmats, mod)->data != NULL) /* make alias */ |
| 201 |
> |
newmat(id, mod); |
| 202 |
> |
} |
| 203 |
|
} |
| 204 |
|
|
| 205 |
|
|
| 264 |
|
if (end == NULL) |
| 265 |
|
end = cp; |
| 266 |
|
/* copy to current object */ |
| 267 |
< |
for (cp = id, cp2 = curobj; cp < end; *cp2++ = *cp++) |
| 267 |
> |
cp2 = curobj; |
| 268 |
> |
if (!isalpha(*id)) { /* start with letter */ |
| 269 |
> |
diff = *cp2 != 'O'; |
| 270 |
> |
*cp2++ = 'O'; |
| 271 |
> |
} |
| 272 |
> |
for (cp = id; cp < end; *cp2++ = *cp++) { |
| 273 |
> |
if (*cp < '!' | *cp > '~') /* limit to visible chars */ |
| 274 |
> |
*cp = '?'; |
| 275 |
|
diff += *cp != *cp2; |
| 276 |
+ |
} |
| 277 |
|
if (!diff && !*cp2) |
| 278 |
|
return; |
| 279 |
|
*cp2 = '\0'; |
| 308 |
|
add2dispatch("spotlight", o_light); |
| 309 |
|
add2dispatch("glow", o_light); |
| 310 |
|
add2dispatch("illum", o_illum); |
| 311 |
< |
puts("# The following was converted from Radiance scene input"); |
| 311 |
> |
puts("# The following was converted from RADIANCE scene input"); |
| 312 |
|
if (hasmult) |
| 313 |
|
printf("xf -s %.4e\n", unit_mult); |
| 314 |
|
printf("o %s\n", curobj); |
| 320 |
|
puts("o"); |
| 321 |
|
if (hasmult) |
| 322 |
|
puts("xf"); |
| 323 |
< |
puts("# End of data converted from Radiance scene input"); |
| 323 |
> |
puts("# End of data converted from RADIANCE scene input"); |
| 324 |
|
lu_done(&rdispatch); |
| 325 |
|
lu_done(&rmats); |
| 326 |
|
lu_done(&vertab); |
| 400 |
|
|
| 401 |
|
|
| 402 |
|
int |
| 403 |
+ |
o_unsupported(mod, typ, id, fa) /* mark unsupported primitive */ |
| 404 |
+ |
char *mod, *typ, *id; |
| 405 |
+ |
FUNARGS *fa; |
| 406 |
+ |
{ |
| 407 |
+ |
register int i; |
| 408 |
+ |
|
| 409 |
+ |
fputs("\n# Unsupported RADIANCE primitive:\n", stdout); |
| 410 |
+ |
printf("# %s %s %s", mod, typ, id); |
| 411 |
+ |
printf("\n# %d", fa->nsargs); |
| 412 |
+ |
for (i = 0; i < fa->nsargs; i++) |
| 413 |
+ |
printf(" %s", fa->sarg[i]); |
| 414 |
+ |
#ifdef IARGS |
| 415 |
+ |
printf("\n# %d", fa->niargs); |
| 416 |
+ |
for (i = 0; i < fa->niargs; i++) |
| 417 |
+ |
printf(" %ld", fa->iarg[i]); |
| 418 |
+ |
#else |
| 419 |
+ |
fputs("\n# 0", stdout); |
| 420 |
+ |
#endif |
| 421 |
+ |
printf("\n# %d", fa->nfargs); |
| 422 |
+ |
for (i = 0; i < fa->nfargs; i++) |
| 423 |
+ |
printf(" %g", fa->farg[i]); |
| 424 |
+ |
fputs("\n\n", stdout); |
| 425 |
+ |
return(0); |
| 426 |
+ |
} |
| 427 |
+ |
|
| 428 |
+ |
|
| 429 |
+ |
int |
| 430 |
|
o_face(mod, typ, id, fa) /* print out a polygon */ |
| 431 |
|
char *mod, *typ, *id; |
| 432 |
|
FUNARGS *fa; |
| 433 |
|
{ |
| 434 |
< |
char entbuf[512]; |
| 434 |
> |
char entbuf[2048]; |
| 435 |
|
register char *cp; |
| 436 |
|
register int i; |
| 437 |
|
|
| 572 |
|
putchar('\n'); |
| 573 |
|
clrverts(); /* vertex id's no longer reliable */ |
| 574 |
|
return(0); |
| 536 |
– |
} |
| 537 |
– |
|
| 538 |
– |
|
| 539 |
– |
int |
| 540 |
– |
o_source(mod, typ, id, fa) /* convert a source */ |
| 541 |
– |
char *mod, *typ, *id; |
| 542 |
– |
FUNARGS *fa; |
| 543 |
– |
{ |
| 544 |
– |
return(0); /* there is no MGF equivalent! */ |
| 575 |
|
} |
| 576 |
|
|
| 577 |
|
|