chore(ground-ai): checkpoint 3d replay and simulator work
This commit is contained in:
1 parent
f8bd79042b
commit
b276e686b0
47 files changed
+2613
-688
No files matched your search
+10
-2
@@ -1,5 +1,7 @@
|
||||
/** Loading maps and logs through the lab's dev-server API (server/lab-api.ts). */
|
||||
import { parsePois, parseTraceLog, readNavPack, type MapPois, type NavPack, type TraceBattle } from '@wto/ground-sim';
|
||||
import {
|
||||
decodeMapScene, parsePois, parseTraceLog, readNavPack, type MapPois, type MapScene, type NavPack, type TraceBattle,
|
||||
} from '@wto/ground-sim';
|
||||
|
||||
export interface LogEntry {
|
||||
readonly name: string;
|
||||
@@ -10,11 +12,14 @@ export interface LogEntry {
|
||||
export interface MapEntry {
|
||||
readonly level: string;
|
||||
readonly pois: boolean;
|
||||
/** The level's geometry is there, so it has a 3D map. */
|
||||
readonly scene: boolean;
|
||||
}
|
||||
|
||||
export interface MapData {
|
||||
readonly pack: NavPack;
|
||||
readonly pois: MapPois | undefined;
|
||||
readonly scene: MapScene | undefined;
|
||||
}
|
||||
|
||||
async function get(url: string): Promise<Response> {
|
||||
@@ -44,5 +49,8 @@ export async function loadMap(entry: MapEntry): Promise<MapData> {
|
||||
const pois = entry.pois
|
||||
? parsePois(await (await get(`/api/maps/file?name=${encodeURIComponent(`${entry.level}.pois.json`)}`)).text())
|
||||
: undefined;
|
||||
return { pack: readNavPack(bytes), pois };
|
||||
const scene = entry.scene
|
||||
? decodeMapScene(new Uint8Array(await (await get(`/api/scene?name=${encodeURIComponent(entry.level)}`)).arrayBuffer()))
|
||||
: undefined;
|
||||
return { pack: readNavPack(bytes), pois, scene };
|
||||
}
|
||||
Reference in new issue
Block a user