修复星环显示

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);
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) {

View File

@ -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) {