15 |
|
#include "color.h" |
16 |
|
#include "lookup.h" |
17 |
|
|
18 |
+ |
#define PI 3.14159265358979323846 |
19 |
+ |
|
20 |
|
int o_face(), o_cone(), o_sphere(), o_ring(), o_cylinder(); |
21 |
|
int o_instance(), o_source(), o_illum(); |
22 |
|
int o_plastic(), o_metal(), o_glass(), o_mirror(), o_trans(), o_light(); |
28 |
|
|
29 |
|
LUTAB rdispatch = LU_SINIT(NULL,NULL); /* function dispatch table */ |
30 |
|
|
31 |
< |
char curmat[80]; /* current material */ |
31 |
> |
char curmat[80]; /* current material */ |
32 |
> |
char curobj[128] = "Untitled"; /* current object name */ |
33 |
|
|
34 |
< |
double unit_mult = 1.; /* units multiplier */ |
34 |
> |
double unit_mult = 1.; /* units multiplier */ |
35 |
|
|
36 |
+ |
#define hasmult (unit_mult < .999 || unit_mult > 1.001) |
37 |
|
|
38 |
+ |
/* |
39 |
+ |
* Stuff for tracking and reusing vertices: |
40 |
+ |
*/ |
41 |
+ |
|
42 |
+ |
char VKFMT[] = "%+16.9e %+16.9e %+16.9e"; |
43 |
+ |
#define VKLEN 64 |
44 |
+ |
|
45 |
+ |
#define mkvkey(k,v) sprintf(k, VKFMT, (v)[0], (v)[1], (v)[2]) |
46 |
+ |
|
47 |
+ |
#define NVERTS 256 |
48 |
+ |
|
49 |
+ |
long vclock; /* incremented at each vertex request */ |
50 |
+ |
|
51 |
+ |
struct vert { |
52 |
+ |
long lused; /* when last used (0 if unassigned) */ |
53 |
+ |
FVECT p; /* track point position only */ |
54 |
+ |
} vert[NVERTS]; /* our vertex cache */ |
55 |
+ |
|
56 |
+ |
LUTAB vertab = LU_SINIT(free,NULL); /* our vertex lookup table */ |
57 |
+ |
|
58 |
+ |
|
59 |
|
main(argc, argv) |
60 |
|
int argc; |
61 |
|
char **argv; |
82 |
|
goto unkopt; |
83 |
|
} |
84 |
|
break; |
85 |
+ |
default: |
86 |
+ |
goto unkopt; |
87 |
|
} |
88 |
|
init(); |
89 |
|
if (i >= argc) |
112 |
|
register int c; |
113 |
|
|
114 |
|
if (inp == NULL) { |
115 |
< |
inp = "the standard input"; |
115 |
> |
inp = "standard input"; |
116 |
|
fp = stdin; |
117 |
|
} else if (inp[0] == '!') { |
118 |
|
if ((fp = popen(inp+1, "r")) == NULL) { |
236 |
|
{ |
237 |
|
if (!strcmp(id, curmat)) /* already set? */ |
238 |
|
return; |
239 |
+ |
if (!strcmp(id, VOIDID)) /* cannot set */ |
240 |
+ |
return; |
241 |
|
printf("m %s\n", id); |
242 |
|
strcpy(curmat, id); |
243 |
|
} |
244 |
|
|
245 |
|
|
246 |
+ |
setobj(id) /* set object name to this one */ |
247 |
+ |
char *id; |
248 |
+ |
{ |
249 |
+ |
register char *cp, *cp2; |
250 |
+ |
char *end = NULL; |
251 |
+ |
int diff = 0; |
252 |
+ |
/* use all but final suffix */ |
253 |
+ |
for (cp = id; *cp; cp++) |
254 |
+ |
if (*cp == '.') |
255 |
+ |
end = cp; |
256 |
+ |
if (end == NULL) |
257 |
+ |
end = cp; |
258 |
+ |
/* copy to current object */ |
259 |
+ |
for (cp = id, cp2 = curobj; cp < end; *cp2++ = *cp++) |
260 |
+ |
diff += *cp != *cp2; |
261 |
+ |
if (!diff && !*cp2) |
262 |
+ |
return; |
263 |
+ |
*cp2 = '\0'; |
264 |
+ |
fputs("o\no ", stdout); |
265 |
+ |
puts(curobj); |
266 |
+ |
} |
267 |
+ |
|
268 |
+ |
|
269 |
|
init() /* initialize dispatch table and output */ |
270 |
|
{ |
271 |
+ |
lu_init(&vertab, NVERTS); |
272 |
|
lu_init(&rdispatch, 22); |
273 |
|
add2dispatch("polygon", o_face); |
274 |
|
add2dispatch("cone", o_cone); |
292 |
|
add2dispatch("glow", o_light); |
293 |
|
add2dispatch("illum", o_illum); |
294 |
|
puts("# The following was converted from Radiance scene input"); |
295 |
< |
if (unit_mult < .999 || unit_mult > 1.001) |
295 |
> |
if (hasmult) |
296 |
|
printf("xf -s %.4e\n", unit_mult); |
297 |
+ |
printf("o %s\n", curobj); |
298 |
|
} |
299 |
|
|
300 |
|
|
301 |
|
uninit() /* mark end of MGF file */ |
302 |
|
{ |
303 |
< |
if (unit_mult < .999 || unit_mult > 1.001) |
303 |
> |
puts("o"); |
304 |
> |
if (hasmult) |
305 |
|
puts("xf"); |
306 |
|
puts("# End of data converted from Radiance scene input"); |
307 |
|
lu_done(&rdispatch); |
308 |
|
lu_done(&rmats); |
309 |
+ |
lu_done(&vertab); |
310 |
|
} |
311 |
|
|
312 |
|
|
313 |
+ |
clrverts() /* clear vertex table */ |
314 |
+ |
{ |
315 |
+ |
register int i; |
316 |
+ |
|
317 |
+ |
lu_done(&vertab); |
318 |
+ |
for (i = 0; i < NVERTS; i++) |
319 |
+ |
vert[i].lused = 0; |
320 |
+ |
lu_init(&vertab, NVERTS); |
321 |
+ |
} |
322 |
+ |
|
323 |
+ |
|
324 |
|
add2dispatch(name, func) /* add function to dispatch table */ |
325 |
|
char *name; |
326 |
|
int (*func)(); |
338 |
|
} |
339 |
|
|
340 |
|
|
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 |
– |
|
341 |
|
char * |
342 |
< |
getvertid(vp) /* get/set vertex ID for this point */ |
342 |
> |
getvertid(vname, vp) /* get/set vertex ID for this point */ |
343 |
> |
char *vname; |
344 |
|
FVECT vp; |
345 |
|
{ |
346 |
< |
static char vname[6]; |
296 |
< |
char vkey[VKLEN]; |
346 |
> |
static char vkey[VKLEN]; |
347 |
|
register LUENT *lp; |
348 |
|
register int i, vndx; |
349 |
|
|
350 |
< |
if (!vertab.tsiz && !lu_init(&vertab, NVERTS)) |
301 |
< |
goto memerr; |
302 |
< |
clock++; /* increment counter */ |
350 |
> |
vclock++; /* increment counter */ |
351 |
|
mkvkey(vkey, vp); |
352 |
|
if ((lp = lu_find(&vertab, vkey)) == NULL) |
353 |
|
goto memerr; |
367 |
|
mkvkey(vkey, vert[vndx].p); |
368 |
|
lu_delete(&vertab, vkey); |
369 |
|
} |
370 |
< |
vert[vndx].lused = clock; /* assign it */ |
371 |
< |
VCOPY(vert[vndx].p, vp); |
324 |
< |
printf("v v%d =\np %.15g %.15g %.15g\n", /* print it */ |
370 |
> |
VCOPY(vert[vndx].p, vp); /* assign it */ |
371 |
> |
printf("v v%d =\n\tp %.15g %.15g %.15g\n", /* print it */ |
372 |
|
vndx, vp[0], vp[1], vp[2]); |
373 |
|
lp->data = (char *)&vert[vndx]; /* set it */ |
374 |
|
} else |
375 |
|
vndx = (struct vert *)lp->data - vert; |
376 |
+ |
vert[vndx].lused = vclock; /* record this use */ |
377 |
|
sprintf(vname, "v%d", vndx); |
378 |
|
return(vname); |
379 |
|
memerr: |
388 |
|
FUNARGS *fa; |
389 |
|
{ |
390 |
|
char entbuf[512]; |
391 |
< |
register char *cp1, *cp2; |
391 |
> |
register char *cp; |
392 |
|
register int i; |
393 |
|
|
394 |
|
if (fa->nfargs < 9 | fa->nfargs % 3) |
395 |
|
return(-1); |
396 |
|
setmat(mod); |
397 |
< |
printf("o %s\n", id); |
398 |
< |
cp1 = entbuf; |
399 |
< |
*cp1++ = 'f'; |
397 |
> |
setobj(id); |
398 |
> |
cp = entbuf; |
399 |
> |
*cp++ = 'f'; |
400 |
|
for (i = 0; i < fa->nfargs; i += 3) { |
401 |
< |
cp2 = getvertid(fa->farg + i); |
402 |
< |
*cp1++ = ' '; |
403 |
< |
while ((*cp1 = *cp2++)) |
404 |
< |
cp1++; |
401 |
> |
*cp++ = ' '; |
402 |
> |
getvertid(cp, fa->farg + i); |
403 |
> |
while (*cp) |
404 |
> |
cp++; |
405 |
|
} |
406 |
|
puts(entbuf); |
359 |
– |
puts("o"); |
407 |
|
return(0); |
408 |
|
} |
409 |
|
|
413 |
|
char *mod, *typ, *id; |
414 |
|
register FUNARGS *fa; |
415 |
|
{ |
416 |
+ |
char v1[6], v2[6]; |
417 |
+ |
|
418 |
|
if (fa->nfargs != 8) |
419 |
|
return(-1); |
420 |
|
setmat(mod); |
421 |
< |
printf("o %s\n", id); |
422 |
< |
printf("v cv1 =\np %.12g %.12g %.12g\n", |
423 |
< |
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]); |
421 |
> |
setobj(id); |
422 |
> |
getvertid(v1, fa->farg); |
423 |
> |
getvertid(v2, fa->farg + 3); |
424 |
|
if (typ[1] == 'u') /* cup -> inverted cone */ |
425 |
< |
printf("cone cv1 %.12g cv2 %.12g\n", |
426 |
< |
-fa->farg[6], -fa->farg[7]); |
425 |
> |
printf("cone %s %.12g %s %.12g\n", |
426 |
> |
v1, -fa->farg[6], v2, -fa->farg[7]); |
427 |
|
else |
428 |
< |
printf("cone cv1 %.12g cv2 %.12g\n", |
429 |
< |
fa->farg[6], fa->farg[7]); |
383 |
< |
puts("o"); |
428 |
> |
printf("cone %s %.12g %s %.12g\n", |
429 |
> |
v1, fa->farg[6], v2, fa->farg[7]); |
430 |
|
return(0); |
431 |
|
} |
432 |
|
|
436 |
|
char *mod, *typ, *id; |
437 |
|
register FUNARGS *fa; |
438 |
|
{ |
439 |
+ |
char cent[6]; |
440 |
+ |
|
441 |
|
if (fa->nfargs != 4) |
442 |
|
return(-1); |
443 |
|
setmat(mod); |
444 |
< |
printf("o %s\n", id); |
445 |
< |
printf("v cent =\np %.12g %.12g %.12g\n", |
446 |
< |
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"); |
444 |
> |
setobj(id); |
445 |
> |
printf("sph %s %.12g\n", getvertid(cent, fa->farg), |
446 |
> |
typ[0]=='b' ? -fa->farg[3] : fa->farg[3]); |
447 |
|
return(0); |
448 |
|
} |
449 |
|
|
453 |
|
char *mod, *typ, *id; |
454 |
|
register FUNARGS *fa; |
455 |
|
{ |
456 |
+ |
char v1[6], v2[6]; |
457 |
+ |
|
458 |
|
if (fa->nfargs != 7) |
459 |
|
return(-1); |
460 |
|
setmat(mod); |
461 |
< |
printf("o %s\n", id); |
462 |
< |
printf("v cv1 =\np %.12g %.12g %.12g\n", |
463 |
< |
fa->farg[0], fa->farg[1], fa->farg[2]); |
464 |
< |
printf("v cv2 =\np %.12g %.12g %.12g\n", |
465 |
< |
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"); |
461 |
> |
setobj(id); |
462 |
> |
getvertid(v1, fa->farg); |
463 |
> |
getvertid(v2, fa->farg + 3); |
464 |
> |
printf("cyl %s %.12g %s\n", v1, |
465 |
> |
typ[0]=='t' ? -fa->farg[6] : fa->farg[6], v2); |
466 |
|
return(0); |
467 |
|
} |
468 |
|
|
475 |
|
if (fa->nfargs != 8) |
476 |
|
return(-1); |
477 |
|
setmat(mod); |
478 |
< |
printf("o %s\n", id); |
479 |
< |
printf("v cent =\np %.12g %.12g %.12g\n", |
478 |
> |
setobj(id); |
479 |
> |
printf("v cent =\n\tp %.12g %.12g %.12g\n", |
480 |
|
fa->farg[0], fa->farg[1], fa->farg[2]); |
481 |
< |
printf("n %.12g %.12g %.12g\n", |
481 |
> |
printf("\tn %.12g %.12g %.12g\n", |
482 |
|
fa->farg[3], fa->farg[4], fa->farg[5]); |
483 |
|
if (fa->farg[6] < fa->farg[7]) |
484 |
|
printf("ring cent %.12g %.12g\n", |
486 |
|
else |
487 |
|
printf("ring cent %.12g %.12g\n", |
488 |
|
fa->farg[7], fa->farg[6]); |
444 |
– |
puts("o"); |
489 |
|
return(0); |
490 |
|
} |
491 |
|
|
495 |
|
char *mod, *typ, *id; |
496 |
|
FUNARGS *fa; |
497 |
|
{ |
498 |
< |
return(0); /* this is too damned difficult! */ |
498 |
> |
register int i; |
499 |
> |
register char *cp; |
500 |
> |
char *start = NULL, *end = NULL; |
501 |
> |
/* |
502 |
> |
* We don't really know how to do this, so we just create |
503 |
> |
* a reference to an undefined MGF file and it's the user's |
504 |
> |
* responsibility to create this file and put the appropriate |
505 |
> |
* stuff into it. |
506 |
> |
*/ |
507 |
> |
if (fa->nsargs < 1) |
508 |
> |
return(-1); |
509 |
> |
setmat(mod); /* only works if surfaces are void */ |
510 |
> |
setobj(id); |
511 |
> |
for (cp = fa->sarg[0]; *cp; cp++) /* construct MGF file name */ |
512 |
> |
if (*cp == '/') |
513 |
> |
start = cp+1; |
514 |
> |
else if (*cp == '.') |
515 |
> |
end = cp; |
516 |
> |
if (start == NULL) |
517 |
> |
start = fa->sarg[0]; |
518 |
> |
if (end == NULL || start >= end) |
519 |
> |
end = cp; |
520 |
> |
fputs("i ", stdout); /* print include entity */ |
521 |
> |
for (cp = start; cp < end; cp++) |
522 |
> |
putchar(*cp); |
523 |
> |
fputs(".mgf", stdout); /* add MGF suffix */ |
524 |
> |
for (i = 1; i < fa->nsargs; i++) { /* add transform */ |
525 |
> |
putchar(' '); |
526 |
> |
fputs(fa->sarg[i], stdout); |
527 |
> |
} |
528 |
> |
putchar('\n'); |
529 |
> |
clrverts(); /* vertex id's no longer reliable */ |
530 |
> |
return(0); |
531 |
|
} |
532 |
|
|
533 |
|
|
551 |
|
} |
552 |
|
/* else create invisible material */ |
553 |
|
newmat(id, NULL); |
554 |
< |
puts("ts 1 0"); |
554 |
> |
puts("\tts 1 0"); |
555 |
|
return(0); |
556 |
|
} |
557 |
|
|
569 |
|
newmat(id, NULL); |
570 |
|
rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2]; |
571 |
|
rgb_cie(cxyz, rrgb); |
572 |
< |
puts("c"); /* put diffuse component */ |
572 |
> |
puts("\tc"); /* put diffuse component */ |
573 |
|
d = cxyz[0] + cxyz[1] + cxyz[2]; |
574 |
|
if (d > FTINY) |
575 |
< |
printf("cxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
576 |
< |
printf("rd %.4f\n", cxyz[1]*(1. - fa->farg[3])); |
577 |
< |
puts("c"); /* put specular component */ |
578 |
< |
printf("rs %.4f %.4f\n", fa->farg[3], |
579 |
< |
typ[7]=='2' ? .5*(fa->farg[4] + fa->farg[5]) : |
580 |
< |
fa->farg[4]); |
575 |
> |
printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
576 |
> |
printf("\trd %.4f\n", cxyz[1]*(1. - fa->farg[3])); |
577 |
> |
if (fa->farg[3] > FTINY) { /* put specular component */ |
578 |
> |
puts("\tc"); |
579 |
> |
printf("\trs %.4f %.4f\n", fa->farg[3], |
580 |
> |
typ[7]=='2' ? .5*(fa->farg[4] + fa->farg[5]) : |
581 |
> |
fa->farg[4]); |
582 |
> |
} |
583 |
|
return(0); |
584 |
|
} |
585 |
|
|
597 |
|
newmat(id, NULL); |
598 |
|
rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2]; |
599 |
|
rgb_cie(cxyz, rrgb); |
600 |
< |
puts("c"); /* put diffuse component */ |
600 |
> |
puts("\tc"); /* put diffuse component */ |
601 |
|
d = cxyz[0] + cxyz[1] + cxyz[2]; |
602 |
|
if (d > FTINY) |
603 |
< |
printf("cxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
604 |
< |
printf("rd %.4f\n", cxyz[1]*(1. - fa->farg[3])); |
603 |
> |
printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
604 |
> |
printf("\trd %.4f\n", cxyz[1]*(1. - fa->farg[3])); |
605 |
|
/* put specular component */ |
606 |
< |
printf("rs %.4f %.4f\n", cxyz[1]*fa->farg[3], |
606 |
> |
printf("\trs %.4f %.4f\n", cxyz[1]*fa->farg[3], |
607 |
|
typ[5]=='2' ? .5*(fa->farg[4] + fa->farg[5]) : |
608 |
|
fa->farg[4]); |
609 |
|
return(0); |
627 |
|
F = (1. - nrfr)/(1. + nrfr); /* use normal incidence */ |
628 |
|
F *= F; |
629 |
|
for (i = 0; i < 3; i++) { |
630 |
< |
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]) / |
630 |
> |
trgb[i] = fa->farg[i] * (1. - F)*(1. - F) / |
631 |
|
(1. - F*F*fa->farg[i]*fa->farg[i]); |
632 |
+ |
rrgb[i] = F * (1. + (1. - 2.*F)*fa->farg[i]) / |
633 |
+ |
(1. - F*F*fa->farg[i]*fa->farg[i]); |
634 |
|
} |
635 |
|
rgb_cie(cxyz, rrgb); /* put reflected component */ |
636 |
< |
puts("c"); |
636 |
> |
puts("\tc"); |
637 |
|
d = cxyz[0] + cxyz[1] + cxyz[2]; |
638 |
|
if (d > FTINY) |
639 |
< |
printf("cxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
640 |
< |
printf("rs %.4f 0\n", cxyz[1]); |
639 |
> |
printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
640 |
> |
printf("\trs %.4f 0\n", cxyz[1]); |
641 |
|
rgb_cie(cxyz, trgb); /* put transmitted component */ |
642 |
< |
puts("c"); |
642 |
> |
puts("\tc"); |
643 |
|
d = cxyz[0] + cxyz[1] + cxyz[2]; |
644 |
|
if (d > FTINY) |
645 |
< |
printf("cxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
646 |
< |
printf("ts %.4f 0\n", cxyz[1]); |
645 |
> |
printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
646 |
> |
printf("\tts %.4f 0\n", cxyz[1]); |
647 |
|
return(0); |
648 |
|
} |
649 |
|
|
665 |
|
newmat(id, NULL); |
666 |
|
rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2]; |
667 |
|
rgb_cie(cxyz, rrgb); |
668 |
< |
puts("c"); /* put specular component */ |
668 |
> |
puts("\tc"); /* put specular component */ |
669 |
|
d = cxyz[0] + cxyz[1] + cxyz[2]; |
670 |
|
if (d > FTINY) |
671 |
< |
printf("cxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
672 |
< |
printf("rs %.4f 0\n", cxyz[1]); |
671 |
> |
printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
672 |
> |
printf("\trs %.4f 0\n", cxyz[1]); |
673 |
|
return(0); |
674 |
|
} |
675 |
|
|
698 |
|
newmat(id, NULL); |
699 |
|
rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2]; |
700 |
|
rgb_cie(cxyz, rrgb); |
701 |
< |
puts("c"); /* put transmitted diffuse */ |
701 |
> |
puts("\tc"); /* put transmitted diffuse */ |
702 |
|
d = cxyz[0] + cxyz[1] + cxyz[2]; |
703 |
|
if (d > FTINY) |
704 |
< |
printf("cxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
705 |
< |
printf("td %.4f\n", cxyz[1]*trans*(1. - fa->farg[3])*(1. - tspec)); |
704 |
> |
printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
705 |
> |
printf("\ttd %.4f\n", cxyz[1]*trans*(1. - fa->farg[3])*(1. - tspec)); |
706 |
|
/* put transmitted specular */ |
707 |
< |
printf("ts %.4f %.4f\n", cxyz[1]*trans*tspec*(1. - fa->farg[3]), rough); |
707 |
> |
printf("\tts %.4f %.4f\n", cxyz[1]*trans*tspec*(1. - fa->farg[3]), rough); |
708 |
|
/* put reflected diffuse */ |
709 |
< |
printf("rd %.4f\n", cxyz[1]*(1. - fa->farg[3])*(1. - trans)); |
710 |
< |
puts("c"); /* put reflected specular */ |
711 |
< |
printf("rs %.4f %.4f\n", fa->farg[3], rough); |
709 |
> |
printf("\trd %.4f\n", cxyz[1]*(1. - fa->farg[3])*(1. - trans)); |
710 |
> |
puts("\tc"); /* put reflected specular */ |
711 |
> |
printf("\trs %.4f %.4f\n", fa->farg[3], rough); |
712 |
|
return(0); |
713 |
|
} |
714 |
|
|
727 |
|
rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2]; |
728 |
|
rgb_cie(cxyz, rrgb); |
729 |
|
d = cxyz[0] + cxyz[1] + cxyz[2]; |
730 |
< |
puts("c"); |
730 |
> |
puts("\tc"); |
731 |
|
if (d > FTINY) |
732 |
< |
printf("cxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
733 |
< |
printf("ed %.4g\n", cxyz[1]); |
732 |
> |
printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d); |
733 |
> |
printf("\ted %.4g\n", cxyz[1]*(PI*WHTEFFICACY)); |
734 |
|
return(0); |
735 |
|
} |