@mml-io/3d-web-client-core 0.0.0-experimental-4fd4a46-20240131 → 0.0.0-experimental-b2c116e-20240201
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/character/Character.d.ts +9 -6
- package/build/character/CharacterManager.d.ts +5 -7
- package/build/character/CharacterModel.d.ts +5 -2
- package/build/character/CharacterModelLoader.d.ts +2 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +117 -120
- package/build/index.js.map +3 -3
- package/package.json +3 -3
@@ -1,21 +1,24 @@
|
|
1
|
-
import { Color, Group
|
1
|
+
import { Color, Group } from "three";
|
2
2
|
import { CameraManager } from "../camera/CameraManager";
|
3
3
|
import { Composer } from "../rendering/composer";
|
4
4
|
import { CharacterModelLoader } from "./CharacterModelLoader";
|
5
5
|
import { CharacterSpeakingIndicator } from "./CharacterSpeakingIndicator";
|
6
6
|
import { AnimationState } from "./CharacterState";
|
7
7
|
import { CharacterTooltip } from "./CharacterTooltip";
|
8
|
-
export type
|
9
|
-
meshFileUrl: string;
|
8
|
+
export type AnimationConfig = {
|
10
9
|
idleAnimationFileUrl: string;
|
11
10
|
jogAnimationFileUrl: string;
|
12
11
|
sprintAnimationFileUrl: string;
|
13
12
|
airAnimationFileUrl: string;
|
14
|
-
|
15
|
-
|
13
|
+
};
|
14
|
+
export type CharacterDescription = {
|
15
|
+
meshFileUrl?: string;
|
16
|
+
mmlCharacterUrl?: string;
|
17
|
+
mmlCharacterString?: string;
|
16
18
|
};
|
17
19
|
export declare class Character extends Group {
|
18
20
|
private readonly characterDescription;
|
21
|
+
private readonly animationConfig;
|
19
22
|
private readonly characterModelLoader;
|
20
23
|
private readonly characterId;
|
21
24
|
private readonly modelLoadedCallback;
|
@@ -25,7 +28,7 @@ export declare class Character extends Group {
|
|
25
28
|
color: Color;
|
26
29
|
tooltip: CharacterTooltip | null;
|
27
30
|
speakingIndicator: CharacterSpeakingIndicator | null;
|
28
|
-
constructor(characterDescription: CharacterDescription, characterModelLoader: CharacterModelLoader, characterId: number, modelLoadedCallback: () => void, cameraManager: CameraManager, composer: Composer);
|
31
|
+
constructor(characterDescription: CharacterDescription, animationConfig: AnimationConfig, characterModelLoader: CharacterModelLoader, characterId: number, modelLoadedCallback: () => void, cameraManager: CameraManager, composer: Composer);
|
29
32
|
private load;
|
30
33
|
updateAnimation(targetAnimation: AnimationState): void;
|
31
34
|
update(time: number, deltaTime: number): void;
|
@@ -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";
|
@@ -18,24 +18,22 @@ export declare class CharacterManager {
|
|
18
18
|
private readonly keyInputManager;
|
19
19
|
private readonly clientStates;
|
20
20
|
private readonly sendUpdate;
|
21
|
-
private readonly
|
21
|
+
private readonly animationConfig;
|
22
|
+
private readonly characterDescription;
|
22
23
|
private updateLocationHash;
|
23
24
|
readonly headTargetOffset: Vector3;
|
24
25
|
private id;
|
25
26
|
remoteCharacters: Map<number, Character>;
|
26
27
|
remoteCharacterControllers: Map<number, RemoteController>;
|
27
28
|
private localCharacterSpawned;
|
28
|
-
private characterDescription;
|
29
29
|
private localController;
|
30
30
|
localCharacter: Character | null;
|
31
31
|
private cameraOffsetTarget;
|
32
32
|
private cameraOffset;
|
33
33
|
private speakingCharacters;
|
34
34
|
readonly group: Group;
|
35
|
-
constructor(composer: Composer, characterModelLoader: CharacterModelLoader, collisionsManager: CollisionsManager, cameraManager: CameraManager, timeManager: TimeManager, keyInputManager: KeyInputManager, clientStates: Map<number, CharacterState>, sendUpdate: (update: CharacterState) => void,
|
36
|
-
|
37
|
-
private composeMMLCharacter;
|
38
|
-
spawnLocalCharacter(characterDescription: CharacterDescription, id: number, spawnPosition?: Vector3, spawnRotation?: Euler): Promise<void>;
|
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;
|
39
37
|
spawnRemoteCharacter(characterDescription: CharacterDescription, id: number, spawnPosition?: Vector3, spawnRotation?: Euler): void;
|
40
38
|
getLocalCharacterPositionAndRotation(): PositionAndRotation;
|
41
39
|
clear(): void;
|
@@ -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,11 +13,13 @@ 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
|
private applyCustomMaterial;
|
18
19
|
updateAnimation(targetAnimation: AnimationState): void;
|
19
20
|
private setMainMesh;
|
21
|
+
private composeMMLCharacter;
|
22
|
+
private loadCharacterFromDescription;
|
20
23
|
private loadMainMesh;
|
21
24
|
private cleanAnimationClips;
|
22
25
|
private setAnimationFromFile;
|
@@ -6,6 +6,7 @@ export declare class CharacterModelLoader {
|
|
6
6
|
private modelCache;
|
7
7
|
private ongoingLoads;
|
8
8
|
constructor(maxCacheSize?: number, debug?: boolean);
|
9
|
-
load(fileUrl: string, fileType: "model"
|
9
|
+
load(fileUrl: string, fileType: "model"): Promise<Object3D | undefined>;
|
10
|
+
load(fileUrl: string, fileType: "animation"): Promise<AnimationClip | undefined>;
|
10
11
|
private loadFromUrl;
|
11
12
|
}
|
package/build/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
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
4
|
export * from "./character/url-position";
|
5
5
|
export * from "./helpers/math-helpers";
|
package/build/index.js
CHANGED
@@ -256,10 +256,14 @@ var CameraManager = class {
|
|
256
256
|
};
|
257
257
|
|
258
258
|
// src/character/Character.ts
|
259
|
-
import { Color as
|
259
|
+
import { Color as Color3, Group, Vector3 as Vector34 } from "three";
|
260
260
|
|
261
261
|
// src/character/CharacterModel.ts
|
262
|
-
import {
|
262
|
+
import {
|
263
|
+
Character as MMLCharacter,
|
264
|
+
ModelLoader,
|
265
|
+
parseMMLDescription
|
266
|
+
} from "@mml-io/3d-web-avatar";
|
263
267
|
import {
|
264
268
|
AnimationClip,
|
265
269
|
AnimationMixer,
|
@@ -640,8 +644,9 @@ var AnimationState = /* @__PURE__ */ ((AnimationState2) => {
|
|
640
644
|
|
641
645
|
// src/character/CharacterModel.ts
|
642
646
|
var CharacterModel = class {
|
643
|
-
constructor(characterDescription, characterModelLoader) {
|
647
|
+
constructor(characterDescription, animationConfig, characterModelLoader) {
|
644
648
|
this.characterDescription = characterDescription;
|
649
|
+
this.animationConfig = animationConfig;
|
645
650
|
this.characterModelLoader = characterModelLoader;
|
646
651
|
this.mesh = null;
|
647
652
|
this.material = new CharacterMaterial();
|
@@ -651,30 +656,18 @@ var CharacterModel = class {
|
|
651
656
|
this.currentAnimation = 0 /* idle */;
|
652
657
|
}
|
653
658
|
async init() {
|
654
|
-
|
655
|
-
|
656
|
-
this.setMainMesh(mesh, "MMLCharacter");
|
657
|
-
this.animationMixer = new AnimationMixer(this.mesh);
|
658
|
-
} else {
|
659
|
-
await this.loadMainMesh();
|
660
|
-
}
|
661
|
-
await this.setAnimationFromFile(
|
662
|
-
this.characterDescription.idleAnimationFileUrl,
|
663
|
-
0 /* idle */
|
664
|
-
);
|
659
|
+
await this.loadMainMesh();
|
660
|
+
await this.setAnimationFromFile(this.animationConfig.idleAnimationFileUrl, 0 /* idle */);
|
665
661
|
await this.setAnimationFromFile(
|
666
|
-
this.
|
662
|
+
this.animationConfig.jogAnimationFileUrl,
|
667
663
|
1 /* walking */
|
668
664
|
);
|
669
665
|
await this.setAnimationFromFile(
|
670
|
-
this.
|
666
|
+
this.animationConfig.sprintAnimationFileUrl,
|
671
667
|
2 /* running */
|
672
668
|
);
|
673
|
-
await this.setAnimationFromFile(
|
674
|
-
|
675
|
-
4 /* air */
|
676
|
-
);
|
677
|
-
if (!this.characterDescription.meshModel) {
|
669
|
+
await this.setAnimationFromFile(this.animationConfig.airAnimationFileUrl, 4 /* air */);
|
670
|
+
if (this.characterDescription.meshFileUrl) {
|
678
671
|
this.applyCustomMaterial(this.material);
|
679
672
|
}
|
680
673
|
}
|
@@ -699,12 +692,9 @@ var CharacterModel = class {
|
|
699
692
|
this.transitionToAnimation(targetAnimation);
|
700
693
|
}
|
701
694
|
}
|
702
|
-
setMainMesh(mainMesh
|
695
|
+
setMainMesh(mainMesh) {
|
703
696
|
this.mesh = mainMesh;
|
704
697
|
this.mesh.position.set(0, -0.4, 0);
|
705
|
-
this.mesh.name = name;
|
706
|
-
const scale = this.characterDescription.modelScale;
|
707
|
-
this.mesh.scale.set(scale, scale, scale);
|
708
698
|
this.mesh.traverse((child) => {
|
709
699
|
if (child.type === "SkinnedMesh") {
|
710
700
|
child.castShadow = true;
|
@@ -713,13 +703,62 @@ var CharacterModel = class {
|
|
713
703
|
});
|
714
704
|
this.animationMixer = new AnimationMixer(this.mesh);
|
715
705
|
}
|
706
|
+
async composeMMLCharacter(mmlCharacterDescription) {
|
707
|
+
var _a, _b, _c;
|
708
|
+
if (((_a = mmlCharacterDescription.base) == null ? void 0 : _a.url.length) === 0) {
|
709
|
+
throw new Error(
|
710
|
+
"ERROR: An MML Character Description was provided but it's not a valid <m-character> string, or a valid URL"
|
711
|
+
);
|
712
|
+
}
|
713
|
+
let mergedCharacter = null;
|
714
|
+
if (mmlCharacterDescription) {
|
715
|
+
const characterBase = ((_b = mmlCharacterDescription.base) == null ? void 0 : _b.url) || null;
|
716
|
+
const parts = [];
|
717
|
+
(_c = mmlCharacterDescription.parts) == null ? void 0 : _c.forEach((part) => {
|
718
|
+
if (part.url)
|
719
|
+
parts.push(part.url);
|
720
|
+
});
|
721
|
+
if (characterBase) {
|
722
|
+
const mmlCharacter = new MMLCharacter(new ModelLoader());
|
723
|
+
mergedCharacter = await mmlCharacter.mergeBodyParts(characterBase, parts);
|
724
|
+
if (mergedCharacter) {
|
725
|
+
return mergedCharacter.children[0].children[0];
|
726
|
+
}
|
727
|
+
}
|
728
|
+
}
|
729
|
+
}
|
730
|
+
async loadCharacterFromDescription() {
|
731
|
+
if (this.characterDescription.meshFileUrl) {
|
732
|
+
return await this.characterModelLoader.load(this.characterDescription.meshFileUrl, "model") || null;
|
733
|
+
}
|
734
|
+
let mmlCharacterSource;
|
735
|
+
if (this.characterDescription.mmlCharacterUrl) {
|
736
|
+
const res = await fetch(this.characterDescription.mmlCharacterUrl);
|
737
|
+
mmlCharacterSource = await res.text();
|
738
|
+
} else if (this.characterDescription.mmlCharacterString) {
|
739
|
+
mmlCharacterSource = this.characterDescription.mmlCharacterString;
|
740
|
+
} else {
|
741
|
+
throw new Error(
|
742
|
+
"ERROR: No Character Description was provided. Specify one of meshFileUrl, mmlCharacterUrl or mmlCharacterString"
|
743
|
+
);
|
744
|
+
}
|
745
|
+
const parsedMMLDescription = parseMMLDescription(mmlCharacterSource);
|
746
|
+
const mmlCharacterDescription = parsedMMLDescription[0];
|
747
|
+
if (parsedMMLDescription[1].length > 0) {
|
748
|
+
console.warn("Errors parsing MML Character Description: ", parsedMMLDescription[1]);
|
749
|
+
}
|
750
|
+
const mmlCharacterBody = await this.composeMMLCharacter(mmlCharacterDescription);
|
751
|
+
if (mmlCharacterBody) {
|
752
|
+
return mmlCharacterBody;
|
753
|
+
}
|
754
|
+
return null;
|
755
|
+
}
|
716
756
|
async loadMainMesh() {
|
717
|
-
const
|
718
|
-
const extension = mainMeshUrl.split(".").pop();
|
719
|
-
const name = mainMeshUrl.split("/").pop().replace(`.${extension}`, "");
|
720
|
-
const mainMesh = await this.characterModelLoader.load(mainMeshUrl, "model");
|
757
|
+
const mainMesh = await this.loadCharacterFromDescription();
|
721
758
|
if (typeof mainMesh !== "undefined") {
|
722
|
-
this.setMainMesh(mainMesh
|
759
|
+
this.setMainMesh(mainMesh);
|
760
|
+
} else {
|
761
|
+
throw new Error("ERROR: No Character Model was loaded");
|
723
762
|
}
|
724
763
|
}
|
725
764
|
cleanAnimationClips(skeletalMesh, animationClip) {
|
@@ -781,7 +820,7 @@ var CharacterModel = class {
|
|
781
820
|
import {
|
782
821
|
CircleGeometry,
|
783
822
|
GLSL3,
|
784
|
-
Mesh
|
823
|
+
Mesh,
|
785
824
|
RawShaderMaterial
|
786
825
|
} from "three";
|
787
826
|
var CharacterSpeakingIndicator = class {
|
@@ -845,7 +884,7 @@ var CharacterSpeakingIndicator = class {
|
|
845
884
|
transparent: true,
|
846
885
|
glslVersion: GLSL3
|
847
886
|
});
|
848
|
-
this.mesh = new
|
887
|
+
this.mesh = new Mesh(this.geometry, this.material);
|
849
888
|
this.currentAlpha = 0;
|
850
889
|
this.targetAlpha = 0;
|
851
890
|
this.scene.add(this.mesh);
|
@@ -871,10 +910,10 @@ var CharacterSpeakingIndicator = class {
|
|
871
910
|
|
872
911
|
// src/character/CharacterTooltip.ts
|
873
912
|
import {
|
874
|
-
Color as
|
913
|
+
Color as Color2,
|
875
914
|
FrontSide,
|
876
915
|
LinearFilter as LinearFilter2,
|
877
|
-
Mesh as
|
916
|
+
Mesh as Mesh2,
|
878
917
|
MeshBasicMaterial as MeshBasicMaterial2,
|
879
918
|
PlaneGeometry
|
880
919
|
} from "three";
|
@@ -991,8 +1030,8 @@ function THREECanvasTextTexture(text, options) {
|
|
991
1030
|
|
992
1031
|
// src/character/CharacterTooltip.ts
|
993
1032
|
var fontScale = 5;
|
994
|
-
var defaultLabelColor = new
|
995
|
-
var defaultFontColor = new
|
1033
|
+
var defaultLabelColor = new Color2(0);
|
1034
|
+
var defaultFontColor = new Color2(16777215);
|
996
1035
|
var defaultLabelAlignment = "center" /* center */;
|
997
1036
|
var defaultLabelFontSize = 9;
|
998
1037
|
var defaultLabelPadding = 0;
|
@@ -1000,7 +1039,7 @@ var defaultLabelWidth = 0.25;
|
|
1000
1039
|
var defaultLabelHeight = 0.125;
|
1001
1040
|
var defaultLabelCastShadows = true;
|
1002
1041
|
var tooltipGeometry = new PlaneGeometry(1, 1, 1, 1);
|
1003
|
-
var CharacterTooltip = class extends
|
1042
|
+
var CharacterTooltip = class extends Mesh2 {
|
1004
1043
|
constructor() {
|
1005
1044
|
super(tooltipGeometry);
|
1006
1045
|
this.visibleOpacity = 0.85;
|
@@ -1106,17 +1145,18 @@ var CharacterTooltip = class extends Mesh3 {
|
|
1106
1145
|
};
|
1107
1146
|
|
1108
1147
|
// src/character/Character.ts
|
1109
|
-
var Character = class extends
|
1110
|
-
constructor(characterDescription, characterModelLoader, characterId, modelLoadedCallback, cameraManager, composer) {
|
1148
|
+
var Character = class extends Group {
|
1149
|
+
constructor(characterDescription, animationConfig, characterModelLoader, characterId, modelLoadedCallback, cameraManager, composer) {
|
1111
1150
|
super();
|
1112
1151
|
this.characterDescription = characterDescription;
|
1152
|
+
this.animationConfig = animationConfig;
|
1113
1153
|
this.characterModelLoader = characterModelLoader;
|
1114
1154
|
this.characterId = characterId;
|
1115
1155
|
this.modelLoadedCallback = modelLoadedCallback;
|
1116
1156
|
this.cameraManager = cameraManager;
|
1117
1157
|
this.composer = composer;
|
1118
1158
|
this.model = null;
|
1119
|
-
this.color = new
|
1159
|
+
this.color = new Color3();
|
1120
1160
|
this.tooltip = null;
|
1121
1161
|
this.speakingIndicator = null;
|
1122
1162
|
this.tooltip = new CharacterTooltip();
|
@@ -1124,7 +1164,11 @@ var Character = class extends Group2 {
|
|
1124
1164
|
this.load();
|
1125
1165
|
}
|
1126
1166
|
async load() {
|
1127
|
-
this.model = new CharacterModel(
|
1167
|
+
this.model = new CharacterModel(
|
1168
|
+
this.characterDescription,
|
1169
|
+
this.animationConfig,
|
1170
|
+
this.characterModelLoader
|
1171
|
+
);
|
1128
1172
|
await this.model.init();
|
1129
1173
|
this.add(this.model.mesh);
|
1130
1174
|
if (this.speakingIndicator === null) {
|
@@ -1167,12 +1211,7 @@ var Character = class extends Group2 {
|
|
1167
1211
|
};
|
1168
1212
|
|
1169
1213
|
// src/character/CharacterManager.ts
|
1170
|
-
import {
|
1171
|
-
ModelLoader,
|
1172
|
-
Character as MMLCharacter,
|
1173
|
-
parseMMLDescription
|
1174
|
-
} from "@mml-io/3d-web-avatar";
|
1175
|
-
import { Euler as Euler2, Group as Group3, Object3D as Object3D6, Quaternion as Quaternion5, Vector3 as Vector38 } from "three";
|
1214
|
+
import { Euler as Euler2, Group as Group2, Quaternion as Quaternion5, Vector3 as Vector38 } from "three";
|
1176
1215
|
|
1177
1216
|
// src/character/LocalController.ts
|
1178
1217
|
import { Euler, Line3, Matrix4, Quaternion as Quaternion2, Ray, Raycaster as Raycaster2, Vector3 as Vector35 } from "three";
|
@@ -1554,7 +1593,7 @@ function decodeCharacterAndCamera(hash) {
|
|
1554
1593
|
|
1555
1594
|
// src/character/CharacterManager.ts
|
1556
1595
|
var CharacterManager = class {
|
1557
|
-
constructor(composer, characterModelLoader, collisionsManager, cameraManager, timeManager, keyInputManager, clientStates, sendUpdate,
|
1596
|
+
constructor(composer, characterModelLoader, collisionsManager, cameraManager, timeManager, keyInputManager, clientStates, sendUpdate, animationConfig, characterDescription) {
|
1558
1597
|
this.composer = composer;
|
1559
1598
|
this.characterModelLoader = characterModelLoader;
|
1560
1599
|
this.collisionsManager = collisionsManager;
|
@@ -1563,68 +1602,25 @@ var CharacterManager = class {
|
|
1563
1602
|
this.keyInputManager = keyInputManager;
|
1564
1603
|
this.clientStates = clientStates;
|
1565
1604
|
this.sendUpdate = sendUpdate;
|
1566
|
-
this.
|
1605
|
+
this.animationConfig = animationConfig;
|
1606
|
+
this.characterDescription = characterDescription;
|
1567
1607
|
this.updateLocationHash = true;
|
1568
1608
|
this.headTargetOffset = new Vector38(0, 1.3, 0);
|
1569
1609
|
this.id = 0;
|
1570
1610
|
this.remoteCharacters = /* @__PURE__ */ new Map();
|
1571
1611
|
this.remoteCharacterControllers = /* @__PURE__ */ new Map();
|
1572
1612
|
this.localCharacterSpawned = false;
|
1573
|
-
this.characterDescription = null;
|
1574
1613
|
this.localCharacter = null;
|
1575
1614
|
this.cameraOffsetTarget = 0;
|
1576
1615
|
this.cameraOffset = 0;
|
1577
1616
|
this.speakingCharacters = /* @__PURE__ */ new Map();
|
1578
|
-
this.group = new
|
1617
|
+
this.group = new Group2();
|
1579
1618
|
}
|
1580
|
-
|
1581
|
-
let parsedDescrioption = {};
|
1582
|
-
await fetch(characterDescription).then(async (response) => {
|
1583
|
-
const characterMMLDescriptionURL = await response.text();
|
1584
|
-
const parsedMMLDescriptionURL = parseMMLDescription(characterMMLDescriptionURL);
|
1585
|
-
parsedDescrioption = parsedMMLDescriptionURL[0];
|
1586
|
-
}).catch((_err) => {
|
1587
|
-
const parsedMMLDescription = parseMMLDescription(characterDescription);
|
1588
|
-
parsedDescrioption = parsedMMLDescription[0];
|
1589
|
-
});
|
1590
|
-
return parsedDescrioption;
|
1591
|
-
}
|
1592
|
-
async composeMMLCharacter(descriptionURL) {
|
1593
|
-
var _a, _b, _c;
|
1594
|
-
const mmlCharacterDescription = await this.fetchDescription(descriptionURL);
|
1595
|
-
if (((_a = mmlCharacterDescription.base) == null ? void 0 : _a.url.length) === 0) {
|
1596
|
-
throw new Error(
|
1597
|
-
"ERROR: An MML Character Description was provided but it's not a valid <m-character> string, or a valid URL"
|
1598
|
-
);
|
1599
|
-
}
|
1600
|
-
let mergedCharacter = null;
|
1601
|
-
if (mmlCharacterDescription) {
|
1602
|
-
const characterBase = ((_b = mmlCharacterDescription.base) == null ? void 0 : _b.url) || null;
|
1603
|
-
const parts = [];
|
1604
|
-
(_c = mmlCharacterDescription.parts) == null ? void 0 : _c.forEach((part) => {
|
1605
|
-
if (part.url)
|
1606
|
-
parts.push(part.url);
|
1607
|
-
});
|
1608
|
-
if (characterBase) {
|
1609
|
-
const mmlCharacter = new MMLCharacter(new ModelLoader());
|
1610
|
-
mergedCharacter = await mmlCharacter.mergeBodyParts(characterBase, parts);
|
1611
|
-
if (mergedCharacter) {
|
1612
|
-
return mergedCharacter.children[0].children[0];
|
1613
|
-
}
|
1614
|
-
}
|
1615
|
-
}
|
1616
|
-
}
|
1617
|
-
async spawnLocalCharacter(characterDescription, id, spawnPosition = new Vector38(), spawnRotation = new Euler2()) {
|
1619
|
+
spawnLocalCharacter(characterDescription, id, spawnPosition = new Vector38(), spawnRotation = new Euler2()) {
|
1618
1620
|
var _a;
|
1619
|
-
if (this.mmlCharacterDescriptionURL) {
|
1620
|
-
const mmlCharacterBody = await this.composeMMLCharacter(this.mmlCharacterDescriptionURL);
|
1621
|
-
if (mmlCharacterBody && mmlCharacterBody instanceof Object3D6) {
|
1622
|
-
characterDescription.meshModel = mmlCharacterBody;
|
1623
|
-
}
|
1624
|
-
}
|
1625
|
-
this.characterDescription = characterDescription;
|
1626
1621
|
const character = new Character(
|
1627
1622
|
characterDescription,
|
1623
|
+
this.animationConfig,
|
1628
1624
|
this.characterModelLoader,
|
1629
1625
|
id,
|
1630
1626
|
() => {
|
@@ -1663,6 +1659,7 @@ var CharacterManager = class {
|
|
1663
1659
|
var _a;
|
1664
1660
|
const character = new Character(
|
1665
1661
|
characterDescription,
|
1662
|
+
this.animationConfig,
|
1666
1663
|
this.characterModelLoader,
|
1667
1664
|
id,
|
1668
1665
|
() => {
|
@@ -1942,7 +1939,7 @@ import {
|
|
1942
1939
|
PromptManager,
|
1943
1940
|
LoadingProgressManager
|
1944
1941
|
} from "mml-web";
|
1945
|
-
import { Group as
|
1942
|
+
import { Group as Group3 } from "three";
|
1946
1943
|
var MMLCompositionScene = class {
|
1947
1944
|
constructor(targetElement, renderer, scene, camera, audioListener, collisionsManager, getUserPositionAndRotation) {
|
1948
1945
|
this.renderer = renderer;
|
@@ -1952,7 +1949,7 @@ var MMLCompositionScene = class {
|
|
1952
1949
|
this.collisionsManager = collisionsManager;
|
1953
1950
|
this.getUserPositionAndRotation = getUserPositionAndRotation;
|
1954
1951
|
this.chatProbes = /* @__PURE__ */ new Set();
|
1955
|
-
this.group = new
|
1952
|
+
this.group = new Group3();
|
1956
1953
|
this.promptManager = PromptManager.init(targetElement);
|
1957
1954
|
const { interactionListener, interactionManager } = InteractionManager.init(
|
1958
1955
|
targetElement,
|
@@ -2391,7 +2388,7 @@ var RendererStatsFolder = class {
|
|
2391
2388
|
|
2392
2389
|
// src/tweakpane/blades/ssaoFolder.ts
|
2393
2390
|
import { BlendFunction } from "postprocessing";
|
2394
|
-
import { Color as
|
2391
|
+
import { Color as Color4 } from "three";
|
2395
2392
|
var ppssaoValues = {
|
2396
2393
|
enabled: false,
|
2397
2394
|
blendFunction: BlendFunction.MULTIPLY,
|
@@ -2583,7 +2580,7 @@ var SSAOFolder = class {
|
|
2583
2580
|
}
|
2584
2581
|
case "color": {
|
2585
2582
|
const value = e.value;
|
2586
|
-
ppssaoEffect.color = new
|
2583
|
+
ppssaoEffect.color = new Color4().setRGB(value.r, value.g, value.b);
|
2587
2584
|
break;
|
2588
2585
|
}
|
2589
2586
|
default: {
|
@@ -2623,7 +2620,7 @@ var SSAOFolder = class {
|
|
2623
2620
|
break;
|
2624
2621
|
case "color":
|
2625
2622
|
const value = e.value;
|
2626
|
-
n8aopass.configuration.color = new
|
2623
|
+
n8aopass.configuration.color = new Color4().setRGB(value.r, value.g, value.b);
|
2627
2624
|
break;
|
2628
2625
|
default:
|
2629
2626
|
break;
|
@@ -2934,7 +2931,7 @@ import {
|
|
2934
2931
|
} from "postprocessing";
|
2935
2932
|
import {
|
2936
2933
|
AmbientLight,
|
2937
|
-
Color as
|
2934
|
+
Color as Color7,
|
2938
2935
|
Fog as Fog2,
|
2939
2936
|
HalfFloatType as HalfFloatType2,
|
2940
2937
|
LinearSRGBColorSpace,
|
@@ -2948,8 +2945,8 @@ import {
|
|
2948
2945
|
import { RGBELoader } from "three/examples/jsm/loaders/RGBELoader.js";
|
2949
2946
|
|
2950
2947
|
// src/sun/Sun.ts
|
2951
|
-
import { CameraHelper, Color as
|
2952
|
-
var Sun = class extends
|
2948
|
+
import { CameraHelper, Color as Color5, DirectionalLight, Group as Group4, OrthographicCamera, Vector3 as Vector39 } from "three";
|
2949
|
+
var Sun = class extends Group4 {
|
2953
2950
|
constructor() {
|
2954
2951
|
super();
|
2955
2952
|
this.debug = false;
|
@@ -3009,7 +3006,7 @@ var Sun = class extends Group5 {
|
|
3009
3006
|
this.directionalLight.intensity = intensity;
|
3010
3007
|
}
|
3011
3008
|
setColor() {
|
3012
|
-
this.directionalLight.color = new
|
3009
|
+
this.directionalLight.color = new Color5().setRGB(
|
3013
3010
|
sunValues.sunColor.r,
|
3014
3011
|
sunValues.sunColor.g,
|
3015
3012
|
sunValues.sunColor.b
|
@@ -3178,7 +3175,7 @@ var GaussGrainEffect = new ShaderMaterial2({
|
|
3178
3175
|
// src/rendering/post-effects/n8-ssao/N8SSAOPass.ts
|
3179
3176
|
import { Pass } from "postprocessing";
|
3180
3177
|
import {
|
3181
|
-
Color as
|
3178
|
+
Color as Color6,
|
3182
3179
|
DataTexture,
|
3183
3180
|
FloatType,
|
3184
3181
|
Fog,
|
@@ -3825,7 +3822,7 @@ var EffectShader = {
|
|
3825
3822
|
import {
|
3826
3823
|
BufferAttribute,
|
3827
3824
|
BufferGeometry,
|
3828
|
-
Mesh as
|
3825
|
+
Mesh as Mesh3,
|
3829
3826
|
OrthographicCamera as OrthographicCamera2,
|
3830
3827
|
Sphere
|
3831
3828
|
} from "three";
|
@@ -3841,7 +3838,7 @@ var FullScreenTriangle = class {
|
|
3841
3838
|
this.geometry.boundingSphere = new Sphere();
|
3842
3839
|
this.geometry.computeBoundingSphere = function() {
|
3843
3840
|
};
|
3844
|
-
this.mesh = new
|
3841
|
+
this.mesh = new Mesh3(this.geometry, material);
|
3845
3842
|
this.mesh.frustumCulled = false;
|
3846
3843
|
}
|
3847
3844
|
get material() {
|
@@ -4102,7 +4099,7 @@ var N8SSAOPass = class extends Pass {
|
|
4102
4099
|
intensity: 5,
|
4103
4100
|
denoiseIterations: 2,
|
4104
4101
|
renderMode: 0,
|
4105
|
-
color: new
|
4102
|
+
color: new Color6(0, 0, 0),
|
4106
4103
|
gammaCorrection: true,
|
4107
4104
|
logarithmicDepthBuffer: false,
|
4108
4105
|
screenSpaceRadius: false,
|
@@ -4165,7 +4162,7 @@ var N8SSAOPass = class extends Pass {
|
|
4165
4162
|
this.needsDepthTexture = true;
|
4166
4163
|
this.needsSwap = true;
|
4167
4164
|
this.r = new Vector26();
|
4168
|
-
this.c = new
|
4165
|
+
this.c = new Color6();
|
4169
4166
|
}
|
4170
4167
|
configureHalfResTargets() {
|
4171
4168
|
if (this.configuration.halfRes) {
|
@@ -4536,7 +4533,7 @@ var Composer = class {
|
|
4536
4533
|
bias: ppssaoValues.bias,
|
4537
4534
|
fade: ppssaoValues.fade,
|
4538
4535
|
resolutionScale: ppssaoValues.resolutionScale,
|
4539
|
-
color: new
|
4536
|
+
color: new Color7().setRGB(ppssaoValues.color.r, ppssaoValues.color.g, ppssaoValues.color.b),
|
4540
4537
|
worldDistanceThreshold: ppssaoValues.worldDistanceThreshold,
|
4541
4538
|
worldDistanceFalloff: ppssaoValues.worldDistanceFalloff,
|
4542
4539
|
worldProximityThreshold: ppssaoValues.worldProximityThreshold,
|
@@ -4552,7 +4549,7 @@ var Composer = class {
|
|
4552
4549
|
this.n8aopass.configuration.aoRadius = n8ssaoValues.aoRadius;
|
4553
4550
|
this.n8aopass.configuration.distanceFalloff = n8ssaoValues.distanceFalloff;
|
4554
4551
|
this.n8aopass.configuration.intensity = n8ssaoValues.intensity;
|
4555
|
-
this.n8aopass.configuration.color = new
|
4552
|
+
this.n8aopass.configuration.color = new Color7().setRGB(
|
4556
4553
|
n8ssaoValues.color.r,
|
4557
4554
|
n8ssaoValues.color.g,
|
4558
4555
|
n8ssaoValues.color.b
|
@@ -4728,7 +4725,7 @@ var Composer = class {
|
|
4728
4725
|
fileInput.click();
|
4729
4726
|
}
|
4730
4727
|
setFog() {
|
4731
|
-
const fogColor = new
|
4728
|
+
const fogColor = new Color7().setRGB(
|
4732
4729
|
envValues.fog.fogColor.r,
|
4733
4730
|
envValues.fog.fogColor.g,
|
4734
4731
|
envValues.fog.fogColor.b
|
@@ -4740,7 +4737,7 @@ var Composer = class {
|
|
4740
4737
|
this.scene.remove(this.ambientLight);
|
4741
4738
|
this.ambientLight.dispose();
|
4742
4739
|
}
|
4743
|
-
const ambientLightColor = new
|
4740
|
+
const ambientLightColor = new Color7().setRGB(
|
4744
4741
|
envValues.ambientLight.ambientLightColor.r,
|
4745
4742
|
envValues.ambientLight.ambientLightColor.g,
|
4746
4743
|
envValues.ambientLight.ambientLightColor.b
|
@@ -4806,13 +4803,13 @@ import {
|
|
4806
4803
|
} from "mml-web";
|
4807
4804
|
import {
|
4808
4805
|
Box3,
|
4809
|
-
Color as
|
4806
|
+
Color as Color8,
|
4810
4807
|
DoubleSide,
|
4811
4808
|
Euler as Euler3,
|
4812
|
-
Group as
|
4809
|
+
Group as Group5,
|
4813
4810
|
Line3 as Line32,
|
4814
4811
|
Matrix4 as Matrix46,
|
4815
|
-
Mesh as
|
4812
|
+
Mesh as Mesh4,
|
4816
4813
|
MeshBasicMaterial as MeshBasicMaterial3,
|
4817
4814
|
Quaternion as Quaternion6,
|
4818
4815
|
Ray as Ray2,
|
@@ -4900,11 +4897,11 @@ var CollisionsManager = class {
|
|
4900
4897
|
};
|
4901
4898
|
if (this.debug) {
|
4902
4899
|
newBufferGeometry.boundsTree = meshBVH;
|
4903
|
-
const wireframeMesh = new
|
4900
|
+
const wireframeMesh = new Mesh4(newBufferGeometry, new MeshBasicMaterial3({ wireframe: true }));
|
4904
4901
|
const normalsHelper = new VertexNormalsHelper(wireframeMesh, 0.25, 65280);
|
4905
4902
|
const visualizer = new MeshBVHHelper(wireframeMesh, 4);
|
4906
|
-
visualizer.edgeMaterial.color = new
|
4907
|
-
const debugGroup = new
|
4903
|
+
visualizer.edgeMaterial.color = new Color8("blue");
|
4904
|
+
const debugGroup = new Group5();
|
4908
4905
|
debugGroup.add(wireframeMesh, normalsHelper, visualizer);
|
4909
4906
|
group.matrixWorld.decompose(debugGroup.position, debugGroup.quaternion, debugGroup.scale);
|
4910
4907
|
visualizer.update();
|