summaryrefslogtreecommitdiffstats
path: root/Smoke/colormap.c
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2007-12-14 18:02:27 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2007-12-14 18:02:27 (GMT)
commit5a422dac78479f396437b5f9c1e8efbecf2c9b0f (patch)
treeb9910125b40708a3cd496ec46312012350886a7c /Smoke/colormap.c
parent241bfc64ed6446c295846d5ae635f6ba4e25a666 (diff)
download2iv35-5a422dac78479f396437b5f9c1e8efbecf2c9b0f.zip
2iv35-5a422dac78479f396437b5f9c1e8efbecf2c9b0f.tar.gz
2iv35-5a422dac78479f396437b5f9c1e8efbecf2c9b0f.tar.bz2
latest merge
Diffstat (limited to 'Smoke/colormap.c')
-rw-r--r--Smoke/colormap.c112
1 files changed, 2 insertions, 110 deletions
diff --git a/Smoke/colormap.c b/Smoke/colormap.c
index 3620cb7..4fafe53 100644
--- a/Smoke/colormap.c
+++ b/Smoke/colormap.c
@@ -3,120 +3,12 @@
#include <windows.h>
#endif
-#include <math.h>
-
-#include "fluids.h"
#include "colormap.h"
-#include "funcs.h"
-
-//rainbow: Implements a color palette, mapping the scalar 'value' to a rainbow color RGB
-void rainbow(float value, float *R, float *G, float *B)
-{
- const float dx = 0.8f;
-
- if (value < 0) value = 0;
- if (value > 1) value = 1;
-
- value = (6 - 2 * dx) * value + dx;
-
- *R = (float)max(0.0f, (3 - fabs(value - 4.0f) - fabs(value - 5.0f)) / 2.0f);
- *G = (float)max(0.0f, (4 - fabs(value - 2.0f) - fabs(value - 4.0f)) / 2.0f);
- *B = (float)max(0.0f, (3 - fabs(value - 1.0f) - fabs(value - 2.0f)) / 2.0f);
-}
-void colormap_fire(float value, float *R, float *G, float *B)
-{
- /* Colormap Fire
- * A fire effect deals with two parts, first a drop from red to yellow (halfway)
- * during which time the Red component remains full e.g. 1. The Green component is
- * slowly added to turn the red into orange, and then yellow (R & G =Y). After this
- * point, the Red and Green component (e.g. yellow) have to drop simulataniously
- * to go from yellow down to black.
- */
- *B = 0;
- *G = 0;
- *R = 0;
-
- if (value <= (0.01)) {
- /* whilst value is 0 - 0.5 both red and green equally change to create yellow */
- *R = *G = value;
- } else {
- /* whilst value is 0.5 - 1 Red is always fully on while the Green component is
- * added in steps to go from red to orange to yellow.
- */
- *G = 0.9f - value;
- *R = 0.8f; // not 1, makes red deeper, more intense
- }
-}
-
-//set_colormap: Sets three different types of colormaps
-struct color4f set_colormap(int colormap_sort, float vy, int draw_bar, float alpha)
-{
- float R, G, B;
- struct color4f return_value;
- const int NLEVELS = 7;
+#if 0
if (autoscale)
{
vy = remap(vy);
}
-
- if (!(draw_bar))
- {
- if (vy < clamp_min) vy = clamp_min;
- if (vy > clamp_max) vy = clamp_max;
- }
-
- switch (colormap_sort)
- {
- case COLOR_BLACKWHITE:
- R = G = B = vy;
- break;
- case COLOR_RAINBOW:
- rainbow(vy,&R,&G,&B);
- break;
- case COLOR_BANDS:
- vy *= NLEVELS; vy = (float)(int)(vy); vy/= NLEVELS;
- rainbow(vy,&R,&G,&B);
- break;
- case COLOR_BLUE_GREEN_RED:
- if (vy < -0.1)
- {
- R = G = 0;
- vy -= -0.1f;
- vy /= 0.9f;
- B = -vy;
- }
- else if (vy < 0.1)
- {
- R = B = 0;
- vy += 0.1f;
- vy /= 0.2f;
- G = vy;
- }
- else
- {
- vy -= 0.1f;
- vy /= 0.9f;
- R = vy;
- G = B = 0;
- }
- break;
- case COLOR_WILRIK:
- colormap_fire(vy, &R, &G, &B);
- break;
- case COLOR_OLIVER:
- rainbow(vy, &R, &G, &B);
- break;
-
- }
-
- glColor4f(R, G, B, alpha);
-
- return_value.r = R;
- return_value.g = G;
- return_value.b = B;
- return_value.a = alpha;
-
- return return_value;
-} \ No newline at end of file
+#endif