mirror of
https://github.com/scottdraves/flam3.git
synced 2025-01-21 05:20:05 -05:00
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:
parent
ce2bbf871f
commit
5ac641382d
@ -367,6 +367,8 @@ void flam3_interpolate_n(flam3_genome *result, int ncp,
|
|||||||
|
|
||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
double t[3], s[4];
|
double t[3], s[4];
|
||||||
|
int alpha1 = 1;
|
||||||
|
|
||||||
s[0] = s[1] = s[2] = s[3] = s[4] = 0.0;
|
s[0] = s[1] = s[2] = s[3] = s[4] = 0.0;
|
||||||
|
|
||||||
for (k = 0; k < ncp; k++) {
|
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[j] += c[k] * t[j];
|
||||||
|
|
||||||
s[3] += c[k] * cpi[k].palette[i].color[3];
|
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;
|
s[4] += c[k] * cpi[k].palette[i].index;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (alpha1 == 1)
|
||||||
|
s[3] = 1.0;
|
||||||
|
|
||||||
hsv2rgb(s, result->palette[i].color);
|
hsv2rgb(s, result->palette[i].color);
|
||||||
result->palette[i].color[3] = s[3];
|
result->palette[i].color[3] = s[3];
|
||||||
|
Loading…
Reference in New Issue
Block a user