13 |
|
#include "resolu.h" |
14 |
|
#include "bsdfrep.h" |
15 |
|
|
16 |
< |
#define NINCIDENT 25 /* number of samples/hemisphere */ |
16 |
> |
#define NINCIDENT 37 /* number of samples/hemisphere */ |
17 |
|
|
18 |
|
#define GRIDSTEP 2 /* our grid step size */ |
19 |
|
#define SAMPRES (GRIDRES/GRIDSTEP) |
26 |
|
|
27 |
|
char ourTempDir[TEMPLEN] = ""; /* our temporary directory */ |
28 |
|
|
29 |
– |
const FVECT Xaxis = {1., 0., 0.}; |
30 |
– |
const FVECT Yaxis = {0., 1., 0.}; |
31 |
– |
const FVECT Zaxis = {0., 0., 1.}; |
32 |
– |
|
29 |
|
const char frpref[] = "frefl"; |
30 |
|
const char ftpref[] = "ftrans"; |
31 |
|
const char brpref[] = "brefl"; |
32 |
|
const char btpref[] = "btrans"; |
33 |
|
const char dsuffix[] = ".txt"; |
34 |
|
|
35 |
< |
const char sph_mat[] = "BSDFmat"; |
35 |
> |
const char sph_fmat[] = "fBSDFmat"; |
36 |
> |
const char sph_bmat[] = "bBSDFmat"; |
37 |
|
const double sph_rad = 10.; |
38 |
|
const double sph_xoffset = 15.; |
39 |
|
|
47 |
|
char *progname; |
48 |
|
|
49 |
|
/* Get Fibonacci sphere vector (0 to NINCIDENT-1) */ |
50 |
< |
static void |
50 |
> |
static RREAL * |
51 |
|
get_ivector(FVECT iv, int i) |
52 |
|
{ |
56 |
– |
const double zstep = 1./(2*NINCIDENT-1); |
53 |
|
const double phistep = PI*(3. - 2.236067978); |
54 |
|
double r; |
55 |
|
|
56 |
< |
iv[2] = 1. - (i+.5)*zstep; |
56 |
> |
iv[2] = 1. - (i+.5)*(1./NINCIDENT); |
57 |
|
r = sqrt(1. - iv[2]*iv[2]); |
58 |
|
iv[0] = r * cos((i+1.)*phistep); |
59 |
|
iv[1] = r * sin((i+1.)*phistep); |
60 |
+ |
|
61 |
+ |
return(iv); |
62 |
|
} |
63 |
|
|
64 |
+ |
/* Convert incident vector into sphere position */ |
65 |
+ |
static RREAL * |
66 |
+ |
cvt_sposition(FVECT sp, const FVECT iv, int inc_side) |
67 |
+ |
{ |
68 |
+ |
sp[0] = -iv[0]*sph_rad + inc_side*sph_xoffset; |
69 |
+ |
sp[1] = -iv[1]*sph_rad; |
70 |
+ |
sp[2] = iv[2]*sph_rad; |
71 |
+ |
|
72 |
+ |
return(sp); |
73 |
+ |
} |
74 |
+ |
|
75 |
|
/* Get temporary file name */ |
76 |
|
static char * |
77 |
|
tfile_name(const char *prefix, const char *suffix, int i) |
258 |
|
RBFNODE *rbf; |
259 |
|
get_ivector(ivec, i); |
260 |
|
if (input_orient < 0) { |
261 |
< |
ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; ivec[2] = -ivec[2]; |
261 |
> |
ivec[0] = -ivec[0]; ivec[2] = -ivec[2]; |
262 |
|
} |
263 |
|
rbf = advect_rbf(ivec, 15000); |
264 |
|
if (!plotRBF(tfile_name(pref, dsuffix, i), rbf)) |
277 |
|
FVECT origin, refl; |
278 |
|
int i; |
279 |
|
|
280 |
< |
for (i = 3; i--; ) origin[i] = ivec[i]*sph_rad; |
272 |
< |
origin[0] -= inc_side*sph_xoffset; |
280 |
> |
cvt_sposition(origin, ivec, inc_side); |
281 |
|
|
282 |
< |
refl[0] = 2.*ivec[2]*ivec[0]; |
283 |
< |
refl[1] = 2.*ivec[2]*ivec[1]; |
282 |
> |
refl[0] = -2.*ivec[2]*ivec[0]; |
283 |
> |
refl[1] = -2.*ivec[2]*ivec[1]; |
284 |
|
refl[2] = 2.*ivec[2]*ivec[2] - 1.; |
285 |
|
|
286 |
|
printf("\n# Mirror arrow\n"); |
316 |
|
FVECT origin; |
317 |
|
int i; |
318 |
|
|
319 |
< |
for (i = 3; i--; ) origin[i] = ivec[i]*sph_rad; |
312 |
< |
origin[0] -= inc_side*sph_xoffset; |
319 |
> |
cvt_sposition(origin, ivec, inc_side); |
320 |
|
|
321 |
|
printf("\n# Transmission arrow\n"); |
322 |
|
printf("\narrow_mat cylinder trans_dir\n0\n0\n7"); |
372 |
|
put_BSDFs(void) |
373 |
|
{ |
374 |
|
const double scalef = bsdf_rad/(log10(overall_max) - min_log10); |
375 |
< |
FVECT ivec; |
375 |
> |
FVECT ivec, sorg, upv; |
376 |
|
RREAL vMtx[3][3]; |
377 |
|
char *fname; |
378 |
|
char cmdbuf[256]; |
384 |
|
NINCIDENT); |
385 |
|
|
386 |
|
printf("\nvoid glow arrow_glow\n0\n0\n4 1 0 1 0\n"); |
387 |
< |
printf("\nvoid mixfunc arrow_mat\n4 arrow_glow void .5 .\n0\n0\n"); |
387 |
> |
printf("\nvoid mixfunc arrow_mat\n4 arrow_glow void 0.25 .\n0\n0\n"); |
388 |
|
|
389 |
< |
if (front_comp & SDsampR) |
389 |
> |
if (front_comp & SDsampR) /* front reflection */ |
390 |
|
for (i = 0; i < NINCIDENT; i++) { |
391 |
|
get_ivector(ivec, i); |
392 |
|
put_mirror_arrow(ivec, 1); |
393 |
+ |
cvt_sposition(sorg, ivec, 1); |
394 |
+ |
ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; /* normal */ |
395 |
+ |
upv[0] = ivec[0]*ivec[1]*(ivec[2] - 1.); |
396 |
+ |
upv[1] = ivec[0]*ivec[0] + ivec[1]*ivec[1]*ivec[2]; |
397 |
+ |
upv[2] = -ivec[1]*(ivec[0]*ivec[0] + ivec[1]*ivec[1]); |
398 |
|
sprintf(xfargs, "-s %f -t %f %f %f", bsdf_rad, |
399 |
< |
ivec[0]*sph_rad - sph_xoffset, |
388 |
< |
ivec[1]*sph_rad, ivec[2]*sph_rad); |
399 |
> |
sorg[0], sorg[1], sorg[2]); |
400 |
|
nxfa = 6; |
401 |
|
printf("\nvoid colorfunc scale_pat\n"); |
402 |
|
printf("%d bsdf_red bsdf_grn bsdf_blu bsdf2rad.cal\n\t%s\n0\n0\n", |
403 |
|
4+nxfa, xfargs); |
404 |
|
printf("\nscale_pat glow scale_mat\n0\n0\n4 1 1 1 0\n"); |
405 |
< |
SDcompXform(vMtx, ivec, Yaxis); |
405 |
> |
if (SDcompXform(vMtx, ivec, upv) != SDEnone) |
406 |
> |
continue; |
407 |
|
nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]); |
408 |
|
sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f", |
409 |
< |
scalef, ivec[0]*sph_rad - sph_xoffset, |
398 |
< |
ivec[1]*sph_rad, ivec[2]*sph_rad); |
409 |
> |
scalef, sorg[0], sorg[1], sorg[2]); |
410 |
|
nxfa += 6; |
411 |
|
fname = tfile_name(frpref, dsuffix, i); |
412 |
< |
sprintf(cmdbuf, "gensurf scale_mat %s%d %s %s %s %d %d | xform -mx -my %s", |
413 |
< |
frpref, i+1, fname, fname, fname, SAMPRES-1, SAMPRES-1, |
412 |
> |
sprintf(cmdbuf, "gensurf scale_mat %s%d %s %s %s %d %d | xform %s", |
413 |
> |
frpref, i, fname, fname, fname, SAMPRES-1, SAMPRES-1, |
414 |
|
xfargs); |
415 |
|
if (!run_cmd(cmdbuf)) |
416 |
|
return(0); |
417 |
|
} |
418 |
< |
if (front_comp & SDsampT) |
418 |
> |
if (front_comp & SDsampT) /* front transmission */ |
419 |
|
for (i = 0; i < NINCIDENT; i++) { |
420 |
|
get_ivector(ivec, i); |
421 |
|
put_trans_arrow(ivec, 1); |
422 |
+ |
cvt_sposition(sorg, ivec, 1); |
423 |
+ |
ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; /* normal */ |
424 |
+ |
upv[0] = ivec[0]*ivec[1]*(ivec[2] - 1.); |
425 |
+ |
upv[1] = ivec[0]*ivec[0] + ivec[1]*ivec[1]*ivec[2]; |
426 |
+ |
upv[2] = -ivec[1]*(ivec[0]*ivec[0] + ivec[1]*ivec[1]); |
427 |
|
sprintf(xfargs, "-s %f -t %f %f %f", bsdf_rad, |
428 |
< |
ivec[0]*sph_rad - sph_xoffset, |
413 |
< |
ivec[1]*sph_rad, ivec[2]*sph_rad); |
428 |
> |
sorg[0], sorg[1], sorg[2]); |
429 |
|
nxfa = 6; |
430 |
|
printf("\nvoid colorfunc scale_pat\n"); |
431 |
|
printf("%d bsdf_red bsdf_grn bsdf_blu bsdf2rad.cal\n\t%s\n0\n0\n", |
432 |
|
4+nxfa, xfargs); |
433 |
|
printf("\nscale_pat glow scale_mat\n0\n0\n4 1 1 1 0\n"); |
434 |
< |
SDcompXform(vMtx, ivec, Yaxis); |
434 |
> |
if (SDcompXform(vMtx, ivec, upv) != SDEnone) |
435 |
> |
continue; |
436 |
|
nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]); |
437 |
|
sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f", |
438 |
< |
scalef, ivec[0]*sph_rad - sph_xoffset, |
423 |
< |
ivec[1]*sph_rad, ivec[2]*sph_rad); |
438 |
> |
scalef, sorg[0], sorg[1], sorg[2]); |
439 |
|
nxfa += 6; |
440 |
|
fname = tfile_name(ftpref, dsuffix, i); |
441 |
< |
sprintf(cmdbuf, "gensurf scale_mat %s%d %s %s %s %d %d | xform -I -mx -my %s", |
442 |
< |
ftpref, i+1, fname, fname, fname, SAMPRES-1, SAMPRES-1, |
441 |
> |
sprintf(cmdbuf, "gensurf scale_mat %s%d %s %s %s %d %d | xform -I %s", |
442 |
> |
ftpref, i, fname, fname, fname, SAMPRES-1, SAMPRES-1, |
443 |
|
xfargs); |
444 |
|
if (!run_cmd(cmdbuf)) |
445 |
|
return(0); |
446 |
|
} |
447 |
< |
if (back_comp & SDsampR) |
447 |
> |
if (back_comp & SDsampR) /* rear reflection */ |
448 |
|
for (i = 0; i < NINCIDENT; i++) { |
449 |
|
get_ivector(ivec, i); |
450 |
|
put_mirror_arrow(ivec, -1); |
451 |
< |
fname = tfile_name(brpref, dsuffix, i); |
451 |
> |
cvt_sposition(sorg, ivec, -1); |
452 |
> |
ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; /* normal */ |
453 |
> |
upv[0] = ivec[0]*ivec[1]*(ivec[2] - 1.); |
454 |
> |
upv[1] = ivec[0]*ivec[0] + ivec[1]*ivec[1]*ivec[2]; |
455 |
> |
upv[2] = -ivec[1]*(ivec[0]*ivec[0] + ivec[1]*ivec[1]); |
456 |
|
sprintf(xfargs, "-s %f -t %f %f %f", bsdf_rad, |
457 |
< |
ivec[0]*sph_rad + sph_xoffset, |
439 |
< |
ivec[1]*sph_rad, ivec[2]*sph_rad); |
457 |
> |
sorg[0], sorg[1], sorg[2]); |
458 |
|
nxfa = 6; |
459 |
|
printf("\nvoid colorfunc scale_pat\n"); |
460 |
|
printf("%d bsdf_red bsdf_grn bsdf_blu bsdf2rad.cal\n\t%s\n0\n0\n", |
461 |
|
4+nxfa, xfargs); |
462 |
|
printf("\nscale_pat glow scale_mat\n0\n0\n4 1 1 1 0\n"); |
463 |
< |
SDcompXform(vMtx, ivec, Yaxis); |
463 |
> |
if (SDcompXform(vMtx, ivec, upv) != SDEnone) |
464 |
> |
continue; |
465 |
|
nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]); |
466 |
|
sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f", |
467 |
< |
scalef, ivec[0]*sph_rad + sph_xoffset, |
449 |
< |
ivec[1]*sph_rad, ivec[2]*sph_rad); |
467 |
> |
scalef, sorg[0], sorg[1], sorg[2]); |
468 |
|
nxfa += 6; |
469 |
|
fname = tfile_name(brpref, dsuffix, i); |
470 |
< |
sprintf(cmdbuf, "gensurf scale_mat %s%d %s %s %s %d %d | xform -I -ry 180 -mx -my %s", |
471 |
< |
brpref, i+1, fname, fname, fname, SAMPRES-1, SAMPRES-1, |
470 |
> |
sprintf(cmdbuf, "gensurf scale_mat %s%d %s %s %s %d %d | xform -I -ry 180 %s", |
471 |
> |
brpref, i, fname, fname, fname, SAMPRES-1, SAMPRES-1, |
472 |
|
xfargs); |
473 |
|
if (!run_cmd(cmdbuf)) |
474 |
|
return(0); |
475 |
|
} |
476 |
< |
if (back_comp & SDsampT) |
476 |
> |
if (back_comp & SDsampT) /* rear transmission */ |
477 |
|
for (i = 0; i < NINCIDENT; i++) { |
478 |
|
get_ivector(ivec, i); |
479 |
|
put_trans_arrow(ivec, -1); |
480 |
< |
fname = tfile_name(btpref, dsuffix, i); |
480 |
> |
cvt_sposition(sorg, ivec, -1); |
481 |
> |
ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; /* normal */ |
482 |
> |
upv[0] = ivec[0]*ivec[1]*(ivec[2] - 1.); |
483 |
> |
upv[1] = ivec[0]*ivec[0] + ivec[1]*ivec[1]*ivec[2]; |
484 |
> |
upv[2] = -ivec[1]*(ivec[0]*ivec[0] + ivec[1]*ivec[1]); |
485 |
|
sprintf(xfargs, "-s %f -t %f %f %f", bsdf_rad, |
486 |
< |
ivec[0]*sph_rad + sph_xoffset, |
465 |
< |
ivec[1]*sph_rad, ivec[2]*sph_rad); |
486 |
> |
sorg[0], sorg[1], sorg[2]); |
487 |
|
nxfa = 6; |
488 |
|
printf("\nvoid colorfunc scale_pat\n"); |
489 |
|
printf("%d bsdf_red bsdf_grn bsdf_blu bsdf2rad.cal\n\t%s\n0\n0\n", |
490 |
|
4+nxfa, xfargs); |
491 |
|
printf("\nscale_pat glow scale_mat\n0\n0\n4 1 1 1 0\n"); |
492 |
< |
SDcompXform(vMtx, ivec, Yaxis); |
492 |
> |
if (SDcompXform(vMtx, ivec, upv) != SDEnone) |
493 |
> |
continue; |
494 |
|
nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]); |
495 |
|
sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f", |
496 |
< |
scalef, ivec[0]*sph_rad + sph_xoffset, |
475 |
< |
ivec[1]*sph_rad, ivec[2]*sph_rad); |
496 |
> |
scalef, sorg[0], sorg[1], sorg[2]); |
497 |
|
nxfa += 6; |
498 |
|
fname = tfile_name(btpref, dsuffix, i); |
499 |
< |
sprintf(cmdbuf, "gensurf scale_mat %s%d %s %s %s %d %d | xform -ry 180 -mx -my %s", |
500 |
< |
btpref, i+1, fname, fname, fname, SAMPRES-1, SAMPRES-1, |
499 |
> |
sprintf(cmdbuf, "gensurf scale_mat %s%d %s %s %s %d %d | xform -ry 180 %s", |
500 |
> |
btpref, i, fname, fname, fname, SAMPRES-1, SAMPRES-1, |
501 |
|
xfargs); |
502 |
|
if (!run_cmd(cmdbuf)) |
503 |
|
return(0); |
515 |
|
printf("\n# Simplified material because we have no XML input\n"); |
516 |
|
printf("\nvoid brightfunc latlong\n2 latlong bsdf2rad.cal\n0\n0\n"); |
517 |
|
if ((front_comp|back_comp) & SDsampT) |
518 |
< |
printf("\nlatlong trans %s\n0\n0\n7 .75 .75 .75 0 0 .5 .8\n", |
519 |
< |
sph_mat); |
518 |
> |
printf("\nlatlong trans %s\n0\n0\n7 .75 .75 .75 0 .04 .5 .8\n", |
519 |
> |
sph_fmat); |
520 |
|
else |
521 |
|
printf("\nlatlong plastic %s\n0\n0\n5 .5 .5 .5 0 0\n", |
522 |
< |
sph_mat); |
522 |
> |
sph_fmat); |
523 |
> |
printf("\ninherit alias %s %s\n", sph_bmat, sph_fmat); |
524 |
|
return; |
525 |
|
} |
526 |
|
switch (XMLfile[0]) { /* avoid RAYPATH search */ |
533 |
|
exit(1); |
534 |
|
break; |
535 |
|
} |
536 |
< |
printf("\n# Actual BSDF material for rendering the hemispheres\n"); |
537 |
< |
printf("\nvoid BSDF BSDFmat\n6 0 \"%s%s\" 0 1 0 .\n0\n0\n", |
536 |
> |
printf("\n# Actual BSDF materials for rendering the hemispheres\n"); |
537 |
> |
printf("\nvoid BSDF BSDF_f\n6 0 \"%s%s\" upx upy upz bsdf2rad.cal\n0\n0\n", |
538 |
|
curdir, XMLfile); |
539 |
|
printf("\nvoid plastic black\n0\n0\n5 0 0 0 0 0\n"); |
540 |
< |
printf("\nvoid mixfunc %s\n4 BSDFmat black latlong bsdf2rad.cal\n0\n0\n", |
541 |
< |
sph_mat); |
540 |
> |
printf("\nvoid mixfunc %s\n4 BSDF_f black latlong bsdf2rad.cal\n0\n0\n", |
541 |
> |
sph_fmat); |
542 |
> |
printf("\nvoid BSDF BSDF_b\n8 0 \"%s%s\" upx upy upz bsdf2rad.cal -ry 180\n0\n0\n", |
543 |
> |
curdir, XMLfile); |
544 |
> |
printf("\nvoid mixfunc %s\n4 BSDF_b black latlong bsdf2rad.cal\n0\n0\n", |
545 |
> |
sph_bmat); |
546 |
|
} |
547 |
|
|
548 |
|
/* Put out overhead parallel light source */ |
550 |
|
put_source(void) |
551 |
|
{ |
552 |
|
printf("\n# Overhead parallel light source\n"); |
553 |
< |
printf("\nvoid light bright\n0\n0\n3 2000 2000 2000\n"); |
553 |
> |
printf("\nvoid light bright\n0\n0\n3 2500 2500 2500\n"); |
554 |
|
printf("\nbright source light\n0\n0\n4 0 0 1 2\n"); |
555 |
|
printf("\n# Material used for labels\n"); |
556 |
|
printf("\nvoid trans vellum\n0\n0\n7 1 1 1 0 0 .5 0\n"); |
560 |
|
static void |
561 |
|
put_hemispheres(void) |
562 |
|
{ |
563 |
+ |
const int nsegs = 131; |
564 |
+ |
|
565 |
|
printf("\n# Hemisphere(s) for showing BSDF appearance (if XML file)\n"); |
538 |
– |
printf("\nvoid antimatter anti_sph\n2 void %s\n0\n0\n", sph_mat); |
566 |
|
if (front_comp) { |
567 |
< |
printf("\n%s sphere Front\n0\n0\n4 %f 0 0 %f\n", |
568 |
< |
sph_mat, -sph_xoffset, sph_rad); |
569 |
< |
printf("\n!genbox anti_sph sph_eraser %f %f %f | xform -t %f %f %f\n", |
543 |
< |
2.02*sph_rad, 2.02*sph_rad, 1.02*sph_rad, |
544 |
< |
-1.01*sph_rad - sph_xoffset, -1.01*sph_rad, -1.01*sph_rad); |
567 |
> |
printf( |
568 |
> |
"\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", |
569 |
> |
sph_fmat, nsegs, sph_rad, 0.495*PI, sph_xoffset); |
570 |
|
printf("\nvoid brighttext front_text\n3 helvet.fnt . FRONT\n0\n"); |
571 |
|
printf("12\n\t%f %f 0\n\t%f 0 0\n\t0 %f 0\n\t.01 1 -.1\n", |
572 |
< |
-.22*sph_rad - sph_xoffset, -1.2*sph_rad, |
572 |
> |
-.22*sph_rad + sph_xoffset, -1.4*sph_rad, |
573 |
|
.35/5.*sph_rad, -1.6*.35/5.*sph_rad); |
574 |
|
printf("\nfront_text alias front_label_mat vellum\n"); |
575 |
|
printf("\nfront_label_mat polygon front_label\n0\n0\n12"); |
576 |
|
printf("\n\t%f %f 0\n\t%f %f 0\n\t%f %f 0\n\t%f %f 0\n", |
577 |
< |
-.25*sph_rad - sph_xoffset, -1.1*sph_rad, |
578 |
< |
-.25*sph_rad - sph_xoffset, (-1.2-1.6*.35/5.-.1)*sph_rad, |
579 |
< |
.25*sph_rad - sph_xoffset, (-1.2-1.6*.35/5.-.1)*sph_rad, |
580 |
< |
.25*sph_rad - sph_xoffset, -1.1*sph_rad ); |
577 |
> |
-.25*sph_rad + sph_xoffset, -1.3*sph_rad, |
578 |
> |
-.25*sph_rad + sph_xoffset, (-1.4-1.6*.35/5.-.1)*sph_rad, |
579 |
> |
.25*sph_rad + sph_xoffset, (-1.4-1.6*.35/5.-.1)*sph_rad, |
580 |
> |
.25*sph_rad + sph_xoffset, -1.3*sph_rad ); |
581 |
|
} |
582 |
|
if (back_comp) { |
583 |
< |
printf("\n%s bubble Back\n0\n0\n4 %f 0 0 %f\n", |
584 |
< |
sph_mat, sph_xoffset, sph_rad); |
585 |
< |
printf("\n!genbox anti_sph sph_eraser %f %f %f | xform -t %f %f %f\n", |
561 |
< |
2.02*sph_rad, 2.02*sph_rad, 1.02*sph_rad, |
562 |
< |
-1.01*sph_rad + sph_xoffset, -1.01*sph_rad, -1.01*sph_rad); |
583 |
> |
printf( |
584 |
> |
"\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", |
585 |
> |
sph_bmat, nsegs, sph_rad, 0.495*PI, -sph_xoffset); |
586 |
|
printf("\nvoid brighttext back_text\n3 helvet.fnt . BACK\n0\n"); |
587 |
|
printf("12\n\t%f %f 0\n\t%f 0 0\n\t0 %f 0\n\t.01 1 -.1\n", |
588 |
< |
-.22*sph_rad + sph_xoffset, -1.2*sph_rad, |
588 |
> |
-.22*sph_rad - sph_xoffset, -1.4*sph_rad, |
589 |
|
.35/4.*sph_rad, -1.6*.35/4.*sph_rad); |
590 |
|
printf("\nback_text alias back_label_mat vellum\n"); |
591 |
|
printf("\nback_label_mat polygon back_label\n0\n0\n12"); |
592 |
|
printf("\n\t%f %f 0\n\t%f %f 0\n\t%f %f 0\n\t%f %f 0\n", |
593 |
< |
-.25*sph_rad + sph_xoffset, -1.1*sph_rad, |
594 |
< |
-.25*sph_rad + sph_xoffset, (-1.2-1.6*.35/4.-.1)*sph_rad, |
595 |
< |
.25*sph_rad + sph_xoffset, (-1.2-1.6*.35/4.-.1)*sph_rad, |
596 |
< |
.25*sph_rad + sph_xoffset, -1.1*sph_rad ); |
593 |
> |
-.25*sph_rad - sph_xoffset, -1.3*sph_rad, |
594 |
> |
-.25*sph_rad - sph_xoffset, (-1.4-1.6*.35/4.-.1)*sph_rad, |
595 |
> |
.25*sph_rad - sph_xoffset, (-1.4-1.6*.35/4.-.1)*sph_rad, |
596 |
> |
.25*sph_rad - sph_xoffset, -1.3*sph_rad ); |
597 |
|
} |
598 |
|
} |
599 |
|
|
602 |
|
put_scale(void) |
603 |
|
{ |
604 |
|
const double max_log10 = log10(overall_max); |
605 |
< |
const double leg_width = 2.*.75*(sph_xoffset - sph_rad); |
605 |
> |
const double leg_width = 2.*.75*(fabs(sph_xoffset) - sph_rad); |
606 |
|
const double leg_height = 2.*sph_rad; |
607 |
|
const int text_lines = 6; |
608 |
|
const int text_digits = 8; |
646 |
|
return; |
647 |
|
printf("\nvoid brighttext BSDFname\n3 helvet.fnt . \"%s\"\n0\n12\n", bsdf_name); |
648 |
|
printf("\t%f %f 0\n", -.95*leg_width, -.6*leg_height); |
649 |
< |
printf("\t%f 0 0\n", .4/strlen(bsdf_name)*leg_width); |
649 |
> |
printf("\t%f 0 0\n", 1.8/strlen(bsdf_name)*leg_width); |
650 |
|
printf("\t0 %f 0\n", -.1*leg_height); |
651 |
|
printf("\t.01 1 -.1\n"); |
652 |
|
printf("\nBSDFname alias name_mat vellum\n"); |
701 |
|
sprintf(cmdbuf, "xform -t %f %f %f -s %f -t %f %f 0 %s", |
702 |
|
-.5*(xmin+xmax), -.5*(ymin+ymax), -zmax, |
703 |
|
1.5*sph_rad/max_dim, |
704 |
< |
-sph_xoffset, -2.5*sph_rad, |
704 |
> |
sph_xoffset, -2.5*sph_rad, |
705 |
|
radfn); |
706 |
|
if (!run_cmd(cmdbuf)) |
707 |
|
return; |
711 |
|
sprintf(cmdbuf, "xform -t %f %f %f -s %f -ry 180 -t %f %f 0 %s", |
712 |
|
-.5*(xmin+xmax), -.5*(ymin+ymax), -zmin, |
713 |
|
1.5*sph_rad/max_dim, |
714 |
< |
sph_xoffset, -2.5*sph_rad, |
714 |
> |
-sph_xoffset, -2.5*sph_rad, |
715 |
|
radfn); |
716 |
|
if (!run_cmd(cmdbuf)) |
717 |
|
return; |