@mml-io/3d-web-client-core 0.21.6 → 0.23.0
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/build/camera/CameraManager.d.ts +7 -4
- package/build/character/Character.d.ts +25 -9
- package/build/character/CharacterManager.d.ts +79 -15
- package/build/character/CharacterModel.d.ts +12 -8
- package/build/character/CharacterState.d.ts +0 -10
- package/build/character/CharacterTooltip.d.ts +1 -0
- package/build/character/LocalController.d.ts +25 -15
- package/build/character/LowPolyModel.d.ts +1 -0
- package/build/character/RemoteController.d.ts +5 -5
- package/build/character/Spawning.d.ts +8 -0
- package/build/character/instancing/CharacterColourSamplingUtils.d.ts +14 -0
- package/build/character/instancing/CharacterInstances.d.ts +92 -0
- package/build/character/instancing/CharacterInstancingAnimationUtils.d.ts +7 -0
- package/build/character/instancing/CharacterInstancingUtils.d.ts +3 -0
- package/build/character/instancing/vendor/core/InstancedEntity.d.ts +191 -0
- package/build/character/instancing/vendor/core/InstancedMesh2.d.ts +361 -0
- package/build/character/instancing/vendor/core/InstancedMeshBVH.d.ts +145 -0
- package/build/character/instancing/vendor/core/feature/Capacity.d.ts +13 -0
- package/build/character/instancing/vendor/core/feature/FrustumCulling.d.ts +37 -0
- package/build/character/instancing/vendor/core/feature/Instances.d.ts +49 -0
- package/build/character/instancing/vendor/core/feature/LOD.d.ts +89 -0
- package/build/character/instancing/vendor/core/feature/Morph.d.ts +18 -0
- package/build/character/instancing/vendor/core/feature/Raycasting.d.ts +7 -0
- package/build/character/instancing/vendor/core/feature/Skeleton.d.ts +19 -0
- package/build/character/instancing/vendor/core/feature/Uniforms.d.ts +42 -0
- package/build/character/instancing/vendor/core/utils/GLInstancedBufferAttribute.d.ts +42 -0
- package/build/character/instancing/vendor/core/utils/InstancedRenderList.d.ts +25 -0
- package/build/character/instancing/vendor/core/utils/SquareDataTexture.d.ts +156 -0
- package/build/character/instancing/vendor/index.d.ts +25 -0
- package/build/character/instancing/vendor/shaders/ShaderChunk.d.ts +1 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_color_pars_vertex.d.ts +1 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_color_vertex.d.ts +1 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_material_color_pars_vertex.d.ts +1 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_material_color_vertex.d.ts +1 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_pars_vertex.d.ts +1 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_skinning_pars_vertex.d.ts +1 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_vertex.d.ts +1 -0
- package/build/character/instancing/vendor/utils/CreateFrom.d.ts +9 -0
- package/build/character/instancing/vendor/utils/SortingUtils.d.ts +16 -0
- package/build/character/loading/CharacterModelLoader.d.ts +11 -0
- package/build/character/loading/GLTFLoadingWorker.worker.d.ts +2 -0
- package/build/character/loading/GLTFLoadingWorkerBrowserCache.d.ts +8 -0
- package/build/character/loading/GLTFLoadingWorkerPool.d.ts +22 -0
- package/build/character/loading/GLTFLoadingWorkerTypes.d.ts +18 -0
- package/build/character/url-position.d.ts +7 -5
- package/build/collisions/CollisionsManager.d.ts +13 -8
- package/build/helpers/math-helpers.d.ts +3 -3
- package/build/index.d.ts +6 -3
- package/build/index.js +10822 -4088
- package/build/index.js.map +4 -4
- package/build/input/KeyInputManager.d.ts +1 -0
- package/build/math/Box.d.ts +16 -0
- package/build/math/EulXYZ.d.ts +24 -0
- package/build/math/Line.d.ts +19 -0
- package/build/math/Matr4.d.ts +77 -0
- package/build/math/Quat.d.ts +57 -0
- package/build/math/Ray.d.ts +15 -0
- package/build/math/Vect3.d.ts +45 -0
- package/build/math/index.d.ts +8 -0
- package/build/math/radToDeg.d.ts +2 -0
- package/build/mml/MMLCompositionScene.d.ts +1 -1
- package/build/rendering/PostProcessingManager.d.ts +92 -0
- package/build/rendering/composer.d.ts +27 -25
- package/build/time/TimeManager.d.ts +2 -1
- package/build/tweakpane/TweakPane.d.ts +10 -5
- package/build/tweakpane/blades/{bcsFolder.d.ts → effects/bcsFolder.d.ts} +2 -2
- package/build/tweakpane/blades/effects/bloomAndGrain.d.ts +12 -0
- package/build/tweakpane/blades/{ssaoFolder.d.ts → effects/ssaoFolder.d.ts} +6 -31
- package/build/tweakpane/blades/{toneMappingFolder.d.ts → effects/toneMappingFolder.d.ts} +1 -1
- package/build/tweakpane/blades/environmentFolder.d.ts +6 -3
- package/build/tweakpane/blades/postProcessingFolder.d.ts +31 -0
- package/build/tweakpane/blades/rendererFolder.d.ts +1 -1
- package/build/tweakpane/blades/rendererStatsFolder.d.ts +0 -2
- package/package.json +16 -11
- package/build/character/CharacterModelLoader.d.ts +0 -11
- package/build/character/CharacterSpeakingIndicator.d.ts +0 -17
- package/build/tweakpane/blades/postExtrasFolder.d.ts +0 -12
@@ -1,5 +1,6 @@
|
|
1
|
-
import { PerspectiveCamera
|
1
|
+
import { PerspectiveCamera } from "three";
|
2
2
|
import { CollisionsManager } from "../collisions/CollisionsManager";
|
3
|
+
import { Vect3 } from "../math";
|
3
4
|
import { TweakPane } from "../tweakpane/TweakPane";
|
4
5
|
export declare class CameraManager {
|
5
6
|
private targetElement;
|
@@ -31,7 +32,8 @@ export declare class CameraManager {
|
|
31
32
|
private targetTheta;
|
32
33
|
private target;
|
33
34
|
private hadTarget;
|
34
|
-
private
|
35
|
+
private cameraRay;
|
36
|
+
private tempVec3;
|
35
37
|
private eventHandlerCollection;
|
36
38
|
private finalTarget;
|
37
39
|
private isLerping;
|
@@ -51,14 +53,15 @@ export declare class CameraManager {
|
|
51
53
|
private onMouseWheel;
|
52
54
|
private zoom;
|
53
55
|
private onContextMenu;
|
54
|
-
setTarget(target:
|
55
|
-
setLerpedTarget(target:
|
56
|
+
setTarget(target: Vect3): void;
|
57
|
+
setLerpedTarget(target: Vect3, targetDistance: number): void;
|
56
58
|
reverseUpdateFromPositions(): void;
|
57
59
|
adjustCameraPosition(): void;
|
58
60
|
dispose(): void;
|
59
61
|
private easeOutExpo;
|
60
62
|
updateAspect(aspect: number): void;
|
61
63
|
recomputeFoV(immediately?: boolean): void;
|
64
|
+
isFlyCameraOn(): boolean;
|
62
65
|
toggleFlyCamera(): void;
|
63
66
|
get activeCamera(): PerspectiveCamera;
|
64
67
|
update(): void;
|
@@ -1,10 +1,11 @@
|
|
1
|
-
import {
|
1
|
+
import { AnimationClip, Group, Object3D } from "three";
|
2
2
|
import { CameraManager } from "../camera/CameraManager";
|
3
|
+
import { EulXYZ } from "../math/EulXYZ";
|
4
|
+
import { Vect3 } from "../math/Vect3";
|
3
5
|
import { Composer } from "../rendering/composer";
|
4
|
-
import { CharacterModelLoader } from "./CharacterModelLoader";
|
5
|
-
import { CharacterSpeakingIndicator } from "./CharacterSpeakingIndicator";
|
6
6
|
import { AnimationState } from "./CharacterState";
|
7
7
|
import { CharacterTooltip } from "./CharacterTooltip";
|
8
|
+
import { CharacterModelLoader } from "./loading/CharacterModelLoader";
|
8
9
|
export type AnimationConfig = {
|
9
10
|
idleAnimationFileUrl: string;
|
10
11
|
jogAnimationFileUrl: string;
|
@@ -12,6 +13,13 @@ export type AnimationConfig = {
|
|
12
13
|
airAnimationFileUrl: string;
|
13
14
|
doubleJumpAnimationFileUrl: string;
|
14
15
|
};
|
16
|
+
export type LoadedAnimations = {
|
17
|
+
idleAnimation: AnimationClip;
|
18
|
+
jogAnimation: AnimationClip;
|
19
|
+
sprintAnimation: AnimationClip;
|
20
|
+
airAnimation: AnimationClip;
|
21
|
+
doubleJumpAnimation: AnimationClip;
|
22
|
+
};
|
15
23
|
export type CharacterDescription = {
|
16
24
|
meshFileUrl: string;
|
17
25
|
mmlCharacterString?: null;
|
@@ -27,28 +35,36 @@ export type CharacterDescription = {
|
|
27
35
|
};
|
28
36
|
export type CharacterConfig = {
|
29
37
|
username: string;
|
30
|
-
characterDescription: CharacterDescription;
|
31
|
-
|
38
|
+
characterDescription: CharacterDescription | null;
|
39
|
+
animationsPromise: Promise<LoadedAnimations>;
|
32
40
|
characterModelLoader: CharacterModelLoader;
|
33
41
|
characterId: number;
|
34
42
|
modelLoadedCallback: () => void;
|
43
|
+
modelLoadFailedCallback?: (error: Error) => void;
|
35
44
|
cameraManager: CameraManager;
|
36
45
|
composer: Composer;
|
37
46
|
isLocal: boolean;
|
47
|
+
abortController?: AbortController;
|
38
48
|
};
|
39
49
|
export declare class Character extends Group {
|
40
50
|
private config;
|
41
51
|
private model;
|
42
|
-
|
43
|
-
tooltip: CharacterTooltip;
|
44
|
-
speakingIndicator: CharacterSpeakingIndicator | null;
|
52
|
+
usernameTooltip: CharacterTooltip;
|
45
53
|
chatTooltips: CharacterTooltip[];
|
46
54
|
constructor(config: CharacterConfig);
|
47
|
-
|
55
|
+
getColors(): Array<[number, number, number]>;
|
56
|
+
updateCharacter(username: string, characterDescription: CharacterDescription | null, abortController: AbortController, onModelLoaded: () => void, onModelLoadFailed: (error: Error) => void): void;
|
48
57
|
private setTooltipHeights;
|
58
|
+
static loadAnimations(characterModelLoader: CharacterModelLoader, animationConfig: AnimationConfig): Promise<LoadedAnimations>;
|
49
59
|
private load;
|
50
60
|
updateAnimation(targetAnimation: AnimationState): void;
|
51
61
|
update(time: number, deltaTime: number): void;
|
62
|
+
getPosition(): Vect3;
|
63
|
+
getRotation(): EulXYZ;
|
64
|
+
setPosition(x: number, y: number, z: number): void;
|
65
|
+
setRotation(x: number, y: number, z: number, w: number): void;
|
52
66
|
getCurrentAnimation(): AnimationState;
|
53
67
|
addChatBubble(message: string): void;
|
68
|
+
getMesh(): Object3D | null;
|
69
|
+
dispose(): void;
|
54
70
|
}
|
@@ -1,17 +1,52 @@
|
|
1
1
|
import { PositionAndRotation } from "@mml-io/mml-web";
|
2
|
-
import {
|
2
|
+
import { Group } from "three";
|
3
3
|
import { CameraManager } from "../camera/CameraManager";
|
4
4
|
import { CollisionsManager } from "../collisions/CollisionsManager";
|
5
5
|
import { KeyInputManager } from "../input/KeyInputManager";
|
6
6
|
import { VirtualJoystick } from "../input/VirtualJoystick";
|
7
|
+
import { EulXYZ } from "../math/EulXYZ";
|
8
|
+
import { Vect3 } from "../math/Vect3";
|
7
9
|
import { Composer } from "../rendering/composer";
|
8
10
|
import { TimeManager } from "../time/TimeManager";
|
9
11
|
import { TweakPane } from "../tweakpane/TweakPane";
|
10
|
-
import {
|
11
|
-
import { CharacterModelLoader } from "./CharacterModelLoader";
|
12
|
+
import { Character, CharacterDescription, LoadedAnimations } from "./Character";
|
12
13
|
import { CharacterState } from "./CharacterState";
|
14
|
+
import { CharacterInstances } from "./instancing/CharacterInstances";
|
15
|
+
import { CharacterModelLoader } from "./loading/CharacterModelLoader";
|
13
16
|
import { LocalController } from "./LocalController";
|
14
17
|
import { RemoteController } from "./RemoteController";
|
18
|
+
type SpawnPosition = {
|
19
|
+
x: number;
|
20
|
+
y: number;
|
21
|
+
z: number;
|
22
|
+
};
|
23
|
+
type SpawnPositionVariance = {
|
24
|
+
x: number;
|
25
|
+
y: number;
|
26
|
+
z: number;
|
27
|
+
};
|
28
|
+
type RespawnTrigger = {
|
29
|
+
minX: number;
|
30
|
+
maxX: number;
|
31
|
+
minY: number;
|
32
|
+
maxY: number;
|
33
|
+
minZ: number;
|
34
|
+
maxZ: number;
|
35
|
+
};
|
36
|
+
export type SpawnConfiguration = {
|
37
|
+
spawnPosition?: Partial<SpawnPosition>;
|
38
|
+
spawnPositionVariance?: Partial<SpawnPositionVariance>;
|
39
|
+
spawnYRotation?: number;
|
40
|
+
respawnTrigger?: Partial<RespawnTrigger>;
|
41
|
+
enableRespawnButton?: boolean;
|
42
|
+
};
|
43
|
+
export type SpawnConfigurationState = {
|
44
|
+
spawnPosition: SpawnPosition;
|
45
|
+
spawnPositionVariance: SpawnPositionVariance;
|
46
|
+
spawnYRotation: number;
|
47
|
+
respawnTrigger: RespawnTrigger;
|
48
|
+
enableRespawnButton: boolean;
|
49
|
+
};
|
15
50
|
export type CharacterManagerConfig = {
|
16
51
|
composer: Composer;
|
17
52
|
characterModelLoader: CharacterModelLoader;
|
@@ -22,34 +57,63 @@ export type CharacterManagerConfig = {
|
|
22
57
|
virtualJoystick?: VirtualJoystick;
|
23
58
|
remoteUserStates: Map<number, CharacterState>;
|
24
59
|
sendUpdate: (update: CharacterState) => void;
|
25
|
-
|
60
|
+
sendLocalCharacterColors: (colors: Array<[number, number, number]>) => void;
|
61
|
+
animationsPromise: Promise<LoadedAnimations>;
|
62
|
+
spawnConfiguration: SpawnConfigurationState;
|
26
63
|
characterResolve: (clientId: number) => {
|
27
|
-
username: string;
|
28
|
-
characterDescription: CharacterDescription;
|
64
|
+
username: string | null;
|
65
|
+
characterDescription: CharacterDescription | null;
|
66
|
+
colors: Array<[number, number, number]> | null;
|
29
67
|
};
|
30
68
|
updateURLLocation?: boolean;
|
31
69
|
};
|
70
|
+
type LoadedCharacterState = {
|
71
|
+
character: Character;
|
72
|
+
remoteController: RemoteController;
|
73
|
+
characterLoaded: boolean;
|
74
|
+
};
|
75
|
+
type RemoteCharacterState = {
|
76
|
+
id: number;
|
77
|
+
loadedCharacterState: LoadedCharacterState | null;
|
78
|
+
lastPosition: {
|
79
|
+
x: number;
|
80
|
+
y: number;
|
81
|
+
z: number;
|
82
|
+
};
|
83
|
+
distanceSquared: number;
|
84
|
+
lastLODChange: number;
|
85
|
+
abortController?: AbortController;
|
86
|
+
};
|
32
87
|
export declare class CharacterManager {
|
33
88
|
private config;
|
34
|
-
readonly headTargetOffset:
|
89
|
+
static readonly headTargetOffset: Vect3;
|
35
90
|
private localClientId;
|
36
|
-
remoteCharacters: Map<number,
|
37
|
-
remoteCharacterControllers: Map<number, RemoteController>;
|
38
|
-
private localCharacterSpawned;
|
91
|
+
remoteCharacters: Map<number, RemoteCharacterState>;
|
39
92
|
localController: LocalController;
|
40
93
|
localCharacter: Character | null;
|
41
|
-
|
94
|
+
characterInstances: CharacterInstances | null;
|
42
95
|
readonly group: Group;
|
43
96
|
private lastUpdateSentTime;
|
97
|
+
private readonly MAX_REAL_REMOTE_CHARACTERS;
|
98
|
+
private readonly LOD_CHANGE_COOLDOWN_MS;
|
99
|
+
private readonly MAX_SCENE_ADDITIONS_PER_FRAME;
|
100
|
+
private pendingSpawns;
|
101
|
+
private loadingCharacters;
|
102
|
+
private charactersReadyForScene;
|
44
103
|
constructor(config: CharacterManagerConfig);
|
45
|
-
spawnLocalCharacter(id: number, username: string, characterDescription: CharacterDescription, spawnPosition?:
|
104
|
+
spawnLocalCharacter(id: number, username: string, characterDescription: CharacterDescription | null, spawnPosition?: Vect3, spawnRotation?: EulXYZ): void;
|
105
|
+
private calculateDistanceSquared;
|
106
|
+
private evaluateLOD;
|
107
|
+
private promoteToReal;
|
108
|
+
private demoteToInstance;
|
46
109
|
setupTweakPane(tweakPane: TweakPane): void;
|
47
|
-
|
110
|
+
private initializeCharacterInstances;
|
48
111
|
getLocalCharacterPositionAndRotation(): PositionAndRotation;
|
49
112
|
clear(): void;
|
50
|
-
|
113
|
+
dispose(): void;
|
51
114
|
addSelfChatBubble(message: string): void;
|
52
115
|
addChatBubble(id: number, message: string): void;
|
53
|
-
|
116
|
+
networkCharacterInfoUpdated(id: number): void;
|
54
117
|
update(): void;
|
55
118
|
}
|
119
|
+
export {};
|
@@ -1,21 +1,24 @@
|
|
1
1
|
import { type MMLCharacterDescription } from "@mml-io/3d-web-avatar";
|
2
|
-
import {
|
3
|
-
import { AnimationAction, AnimationMixer, Bone, Object3D } from "three";
|
2
|
+
import { AnimationAction, AnimationMixer, Bone, Color, Object3D } from "three";
|
4
3
|
import { CameraManager } from "../camera/CameraManager";
|
5
|
-
import {
|
6
|
-
import { CharacterModelLoader } from "./CharacterModelLoader";
|
4
|
+
import { CharacterDescription, LoadedAnimations } from "./Character";
|
7
5
|
import { AnimationState } from "./CharacterState";
|
6
|
+
import { CharacterModelLoader } from "./loading/CharacterModelLoader";
|
7
|
+
export declare const colorPartNamesIndex: readonly ["hair", "shirt_short", "shirt_long", "pants_short", "pants_long", "shoes", "skin", "lips"];
|
8
|
+
export type ColorPartName = (typeof colorPartNamesIndex)[number];
|
9
|
+
export declare function colorsToColorArray(colors: Map<ColorPartName, Color>): Array<[number, number, number]>;
|
10
|
+
export declare function colorArrayToColors(colorArray: Array<[number, number, number]>): Map<ColorPartName, Color>;
|
8
11
|
export type CharacterModelConfig = {
|
9
12
|
characterDescription: CharacterDescription;
|
10
|
-
|
13
|
+
animationsPromise: Promise<LoadedAnimations>;
|
11
14
|
characterModelLoader: CharacterModelLoader;
|
12
15
|
cameraManager: CameraManager;
|
13
16
|
characterId: number;
|
14
17
|
isLocal: boolean;
|
18
|
+
abortController?: AbortController;
|
15
19
|
};
|
16
20
|
export declare class CharacterModel {
|
17
21
|
private config;
|
18
|
-
static ModelLoader: ModelLoader;
|
19
22
|
mesh: Object3D | null;
|
20
23
|
headBone: Bone | null;
|
21
24
|
characterHeight: number | null;
|
@@ -25,16 +28,17 @@ export declare class CharacterModel {
|
|
25
28
|
currentAnimation: AnimationState;
|
26
29
|
mmlCharacterDescription: MMLCharacterDescription;
|
27
30
|
private isPostDoubleJump;
|
31
|
+
private colors;
|
28
32
|
constructor(config: CharacterModelConfig);
|
29
33
|
init(): Promise<void>;
|
30
34
|
private applyCustomMaterials;
|
31
35
|
updateAnimation(targetAnimation: AnimationState): void;
|
32
|
-
private setMainMesh;
|
33
36
|
private composeMMLCharacter;
|
34
37
|
private loadCharacterFromDescription;
|
35
|
-
|
38
|
+
getColors(): Array<[number, number, number]>;
|
36
39
|
private cleanAnimationClips;
|
37
40
|
private setAnimationFromFile;
|
38
41
|
private transitionToAnimation;
|
39
42
|
update(time: number): void;
|
43
|
+
dispose(): void;
|
40
44
|
}
|
@@ -8,7 +8,6 @@ export declare enum AnimationState {
|
|
8
8
|
"doubleJump" = 6
|
9
9
|
}
|
10
10
|
export type CharacterState = {
|
11
|
-
id: number;
|
12
11
|
position: {
|
13
12
|
x: number;
|
14
13
|
y: number;
|
@@ -18,14 +17,5 @@ export type CharacterState = {
|
|
18
17
|
quaternionY: number;
|
19
18
|
quaternionW: number;
|
20
19
|
};
|
21
|
-
camPosition?: {
|
22
|
-
x: number;
|
23
|
-
y: number;
|
24
|
-
z: number;
|
25
|
-
};
|
26
|
-
camQuaternion?: {
|
27
|
-
y: number;
|
28
|
-
w: number;
|
29
|
-
};
|
30
20
|
state: AnimationState;
|
31
21
|
};
|
@@ -1,10 +1,13 @@
|
|
1
|
-
import { Line3, Quaternion, Vector3 } from "three";
|
2
1
|
import { CameraManager } from "../camera/CameraManager";
|
3
2
|
import { CollisionsManager } from "../collisions/CollisionsManager";
|
4
3
|
import { KeyInputManager } from "../input/KeyInputManager";
|
5
4
|
import { VirtualJoystick } from "../input/VirtualJoystick";
|
5
|
+
import { Line } from "../math/Line";
|
6
|
+
import { Quat } from "../math/Quat";
|
7
|
+
import { IVect3, Vect3 } from "../math/Vect3";
|
6
8
|
import { TimeManager } from "../time/TimeManager";
|
7
9
|
import { Character } from "./Character";
|
10
|
+
import { SpawnConfigurationState } from "./CharacterManager";
|
8
11
|
import { CharacterState } from "./CharacterState";
|
9
12
|
export type LocalControllerConfig = {
|
10
13
|
id: number;
|
@@ -14,12 +17,13 @@ export type LocalControllerConfig = {
|
|
14
17
|
virtualJoystick?: VirtualJoystick;
|
15
18
|
cameraManager: CameraManager;
|
16
19
|
timeManager: TimeManager;
|
20
|
+
spawnConfiguration: SpawnConfigurationState;
|
17
21
|
};
|
18
22
|
export declare class LocalController {
|
19
23
|
private config;
|
20
24
|
capsuleInfo: {
|
21
25
|
radius: number;
|
22
|
-
segment:
|
26
|
+
segment: Line;
|
23
27
|
};
|
24
28
|
gravity: number;
|
25
29
|
jumpForce: number;
|
@@ -37,7 +41,7 @@ export declare class LocalController {
|
|
37
41
|
groundRunControl: number;
|
38
42
|
baseControl: number;
|
39
43
|
minimumSurfaceAngle: number;
|
40
|
-
latestPosition:
|
44
|
+
latestPosition: Vect3;
|
41
45
|
characterOnGround: boolean;
|
42
46
|
coyoteTime: boolean;
|
43
47
|
private collisionDetectionSteps;
|
@@ -51,26 +55,32 @@ export declare class LocalController {
|
|
51
55
|
private rotationOffset;
|
52
56
|
private azimuthalAngle;
|
53
57
|
private tempSegment;
|
54
|
-
private
|
55
|
-
private
|
58
|
+
private tempQuat;
|
59
|
+
private tempEulXYZ;
|
56
60
|
private tempVector;
|
57
61
|
private tempVector2;
|
58
|
-
private
|
59
|
-
private
|
60
|
-
private
|
61
|
-
private
|
62
|
+
private tempVect3;
|
63
|
+
private tempRay;
|
64
|
+
private surfaceTempQuat;
|
65
|
+
private surfaceTempQuat2;
|
62
66
|
private surfaceTempVector1;
|
63
67
|
private surfaceTempVector2;
|
64
|
-
private
|
68
|
+
private surfaceTempVect3;
|
65
69
|
private surfaceTempVector4;
|
66
70
|
private surfaceTempVector5;
|
67
71
|
private surfaceTempRay;
|
68
72
|
private lastFrameSurfaceState;
|
69
|
-
jumpPressed: boolean;
|
70
73
|
jumpReleased: boolean;
|
71
74
|
networkState: CharacterState;
|
72
75
|
private controlState;
|
76
|
+
private minimumX;
|
77
|
+
private maximumX;
|
78
|
+
private minimumY;
|
79
|
+
private maximumY;
|
80
|
+
private minimumZ;
|
81
|
+
private maximumZ;
|
73
82
|
constructor(config: LocalControllerConfig);
|
83
|
+
updateSpawnConfig(spawnConfig: SpawnConfigurationState): void;
|
74
84
|
update(): void;
|
75
85
|
private getTargetAnimation;
|
76
86
|
private updateRotationOffset;
|
@@ -80,10 +90,10 @@ export declare class LocalController {
|
|
80
90
|
private processJump;
|
81
91
|
private applyControls;
|
82
92
|
private updatePosition;
|
83
|
-
getMovementFromSurfaces(userPosition:
|
84
|
-
rotation:
|
85
|
-
position:
|
93
|
+
getMovementFromSurfaces(userPosition: IVect3, deltaTime: number): {
|
94
|
+
rotation: Quat;
|
95
|
+
position: Vect3;
|
86
96
|
} | null;
|
87
97
|
private updateNetworkState;
|
88
|
-
|
98
|
+
resetPosition(): void;
|
89
99
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const lowPolyLoDModelURL: any;
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { Character } from "./Character";
|
2
|
-
import {
|
2
|
+
import { CharacterState } from "./CharacterState";
|
3
3
|
export type RemoteControllerConfig = {
|
4
|
-
id: number;
|
5
4
|
character: Character;
|
6
5
|
};
|
7
6
|
export declare class RemoteController {
|
8
|
-
private
|
9
|
-
currentAnimation: AnimationState;
|
7
|
+
private character;
|
10
8
|
networkState: CharacterState;
|
11
|
-
|
9
|
+
private hasReceivedInitialUpdate;
|
10
|
+
private interpolationRate;
|
11
|
+
constructor(character: Character);
|
12
12
|
update(clientUpdate: CharacterState, time: number, deltaTime: number): void;
|
13
13
|
private updateFromNetwork;
|
14
14
|
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { EulXYZ } from "../math/EulXYZ";
|
2
|
+
import { Vect3 } from "../math/Vect3";
|
3
|
+
import { SpawnConfigurationState } from "./CharacterManager";
|
4
|
+
export declare function getSpawnData(config: SpawnConfigurationState, useLocationHash?: boolean): {
|
5
|
+
spawnPosition: Vect3;
|
6
|
+
spawnRotation: EulXYZ;
|
7
|
+
cameraPosition: Vect3;
|
8
|
+
};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { Color, SkinnedMesh, Object3D } from "three";
|
2
|
+
import { ColorPartName } from "../CharacterModel";
|
3
|
+
import { InstancedMesh2 } from "./vendor/";
|
4
|
+
export type ColorSamplingOptions = {
|
5
|
+
circularSamplingRadius?: number;
|
6
|
+
topDownSamplingSize?: {
|
7
|
+
width: number;
|
8
|
+
height: number;
|
9
|
+
};
|
10
|
+
debug?: boolean;
|
11
|
+
};
|
12
|
+
export declare function captureCharacterColors(characterMesh: SkinnedMesh, options: ColorSamplingOptions): Map<ColorPartName, Color>;
|
13
|
+
export declare function captureCharacterColorsFromObject3D(object3D: Object3D, options: ColorSamplingOptions): Map<ColorPartName, Color>;
|
14
|
+
export declare function updateDebugTextureCanvas(instancedMesh: InstancedMesh2): void;
|
@@ -0,0 +1,92 @@
|
|
1
|
+
import { Color, Object3D, Quaternion, Vector3 } from "three";
|
2
|
+
import { CameraManager } from "../../camera/CameraManager";
|
3
|
+
import { EulXYZ, Vect3 } from "../../math";
|
4
|
+
import { TimeManager } from "../../time/TimeManager";
|
5
|
+
import { LoadedAnimations } from "../Character";
|
6
|
+
import { ColorPartName } from "../CharacterModel";
|
7
|
+
import { AnimationState } from "../CharacterState";
|
8
|
+
import { CharacterModelLoader } from "../loading/CharacterModelLoader";
|
9
|
+
export type CharacterInstancesConfig = {
|
10
|
+
animationsPromise: Promise<LoadedAnimations>;
|
11
|
+
characterModelLoader: CharacterModelLoader;
|
12
|
+
cameraManager: CameraManager;
|
13
|
+
timeManager: TimeManager;
|
14
|
+
debug?: boolean;
|
15
|
+
};
|
16
|
+
export type InstanceData = {
|
17
|
+
characterId: number;
|
18
|
+
instanceId: number;
|
19
|
+
isActive: boolean;
|
20
|
+
isShadowed: boolean;
|
21
|
+
time: number;
|
22
|
+
speed: number;
|
23
|
+
offset: number;
|
24
|
+
currentAnimationState: string;
|
25
|
+
animationTime: number;
|
26
|
+
targetPosition: Vector3;
|
27
|
+
targetQuaternion: Quaternion;
|
28
|
+
lerpSpeed: number;
|
29
|
+
hasNewTarget: boolean;
|
30
|
+
};
|
31
|
+
export declare class CharacterInstances {
|
32
|
+
private config;
|
33
|
+
private mixer;
|
34
|
+
private action;
|
35
|
+
private instancedMesh;
|
36
|
+
private skinnedMesh;
|
37
|
+
private propertyBindings;
|
38
|
+
private interpolants;
|
39
|
+
private propertyBindingsLOD;
|
40
|
+
private interpolantsLOD;
|
41
|
+
private invMatrixWorld;
|
42
|
+
private cameraLocalPosition;
|
43
|
+
private delta;
|
44
|
+
private characterScale;
|
45
|
+
private currentBindingMode;
|
46
|
+
private debug;
|
47
|
+
private animationClip;
|
48
|
+
private animationSegments;
|
49
|
+
private characterIdToInstanceIdMap;
|
50
|
+
private animationStateToSegmentName;
|
51
|
+
/**
|
52
|
+
* Apply colors to an instance at the given index
|
53
|
+
* @param instanceIndex The index of the instance to apply colors to
|
54
|
+
* @param colors Optional specific colors to apply, if not provided, random colors will be used
|
55
|
+
*/
|
56
|
+
private applyInstanceColors;
|
57
|
+
constructor(config: CharacterInstancesConfig);
|
58
|
+
initialize(): Promise<Object3D | null>;
|
59
|
+
spawnInstance(characterId: number, colors: Map<ColorPartName, Color>, position: Vect3, rotation: EulXYZ, animationState: AnimationState): void;
|
60
|
+
despawnInstance(characterId: number): void;
|
61
|
+
/**
|
62
|
+
* Shadows an instance instead of fully despawning it. This keeps the instance data
|
63
|
+
* intact (including colors) while hiding it when a real character is promoted.
|
64
|
+
* This avoids texture updates when the character is later demoted back to an instance.
|
65
|
+
*/
|
66
|
+
shadowInstance(characterId: number): void;
|
67
|
+
/**
|
68
|
+
* Reactivates a previously shadowed instance. This is used when a real character
|
69
|
+
* is demoted back to an instance, allowing us to reuse the existing instance data
|
70
|
+
* and avoid texture updates from creating a new instance.
|
71
|
+
*/
|
72
|
+
unshadowInstance(characterId: number): void;
|
73
|
+
updateInstance(characterId: number, position: Vect3, rotation: EulXYZ, animationState: AnimationState): void;
|
74
|
+
updateInstanceColors(characterId: number, colors: Map<string, Color>): void;
|
75
|
+
private updateInstancedMeshBounds;
|
76
|
+
private setMainMesh;
|
77
|
+
private loadAnimation;
|
78
|
+
private createInstancedMesh;
|
79
|
+
private setupAnimationOptimization;
|
80
|
+
private initializeSkeletonData;
|
81
|
+
getPositionForInstance(characterId: number): Vect3 | null;
|
82
|
+
private updateAllInstanceLerping;
|
83
|
+
update(deltaTime: number, totalTime: number): void;
|
84
|
+
setupFrustumCulling(): void;
|
85
|
+
clear(): void;
|
86
|
+
dispose(): void;
|
87
|
+
/**
|
88
|
+
* Immediately sets an instance position without lerping. Used when unshadowing
|
89
|
+
* instances to position them at the real character's last known position.
|
90
|
+
*/
|
91
|
+
setInstancePositionImmediate(characterId: number, position: Vect3, rotation: EulXYZ, animationState: AnimationState): boolean;
|
92
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { AnimationClip } from "three";
|
2
|
+
export type SegmentTime = {
|
3
|
+
startTime: number;
|
4
|
+
endTime: number;
|
5
|
+
duration: number;
|
6
|
+
};
|
7
|
+
export declare function createSingleTimeline(individualClips: Map<string, AnimationClip>): [Map<string, SegmentTime>, AnimationClip];
|