diff options
author | Oliver Schinagl <oliver@schinagl.nl> | 2007-12-17 19:48:37 (GMT) |
---|---|---|
committer | Oliver Schinagl <oliver@schinagl.nl> | 2007-12-17 19:48:37 (GMT) |
commit | 9363bc6887a7ffb9ea6c0f6a63a93c215e227502 (patch) | |
tree | dc5f962bdcc413a5bd4bff4d85c7842522a73fb3 /Smoke/palette.c | |
parent | 1d771540b16ba07cb02be5490892465a2a5ab89a (diff) | |
download | 2iv35-9363bc6887a7ffb9ea6c0f6a63a93c215e227502.zip 2iv35-9363bc6887a7ffb9ea6c0f6a63a93c215e227502.tar.gz 2iv35-9363bc6887a7ffb9ea6c0f6a63a93c215e227502.tar.bz2 |
Added/splitted colormaps to a seperate file.
Diffstat (limited to 'Smoke/palette.c')
-rw-r--r-- | Smoke/palette.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/Smoke/palette.c b/Smoke/palette.c index df24f04..0fdcb7c 100644 --- a/Smoke/palette.c +++ b/Smoke/palette.c @@ -50,57 +50,57 @@ void colormap_fire(float value, float *R, float *G, float *B) } } -//set_colormap: Sets three different types of colormaps -struct color4f set_colormap(int colormap_sort, float vy, float alpha) +//set_palette: Sets three different types of colormaps +struct color4f set_palette(int colormap_sort, float value, int num_colors) { float R, G, B; struct color4f return_value; const int NLEVELS = 7; -// vy *= olivers_color; -// vy = (float)(int)(vy); - // vy /= olivers_color; + value *= num_colors; + value = (float)(int)(value); + value /= num_colors; switch (colormap_sort) { case COLOR_BLACKWHITE: - R = G = B = vy; + R = G = B = value; break; case COLOR_RAINBOW: - rainbow(vy,&R,&G,&B); + rainbow(value,&R,&G,&B); break; case COLOR_BANDS: - vy *= NLEVELS; vy = (float)(int)(vy); vy/= NLEVELS; - rainbow(vy,&R,&G,&B); + value *= NLEVELS; value = (float)(int)(value); value/= NLEVELS; + rainbow(value,&R,&G,&B); break; case COLOR_BLUE_GREEN_RED: - if (vy < -0.1) + if (value < -0.1) { R = G = 0; - vy -= -0.1f; - vy /= 0.9f; - B = -vy; + value -= -0.1f; + value /= 0.9f; + B = -value; } - else if (vy < 0.1) + else if (value < 0.1) { R = B = 0; - vy += 0.1f; - vy /= 0.2f; - G = vy; + value += 0.1f; + value /= 0.2f; + G = value; } else { - vy -= 0.1f; - vy /= 0.9f; - R = vy; + value -= 0.1f; + value /= 0.9f; + R = value; G = B = 0; } break; case COLOR_WILRIK: - colormap_fire(vy, &R, &G, &B); + colormap_fire(value, &R, &G, &B); break; case COLOR_OLIVER: - rainbow(vy, &R, &G, &B); + rainbow(value, &R, &G, &B); break; } @@ -108,7 +108,6 @@ struct color4f set_colormap(int colormap_sort, float vy, float alpha) return_value.r = R; return_value.g = G; return_value.b = B; - return_value.a = alpha; return return_value; } |