@mml-io/3d-web-client-core 0.10.1 → 0.12.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 +1 -1
- package/build/character/Character.d.ts +16 -21
- package/build/character/CharacterManager.d.ts +11 -7
- package/build/character/CharacterMaterial.d.ts +1 -1
- package/build/character/CharacterModel.d.ts +10 -7
- package/build/character/CharacterModelLoader.d.ts +4 -6
- package/build/character/CharacterTooltip.d.ts +4 -6
- package/build/character/LocalController.d.ts +23 -11
- package/build/character/RemoteController.d.ts +1 -9
- package/build/character/url-position.d.ts +12 -0
- package/build/collisions/CollisionsManager.d.ts +4 -4
- package/build/index.d.ts +3 -1
- package/build/index.js +2007 -621
- package/build/index.js.map +4 -4
- package/build/mml/MMLCompositionScene.d.ts +1 -0
- package/build/rendering/post-effects/n8-ssao/BlueNoise.d.ts +1 -0
- package/build/rendering/post-effects/n8-ssao/DepthDownSample.d.ts +17 -0
- package/build/rendering/post-effects/n8-ssao/EffectCompositer.d.ts +39 -0
- package/build/rendering/post-effects/n8-ssao/EffectShader.d.ts +31 -0
- package/build/rendering/post-effects/n8-ssao/FullScreenTriangle.d.ts +11 -0
- package/build/rendering/post-effects/n8-ssao/N8SSAOPass.d.ts +65 -0
- package/build/rendering/post-effects/n8-ssao/PoissionBlur.d.ts +30 -0
- package/build/tweakpane/blades/ssaoFolder.d.ts +21 -0
- package/package.json +9 -9
@@ -38,7 +38,7 @@ export declare class CameraManager {
|
|
38
38
|
private onMouseWheel;
|
39
39
|
setTarget(target: Vector3): void;
|
40
40
|
setLerpedTarget(target: Vector3, targetDistance: number): void;
|
41
|
-
|
41
|
+
reverseUpdateFromPositions(): void;
|
42
42
|
adjustCameraPosition(): void;
|
43
43
|
dispose(): void;
|
44
44
|
private easeOutExpo;
|
@@ -1,41 +1,36 @@
|
|
1
|
-
import { Color,
|
1
|
+
import { Color, Group } from "three";
|
2
2
|
import { CameraManager } from "../camera/CameraManager";
|
3
|
-
import { CollisionsManager } from "../collisions/CollisionsManager";
|
4
|
-
import { KeyInputManager } from "../input/KeyInputManager";
|
5
3
|
import { Composer } from "../rendering/composer";
|
6
|
-
import { TimeManager } from "../time/TimeManager";
|
7
|
-
import { CharacterModel } from "./CharacterModel";
|
8
4
|
import { CharacterModelLoader } from "./CharacterModelLoader";
|
9
5
|
import { CharacterSpeakingIndicator } from "./CharacterSpeakingIndicator";
|
6
|
+
import { AnimationState } from "./CharacterState";
|
10
7
|
import { CharacterTooltip } from "./CharacterTooltip";
|
11
|
-
|
12
|
-
export type CharacterDescription = {
|
13
|
-
meshFileUrl: string;
|
8
|
+
export type AnimationConfig = {
|
14
9
|
idleAnimationFileUrl: string;
|
15
10
|
jogAnimationFileUrl: string;
|
16
11
|
sprintAnimationFileUrl: string;
|
17
12
|
airAnimationFileUrl: string;
|
18
|
-
modelScale: number;
|
19
13
|
};
|
20
|
-
export
|
14
|
+
export type CharacterDescription = {
|
15
|
+
meshFileUrl?: string;
|
16
|
+
mmlCharacterUrl?: string;
|
17
|
+
mmlCharacterString?: string;
|
18
|
+
};
|
19
|
+
export declare class Character extends Group {
|
21
20
|
private readonly characterDescription;
|
21
|
+
private readonly animationConfig;
|
22
22
|
private readonly characterModelLoader;
|
23
|
-
private readonly
|
24
|
-
private readonly isLocal;
|
23
|
+
private readonly characterId;
|
25
24
|
private readonly modelLoadedCallback;
|
26
|
-
private readonly collisionsManager;
|
27
|
-
private readonly keyInputManager;
|
28
25
|
private readonly cameraManager;
|
29
|
-
private readonly timeManager;
|
30
26
|
private readonly composer;
|
31
|
-
|
32
|
-
name: string | null;
|
33
|
-
model: CharacterModel | null;
|
27
|
+
private model;
|
34
28
|
color: Color;
|
35
|
-
position: Vector3;
|
36
29
|
tooltip: CharacterTooltip | null;
|
37
30
|
speakingIndicator: CharacterSpeakingIndicator | null;
|
38
|
-
constructor(characterDescription: CharacterDescription,
|
31
|
+
constructor(characterDescription: CharacterDescription, animationConfig: AnimationConfig, characterModelLoader: CharacterModelLoader, characterId: number, modelLoadedCallback: () => void, cameraManager: CameraManager, composer: Composer);
|
39
32
|
private load;
|
40
|
-
|
33
|
+
updateAnimation(targetAnimation: AnimationState): void;
|
34
|
+
update(time: number, deltaTime: number): void;
|
35
|
+
getCurrentAnimation(): AnimationState;
|
41
36
|
}
|
@@ -5,7 +5,7 @@ import { CollisionsManager } from "../collisions/CollisionsManager";
|
|
5
5
|
import { KeyInputManager } from "../input/KeyInputManager";
|
6
6
|
import { Composer } from "../rendering/composer";
|
7
7
|
import { TimeManager } from "../time/TimeManager";
|
8
|
-
import { Character, CharacterDescription } from "./Character";
|
8
|
+
import { AnimationConfig, Character, CharacterDescription } from "./Character";
|
9
9
|
import { CharacterModelLoader } from "./CharacterModelLoader";
|
10
10
|
import { CharacterState } from "./CharacterState";
|
11
11
|
import { RemoteController } from "./RemoteController";
|
@@ -15,22 +15,26 @@ export declare class CharacterManager {
|
|
15
15
|
private readonly collisionsManager;
|
16
16
|
private readonly cameraManager;
|
17
17
|
private readonly timeManager;
|
18
|
-
private readonly
|
18
|
+
private readonly keyInputManager;
|
19
19
|
private readonly clientStates;
|
20
20
|
private readonly sendUpdate;
|
21
|
+
private readonly animationConfig;
|
22
|
+
private readonly characterDescription;
|
21
23
|
private updateLocationHash;
|
24
|
+
readonly headTargetOffset: Vector3;
|
22
25
|
private id;
|
23
|
-
loadingCharacters: Map<number, Promise<Character>>;
|
24
26
|
remoteCharacters: Map<number, Character>;
|
25
27
|
remoteCharacterControllers: Map<number, RemoteController>;
|
26
|
-
private
|
27
|
-
|
28
|
+
private localCharacterSpawned;
|
29
|
+
private localController;
|
30
|
+
localCharacter: Character | null;
|
28
31
|
private cameraOffsetTarget;
|
29
32
|
private cameraOffset;
|
30
33
|
private speakingCharacters;
|
31
34
|
readonly group: Group;
|
32
|
-
constructor(composer: Composer, characterModelLoader: CharacterModelLoader, collisionsManager: CollisionsManager, cameraManager: CameraManager, timeManager: TimeManager,
|
33
|
-
|
35
|
+
constructor(composer: Composer, characterModelLoader: CharacterModelLoader, collisionsManager: CollisionsManager, cameraManager: CameraManager, timeManager: TimeManager, keyInputManager: KeyInputManager, clientStates: Map<number, CharacterState>, sendUpdate: (update: CharacterState) => void, animationConfig: AnimationConfig, characterDescription: CharacterDescription);
|
36
|
+
spawnLocalCharacter(characterDescription: CharacterDescription, id: number, spawnPosition?: Vector3, spawnRotation?: Euler): void;
|
37
|
+
spawnRemoteCharacter(characterDescription: CharacterDescription, id: number, spawnPosition?: Vector3, spawnRotation?: Euler): void;
|
34
38
|
getLocalCharacterPositionAndRotation(): PositionAndRotation;
|
35
39
|
clear(): void;
|
36
40
|
setSpeakingCharacter(id: number, value: boolean): void;
|
@@ -5,7 +5,7 @@ type TUniform<TValue = any> = {
|
|
5
5
|
export declare class CharacterMaterial extends MeshPhysicalMaterial {
|
6
6
|
uniforms: Record<string, TUniform>;
|
7
7
|
colorsCube216: Color[];
|
8
|
-
constructor();
|
8
|
+
constructor(color?: Color);
|
9
9
|
private generateColorCube;
|
10
10
|
update(): void;
|
11
11
|
}
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import { AnimationAction, AnimationMixer, Bone, Object3D } from "three";
|
2
|
-
import { CharacterDescription } from "./Character";
|
2
|
+
import { AnimationConfig, CharacterDescription } from "./Character";
|
3
3
|
import { CharacterMaterial } from "./CharacterMaterial";
|
4
4
|
import { CharacterModelLoader } from "./CharacterModelLoader";
|
5
5
|
import { AnimationState } from "./CharacterState";
|
6
6
|
export declare class CharacterModel {
|
7
7
|
private readonly characterDescription;
|
8
|
+
private readonly animationConfig;
|
8
9
|
private characterModelLoader;
|
9
10
|
mesh: Object3D | null;
|
10
11
|
material: CharacterMaterial;
|
@@ -12,14 +13,16 @@ export declare class CharacterModel {
|
|
12
13
|
animations: Record<string, AnimationAction>;
|
13
14
|
animationMixer: AnimationMixer | null;
|
14
15
|
currentAnimation: AnimationState;
|
15
|
-
constructor(characterDescription: CharacterDescription, characterModelLoader: CharacterModelLoader);
|
16
|
+
constructor(characterDescription: CharacterDescription, animationConfig: AnimationConfig, characterModelLoader: CharacterModelLoader);
|
16
17
|
init(): Promise<void>;
|
17
|
-
|
18
|
-
|
19
|
-
private
|
20
|
-
private
|
21
|
-
private
|
18
|
+
private applyCustomMaterial;
|
19
|
+
updateAnimation(targetAnimation: AnimationState): void;
|
20
|
+
private setMainMesh;
|
21
|
+
private composeMMLCharacter;
|
22
|
+
private loadCharacterFromDescription;
|
22
23
|
private loadMainMesh;
|
24
|
+
private cleanAnimationClips;
|
23
25
|
private setAnimationFromFile;
|
24
26
|
private transitionToAnimation;
|
27
|
+
update(time: number): void;
|
25
28
|
}
|
@@ -1,14 +1,12 @@
|
|
1
1
|
import { AnimationClip, Object3D } from "three";
|
2
2
|
export declare class CharacterModelLoader {
|
3
|
-
private
|
3
|
+
private debug;
|
4
4
|
private readonly loadingManager;
|
5
5
|
private readonly gltfLoader;
|
6
6
|
private modelCache;
|
7
7
|
private ongoingLoads;
|
8
|
-
constructor(maxCacheSize?: number);
|
9
|
-
|
10
|
-
load(fileUrl: string, fileType: "
|
8
|
+
constructor(maxCacheSize?: number, debug?: boolean);
|
9
|
+
load(fileUrl: string, fileType: "model"): Promise<Object3D | undefined>;
|
10
|
+
load(fileUrl: string, fileType: "animation"): Promise<AnimationClip | undefined>;
|
11
11
|
private loadFromUrl;
|
12
12
|
}
|
13
|
-
declare const MODEL_LOADER: CharacterModelLoader;
|
14
|
-
export default MODEL_LOADER;
|
@@ -1,14 +1,12 @@
|
|
1
|
-
import { Camera,
|
2
|
-
export declare class CharacterTooltip {
|
3
|
-
private
|
4
|
-
private material;
|
5
|
-
private mesh;
|
1
|
+
import { Camera, Mesh } from "three";
|
2
|
+
export declare class CharacterTooltip extends Mesh {
|
3
|
+
private tooltipMaterial;
|
6
4
|
private visibleOpacity;
|
7
5
|
private targetOpacity;
|
8
6
|
private fadingSpeed;
|
9
7
|
private secondsToFadeOut;
|
10
8
|
private props;
|
11
|
-
constructor(
|
9
|
+
constructor();
|
12
10
|
private redrawText;
|
13
11
|
setText(text: string, temporary?: boolean): void;
|
14
12
|
hide(): void;
|
@@ -1,24 +1,21 @@
|
|
1
|
-
import { Line3 } from "three";
|
1
|
+
import { Line3, Quaternion, Vector3 } from "three";
|
2
2
|
import { CameraManager } from "../camera/CameraManager";
|
3
3
|
import { CollisionsManager } from "../collisions/CollisionsManager";
|
4
4
|
import { KeyInputManager } from "../input/KeyInputManager";
|
5
5
|
import { TimeManager } from "../time/TimeManager";
|
6
|
-
import {
|
6
|
+
import { Character } from "./Character";
|
7
7
|
import { CharacterState } from "./CharacterState";
|
8
8
|
export declare class LocalController {
|
9
|
-
private readonly
|
9
|
+
private readonly character;
|
10
10
|
private readonly id;
|
11
11
|
private readonly collisionsManager;
|
12
12
|
private readonly keyInputManager;
|
13
13
|
private readonly cameraManager;
|
14
14
|
private readonly timeManager;
|
15
|
-
private collisionDetectionSteps;
|
16
15
|
capsuleInfo: {
|
17
16
|
radius: number;
|
18
17
|
segment: Line3;
|
19
18
|
};
|
20
|
-
private maxWalkSpeed;
|
21
|
-
private maxRunSpeed;
|
22
19
|
private gravity;
|
23
20
|
private jumpForce;
|
24
21
|
private coyoteTimeThreshold;
|
@@ -28,6 +25,7 @@ export declare class LocalController {
|
|
28
25
|
private characterWasOnGround;
|
29
26
|
private characterAirborneSince;
|
30
27
|
private currentHeight;
|
28
|
+
private currentSurfaceAngle;
|
31
29
|
private characterVelocity;
|
32
30
|
private vectorUp;
|
33
31
|
private vectorDown;
|
@@ -35,9 +33,21 @@ export declare class LocalController {
|
|
35
33
|
private azimuthalAngle;
|
36
34
|
private tempMatrix;
|
37
35
|
private tempSegment;
|
36
|
+
private tempQuaternion;
|
37
|
+
private tempEuler;
|
38
38
|
private tempVector;
|
39
39
|
private tempVector2;
|
40
|
+
private tempVector3;
|
40
41
|
private rayCaster;
|
42
|
+
private surfaceTempQuaternion;
|
43
|
+
private surfaceTempQuaternion2;
|
44
|
+
private surfaceTempVector1;
|
45
|
+
private surfaceTempVector2;
|
46
|
+
private surfaceTempVector3;
|
47
|
+
private surfaceTempVector4;
|
48
|
+
private surfaceTempVector5;
|
49
|
+
private surfaceTempRay;
|
50
|
+
private lastFrameSurfaceState;
|
41
51
|
private forward;
|
42
52
|
private backward;
|
43
53
|
private left;
|
@@ -46,19 +56,21 @@ export declare class LocalController {
|
|
46
56
|
private jump;
|
47
57
|
private anyDirection;
|
48
58
|
private conflictingDirections;
|
49
|
-
private thirdPersonCamera;
|
50
|
-
private speed;
|
51
|
-
private targetSpeed;
|
52
59
|
networkState: CharacterState;
|
53
|
-
constructor(
|
60
|
+
constructor(character: Character, id: number, collisionsManager: CollisionsManager, keyInputManager: KeyInputManager, cameraManager: CameraManager, timeManager: TimeManager);
|
61
|
+
private updateControllerState;
|
54
62
|
update(): void;
|
55
63
|
private getTargetAnimation;
|
56
64
|
private updateRotationOffset;
|
57
65
|
private updateAzimuthalAngle;
|
58
66
|
private computeAngularDifference;
|
59
67
|
private updateRotation;
|
60
|
-
private
|
68
|
+
private applyControls;
|
61
69
|
private updatePosition;
|
70
|
+
getMovementFromSurfaces(userPosition: Vector3, deltaTime: number): {
|
71
|
+
rotation: Quaternion;
|
72
|
+
position: Vector3;
|
73
|
+
} | null;
|
62
74
|
private updateNetworkState;
|
63
75
|
private resetPosition;
|
64
76
|
}
|
@@ -1,19 +1,11 @@
|
|
1
|
-
import { Object3D } from "three";
|
2
1
|
import { Character } from "./Character";
|
3
|
-
import { CharacterModelLoader } from "./CharacterModelLoader";
|
4
2
|
import { AnimationState, CharacterState } from "./CharacterState";
|
5
3
|
export declare class RemoteController {
|
6
4
|
readonly character: Character;
|
7
|
-
private readonly characterModelLoader;
|
8
5
|
readonly id: number;
|
9
|
-
characterModel: Object3D | null;
|
10
|
-
private animationMixer;
|
11
|
-
private animations;
|
12
6
|
currentAnimation: AnimationState;
|
13
7
|
networkState: CharacterState;
|
14
|
-
constructor(character: Character,
|
8
|
+
constructor(character: Character, id: number);
|
15
9
|
update(clientUpdate: CharacterState, time: number, deltaTime: number): void;
|
16
|
-
setAnimationFromFile(animationType: AnimationState, fileName: string): Promise<void>;
|
17
|
-
private transitionToAnimation;
|
18
10
|
private updateFromNetwork;
|
19
11
|
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Object3D, Quaternion, Vector3 } from "three";
|
2
|
+
export declare function encodeCharacterAndCamera(character: Object3D, camera: Object3D): string;
|
3
|
+
export declare function decodeCharacterAndCamera(hash: string): {
|
4
|
+
character: {
|
5
|
+
position: Vector3;
|
6
|
+
quaternion: Quaternion;
|
7
|
+
};
|
8
|
+
camera: {
|
9
|
+
position: Vector3;
|
10
|
+
quaternion: Quaternion;
|
11
|
+
};
|
12
|
+
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { MElement } from "mml-web";
|
2
|
-
import { Group, Line3, Matrix4, Ray, Scene } from "three";
|
2
|
+
import { Group, Line3, Matrix4, Ray, Scene, Vector3 } from "three";
|
3
3
|
import { MeshBVH } from "three-mesh-bvh";
|
4
|
-
type CollisionMeshState = {
|
4
|
+
export type CollisionMeshState = {
|
5
5
|
matrix: Matrix4;
|
6
6
|
source: Group;
|
7
7
|
meshBVH: MeshBVH;
|
@@ -14,6 +14,7 @@ export declare class CollisionsManager {
|
|
14
14
|
private tempVector;
|
15
15
|
private tempVector2;
|
16
16
|
private tempVector3;
|
17
|
+
private tempQuaternion;
|
17
18
|
private tempRay;
|
18
19
|
private tempMatrix;
|
19
20
|
private tempMatrix2;
|
@@ -24,7 +25,7 @@ export declare class CollisionsManager {
|
|
24
25
|
collisionMeshState: Map<Group, CollisionMeshState>;
|
25
26
|
private collisionTrigger;
|
26
27
|
constructor(scene: Scene);
|
27
|
-
|
28
|
+
raycastFirst(ray: Ray): [number, Vector3, CollisionMeshState] | null;
|
28
29
|
private createCollisionMeshState;
|
29
30
|
addMeshesGroup(group: Group, mElement?: MElement): void;
|
30
31
|
updateMeshesGroup(group: Group): void;
|
@@ -32,4 +33,3 @@ export declare class CollisionsManager {
|
|
32
33
|
private applyCollider;
|
33
34
|
applyColliders(tempSegment: Line3, radius: number): void;
|
34
35
|
}
|
35
|
-
export {};
|
package/build/index.d.ts
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
export { CameraManager } from "./camera/CameraManager";
|
2
|
-
export { CharacterDescription } from "./character/Character";
|
2
|
+
export { CharacterDescription, AnimationConfig } from "./character/Character";
|
3
3
|
export { CharacterManager } from "./character/CharacterManager";
|
4
|
+
export * from "./character/url-position";
|
5
|
+
export * from "./helpers/math-helpers";
|
4
6
|
export { CharacterModelLoader } from "./character/CharacterModelLoader";
|
5
7
|
export { CharacterState, AnimationState } from "./character/CharacterState";
|
6
8
|
export { KeyInputManager } from "./input/KeyInputManager";
|