feat(world): Poly-Haven-Materialien, Wasser, Himmel und mitlaufende Schatten
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
289bbbba1d
commit
fb0d19c2e5
25 files changed
+160
-14
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { MATERIAL_KEYS, TEXTURES, waterNormalData } from "../src/world/materials.js";
|
||||
import { buildChunkGeometry } from "../src/world/geometry.js";
|
||||
|
||||
describe("materials", () => {
|
||||
it("deckt genau die Geometrie-Teile ab", () => {
|
||||
const chunk = { chunk: [0, 0], origin: [0, 0], land: [], roads: [], centerlines: [], buildings: [], palms: [] };
|
||||
expect(Object.keys(buildChunkGeometry(chunk)).sort()).toEqual([...MATERIAL_KEYS].sort());
|
||||
});
|
||||
|
||||
it("nennt für jedes Material eine Textur", () => {
|
||||
for (const key of MATERIAL_KEYS) expect(TEXTURES[key]).toBeTruthy();
|
||||
});
|
||||
|
||||
it("deckt Strand und Park mit eigenen Materialien ab", () => {
|
||||
expect(MATERIAL_KEYS).toContain("sand");
|
||||
expect(MATERIAL_KEYS).toContain("park");
|
||||
});
|
||||
|
||||
it("erzeugt eine Wellen-Normalmap mit neutraler Grundfarbe", () => {
|
||||
const data = waterNormalData(32);
|
||||
expect(data.length).toBe(32 * 32 * 4);
|
||||
// Normalen zeigen im Mittel nach oben: Blaukanal nahe 255.
|
||||
const blue = [...data].filter((_, i) => i % 4 === 2);
|
||||
expect(blue.reduce((a, b) => a + b, 0) / blue.length).toBeGreaterThan(200);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user