569 |
|
return 0; /* should be internal error */ |
570 |
|
/* get BSDF value */ |
571 |
|
yval = SDlookupTre(sdt->stc[tt_Y], gridPos, hc); |
572 |
+ |
if (coef == NULL) /* just getting hypercube? */ |
573 |
+ |
return 1; |
574 |
|
if (sdt->stc[tt_u] == NULL || sdt->stc[tt_v] == NULL) { |
575 |
< |
if (coef != NULL) *coef = yval; |
575 |
> |
*coef = yval; |
576 |
|
return 1; /* no color */ |
577 |
|
} |
576 |
– |
if (coef == NULL) /* just getting hypercube? */ |
577 |
– |
return 1; |
578 |
|
/* else decode color */ |
579 |
|
SDyuv2rgb(yval, SDlookupTre(sdt->stc[tt_u], gridPos, NULL), |
580 |
|
SDlookupTre(sdt->stc[tt_v], gridPos, NULL), coef); |
789 |
|
for (i = sdt->stc[tt_Y]->ndim - 2; i--; ) |
790 |
|
inCoord[i] = floor(inCoord[i]/quantum)*quantum + .5*quantum; |
791 |
|
cdlast = NULL; /* check for direction in cache list */ |
792 |
+ |
/* PLACE MUTEX LOCK HERE FOR THREAD-SAFE */ |
793 |
|
for (cd = (SDTreCDst *)sdc->cdList; cd != NULL; |
794 |
|
cdlast = cd, cd = cd->next) { |
795 |
|
if (cd->sidef != mode) |
808 |
|
cd->next = (SDTreCDst *)sdc->cdList; |
809 |
|
sdc->cdList = (SDCDst *)cd; |
810 |
|
} |
811 |
+ |
/* END MUTEX LOCK */ |
812 |
|
return (SDCDst *)cd; /* ready to go */ |
813 |
|
} |
814 |
|
|
926 |
|
} |
927 |
|
|
928 |
|
/* Advance pointer past matching token (or any token if c==0) */ |
929 |
< |
#define eat_token(spp,c) (next_token(spp)==(c) ^ !(c) ? *(*(spp))++ : 0) |
929 |
> |
#define eat_token(spp,c) ((next_token(spp)==(c)) ^ !(c) ? *(*(spp))++ : 0) |
930 |
|
|
931 |
|
/* Count words from this point in string to '}' */ |
932 |
|
static int |
1176 |
|
static double |
1177 |
|
subtract_min_Y(SDNode *st) |
1178 |
|
{ |
1179 |
< |
float vmin; |
1179 |
> |
const float vmaxmin = 1.5/M_PI; |
1180 |
> |
float vmin; |
1181 |
|
/* be sure to skip unused portion */ |
1182 |
|
if (st->ndim == 3) { |
1183 |
|
int n; |
1184 |
< |
vmin = 1./M_PI; |
1184 |
> |
vmin = vmaxmin; |
1185 |
|
if (st->log2GR < 0) { |
1186 |
|
for (n = 0; n < 8; n += 2) { |
1187 |
|
float v = SDgetTreMin(st->u.t[n]); |
1197 |
|
} else /* anisotropic covers entire tree */ |
1198 |
|
vmin = SDgetTreMin(st); |
1199 |
|
|
1200 |
< |
if (vmin <= .01/M_PI) |
1200 |
> |
if ((vmin >= vmaxmin) | (vmin <= .01/M_PI)) |
1201 |
|
return .0; /* not worth bothering about */ |
1202 |
|
|
1203 |
|
SDsubtractTreVal(st, vmin); |
1319 |
|
SDtraverseTre(stc[tt_Y], NULL, 0, get_min_RGB, &my_min); |
1320 |
|
/* convert to C_COLOR */ |
1321 |
|
ymin = c_fromSharpRGB(my_min.rgb, cs); |
1322 |
< |
if (ymin <= .01/M_PI) /* not worth bothering about? */ |
1323 |
< |
return .0; |
1322 |
> |
if ((ymin >= .5*FHUGE) | (ymin <= .01/M_PI)) |
1323 |
> |
return .0; /* close to zero or no tree */ |
1324 |
|
/* adjust u' & v' trees */ |
1325 |
|
SDtraverseTre(stc[tt_u], NULL, 0, adjust_utree, &my_min); |
1326 |
|
SDtraverseTre(stc[tt_v], NULL, 0, adjust_vtree, &my_min); |
1357 |
|
memcpy(df->comp[0].cspec, tt_RGB_prim, sizeof(tt_RGB_prim)); |
1358 |
|
dv->cieY = subtract_min_RGB(&dv->spec, sdt->stc); |
1359 |
|
} else { |
1360 |
< |
df->comp[0].cspec[0] = c_dfcolor; |
1360 |
> |
df->comp[0].cspec[0] = dv->spec = c_dfcolor; |
1361 |
|
dv->cieY = subtract_min_Y(sdt->stc[tt_Y]); |
1362 |
|
} |
1363 |
|
df->maxHemi -= dv->cieY; /* adjust maximum hemispherical */ |
1422 |
|
} |
1423 |
|
|
1424 |
|
/* Variable resolution BSDF methods */ |
1425 |
< |
SDFunc SDhandleTre = { |
1425 |
> |
const SDFunc SDhandleTre = { |
1426 |
|
&SDgetTreBSDF, |
1427 |
|
&SDqueryTreProjSA, |
1428 |
|
&SDgetTreCDist, |