feat(client): overlay de fronteira -- ajustes + materiais e external actor

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-17 22:44:11 -03:00
parent 1f2441bde7
commit a3f2fa9c06
12 changed files with 23 additions and 10 deletions

View File

@@ -18,20 +18,33 @@ namespace
const FColor kLabelAlive(93, 213, 255); // ciano -- server online
const FColor kLabelDead(255, 90, 90); // vermelho -- server offline / cell vazia
// Offset do cellId de filha de split (espelha CHILD_CELLID_OFFSET do server).
constexpr uint32 kChildCellIdOffset = 1000000u;
// Decodifica o cellId int na notacao de quadtree: raiz -> "0".."3"; filha ->
// "<pai>,<quadrante>" (ex "0,2"); neto -> "0,2,1" (recursivo). Espelha
// childCellId = offset + pai*4 + quadrante do SplitCoordinator.
// Decodifica o cellId na notacao "raiz fora, splits no array" da k-d tree
// binaria: raiz pura -> "0"; derivada -> "0,[0,1]". Espelha o layout
// bit-packed de Server/ZeusServices/Shared/types/src/cell-id.ts:
// bit 30 = flag (1 = cell derivada de split)
// bits 29..26 = depth (profundidade de split)
// bits 25..15 = rootId (cell raiz do baseGrid)
// bits 14..0 = path (1 bit por nivel, MSB-first)
FString DecodeCellPath(uint32 CellId)
{
if (CellId < kChildCellIdOffset)
constexpr uint32 kFlagBit = 1u << 30;
if ((CellId & kFlagBit) == 0u)
{
return FString::Printf(TEXT("%u"), CellId);
return FString::Printf(TEXT("%u"), CellId); // raiz pura
}
const uint32 Rel = CellId - kChildCellIdOffset;
return DecodeCellPath(Rel / 4u) + FString::Printf(TEXT(",%u"), Rel % 4u);
const uint32 Depth = (CellId >> 26) & 0xFu;
const uint32 Root = (CellId >> 15) & 0x7FFu;
const uint32 Packed = CellId & 0x7FFFu;
FString Path;
for (uint32 i = 0; i < Depth; ++i)
{
if (i > 0)
{
Path += TEXT(",");
}
Path += ((Packed >> (14u - i)) & 1u) ? TEXT("1") : TEXT("0");
}
return FString::Printf(TEXT("%u,[%s]"), Root, *Path);
}
// Aresta compartilhada entre dois retangulos axis-aligned (no plano XY).