mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-23 03:32:19 +00:00
Lines can fade with the age of their points, drawn by the renderer on the GPU (#1892)
* Lines can fade with the age of their points, drawn by the renderer on the GPU A LineItem's ageFade gives each position a time, a window and floors; the renderer fades the line's alpha (and optionally its width) by each point's recency on the scene clock, so a moving trail is not re-sent each frame. Capability lineAgeFade; the Cesium port draws it in its line materials from a small float texture of the points' times and a per-frame uniform, and the conformance check draw.lines.ageFade pins it. * Changelog for line age fade (#1892)
This commit is contained in:
1 parent
918435ddc7
commit
7ff536299a
12 files changed
+959
-46
No files matched your search
Vendored
+30
@@ -295,6 +295,34 @@ export type LineStyle =
|
||||
rim?: { shade: number; widthFraction: number };
|
||||
};
|
||||
|
||||
/**
|
||||
* `lineAgeFade`: a line that fades with the age of its points, drawn by the
|
||||
* renderer on the scene clock (`frame.setTime`), so a line whose points stay
|
||||
* where they are is not sent again as time passes. A point's recency is
|
||||
* `1 - clamp((now - time) / windowMs, 0, 1)`, its time running evenly
|
||||
* between neighbouring positions, so the fade is smooth along the line, not
|
||||
* stepped at its points. The line's colour (its style's, or a segment's from
|
||||
* `segmentColors`) draws at its alpha times
|
||||
* `mix(alphaFloor, 1, smoothstep(0, 1, recency))`, and with
|
||||
* `squaredAlphaFloor` times `mix(squaredAlphaFloor, 1, recency²)` as well;
|
||||
* with `widthFloor` it draws `widthPx` times `mix(widthFloor, 1, recency)`
|
||||
* wide, about its path. A point at or past the window draws at the floors, a
|
||||
* point at or after now at full strength. New `times` with new positions are
|
||||
* an ordinary update.
|
||||
*/
|
||||
export interface LineAgeFade {
|
||||
/** Each position's time, epoch ms on the scene clock: one per position. */
|
||||
times: number[] | Float64Array;
|
||||
/** The age a point fades over, ms; positive. */
|
||||
windowMs: number;
|
||||
/** A fully aged point's alpha multiplier, 0..1. */
|
||||
alphaFloor: number;
|
||||
/** A second alpha multiplier's floor, eased by recency squared, 0..1. */
|
||||
squaredAlphaFloor?: number;
|
||||
/** A fully aged point's width multiplier, 0..1 [1, no narrowing]. */
|
||||
widthFloor?: number;
|
||||
}
|
||||
|
||||
export interface LineItem {
|
||||
id: string;
|
||||
/** ECEF positions, or packed `x, y, z` triples. */
|
||||
@@ -321,6 +349,8 @@ export interface LineItem {
|
||||
segmentShow?: boolean[];
|
||||
/** Draw only the first fraction of the line, 0..1. */
|
||||
revealFraction?: number;
|
||||
/** `lineAgeFade`: fade the line with the age of its points (`LineAgeFade`). */
|
||||
ageFade?: LineAgeFade;
|
||||
/** Positions are in a frame rotating with the sky (orbits). */
|
||||
frame?: 'fixed' | 'inertial';
|
||||
meta?: Meta;
|
||||
|
||||
Reference in new issue
Block a user