319 |
|
} |
320 |
|
else raytexture(rayIn, mat -> omod); |
321 |
|
|
322 |
+ |
nd.mp = mat; |
323 |
|
nd.rp = rayIn; |
324 |
|
|
325 |
|
/* Get material color */ |
481 |
|
|
482 |
|
|
483 |
|
|
484 |
< |
static void getacoords (ANISODAT *np) |
484 |
> |
static void getacoords (ANISODAT *nd) |
485 |
|
/* Set up coordinate system for anisotropic sampling; cloned from aniso.c */ |
486 |
|
{ |
487 |
< |
MFUNC *mf; |
488 |
< |
int i; |
487 |
> |
MFUNC *mf; |
488 |
> |
int i; |
489 |
|
|
490 |
< |
mf = getfunc(np->mp, 3, 0x7, 1); |
491 |
< |
setfunc(np->mp, np->rp); |
490 |
> |
mf = getfunc(nd -> mp, 3, 0x7, 1); |
491 |
> |
setfunc(nd -> mp, nd -> rp); |
492 |
|
errno = 0; |
493 |
|
|
494 |
|
for (i = 0; i < 3; i++) |
495 |
< |
np->u[i] = evalue(mf->ep[i]); |
495 |
> |
nd -> u [i] = evalue(mf -> ep [i]); |
496 |
|
|
497 |
< |
if ((errno == EDOM) | (errno == ERANGE)) { |
498 |
< |
objerror(np->mp, WARNING, "compute error"); |
498 |
< |
np->specfl |= SP_BADU; |
499 |
< |
return; |
500 |
< |
} |
501 |
< |
|
502 |
< |
if (mf->fxp != &unitxf) |
503 |
< |
multv3(np->u, np->u, mf->fxp->xfm); |
497 |
> |
if (errno == EDOM || errno == ERANGE) |
498 |
> |
nd -> u [0] = nd -> u [1] = nd -> u [2] = 0.0; |
499 |
|
|
500 |
< |
fcross(np->v, np->pnorm, np->u); |
500 |
> |
if (mf -> fxp != &unitxf) |
501 |
> |
multv3(nd -> u, nd -> u, mf -> fxp -> xfm); |
502 |
|
|
503 |
< |
if (normalize(np->v) == 0.0) { |
508 |
< |
objerror(np->mp, WARNING, "illegal orientation vector"); |
509 |
< |
np->specfl |= SP_BADU; |
510 |
< |
return; |
511 |
< |
} |
503 |
> |
fcross(nd -> v, nd -> pnorm, nd -> u); |
504 |
|
|
505 |
< |
fcross(np->u, np->v, np->pnorm); |
505 |
> |
if (normalize(nd -> v) == 0.0) { |
506 |
> |
if (fabs(nd -> u_alpha - nd -> v_alpha) > 0.001) |
507 |
> |
objerror(nd -> mp, WARNING, "illegal orientation vector"); |
508 |
> |
getperpendicular(nd -> u, nd -> pnorm, 1); |
509 |
> |
fcross(nd -> v, nd -> pnorm, nd -> u); |
510 |
> |
nd -> u_alpha = nd -> v_alpha = |
511 |
> |
sqrt(0.5 * (sqr(nd -> u_alpha) + sqr(nd -> v_alpha))); |
512 |
> |
} |
513 |
> |
else fcross(nd -> u, nd -> v, nd -> pnorm); |
514 |
|
} |
515 |
|
|
516 |
|
|
616 |
|
if (mat -> oargs.nfargs != (mat -> otype == MAT_TRANS2 ? 8 : 6)) |
617 |
|
objerror(mat, USER, "bad number of real arguments"); |
618 |
|
|
619 |
+ |
nd.mp = mat; |
620 |
|
nd.rp = rayIn; |
620 |
– |
nd.mp = objptr(rayIn -> ro -> omod); |
621 |
|
|
622 |
|
/* get material color */ |
623 |
|
copycolor(nd.mcolor, mat -> oargs.farg); |
661 |
|
if (nd.rspec > FTINY) { |
662 |
|
nd.specfl |= SP_REFL; |
663 |
|
|
664 |
< |
/* comput e specular color */ |
664 |
> |
/* compute specular color */ |
665 |
|
if (mat -> otype == MAT_METAL2) |
666 |
|
copycolor(nd.scolor, nd.mcolor); |
667 |
|
else setcolor(nd.scolor, 1, 1, 1); |
1033 |
|
/* Replacement scattering routine */ |
1034 |
|
photonScatter [aliasRec.otype] (&aliasRec, rayIn); |
1035 |
|
|
1036 |
– |
#if 0 |
1036 |
|
/* Avoid potential memory leak? */ |
1037 |
|
if (aliasRec.os != aliasPtr -> os) { |
1038 |
< |
if (aliasObj -> os) |
1039 |
< |
free_os(aliasObj); |
1038 |
> |
if (aliasPtr -> os) |
1039 |
> |
free_os(aliasPtr); |
1040 |
|
aliasPtr -> os = aliasRec.os; |
1041 |
|
} |
1043 |
– |
#endif |
1042 |
|
|
1043 |
|
return 0; |
1044 |
|
} |
1488 |
|
/* Check argz */ |
1489 |
|
if (mat -> oargs.nsargs < 10 || mat -> oargs.nfargs < 9) |
1490 |
|
objerror(mat, USER, "bad # arguments"); |
1491 |
+ |
|
1492 |
|
nd.mp = mat; |
1493 |
|
nd.pr = rayIn; |
1494 |
|
/* Dummiez */ |
1637 |
|
|
1638 |
|
nd.mp = mat; |
1639 |
|
nd.pr = rayIn; |
1640 |
+ |
|
1641 |
|
/* Material kolour */ |
1642 |
|
setcolor(nd.mcolor, mat -> oargs.farg [0], mat -> oargs.farg [1], |
1643 |
|
mat -> oargs.farg [2]); |