| @@ -110,6 +110,7 @@ liblolcore_sources = \ | |||||
| image/codec/ios-image.cpp \ | image/codec/ios-image.cpp \ | ||||
| image/codec/dummy-image.cpp \ | image/codec/dummy-image.cpp \ | ||||
| image/color/cie1931.cpp \ | image/color/cie1931.cpp \ | ||||
| image/color/color.cpp \ | |||||
| \ | \ | ||||
| loldebug.h \ | loldebug.h \ | ||||
| debug/fps.cpp debug/fps.h debug/lines.cpp \ | debug/fps.cpp debug/fps.h debug/lines.cpp \ | ||||
| @@ -0,0 +1,45 @@ | |||||
| // | |||||
| // Lol Engine | |||||
| // | |||||
| // Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | |||||
| // modify it under the terms of the Do What The Fuck You Want To | |||||
| // Public License, Version 2, as published by Sam Hocevar. See | |||||
| // http://www.wtfpl.net/ for more details. | |||||
| // | |||||
| #if defined HAVE_CONFIG_H | |||||
| # include "config.h" | |||||
| #endif | |||||
| #include "core.h" | |||||
| namespace lol | |||||
| { | |||||
| String Color::HexString4Bpp(vec3 c) | |||||
| { | |||||
| uvec3 c2 = (uvec3)(clamp(c, 0.f, 1.f) * 255.0f); | |||||
| return String::Printf("%01x%01x%01x", c2.r, c2.g, c2.b); | |||||
| } | |||||
| String Color::HexString4Bpp(vec4 c) | |||||
| { | |||||
| uvec4 c2 = (uvec4)(clamp(c, 0.f, 1.f) * 255.0f); | |||||
| return String::Printf("%01x%1x%01x%01x", c2.r, c2.g, c2.b, c2.a); | |||||
| } | |||||
| String Color::HexString8Bpp(vec3 c) | |||||
| { | |||||
| uvec3 c2 = (uvec3)(clamp(c, 0.f, 1.f) * 255.0f); | |||||
| return String::Printf("%02x%02x%02x", c2.r, c2.g, c2.b); | |||||
| } | |||||
| String Color::HexString8Bpp(vec4 c) | |||||
| { | |||||
| uvec4 c2 = (uvec4)(clamp(c, 0.f, 1.f) * 255.0f); | |||||
| return String::Printf("%02x%2x%02x%02x", c2.r, c2.g, c2.b, c2.a); | |||||
| } | |||||
| } /* namespace lol */ | |||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // Lol Engine | // Lol Engine | ||||
| // | // | ||||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | // This program is free software; you can redistribute it and/or | ||||
| // modify it under the terms of the Do What The Fuck You Want To | // modify it under the terms of the Do What The Fuck You Want To | ||||
| // Public License, Version 2, as published by Sam Hocevar. See | // Public License, Version 2, as published by Sam Hocevar. See | ||||
| @@ -277,6 +277,14 @@ public: | |||||
| * Convert a wavelength into an xyY fully saturated colour. | * Convert a wavelength into an xyY fully saturated colour. | ||||
| */ | */ | ||||
| static vec3 WavelengthToCIExyY(float nm); | static vec3 WavelengthToCIExyY(float nm); | ||||
| /* | |||||
| * Convert colors to hex strings. | |||||
| */ | |||||
| static String HexString4Bpp(vec3 c); | |||||
| static String HexString4Bpp(vec4 c); | |||||
| static String HexString8Bpp(vec3 c); | |||||
| static String HexString8Bpp(vec4 c); | |||||
| }; | }; | ||||
| } /* namespace lol */ | } /* namespace lol */ | ||||
| @@ -145,6 +145,7 @@ | |||||
| <ClCompile Include="image\codec\ps3-image.cpp" /> | <ClCompile Include="image\codec\ps3-image.cpp" /> | ||||
| <ClCompile Include="image\codec\sdl-image.cpp" /> | <ClCompile Include="image\codec\sdl-image.cpp" /> | ||||
| <ClCompile Include="image\color\cie1931.cpp" /> | <ClCompile Include="image\color\cie1931.cpp" /> | ||||
| <ClCompile Include="image\color\color.cpp" /> | |||||
| <ClCompile Include="image\image.cpp" /> | <ClCompile Include="image\image.cpp" /> | ||||
| <ClCompile Include="input\controller.cpp" /> | <ClCompile Include="input\controller.cpp" /> | ||||
| <ClCompile Include="input\input.cpp" /> | <ClCompile Include="input\input.cpp" /> | ||||
| @@ -291,6 +291,9 @@ | |||||
| <ClCompile Include="image\color\cie1931.cpp"> | <ClCompile Include="image\color\cie1931.cpp"> | ||||
| <Filter>image\color</Filter> | <Filter>image\color</Filter> | ||||
| </ClCompile> | </ClCompile> | ||||
| <ClCompile Include="image\color\color.cpp"> | |||||
| <Filter>image\color</Filter> | |||||
| </ClCompile> | |||||
| <ClCompile Include="math\geometry.cpp"> | <ClCompile Include="math\geometry.cpp"> | ||||
| <Filter>math</Filter> | <Filter>math</Filter> | ||||
| </ClCompile> | </ClCompile> | ||||