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,18 @@
|
||||
// Lädt die benötigten Poly-Haven-Texturen in 1k nach public/textures/.
|
||||
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 MAPS = ["Diffuse", "nor_gl", "arm"];
|
||||
|
||||
await mkdir("public/textures", { recursive: true });
|
||||
for (const slug of SLUGS) {
|
||||
const files = await (await fetch(`https://api.polyhaven.com/files/${slug}`, { headers: UA })).json();
|
||||
for (const map of MAPS) {
|
||||
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);
|
||||
console.log(`${slug}_${map}.jpg ${(buf.length / 1e6).toFixed(1)} MB`);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user