修复星环显示

main
mula.liu 2026-01-02 02:56:32 +08:00
parent 638561d86d
commit 00df13c070
3 changed files with 8 additions and 16 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -141,18 +141,14 @@ export function BodyViewer({ body, disableGlow = false }: BodyViewerProps) {
setModelPath(fullPath); setModelPath(fullPath);
setModelScale(mainResource.extra_data?.scale || 1.0); setModelScale(mainResource.extra_data?.scale || 1.0);
} else { } else {
// Find main texture // Find main texture: layer is surface, base, or empty
const mainTexture = response.resources.find( const mainTexture = response.resources.find(
(r) => !r.file_path.includes('atmosphere') && (r) => !r.extra_data?.layer || r.extra_data.layer === 'surface' || r.extra_data.layer === 'base'
!r.file_path.includes('night') &&
!r.file_path.includes('_ring')
); );
// Find ring texture // Find ring texture: strictly by layer meta-data
const bodyNameLower = body.name.toLowerCase();
const ringTexture = response.resources.find( const ringTexture = response.resources.find(
(r) => r.file_path.toLowerCase().includes(`${bodyNameLower}_ring`) || (r) => r.extra_data?.layer === 'ring'
(r.file_path.toLowerCase().includes('ring') && r.file_path.toLowerCase().includes(bodyNameLower))
); );
if (mainTexture) { if (mainTexture) {

View File

@ -112,19 +112,15 @@ function Planet({ body, size, emissive, emissiveIntensity, allBodies, isSelected
fetchBodyResources(body.id, 'texture') fetchBodyResources(body.id, 'texture')
.then((response) => { .then((response) => {
// 1. Find the main texture (body surface) // 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( const mainTexture = response.resources.find(
(r) => !r.file_path.includes('atmosphere') && (r) => !r.extra_data?.layer || r.extra_data.layer === 'surface' || r.extra_data.layer === 'base'
!r.file_path.includes('night') &&
!r.file_path.includes('_ring')
); );
// 2. Find the ring texture // 2. Find the ring texture
// Convention: filename contains body name + "_ring" (e.g. "saturn_ring") // Strictly use layer meta-data
const bodyNameLower = body.name.toLowerCase();
const ringTexture = response.resources.find( const ringTexture = response.resources.find(
(r) => r.file_path.toLowerCase().includes(`${bodyNameLower}_ring`) || (r) => r.extra_data?.layer === 'ring'
(r.file_path.toLowerCase().includes('ring') && r.file_path.toLowerCase().includes(bodyNameLower))
); );
if (mainTexture) { if (mainTexture) {