Render NameLayer text with MSDF assets

This commit is contained in:
scamiv
2026-05-09 02:14:44 +02:00
parent be3bab84ed
commit a60e72ea6f
13 changed files with 3582 additions and 765 deletions
+12
View File
@@ -4,6 +4,7 @@ import {
} from "../src/client/graphics/PlayerIcons";
import {
computeNameLayerLayout,
computeNameLayerScreenMetrics,
computeNameLayerWorldScale,
computeTraitorFlashAlpha,
computeTraitorFlashDurationSeconds,
@@ -102,6 +103,17 @@ describe("NameLayerLayout", () => {
expect(computeNameLayerWorldScale(20, 2)).toBeCloseTo(6);
});
test("computes final screen-space text and icon sizes", () => {
expect(computeNameLayerScreenMetrics(8, 2)).toEqual({
fontSize: 16,
iconSize: 24,
});
expect(computeNameLayerScreenMetrics(20, 2)).toEqual({
fontSize: 48,
iconSize: 72,
});
});
test("matches traitor flash duration thresholds and alpha extrema", () => {
expect(computeTraitorFlashDurationSeconds(156)).toBeNull();
expect(computeTraitorFlashDurationSeconds(150)).toBeCloseTo(1);