feat(notifier): infrastructura del sistema de notificacions toast
- Notifier singleton (System::init/get/destroy) que dibuixa un cuadre
centrat al centre-superior amb fons semitransparent (derivat oscur del
color del text) i bordes en línies.
- Màquina d'estats HIDDEN → ENTERING → HOLDING → EXITING amb easing
outCubic (entrada) i inCubic (sortida), slide de 300 ms.
- pushRect() afegit a GpuFrameRenderer (2 triangles, edge_dist=0) per
poder pintar el fons opac/semitransparent reutilitzant el pipeline de
línies — sense afegir cap pipeline nou.
- VectorText::render/renderCentered admeten color RGBA explícit
(default {0,0,0,0} preserva el comportament previ amb oscil·lador
global de color).
- Easing header-only a core/utils/easing.hpp (outCubic, inCubic).
- Director crea Notifier just després del DebugOverlay i el draweja com
a última capa per damunt de l'escena i el debug.
Encara cap consumer el crida; els F1-F5 i la doble pulsació d'ESC
arriben en commits posteriors.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -269,6 +269,31 @@ namespace Rendering::GPU {
|
||||
indices_.push_back(BASE_INDEX + 2);
|
||||
}
|
||||
|
||||
void GpuFrameRenderer::pushRect(float x, float y, float w, float h, float r, float g, float b, float a) {
|
||||
if (w <= 0.0F || h <= 0.0F) {
|
||||
return;
|
||||
}
|
||||
const float X1 = x;
|
||||
const float Y1 = y;
|
||||
const float X2 = x + w;
|
||||
const float Y2 = y + h;
|
||||
|
||||
const auto BASE_INDEX = static_cast<uint16_t>(vertices_.size());
|
||||
|
||||
// edge_dist=0 → el fragment shader dóna alpha plena (no fade).
|
||||
vertices_.push_back({X1, Y1, r, g, b, a, 0.0F});
|
||||
vertices_.push_back({X2, Y1, r, g, b, a, 0.0F});
|
||||
vertices_.push_back({X1, Y2, r, g, b, a, 0.0F});
|
||||
vertices_.push_back({X2, Y2, r, g, b, a, 0.0F});
|
||||
|
||||
indices_.push_back(BASE_INDEX + 0);
|
||||
indices_.push_back(BASE_INDEX + 1);
|
||||
indices_.push_back(BASE_INDEX + 2);
|
||||
indices_.push_back(BASE_INDEX + 1);
|
||||
indices_.push_back(BASE_INDEX + 3);
|
||||
indices_.push_back(BASE_INDEX + 2);
|
||||
}
|
||||
|
||||
void GpuFrameRenderer::flushBatch() {
|
||||
if (vertices_.empty() || indices_.empty()) {
|
||||
return;
|
||||
|
||||
@@ -74,6 +74,13 @@ namespace Rendering::GPU {
|
||||
// Encola una línea con grosor configurable (px). Color RGBA en [0..1].
|
||||
void pushLine(float x1, float y1, float x2, float y2, float thickness, float r, float g, float b, float a);
|
||||
|
||||
// Encola un rectàngle massís (2 triangles) amb color RGBA [0..1]. Es
|
||||
// remet pel mateix pipeline de líneas (TRIANGLELIST + alpha blend); els
|
||||
// vèrtexs es marquen amb edge_dist=0 perquè el fragment shader doni
|
||||
// alpha completa sense fade geomètric. Útil per a fons semitransparents
|
||||
// d'UI (notificacions, panels).
|
||||
void pushRect(float x, float y, float w, float h, float r, float g, float b, float a);
|
||||
|
||||
// endFrame: flush del batch de líneas → composite postpro → submit + presenta.
|
||||
void endFrame();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user