Don't use floats for the Haunt effect

Fixes #7.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/365/head
Gergely Nagy 8 years ago
parent f2ca23adc5
commit 67262add72

@ -92,22 +92,18 @@ namespace KaleidoscopePlugins {
namespace Stalker { namespace Stalker {
cRGB Haunt::highlightColor;
// Haunt // Haunt
float Haunt::mb; Haunt::Haunt (const cRGB highlightColor_) {
float Haunt::mg; highlightColor = highlightColor_;
float Haunt::mr;
Haunt::Haunt (const cRGB highlightColor) {
mb = highlightColor.b / 255.0;
mg = highlightColor.g / 255.0;
mr = highlightColor.r / 255.0;
} }
cRGB cRGB
Haunt::compute (uint8_t step) { Haunt::compute (uint8_t step) {
cRGB color = {(uint8_t)min(step * mb, 255), cRGB color = CRGB((uint8_t)min(step * highlightColor.r / 255, 255),
(uint8_t)min(step * mg, 255), (uint8_t)min(step * highlightColor.g / 255, 255),
(uint8_t)min(step * mr, 255)}; (uint8_t)min(step * highlightColor.b / 255, 255));
return color; return color;
} }

@ -56,9 +56,8 @@ namespace KaleidoscopePlugins {
Haunt (void *) : Haunt () {}; Haunt (void *) : Haunt () {};
virtual cRGB compute (uint8_t step) final; virtual cRGB compute (uint8_t step) final;
private: private:
static float mr, mg, mb; static cRGB highlightColor;
}; };
class BlazingTrail : public StalkerEffect::ColorComputer { class BlazingTrail : public StalkerEffect::ColorComputer {

Loading…
Cancel
Save