feat: 3D aircraft model overhaul and multi-source flight data proxy (Resolves #15) (#16)

* Refactor aircraft photo and hero banner components to reset loading state on photo change

- Updated Lightbox component to reset image loading state when navigating between photos.
- Modified HeroBanner component to reset loading state when the photo changes.

Clean up control panel search logic

- Removed unnecessary hasResults variable in SearchContent component.

Implement flight API client with fallback mechanism

- Added flight-api-client to handle fetching flight data from multiple sources (airplanes.live, adsb.lol, OpenSky).
- Introduced flight-api-parsing module to convert raw API responses into standardized FlightState objects.
- Created flight-api-types for shared types between API responses.

Refactor useFlights hook to utilize new flight API client

- Updated useFlights hook to fetch flights using the new flight API client.
- Removed credit management logic as it is no longer applicable with the new API structure.

Fix useFlightMonitors to fetch flight data by hex address

- Changed useFlightMonitors to use fetchFlightByHex instead of fetchFlightByIcao24.

Update geo utility function for better readability

- Refactored splitAtAntimeridian function to improve variable naming and clarity.

Enhance OpenSky types with additional fields

- Added typeCode and registration fields to FlightState type for better integration with readsb data.

* fix: correct 6 files that diverged during rebase (iata code, globe mode ref, terrain attribution, cache eviction, opensky parsing)

* fix: improve keyboard shortcuts help focus trapping

feat: add showAirspace option to MapAttribution component

fix: clear hideTimer on ScrollArea cleanup

refactor: change pendingFpvRef to MutableRefObject in useFlightMonitors

fix: handle sessionStorage availability in useFlightTrack

refactor: increase POLL_INTERVAL_MS in useFlights for better performance

fix: optimize keyboard shortcuts dialog check

refactor: optimize useMergedTrails by caching selected flight position

feat: extend Settings type with airspace options

refactor: improve airline logo normalization functions

refactor: enhance flight API client with serialized rate limiting

refactor: optimize registration country lookup with pre-built maps

refactor: enhance logo cache management with size limits

feat: update map attribution to include airspace option

fix: validate rawState in parseStateRow function

refactor: improve utility functions with clamp implementation

* feat: add ATC lookup functionality and GPU memory monitoring

- Implemented ATC lookup functions in `atc-lookup.ts` for converting IATA to ICAO codes, finding nearby ATC feeds, and looking up ATC feeds by code.
- Introduced `atc-types.ts` to define types and priorities for ATC feeds.
- Added GPU memory monitoring in `gpu-memory-monitor.ts` to track WebGL resource allocations and provide memory reports.
- Enhanced trail stitching logic in `trail-stitching.ts` by adding a function to clear the splined track cache and optimizing altitude checks.

* feat: enhance flight data handling and improve API resilience

- Implemented a maximum empty response streak guard in useFlights to prevent data loss during transient API failures.
- Added immediate fetch on network reconnect in useFlights to ensure timely data retrieval.
- Updated useMergedTrails to include timestamps for trail points.
- Removed smoothAnimations setting from useSettings as it is no longer needed.
- Enhanced useTrailHistory to preserve last-known trails during empty flight responses and added dynamic jump detection for tab resume scenarios.
- Improved flight API client with a circuit breaker mechanism to handle provider failures and prevent excessive retries.
- Updated flight API parsing to reject non-JSON responses from OpenSky and other providers.
- Enhanced trail smoothing and stitching logic to ensure better continuity at junctions between historical and live data.

* feat: migrate aircraft models to Cloudinary CDN and update mapping logic

* fix: adjust UI component styles and improve trail smoothing parameters

* fix: adjust base aircraft size for improved rendering

* feat: update changelog with recent enhancements and modify data source attribution

* fix: update model optimization details and remove Draco compression dependency

* feat: update changelog with recent code review fixes and fallback provider adjustments
This commit is contained in:
kew
2026-03-23 01:25:11 +05:30
committed by GitHub
parent 147b69b944
commit eb1103f63f
95 changed files with 9667 additions and 1384 deletions

92
docs/3D-MODELS.md Normal file
View File

@ -0,0 +1,92 @@
# 3D Aircraft Models
## Overview
Aeris uses 14 distinct 3D aircraft silhouettes to represent different aircraft types on the globe. Models are assigned based on ICAO type code (when available) or ADS-B emitter category.
Two iconic aircraft types — the **Airbus A380** and **Boeing 737** — have dedicated models for visual distinction. All other aircraft are mapped to generic silhouette categories.
## Model Inventory
| File | Size (KB) | Description | Source |
| ------------------- | --------: | ------------------------------------------ | -------------- |
| `b737.glb` | 156.1 | Boeing 737 family (incl. MAX) | fr24-3d-models |
| `bizjet.glb` | 452.8 | Business jets (Gulfstream, Citation, etc.) | FlightAirMap |
| `drone.glb` | 131.0 | Unmanned aerial vehicles | FlightAirMap |
| `fighter.glb` | 58.2 | Military high-performance aircraft | FlightAirMap |
| `generic.glb` | 401.8 | Default fallback (A320 silhouette) | FlightAirMap |
| `glider.glb` | 68.1 | Gliders and sailplanes | FlightAirMap |
| `helicopter.glb` | 270.8 | Rotorcraft | FlightAirMap |
| `light-prop.glb` | 131.0 | Light GA props (Cessna, Piper, etc.) | FlightAirMap |
| `narrowbody.glb` | 401.8 | Narrow-body jets (A320, other non-737) | FlightAirMap |
| `regional-jet.glb` | 127.0 | Regional jets (CRJ, Embraer E-Jets) | FlightAirMap |
| `turboprop.glb` | 86.4 | Turboprops (ATR, Dash-8) | FlightAirMap |
| `widebody-2eng.glb` | 149.3 | Wide-body twin-engine (777, 787, A330) | FlightAirMap |
| `widebody-4eng.glb` | 241.8 | Wide-body four-engine (A340, A380) | FlightAirMap |
### Totals
| Metric | Value |
| --------------------------------- | -------------------: |
| **Aircraft models** | 13 files |
| **Aircraft total** | 2,676.1 KB (2.61 MB) |
| **Legacy model** (`airplane.glb`) | 1,295.2 KB (1.26 MB) |
| **All GLB files** | 3,971.3 KB (3.88 MB) |
## Optimization Pipeline
All models are optimized for web delivery using `@gltf-transform/cli`:
1. **Texture stripping** — Materials set to neutral unlit gray
2. **Mesh simplification** — Triangle count reduced to ~30% of original
3. **B737 format conversion** — Converted from glTF 1.0 → 2.0 via `gltf-pipeline`
> Note: Draco compression is **not** used for these models, to avoid
> introducing an external WASM decoder dependency.
> See `public/models/aircraft/NOTICE.md` for details.
## Model Assignment
### Priority: TypeCode → Category
When an aircraft's ICAO type code is available (from readsb providers), it takes priority over the generic ADS-B category mapping.
**Dedicated model types:**
| Aircraft Type | TypeCode Pattern | Model Key |
| ---------------- | --------------------- | --------- |
| Airbus A380 | `A38x` | `a380` |
| Boeing 737 (all) | `B73x`, `B37M``B39M` | `b737` |
**Category-based fallback (DO-260B):**
| ADS-B Category | Weight Class | Model Key |
| -------------- | ---------------------- | --------------- |
| 2 | Light (<15,500 lbs) | `light-prop` |
| 3 | Small (15,50075,000) | `narrowbody` |
| 4 | Large (75,000300,000) | `narrowbody` |
| 5 | High vortex (B757) | `narrowbody` |
| 6 | Heavy (>300,000 lbs) | `widebody-2eng` |
| 7 | High performance | `fighter` |
| 8 | Rotorcraft | `helicopter` |
| 9 | Glider/sailplane | `glider` |
| 12 | Ultralight | `light-prop` |
| 14 | UAV | `drone` |
| Other | Unknown | `generic` |
## Performance
- Models are **lazy-loaded**: only fetched when an aircraft of that type first appears in data
- The 6 most common model types are **prefetched** via `<link rel="prefetch">` on page load
- Empty ScenegraphLayers are kept alive with stable empty arrays to avoid shader recompilation
- deck.gl caches models by URL, so the `a380` key (which maps to `widebody-4eng.glb`) shares the cache entry
## Licensing
All models are licensed under **GPL v2**, compatible with the project's AGPL v3 license.
- **FlightAirMap-3dmodels**: https://github.com/Ysurac/FlightAirMap-3dmodels
- **fr24-3d-models**: https://github.com/Flightradar24/fr24-3d-models
- Original sources: [FlightGear FGMEMBERS](https://github.com/FGMEMBERS)
See [public/models/aircraft/NOTICE.md](../public/models/aircraft/NOTICE.md) for full attribution.