| 459 |
|
return; |
| 460 |
|
} |
| 461 |
|
} |
| 462 |
< |
if (*cp == '+' || *cp == '-') /* f-stops */ |
| 462 |
> |
if ((*cp == '+') | (*cp == '-')) /* f-stops */ |
| 463 |
|
e *= pow(2.0, atof(cp)); |
| 464 |
|
else /* multiplier */ |
| 465 |
|
e *= atof(cp); |
| 520 |
|
if (sscanf(buf, "%lf", &d0) != 1) |
| 521 |
|
return(0); |
| 522 |
|
} |
| 523 |
< |
if (FABSEQ(ptr->d, d0)) |
| 523 |
> |
if (FRELEQ(ptr->d, d0)) |
| 524 |
|
return(0); |
| 525 |
|
ptr->d = d0; |
| 526 |
|
break; |
| 552 |
|
if (sscanf(buf, "%lf %lf %lf", &d0, &d1, &d2) != 3) |
| 553 |
|
return(0); |
| 554 |
|
} |
| 555 |
< |
if (FABSEQ(colval(ptr->C,RED), d0) && |
| 556 |
< |
FABSEQ(colval(ptr->C,GRN), d1) && |
| 557 |
< |
FABSEQ(colval(ptr->C,BLU), d2)) |
| 555 |
> |
if (FRELEQ(colval(ptr->C,RED), d0) && |
| 556 |
> |
FRELEQ(colval(ptr->C,GRN), d1) && |
| 557 |
> |
FRELEQ(colval(ptr->C,BLU), d2)) |
| 558 |
|
return(0); |
| 559 |
|
setcolor(ptr->C, d0, d1, d2); |
| 560 |
|
break; |
| 588 |
|
case 'l': /* limit */ |
| 589 |
|
switch (s[1]) { |
| 590 |
|
case 'w': /* weight */ |
| 591 |
< |
getparam(s+2, "limit weight", 'r', |
| 592 |
< |
(void *)&minweight); |
| 591 |
> |
getparam(s+2, "limit weight", 'r', &minweight); |
| 592 |
|
break; |
| 593 |
|
case 'r': /* reflection */ |
| 594 |
< |
getparam(s+2, "limit reflection", 'i', |
| 596 |
< |
(void *)&maxdepth); |
| 594 |
> |
getparam(s+2, "limit reflection", 'i', &maxdepth); |
| 595 |
|
break; |
| 596 |
|
default: |
| 597 |
|
goto badparam; |
| 600 |
|
case 'd': /* direct */ |
| 601 |
|
switch (s[1]) { |
| 602 |
|
case 'j': /* jitter */ |
| 603 |
< |
getparam(s+2, "direct jitter", 'r', |
| 606 |
< |
(void *)&dstrsrc); |
| 603 |
> |
getparam(s+2, "direct jitter", 'r', &dstrsrc); |
| 604 |
|
break; |
| 605 |
|
case 'c': /* certainty */ |
| 606 |
< |
getparam(s+2, "direct certainty", 'r', |
| 610 |
< |
(void *)&shadcert); |
| 606 |
> |
getparam(s+2, "direct certainty", 'r', &shadcert); |
| 607 |
|
break; |
| 608 |
|
case 't': /* threshold */ |
| 609 |
< |
getparam(s+2, "direct threshold", 'r', |
| 614 |
< |
(void *)&shadthresh); |
| 609 |
> |
getparam(s+2, "direct threshold", 'r', &shadthresh); |
| 610 |
|
break; |
| 611 |
|
case 'v': /* visibility */ |
| 612 |
< |
getparam(s+2, "direct visibility", 'b', |
| 618 |
< |
(void *)&directvis); |
| 612 |
> |
getparam(s+2, "direct visibility", 'b', &directvis); |
| 613 |
|
break; |
| 614 |
|
case 's': /* sampling */ |
| 615 |
< |
getparam(s+2, "direct sampling", 'r', |
| 622 |
< |
(void *)&srcsizerat); |
| 615 |
> |
getparam(s+2, "direct sampling", 'r', &srcsizerat); |
| 616 |
|
break; |
| 617 |
|
default: |
| 618 |
|
goto badparam; |
| 628 |
|
case ' ': |
| 629 |
|
case 'y': case 'Y': case 't': case 'T': case '1': case '+': |
| 630 |
|
case 'n': case 'N': case 'f': case 'F': case '0': case '-': |
| 631 |
< |
getparam(s+1, "black and white", 'b', |
| 639 |
< |
(void *)&greyscale); |
| 631 |
> |
getparam(s+1, "black and white", 'b', &greyscale); |
| 632 |
|
newparam = prev_newp; |
| 633 |
|
break; |
| 634 |
|
default: |
| 636 |
|
} |
| 637 |
|
break; |
| 638 |
|
case 'i': /* irradiance */ |
| 639 |
< |
getparam(s+1, "irradiance", 'b', |
| 648 |
< |
(void *)&do_irrad); |
| 639 |
> |
getparam(s+1, "irradiance", 'b', &do_irrad); |
| 640 |
|
break; |
| 641 |
|
case 'a': /* ambient */ |
| 642 |
|
switch (s[1]) { |
| 643 |
|
case 'v': /* value */ |
| 644 |
< |
getparam(s+2, "ambient value", 'C', |
| 654 |
< |
(void *)ambval); |
| 644 |
> |
getparam(s+2, "ambient value", 'C', ambval); |
| 645 |
|
break; |
| 646 |
|
case 'w': /* weight */ |
| 647 |
< |
getparam(s+2, "ambient value weight", 'i', |
| 658 |
< |
(void *)&ambvwt); |
| 647 |
> |
getparam(s+2, "ambient value weight", 'i', &ambvwt); |
| 648 |
|
break; |
| 649 |
|
case 'a': /* accuracy */ |
| 650 |
< |
if (getparam(s+2, "ambient accuracy", 'r', |
| 662 |
< |
(void *)&ambacc)) |
| 650 |
> |
if (getparam(s+2, "ambient accuracy", 'r', &ambacc)) |
| 651 |
|
setambacc(ambacc); |
| 652 |
|
break; |
| 653 |
|
case 'd': /* divisions */ |
| 654 |
< |
getparam(s+2, "ambient divisions", 'i', |
| 667 |
< |
(void *)&ambdiv); |
| 654 |
> |
getparam(s+2, "ambient divisions", 'i', &ambdiv); |
| 655 |
|
break; |
| 656 |
|
case 's': /* samples */ |
| 657 |
< |
getparam(s+2, "ambient super-samples", 'i', |
| 671 |
< |
(void *)&ambssamp); |
| 657 |
> |
getparam(s+2, "ambient super-samples", 'i', &ambssamp); |
| 658 |
|
break; |
| 659 |
|
case 'b': /* bounces */ |
| 660 |
< |
getparam(s+2, "ambient bounces", 'i', |
| 675 |
< |
(void *)&ambounce); |
| 660 |
> |
getparam(s+2, "ambient bounces", 'i', &ambounce); |
| 661 |
|
break; |
| 662 |
|
case 'r': |
| 663 |
< |
if (getparam(s+2, "ambient resolution", 'i', |
| 679 |
< |
(void *)&ambres)) |
| 663 |
> |
if (getparam(s+2, "ambient resolution", 'i', &ambres)) |
| 664 |
|
setambres(ambres); |
| 665 |
|
break; |
| 666 |
|
default: |
| 670 |
|
case 'm': /* medium */ |
| 671 |
|
switch (s[1]) { |
| 672 |
|
case 'e': /* extinction coefficient */ |
| 673 |
< |
getparam(s+2, "extinction coefficient", 'C', |
| 690 |
< |
(void *)cextinction); |
| 673 |
> |
getparam(s+2, "extinction coefficient", 'C', cextinction); |
| 674 |
|
break; |
| 675 |
|
case 'a': /* scattering albedo */ |
| 676 |
< |
getparam(s+2, "scattering albedo", 'C', |
| 694 |
< |
(void *)salbedo); |
| 676 |
> |
getparam(s+2, "scattering albedo", 'C', salbedo); |
| 677 |
|
break; |
| 678 |
|
case 'g': /* scattering eccentricity */ |
| 679 |
< |
getparam(s+2, "scattering eccentricity", 'r', |
| 698 |
< |
(void *)&seccg); |
| 679 |
> |
getparam(s+2, "scattering eccentricity", 'r', &seccg); |
| 680 |
|
break; |
| 681 |
|
case 's': /* sampling distance */ |
| 682 |
< |
getparam(s+2, "mist sampling distance", 'r', |
| 702 |
< |
(void *)&ssampdist); |
| 682 |
> |
getparam(s+2, "mist sampling distance", 'r', &ssampdist); |
| 683 |
|
break; |
| 684 |
|
default: |
| 685 |
|
goto badparam; |
| 688 |
|
case 'p': /* pixel */ |
| 689 |
|
switch (s[1]) { |
| 690 |
|
case 's': /* sample */ |
| 691 |
< |
if (getparam(s+2, "pixel sample", 'i', |
| 712 |
< |
(void *)&psample)) |
| 691 |
> |
if (getparam(s+2, "pixel sample", 'i', &psample)) |
| 692 |
|
pdepth = 0; |
| 693 |
|
break; |
| 694 |
|
case 't': /* threshold */ |
| 695 |
< |
if (getparam(s+2, "pixel threshold", 'r', |
| 717 |
< |
(void *)&maxdiff)) |
| 695 |
> |
if (getparam(s+2, "pixel threshold", 'r', &maxdiff)) |
| 696 |
|
pdepth = 0; |
| 697 |
|
break; |
| 698 |
|
default: |
| 703 |
|
case 's': /* specular */ |
| 704 |
|
switch (s[1]) { |
| 705 |
|
case 's': /* sampling */ |
| 706 |
< |
getparam(s+2, "specular sampling", 'r', |
| 729 |
< |
(void *)&specjitter); |
| 706 |
> |
getparam(s+2, "specular sampling", 'r', &specjitter); |
| 707 |
|
break; |
| 708 |
|
case 't': /* threshold */ |
| 709 |
< |
getparam(s+2, "specular threshold", 'r', |
| 733 |
< |
(void *)&specthresh); |
| 709 |
> |
getparam(s+2, "specular threshold", 'r', &specthresh); |
| 710 |
|
break; |
| 711 |
|
default: |
| 712 |
|
goto badparam; |
| 731 |
|
{ |
| 732 |
|
RAY thisray; |
| 733 |
|
char buf[512]; |
| 734 |
+ |
COLOR col; |
| 735 |
|
|
| 736 |
|
thisray.rmax = 0.0; |
| 737 |
|
|
| 791 |
|
if (thisray.rot >= FHUGE*.99) |
| 792 |
|
(*dev->comout)("at infinity"); |
| 793 |
|
else { |
| 794 |
< |
sprintf(buf, "at (%.6g %.6g %.6g) (%.6g)", |
| 794 |
> |
sprintf(buf, "at (%.3f %.3f %.3f) (%.6g)", |
| 795 |
|
thisray.rop[0], thisray.rop[1], |
| 796 |
|
thisray.rop[2], raydistance(&thisray)); |
| 797 |
|
(*dev->comout)(buf); |
| 798 |
|
} |
| 799 |
|
(*dev->comin)(buf, NULL); |
| 800 |
< |
sprintf(buf, "value (%.5g %.5g %.5g) (%.3gL)", |
| 801 |
< |
colval(thisray.rcol,RED), |
| 802 |
< |
colval(thisray.rcol,GRN), |
| 803 |
< |
colval(thisray.rcol,BLU), |
| 804 |
< |
luminance(thisray.rcol)); |
| 800 |
> |
scolor_rgb(col, thisray.rcol); |
| 801 |
> |
sprintf(buf, "value (%.4g %.4g %.4g) (%.3gL)", |
| 802 |
> |
colval(col,RED), |
| 803 |
> |
colval(col,GRN), |
| 804 |
> |
colval(col,BLU), |
| 805 |
> |
luminance(col)); |
| 806 |
|
(*dev->comout)(buf); |
| 807 |
|
} |
| 808 |
|
(*dev->comin)(buf, NULL); |