@multitapio/multitap 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.stamp +0 -0
- package/dist/cache.d.ts +117 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/channel.d.ts +91 -0
- package/dist/channel.d.ts.map +1 -0
- package/dist/channel.worker.d.ts +3 -0
- package/dist/channel.worker.d.ts.map +1 -0
- package/dist/codegen/config.d.ts +107 -0
- package/dist/codegen/config.d.ts.map +1 -0
- package/dist/codegen/generator.d.ts +78 -0
- package/dist/codegen/generator.d.ts.map +1 -0
- package/dist/codegen/index.d.ts +13 -0
- package/dist/codegen/index.d.ts.map +1 -0
- package/dist/codegen/inject.d.ts +51 -0
- package/dist/codegen/inject.d.ts.map +1 -0
- package/dist/codegen/rust.d.ts +22 -0
- package/dist/codegen/rust.d.ts.map +1 -0
- package/dist/codegen/typescript.d.ts +22 -0
- package/dist/codegen/typescript.d.ts.map +1 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/crypto.d.ts +141 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/debug.d.ts +39 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/diagnostics/index.d.ts +12 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/diagnostics.js +5502 -0
- package/dist/e2e/cli.d.ts +2 -0
- package/dist/e2e/cli.d.ts.map +1 -0
- package/dist/executor.d.ts +130 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/globals.d.ts +32 -0
- package/dist/helpers.d.ts +3 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/input-codec.d.ts +136 -0
- package/dist/input-codec.d.ts.map +1 -0
- package/dist/input-graph.d.ts +106 -0
- package/dist/input-graph.d.ts.map +1 -0
- package/dist/lib.d.ts +10 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +9409 -0
- package/dist/messages.d.ts +63 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/peer-mesh.d.ts +77 -0
- package/dist/peer-mesh.d.ts.map +1 -0
- package/dist/react/Crosshair.d.ts +17 -0
- package/dist/react/Crosshair.d.ts.map +1 -0
- package/dist/react/Player.d.ts +10 -0
- package/dist/react/Player.d.ts.map +1 -0
- package/dist/react/PlayerPoseContext.d.ts +31 -0
- package/dist/react/PlayerPoseContext.d.ts.map +1 -0
- package/dist/react/hooks/index.d.ts +7 -0
- package/dist/react/hooks/index.d.ts.map +1 -0
- package/dist/react/hooks/useEvent.d.ts +46 -0
- package/dist/react/hooks/useEvent.d.ts.map +1 -0
- package/dist/react/hooks/useFrame.d.ts +23 -0
- package/dist/react/hooks/useFrame.d.ts.map +1 -0
- package/dist/react/hooks/usePlayers.d.ts +24 -0
- package/dist/react/hooks/usePlayers.d.ts.map +1 -0
- package/dist/react/hooks/useQuery.d.ts +41 -0
- package/dist/react/hooks/useQuery.d.ts.map +1 -0
- package/dist/react/hooks/useSession.d.ts +10 -0
- package/dist/react/hooks/useSession.d.ts.map +1 -0
- package/dist/react/index.d.ts +18 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/input/DesktopInputMapper.d.ts +38 -0
- package/dist/react/input/DesktopInputMapper.d.ts.map +1 -0
- package/dist/react/input/index.d.ts +4 -0
- package/dist/react/input/index.d.ts.map +1 -0
- package/dist/react/input/types.d.ts +46 -0
- package/dist/react/input/types.d.ts.map +1 -0
- package/dist/react/providers/SessionProvider.d.ts +17 -0
- package/dist/react/providers/SessionProvider.d.ts.map +1 -0
- package/dist/react/providers/index.d.ts +2 -0
- package/dist/react/providers/index.d.ts.map +1 -0
- package/dist/react/types/index.d.ts +2 -0
- package/dist/react/types/index.d.ts.map +1 -0
- package/dist/react/types/session.d.ts +88 -0
- package/dist/react/types/session.d.ts.map +1 -0
- package/dist/react/types.d.ts +134 -0
- package/dist/react/types.d.ts.map +1 -0
- package/dist/react/utils/math.d.ts +19 -0
- package/dist/react/utils/math.d.ts.map +1 -0
- package/dist/react/views/AsteroidsView.d.ts +24 -0
- package/dist/react/views/AsteroidsView.d.ts.map +1 -0
- package/dist/react/views/FirstPersonView.d.ts +10 -0
- package/dist/react/views/FirstPersonView.d.ts.map +1 -0
- package/dist/react/views/IsometricView.d.ts +21 -0
- package/dist/react/views/IsometricView.d.ts.map +1 -0
- package/dist/react/views/MapView.d.ts +16 -0
- package/dist/react/views/MapView.d.ts.map +1 -0
- package/dist/react/views/MobaView.d.ts +17 -0
- package/dist/react/views/MobaView.d.ts.map +1 -0
- package/dist/react/views/SideOnView.d.ts +23 -0
- package/dist/react/views/SideOnView.d.ts.map +1 -0
- package/dist/react/views/ThirdPersonFixedView.d.ts +21 -0
- package/dist/react/views/ThirdPersonFixedView.d.ts.map +1 -0
- package/dist/react/views/ThirdPersonView.d.ts +12 -0
- package/dist/react/views/ThirdPersonView.d.ts.map +1 -0
- package/dist/react/views/TopDownFixedView.d.ts +20 -0
- package/dist/react/views/TopDownFixedView.d.ts.map +1 -0
- package/dist/react/views/TopDownView.d.ts +12 -0
- package/dist/react/views/TopDownView.d.ts.map +1 -0
- package/dist/react/views/TwinStickView.d.ts +13 -0
- package/dist/react/views/TwinStickView.d.ts.map +1 -0
- package/dist/react/views/VehicleFixedView.d.ts +16 -0
- package/dist/react/views/VehicleFixedView.d.ts.map +1 -0
- package/dist/react/views/VehicleView.d.ts +13 -0
- package/dist/react/views/VehicleView.d.ts.map +1 -0
- package/dist/react/views/index.d.ts +21 -0
- package/dist/react/views/index.d.ts.map +1 -0
- package/dist/react/views/types.d.ts +136 -0
- package/dist/react/views/types.d.ts.map +1 -0
- package/dist/rollback.d.ts +193 -0
- package/dist/rollback.d.ts.map +1 -0
- package/dist/rollback.worker.d.ts +3 -0
- package/dist/rollback.worker.d.ts.map +1 -0
- package/dist/schema.d.ts +309 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/session-config.d.ts +119 -0
- package/dist/session-config.d.ts.map +1 -0
- package/dist/session.d.ts +120 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/state.d.ts +400 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/stats.d.ts +21 -0
- package/dist/stats.d.ts.map +1 -0
- package/dist/test-session.d.ts +170 -0
- package/dist/test-session.d.ts.map +1 -0
- package/dist/types/cache.d.ts +117 -0
- package/dist/types/cache.d.ts.map +1 -0
- package/dist/types/channel.d.ts +91 -0
- package/dist/types/channel.d.ts.map +1 -0
- package/dist/types/channel.worker.d.ts +3 -0
- package/dist/types/channel.worker.d.ts.map +1 -0
- package/dist/types/codegen/config.d.ts +107 -0
- package/dist/types/codegen/config.d.ts.map +1 -0
- package/dist/types/codegen/generator.d.ts +78 -0
- package/dist/types/codegen/generator.d.ts.map +1 -0
- package/dist/types/codegen/index.d.ts +13 -0
- package/dist/types/codegen/index.d.ts.map +1 -0
- package/dist/types/codegen/inject.d.ts +51 -0
- package/dist/types/codegen/inject.d.ts.map +1 -0
- package/dist/types/codegen/rust.d.ts +22 -0
- package/dist/types/codegen/rust.d.ts.map +1 -0
- package/dist/types/codegen/typescript.d.ts +22 -0
- package/dist/types/codegen/typescript.d.ts.map +1 -0
- package/dist/types/constants.d.ts +5 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/crypto.d.ts +141 -0
- package/dist/types/crypto.d.ts.map +1 -0
- package/dist/types/debug.d.ts +39 -0
- package/dist/types/debug.d.ts.map +1 -0
- package/dist/types/diagnostics/index.d.ts +12 -0
- package/dist/types/diagnostics/index.d.ts.map +1 -0
- package/dist/types/e2e/cli.d.ts +2 -0
- package/dist/types/e2e/cli.d.ts.map +1 -0
- package/dist/types/executor.d.ts +130 -0
- package/dist/types/executor.d.ts.map +1 -0
- package/dist/types/helpers.d.ts +3 -0
- package/dist/types/helpers.d.ts.map +1 -0
- package/dist/types/input-codec.d.ts +136 -0
- package/dist/types/input-codec.d.ts.map +1 -0
- package/dist/types/input-graph.d.ts +106 -0
- package/dist/types/input-graph.d.ts.map +1 -0
- package/dist/types/lib.d.ts +10 -0
- package/dist/types/lib.d.ts.map +1 -0
- package/dist/types/messages.d.ts +63 -0
- package/dist/types/messages.d.ts.map +1 -0
- package/dist/types/peer-mesh.d.ts +77 -0
- package/dist/types/peer-mesh.d.ts.map +1 -0
- package/dist/types/react/Crosshair.d.ts +17 -0
- package/dist/types/react/Crosshair.d.ts.map +1 -0
- package/dist/types/react/Player.d.ts +10 -0
- package/dist/types/react/Player.d.ts.map +1 -0
- package/dist/types/react/PlayerPoseContext.d.ts +31 -0
- package/dist/types/react/PlayerPoseContext.d.ts.map +1 -0
- package/dist/types/react/hooks/index.d.ts +7 -0
- package/dist/types/react/hooks/index.d.ts.map +1 -0
- package/dist/types/react/hooks/useEvent.d.ts +46 -0
- package/dist/types/react/hooks/useEvent.d.ts.map +1 -0
- package/dist/types/react/hooks/useFrame.d.ts +23 -0
- package/dist/types/react/hooks/useFrame.d.ts.map +1 -0
- package/dist/types/react/hooks/usePlayers.d.ts +24 -0
- package/dist/types/react/hooks/usePlayers.d.ts.map +1 -0
- package/dist/types/react/hooks/useQuery.d.ts +41 -0
- package/dist/types/react/hooks/useQuery.d.ts.map +1 -0
- package/dist/types/react/hooks/useSession.d.ts +10 -0
- package/dist/types/react/hooks/useSession.d.ts.map +1 -0
- package/dist/types/react/index.d.ts +18 -0
- package/dist/types/react/index.d.ts.map +1 -0
- package/dist/types/react/input/DesktopInputMapper.d.ts +38 -0
- package/dist/types/react/input/DesktopInputMapper.d.ts.map +1 -0
- package/dist/types/react/input/index.d.ts +4 -0
- package/dist/types/react/input/index.d.ts.map +1 -0
- package/dist/types/react/input/types.d.ts +46 -0
- package/dist/types/react/input/types.d.ts.map +1 -0
- package/dist/types/react/providers/SessionProvider.d.ts +17 -0
- package/dist/types/react/providers/SessionProvider.d.ts.map +1 -0
- package/dist/types/react/providers/index.d.ts +2 -0
- package/dist/types/react/providers/index.d.ts.map +1 -0
- package/dist/types/react/types/index.d.ts +2 -0
- package/dist/types/react/types/index.d.ts.map +1 -0
- package/dist/types/react/types/session.d.ts +88 -0
- package/dist/types/react/types/session.d.ts.map +1 -0
- package/dist/types/react/types.d.ts +134 -0
- package/dist/types/react/types.d.ts.map +1 -0
- package/dist/types/react/utils/math.d.ts +19 -0
- package/dist/types/react/utils/math.d.ts.map +1 -0
- package/dist/types/react/views/AsteroidsView.d.ts +24 -0
- package/dist/types/react/views/AsteroidsView.d.ts.map +1 -0
- package/dist/types/react/views/FirstPersonView.d.ts +10 -0
- package/dist/types/react/views/FirstPersonView.d.ts.map +1 -0
- package/dist/types/react/views/IsometricView.d.ts +21 -0
- package/dist/types/react/views/IsometricView.d.ts.map +1 -0
- package/dist/types/react/views/MapView.d.ts +16 -0
- package/dist/types/react/views/MapView.d.ts.map +1 -0
- package/dist/types/react/views/MobaView.d.ts +17 -0
- package/dist/types/react/views/MobaView.d.ts.map +1 -0
- package/dist/types/react/views/SideOnView.d.ts +23 -0
- package/dist/types/react/views/SideOnView.d.ts.map +1 -0
- package/dist/types/react/views/ThirdPersonFixedView.d.ts +21 -0
- package/dist/types/react/views/ThirdPersonFixedView.d.ts.map +1 -0
- package/dist/types/react/views/ThirdPersonView.d.ts +12 -0
- package/dist/types/react/views/ThirdPersonView.d.ts.map +1 -0
- package/dist/types/react/views/TopDownFixedView.d.ts +20 -0
- package/dist/types/react/views/TopDownFixedView.d.ts.map +1 -0
- package/dist/types/react/views/TopDownView.d.ts +12 -0
- package/dist/types/react/views/TopDownView.d.ts.map +1 -0
- package/dist/types/react/views/TwinStickView.d.ts +13 -0
- package/dist/types/react/views/TwinStickView.d.ts.map +1 -0
- package/dist/types/react/views/VehicleFixedView.d.ts +16 -0
- package/dist/types/react/views/VehicleFixedView.d.ts.map +1 -0
- package/dist/types/react/views/VehicleView.d.ts +13 -0
- package/dist/types/react/views/VehicleView.d.ts.map +1 -0
- package/dist/types/react/views/index.d.ts +21 -0
- package/dist/types/react/views/index.d.ts.map +1 -0
- package/dist/types/react/views/types.d.ts +136 -0
- package/dist/types/react/views/types.d.ts.map +1 -0
- package/dist/types/rollback.d.ts +193 -0
- package/dist/types/rollback.d.ts.map +1 -0
- package/dist/types/rollback.worker.d.ts +3 -0
- package/dist/types/rollback.worker.d.ts.map +1 -0
- package/dist/types/schema.d.ts +309 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/session-config.d.ts +119 -0
- package/dist/types/session-config.d.ts.map +1 -0
- package/dist/types/session.d.ts +120 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/state.d.ts +400 -0
- package/dist/types/state.d.ts.map +1 -0
- package/dist/types/stats.d.ts +21 -0
- package/dist/types/stats.d.ts.map +1 -0
- package/dist/types/test-session.d.ts +170 -0
- package/dist/types/test-session.d.ts.map +1 -0
- package/dist/types/utils.d.ts +26 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/vite/codegen-runner.d.ts +27 -0
- package/dist/types/vite/codegen-runner.d.ts.map +1 -0
- package/dist/types/vite/index.d.ts +20 -0
- package/dist/types/vite/index.d.ts.map +1 -0
- package/dist/types/vite/module-builder.d.ts +28 -0
- package/dist/types/vite/module-builder.d.ts.map +1 -0
- package/dist/types/vite/plugin.d.ts +27 -0
- package/dist/types/vite/plugin.d.ts.map +1 -0
- package/dist/types/vite/types.d.ts +37 -0
- package/dist/types/vite/types.d.ts.map +1 -0
- package/dist/types/vite/wasm-compiler.d.ts +32 -0
- package/dist/types/vite/wasm-compiler.d.ts.map +1 -0
- package/dist/utils.d.ts +26 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/vite/codegen-runner.d.ts +27 -0
- package/dist/vite/codegen-runner.d.ts.map +1 -0
- package/dist/vite/index.d.ts +20 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +4202 -0
- package/dist/vite/module-builder.d.ts +28 -0
- package/dist/vite/module-builder.d.ts.map +1 -0
- package/dist/vite/plugin.d.ts +27 -0
- package/dist/vite/plugin.d.ts.map +1 -0
- package/dist/vite/types.d.ts +37 -0
- package/dist/vite/types.d.ts.map +1 -0
- package/dist/vite/wasm-compiler.d.ts +32 -0
- package/dist/vite/wasm-compiler.d.ts.map +1 -0
- package/package.json +92 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { RootState } from '@react-three/fiber';
|
|
3
|
+
import type { StoreApi as ZustandStoreApi } from 'zustand';
|
|
4
|
+
import type { SessionConfig } from '../../session-config';
|
|
5
|
+
import type { SessionStats, SessionOptions, SessionInterface } from '../../session';
|
|
6
|
+
import type { Participant } from '../../input-graph';
|
|
7
|
+
import type { EntityRef, CompiledSchema } from '../../state';
|
|
8
|
+
import type { InputCodec } from '../../input-codec';
|
|
9
|
+
/**
|
|
10
|
+
* Player in a session - extends Participant with entity reference
|
|
11
|
+
*/
|
|
12
|
+
export interface Player extends Participant {
|
|
13
|
+
entity: EntityRef;
|
|
14
|
+
isCurrentPlayer: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Zustand store for tracking entities matching a query
|
|
18
|
+
*/
|
|
19
|
+
export type EntityStore = {
|
|
20
|
+
entities: EntityRef[];
|
|
21
|
+
updateEntities: (incoming: Generator<EntityRef>) => void;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Zustand store for tracking session players
|
|
25
|
+
*/
|
|
26
|
+
export type PlayerStore = {
|
|
27
|
+
players: Player[];
|
|
28
|
+
update: (state: DataView, allParticipants: readonly Participant[], currentPlayerId: string) => void;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Session context value provided by SessionProvider
|
|
32
|
+
*/
|
|
33
|
+
export interface SessionContextValue {
|
|
34
|
+
/** Ref to current state DataView for the current frame - use within useFrame */
|
|
35
|
+
stateRef: RefObject<DataView>;
|
|
36
|
+
/** Store tracking participants for the current stateRef tick */
|
|
37
|
+
participants: ZustandStoreApi<PlayerStore>;
|
|
38
|
+
/** Session is ready to be used */
|
|
39
|
+
isReady: boolean;
|
|
40
|
+
/** Error during session initialization */
|
|
41
|
+
error: Error | null;
|
|
42
|
+
/** Send input to the session */
|
|
43
|
+
sendInput: (input: Uint8Array) => void;
|
|
44
|
+
/** Compiled input bindings */
|
|
45
|
+
inputBindings: InputCodec;
|
|
46
|
+
/** Session has ended */
|
|
47
|
+
ended: boolean;
|
|
48
|
+
/** Session config */
|
|
49
|
+
config: SessionConfig;
|
|
50
|
+
/** Compiled state schema for runtime queries */
|
|
51
|
+
schema: CompiledSchema;
|
|
52
|
+
/** Get session stats */
|
|
53
|
+
getStats: () => SessionStats;
|
|
54
|
+
/** Get current player id */
|
|
55
|
+
currentPlayerId: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Props for SessionProvider component
|
|
59
|
+
*/
|
|
60
|
+
export interface SessionProviderProps {
|
|
61
|
+
config: SessionOptions;
|
|
62
|
+
children: React.ReactNode;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Interface for session used by React components
|
|
66
|
+
*/
|
|
67
|
+
export interface ReactSessionInterface {
|
|
68
|
+
getConfig: SessionInterface['getConfig'];
|
|
69
|
+
getInputBindings: SessionInterface['getInputBindings'];
|
|
70
|
+
sendInput: SessionInterface['sendInput'];
|
|
71
|
+
getState: SessionInterface['getState'];
|
|
72
|
+
getStats: SessionInterface['getStats'];
|
|
73
|
+
close: SessionInterface['close'];
|
|
74
|
+
getParticipants: SessionInterface['getParticipants'];
|
|
75
|
+
getCurrentPlayerId: SessionInterface['getCurrentPlayerId'];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Factory function type for creating sessions (allows test mocking)
|
|
79
|
+
*/
|
|
80
|
+
export type ReactCreateSession = (config: SessionOptions) => Promise<ReactSessionInterface>;
|
|
81
|
+
/**
|
|
82
|
+
* Callback type for useFrame hook
|
|
83
|
+
*/
|
|
84
|
+
export type UseSessionRenderCallback = (state: RootState & {
|
|
85
|
+
state: DataView;
|
|
86
|
+
players: Player[];
|
|
87
|
+
}, delta: number, frame?: XRFrame) => void;
|
|
88
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/react/types/session.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { Quaternion, Vector3 } from 'three';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { InputMapper } from './input/types';
|
|
4
|
+
/**
|
|
5
|
+
* Types that can be converted to Vector3
|
|
6
|
+
*/
|
|
7
|
+
export type Vector3Like = Vector3 | [number, number, number] | {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
z: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Types that can be converted to Quaternion
|
|
14
|
+
*/
|
|
15
|
+
export type QuaternionLike = Quaternion | [number, number, number, number] | {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
z: number;
|
|
19
|
+
w: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Supported camera view types
|
|
23
|
+
*/
|
|
24
|
+
export type ViewType = 'firstPerson' | 'thirdPerson' | 'thirdPersonFixed' | 'topDown' | 'topDownFixed' | 'isometric' | 'sideOn' | 'map' | 'vehicle' | 'vehicleFixed' | 'twinStick' | 'moba' | 'asteroids';
|
|
25
|
+
/**
|
|
26
|
+
* Player component props
|
|
27
|
+
*/
|
|
28
|
+
export interface PlayerProps {
|
|
29
|
+
/** Body position (from server/game state) */
|
|
30
|
+
position?: Vector3Like;
|
|
31
|
+
/** Body rotation quaternion (from server/game state) - NOT the aim */
|
|
32
|
+
rotation?: QuaternionLike;
|
|
33
|
+
/** Whether this player captures input (keyboard/mouse/touch) */
|
|
34
|
+
enableInput?: boolean;
|
|
35
|
+
/** Whether this player's camera is used for rendering */
|
|
36
|
+
enableCamera?: boolean;
|
|
37
|
+
/** Current camera view type */
|
|
38
|
+
view?: ViewType;
|
|
39
|
+
/** Custom input mapper (default: DesktopInputMapper) */
|
|
40
|
+
inputMapper?: InputMapper;
|
|
41
|
+
/** Distance from camera to player (third-person views) */
|
|
42
|
+
cameraDistance?: number;
|
|
43
|
+
/** Height offset for camera */
|
|
44
|
+
cameraHeight?: number;
|
|
45
|
+
/** Additional camera offset */
|
|
46
|
+
cameraOffset?: Vector3Like;
|
|
47
|
+
/**
|
|
48
|
+
* Camera smoothing/damping factor (0 = instant, approaching 1 = very smooth)
|
|
49
|
+
* Values are clamped to [0, 0.99] to prevent the camera from freezing.
|
|
50
|
+
*/
|
|
51
|
+
damping?: number;
|
|
52
|
+
/** Pitch angle from vertical in radians (isometric, moba views) */
|
|
53
|
+
cameraAngle?: number;
|
|
54
|
+
/** Fixed camera yaw rotation in radians (topDownFixed, isometric, sideOn views) */
|
|
55
|
+
fixedYaw?: number;
|
|
56
|
+
/** Model position/rotation smoothing speed (higher = faster, 0 = instant) */
|
|
57
|
+
modelSmoothing?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Vehicle-only: when true and moving backwards, swing the camera to the other side.
|
|
60
|
+
* Ignored by all non-vehicle views.
|
|
61
|
+
*/
|
|
62
|
+
reverseCam?: boolean;
|
|
63
|
+
/** Name for the camera object (useful for testing/debugging) */
|
|
64
|
+
cameraName?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Show crosshair when this player has camera enabled.
|
|
67
|
+
* The crosshair style adapts to the view type:
|
|
68
|
+
* - 'center' views (FPS, third-person): crosshair at screen center
|
|
69
|
+
* - 'cursor' views (twin-stick, MOBA): crosshair follows cursor
|
|
70
|
+
* - 'none' views (map, sideOn, asteroids): no crosshair
|
|
71
|
+
*/
|
|
72
|
+
crosshair?: boolean;
|
|
73
|
+
/** Player model (consumer-provided mesh/geometry) */
|
|
74
|
+
children?: ReactNode;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Sampled player intent for network sync
|
|
78
|
+
*
|
|
79
|
+
* Coordinate convention (matches Three.js):
|
|
80
|
+
* - Right-handed, Y-up, XZ ground plane
|
|
81
|
+
* - Forward = -Z in heading-space (matches Three.js camera/object look direction)
|
|
82
|
+
*
|
|
83
|
+
* Intent model:
|
|
84
|
+
* - `heading`: Movement reference frame (move vector is relative to this)
|
|
85
|
+
* - `aim`: Attack/targeting direction (where camera points)
|
|
86
|
+
* - `move`: Movement intent relative to heading (NEVER world-space)
|
|
87
|
+
*
|
|
88
|
+
* For many views, heading === aim (same quaternion value).
|
|
89
|
+
*
|
|
90
|
+
* Views where aim can differ from heading:
|
|
91
|
+
* - Orbit-style thirdPerson: aim follows direction of travel while heading stays camera-relative.
|
|
92
|
+
* - Vehicle: heading = body direction (from server), aim = mouse direction
|
|
93
|
+
* - TwinStick: heading = screen up (fixed), aim = cursor direction
|
|
94
|
+
* - Moba: heading = iso camera direction (fixed), aim = cursor direction
|
|
95
|
+
*/
|
|
96
|
+
export interface PlayerIntent {
|
|
97
|
+
/** Movement reference frame (facing direction quaternion) */
|
|
98
|
+
heading: Quaternion;
|
|
99
|
+
/** Attack/look direction (where camera points) */
|
|
100
|
+
aim: Quaternion;
|
|
101
|
+
/**
|
|
102
|
+
* Movement intent relative to heading (ALWAYS heading-space, NEVER world-space)
|
|
103
|
+
*
|
|
104
|
+
* Axis convention in heading-space (Three.js standard: forward = -Z):
|
|
105
|
+
* - move.x > 0: strafe right
|
|
106
|
+
* - move.x < 0: strafe left
|
|
107
|
+
* - move.z < 0: forward
|
|
108
|
+
* - move.z > 0: backward
|
|
109
|
+
*
|
|
110
|
+
* Examples:
|
|
111
|
+
* - Full forward: move = (0, 0, -1)
|
|
112
|
+
* - Full backward: move = (0, 0, 1)
|
|
113
|
+
* - Strafe right: move = (1, 0, 0)
|
|
114
|
+
*
|
|
115
|
+
* For vehicle-style controls:
|
|
116
|
+
* - steer = move.x
|
|
117
|
+
* - throttle = -move.z (so positive throttle = forward)
|
|
118
|
+
*/
|
|
119
|
+
move: Vector3;
|
|
120
|
+
/** Standard action flags (bitmask of ACTION_* constants) */
|
|
121
|
+
actions: number;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Imperative handle exposed via ref
|
|
125
|
+
*/
|
|
126
|
+
export interface PlayerHandle {
|
|
127
|
+
/** Set player body position (e.g., from server update) */
|
|
128
|
+
setPosition(pos: Vector3Like): void;
|
|
129
|
+
/** Set player body rotation (e.g., from server update) */
|
|
130
|
+
setRotation(rot: QuaternionLike): void;
|
|
131
|
+
/** Sample current intent for network sync */
|
|
132
|
+
sample(): PlayerIntent;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/react/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,OAAO,GACP,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GACxB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvC;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,UAAU,GACV,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAChC;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAElD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAChB,aAAa,GACb,aAAa,GACb,kBAAkB,GAClB,SAAS,GACT,cAAc,GACd,WAAW,GACX,QAAQ,GACR,KAAK,GACL,SAAS,GACT,cAAc,GACd,WAAW,GACX,MAAM,GACN,WAAW,CAAA;AAEf;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,WAAW,CAAA;IACtB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,cAAc,CAAA;IAEzB,gEAAgE;IAChE,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,yDAAyD;IACzD,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,QAAQ,CAAA;IAEf,wDAAwD;IACxD,WAAW,CAAC,EAAE,WAAW,CAAA;IAGzB,0DAA0D;IAC1D,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,+BAA+B;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,+BAA+B;IAC/B,YAAY,CAAC,EAAE,WAAW,CAAA;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,6EAA6E;IAC7E,cAAc,CAAC,EAAE,MAAM,CAAA;IAEvB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,OAAO,EAAE,UAAU,CAAA;IACnB,kDAAkD;IAClD,GAAG,EAAE,UAAU,CAAA;IACf;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,EAAE,OAAO,CAAA;IACb,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,0DAA0D;IAC1D,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAAA;IACnC,0DAA0D;IAC1D,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,CAAA;IACtC,6CAA6C;IAC7C,MAAM,IAAI,YAAY,CAAA;CACvB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Quaternion, Vector3 } from 'three';
|
|
2
|
+
import type { QuaternionLike, Vector3Like } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Convert Vector3Like to Vector3
|
|
5
|
+
*/
|
|
6
|
+
export declare function toVector3(v: Vector3Like): Vector3;
|
|
7
|
+
/**
|
|
8
|
+
* Convert QuaternionLike to Quaternion
|
|
9
|
+
*/
|
|
10
|
+
export declare function toQuaternion(q: QuaternionLike): Quaternion;
|
|
11
|
+
/**
|
|
12
|
+
* Lerp between two values
|
|
13
|
+
*/
|
|
14
|
+
export declare function lerp(a: number, b: number, t: number): number;
|
|
15
|
+
/**
|
|
16
|
+
* Clamp a value between min and max
|
|
17
|
+
*/
|
|
18
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
19
|
+
//# sourceMappingURL=math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../../src/react/utils/math.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3D;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAIjD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,cAAc,GAAG,UAAU,CAI1D;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { View } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Asteroids view (top-down with keyboard rotation)
|
|
4
|
+
*
|
|
5
|
+
* Style: Asteroids, classic arcade rotation+thrust games
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* - Pivot: at player position, no rotation (fixed north-up camera)
|
|
9
|
+
* - Camera: directly above pivot, looking straight down
|
|
10
|
+
*
|
|
11
|
+
* Controls:
|
|
12
|
+
* - Arrow Left/Right (look.x): rotate heading (turn ship)
|
|
13
|
+
* - Arrow Up/Down or W/S (movement.y): thrust forward/backward relative to heading
|
|
14
|
+
* - A/D (movement.x): strafe relative to heading
|
|
15
|
+
*
|
|
16
|
+
* This is different from topDownFixed which has screen-relative movement.
|
|
17
|
+
* Asteroids view has heading-relative movement like a spaceship.
|
|
18
|
+
*
|
|
19
|
+
* NOTE: This is for classic Asteroids-style rotation+thrust mechanics ONLY.
|
|
20
|
+
* For "tank games" (drive + shoot), use the `vehicle` view instead.
|
|
21
|
+
* For tank games with fixed camera, use `thirdPersonFixed`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const AsteroidsView: View;
|
|
24
|
+
//# sourceMappingURL=AsteroidsView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsteroidsView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/AsteroidsView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAA;AAW3D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa,EAAE,IAuE3B,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { View } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* First-person view
|
|
4
|
+
*
|
|
5
|
+
* - Pivot: positioned at player's eye level, rotates on Y axis (yaw)
|
|
6
|
+
* - Camera: at pivot position, rotates on X axis (pitch)
|
|
7
|
+
* - Movement is relative to look direction
|
|
8
|
+
*/
|
|
9
|
+
export declare const FirstPersonView: View;
|
|
10
|
+
//# sourceMappingURL=FirstPersonView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FirstPersonView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/FirstPersonView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAA;AAmB3D;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,IAoG7B,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { View } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Isometric view (fixed angle, screen-relative WASD)
|
|
4
|
+
*
|
|
5
|
+
* Style: Diablo, Path of Exile, CRPGs
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* - Pivot: at player position, rotated by fixedYaw
|
|
9
|
+
* - Camera: at angle from vertical (cameraAngle), looking at player
|
|
10
|
+
*
|
|
11
|
+
* Mouse input is ignored. WASD is screen-relative, mapped to isometric axes.
|
|
12
|
+
* Movement is relative to the fixed camera yaw.
|
|
13
|
+
*
|
|
14
|
+
* Props:
|
|
15
|
+
* - cameraAngle: pitch from vertical in radians (default 45°)
|
|
16
|
+
* - fixedYaw: camera rotation in radians (default -45° for classic iso)
|
|
17
|
+
*
|
|
18
|
+
* heading and aim are both fixed to the camera yaw direction.
|
|
19
|
+
*/
|
|
20
|
+
export declare const IsometricView: View;
|
|
21
|
+
//# sourceMappingURL=IsometricView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IsometricView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/IsometricView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAA;AAY3D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,aAAa,EAAE,IAuE3B,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { View } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Map / RTS view
|
|
4
|
+
*
|
|
5
|
+
* This view delegates camera control to drei's MapControls component,
|
|
6
|
+
* which is rendered by Player.tsx when view === 'map'.
|
|
7
|
+
*
|
|
8
|
+
* Controls (MapControls defaults):
|
|
9
|
+
* - Left-drag: Rotate
|
|
10
|
+
* - Right-drag: Pan
|
|
11
|
+
* - Scroll: Zoom
|
|
12
|
+
*
|
|
13
|
+
* The view just provides minimal state - MapControls handles everything.
|
|
14
|
+
*/
|
|
15
|
+
export declare const MapView: View;
|
|
16
|
+
//# sourceMappingURL=MapView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/MapView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAA;AAE3D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,EAAE,IA4BrB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { View } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* MOBA view (isometric camera + decoupled mouse aim)
|
|
4
|
+
*
|
|
5
|
+
* Style: League of Legends, Dota 2
|
|
6
|
+
*
|
|
7
|
+
* - Camera: fixed isometric yaw/pitch (north-east diagonal by default)
|
|
8
|
+
* - Movement: WASD screen-relative, interpreted relative to fixed camera yaw
|
|
9
|
+
* - heading: fixed quaternion matching camera yaw (movement reference frame)
|
|
10
|
+
* - aim: yaw-only quaternion driven by mouse X delta (independent of heading)
|
|
11
|
+
*
|
|
12
|
+
* Props:
|
|
13
|
+
* - cameraAngle: pitch from vertical in radians (default 45°)
|
|
14
|
+
* - fixedYaw: camera rotation in radians (default -45°)
|
|
15
|
+
*/
|
|
16
|
+
export declare const MobaView: View;
|
|
17
|
+
//# sourceMappingURL=MobaView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MobaView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/MobaView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAA;AAmB3D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,EAAE,IA4FtB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { View } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Side-on view (2.5D platformer)
|
|
4
|
+
*
|
|
5
|
+
* Style: Limbo, Little Nightmares, 2.5D platformers
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* - Pivot: at player position, rotated 90° so camera faces the X axis
|
|
9
|
+
* - Camera: offset on local Z axis, looking at player
|
|
10
|
+
*
|
|
11
|
+
* This view treats the game as a 2D side-scroller rendered in 3D:
|
|
12
|
+
* - A/D moves left/right on X axis (world space)
|
|
13
|
+
* - W could be jump intent (game-level interpretation)
|
|
14
|
+
* - Mouse input is ignored
|
|
15
|
+
*
|
|
16
|
+
* The facing direction flips based on last horizontal movement:
|
|
17
|
+
* - Moving right (D) → facing direction +1 (facing +X)
|
|
18
|
+
* - Moving left (A) → facing direction -1 (facing -X)
|
|
19
|
+
*
|
|
20
|
+
* heading and aim are set to the current facing direction.
|
|
21
|
+
*/
|
|
22
|
+
export declare const SideOnView: View;
|
|
23
|
+
//# sourceMappingURL=SideOnView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideOnView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/SideOnView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAA;AAK3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,UAAU,EAAE,IA6FxB,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { View } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Third-person fixed view (over-shoulder, RE4/God of War style)
|
|
4
|
+
*
|
|
5
|
+
* The camera is on a ray extending BACKWARD from the player's head.
|
|
6
|
+
* Think of it as first-person, but the camera is pulled back along the look ray.
|
|
7
|
+
*
|
|
8
|
+
* Geometry:
|
|
9
|
+
* - Pivot is at the player's head, rotated by yaw AND pitch (like FPS)
|
|
10
|
+
* - Camera is positioned behind the pivot along its local +Z axis
|
|
11
|
+
* - Camera has no rotation of its own - it inherits pivot's orientation
|
|
12
|
+
*
|
|
13
|
+
* When you pitch down:
|
|
14
|
+
* - The pivot tilts down (looking at ground ahead)
|
|
15
|
+
* - The camera, being behind the pivot, ends up above and behind
|
|
16
|
+
* - The camera looks "over the shoulder" at the ground ahead
|
|
17
|
+
*
|
|
18
|
+
* This is the same as extending the FPS look ray backward.
|
|
19
|
+
*/
|
|
20
|
+
export declare const ThirdPersonFixedView: View;
|
|
21
|
+
//# sourceMappingURL=ThirdPersonFixedView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThirdPersonFixedView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/ThirdPersonFixedView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAA;AAwB3D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,oBAAoB,EAAE,IA4HlC,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { View } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Third-person view (over-shoulder style)
|
|
4
|
+
*
|
|
5
|
+
* Architecture:
|
|
6
|
+
* - Pivot: positioned at player + height offset (this is what camera looks at)
|
|
7
|
+
* - Camera: orbits around pivot based on yaw/pitch, always looks at pivot
|
|
8
|
+
*
|
|
9
|
+
* Pitch controls camera's vertical position in arc around target (not camera rotation)
|
|
10
|
+
*/
|
|
11
|
+
export declare const ThirdPersonView: View;
|
|
12
|
+
//# sourceMappingURL=ThirdPersonView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThirdPersonView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/ThirdPersonView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAA;AAuB3D;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,EAAE,IA2H7B,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { View } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Top-down fixed view (north-up, no mouse input)
|
|
4
|
+
*
|
|
5
|
+
* Style: Hotline Miami, classic Zelda
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* - Pivot: at player position, no rotation (fixed north-up)
|
|
9
|
+
* - Camera: directly above pivot, looking straight down
|
|
10
|
+
*
|
|
11
|
+
* Mouse input is ignored. WASD is screen-relative:
|
|
12
|
+
* - W = up on screen = -Z in world
|
|
13
|
+
* - S = down on screen = +Z in world
|
|
14
|
+
* - A = left on screen = -X in world
|
|
15
|
+
* - D = right on screen = +X in world
|
|
16
|
+
*
|
|
17
|
+
* heading and aim are both fixed facing -Z (identity rotation).
|
|
18
|
+
*/
|
|
19
|
+
export declare const TopDownFixedView: View;
|
|
20
|
+
//# sourceMappingURL=TopDownFixedView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TopDownFixedView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/TopDownFixedView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAA;AAK3D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB,EAAE,IA8D9B,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { View } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Top-down view (overhead camera)
|
|
4
|
+
*
|
|
5
|
+
* Architecture:
|
|
6
|
+
* - Pivot: at player position, rotates on Y axis (yaw)
|
|
7
|
+
* - Camera: directly above pivot, looking straight down
|
|
8
|
+
*
|
|
9
|
+
* Mouse X rotates the view, movement is relative to camera rotation.
|
|
10
|
+
*/
|
|
11
|
+
export declare const TopDownView: View;
|
|
12
|
+
//# sourceMappingURL=TopDownView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TopDownView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/TopDownView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAA;AAS3D;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,EAAE,IAkEzB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { View } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Twin-stick view (fixed top-down camera, independent mouse aim)
|
|
4
|
+
*
|
|
5
|
+
* Style: Enter the Gungeon, Nuclear Throne
|
|
6
|
+
*
|
|
7
|
+
* - Camera: fixed above the player, north-up (no camera rotation)
|
|
8
|
+
* - Movement: WASD is screen-relative (W=-Z, S=+Z, A=-X, D=+X)
|
|
9
|
+
* - heading: fixed to screen up (-Z) (identity quaternion)
|
|
10
|
+
* - aim: yaw-only quaternion driven by mouse X delta (independent of heading)
|
|
11
|
+
*/
|
|
12
|
+
export declare const TwinStickView: View;
|
|
13
|
+
//# sourceMappingURL=TwinStickView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TwinStickView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/TwinStickView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAA;AAa3D;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,EAAE,IAqF3B,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { View } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Vehicle Fixed view
|
|
4
|
+
*
|
|
5
|
+
* - `heading` comes from the body rotation (server / props), yaw-only.
|
|
6
|
+
* - `aim` is locked to heading yaw, but can include pitch for camera tilt.
|
|
7
|
+
* - Camera stays behind the vehicle body with damping (like a chase cam).
|
|
8
|
+
*
|
|
9
|
+
* Controls:
|
|
10
|
+
* - W/S: throttle (move.z, forward = -Z)
|
|
11
|
+
* - A/D: steering (move.x)
|
|
12
|
+
* - Mouse X: also contributes to steering (move.x)
|
|
13
|
+
* - Mouse Y: camera pitch (clamped)
|
|
14
|
+
*/
|
|
15
|
+
export declare const VehicleFixedView: View;
|
|
16
|
+
//# sourceMappingURL=VehicleFixedView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VehicleFixedView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/VehicleFixedView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAA;AA8B3D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,EAAE,IAgI9B,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { View } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Vehicle view
|
|
4
|
+
*
|
|
5
|
+
* Key rule: `heading` comes from the body rotation (server / props), while `aim`
|
|
6
|
+
* comes from local free-look input (mouse).
|
|
7
|
+
*
|
|
8
|
+
* - Movement: W/S = throttle (mapped to move.z), A/D = steering (mapped to move.x)
|
|
9
|
+
* - `move` is ALWAYS relative to `heading` (vehicle body direction)
|
|
10
|
+
* - Camera follows `aim` so you see where you're aiming, even while the body turns independently
|
|
11
|
+
*/
|
|
12
|
+
export declare const VehicleView: View;
|
|
13
|
+
//# sourceMappingURL=VehicleView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VehicleView.d.ts","sourceRoot":"","sources":["../../../../src/react/views/VehicleView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,SAAS,CAAA;AA2B3D;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,EAAE,IAqJzB,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ViewType } from '../types';
|
|
2
|
+
import type { View } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Get a view implementation by type
|
|
5
|
+
*/
|
|
6
|
+
export declare function getView(type: ViewType): View;
|
|
7
|
+
export { FirstPersonView } from './FirstPersonView';
|
|
8
|
+
export { ThirdPersonView } from './ThirdPersonView';
|
|
9
|
+
export { ThirdPersonFixedView } from './ThirdPersonFixedView';
|
|
10
|
+
export { TopDownView } from './TopDownView';
|
|
11
|
+
export { TopDownFixedView } from './TopDownFixedView';
|
|
12
|
+
export { IsometricView } from './IsometricView';
|
|
13
|
+
export { SideOnView } from './SideOnView';
|
|
14
|
+
export { MapView } from './MapView';
|
|
15
|
+
export { VehicleView } from './VehicleView';
|
|
16
|
+
export { VehicleFixedView } from './VehicleFixedView';
|
|
17
|
+
export { TwinStickView } from './TwinStickView';
|
|
18
|
+
export { MobaView } from './MobaView';
|
|
19
|
+
export { AsteroidsView } from './AsteroidsView';
|
|
20
|
+
export type { CrosshairConfig, CrosshairMode, View, ViewContext, ViewState } from './types';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react/views/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAkCnC;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAE5C;AAED,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA"}
|