| 26 |
|
|
| 27 |
|
LUTAB rdispatch = LU_SINIT(NULL,NULL); /* function dispatch table */ |
| 28 |
|
|
| 29 |
< |
char curmat[80]; /* current material */ |
| 29 |
> |
char curmat[80]; /* current material */ |
| 30 |
> |
char curobj[128] = "Untitled"; /* current object name */ |
| 31 |
|
|
| 32 |
< |
double unit_mult = 1.; /* units multiplier */ |
| 32 |
> |
double unit_mult = 1.; /* units multiplier */ |
| 33 |
|
|
| 34 |
+ |
#define hasmult (unit_mult < .999 || unit_mult > 1.001) |
| 35 |
|
|
| 36 |
+ |
/* |
| 37 |
+ |
* Stuff for tracking and reusing vertices: |
| 38 |
+ |
*/ |
| 39 |
+ |
|
| 40 |
+ |
char VKFMT[] = "%+1.9e %+1.9e %+1.9e"; |
| 41 |
+ |
#define VKLEN 64 |
| 42 |
+ |
|
| 43 |
+ |
#define mkvkey(k,v) sprintf(k, VKFMT, (v)[0], (v)[1], (v)[2]) |
| 44 |
+ |
|
| 45 |
+ |
#define NVERTS 256 |
| 46 |
+ |
|
| 47 |
+ |
long clock; /* incremented at each vertex request */ |
| 48 |
+ |
|
| 49 |
+ |
struct vert { |
| 50 |
+ |
long lused; /* when last used (0 if unassigned) */ |
| 51 |
+ |
FVECT p; /* track point position only */ |
| 52 |
+ |
} vert[NVERTS]; /* our vertex cache */ |
| 53 |
+ |
|
| 54 |
+ |
LUTAB vertab = LU_SINIT(free,NULL); /* our vertex lookup table */ |
| 55 |
+ |
|
| 56 |
+ |
|
| 57 |
|
main(argc, argv) |
| 58 |
|
int argc; |
| 59 |
|
char **argv; |
| 108 |
|
register int c; |
| 109 |
|
|
| 110 |
|
if (inp == NULL) { |
| 111 |
< |
inp = "the standard input"; |
| 111 |
> |
inp = "standard input"; |
| 112 |
|
fp = stdin; |
| 113 |
|
} else if (inp[0] == '!') { |
| 114 |
|
if ((fp = popen(inp+1, "r")) == NULL) { |
| 232 |
|
{ |
| 233 |
|
if (!strcmp(id, curmat)) /* already set? */ |
| 234 |
|
return; |
| 235 |
+ |
if (!strcmp(id, VOIDID)) /* cannot set */ |
| 236 |
+ |
return; |
| 237 |
|
printf("m %s\n", id); |
| 238 |
|
strcpy(curmat, id); |
| 239 |
|
} |
| 240 |
|
|
| 241 |
|
|
| 242 |
+ |
setobj(id) /* set object name to this one */ |
| 243 |
+ |
char *id; |
| 244 |
+ |
{ |
| 245 |
+ |
register char *cp, *cp2; |
| 246 |
+ |
char *end = NULL; |
| 247 |
+ |
int diff = 0; |
| 248 |
+ |
/* use all but final suffix */ |
| 249 |
+ |
for (cp = id; *cp; cp++) |
| 250 |
+ |
if (*cp == '.') |
| 251 |
+ |
end = cp; |
| 252 |
+ |
if (end == NULL) |
| 253 |
+ |
end = cp; |
| 254 |
+ |
/* copy to current object */ |
| 255 |
+ |
for (cp = id, cp2 = curobj; cp < end; *cp2++ = *cp++) |
| 256 |
+ |
diff += *cp != *cp2; |
| 257 |
+ |
if (!diff && !*cp2) |
| 258 |
+ |
return; |
| 259 |
+ |
*cp2 = '\0'; |
| 260 |
+ |
fputs("o\no ", stdout); |
| 261 |
+ |
puts(curobj); |
| 262 |
+ |
} |
| 263 |
+ |
|
| 264 |
+ |
|
| 265 |
|
init() /* initialize dispatch table and output */ |
| 266 |
|
{ |
| 267 |
+ |
lu_init(&vertab, NVERTS); |
| 268 |
|
lu_init(&rdispatch, 22); |
| 269 |
|
add2dispatch("polygon", o_face); |
| 270 |
|
add2dispatch("cone", o_cone); |
| 288 |
|
add2dispatch("glow", o_light); |
| 289 |
|
add2dispatch("illum", o_illum); |
| 290 |
|
puts("# The following was converted from Radiance scene input"); |
| 291 |
< |
if (unit_mult < .999 || unit_mult > 1.001) |
| 291 |
> |
if (hasmult) |
| 292 |
|
printf("xf -s %.4e\n", unit_mult); |
| 293 |
+ |
printf("o %s\n", curobj); |
| 294 |
|
} |
| 295 |
|
|
| 296 |
|
|
| 297 |
|
uninit() /* mark end of MGF file */ |
| 298 |
|
{ |
| 299 |
< |
if (unit_mult < .999 || unit_mult > 1.001) |
| 299 |
> |
puts("o"); |
| 300 |
> |
if (hasmult) |
| 301 |
|
puts("xf"); |
| 302 |
|
puts("# End of data converted from Radiance scene input"); |
| 303 |
|
lu_done(&rdispatch); |
| 304 |
|
lu_done(&rmats); |
| 305 |
+ |
lu_done(&vertab); |
| 306 |
|
} |
| 307 |
|
|
| 308 |
|
|
| 323 |
|
} |
| 324 |
|
|
| 325 |
|
|
| 274 |
– |
char VKFMT[] = "%+1.9e %+1.9e %+1.9e"; |
| 275 |
– |
#define VKLEN 64 |
| 276 |
– |
|
| 277 |
– |
#define mkvkey(k,v) sprintf(k, VKFMT, (v)[0], (v)[1], (v)[2]) |
| 278 |
– |
|
| 279 |
– |
#define NVERTS 256 |
| 280 |
– |
|
| 281 |
– |
long clock; /* incremented at each vertex request */ |
| 282 |
– |
|
| 283 |
– |
struct vert { |
| 284 |
– |
long lused; /* when last used (0 if unassigned) */ |
| 285 |
– |
FVECT p; /* track point position only */ |
| 286 |
– |
} vert[NVERTS]; |
| 287 |
– |
|
| 288 |
– |
LUTAB vertab = LU_SINIT(free,NULL); /* our vertex lookup table */ |
| 289 |
– |
|
| 290 |
– |
|
| 326 |
|
char * |
| 327 |
< |
getvertid(vp) /* get/set vertex ID for this point */ |
| 327 |
> |
getvertid(vname, vp) /* get/set vertex ID for this point */ |
| 328 |
> |
char *vname; |
| 329 |
|
FVECT vp; |
| 330 |
|
{ |
| 295 |
– |
static char vname[6]; |
| 331 |
|
char vkey[VKLEN]; |
| 332 |
|
register LUENT *lp; |
| 333 |
|
register int i, vndx; |
| 334 |
|
|
| 300 |
– |
if (!vertab.tsiz && !lu_init(&vertab, NVERTS)) |
| 301 |
– |
goto memerr; |
| 335 |
|
clock++; /* increment counter */ |
| 336 |
|
mkvkey(vkey, vp); |
| 337 |
|
if ((lp = lu_find(&vertab, vkey)) == NULL) |
| 352 |
|
mkvkey(vkey, vert[vndx].p); |
| 353 |
|
lu_delete(&vertab, vkey); |
| 354 |
|
} |
| 355 |
< |
vert[vndx].lused = clock; /* assign it */ |
| 356 |
< |
VCOPY(vert[vndx].p, vp); |
| 324 |
< |
printf("v v%d =\np %.15g %.15g %.15g\n", /* print it */ |
| 355 |
> |
VCOPY(vert[vndx].p, vp); /* assign it */ |
| 356 |
> |
printf("v v%d =\n\tp %.15g %.15g %.15g\n", /* print it */ |
| 357 |
|
vndx, vp[0], vp[1], vp[2]); |
| 358 |
|
lp->data = (char *)&vert[vndx]; /* set it */ |
| 359 |
|
} else |
| 360 |
|
vndx = (struct vert *)lp->data - vert; |
| 361 |
+ |
vert[vndx].lused = clock; /* record this use */ |
| 362 |
|
sprintf(vname, "v%d", vndx); |
| 363 |
|
return(vname); |
| 364 |
|
memerr: |
| 373 |
|
FUNARGS *fa; |
| 374 |
|
{ |
| 375 |
|
char entbuf[512]; |
| 376 |
< |
register char *cp1, *cp2; |
| 376 |
> |
register char *cp; |
| 377 |
|
register int i; |
| 378 |
|
|
| 379 |
|
if (fa->nfargs < 9 | fa->nfargs % 3) |
| 380 |
|
return(-1); |
| 381 |
|
setmat(mod); |
| 382 |
< |
printf("o %s\n", id); |
| 383 |
< |
cp1 = entbuf; |
| 384 |
< |
*cp1++ = 'f'; |
| 382 |
> |
setobj(id); |
| 383 |
> |
cp = entbuf; |
| 384 |
> |
*cp++ = 'f'; |
| 385 |
|
for (i = 0; i < fa->nfargs; i += 3) { |
| 386 |
< |
cp2 = getvertid(fa->farg + i); |
| 387 |
< |
*cp1++ = ' '; |
| 388 |
< |
while ((*cp1 = *cp2++)) |
| 389 |
< |
cp1++; |
| 386 |
> |
*cp++ = ' '; |
| 387 |
> |
getvertid(cp, fa->farg + i); |
| 388 |
> |
while (*cp) |
| 389 |
> |
cp++; |
| 390 |
|
} |
| 391 |
|
puts(entbuf); |
| 359 |
– |
puts("o"); |
| 392 |
|
return(0); |
| 393 |
|
} |
| 394 |
|
|
| 398 |
|
char *mod, *typ, *id; |
| 399 |
|
register FUNARGS *fa; |
| 400 |
|
{ |
| 401 |
+ |
char v1[6], v2[6]; |
| 402 |
+ |
|
| 403 |
|
if (fa->nfargs != 8) |
| 404 |
|
return(-1); |
| 405 |
|
setmat(mod); |
| 406 |
< |
printf("o %s\n", id); |
| 407 |
< |
printf("v cv1 =\np %.12g %.12g %.12g\n", |
| 408 |
< |
fa->farg[0], fa->farg[1], fa->farg[2]); |
| 375 |
< |
printf("v cv2 =\np %.12g %.12g %.12g\n", |
| 376 |
< |
fa->farg[3], fa->farg[4], fa->farg[5]); |
| 406 |
> |
setobj(id); |
| 407 |
> |
getvertid(v1, fa->farg); |
| 408 |
> |
getvertid(v2, fa->farg + 3); |
| 409 |
|
if (typ[1] == 'u') /* cup -> inverted cone */ |
| 410 |
< |
printf("cone cv1 %.12g cv2 %.12g\n", |
| 411 |
< |
-fa->farg[6], -fa->farg[7]); |
| 410 |
> |
printf("cone %s %.12g %s %.12g\n", |
| 411 |
> |
v1, -fa->farg[6], v2, -fa->farg[7]); |
| 412 |
|
else |
| 413 |
< |
printf("cone cv1 %.12g cv2 %.12g\n", |
| 414 |
< |
fa->farg[6], fa->farg[7]); |
| 383 |
< |
puts("o"); |
| 413 |
> |
printf("cone %s %.12g %s %.12g\n", |
| 414 |
> |
v1, fa->farg[6], v2, fa->farg[7]); |
| 415 |
|
return(0); |
| 416 |
|
} |
| 417 |
|
|
| 421 |
|
char *mod, *typ, *id; |
| 422 |
|
register FUNARGS *fa; |
| 423 |
|
{ |
| 424 |
+ |
char cent[6]; |
| 425 |
+ |
|
| 426 |
|
if (fa->nfargs != 4) |
| 427 |
|
return(-1); |
| 428 |
|
setmat(mod); |
| 429 |
< |
printf("o %s\n", id); |
| 430 |
< |
printf("v cent =\np %.12g %.12g %.12g\n", |
| 431 |
< |
fa->farg[0], fa->farg[1], fa->farg[2]); |
| 399 |
< |
printf("sph cent %.12g\n", typ[0]=='b' ? -fa->farg[3] : fa->farg[3]); |
| 400 |
< |
puts("o"); |
| 429 |
> |
setobj(id); |
| 430 |
> |
printf("sph %s %.12g\n", getvertid(cent, fa->farg), |
| 431 |
> |
typ[0]=='b' ? -fa->farg[3] : fa->farg[3]); |
| 432 |
|
return(0); |
| 433 |
|
} |
| 434 |
|
|
| 438 |
|
char *mod, *typ, *id; |
| 439 |
|
register FUNARGS *fa; |
| 440 |
|
{ |
| 441 |
+ |
char v1[6], v2[6]; |
| 442 |
+ |
|
| 443 |
|
if (fa->nfargs != 7) |
| 444 |
|
return(-1); |
| 445 |
|
setmat(mod); |
| 446 |
< |
printf("o %s\n", id); |
| 447 |
< |
printf("v cv1 =\np %.12g %.12g %.12g\n", |
| 448 |
< |
fa->farg[0], fa->farg[1], fa->farg[2]); |
| 449 |
< |
printf("v cv2 =\np %.12g %.12g %.12g\n", |
| 450 |
< |
fa->farg[3], fa->farg[4], fa->farg[5]); |
| 418 |
< |
printf("cyl cv1 %.12g cv2\n", |
| 419 |
< |
typ[0]=='t' ? -fa->farg[6] : fa->farg[6]); |
| 420 |
< |
puts("o"); |
| 446 |
> |
setobj(id); |
| 447 |
> |
getvertid(v1, fa->farg); |
| 448 |
> |
getvertid(v2, fa->farg + 3); |
| 449 |
> |
printf("cyl %s %.12g %s\n", v1, |
| 450 |
> |
typ[0]=='t' ? -fa->farg[6] : fa->farg[6], v2); |
| 451 |
|
return(0); |
| 452 |
|
} |
| 453 |
|
|
| 460 |
|
if (fa->nfargs != 8) |
| 461 |
|
return(-1); |
| 462 |
|
setmat(mod); |
| 463 |
< |
printf("o %s\n", id); |
| 464 |
< |
printf("v cent =\np %.12g %.12g %.12g\n", |
| 463 |
> |
setobj(id); |
| 464 |
> |
printf("v cent =\n\tp %.12g %.12g %.12g\n", |
| 465 |
|
fa->farg[0], fa->farg[1], fa->farg[2]); |
| 466 |
< |
printf("n %.12g %.12g %.12g\n", |
| 466 |
> |
printf("\tn %.12g %.12g %.12g\n", |
| 467 |
|
fa->farg[3], fa->farg[4], fa->farg[5]); |
| 468 |
|
if (fa->farg[6] < fa->farg[7]) |
| 469 |
|
printf("ring cent %.12g %.12g\n", |
| 471 |
|
else |
| 472 |
|
printf("ring cent %.12g %.12g\n", |
| 473 |
|
fa->farg[7], fa->farg[6]); |
| 444 |
– |
puts("o"); |
| 474 |
|
return(0); |
| 475 |
|
} |
| 476 |
|
|
| 480 |
|
char *mod, *typ, *id; |
| 481 |
|
FUNARGS *fa; |
| 482 |
|
{ |
| 483 |
< |
return(0); /* this is too damned difficult! */ |
| 483 |
> |
register int i; |
| 484 |
> |
register char *cp; |
| 485 |
> |
char *start = NULL, *end = NULL; |
| 486 |
> |
/* |
| 487 |
> |
* We don't really know how to do this, so we just create |
| 488 |
> |
* a reference to an undefined MGF file and it's the user's |
| 489 |
> |
* responsibility to create this file and put the appropriate |
| 490 |
> |
* stuff into it. |
| 491 |
> |
*/ |
| 492 |
> |
if (fa->nsargs < 1) |
| 493 |
> |
return(-1); |
| 494 |
> |
setmat(mod); /* only works if surfaces are void */ |
| 495 |
> |
setobj(id); |
| 496 |
> |
for (cp = fa->sarg[0]; *cp; cp++) /* construct MGF file name */ |
| 497 |
> |
if (*cp == '/') |
| 498 |
> |
start = cp+1; |
| 499 |
> |
else if (*cp == '.') |
| 500 |
> |
end = cp; |
| 501 |
> |
if (start == NULL) |
| 502 |
> |
start = fa->sarg[0]; |
| 503 |
> |
if (end == NULL || start >= end) |
| 504 |
> |
end = cp; |
| 505 |
> |
fputs("i ", stdout); /* print include entity */ |
| 506 |
> |
for (cp = start; cp < end; cp++) |
| 507 |
> |
putchar(*cp); |
| 508 |
> |
fputs(".mgf", stdout); /* add MGF suffix */ |
| 509 |
> |
for (i = 1; i < fa->nsargs; i++) { /* add transform */ |
| 510 |
> |
putchar(' '); |
| 511 |
> |
fputs(fa->sarg[i], stdout); |
| 512 |
> |
} |
| 513 |
> |
putchar('\n'); |
| 514 |
> |
return(0); |
| 515 |
|
} |
| 516 |
|
|
| 517 |
|
|
| 535 |
|
} |
| 536 |
|
/* else create invisible material */ |
| 537 |
|
newmat(id, NULL); |
| 538 |
< |
puts("ts 1 0"); |
| 538 |
> |
puts("\tts 1 0"); |
| 539 |
|
return(0); |
| 540 |
|
} |
| 541 |
|
|
| 553 |
|
newmat(id, NULL); |
| 554 |
|
rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2]; |
| 555 |
|
rgb_cie(cxyz, rrgb); |
| 556 |
< |
puts("c"); /* put diffuse component */ |
| 556 |
> |
puts("\tc"); /* put diffuse component */ |
| 557 |
|
d = cxyz[0] + cxyz[1] + cxyz[2]; |
| 558 |
|
if (d > FTINY) |
| 559 |
< |
printf("cxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
| 560 |
< |
printf("rd %.4f\n", cxyz[1]*(1. - fa->farg[3])); |
| 561 |
< |
puts("c"); /* put specular component */ |
| 562 |
< |
printf("rs %.4f %.4f\n", fa->farg[3], |
| 563 |
< |
typ[7]=='2' ? .5*(fa->farg[4] + fa->farg[5]) : |
| 564 |
< |
fa->farg[4]); |
| 559 |
> |
printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
| 560 |
> |
printf("\trd %.4f\n", cxyz[1]*(1. - fa->farg[3])); |
| 561 |
> |
if (fa->farg[3] > FTINY) { /* put specular component */ |
| 562 |
> |
puts("\tc"); |
| 563 |
> |
printf("\trs %.4f %.4f\n", fa->farg[3], |
| 564 |
> |
typ[7]=='2' ? .5*(fa->farg[4] + fa->farg[5]) : |
| 565 |
> |
fa->farg[4]); |
| 566 |
> |
} |
| 567 |
|
return(0); |
| 568 |
|
} |
| 569 |
|
|
| 581 |
|
newmat(id, NULL); |
| 582 |
|
rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2]; |
| 583 |
|
rgb_cie(cxyz, rrgb); |
| 584 |
< |
puts("c"); /* put diffuse component */ |
| 584 |
> |
puts("\tc"); /* put diffuse component */ |
| 585 |
|
d = cxyz[0] + cxyz[1] + cxyz[2]; |
| 586 |
|
if (d > FTINY) |
| 587 |
< |
printf("cxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
| 588 |
< |
printf("rd %.4f\n", cxyz[1]*(1. - fa->farg[3])); |
| 587 |
> |
printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
| 588 |
> |
printf("\trd %.4f\n", cxyz[1]*(1. - fa->farg[3])); |
| 589 |
|
/* put specular component */ |
| 590 |
< |
printf("rs %.4f %.4f\n", cxyz[1]*fa->farg[3], |
| 590 |
> |
printf("\trs %.4f %.4f\n", cxyz[1]*fa->farg[3], |
| 591 |
|
typ[5]=='2' ? .5*(fa->farg[4] + fa->farg[5]) : |
| 592 |
|
fa->farg[4]); |
| 593 |
|
return(0); |
| 611 |
|
F = (1. - nrfr)/(1. + nrfr); /* use normal incidence */ |
| 612 |
|
F *= F; |
| 613 |
|
for (i = 0; i < 3; i++) { |
| 614 |
< |
rrgb[i] = (1. - F)*(1. - F)/(1. - F*F*fa->farg[i]*fa->farg[i]); |
| 553 |
< |
trgb[i] = F * (1. + (1. - 2.*F)*fa->farg[i]) / |
| 614 |
> |
trgb[i] = fa->farg[i] * (1. - F)*(1. - F) / |
| 615 |
|
(1. - F*F*fa->farg[i]*fa->farg[i]); |
| 616 |
+ |
rrgb[i] = F * (1. + (1. - 2.*F)*fa->farg[i]) / |
| 617 |
+ |
(1. - F*F*fa->farg[i]*fa->farg[i]); |
| 618 |
|
} |
| 619 |
|
rgb_cie(cxyz, rrgb); /* put reflected component */ |
| 620 |
< |
puts("c"); |
| 620 |
> |
puts("\tc"); |
| 621 |
|
d = cxyz[0] + cxyz[1] + cxyz[2]; |
| 622 |
|
if (d > FTINY) |
| 623 |
< |
printf("cxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
| 624 |
< |
printf("rs %.4f 0\n", cxyz[1]); |
| 623 |
> |
printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
| 624 |
> |
printf("\trs %.4f 0\n", cxyz[1]); |
| 625 |
|
rgb_cie(cxyz, trgb); /* put transmitted component */ |
| 626 |
< |
puts("c"); |
| 626 |
> |
puts("\tc"); |
| 627 |
|
d = cxyz[0] + cxyz[1] + cxyz[2]; |
| 628 |
|
if (d > FTINY) |
| 629 |
< |
printf("cxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
| 630 |
< |
printf("ts %.4f 0\n", cxyz[1]); |
| 629 |
> |
printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
| 630 |
> |
printf("\tts %.4f 0\n", cxyz[1]); |
| 631 |
|
return(0); |
| 632 |
|
} |
| 633 |
|
|
| 649 |
|
newmat(id, NULL); |
| 650 |
|
rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2]; |
| 651 |
|
rgb_cie(cxyz, rrgb); |
| 652 |
< |
puts("c"); /* put specular component */ |
| 652 |
> |
puts("\tc"); /* put specular component */ |
| 653 |
|
d = cxyz[0] + cxyz[1] + cxyz[2]; |
| 654 |
|
if (d > FTINY) |
| 655 |
< |
printf("cxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
| 656 |
< |
printf("rs %.4f 0\n", cxyz[1]); |
| 655 |
> |
printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
| 656 |
> |
printf("\trs %.4f 0\n", cxyz[1]); |
| 657 |
|
return(0); |
| 658 |
|
} |
| 659 |
|
|
| 682 |
|
newmat(id, NULL); |
| 683 |
|
rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2]; |
| 684 |
|
rgb_cie(cxyz, rrgb); |
| 685 |
< |
puts("c"); /* put transmitted diffuse */ |
| 685 |
> |
puts("\tc"); /* put transmitted diffuse */ |
| 686 |
|
d = cxyz[0] + cxyz[1] + cxyz[2]; |
| 687 |
|
if (d > FTINY) |
| 688 |
< |
printf("cxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
| 689 |
< |
printf("td %.4f\n", cxyz[1]*trans*(1. - fa->farg[3])*(1. - tspec)); |
| 688 |
> |
printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
| 689 |
> |
printf("\ttd %.4f\n", cxyz[1]*trans*(1. - fa->farg[3])*(1. - tspec)); |
| 690 |
|
/* put transmitted specular */ |
| 691 |
< |
printf("ts %.4f %.4f\n", cxyz[1]*trans*tspec*(1. - fa->farg[3]), rough); |
| 691 |
> |
printf("\tts %.4f %.4f\n", cxyz[1]*trans*tspec*(1. - fa->farg[3]), rough); |
| 692 |
|
/* put reflected diffuse */ |
| 693 |
< |
printf("rd %.4f\n", cxyz[1]*(1. - fa->farg[3])*(1. - trans)); |
| 694 |
< |
puts("c"); /* put reflected specular */ |
| 695 |
< |
printf("rs %.4f %.4f\n", fa->farg[3], rough); |
| 693 |
> |
printf("\trd %.4f\n", cxyz[1]*(1. - fa->farg[3])*(1. - trans)); |
| 694 |
> |
puts("\tc"); /* put reflected specular */ |
| 695 |
> |
printf("\trs %.4f %.4f\n", fa->farg[3], rough); |
| 696 |
|
return(0); |
| 697 |
|
} |
| 698 |
|
|
| 711 |
|
rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2]; |
| 712 |
|
rgb_cie(cxyz, rrgb); |
| 713 |
|
d = cxyz[0] + cxyz[1] + cxyz[2]; |
| 714 |
< |
puts("c"); |
| 714 |
> |
puts("\tc"); |
| 715 |
|
if (d > FTINY) |
| 716 |
< |
printf("cxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
| 717 |
< |
printf("ed %.4g\n", cxyz[1]); |
| 716 |
> |
printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
| 717 |
> |
printf("\ted %.4g\n", cxyz[1]*WHTEFFICACY); |
| 718 |
|
return(0); |
| 719 |
|
} |