refactor(render): eliminar restes del ColorOscillator (setLineColor/getLineColor/global mutable) i deixar DEFAULT_LINE_COLOR constexpr

This commit is contained in:
2026-05-26 19:23:29 +02:00
parent 4f5421191d
commit b93761eb1e
7 changed files with 24 additions and 31 deletions
+4 -4
View File
@@ -51,12 +51,12 @@ namespace Graphics {
namespace {
// Lerp de l'oscil·lador (color base actual) cap a un color "flash" en
// funció de f ∈ [0, 1]. Retorna sempre amb alpha>0 perquè el line_renderer
// l'use directament (sense barrejar amb el global).
// Lerp del color base verd fòsfor cap a un color "flash" en funció de
// f ∈ [0, 1]. Retorna sempre amb alpha>0 perquè el line_renderer l'usi
// directament (sense caure al fallback DEFAULT_LINE_COLOR).
auto lerpColor(SDL_Color flash, float f) -> SDL_Color {
const float CLAMPED = std::clamp(f, 0.0F, 1.0F);
const SDL_Color BASE = Rendering::getLineColor();
constexpr SDL_Color BASE = Rendering::DEFAULT_LINE_COLOR;
const auto LERP_U8 = [&](unsigned char a, unsigned char b) {
const float OUT = (static_cast<float>(a) * (1.0F - CLAMPED)) + (static_cast<float>(b) * CLAMPED);
return static_cast<unsigned char>(OUT);