mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-23 03:32:19 +00:00
feat(aircraft): draw far-away aircraft as shaded sprites seen from the camera's angle
Aircraft on the map were flat, top-down SVG silhouettes turned along
their course: from an oblique camera they read as paper cut-outs lying
on the ground.
Each aircraft class (and each helicopter rotor frame) is now rendered in
Blender from a sphere of directions into one sheet of shaded sprites
(public/sprites/aircraft-views.webp: 302 views a class, 7.5 degrees
apart from straight above to 30 degrees below the horizon, 4096 x 3648,
grey, 3.1 MB). The renderer lays a contact flat on the ground along its
course, works out where the eye is in that frame and draws the nearest
view, mirrored for the port side. The view is a card standing at the
contact, square to the direction it was rendered from, so between views
the sprite is tilted (foreshortened and turned) as the aircraft would
be; views are not blended. Sprites are neutral, so the fleet, tracked
and military tints still apply.
Renderer: a new `viewSheets` capability, `DrawPort.views(id, sheet)` and
an image `{views, first, fallback}` for icon items (src/data/viewSheet.js
holds the layout and maths, in JS and GLSL). A view row draws from the
sheet's own texture, kept as luminance and alpha; until the sheet has
loaded, and if it cannot load, it draws its flat `fallback` along its
course as before. View sheets are offered on WebGL 2 only, and on
WebGL 1 the icon shader is as it was.
Layers: Flights, Military Flights (fleet and tracked contact) and Local
ADS-B draw views; the TR-3B, airport vehicles, ground stations and
Cockpit's far pips stay flat, as does any renderer without the
capability.
Tools: `npm run build:aircraft-views` bakes the sheet from the repo's
own fleet models (about 7 minutes); scripts/qa-aircraft-view-sheet.mjs
writes contact sheets of a bake and scripts/qa-aircraft-views.mjs
photographs a grid of every class in the app from above, tilted, from
below and round an orbit.
With 5,000 contacts on an M3 Max the frame takes 5.9-6.1 ms against
5.9 ms with the flat glyphs.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
1 parent
d9d79ebc4d
commit
efdac0ba70
40 files changed
+3535
-109
No files matched your search
@@ -21,11 +21,12 @@ const PIN_TURN_DEG = 0.1;
|
||||
* the grounded floor: a floor-pinned row holds a CPU position, so it is not
|
||||
* planned, and settling a grounded contact puts it straight onto the floor.
|
||||
*/
|
||||
export function createIcons({ flightState, services, parts }) {
|
||||
export function createIcons({ flightState, services, parts, resolveAsset }) {
|
||||
const icons = createAircraftIcons({
|
||||
state: flightState,
|
||||
services,
|
||||
parts,
|
||||
resolveAsset,
|
||||
layerId: 'flights',
|
||||
displayDelay: flightState._displayDelay,
|
||||
followsClock: () => followsClock(flightState),
|
||||
|
||||
Reference in new issue
Block a user