Nice! Looks good. I like the idea of collecting a couple of working examples! Especially since I was involved in a couple of them.
I only took a quick look at the hue shift example. I faced the same problem lately. But I solved it like this:
// Calculate the color
hue += 0.25 * fTime;
if(hue > 1.0)
hue = 0.0;
// convert hue to RGB
float r = std::abs(3.0 - 6.0 * hue) - 1.0;
float g = 2.0 - std::abs(2.0 - 6.0 * hue);
float b = 2.0 - std::abs(4.0 - 6.0 * hue);
color = sf::Color(Clamp(r, 0.f, 1.f) * 255.f, Clamp(g, 0.f, 1.f) * 255.f, Clamp(b, 0.f, 1.f) * 255.f);
It is a little more efficient and easier to control.
Maybe I could create a similar wiki page to this forum post, that captures the ideas and just link to my repository...
Alright I guess that would work too.
Here is the Clamp template:
template <typename T> T Clamp(const T& value, const T& low, const T& high)
{
return value < low ? low : (value > high ? high : value);
}
The parameters are the value to be clamped, the lower and the upper bound.
I'll only use it if it's compatible with the zlib license. (Otherwise I might just steal the idea and use my own implementation.) ;D
Alright you can do whatever you want with it, but it would be nice if you reference me as an author :) The idea is to increment the hue over time and then convert the hue to an RGB color using techniques explained in this blog post: http://chilliant.blogspot.de/2010/11/rgbhsv-in-hlsl.html