diff --git a/src/app/features/galaxy-system/system-orbits-renderer.spec.ts b/src/app/features/galaxy-system/system-orbits-renderer.spec.ts index a37df6b..0512976 100644 --- a/src/app/features/galaxy-system/system-orbits-renderer.spec.ts +++ b/src/app/features/galaxy-system/system-orbits-renderer.spec.ts @@ -1,5 +1,5 @@ import * as THREE from 'three/webgpu'; -import { describe, expect, it } from 'vitest'; +import { describe, expect, it, vi } from 'vitest'; import { DEFAULT_EPOCH_JD, GM_SUN_AU3_PER_DAY2, TT_MINUS_UTC_DAYS, ttMinusUtSeconds } from '../../shared/astro/constants'; import { keplerRates } from '../../shared/astro/kepler'; @@ -465,6 +465,13 @@ describe('derived surfaces', () => { renderer.dispose(); }); + it('builds a body still waiting for its surface without three warning of an undefined map', () => { + const warn = vi.spyOn(console, 'warn'); + twoPlanets().dispose(); + expect(warn.mock.calls.flat().join(' ')).not.toContain("parameter 'map'"); + warn.mockRestore(); + }); + it('paints nothing once the system is left', async () => { const renderer = twoPlanets(); renderer.dispose(); diff --git a/src/app/features/galaxy-system/system-orbits-renderer.ts b/src/app/features/galaxy-system/system-orbits-renderer.ts index fdadb0f..7b209b7 100644 --- a/src/app/features/galaxy-system/system-orbits-renderer.ts +++ b/src/app/features/galaxy-system/system-orbits-renderer.ts @@ -180,7 +180,9 @@ function buildMarker( ): THREE.Mesh { const geometry = new THREE.SphereGeometry(bodyMarkerRadiusAu(radiusKm), MARKER_WIDTH_SEGMENTS, MARKER_HEIGHT_SEGMENTS); const photograph = id ? bodyTexturePath(id) : undefined; - const map = photograph ? loadCachedTexture(photograph) : undefined; + // null, not undefined, where there is none yet: three warns "parameter 'map' has value of + // undefined" for every body built so, eleven of them on entering the Sun's system. + const map = photograph ? loadCachedTexture(photograph) : null; const material = new THREE.MeshStandardMaterial({ map, color: map ? 0xffffff : colorForKind(kind),