Refactoring cutscenes

This commit is contained in:
Vladislav Khorev committed 2026-06-06 22:04:42 +03:00
1 parent 7011bbb754
commit 2e5988f8f4
20 files changed
+1913 -1881

No files matched your search

+65
View File
@@ -0,0 +1,65 @@
#pragma once
#include "render/Renderer.h"
#include "UiManager.h"
#include <Eigen/Core>
namespace ZL
{
// Axis-aligned textured quad with cached mesh. Rebuild only when rect changes.
struct UiQuad {
UiRect rect{};
VertexRenderStruct mesh;
bool initialized = false;
void rebuild(const UiRect& newRect) {
rect = newRect;
mesh.data = CreateRect2D(
{ rect.x + rect.w * 0.5f, rect.y + rect.h * 0.5f },
{ rect.w * 0.5f, rect.h * 0.5f },
0.0f
);
mesh.RefreshVBO();
initialized = true;
}
void rebuildWithUV(
const UiRect& newRect,
const Eigen::Vector2f& uvBottomLeft,
const Eigen::Vector2f& uvTopLeft,
const Eigen::Vector2f& uvTopRight,
const Eigen::Vector2f& uvBottomRight
) {
rect = newRect;
const float x0 = rect.x;
const float y0 = rect.y;
const float x1 = rect.x + rect.w;
const float y1 = rect.y + rect.h;
VertexDataStruct data;
data.PositionData = {
{ x0, y0, 0.0f },
{ x0, y1, 0.0f },
{ x1, y1, 0.0f },
{ x1, y1, 0.0f },
{ x1, y0, 0.0f },
{ x0, y0, 0.0f }
};
data.TexCoordData = {
uvBottomLeft,
uvTopLeft,
uvTopRight,
uvTopRight,
uvBottomRight,
uvBottomLeft
};
mesh.AssignFrom(data);
initialized = true;
}
};
}