mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
Sprites for helicopters, ground vehicles, stations and vessel types; history to live without an empty map; model parts in Cesium
Aircraft icons are one size; helicopters turn a three-frame rotor while airborne or moving; ADS-B ground vehicles share one amber sprite and stations/obstacles one mast; vessels get hull sprites by type and one buoy. Going live keeps contacts until the first live answer and replaces them by id; fast playback holds before the loaded positions end and prefetches ahead. Cesium models move their parts from the optional model part state.
This commit is contained in:
1 parent
624c229bc2
commit
7186f720df
97 files changed
+6586
-343
No files matched your search
Vendored
+86
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* A model's moving parts (`modelParts.js`): its part table and the maths
|
||||
* that turns a model item's `parts` into one matrix per part, so a renderer
|
||||
* that poses parts draws exactly those.
|
||||
*/
|
||||
import type { ModelPartState } from './contract/index';
|
||||
|
||||
/** What a part does: what live data drives and what is offered first. */
|
||||
export type PartKind =
|
||||
'body' | 'spin' | 'hinge' | 'slide' | 'deploy' | 'separable' | 'marker';
|
||||
|
||||
/** `[x, y, z]`. */
|
||||
export type PartVec3 = readonly [number, number, number];
|
||||
|
||||
/** One part of a model, as its table gives it (glTF frame, metres and degrees). */
|
||||
export interface ModelPart {
|
||||
/** Its `_PART` index. */
|
||||
readonly index: number;
|
||||
readonly name: string;
|
||||
readonly kind: PartKind;
|
||||
/** The part it rides, or null for the body. */
|
||||
readonly parent: string | null;
|
||||
/** Its parent's index, or -1 for the body. */
|
||||
readonly parentIndex: number;
|
||||
/** The point it turns about; the origin for the body. */
|
||||
readonly pivot: PartVec3;
|
||||
/** Its axis of motion, unit length; null where the table gives none. */
|
||||
readonly axis: PartVec3 | null;
|
||||
/** `[stowed, deployed]`: degrees for hinge and deploy, metres for slide and separable. */
|
||||
readonly limits: readonly [number, number] | null;
|
||||
/** The value it is drawn at in the file; null without limits. */
|
||||
readonly rest: number | null;
|
||||
}
|
||||
|
||||
/** A model's part table: its parts in `_PART` index order, the body first. */
|
||||
export interface PartTable {
|
||||
readonly parts: readonly ModelPart[];
|
||||
/** A part's index by its name. */
|
||||
readonly byName: ReadonlyMap<string, number>;
|
||||
}
|
||||
|
||||
/** Where and how `partMatrices` writes. */
|
||||
export interface PartMatricesOptions {
|
||||
/** Where in `out` the first matrix goes; 0 by default. */
|
||||
readonly offset?: number;
|
||||
/** Gets each part's `PART_HIDDEN` and `PART_HIGHLIGHT`, from `flagsOffset`. */
|
||||
readonly flags?: Uint8Array;
|
||||
readonly flagsOffset?: number;
|
||||
/** The model's stretch along its glTF axes (`axisScale`): parts then turn rigidly in the stretched model. */
|
||||
readonly scale?: PartVec3 | null;
|
||||
}
|
||||
|
||||
export const PART_KINDS: readonly PartKind[];
|
||||
export const PART_HIDDEN: 1;
|
||||
export const PART_HIGHLIGHT: 2;
|
||||
|
||||
/** Whether a pose's `highlight` asks for one: true, or a colour (a non-empty string, or three or four finite numbers). */
|
||||
export function asksHighlight(value: unknown): boolean;
|
||||
|
||||
/** The part table in a node's glTF `extras`; null when it has none. Throws on a malformed table. */
|
||||
export function partTableOf(extras: unknown): PartTable | null;
|
||||
|
||||
/** The glTF JSON of a GLB. Throws when the bytes are not a GLB. */
|
||||
export function glbJson(glb: Uint8Array | ArrayBuffer): Record<string, unknown>;
|
||||
|
||||
/** The part table of a glTF document; null when no node has one. */
|
||||
export function gltfPartTable(gltf: Record<string, unknown>): PartTable | null;
|
||||
|
||||
/** The part table of a GLB's bytes; null for a model without one. */
|
||||
export function readPartTable(glb: Uint8Array | ArrayBuffer): PartTable | null;
|
||||
|
||||
/** Where the scene's first mesh is drawn: its node's transform with its parents', column-major 4×4. */
|
||||
export function gltfMeshMatrix(gltf: Record<string, unknown>): number[];
|
||||
|
||||
/**
|
||||
* Each part's column-major 4×4 matrix for `state` at `timeS` seconds into
|
||||
* `out`, in `_PART` order, in the model's glTF frame. Whether any part is
|
||||
* not at rest.
|
||||
*/
|
||||
export function partMatrices(
|
||||
table: PartTable,
|
||||
state: ModelPartState | null | undefined,
|
||||
timeS: number,
|
||||
out: Float32Array | Float64Array,
|
||||
options?: PartMatricesOptions,
|
||||
): boolean;
|
||||
Reference in new issue
Block a user