569 |
|
return 0; /* should be internal error */ |
570 |
|
/* get BSDF value */ |
571 |
|
yval = SDlookupTre(sdt->stc[tt_Y], gridPos, hc); |
572 |
– |
if (sdt->stc[tt_u] == NULL || sdt->stc[tt_v] == NULL) { |
573 |
– |
if (coef != NULL) *coef = yval; |
574 |
– |
return 1; /* no color */ |
575 |
– |
} |
572 |
|
if (coef == NULL) /* just getting hypercube? */ |
573 |
|
return 1; |
574 |
+ |
if ((sdt->stc[tt_u] == NULL) | (sdt->stc[tt_v] == NULL)) { |
575 |
+ |
*coef = yval; |
576 |
+ |
return 1; /* no color */ |
577 |
+ |
} |
578 |
|
/* else decode color */ |
579 |
|
SDyuv2rgb(yval, SDlookupTre(sdt->stc[tt_u], gridPos, NULL), |
580 |
|
SDlookupTre(sdt->stc[tt_v], gridPos, NULL), coef); |
1194 |
|
} else /* anisotropic covers entire tree */ |
1195 |
|
vmin = SDgetTreMin(st); |
1196 |
|
|
1197 |
< |
if (vmin <= FTINY) |
1198 |
< |
return .0; |
1197 |
> |
if (vmin <= .01/M_PI) |
1198 |
> |
return .0; /* not worth bothering about */ |
1199 |
|
|
1200 |
|
SDsubtractTreVal(st, vmin); |
1201 |
|
|
1314 |
|
my_min.new_stu = my_min.new_stv = NULL; |
1315 |
|
/* get minimum RGB value */ |
1316 |
|
SDtraverseTre(stc[tt_Y], NULL, 0, get_min_RGB, &my_min); |
1317 |
< |
ymin = tt_RGB_coef[0]*my_min.rgb[0] + |
1318 |
< |
tt_RGB_coef[1]*my_min.rgb[1] + |
1319 |
< |
tt_RGB_coef[2]*my_min.rgb[2]; |
1320 |
< |
if (ymin <= 1e-5) { |
1321 |
< |
*cs = c_dfcolor; |
1322 |
< |
return .0; /* not worth bothering about */ |
1323 |
< |
} |
1324 |
< |
/* adjust u' & v' values */ |
1317 |
> |
/* convert to C_COLOR */ |
1318 |
> |
ymin = c_fromSharpRGB(my_min.rgb, cs); |
1319 |
> |
if (ymin <= .01/M_PI) /* not worth bothering about? */ |
1320 |
> |
return .0; |
1321 |
> |
/* adjust u' & v' trees */ |
1322 |
|
SDtraverseTre(stc[tt_u], NULL, 0, adjust_utree, &my_min); |
1323 |
|
SDtraverseTre(stc[tt_v], NULL, 0, adjust_vtree, &my_min); |
1324 |
|
SDfreeTre(stc[tt_u]); SDfreeTre(stc[tt_v]); |
1325 |
|
stc[tt_u] = SDsimplifyTre(my_min.new_stu); |
1326 |
|
stc[tt_v] = SDsimplifyTre(my_min.new_stv); |
1327 |
< |
/* finally, subtract Y value */ |
1327 |
> |
/* subtract Y & return hemispherical */ |
1328 |
|
SDsubtractTreVal(stc[tt_Y], ymin); |
1329 |
< |
/* return color and Y */ |
1330 |
< |
c_fromSharpRGB(my_min.rgb, cs); |
1334 |
< |
return M_PI*ymin; |
1329 |
> |
|
1330 |
> |
return M_PI * ymin; |
1331 |
|
} |
1332 |
|
|
1333 |
|
/* Extract and separate diffuse portion of BSDF */ |