feat(world): Parkwege, Felder, Plätze, Pool und Parkplatz als eigene Schichten

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
knsoandClaude Sonnet 5 committed 2026-09-16 08:34:43 +02:00
1 parent e675e62a16
commit b736afb7ff
10 files changed
+96 -17

No files matched your search

+9 -3
View File
@@ -1,18 +1,24 @@
// Lädt die benötigten Poly-Haven-Texturen in 1k nach public/textures/.
// Lädt die benötigten Poly-Haven-Texturen in 1k nach public/textures/. Vorhandene Dateien bleiben
// unangetastet, damit ein neuer Eintrag die übrigen Texturen nicht still ändert.
import { existsSync } from "node:fs";
import { mkdir, writeFile } from "node:fs/promises";
const UA = { "User-Agent": "leonida-assets/0.1 (local hobby project)" };
const SLUGS = ["asphalt_02", "concrete_pavement_03", "white_stucco", "sand_01", "leafy_grass", "grass_path_2", "palm_bark"];
const SLUGS = ["asphalt_02", "concrete_pavement_03", "white_stucco", "sand_01", "leafy_grass", "grass_path_2", "palm_bark",
"concrete_pavement"];
const MAPS = ["Diffuse", "nor_gl", "arm"];
await mkdir("public/textures", { recursive: true });
for (const slug of SLUGS) {
if (MAPS.every((map) => existsSync(`public/textures/${slug}_${map}.jpg`))) continue;
const files = await (await fetch(`https://api.polyhaven.com/files/${slug}`, { headers: UA })).json();
for (const map of MAPS) {
const target = `public/textures/${slug}_${map}.jpg`;
if (existsSync(target)) continue;
const entry = files[map]?.["1k"]?.jpg;
if (!entry) { console.warn(`${slug}: ${map} fehlt`); continue; }
const buf = Buffer.from(await (await fetch(entry.url, { headers: UA })).arrayBuffer());
await writeFile(`public/textures/${slug}_${map}.jpg`, buf);
await writeFile(target, buf);
console.log(`${slug}_${map}.jpg ${(buf.length / 1e6).toFixed(1)} MB`);
}
}