mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-23 03:32:19 +00:00
feat(vessels): draw vessels as shaded sprites seen from the camera's angle
Vessels on the map were flat, top-down hulls turned along their course, drawn at one size at every range. Each hull shape (the ten vessel kinds, a dredger and a pilot boat) is now rendered in Blender into a view sheet like the aircraft's (public/sprites/vessel-views.webp: 208 views a shape, 7.5 degrees apart from straight above down to the horizon, 4096 x 2496, grey, 2.2 MB), cut at the waterline. On a renderer with `viewSheets` the Vessels layer draws a vessel as the view of its hull from where the eye is, with the flat hull as the fallback while the sheet loads or if it cannot load. A vessel keeps its kind's colour; aids to navigation keep their upright buoy; a renderer without view sheets draws the flat hulls as before. Every AIS ship type code 0-99 maps to a shape in the sheet (`vesselShape`, vesselTypes.js), pinned by a test. Type text such as "Search & Rescue" and "Anti Pollution" is now recognised, which also gives those vessels their right kind colour. Size: a vessel's icon now follows its range from the eye on the same range aircraft icons use (1.5 times its former size up close, its former size at about 1,000 km, a third from 8,000 km out), so it stays under an aircraft's icon at every range, and the vessel set recedes toward the horizon as the aircraft sets do. Tools: the bake script handles both sheets (scripts/bake-view-sheet.py; `npm run build:aircraft-views`, `npm run build:vessel-views`), and refuses a partial bake over a shipped sheet. scripts/qa-view-sheet.mjs writes contact sheets of a bake; scripts/qa-aircraft-views.mjs takes `--layer vessels`. The aircraft sheet is unchanged. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
1 parent
b4ff9b1e07
commit
01187cbe7a
19 files changed
+1115
-272
No files matched your search
+41
-2
@@ -3,8 +3,9 @@
|
||||
* @description A view sheet: one image of small sprites showing a subject
|
||||
* (an aircraft class) from a sphere of directions, and the maths that picks
|
||||
* the sprite for where the eye is. Plain JavaScript and GLSL: no DOM, no
|
||||
* engine. `scripts/build-aircraft-view-sheet.py` bakes the aircraft sheet to
|
||||
* this layout; a renderer with the `viewSheets` capability draws it.
|
||||
* engine. `scripts/bake-view-sheet.py` bakes the aircraft and
|
||||
* vessel sheets to their layouts here; a renderer with the `viewSheets`
|
||||
* capability draws them.
|
||||
*
|
||||
* **Frames.** A subject lies flat on the earth: up is the ground's normal,
|
||||
* forward its course. `d` is the direction from the subject to the eye in
|
||||
@@ -64,6 +65,44 @@ export const AIRCRAFT_VIEWS = Object.freeze({
|
||||
}),
|
||||
});
|
||||
|
||||
/**
|
||||
* The vessel hull shapes' view sheet (`public/sprites/vessel-views.json`):
|
||||
* from straight above down to the horizon, a ship never being seen from
|
||||
* below.
|
||||
*/
|
||||
export const VESSEL_VIEWS = Object.freeze({
|
||||
id: 'vessel-views',
|
||||
sheet: Object.freeze({
|
||||
image: '/sprites/vessel-views.webp',
|
||||
cellPx: 64,
|
||||
columns: 64,
|
||||
rows: 39,
|
||||
ringStepDeg: 7.5,
|
||||
rings: Object.freeze([1, 4, 7, 10, 13, 16, 18, 20, 22, 23, 24, 25, 25]),
|
||||
grey: true,
|
||||
}),
|
||||
/** Frames in each subject's block. */
|
||||
frames: 208,
|
||||
/**
|
||||
* Each hull shape's first cell (`vesselShape`, vesselTypes.js): the ten
|
||||
* hull kinds, then the shapes drawn within a kind.
|
||||
*/
|
||||
subjects: Object.freeze({
|
||||
cargo: 0,
|
||||
tanker: 208,
|
||||
passenger: 416,
|
||||
highspeed: 624,
|
||||
fishing: 832,
|
||||
tug: 1040,
|
||||
sailing: 1248,
|
||||
pleasure: 1456,
|
||||
military: 1664,
|
||||
other: 1872,
|
||||
dredger: 2080,
|
||||
pilot: 2288,
|
||||
}),
|
||||
});
|
||||
|
||||
/**
|
||||
* Check a sheet's layout, and return it with each ring's first frame.
|
||||
* @param {{image: string, cellPx: number, columns: number, rows: number,
|
||||
|
||||
Reference in new issue
Block a user