mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Read vessel, CCTV and FIRMS billboard state from Core's mirror
The three layers now add their billboards through addBillboard and write the mirrored fields through setBillboard, so selection, cards, queries, focus, view thinning and the FIRMS horizon cull read what was pushed from Core instead of from Cesium. Vessels and FIRMS state their sprites' own sizes (32 px ship artwork, the glow canvas at twice the core size), which the mirror needs. A vessel helper, iconPosition, replaces the repeated mirror-or-visual position lookups, and the vessel visibility pass writes show only when it changes, as CCTV and FIRMS already did. A billboard never given a position now has none in the mirror rather than the origin.
This commit is contained in:
1 parent
1cfff5803a
commit
47f7eeb00e
23 files changed
+152
-97
No files matched your search
@@ -13,6 +13,7 @@ import {
|
||||
CULL_LIFT_M,
|
||||
LABEL_MIN_SEP_PX,
|
||||
} from './policy.js';
|
||||
import { billboardState, setBillboard } from '../../data/billboardMirror.js';
|
||||
|
||||
export function createModel({
|
||||
layerState,
|
||||
@@ -273,9 +274,9 @@ export function createModel({
|
||||
* the opposite side of the Earth shine through the planet at tilted mid-altitude
|
||||
* views. Same pattern as the flights/CCTV layers' `EllipsoidalOccluder` passes.
|
||||
*
|
||||
* Pure and allocation-free: reads `billboard.position`, writes `billboard.show`
|
||||
* only when it actually flips (assigning `show` dirties the collection's vertex
|
||||
* buffer). Accepts any `{length, get(i)}` shape so it is unit-testable without
|
||||
* Pure and allocation-free: reads the billboard's mirrored position and show,
|
||||
* and writes `show` only when it actually flips (assigning `show` dirties the
|
||||
* collection's vertex buffer). Accepts any `{length, get(i)}` shape so it is unit-testable without
|
||||
* a WebGL scene.
|
||||
*
|
||||
* @param {?{length: number, get: function(number): (Object|undefined)}} billboards
|
||||
@@ -295,9 +296,10 @@ export function createModel({
|
||||
for (let i = 0; i < total; i += 1) {
|
||||
const billboard = billboards.get(i);
|
||||
if (!billboard) continue;
|
||||
const point = (cullPositions && cullPositions[i]) || billboard.position;
|
||||
const pushed = billboardState(billboard);
|
||||
const point = (cullPositions && cullPositions[i]) || pushed.position;
|
||||
const visible = occluder.isPointVisible(point) === true;
|
||||
if (billboard.show !== visible) billboard.show = visible;
|
||||
if (pushed.show !== visible) setBillboard(billboard, 'show', visible);
|
||||
if (visible) visibleCount += 1;
|
||||
}
|
||||
return visibleCount;
|
||||
|
||||
@@ -2,6 +2,7 @@ import * as Cesium from 'cesium';
|
||||
import { FIRMS_OVERLAY_SOURCE_ID } from '../../data/firmsLabels.js';
|
||||
import { horizonOccluder } from '../../data/iconOrientation.js';
|
||||
import { LOD_LEVELS, CONTEXT_TOP_N } from './policy.js';
|
||||
import { addBillboard } from '../../data/billboardMirror.js';
|
||||
|
||||
export function createRendering({
|
||||
layerState,
|
||||
@@ -237,13 +238,17 @@ export function createRendering({
|
||||
const pickId = `firms-${fire.index}`;
|
||||
layerState._pickIndexById.set(pickId, fire);
|
||||
layerState._cullPositions.push(cullPosition);
|
||||
layerState._billboards.add({
|
||||
const corePx = components.model.sizeBucket(coreSize);
|
||||
addBillboard(layerState._billboards, {
|
||||
id: pickId,
|
||||
position,
|
||||
image: components.model.glowSprite(
|
||||
components.model.detectionColorStop(fire),
|
||||
components.model.sizeBucket(coreSize),
|
||||
corePx,
|
||||
),
|
||||
// The glow sprite's own size (see glowSprite), stated for Core's mirror.
|
||||
width: corePx * 2,
|
||||
height: corePx * 2,
|
||||
verticalOrigin: Cesium.VerticalOrigin.CENTER,
|
||||
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
||||
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
||||
|
||||
Reference in new issue
Block a user