Build a body still waiting for its surface with a null map, so three stops warning on each one
Since de34fff paints derived surfaces after the system is built, every body without a photograph
was given map: undefined, and three's Material.setValues warns "parameter 'map' has value of
undefined" for each: eleven warnings every time the Sun's system was entered, one per exoplanet in
any other. The marker now starts with map: null, which three takes without a word and which
the deferred paint replaces as before. In the running app, entering the Sun (38 members) now logs
no console message at all.
Control: undefined again fails "builds a body still waiting for its surface without three warning
of an undefined map".
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import * as THREE from 'three/webgpu';
|
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 { DEFAULT_EPOCH_JD, GM_SUN_AU3_PER_DAY2, TT_MINUS_UTC_DAYS, ttMinusUtSeconds } from '../../shared/astro/constants';
|
||||||
import { keplerRates } from '../../shared/astro/kepler';
|
import { keplerRates } from '../../shared/astro/kepler';
|
||||||
@@ -465,6 +465,13 @@ describe('derived surfaces', () => {
|
|||||||
renderer.dispose();
|
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 () => {
|
it('paints nothing once the system is left', async () => {
|
||||||
const renderer = twoPlanets();
|
const renderer = twoPlanets();
|
||||||
renderer.dispose();
|
renderer.dispose();
|
||||||
|
|||||||
@@ -180,7 +180,9 @@ function buildMarker(
|
|||||||
): THREE.Mesh {
|
): THREE.Mesh {
|
||||||
const geometry = new THREE.SphereGeometry(bodyMarkerRadiusAu(radiusKm), MARKER_WIDTH_SEGMENTS, MARKER_HEIGHT_SEGMENTS);
|
const geometry = new THREE.SphereGeometry(bodyMarkerRadiusAu(radiusKm), MARKER_WIDTH_SEGMENTS, MARKER_HEIGHT_SEGMENTS);
|
||||||
const photograph = id ? bodyTexturePath(id) : undefined;
|
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({
|
const material = new THREE.MeshStandardMaterial({
|
||||||
map,
|
map,
|
||||||
color: map ? 0xffffff : colorForKind(kind),
|
color: map ? 0xffffff : colorForKind(kind),
|
||||||
|
|||||||
Reference in New Issue
Block a user