summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2008-01-10 13:16:05 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2008-01-10 13:16:05 (GMT)
commitba9323fa78707a82ba806a28f62dfe592e855ddf (patch)
treeef4e7a10d4ee66884e009a02a58193bccfe4e5ba
parent7f0f58b951975bc99f8e2555710893520f56d5bc (diff)
download2iv35-ba9323fa78707a82ba806a28f62dfe592e855ddf.zip
2iv35-ba9323fa78707a82ba806a28f62dfe592e855ddf.tar.gz
2iv35-ba9323fa78707a82ba806a28f62dfe592e855ddf.tar.bz2
trip like we do
-rw-r--r--Smoke/palette.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/Smoke/palette.c b/Smoke/palette.c
index d8b10a9..9d487f0 100644
--- a/Smoke/palette.c
+++ b/Smoke/palette.c
@@ -13,8 +13,8 @@
static float trip_like_i_do_arr[10][3] = {
- {0.0f, 0.0f, 0.0f}, {0.1f, 0.1f, 0.1f}, {0.2f, 0.2f, 0.2f}, {0.3f, 0.3f, 0.3f}, {0.4f, 0.4f, 0.4f},
- {0.5f, 0.5f, 0.5f}, {0.6f, 0.6f, 0.6f}, {0.7f, 0.7f, 0.7f}, {0.8f, 0.8f, 0.8f}, {0.9f, 0.9f, 0.9f},
+ {1.0f, 0.0f, 0.0f}, {1.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 1.0f}, {0.0f, 1.0f, 1.0f}, {0.0f, 1.0f, 0.0f},
+ {1.0f, 0.5f, 0.0f}, {1.0f, 0.75f, 0.0f}, {0.5f, 0.0f, 1.0f}, {0.0f, 1.0f, 0.5f}, {1.0f, 0.0f, 0.5f},
};
void HSVtoRGB(float *r, float *g, float *b, float h, float s, float v)
@@ -139,14 +139,20 @@ static struct color4f rainbow(float value)
static struct color4f puke_like_he_does(float value)
{
struct color4f return_value;
- float val;
- val = (float)(((int)(value * 100)) % 10);
+ return_value.r = 0;
+ return_value.g = 0;
+ return_value.b = 0;
- return_value.r = val/10.0f;
- return_value.g = val/10.0f;
- return_value.b = val/10.0f;
+ if (value > 0.001) {
+ value *= 100;
+ value = ((int)value) % 10;
+ value /= 10;
+ return_value.r = value;
+ return_value.g = value;
+ return_value.b = value;
+ }
return return_value;
}
@@ -160,12 +166,14 @@ static struct color4f trip_like_i_do(float value)
return_value.r = 0;
return_value.b = 0;
return_value.g = 0;
+
+ if (value > 0.001) {
+ val = (int)(value * 100) % 10;
- val = (int)(value * 100) % 10;
-
- return_value.r = trip_like_i_do_arr[val][0];
- return_value.g = trip_like_i_do_arr[val][1];
- return_value.b = trip_like_i_do_arr[val][2];
+ return_value.r = trip_like_i_do_arr[val][0];
+ return_value.g = trip_like_i_do_arr[val][1];
+ return_value.b = trip_like_i_do_arr[val][2];
+ }
return return_value;
}
@@ -182,6 +190,7 @@ static struct color4f colormap_fire(float value)
return return_value;
}
+#if 0
static struct color4f bluegreenred(float value)
{
struct color4f return_value;
@@ -209,6 +218,7 @@ static struct color4f bluegreenred(float value)
return return_value;
}
+#endif
//set_palette: Sets three different types of colormaps
struct color4f set_palette(int colormap_sort, float value, int num_colors)
@@ -246,6 +256,7 @@ struct color4f set_palette(int colormap_sort, float value, int num_colors)
break;
case PALETTE_GREY_BANDS:
return_value = puke_like_he_does(value);
+ break;
case PALETTE_RED:
return_value.r = 1.0f;
break;