From b03b048974248e62509f2740c10370258c49c997 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sat, 30 Aug 2008 21:09:13 +0000 Subject: removed gc_client.hpp --- src/game/client/components/menus.cpp | 39 +++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'src/game/client/components/menus.cpp') diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 4a37669e..4893d0ea 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -26,7 +26,6 @@ extern "C" { #include #include #include -#include #include vec4 MENUS::gui_color; @@ -41,6 +40,44 @@ vec4 MENUS::color_tabbar_active_ingame; INPUT_EVENT MENUS::inputevents[MAX_INPUTEVENTS]; int MENUS::num_inputevents; +inline float hue_to_rgb(float v1, float v2, float h) +{ + if(h < 0) h += 1; + if(h > 1) h -= 1; + if((6 * h) < 1) return v1 + ( v2 - v1 ) * 6 * h; + if((2 * h) < 1) return v2; + if((3 * h) < 2) return v1 + ( v2 - v1 ) * ((2.0f/3.0f) - h) * 6; + return v1; +} + +inline vec3 hsl_to_rgb(vec3 in) +{ + float v1, v2; + vec3 out; + + if(in.s == 0) + { + out.r = in.l; + out.g = in.l; + out.b = in.l; + } + else + { + if(in.l < 0.5f) + v2 = in.l * (1 + in.s); + else + v2 = (in.l+in.s) - (in.s*in.l); + + v1 = 2 * in.l - v2; + + out.r = hue_to_rgb(v1, v2, in.h + (1.0f/3.0f)); + out.g = hue_to_rgb(v1, v2, in.h); + out.b = hue_to_rgb(v1, v2, in.h - (1.0f/3.0f)); + } + + return out; +} + MENUS::MENUS() { -- cgit 1.4.1