From b3fbae340ba4ab21b81a030bdf7b13439b338fc4 Mon Sep 17 00:00:00 2001 From: PS Date: Fri, 9 Apr 2021 12:14:00 -1000 Subject: [PATCH] Made LedBlend_Overwrite more useful --- .../engine/animation/foldhaus_animation_renderer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/app/engine/animation/foldhaus_animation_renderer.cpp b/src/app/engine/animation/foldhaus_animation_renderer.cpp index 5bdaec1..eb2c130 100644 --- a/src/app/engine/animation/foldhaus_animation_renderer.cpp +++ b/src/app/engine/animation/foldhaus_animation_renderer.cpp @@ -8,13 +8,22 @@ internal pixel LedBlend_Overwrite(pixel PixelA, pixel PixelB, u8* UserData) { + r32 MagB = (r32)(PixelB.R + PixelB.G + PixelB.B) / (255 * 3); + + pixel Result = {}; + Result.R = (u8)LerpR32(MagB, PixelA.R, PixelB.R); + Result.G = (u8)LerpR32(MagB, PixelA.G, PixelB.G); + Result.B = (u8)LerpR32(MagB, PixelA.B, PixelB.B); + +#if 0 pixel Result = PixelB; if (PixelB.R == 0 && PixelB.G == 0 && - PixelB.G == 0) + PixelB.B == 0) { Result = PixelA; } +#endif return Result; }