forked from matrix-org/thirdroom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameTypes.ts
78 lines (69 loc) · 2.22 KB
/
GameTypes.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { IWorld, Query } from "bitecs";
import { GLTFComponentDefinition } from "./gltf/GLTF";
import { GLTFResource } from "./gltf/gltf.game";
import { BaseThreadContext } from "./module/module.common";
import { ComponentStore } from "./resource/ComponentStore";
import { RemoteResource } from "./resource/RemoteResourceClass";
import { RemoteWorld } from "./resource/RemoteResources";
import { Replicator } from "./network/Replicator";
export type World = IWorld;
export interface ResourceManagerGLTFCacheEntry {
refCount: number;
promise: Promise<GLTFResource>;
}
export interface Collision {
nodeA: number;
nodeB: number;
started: boolean;
}
export interface CollisionListener {
id: number;
collisions: Collision[];
}
export interface ActionBarListener {
id: number;
actions: string[];
}
export interface NetworkListener {
id: number;
inbound: [string, ArrayBuffer, boolean][];
}
export interface RemoteResourceManager {
id: string;
ctx: GameContext;
resourceIds: Set<number>;
resourceMap: Map<number, string | ArrayBuffer | RemoteResource>;
gltfCache: Map<string, ResourceManagerGLTFCacheEntry>;
nextQueryId: number;
registeredQueries: Map<number, Query>;
maxEntities: number;
nextComponentId: number;
componentStoreSize: number;
componentIdsByName: Map<string, number>;
componentStores: Map<number, ComponentStore>;
componentDefinitions: Map<number, GLTFComponentDefinition>;
nextComponentStoreIndex: number;
nodeIdToComponentStoreIndex: Map<number, number>;
collisionListeners: CollisionListener[];
nextCollisionListenerId: number;
actionBarListeners: ActionBarListener[];
nextActionBarListenerId: number;
replicators: Map<number, Replicator>;
nextReplicatorId: number;
matrixListening: boolean;
inboundMatrixWidgetMessages: Uint8Array[];
networkListeners: NetworkListener[];
nextNetworkListenerId: number;
}
export interface GameContext extends BaseThreadContext {
mainToGameTripleBufferFlags: Uint8Array;
renderToGameTripleBufferFlags: Uint8Array;
gameToMainTripleBufferFlags: Uint8Array;
gameToRenderTripleBufferFlags: Uint8Array;
elapsed: number;
dt: number;
world: World;
worldResource: RemoteWorld;
resourceManager: RemoteResourceManager;
editorLoaded: boolean;
}