| 26 |
|
|
| 27 |
|
char ourTempDir[TEMPLEN] = ""; /* our temporary directory */ |
| 28 |
|
|
| 29 |
– |
const FVECT Yaxis = {0., 1., 0.}; |
| 30 |
– |
|
| 29 |
|
const char frpref[] = "frefl"; |
| 30 |
|
const char ftpref[] = "ftrans"; |
| 31 |
|
const char brpref[] = "brefl"; |
| 371 |
|
put_BSDFs(void) |
| 372 |
|
{ |
| 373 |
|
const double scalef = bsdf_rad/(log10(overall_max) - min_log10); |
| 374 |
< |
FVECT ivec, sorg; |
| 374 |
> |
FVECT ivec, sorg, upv; |
| 375 |
|
RREAL vMtx[3][3]; |
| 376 |
|
char *fname; |
| 377 |
|
char cmdbuf[256]; |
| 391 |
|
put_mirror_arrow(ivec, 1); |
| 392 |
|
cvt_sposition(sorg, ivec, 1); |
| 393 |
|
ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; /* normal */ |
| 394 |
+ |
upv[0] = ivec[0]*ivec[1]*(ivec[2] - 1.); |
| 395 |
+ |
upv[1] = ivec[0]*ivec[0] + ivec[1]*ivec[1]*ivec[2]; |
| 396 |
+ |
upv[2] = -ivec[1]*(ivec[0]*ivec[0] + ivec[1]*ivec[1]); |
| 397 |
|
sprintf(xfargs, "-s %f -t %f %f %f", bsdf_rad, |
| 398 |
|
sorg[0], sorg[1], sorg[2]); |
| 399 |
|
nxfa = 6; |
| 401 |
|
printf("%d bsdf_red bsdf_grn bsdf_blu bsdf2rad.cal\n\t%s\n0\n0\n", |
| 402 |
|
4+nxfa, xfargs); |
| 403 |
|
printf("\nscale_pat glow scale_mat\n0\n0\n4 1 1 1 0\n"); |
| 404 |
< |
SDcompXform(vMtx, ivec, Yaxis); |
| 404 |
> |
SDcompXform(vMtx, ivec, upv); |
| 405 |
|
nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]); |
| 406 |
|
sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f", |
| 407 |
|
scalef, sorg[0], sorg[1], sorg[2]); |
| 419 |
|
put_trans_arrow(ivec, 1); |
| 420 |
|
cvt_sposition(sorg, ivec, 1); |
| 421 |
|
ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; /* normal */ |
| 422 |
+ |
upv[0] = ivec[0]*ivec[1]*(ivec[2] - 1.); |
| 423 |
+ |
upv[1] = ivec[0]*ivec[0] + ivec[1]*ivec[1]*ivec[2]; |
| 424 |
+ |
upv[2] = -ivec[1]*(ivec[0]*ivec[0] + ivec[1]*ivec[1]); |
| 425 |
|
sprintf(xfargs, "-s %f -t %f %f %f", bsdf_rad, |
| 426 |
|
sorg[0], sorg[1], sorg[2]); |
| 427 |
|
nxfa = 6; |
| 429 |
|
printf("%d bsdf_red bsdf_grn bsdf_blu bsdf2rad.cal\n\t%s\n0\n0\n", |
| 430 |
|
4+nxfa, xfargs); |
| 431 |
|
printf("\nscale_pat glow scale_mat\n0\n0\n4 1 1 1 0\n"); |
| 432 |
< |
SDcompXform(vMtx, ivec, Yaxis); |
| 432 |
> |
SDcompXform(vMtx, ivec, upv); |
| 433 |
|
nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]); |
| 434 |
|
sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f", |
| 435 |
|
scalef, sorg[0], sorg[1], sorg[2]); |
| 447 |
|
put_mirror_arrow(ivec, -1); |
| 448 |
|
cvt_sposition(sorg, ivec, -1); |
| 449 |
|
ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; /* normal */ |
| 450 |
+ |
upv[0] = ivec[0]*ivec[1]*(ivec[2] - 1.); |
| 451 |
+ |
upv[1] = ivec[0]*ivec[0] + ivec[1]*ivec[1]*ivec[2]; |
| 452 |
+ |
upv[2] = -ivec[1]*(ivec[0]*ivec[0] + ivec[1]*ivec[1]); |
| 453 |
|
sprintf(xfargs, "-s %f -t %f %f %f", bsdf_rad, |
| 454 |
|
sorg[0], sorg[1], sorg[2]); |
| 455 |
|
nxfa = 6; |
| 457 |
|
printf("%d bsdf_red bsdf_grn bsdf_blu bsdf2rad.cal\n\t%s\n0\n0\n", |
| 458 |
|
4+nxfa, xfargs); |
| 459 |
|
printf("\nscale_pat glow scale_mat\n0\n0\n4 1 1 1 0\n"); |
| 460 |
< |
SDcompXform(vMtx, ivec, Yaxis); |
| 460 |
> |
SDcompXform(vMtx, ivec, upv); |
| 461 |
|
nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]); |
| 462 |
|
sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f", |
| 463 |
|
scalef, sorg[0], sorg[1], sorg[2]); |
| 475 |
|
put_trans_arrow(ivec, -1); |
| 476 |
|
cvt_sposition(sorg, ivec, -1); |
| 477 |
|
ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; /* normal */ |
| 478 |
+ |
upv[0] = ivec[0]*ivec[1]*(ivec[2] - 1.); |
| 479 |
+ |
upv[1] = ivec[0]*ivec[0] + ivec[1]*ivec[1]*ivec[2]; |
| 480 |
+ |
upv[2] = -ivec[1]*(ivec[0]*ivec[0] + ivec[1]*ivec[1]); |
| 481 |
|
sprintf(xfargs, "-s %f -t %f %f %f", bsdf_rad, |
| 482 |
|
sorg[0], sorg[1], sorg[2]); |
| 483 |
|
nxfa = 6; |
| 485 |
|
printf("%d bsdf_red bsdf_grn bsdf_blu bsdf2rad.cal\n\t%s\n0\n0\n", |
| 486 |
|
4+nxfa, xfargs); |
| 487 |
|
printf("\nscale_pat glow scale_mat\n0\n0\n4 1 1 1 0\n"); |
| 488 |
< |
SDcompXform(vMtx, ivec, Yaxis); |
| 488 |
> |
SDcompXform(vMtx, ivec, upv); |
| 489 |
|
nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]); |
| 490 |
|
sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f", |
| 491 |
|
scalef, sorg[0], sorg[1], sorg[2]); |
| 528 |
|
break; |
| 529 |
|
} |
| 530 |
|
printf("\n# Actual BSDF material for rendering the hemispheres\n"); |
| 531 |
< |
printf("\nvoid BSDF BSDFmat\n6 0 \"%s%s\" 0 1 0 .\n0\n0\n", |
| 531 |
> |
printf("\nvoid BSDF BSDFmat\n6 0 \"%s%s\" upx upy upz bsdf2rad.cal\n0\n0\n", |
| 532 |
|
curdir, XMLfile); |
| 533 |
|
printf("\nvoid plastic black\n0\n0\n5 0 0 0 0 0\n"); |
| 534 |
|
printf("\nvoid mixfunc %s\n4 BSDFmat black latlong bsdf2rad.cal\n0\n0\n", |
| 550 |
|
static void |
| 551 |
|
put_hemispheres(void) |
| 552 |
|
{ |
| 553 |
+ |
const int nsegs = 131; |
| 554 |
+ |
|
| 555 |
|
printf("\n# Hemisphere(s) for showing BSDF appearance (if XML file)\n"); |
| 544 |
– |
printf("\nvoid antimatter anti_sph\n2 void %s\n0\n0\n", sph_mat); |
| 556 |
|
if (front_comp) { |
| 557 |
< |
printf("\n%s sphere Front\n0\n0\n4 %f 0 0 %f\n", |
| 558 |
< |
sph_mat, sph_xoffset, sph_rad); |
| 559 |
< |
printf("\n!genbox anti_sph sph_eraser %f %f %f | xform -t %f %f %f\n", |
| 549 |
< |
2.02*sph_rad, 2.02*sph_rad, 1.02*sph_rad, |
| 550 |
< |
-1.01*sph_rad + sph_xoffset, -1.01*sph_rad, -1.01*sph_rad); |
| 557 |
> |
printf( |
| 558 |
> |
"\n!genrev %s Front \"R*sin(A*t)\" \"R*cos(A*t)\" %d -e \"R:%g;A:%f\" -s | xform -t %g 0 0\n", |
| 559 |
> |
sph_mat, nsegs, sph_rad, 0.495*PI, sph_xoffset); |
| 560 |
|
printf("\nvoid brighttext front_text\n3 helvet.fnt . FRONT\n0\n"); |
| 561 |
|
printf("12\n\t%f %f 0\n\t%f 0 0\n\t0 %f 0\n\t.01 1 -.1\n", |
| 562 |
|
-.22*sph_rad + sph_xoffset, -1.4*sph_rad, |
| 570 |
|
.25*sph_rad + sph_xoffset, -1.3*sph_rad ); |
| 571 |
|
} |
| 572 |
|
if (back_comp) { |
| 573 |
< |
printf("\n%s bubble Back\n0\n0\n4 %f 0 0 %f\n", |
| 574 |
< |
sph_mat, -sph_xoffset, sph_rad); |
| 575 |
< |
printf("\n!genbox anti_sph sph_eraser %f %f %f | xform -t %f %f %f\n", |
| 567 |
< |
2.02*sph_rad, 2.02*sph_rad, 1.02*sph_rad, |
| 568 |
< |
-1.01*sph_rad - sph_xoffset, -1.01*sph_rad, -1.01*sph_rad); |
| 573 |
> |
printf( |
| 574 |
> |
"\n!genrev %s Back \"R*cos(A*t)\" \"R*sin(A*t)\" %d -e \"R:%g;A:%f\" -s | xform -t %g 0 0\n", |
| 575 |
> |
sph_mat, nsegs, sph_rad, 0.495*PI, -sph_xoffset); |
| 576 |
|
printf("\nvoid brighttext back_text\n3 helvet.fnt . BACK\n0\n"); |
| 577 |
|
printf("12\n\t%f %f 0\n\t%f 0 0\n\t0 %f 0\n\t.01 1 -.1\n", |
| 578 |
|
-.22*sph_rad - sph_xoffset, -1.4*sph_rad, |