b746578bc8
Sustituye en bloque las cabeceras de los archivos por una sola línea de copyright. Cero rastro de "Visente", "Sergi" o "1999" en el árbol del proyecto. Se eliminan también las variantes "© 2025 Port a C++20", "© 2025 Port a C++20 con SDL3" y "© 2025 Orni Attack" (con todas sus colas descriptivas como "Arquitectura de entidades" o "Sistema de física"), que en este punto eran ruido histórico. Aplicado con un par de sed (find -type f, excluyendo source/external y source/legacy): 1. \|^// © 1999 Visente i Sergi (versión Pascal)$|d 2. s|^// © 2025 (Port a C++20.*|Orni Attack.*)$|// © 2026 JailDesigner| Verificado: la única variante de cabecera tras el sweep es "// © 2026 JailDesigner". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
55 lines
2.0 KiB
C++
55 lines
2.0 KiB
C++
// line_renderer.cpp - Implementación de renderizado de líneas (SDL3 GPU)
|
||
// © 2026 JailDesigner
|
||
|
||
#include "core/rendering/line_renderer.hpp"
|
||
|
||
namespace Rendering {
|
||
|
||
// Color global compartido para líneas sin paleta propia (HUD, debug, texto
|
||
// genérico). Equivale al "color máximo" de la antigua oscilación CPU: verde
|
||
// fósforo CRT. El pulso de brillo lo aplica ahora el shader de postpro.
|
||
SDL_Color g_current_line_color = {100, 255, 100, 255};
|
||
|
||
// Grosor global por defecto. Configurable via setLineThickness.
|
||
// 1.5 da una línea visible y crujiente; 1.0 se ve demasiado fino en pantallas grandes.
|
||
float g_current_line_thickness = 1.5F;
|
||
|
||
void linea(Renderer* renderer,
|
||
int x1, int y1, int x2, int y2,
|
||
float brightness,
|
||
float thickness,
|
||
SDL_Color color) {
|
||
if (renderer == nullptr) {
|
||
return;
|
||
}
|
||
|
||
// Coords lógicas (1280×720). El shader hace el mapeo a NDC; el viewport
|
||
// del SDLManager hace el letterbox a píxeles físicos.
|
||
const float FX1 = static_cast<float>(x1);
|
||
const float FY1 = static_cast<float>(y1);
|
||
const float FX2 = static_cast<float>(x2);
|
||
const float FY2 = static_cast<float>(y2);
|
||
|
||
// color.alpha==0 → usar color global (verde fósforo). alpha>0 → color directo.
|
||
const SDL_Color SOURCE = (color.a > 0) ? color : g_current_line_color;
|
||
const float R = (static_cast<float>(SOURCE.r) * brightness) / 255.0F;
|
||
const float G = (static_cast<float>(SOURCE.g) * brightness) / 255.0F;
|
||
const float B = (static_cast<float>(SOURCE.b) * brightness) / 255.0F;
|
||
|
||
const float W = (thickness > 0.0F) ? thickness : g_current_line_thickness;
|
||
|
||
renderer->pushLine(FX1, FY1, FX2, FY2, W, R, G, B, 1.0F);
|
||
}
|
||
|
||
void setLineColor(SDL_Color color) { g_current_line_color = color; }
|
||
|
||
void setLineThickness(float thickness) {
|
||
if (thickness > 0.0F) {
|
||
g_current_line_thickness = thickness;
|
||
}
|
||
}
|
||
|
||
auto getLineThickness() -> float { return g_current_line_thickness; }
|
||
|
||
} // namespace Rendering
|