@mml-io/3d-web-client-core 0.0.0-experimental-ec5821b-20240201 → 0.0.0-experimental-a3e15a8-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.
@@ -11,7 +11,7 @@ export declare class CameraManager {
11
11
  private minFOV;
12
12
  private maxFOV;
13
13
  private targetFOV;
14
- private minPolarAngle;
14
+ minPolarAngle: number;
15
15
  private maxPolarAngle;
16
16
  private dampingFactor;
17
17
  targetDistance: number;
package/build/index.js CHANGED
@@ -100,8 +100,8 @@ var CameraManager = class {
100
100
  this.maxDistance = 8;
101
101
  this.initialFOV = 60;
102
102
  this.fov = this.initialFOV;
103
- this.minFOV = 50;
104
- this.maxFOV = 70;
103
+ this.minFOV = 85;
104
+ this.maxFOV = 60;
105
105
  this.targetFOV = this.initialFOV;
106
106
  this.minPolarAngle = Math.PI * 0.25;
107
107
  this.maxPolarAngle = Math.PI * 0.95;
@@ -199,10 +199,12 @@ var CameraManager = class {
199
199
  this.fov = this.targetFOV;
200
200
  }
201
201
  adjustCameraPosition() {
202
- this.rayCaster.set(
203
- this.camera.position,
204
- this.target.clone().sub(this.camera.position).normalize()
205
- );
202
+ const offsetDistance = 0.5;
203
+ const offset = new Vector32(0, 0, offsetDistance);
204
+ offset.applyEuler(this.camera.rotation);
205
+ const rayOrigin = this.camera.position.clone().add(offset);
206
+ const rayDirection = this.target.clone().sub(rayOrigin).normalize();
207
+ this.rayCaster.set(rayOrigin, rayDirection);
206
208
  const firstRaycastHit = this.collisionsManager.raycastFirst(this.rayCaster.ray);
207
209
  const cameraToPlayerDistance = this.camera.position.distanceTo(this.target);
208
210
  if (firstRaycastHit !== null && firstRaycastHit[0] <= cameraToPlayerDistance) {
@@ -2358,18 +2360,15 @@ var RendererStatsFolder = class {
2358
2360
  FPS: "0"
2359
2361
  };
2360
2362
  this.folder = parentFolder.addFolder({ title: "renderStats", expanded });
2361
- this.performance = this.folder.addFolder({ title: "performance", expanded: true });
2362
- this.defails = this.folder.addFolder({ title: "pipeline details", expanded: false });
2363
- this.folder.addBlade({ view: "separator" });
2364
- this.performance.addBinding(this.statsData, "FPS", { readonly: true });
2365
- this.performance.addBinding(this.statsData, "deltaTime", { readonly: true });
2366
- this.performance.addBinding(this.statsData, "rawDeltaTime", { readonly: true });
2367
- this.defails.addBinding(this.statsData, "triangles", { readonly: true });
2368
- this.defails.addBinding(this.statsData, "geometries", { readonly: true });
2369
- this.defails.addBinding(this.statsData, "textures", { readonly: true });
2370
- this.defails.addBinding(this.statsData, "shaders", { readonly: true });
2371
- this.defails.addBinding(this.statsData, "postPasses", { readonly: true });
2372
- this.defails.addBinding(this.statsData, "drawCalls", { readonly: true });
2363
+ this.folder.addBinding(this.statsData, "FPS", { readonly: true });
2364
+ this.folder.addBinding(this.statsData, "deltaTime", { readonly: true });
2365
+ this.folder.addBinding(this.statsData, "rawDeltaTime", { readonly: true });
2366
+ this.folder.addBinding(this.statsData, "triangles", { readonly: true });
2367
+ this.folder.addBinding(this.statsData, "geometries", { readonly: true });
2368
+ this.folder.addBinding(this.statsData, "textures", { readonly: true });
2369
+ this.folder.addBinding(this.statsData, "shaders", { readonly: true });
2370
+ this.folder.addBinding(this.statsData, "postPasses", { readonly: true });
2371
+ this.folder.addBinding(this.statsData, "drawCalls", { readonly: true });
2373
2372
  }
2374
2373
  update(renderer, composer, timeManager) {
2375
2374
  const { geometries, textures } = renderer.info.memory;
@@ -2716,7 +2715,7 @@ var ToneMappingFolder = class {
2716
2715
  // src/tweakpane/tweakPaneStyle.ts
2717
2716
  var tweakPaneStyle = `
2718
2717
  :root {
2719
- --tp-base-background-color: rgba(0, 0, 0, 0.6);
2718
+ --tp-base-background-color: rgba(12, 12, 12, 0.6);
2720
2719
  --tp-base-shadow-color: hsla(0, 0%, 0%, 0.2);
2721
2720
  --tp-button-background-color: hsla(0, 0%, 80%, 1);
2722
2721
  --tp-button-background-color-active: hsla(0, 0%, 100%, 1);
@@ -2737,6 +2736,9 @@ var tweakPaneStyle = `
2737
2736
  --tp-label-foreground-color: hsla(0, 0%, 100%, 0.6);
2738
2737
  --tp-monitor-background-color: hsla(0, 0%, 0%, 0.3);
2739
2738
  --tp-monitor-foreground-color: hsla(0, 0%, 100%, 0.3);
2739
+ -webkit-user-select: none;
2740
+ -ms-user-select: none;
2741
+ user-select: none;
2740
2742
  }
2741
2743
 
2742
2744
  .tp-brkv {
@@ -2746,28 +2748,40 @@ var tweakPaneStyle = `
2746
2748
  }
2747
2749
 
2748
2750
  .tp-dfwv {
2751
+ z-index: 100;
2749
2752
  color: white;
2750
- backdrop-filter: blur(12px);
2751
- width: 360px !important;
2753
+ width: 600px !important;
2752
2754
  display: none;
2753
2755
  -webkit-user-select: none;
2754
2756
  -ms-user-select: none;
2755
2757
  user-select: none;
2756
2758
  }
2757
2759
 
2760
+ .tp-fldv {
2761
+ margin: 1px 0px 0px 0px !important;
2762
+ }
2763
+
2764
+ .tp-fldv_b {
2765
+ overflow: visible !important;
2766
+ }
2767
+
2758
2768
  .tp-fldv_t {
2759
- font-size: 11px;
2760
- background-color: rgba(0, 0, 0, 0.1);
2769
+ font-size: 13px;
2770
+ font-weight: 900;
2771
+ color: #ffffff;
2772
+ background-color: rgba(70, 70, 70, 0.3);
2773
+ border-top: 1px solid rgba(210, 210, 210, 0.1);
2774
+ border-radius: 3px;
2761
2775
  }
2762
2776
 
2763
2777
  .tp-lblv_l {
2764
- font-size: 11px;
2778
+ font-size: 12px;
2765
2779
  padding-left: 0px !important;
2766
2780
  padding-right: 0px !important;
2767
2781
  }
2768
2782
 
2769
2783
  .tp-lblv_v {
2770
- width: 180px;
2784
+ width: 150px;
2771
2785
  }
2772
2786
 
2773
2787
  .tp-sldtxtv_t {
@@ -2775,9 +2789,13 @@ var tweakPaneStyle = `
2775
2789
  }
2776
2790
 
2777
2791
  .tp-sglv_i {
2778
- font-size: 11px;
2792
+ font-size: 12px;
2779
2793
  color: rgba(255, 255, 255, 0.7);
2780
2794
  }
2795
+
2796
+ .tp-ckbv_w {
2797
+ border: 1px solid rgba(200, 200, 250, 0.2);
2798
+ }
2781
2799
  `;
2782
2800
 
2783
2801
  // src/tweakpane/TweakPane.ts
@@ -2786,9 +2804,13 @@ var TweakPane = class {
2786
2804
  this.renderer = renderer;
2787
2805
  this.scene = scene;
2788
2806
  this.composer = composer;
2789
- this.gui = new Pane();
2790
2807
  this.saveVisibilityInLocalStorage = true;
2791
2808
  this.guiVisible = false;
2809
+ const appWrapper = document.getElementById("app");
2810
+ const tweakPaneWrapper = document.createElement("div");
2811
+ tweakPaneWrapper.id = "tweakpane-panel";
2812
+ appWrapper.appendChild(tweakPaneWrapper);
2813
+ this.gui = new Pane({ container: tweakPaneWrapper });
2792
2814
  this.gui.registerPlugin(EssentialsPlugin);
2793
2815
  if (this.saveVisibilityInLocalStorage) {
2794
2816
  const localStorageGuiVisible = localStorage.getItem("guiVisible");
@@ -2815,21 +2837,22 @@ var TweakPane = class {
2815
2837
  this.toneMappingFolder.folder.hidden = rendererValues.toneMapping === 5 ? false : true;
2816
2838
  this.export = this.gui.addFolder({ title: "import / export", expanded: false });
2817
2839
  window.addEventListener("keydown", this.processKey.bind(this));
2818
- this.setupGUIListeners.bind(this)();
2819
2840
  this.setupRenderPane = this.setupRenderPane.bind(this);
2820
- }
2821
- processKey(e) {
2822
- if (e.key === "p")
2823
- this.toggleGUI();
2841
+ this.setupGUIListeners.bind(this)();
2824
2842
  }
2825
2843
  setupGUIListeners() {
2826
2844
  const gui = this.gui;
2827
2845
  const paneElement = gui.containerElem_;
2828
- paneElement.style.display = this.guiVisible ? "unset" : "none";
2846
+ paneElement.style.right = this.guiVisible ? "0px" : "-450px";
2847
+ this.gui.element.addEventListener("mouseenter", () => setTweakpaneActive(true));
2829
2848
  this.gui.element.addEventListener("mousedown", () => setTweakpaneActive(true));
2830
2849
  this.gui.element.addEventListener("mouseup", () => setTweakpaneActive(false));
2831
2850
  this.gui.element.addEventListener("mouseleave", () => setTweakpaneActive(false));
2832
2851
  }
2852
+ processKey(e) {
2853
+ if (e.key === "p")
2854
+ this.toggleGUI();
2855
+ }
2833
2856
  setupRenderPane(composer, normalPass, ppssaoEffect, ppssaoPass, n8aopass, toneMappingEffect, toneMappingPass, brightnessContrastSaturation, bloomEffect, gaussGrainEffect, hasLighting, sun, setHDR, setAmbientLight, setFog) {
2834
2857
  this.rendererFolder.setupChangeEvent(
2835
2858
  this.scene,
@@ -2901,10 +2924,10 @@ var TweakPane = class {
2901
2924
  input.click();
2902
2925
  }
2903
2926
  toggleGUI() {
2927
+ this.guiVisible = !this.guiVisible;
2904
2928
  const gui = this.gui;
2905
2929
  const paneElement = gui.containerElem_;
2906
- paneElement.style.display = this.guiVisible ? "none" : "unset";
2907
- this.guiVisible = !this.guiVisible;
2930
+ paneElement.style.right = this.guiVisible ? "0px" : "-450px";
2908
2931
  if (this.saveVisibilityInLocalStorage) {
2909
2932
  localStorage.setItem("guiVisible", this.guiVisible === true ? "true" : "false");
2910
2933
  }