@mml-io/3d-web-client-core 0.0.0-experimental-0d0c89d-20240206 → 0.0.0-experimental-248ff6a-20240207
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.
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type MMLCharacterDescription } from "@mml-io/3d-web-avatar";
|
1
2
|
import { AnimationAction, AnimationMixer, Bone, Object3D } from "three";
|
2
3
|
import { AnimationConfig, CharacterDescription } from "./Character";
|
3
4
|
import { CharacterMaterial } from "./CharacterMaterial";
|
@@ -13,6 +14,7 @@ export declare class CharacterModel {
|
|
13
14
|
animations: Record<string, AnimationAction>;
|
14
15
|
animationMixer: AnimationMixer | null;
|
15
16
|
currentAnimation: AnimationState;
|
17
|
+
mmlCharacterDescription: MMLCharacterDescription;
|
16
18
|
constructor(characterDescription: CharacterDescription, animationConfig: AnimationConfig, characterModelLoader: CharacterModelLoader);
|
17
19
|
init(): Promise<void>;
|
18
20
|
private applyCustomMaterial;
|
package/build/index.js
CHANGED
@@ -262,7 +262,7 @@ import { Color as Color3, Group, Vector3 as Vector34 } from "three";
|
|
262
262
|
|
263
263
|
// src/character/CharacterModel.ts
|
264
264
|
import {
|
265
|
-
|
265
|
+
MMLCharacter,
|
266
266
|
ModelLoader,
|
267
267
|
parseMMLDescription
|
268
268
|
} from "@mml-io/3d-web-avatar";
|
@@ -706,7 +706,7 @@ var CharacterModel = class {
|
|
706
706
|
this.animationMixer = new AnimationMixer(this.mesh);
|
707
707
|
}
|
708
708
|
async composeMMLCharacter(mmlCharacterDescription) {
|
709
|
-
var _a, _b
|
709
|
+
var _a, _b;
|
710
710
|
if (((_a = mmlCharacterDescription.base) == null ? void 0 : _a.url.length) === 0) {
|
711
711
|
throw new Error(
|
712
712
|
"ERROR: An MML Character Description was provided but it's not a valid <m-character> string, or a valid URL"
|
@@ -715,14 +715,13 @@ var CharacterModel = class {
|
|
715
715
|
let mergedCharacter = null;
|
716
716
|
if (mmlCharacterDescription) {
|
717
717
|
const characterBase = ((_b = mmlCharacterDescription.base) == null ? void 0 : _b.url) || null;
|
718
|
-
const parts = [];
|
719
|
-
(_c = mmlCharacterDescription.parts) == null ? void 0 : _c.forEach((part) => {
|
720
|
-
if (part.url)
|
721
|
-
parts.push(part.url);
|
722
|
-
});
|
723
718
|
if (characterBase) {
|
719
|
+
this.mmlCharacterDescription = mmlCharacterDescription;
|
724
720
|
const mmlCharacter = new MMLCharacter(new ModelLoader());
|
725
|
-
mergedCharacter = await mmlCharacter.mergeBodyParts(
|
721
|
+
mergedCharacter = await mmlCharacter.mergeBodyParts(
|
722
|
+
characterBase,
|
723
|
+
mmlCharacterDescription.parts
|
724
|
+
);
|
726
725
|
if (mergedCharacter) {
|
727
726
|
return mergedCharacter.children[0].children[0];
|
728
727
|
}
|
@@ -2360,18 +2359,15 @@ var RendererStatsFolder = class {
|
|
2360
2359
|
FPS: "0"
|
2361
2360
|
};
|
2362
2361
|
this.folder = parentFolder.addFolder({ title: "renderStats", expanded });
|
2363
|
-
this.
|
2364
|
-
this.
|
2365
|
-
this.folder.
|
2366
|
-
this.
|
2367
|
-
this.
|
2368
|
-
this.
|
2369
|
-
this.
|
2370
|
-
this.
|
2371
|
-
this.
|
2372
|
-
this.defails.addBinding(this.statsData, "shaders", { readonly: true });
|
2373
|
-
this.defails.addBinding(this.statsData, "postPasses", { readonly: true });
|
2374
|
-
this.defails.addBinding(this.statsData, "drawCalls", { readonly: true });
|
2362
|
+
this.folder.addBinding(this.statsData, "FPS", { readonly: true });
|
2363
|
+
this.folder.addBinding(this.statsData, "deltaTime", { readonly: true });
|
2364
|
+
this.folder.addBinding(this.statsData, "rawDeltaTime", { readonly: true });
|
2365
|
+
this.folder.addBinding(this.statsData, "triangles", { readonly: true });
|
2366
|
+
this.folder.addBinding(this.statsData, "geometries", { readonly: true });
|
2367
|
+
this.folder.addBinding(this.statsData, "textures", { readonly: true });
|
2368
|
+
this.folder.addBinding(this.statsData, "shaders", { readonly: true });
|
2369
|
+
this.folder.addBinding(this.statsData, "postPasses", { readonly: true });
|
2370
|
+
this.folder.addBinding(this.statsData, "drawCalls", { readonly: true });
|
2375
2371
|
}
|
2376
2372
|
update(renderer, composer, timeManager) {
|
2377
2373
|
const { geometries, textures } = renderer.info.memory;
|
@@ -2718,7 +2714,7 @@ var ToneMappingFolder = class {
|
|
2718
2714
|
// src/tweakpane/tweakPaneStyle.ts
|
2719
2715
|
var tweakPaneStyle = `
|
2720
2716
|
:root {
|
2721
|
-
--tp-base-background-color: rgba(
|
2717
|
+
--tp-base-background-color: rgba(12, 12, 12, 0.6);
|
2722
2718
|
--tp-base-shadow-color: hsla(0, 0%, 0%, 0.2);
|
2723
2719
|
--tp-button-background-color: hsla(0, 0%, 80%, 1);
|
2724
2720
|
--tp-button-background-color-active: hsla(0, 0%, 100%, 1);
|
@@ -2739,6 +2735,9 @@ var tweakPaneStyle = `
|
|
2739
2735
|
--tp-label-foreground-color: hsla(0, 0%, 100%, 0.6);
|
2740
2736
|
--tp-monitor-background-color: hsla(0, 0%, 0%, 0.3);
|
2741
2737
|
--tp-monitor-foreground-color: hsla(0, 0%, 100%, 0.3);
|
2738
|
+
-webkit-user-select: none;
|
2739
|
+
-ms-user-select: none;
|
2740
|
+
user-select: none;
|
2742
2741
|
}
|
2743
2742
|
|
2744
2743
|
.tp-brkv {
|
@@ -2748,28 +2747,40 @@ var tweakPaneStyle = `
|
|
2748
2747
|
}
|
2749
2748
|
|
2750
2749
|
.tp-dfwv {
|
2750
|
+
z-index: 100;
|
2751
2751
|
color: white;
|
2752
|
-
|
2753
|
-
width: 360px !important;
|
2752
|
+
width: 600px !important;
|
2754
2753
|
display: none;
|
2755
2754
|
-webkit-user-select: none;
|
2756
2755
|
-ms-user-select: none;
|
2757
2756
|
user-select: none;
|
2758
2757
|
}
|
2759
2758
|
|
2759
|
+
.tp-fldv {
|
2760
|
+
margin: 1px 0px 0px 0px !important;
|
2761
|
+
}
|
2762
|
+
|
2763
|
+
.tp-fldv_b {
|
2764
|
+
overflow: visible !important;
|
2765
|
+
}
|
2766
|
+
|
2760
2767
|
.tp-fldv_t {
|
2761
|
-
font-size:
|
2762
|
-
|
2768
|
+
font-size: 13px;
|
2769
|
+
font-weight: 900;
|
2770
|
+
color: #ffffff;
|
2771
|
+
background-color: rgba(70, 70, 70, 0.3);
|
2772
|
+
border-top: 1px solid rgba(210, 210, 210, 0.1);
|
2773
|
+
border-radius: 3px;
|
2763
2774
|
}
|
2764
2775
|
|
2765
2776
|
.tp-lblv_l {
|
2766
|
-
font-size:
|
2777
|
+
font-size: 12px;
|
2767
2778
|
padding-left: 0px !important;
|
2768
2779
|
padding-right: 0px !important;
|
2769
2780
|
}
|
2770
2781
|
|
2771
2782
|
.tp-lblv_v {
|
2772
|
-
width:
|
2783
|
+
width: 150px;
|
2773
2784
|
}
|
2774
2785
|
|
2775
2786
|
.tp-sldtxtv_t {
|
@@ -2777,9 +2788,13 @@ var tweakPaneStyle = `
|
|
2777
2788
|
}
|
2778
2789
|
|
2779
2790
|
.tp-sglv_i {
|
2780
|
-
font-size:
|
2791
|
+
font-size: 12px;
|
2781
2792
|
color: rgba(255, 255, 255, 0.7);
|
2782
2793
|
}
|
2794
|
+
|
2795
|
+
.tp-ckbv_w {
|
2796
|
+
border: 1px solid rgba(200, 200, 250, 0.2);
|
2797
|
+
}
|
2783
2798
|
`;
|
2784
2799
|
|
2785
2800
|
// src/tweakpane/TweakPane.ts
|
@@ -2788,9 +2803,13 @@ var TweakPane = class {
|
|
2788
2803
|
this.renderer = renderer;
|
2789
2804
|
this.scene = scene;
|
2790
2805
|
this.composer = composer;
|
2791
|
-
this.gui = new Pane();
|
2792
2806
|
this.saveVisibilityInLocalStorage = true;
|
2793
2807
|
this.guiVisible = false;
|
2808
|
+
const appWrapper = document.getElementById("app");
|
2809
|
+
const tweakPaneWrapper = document.createElement("div");
|
2810
|
+
tweakPaneWrapper.id = "tweakpane-panel";
|
2811
|
+
appWrapper.appendChild(tweakPaneWrapper);
|
2812
|
+
this.gui = new Pane({ container: tweakPaneWrapper });
|
2794
2813
|
this.gui.registerPlugin(EssentialsPlugin);
|
2795
2814
|
if (this.saveVisibilityInLocalStorage) {
|
2796
2815
|
const localStorageGuiVisible = localStorage.getItem("guiVisible");
|
@@ -2817,21 +2836,22 @@ var TweakPane = class {
|
|
2817
2836
|
this.toneMappingFolder.folder.hidden = rendererValues.toneMapping === 5 ? false : true;
|
2818
2837
|
this.export = this.gui.addFolder({ title: "import / export", expanded: false });
|
2819
2838
|
window.addEventListener("keydown", this.processKey.bind(this));
|
2820
|
-
this.setupGUIListeners.bind(this)();
|
2821
2839
|
this.setupRenderPane = this.setupRenderPane.bind(this);
|
2822
|
-
|
2823
|
-
processKey(e) {
|
2824
|
-
if (e.key === "p")
|
2825
|
-
this.toggleGUI();
|
2840
|
+
this.setupGUIListeners.bind(this)();
|
2826
2841
|
}
|
2827
2842
|
setupGUIListeners() {
|
2828
2843
|
const gui = this.gui;
|
2829
2844
|
const paneElement = gui.containerElem_;
|
2830
|
-
paneElement.style.
|
2845
|
+
paneElement.style.right = this.guiVisible ? "0px" : "-450px";
|
2846
|
+
this.gui.element.addEventListener("mouseenter", () => setTweakpaneActive(true));
|
2831
2847
|
this.gui.element.addEventListener("mousedown", () => setTweakpaneActive(true));
|
2832
2848
|
this.gui.element.addEventListener("mouseup", () => setTweakpaneActive(false));
|
2833
2849
|
this.gui.element.addEventListener("mouseleave", () => setTweakpaneActive(false));
|
2834
2850
|
}
|
2851
|
+
processKey(e) {
|
2852
|
+
if (e.key === "p")
|
2853
|
+
this.toggleGUI();
|
2854
|
+
}
|
2835
2855
|
setupRenderPane(composer, normalPass, ppssaoEffect, ppssaoPass, n8aopass, toneMappingEffect, toneMappingPass, brightnessContrastSaturation, bloomEffect, gaussGrainEffect, hasLighting, sun, setHDR, setAmbientLight, setFog) {
|
2836
2856
|
this.rendererFolder.setupChangeEvent(
|
2837
2857
|
this.scene,
|
@@ -2903,10 +2923,10 @@ var TweakPane = class {
|
|
2903
2923
|
input.click();
|
2904
2924
|
}
|
2905
2925
|
toggleGUI() {
|
2926
|
+
this.guiVisible = !this.guiVisible;
|
2906
2927
|
const gui = this.gui;
|
2907
2928
|
const paneElement = gui.containerElem_;
|
2908
|
-
paneElement.style.
|
2909
|
-
this.guiVisible = !this.guiVisible;
|
2929
|
+
paneElement.style.right = this.guiVisible ? "0px" : "-450px";
|
2910
2930
|
if (this.saveVisibilityInLocalStorage) {
|
2911
2931
|
localStorage.setItem("guiVisible", this.guiVisible === true ? "true" : "false");
|
2912
2932
|
}
|