2026-03-31 03:04:15 +02:00
|
|
|
import type { PerspectiveCamera } from "three";
|
|
|
|
|
|
|
|
|
|
import type { Vec3 } from "../core/vector";
|
|
|
|
|
|
2026-04-04 07:51:38 +02:00
|
|
|
import type { FirstPersonPlayerShape, ResolvedPlayerMotion } from "./player-collision";
|
2026-03-31 03:04:15 +02:00
|
|
|
import type { RuntimeNavigationMode, RuntimeSceneDefinition, RuntimeSpawnPoint } from "./runtime-scene-build";
|
|
|
|
|
|
|
|
|
|
export interface FirstPersonTelemetry {
|
|
|
|
|
feetPosition: Vec3;
|
|
|
|
|
eyePosition: Vec3;
|
|
|
|
|
grounded: boolean;
|
2026-04-06 08:21:28 +02:00
|
|
|
locomotionState: RuntimeLocomotionState;
|
|
|
|
|
inWaterVolume: boolean;
|
2026-04-07 05:29:41 +02:00
|
|
|
cameraSubmerged: boolean;
|
2026-04-06 08:21:28 +02:00
|
|
|
inFogVolume: boolean;
|
2026-03-31 03:04:15 +02:00
|
|
|
pointerLocked: boolean;
|
|
|
|
|
spawn: RuntimeSpawnPoint;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-06 08:21:28 +02:00
|
|
|
export type RuntimeLocomotionState = "grounded" | "swimming" | "flying";
|
|
|
|
|
|
|
|
|
|
export interface RuntimePlayerVolumeState {
|
|
|
|
|
inWater: boolean;
|
|
|
|
|
inFog: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-31 03:04:15 +02:00
|
|
|
export interface RuntimeControllerContext {
|
|
|
|
|
camera: PerspectiveCamera;
|
|
|
|
|
domElement: HTMLCanvasElement;
|
|
|
|
|
getRuntimeScene(): RuntimeSceneDefinition;
|
2026-04-04 07:51:38 +02:00
|
|
|
resolveFirstPersonMotion(feetPosition: Vec3, motion: Vec3, shape: FirstPersonPlayerShape): ResolvedPlayerMotion | null;
|
2026-04-06 08:21:28 +02:00
|
|
|
resolvePlayerVolumeState(feetPosition: Vec3): RuntimePlayerVolumeState;
|
2026-03-31 03:04:15 +02:00
|
|
|
setRuntimeMessage(message: string | null): void;
|
|
|
|
|
setFirstPersonTelemetry(telemetry: FirstPersonTelemetry | null): void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface NavigationController {
|
|
|
|
|
id: RuntimeNavigationMode;
|
|
|
|
|
activate(ctx: RuntimeControllerContext): void;
|
|
|
|
|
deactivate(ctx: RuntimeControllerContext): void;
|
2026-04-11 04:14:44 +02:00
|
|
|
resetSceneState(): void;
|
2026-03-31 03:04:15 +02:00
|
|
|
update(dt: number): void;
|
|
|
|
|
}
|