|
|
@@ -24,7 +24,7 @@ import { getCockpitConfig, loadCockpitConfig } from './cockpitConfig.js'
|
|
|
import { attachCameraInput, createCameraControl } from './cameraControl.js'
|
|
|
import { attachPointPick } from './pointPick.js'
|
|
|
import { attachSceneFocus } from './sceneInputFocus.js'
|
|
|
-import { formatCameraState, INITIAL_PANORAMA, RETURN_FLIGHT_MS, SETTLE_EPSILON } from '../domain/camera.js'
|
|
|
+import { ENTRY_FLIGHT_MS, formatCameraState, INITIAL_PANORAMA, RETURN_FLIGHT_MS, SETTLE_EPSILON } from '../domain/camera.js'
|
|
|
import { BASEMAP_STATE, basemapStatusText, planBasemap } from '../domain/basemap.js'
|
|
|
import { isAtHome, planHome, planIntro } from '../domain/viewPresets.js'
|
|
|
import { isStaleLocate, locateTierFor, planLocateView, planTerrainLocateTarget, TERRAIN_LOCATE_REASON } from '../domain/pointLocate.js'
|
|
|
@@ -104,7 +104,7 @@ import {
|
|
|
stepHandover,
|
|
|
} from '../domain/imageryHandover.js'
|
|
|
import { planTileWarmup, runTileWarmup } from '../domain/tileWarmup.js'
|
|
|
-import { stepEntryMap } from './entryMapTransition.js'
|
|
|
+import { ENTRY_FOG_COVER_MS, entryFogStartedAt, stepEntryMap } from './entryMapTransition.js'
|
|
|
|
|
|
const ENGINE_TEXT = {
|
|
|
unavailable: 'Cesium 引擎未启动(无宿主要素)',
|
|
|
@@ -1716,14 +1716,15 @@ export function goHome(options = {}) {
|
|
|
// **先换限位再飞**:否则飞行目标 12,000 m 会被"区外"的宽上限放行、落地后才被夹,
|
|
|
// 画面会在到位瞬间跳一下。
|
|
|
// 在区域状态通知与相机起飞之前先立起入场保护,避免同步回调提前放行。
|
|
|
- const covered = fromGlobal && primaryAreaPlan.enabled && handoverEnabled()
|
|
|
+ const protectedEntry = fromGlobal && primaryAreaPlan.enabled && handoverEnabled()
|
|
|
&& overlayHandles.length > 0 && !handoverPrototypeActive
|
|
|
- if (covered) beginEntryMap(record)
|
|
|
+ if (protectedEntry) beginEntryMap(record, options.immediate)
|
|
|
setAreaState('enter')
|
|
|
const home = getHomeView()
|
|
|
- // 缩短雾内航程,尽快让 Cesium 开始处理落地视野,而不是加载沿途低精图。
|
|
|
- const applied = applyViewPreset(home, home, covered ? { flightMs: 550, ...options } : options)
|
|
|
- if (covered && !applied) clearEntryMap(record)
|
|
|
+ // 先让地球放大可见,再在近景遮挡中完成落地渲染。
|
|
|
+ const flight = protectedEntry ? { flightMs: ENTRY_FLIGHT_MS, flightCurve: 'entry', ...options } : options
|
|
|
+ const applied = applyViewPreset(home, home, flight)
|
|
|
+ if (protectedEntry && !applied) clearEntryMap(record)
|
|
|
return applied
|
|
|
}
|
|
|
|
|
|
@@ -2029,7 +2030,10 @@ export function setAreaState(action) {
|
|
|
const handoverWillHandleFogDrop = areaState !== AREA_STATE.LOCKED && handoverHandlesFogDrop()
|
|
|
|
|
|
if (action === 'returnGlobal') {
|
|
|
+ const entry = instance?.entryMap
|
|
|
if (instance) clearEntryMap(instance)
|
|
|
+ // 取消尚未显露的视距雾,避免回全球时反而把它打开。
|
|
|
+ if (entry && !entry.coverReady) settleFog(FOG_PHASE.GLOBAL)
|
|
|
// 先让交接进入"收起"(立刻排帧),雾暂不动。
|
|
|
// `force=true`:进出是离散动作,必须**这一次调用就定下**目标相位,
|
|
|
// 不能被稳态节流吞掉(否则按下返回后要等最多 120 ms 才开始收影像)。
|
|
|
@@ -2209,6 +2213,8 @@ function cameraAltitude() {
|
|
|
* 画面上的雾都至少花 `altitudeSlewMs` 变化。
|
|
|
*/
|
|
|
function fogEffectiveStrength() {
|
|
|
+ // 视距雾也不能把地球到区域的可见航段提前蒙住。
|
|
|
+ if (instance?.entryMap && !instance.entryMap.coverReady) return 0
|
|
|
const base = Math.min(fogLifecycle.strength, fogDegrade.strengthCap)
|
|
|
return Math.max(0, base * fogAltitudeShown)
|
|
|
}
|
|
|
@@ -2876,23 +2882,25 @@ function isHardRevealBlock(block) {
|
|
|
|| block === HANDOVER_BLOCK.EDGE_RISK
|
|
|
}
|
|
|
|
|
|
-const ENTRY_FOG_COVER_MS = 260 // 留足 MapCanvas 入场雾的淡入帧,再允许在雾后切换影像。
|
|
|
const ENTRY_SLOW_MS = 10000
|
|
|
|
|
|
export function isEntryMapPending() {
|
|
|
return !!instance?.entryMap && !instance.entryMap.revealed
|
|
|
}
|
|
|
|
|
|
-function beginEntryMap(record) {
|
|
|
+function beginEntryMap(record, immediate) {
|
|
|
record.cancelTileWarmup?.()
|
|
|
record.cancelTileWarmup = null
|
|
|
+ const since = engineNow()
|
|
|
+ const range = immediate ? null : record.cameraControl.getState().shownHpr.range
|
|
|
+ const coverStartedAt = entryFogStartedAt(null, { range }, since)
|
|
|
record.entryMap = {
|
|
|
- since: engineNow(), paintDetail: false, readyFrames: 0, revealed: false,
|
|
|
+ since, coverStartedAt, coverReady: false, paintDetail: false, readyFrames: 0, revealed: false,
|
|
|
layers: new Set(overlayHandles.map((handle) => handle.layer)),
|
|
|
}
|
|
|
- record.host.dataset.mapEntryFog = 'covered'
|
|
|
+ record.host.dataset.mapEntryFog = coverStartedAt === null ? 'approach' : 'covered'
|
|
|
record.entrySlowTimer = setTimeout(() => {
|
|
|
- if (record !== instance || !isEntryMapPending()) return
|
|
|
+ if (record !== instance || !isEntryMapPending() || record.entryMap.coverStartedAt === null) return
|
|
|
record.host.dataset.mapEntryFog = 'slow'
|
|
|
record.viewer.scene.requestRender()
|
|
|
}, ENTRY_SLOW_MS)
|
|
|
@@ -2913,15 +2921,23 @@ function advanceEntryMap(record) {
|
|
|
const entry = record.entryMap
|
|
|
if (!entry || entry.revealed || areaState !== AREA_STATE.LOCKED) return
|
|
|
const { scene } = record.viewer
|
|
|
- const elapsed = engineNow() - entry.since
|
|
|
- const settled = record.cameraControl?.getState().settled === true
|
|
|
+ const now = engineNow()
|
|
|
+ const elapsed = now - entry.since
|
|
|
+ const camera = record.cameraControl.getState()
|
|
|
+ const settled = camera.settled === true
|
|
|
+ const coverStartedAt = entryFogStartedAt(entry.coverStartedAt, { range: camera.shownHpr.range, settled }, now)
|
|
|
+ if (entry.coverStartedAt === null && coverStartedAt !== null) {
|
|
|
+ record.host.dataset.mapEntryFog = elapsed >= ENTRY_SLOW_MS ? 'slow' : 'covered'
|
|
|
+ }
|
|
|
+ const coverReady = coverStartedAt !== null && now - coverStartedAt >= ENTRY_FOG_COVER_MS
|
|
|
const tilesReady = scene.globe?.tilesLoaded === true
|
|
|
const gate = revealGate({ areaState, entryCovered: true, tilesLoaded: tilesReady })
|
|
|
- const readyToPaint = elapsed >= ENTRY_FOG_COVER_MS && settled && gate.allowed
|
|
|
+ const readyToPaint = coverReady && settled && gate.allowed
|
|
|
const detailDrawn = readyToPaint && entry.paintDetail && record.engine.hasRenderedEntryImagery(record.viewer, entry.layers)
|
|
|
- const next = stepEntryMap(entry, { readyToPaint, detailDrawn })
|
|
|
- next.block = detailDrawn ? null : !settled ? 'camera' : !tilesReady ? 'tiles' : 'textures'
|
|
|
+ const next = stepEntryMap({ ...entry, coverStartedAt, coverReady }, { readyToPaint, detailDrawn })
|
|
|
+ next.block = detailDrawn ? null : !settled ? 'camera' : !coverReady ? 'cover' : !tilesReady ? 'tiles' : 'textures'
|
|
|
record.entryMap = next
|
|
|
+ if (coverReady && !entry.coverReady) paintFog()
|
|
|
|
|
|
if (!entry.paintDetail && next.paintDetail) {
|
|
|
// 雾已经盖住画面:精细层立即全亮,给后续真实帧确认,不做两遍淡入。
|