roundoff error was introducing some strangeness in smoothly interpolated genome palettes - now ensure that all 1.0 alpha channels -> 1.0 alpha in output

git-svn-id: https://flam3.googlecode.com/svn/trunk@156 77852712-ef1d-11de-8684-7d64432d61a3
This commit is contained in:
Erik Reckase 2011-01-12 20:52:59 +00:00 committed by Scott Draves
parent ce2bbf871f
commit 5ac641382d

View File

@ -367,6 +367,8 @@ void flam3_interpolate_n(flam3_genome *result, int ncp,
for (i = 0; i < 256; i++) {
double t[3], s[4];
int alpha1 = 1;
s[0] = s[1] = s[2] = s[3] = s[4] = 0.0;
for (k = 0; k < ncp; k++) {
@ -375,9 +377,14 @@ void flam3_interpolate_n(flam3_genome *result, int ncp,
s[j] += c[k] * t[j];
s[3] += c[k] * cpi[k].palette[i].color[3];
if (cpi[k].palette[i].color[3] != 1.0)
alpha1 = 0;
s[4] += c[k] * cpi[k].palette[i].index;
}
if (alpha1 == 1)
s[3] = 1.0;
hsv2rgb(s, result->palette[i].color);
result->palette[i].color[3] = s[3];