From e39538b644236e3927def1dee5e8e4f833f99e14 Mon Sep 17 00:00:00 2001 From: div0 Date: Wed, 14 Nov 2007 10:07:10 +0000 Subject: [PATCH] oops... added something there too git-svn-id: svn://svn.icculus.org/nexuiz/trunk@2945 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/common/util.qc | 35 +++++++++++++++++++++++++++++++++++ data/qcsrc/common/util.qh | 2 ++ 2 files changed, 37 insertions(+) diff --git a/data/qcsrc/common/util.qc b/data/qcsrc/common/util.qc index a2237d04f..96ec8e5e1 100644 --- a/data/qcsrc/common/util.qc +++ b/data/qcsrc/common/util.qc @@ -180,3 +180,38 @@ string ftos_decimals(float number, float decimals) result = strcat(substring(result, 0, len - decimals), ".", tmp); return result; } + +float time; +vector colormapPaletteColor(float c, float isPants) +{ + switch(c) + { + case 0: return '0.733 0.733 0.733'; + case 1: return '0.451 0.341 0.122'; + case 2: return '0.000 0.733 0.733'; + case 3: return '0.000 1.000 0.000'; + case 4: return '1.000 0.000 0.000'; + case 5: return '0.000 0.502 1.000'; + case 6: return '0.812 0.561 0.169'; + case 7: return '0.718 0.529 0.420'; + case 8: return '0.765 0.545 0.667'; + case 9: return '1.000 0.000 1.000'; + case 10: return '0.639 0.529 0.482'; + case 11: return '0.310 0.388 0.341'; + case 12: return '1.000 1.000 0.000'; + case 13: return '0.000 0.000 1.000'; + case 14: return '1.000 0.502 0.000'; + case 15: + if(isPants) + return + '1 0 0' * (0.502 + 0.498 * sin(time / 2.7182818285 + 0.0000000000)) + + '0 1 0' * (0.502 + 0.498 * sin(time / 2.7182818285 + 2.0943951024)) + + '0 0 1' * (0.502 + 0.498 * sin(time / 2.7182818285 + 4.1887902048)); + else + return + '1 0 0' * (0.502 + 0.498 * sin(time / 3.1415926536 + 5.2359877560)) + + '0 1 0' * (0.502 + 0.498 * sin(time / 3.1415926536 + 3.1415926536)) + + '0 0 1' * (0.502 + 0.498 * sin(time / 3.1415926536 + 1.0471975512)); + default: return '0.000 0.000 0.000'; + } +} diff --git a/data/qcsrc/common/util.qh b/data/qcsrc/common/util.qh index de2bb7f1f..00c998c11 100644 --- a/data/qcsrc/common/util.qh +++ b/data/qcsrc/common/util.qh @@ -30,3 +30,5 @@ float median(float a, float b, float c); // converts a number to a string with the indicated number of decimals // works for up to 10 decimals! string ftos_decimals(float number, float decimals); + +vector colormapPaletteColor(float c, float isPants); -- 2.39.2