Add male toddler character model in GLB format
All checks were successful
Deploy to production / deploy (push) Successful in 3m27s

This commit is contained in:
Torsten Schulz (local)
2026-07-30 09:59:53 +02:00
parent b3f6429307
commit 60ad24d317
38 changed files with 67 additions and 91 deletions

View File

@@ -14,6 +14,7 @@ const PROJECT_ROOT = path.join(BACKEND_DIR, '..');
const MODELS_REL = path.join('models', '3d', 'falukant', 'characters');
const DIST_MODELS = path.join(PROJECT_ROOT, 'frontend', 'dist', MODELS_REL);
const PUBLIC_MODELS = path.join(PROJECT_ROOT, 'frontend', 'public', MODELS_REL);
const SOURCE_MODELS = path.join(PROJECT_ROOT, 'frontend', 'models-src', '3d', 'falukant', 'characters');
const CACHE_DIR = path.join(BACKEND_DIR, 'data', 'model-cache');
const CLI_PATH = path.join(BACKEND_DIR, 'node_modules', '.bin', 'gltf-transform');
@@ -103,16 +104,17 @@ export async function getOptimizedModelPath(filename) {
return sourcePath;
}
const rawSourcePath = path.join(SOURCE_MODELS, filename);
if (!fs.existsSync(rawSourcePath)) {
throw new Error(`Raw source model not found: ${filename} (looked in ${SOURCE_MODELS})`);
}
const cacheFilename = filename.replace(/\.glb$/, '_opt.glb');
const cachePath = path.join(CACHE_DIR, cacheFilename);
if (!fs.existsSync(sourcePath)) {
throw new Error(`Source model not found: ${filename} (looked in ${sourceDir})`);
}
ensureCacheDir();
if (isCacheValid(sourcePath, cachePath)) {
if (isCacheValid(rawSourcePath, cachePath)) {
return cachePath;
}
@@ -120,7 +122,7 @@ export async function getOptimizedModelPath(filename) {
if (!promise) {
promise = (async () => {
try {
await runOptimize(sourcePath, cachePath);
await runOptimize(rawSourcePath, cachePath);
return cachePath;
} finally {
pending.delete(filename);