summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2008-01-09 12:21:38 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2008-01-09 12:21:38 (GMT)
commit4f8eda57dc837193ea25737b28d3514b3858639f (patch)
tree3b33bbf764bb29b154ac3a21aaa43d4cc6361883
parentae535cfe2dfbb6b90f41a9fad6fc863a05fb32ba (diff)
download2iv35-4f8eda57dc837193ea25737b28d3514b3858639f.zip
2iv35-4f8eda57dc837193ea25737b28d3514b3858639f.tar.gz
2iv35-4f8eda57dc837193ea25737b28d3514b3858639f.tar.bz2
olivers palette
-rw-r--r--Smoke/palette.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/Smoke/palette.c b/Smoke/palette.c
index c0fd8b5..49b0354 100644
--- a/Smoke/palette.c
+++ b/Smoke/palette.c
@@ -12,6 +12,11 @@
#include "palette.h"
+static float trip_like_i_do_arr[10][3] = {
+ {0.0f, 0.0f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 1.0f, 0.0f}, {0.0f, 1.0f, 1.0f},
+ {1.0f, 0.0f, 1.0f}, {1.0f, 0.5f, 0.5f}, {0.5f, 0.5f, 1.0f}, {0.5f, 1.0f, 0.5f}, {0.0f, 1.0f, 0.0f},
+};
+
void HSVtoRGB(float *r, float *g, float *b, float h, float s, float v)
{
int i;
@@ -113,7 +118,7 @@ static struct color4f blackandwhite(float value)
}
//rainbow: Implements a color palette, mapping the scalar 'value' to a rainbow color RGB
-static struct colorf4 rainbow(float value)
+static struct color4f rainbow(float value)
{
struct color4f return_value;
const float dx = 0.8f;
@@ -124,8 +129,8 @@ static struct colorf4 rainbow(float value)
value = (6 - 2 * dx) * value + dx;
return_value.r = (float)max(0.0f, (3 - fabs(value - 4.0f) - fabs(value - 5.0f)) / 2.0f);
- return_value.b = (float)max(0.0f, (4 - fabs(value - 2.0f) - fabs(value - 4.0f)) / 2.0f);
- return_value.g = (float)max(0.0f, (3 - fabs(value - 1.0f) - fabs(value - 2.0f)) / 2.0f);
+ return_value.g = (float)max(0.0f, (4 - fabs(value - 2.0f) - fabs(value - 4.0f)) / 2.0f);
+ return_value.b = (float)max(0.0f, (3 - fabs(value - 1.0f) - fabs(value - 2.0f)) / 2.0f);
return return_value;
}
@@ -134,10 +139,18 @@ static struct colorf4 rainbow(float value)
static struct color4f trip_like_i_do(float value)
{
struct color4f return_value;
+ int val;
- return_value.r = value;
- return_value.g = value;
- return_value.b = value;
+
+ return_value.r = 0;
+ return_value.b = 0;
+ return_value.g = 0;
+
+ 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 return_value;
}