mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 09:12:18 +00:00
Draw Bhote Koshi and awareness pulses through engine.ground
Render the Bhote Koshi event and locator through one ground and point display. Keep Cesium's reveal paths, dashed halo, glowing core, polygon classification, pick identities and independent point outline opacity. Add static pixel dash masks, synchronous ground reveals after terrain bounds load, and per-point outline colour so the shared display preserves those behaviours. Add a ground pulse field with checked state on all three engines. Keep Cesium's raised material disc, band equations, front widths, wake and rest timing and reduced-motion behaviour. Navara now follows Cesium's raised pulse surface and story styling, with ground effects composed after tone mapping. Move the wind mesh shader into the Navara engine without changing its transparent pass. Layer renderer lines fall from 210 to 14 for Cesium and from 794 to 314 for Navara. Viewer lines fall from 953 to 948, extension reads from 6 to 4, and engine-name lines from 37 to 36. No coupling count grows. Checked in the browser, keyless: the contract suite, with its new pulse pixel checks, passes on Navara and on Cesium apart from the camera-events check that also fails intermittently before; the Nepal locator and Contacts engine switches pass. The Nepal event and wind engine switches fail the same way before this change. Side by side at the locator's overview, Cesium draws the same pixels as before and Navara's river corridor now glows as Cesium's does, where it was faint.
This commit is contained in:
1 parent
dacfd33f10
commit
f385986383
50 files changed
+1438
-520
No files matched your search
+58
-11
@@ -18,6 +18,7 @@
|
||||
// under it); identify() names a picked item.
|
||||
|
||||
import * as Cesium from 'cesium';
|
||||
import { createCesiumPulseField } from './groundPulse.js';
|
||||
import {
|
||||
areaRings,
|
||||
createGroundRegistry,
|
||||
@@ -119,14 +120,21 @@ export function corridorUniforms(item) {
|
||||
}
|
||||
|
||||
const corridorMaterial = (item) =>
|
||||
new Cesium.Material({
|
||||
fabric: {
|
||||
type: CORRIDOR_MATERIAL,
|
||||
uniforms: corridorUniforms(item),
|
||||
source: CORRIDOR_SOURCE,
|
||||
},
|
||||
translucent: true,
|
||||
});
|
||||
item.animation.pattern
|
||||
? Cesium.Material.fromType('PolylineDash', {
|
||||
color: colorOf(item.fill),
|
||||
gapColor: Cesium.Color.TRANSPARENT,
|
||||
dashLength: item.animation.pattern.lengthPx,
|
||||
dashPattern: item.animation.pattern.pattern,
|
||||
})
|
||||
: new Cesium.Material({
|
||||
fabric: {
|
||||
type: CORRIDOR_MATERIAL,
|
||||
uniforms: corridorUniforms(item),
|
||||
source: CORRIDOR_SOURCE,
|
||||
},
|
||||
translucent: true,
|
||||
});
|
||||
|
||||
// Items of one look and colour share a primitive.
|
||||
const lookKey = (item) =>
|
||||
@@ -270,6 +278,10 @@ export function createCesiumGround(
|
||||
) {
|
||||
const make = { ...DEFAULT_FACTORIES, ...factories };
|
||||
const { scene } = viewer;
|
||||
let heightsReady =
|
||||
make.lines !== DEFAULT_FACTORIES.lines &&
|
||||
make.fills !== DEFAULT_FACTORIES.fills;
|
||||
let heightsPromise = null;
|
||||
let root = null;
|
||||
const ordered = [];
|
||||
const building = new Set();
|
||||
@@ -322,7 +334,7 @@ export function createCesiumGround(
|
||||
}
|
||||
return root;
|
||||
};
|
||||
const registry = createGroundRegistry((options) => {
|
||||
const build = (options) => {
|
||||
const slot = new Cesium.PrimitiveCollection({ destroyPrimitives: true });
|
||||
const at = ordered.filter((entry) => entry.order <= options.order).length;
|
||||
ordered.splice(at, 0, { order: options.order, slot });
|
||||
@@ -331,14 +343,37 @@ export function createCesiumGround(
|
||||
let looks = [];
|
||||
const classificationType = classificationOf(options.drape);
|
||||
const allowPicking = options.pickable;
|
||||
let pending = null;
|
||||
let waiting = false;
|
||||
let destroyed = false;
|
||||
const forget = () => {
|
||||
for (const primitive of drawn) building.delete(primitive);
|
||||
for (const material of looks) materials.delete(material);
|
||||
drawn = [];
|
||||
looks = [];
|
||||
};
|
||||
return {
|
||||
const part = {
|
||||
commit(items) {
|
||||
pending = items;
|
||||
if (options.dynamic && !heightsReady) {
|
||||
if (!waiting) {
|
||||
waiting = true;
|
||||
heightsPromise ??=
|
||||
Cesium.GroundPrimitive.initializeTerrainHeights();
|
||||
heightsPromise.then(
|
||||
() => {
|
||||
heightsReady = true;
|
||||
waiting = false;
|
||||
if (!destroyed) part.commit(pending);
|
||||
},
|
||||
() => {
|
||||
heightsPromise = null;
|
||||
waiting = false;
|
||||
},
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
forget();
|
||||
slot.removeAll();
|
||||
const { fills, lines, animated } = groundInstances(options, items);
|
||||
@@ -352,6 +387,7 @@ export function createCesiumGround(
|
||||
}),
|
||||
classificationType,
|
||||
allowPicking,
|
||||
asynchronous: !options.dynamic,
|
||||
}),
|
||||
);
|
||||
if (lines.length)
|
||||
@@ -361,6 +397,7 @@ export function createCesiumGround(
|
||||
appearance: new Cesium.PolylineColorAppearance(),
|
||||
classificationType,
|
||||
allowPicking,
|
||||
asynchronous: !options.dynamic,
|
||||
}),
|
||||
);
|
||||
for (const { item, instances } of animated) {
|
||||
@@ -374,6 +411,7 @@ export function createCesiumGround(
|
||||
appearance: new Cesium.PolylineMaterialAppearance({ material }),
|
||||
classificationType,
|
||||
allowPicking,
|
||||
asynchronous: !options.dynamic,
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -391,8 +429,13 @@ export function createCesiumGround(
|
||||
animate();
|
||||
requestRender('ground');
|
||||
},
|
||||
ready: () => drawn.every((primitive) => primitive.ready === true),
|
||||
ready: () =>
|
||||
(!options.dynamic || heightsReady) &&
|
||||
!waiting &&
|
||||
drawn.every((primitive) => primitive.ready === true),
|
||||
destroy() {
|
||||
destroyed = true;
|
||||
pending = null;
|
||||
forget();
|
||||
animate();
|
||||
ordered.splice(
|
||||
@@ -403,6 +446,10 @@ export function createCesiumGround(
|
||||
requestRender('ground');
|
||||
},
|
||||
};
|
||||
return part;
|
||||
};
|
||||
const registry = createGroundRegistry(build, {
|
||||
pulseField: (options) => createCesiumPulseField(viewer, options),
|
||||
});
|
||||
return {
|
||||
ground: registry.ground,
|
||||
|
||||
Reference in new issue
Block a user