fix: render live V2X vehicles in Cesium preview
This commit is contained in:
@@ -7,7 +7,13 @@ const os = require("os");
|
||||
const path = require("path");
|
||||
const { cesiumPreviewHtml } = require("./lib/area-preview");
|
||||
const { makeVehicleGltf } = require("./lib/vehicle-model");
|
||||
const { VEHICLE_IDS, REVERSED_MODEL_IDS, writePreviewVehicleLibrary } = require("./lib/vehicle-library");
|
||||
const {
|
||||
VEHICLE_IDS,
|
||||
REVERSED_MODEL_IDS,
|
||||
V2X_VEHICLE_MODEL_NAMES,
|
||||
writePreviewVehicleLibrary,
|
||||
writePreviewV2xVehicleLibrary,
|
||||
} = require("./lib/vehicle-library");
|
||||
const {
|
||||
allowedTurns,
|
||||
buildVehicleRoute,
|
||||
@@ -235,6 +241,14 @@ if (fs.existsSync(vehicleLibraryRoot)) {
|
||||
}
|
||||
}
|
||||
|
||||
const v2xVehicleLibraryRoot = path.join(__dirname, "..", "assets", "models", "v2x-vehicles");
|
||||
if (fs.existsSync(v2xVehicleLibraryRoot)) {
|
||||
const v2xLibraryDir = path.join(tempDir, "v2x-vehicle-library");
|
||||
const models = writePreviewV2xVehicleLibrary(v2xLibraryDir);
|
||||
assert.deepEqual(models, V2X_VEHICLE_MODEL_NAMES.map((name) => `v2x-vehicles/${name}`));
|
||||
for (const model of models) assert.ok(fs.existsSync(path.join(v2xLibraryDir, model)));
|
||||
}
|
||||
|
||||
const html = cesiumPreviewHtml(
|
||||
"scene<&>.glb",
|
||||
"scene.json",
|
||||
@@ -298,6 +312,18 @@ assert.match(previewRuntime, /entry\.nodeKeys/,
|
||||
assert.match(previewRuntime, /paintCountdown\(/, "countDown from the push drives the countdown assets");
|
||||
assert.match(previewRuntime, /nativeSignals: \(signalData && signalData\.signals\) \|\| \[\]/,
|
||||
"the overlay needs the native signal list to bind phases");
|
||||
assert.match(previewRuntime, /registry\?\.visibleSize/,
|
||||
"diagnostics must report the visible live-vehicle count");
|
||||
assert.match(previewRuntime, /Target WS:/,
|
||||
"diagnostics must expose target websocket receipt and parsing counts");
|
||||
assert.match(previewRuntime, /Target payload:/,
|
||||
"diagnostics must expose the payload shape when target pushes have no vehicles");
|
||||
assert.match(v2xRuntime, /minimumPixelSize: 28/,
|
||||
"live vehicles remain visible from the intersection overview");
|
||||
assert.match(v2xRuntime, /LIVE_VEHICLE_HEIGHT_METERS = 1\.2/,
|
||||
"live vehicles stay clear of the static road surface");
|
||||
assert.match(v2xRuntime, /LIVE_VEHICLE_HEADING_OFFSET_DEGREES = 90/,
|
||||
"live dashboard vehicle models receive their required clockwise heading correction");
|
||||
|
||||
// Overlay-side regressions: lamp codes, heartbeat, subscription frames,
|
||||
// vehicle lifecycle and the removed out-of-scope request.
|
||||
|
||||
Reference in New Issue
Block a user