From 00df13c070eeacb55fbdc73c8d337c44289dcc9e Mon Sep 17 00:00:00 2001 From: "mula.liu" Date: Fri, 2 Jan 2026 02:56:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=98=9F=E7=8E=AF=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 14340 -> 14340 bytes frontend/src/components/BodyViewer.tsx | 12 ++++-------- frontend/src/components/CelestialBody.tsx | 12 ++++-------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/.DS_Store b/.DS_Store index 36cef4862813ab0caac268363d351b8dbe772b52..e019fbc85ced835fc1c9a22e75e66378bd0e4a4f 100644 GIT binary patch delta 14 VcmZoEXerpBt;oo@Sx51P7yu{61l0fl delta 14 VcmZoEXerpBt;oo*Sx51P7yu{01k?Zk 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) {