mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Draw civil flights from an icon set moved on the GPU
Every flight is now a row in the layer's icon set. Its motion segment follows the same regime `_deadReckon` picks (interpolate between fixes, warm up backward from the oldest, coast forward from the newest), and one shared `_motionRegime` makes that choice for both. The shader moves every untracked contact between polls, so the 12 Hz fleet tick no longer touches each billboard. It now only re-plans expired rows, floors grounded contacts, advances focus while needed, and runs the 3D model regime. Grounded contacts the floor lifts are pinned to a hold at the floored position. Their nose glides on the GPU. Contacts within 50 km re-floor every tick, and farther ones take turns about once a second. Low contacts are judged for the horizon at no lower than 12 m above the ellipsoid, as before. Below hover speed a contact's nose holds. A row whose fleet model is drawn keeps its focus updated, because the model reads it. Untracking re-plans and re-floors the icon from the tracked course. On the same views with about 6,700 OpenSky flights, frame gaps at p95 drop from 28-40 ms to 17 ms, and the fleet tick from 16-37 ms to about 2 ms at most.
This commit is contained in:
1 parent
37dd4058c1
commit
fa3a3a3bca
33 files changed
+1598
-986
No files matched your search
+18
-2
@@ -45,7 +45,7 @@ const COURSE0 = 19; // deg
|
||||
const COURSE_SLOPE = 20; // lerp: deg per unit fraction
|
||||
const SLEW_OFFSET = 21; // deg still to glide at SLEW_T0
|
||||
const SLEW_T0 = 22; // s
|
||||
const SLEW_RATE = 23; // deg/s
|
||||
const SLEW_RATE = 23; // deg/s; negative holds the course at the glide's start
|
||||
|
||||
const DEG = Math.PI / 180;
|
||||
const STRAIGHT_BELOW_RAD_PER_SEC = 1e-4;
|
||||
@@ -140,6 +140,8 @@ export function writeArcSegment(out, row, segment) {
|
||||
/**
|
||||
* Glide the displayed course from `fromCourseDeg` onto the segment's own course,
|
||||
* at most `rateDps`, starting at `t0` (the rate limit at a segment boundary).
|
||||
* A rate of zero or less holds `fromCourseDeg` for the whole segment instead
|
||||
* (a hover: the nose keeps its heading however the track moves).
|
||||
* Call after writing the segment.
|
||||
* @param {Float32Array} out
|
||||
* @param {number} row
|
||||
@@ -153,7 +155,7 @@ export function writeCourseGlide(out, row, fromCourseDeg, t0, rateDps) {
|
||||
const target = targetCourse(out, o, t0);
|
||||
out[o + SLEW_OFFSET] = norm180(fromCourseDeg - target);
|
||||
out[o + SLEW_T0] = t0;
|
||||
out[o + SLEW_RATE] = Math.max(0, rateDps);
|
||||
out[o + SLEW_RATE] = rateDps > 0 ? rateDps : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,6 +197,8 @@ export function segmentCourse(seg, row, tau) {
|
||||
const o = row * SEGMENT_STRIDE;
|
||||
const course = targetCourse(seg, o, tau);
|
||||
const offset = seg[o + SLEW_OFFSET];
|
||||
if (seg[o + SLEW_RATE] < 0)
|
||||
return norm360(targetCourse(seg, o, seg[o + SLEW_T0]) + offset);
|
||||
if (offset === 0) return norm360(course);
|
||||
// limitCourseStep: the displayed course turns at the rate toward the segment's
|
||||
// own (possibly turning) course until it reaches it, then follows it. The
|
||||
@@ -207,6 +211,17 @@ export function segmentCourse(seg, row, tau) {
|
||||
return norm360(turned < gap ? start + offset + toward * turned : course);
|
||||
}
|
||||
|
||||
/**
|
||||
* The course the row glides toward at `tau` (its segment's own course).
|
||||
* @param {Float32Array} seg
|
||||
* @param {number} row
|
||||
* @param {number} tau
|
||||
* @returns {number}
|
||||
*/
|
||||
export function segmentTargetCourse(seg, row, tau) {
|
||||
return norm360(targetCourse(seg, row * SEGMENT_STRIDE, tau));
|
||||
}
|
||||
|
||||
/** The segment's own course at `tau`, before any glide. */
|
||||
function targetCourse(seg, o, tau) {
|
||||
const kind = seg[o + KIND];
|
||||
@@ -310,6 +325,7 @@ float iconTargetCourse(vec4 seg3, vec4 seg4, vec4 seg5, float tau) {
|
||||
float iconSegmentCourse(vec4 seg3, vec4 seg4, vec4 seg5, float tau) {
|
||||
float course = iconTargetCourse(seg3, seg4, seg5, tau);
|
||||
float offset = seg5.y;
|
||||
if (seg5.w < 0.0) return iconTargetCourse(seg3, seg4, seg5, seg5.z) + offset;
|
||||
if (offset == 0.0) return course;
|
||||
float toward = -sign(offset);
|
||||
float start = iconTargetCourse(seg3, seg4, seg5, seg5.z);
|
||||
|
||||
Reference in new issue
Block a user