diff --git a/.DS_Store b/.DS_Store index 36cef48..e019fbc 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/frontend/src/components/BodyViewer.tsx b/frontend/src/components/BodyViewer.tsx index 1c1d417..3fadb75 100644 --- a/frontend/src/components/BodyViewer.tsx +++ b/frontend/src/components/BodyViewer.tsx @@ -141,18 +141,14 @@ export function BodyViewer({ body, disableGlow = false }: BodyViewerProps) { setModelPath(fullPath); setModelScale(mainResource.extra_data?.scale || 1.0); } else { - // Find main texture + // Find main texture: layer is surface, base, or empty const mainTexture = response.resources.find( - (r) => !r.file_path.includes('atmosphere') && - !r.file_path.includes('night') && - !r.file_path.includes('_ring') + (r) => !r.extra_data?.layer || r.extra_data.layer === 'surface' || r.extra_data.layer === 'base' ); - // Find ring texture - const bodyNameLower = body.name.toLowerCase(); + // Find ring texture: strictly by layer meta-data const ringTexture = response.resources.find( - (r) => r.file_path.toLowerCase().includes(`${bodyNameLower}_ring`) || - (r.file_path.toLowerCase().includes('ring') && r.file_path.toLowerCase().includes(bodyNameLower)) + (r) => r.extra_data?.layer === 'ring' ); if (mainTexture) { diff --git a/frontend/src/components/CelestialBody.tsx b/frontend/src/components/CelestialBody.tsx index 8400021..75e886c 100644 --- a/frontend/src/components/CelestialBody.tsx +++ b/frontend/src/components/CelestialBody.tsx @@ -112,19 +112,15 @@ function Planet({ body, size, emissive, emissiveIntensity, allBodies, isSelected fetchBodyResources(body.id, 'texture') .then((response) => { // 1. Find the main texture (body surface) - // Exclude atmosphere, night, and ring textures from main body texture + // Standard: Use layer="surface" or no layer at all const mainTexture = response.resources.find( - (r) => !r.file_path.includes('atmosphere') && - !r.file_path.includes('night') && - !r.file_path.includes('_ring') + (r) => !r.extra_data?.layer || r.extra_data.layer === 'surface' || r.extra_data.layer === 'base' ); // 2. Find the ring texture - // Convention: filename contains body name + "_ring" (e.g. "saturn_ring") - const bodyNameLower = body.name.toLowerCase(); + // Strictly use layer meta-data const ringTexture = response.resources.find( - (r) => r.file_path.toLowerCase().includes(`${bodyNameLower}_ring`) || - (r.file_path.toLowerCase().includes('ring') && r.file_path.toLowerCase().includes(bodyNameLower)) + (r) => r.extra_data?.layer === 'ring' ); if (mainTexture) {