This commit is contained in:
2026-11-05 09:57:11 -05:00
parent d34388bf2c
commit 89e392cc2e
81 changed files with 12410 additions and 1135 deletions
+10 -1
View File
@@ -7,6 +7,7 @@ import { BODY_PROFILES, playerB3D, soundOGG, SOUND_PROFILES, TOOL_NAMES, toolOBJ
import { ANIMAL_NAMES, BOTANY_CATALOGUE, animalOBJ, contactSheet, legacyPixel, worldArt } from './world-art.mjs';
import { FLORA_NAMES, TREE_SEASONS, SPECIES_ATLAS_NAMES, floraOBJ, treeAtlas } from './flora-art.mjs';
import { CHARACTER_ART_MANIFEST, CHARACTER_OPTIONS, characterArt, characterMesh, compositeCharacter, portraitSheet } from './character-art.mjs';
import { FAUNA_NAMES, FAUNA_ANIMATIONS, FAUNA_ART_MANIFEST, faunaB3D, faunaTexture, faunaPortraitSheet } from './fauna-art.mjs';
function crc32(data) {
let crc = 0xffffffff;
@@ -119,7 +120,9 @@ export async function generateAssets(destination, source) {
(x,y)=>trees.data.subarray((y*trees.width+x)*4,(y*trees.width+x+1)*4), trees.height));
}
for (const name of SPECIES_ATLAS_NAMES) {
const [species, , season='summer'] = name.split('_'), trees=treeAtlas(art,season,species);
const match=/^([a-z]+(?:_[a-z]+)*)_atlas(?:_(spring|autumn|winter))?$/.exec(name);
if(!match) throw new Error('Invalid species atlas name');
const [,species,season='summer']=match, trees=treeAtlas(art,season,species);
await writeAsset(textures, `hearth_${name}.png`, png(trees.width,
(x,y)=>trees.data.subarray((y*trees.width+x)*4,(y*trees.width+x+1)*4), trees.height));
}
@@ -135,6 +138,11 @@ export async function generateAssets(destination, source) {
}
const encode = image => png(image.width,
(x,y)=>image.data.subarray((y*image.width+x)*4,(y*image.width+x+1)*4),image.height);
for(const id of FAUNA_NAMES) await writeAsset(textures,`hearth_fauna_${id}.png`,encode(faunaTexture(id)));
await writeAsset(textures,'hearth_fauna_contact_sheet.png',encode(faunaPortraitSheet()));
await writeAsset(destination,'fauna-art.json',JSON.stringify({format:1,animations:FAUNA_ANIMATIONS,
animals:FAUNA_ART_MANIFEST,portraitSheet:{filename:'hearth_fauna_contact_sheet.png',width:512,height:768,
frame:9,columns:4,cellSize:128,order:FAUNA_NAMES}},null,2)+'\n');
for (const [name,image] of characterArt()) await writeAsset(textures,name,encode(image));
await writeAsset(textures,'hearth_person.png',encode(compositeCharacter()));
await writeAsset(textures,'hearth_character_contact_sheet.png',encode(portraitSheet()));
@@ -146,6 +154,7 @@ export async function generateAssets(destination, source) {
await ensureDirectory(models);
for (const name of FLORA_NAMES) await writeAsset(models, `hearth_${name}.obj`, floraOBJ(name));
for (const name of ANIMAL_NAMES) await writeAsset(models, `hearth_${name}.obj`, animalOBJ(name));
for (const id of FAUNA_NAMES) await writeAsset(models,`hearth_fauna_${id}.b3d`,faunaB3D(id));
let vertices = 0;
const obj = ['# Original Last Hearth block character', 'vt 0 0','vt 1 0','vt 1 1','vt 0 1'];
function box(x0,y0,z0,x1,y1,z1) {