@mml-io/3d-web-client-core 0.0.0-experimental-8634a66-20240605 → 0.0.0-experimental-eeaedb1-20240609
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/index.js
CHANGED
@@ -2316,11 +2316,14 @@ var CharacterManager = class {
|
|
2316
2316
|
this.remoteCharacterControllers.delete(id);
|
2317
2317
|
}
|
2318
2318
|
}
|
2319
|
-
if (this.config.
|
2320
|
-
|
2319
|
+
if (this.config.updateURLLocation && this.config.timeManager.frame % 60 === 0 && document.hasFocus()) {
|
2320
|
+
const hash = encodeCharacterAndCamera(
|
2321
2321
|
this.localCharacter,
|
2322
2322
|
this.config.cameraManager.camera
|
2323
2323
|
);
|
2324
|
+
const url = new URL(window.location.href);
|
2325
|
+
url.hash = hash;
|
2326
|
+
window.history.replaceState({}, "", url);
|
2324
2327
|
}
|
2325
2328
|
}
|
2326
2329
|
}
|
@@ -2615,11 +2618,11 @@ var sunOptions = {
|
|
2615
2618
|
sunIntensity: { min: 0, max: 10, step: 0.1 }
|
2616
2619
|
};
|
2617
2620
|
var envValues = {
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2621
|
+
skyboxAzimuthalAngle: 0,
|
2622
|
+
skyboxPolarAngle: 0,
|
2623
|
+
envMapIntensity: 0.07,
|
2624
|
+
skyboxIntensity: 0.8,
|
2625
|
+
skyboxBlurriness: 0,
|
2623
2626
|
ambientLight: {
|
2624
2627
|
ambientLightIntensity: 0.27,
|
2625
2628
|
ambientLightColor: { r: 1, g: 1, b: 1 }
|
@@ -2631,10 +2634,10 @@ var envValues = {
|
|
2631
2634
|
}
|
2632
2635
|
};
|
2633
2636
|
var envOptions = {
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2637
|
-
|
2637
|
+
skyboxAzimuthalAngle: { min: 0, max: 360, step: 1 },
|
2638
|
+
skyboxPolarAngle: { min: 0, max: 360, step: 1 },
|
2639
|
+
skyboxIntensity: { min: 0, max: 1.3, step: 0.01 },
|
2640
|
+
skyboxBlurriness: { min: 0, max: 0.1, step: 1e-3 },
|
2638
2641
|
ambientLight: {
|
2639
2642
|
ambientLightIntensity: { min: 0, max: 1, step: 0.01 }
|
2640
2643
|
},
|
@@ -2647,6 +2650,9 @@ var EnvironmentFolder = class {
|
|
2647
2650
|
constructor(parentFolder, expand = false) {
|
2648
2651
|
this.folder = parentFolder.addFolder({ title: "environment", expanded: expand });
|
2649
2652
|
this.sun = this.folder.addFolder({ title: "sun", expanded: true });
|
2653
|
+
this.envMap = this.folder.addFolder({ title: "envMap", expanded: true });
|
2654
|
+
this.fog = this.folder.addFolder({ title: "fog", expanded: true });
|
2655
|
+
this.skybox = this.folder.addFolder({ title: "skybox", expanded: true });
|
2650
2656
|
this.ambient = this.folder.addFolder({ title: "ambient", expanded: true });
|
2651
2657
|
this.sun.addBinding(
|
2652
2658
|
sunValues.sunPosition,
|
@@ -2662,11 +2668,12 @@ var EnvironmentFolder = class {
|
|
2662
2668
|
this.sun.addBinding(sunValues, "sunColor", {
|
2663
2669
|
color: { type: "float" }
|
2664
2670
|
});
|
2665
|
-
this.hdrButton = this.
|
2666
|
-
this.
|
2667
|
-
this.
|
2668
|
-
this.
|
2669
|
-
this.
|
2671
|
+
this.hdrButton = this.skybox.addButton({ title: "Set HDRI" });
|
2672
|
+
this.skybox.addBinding(envValues, "skyboxIntensity", envOptions.skyboxIntensity);
|
2673
|
+
this.skybox.addBinding(envValues, "skyboxBlurriness", envOptions.skyboxBlurriness);
|
2674
|
+
this.skybox.addBinding(envValues, "skyboxAzimuthalAngle", envOptions.skyboxAzimuthalAngle);
|
2675
|
+
this.skybox.addBinding(envValues, "skyboxPolarAngle", envOptions.skyboxPolarAngle);
|
2676
|
+
this.envMap.addBinding(envValues, "envMapIntensity", envOptions.skyboxIntensity);
|
2670
2677
|
this.ambient.addBinding(
|
2671
2678
|
envValues.ambientLight,
|
2672
2679
|
"ambientLightIntensity",
|
@@ -2675,13 +2682,13 @@ var EnvironmentFolder = class {
|
|
2675
2682
|
this.ambient.addBinding(envValues.ambientLight, "ambientLightColor", {
|
2676
2683
|
color: { type: "float" }
|
2677
2684
|
});
|
2678
|
-
this.
|
2679
|
-
this.
|
2680
|
-
this.
|
2685
|
+
this.fog.addBinding(envValues.fog, "fogNear", envOptions.fog.fogNear);
|
2686
|
+
this.fog.addBinding(envValues.fog, "fogFar", envOptions.fog.fogFar);
|
2687
|
+
this.fog.addBinding(envValues.fog, "fogColor", {
|
2681
2688
|
color: { type: "float" }
|
2682
2689
|
});
|
2683
2690
|
}
|
2684
|
-
setupChangeEvent(scene, setHDR,
|
2691
|
+
setupChangeEvent(scene, setHDR, setSkyboxAzimuthalAngle, setSkyboxPolarAngle, setAmbientLight, setFog, sun) {
|
2685
2692
|
this.sun.on("change", (e) => {
|
2686
2693
|
const target = e.target.key;
|
2687
2694
|
if (!target)
|
@@ -2719,27 +2726,45 @@ var EnvironmentFolder = class {
|
|
2719
2726
|
this.hdrButton.on("click", () => {
|
2720
2727
|
setHDR();
|
2721
2728
|
});
|
2722
|
-
this.
|
2729
|
+
this.envMap.on("change", (e) => {
|
2730
|
+
const target = e.target.key;
|
2731
|
+
if (!target)
|
2732
|
+
return;
|
2733
|
+
switch (target) {
|
2734
|
+
case "envMapIntensity":
|
2735
|
+
scene.environmentIntensity = e.value;
|
2736
|
+
break;
|
2737
|
+
}
|
2738
|
+
});
|
2739
|
+
this.skybox.on("change", (e) => {
|
2723
2740
|
const target = e.target.key;
|
2724
2741
|
if (!target)
|
2725
2742
|
return;
|
2726
2743
|
switch (target) {
|
2727
|
-
case "
|
2744
|
+
case "skyboxAzimuthalAngle": {
|
2728
2745
|
const value = e.value;
|
2729
|
-
|
2746
|
+
setSkyboxAzimuthalAngle(value);
|
2730
2747
|
break;
|
2731
2748
|
}
|
2732
|
-
case "
|
2749
|
+
case "skyboxPolarAngle": {
|
2733
2750
|
const value = e.value;
|
2734
|
-
|
2751
|
+
envValues.skyboxPolarAngle = value;
|
2752
|
+
setSkyboxPolarAngle(value);
|
2735
2753
|
break;
|
2736
2754
|
}
|
2737
|
-
case "
|
2755
|
+
case "skyboxIntensity":
|
2738
2756
|
scene.backgroundIntensity = e.value;
|
2739
2757
|
break;
|
2740
|
-
case "
|
2758
|
+
case "skyboxBlurriness":
|
2741
2759
|
scene.backgroundBlurriness = e.value;
|
2742
2760
|
break;
|
2761
|
+
}
|
2762
|
+
});
|
2763
|
+
this.ambient.on("change", (e) => {
|
2764
|
+
const target = e.target.key;
|
2765
|
+
if (!target)
|
2766
|
+
return;
|
2767
|
+
switch (target) {
|
2743
2768
|
case "ambientLightIntensity": {
|
2744
2769
|
envValues.ambientLight.ambientLightIntensity = e.value;
|
2745
2770
|
setAmbientLight();
|
@@ -2755,6 +2780,13 @@ var EnvironmentFolder = class {
|
|
2755
2780
|
setAmbientLight();
|
2756
2781
|
break;
|
2757
2782
|
}
|
2783
|
+
}
|
2784
|
+
});
|
2785
|
+
this.fog.on("change", (e) => {
|
2786
|
+
const target = e.target.key;
|
2787
|
+
if (!target)
|
2788
|
+
return;
|
2789
|
+
switch (target) {
|
2758
2790
|
case "fogNear": {
|
2759
2791
|
envValues.fog.fogNear = e.value;
|
2760
2792
|
setFog();
|
@@ -2775,8 +2807,6 @@ var EnvironmentFolder = class {
|
|
2775
2807
|
setFog();
|
2776
2808
|
break;
|
2777
2809
|
}
|
2778
|
-
default:
|
2779
|
-
break;
|
2780
2810
|
}
|
2781
2811
|
});
|
2782
2812
|
}
|
@@ -3405,9 +3435,10 @@ var TweakPane = class {
|
|
3405
3435
|
this.characterControls = new CharacterControlsFolder(this.gui, false);
|
3406
3436
|
this.toneMappingFolder.folder.hidden = rendererValues.toneMapping === 5 ? false : true;
|
3407
3437
|
this.export = this.gui.addFolder({ title: "import / export", expanded: false });
|
3408
|
-
window.addEventListener("keydown",
|
3409
|
-
|
3410
|
-
|
3438
|
+
window.addEventListener("keydown", (e) => {
|
3439
|
+
this.processKey(e);
|
3440
|
+
});
|
3441
|
+
this.setupGUIListeners();
|
3411
3442
|
}
|
3412
3443
|
setupGUIListeners() {
|
3413
3444
|
const gui = this.gui;
|
@@ -3422,7 +3453,7 @@ var TweakPane = class {
|
|
3422
3453
|
if (e.key === "p")
|
3423
3454
|
this.toggleGUI();
|
3424
3455
|
}
|
3425
|
-
setupRenderPane(composer, normalPass, ppssaoEffect, ppssaoPass, n8aopass, toneMappingEffect, toneMappingPass, brightnessContrastSaturation, bloomEffect, gaussGrainEffect, hasLighting, sun, setHDR,
|
3456
|
+
setupRenderPane(composer, normalPass, ppssaoEffect, ppssaoPass, n8aopass, toneMappingEffect, toneMappingPass, brightnessContrastSaturation, bloomEffect, gaussGrainEffect, hasLighting, sun, setHDR, setSkyboxAzimuthalAngle, setSkyboxPolarAngle, setAmbientLight, setFog) {
|
3426
3457
|
this.rendererFolder.setupChangeEvent(
|
3427
3458
|
this.renderer,
|
3428
3459
|
this.toneMappingFolder.folder,
|
@@ -3435,8 +3466,8 @@ var TweakPane = class {
|
|
3435
3466
|
this.environment.setupChangeEvent(
|
3436
3467
|
this.scene,
|
3437
3468
|
setHDR,
|
3438
|
-
|
3439
|
-
|
3469
|
+
setSkyboxAzimuthalAngle,
|
3470
|
+
setSkyboxPolarAngle,
|
3440
3471
|
setAmbientLight,
|
3441
3472
|
setFog,
|
3442
3473
|
sun
|
@@ -5129,7 +5160,7 @@ var Composer = class {
|
|
5129
5160
|
this.renderer.toneMapping = rendererValues.toneMapping;
|
5130
5161
|
this.renderer.toneMappingExposure = rendererValues.exposure;
|
5131
5162
|
this.environmentConfiguration = environmentConfiguration;
|
5132
|
-
this.
|
5163
|
+
this.updateSkyboxAndEnvValues();
|
5133
5164
|
this.updateAmbientLightValues();
|
5134
5165
|
this.setFog();
|
5135
5166
|
this.effectComposer = new EffectComposer2(this.renderer, {
|
@@ -5247,8 +5278,14 @@ var Composer = class {
|
|
5247
5278
|
this.spawnSun,
|
5248
5279
|
this.sun,
|
5249
5280
|
this.setHDRIFromFile.bind(this),
|
5250
|
-
|
5251
|
-
|
5281
|
+
(azimuthalAngle) => {
|
5282
|
+
envValues.skyboxAzimuthalAngle = azimuthalAngle;
|
5283
|
+
this.updateSkyboxRotation();
|
5284
|
+
},
|
5285
|
+
(polarAngle) => {
|
5286
|
+
envValues.skyboxPolarAngle = polarAngle;
|
5287
|
+
this.updateSkyboxRotation();
|
5288
|
+
},
|
5252
5289
|
this.setAmbientLight.bind(this),
|
5253
5290
|
this.setFog.bind(this)
|
5254
5291
|
);
|
@@ -5303,17 +5340,15 @@ var Composer = class {
|
|
5303
5340
|
this.renderer.clearDepth();
|
5304
5341
|
this.renderer.render(this.postPostScene, this.camera);
|
5305
5342
|
}
|
5306
|
-
|
5343
|
+
updateSkyboxRotation() {
|
5307
5344
|
this.scene.backgroundRotation = new Euler3(
|
5308
|
-
MathUtils.degToRad(envValues.
|
5309
|
-
MathUtils.degToRad(
|
5345
|
+
MathUtils.degToRad(envValues.skyboxPolarAngle),
|
5346
|
+
MathUtils.degToRad(envValues.skyboxAzimuthalAngle),
|
5310
5347
|
0
|
5311
5348
|
);
|
5312
|
-
|
5313
|
-
|
5314
|
-
|
5315
|
-
MathUtils.degToRad(polarAngle),
|
5316
|
-
MathUtils.degToRad(envValues.hdrAzimuthalAngle),
|
5349
|
+
this.scene.environmentRotation = new Euler3(
|
5350
|
+
MathUtils.degToRad(envValues.skyboxPolarAngle),
|
5351
|
+
MathUtils.degToRad(envValues.skyboxAzimuthalAngle),
|
5317
5352
|
0
|
5318
5353
|
);
|
5319
5354
|
}
|
@@ -5328,18 +5363,18 @@ var Composer = class {
|
|
5328
5363
|
envMap.colorSpace = LinearSRGBColorSpace;
|
5329
5364
|
envMap.needsUpdate = true;
|
5330
5365
|
this.scene.environment = envMap;
|
5331
|
-
this.scene.environmentIntensity = envValues.
|
5366
|
+
this.scene.environmentIntensity = envValues.envMapIntensity;
|
5332
5367
|
this.scene.environmentRotation = new Euler3(
|
5333
|
-
MathUtils.degToRad(envValues.
|
5334
|
-
MathUtils.degToRad(envValues.
|
5368
|
+
MathUtils.degToRad(envValues.skyboxPolarAngle),
|
5369
|
+
MathUtils.degToRad(envValues.skyboxAzimuthalAngle),
|
5335
5370
|
0
|
5336
5371
|
);
|
5337
5372
|
this.scene.background = envMap;
|
5338
|
-
this.scene.backgroundIntensity = envValues.
|
5339
|
-
this.scene.backgroundBlurriness = envValues.
|
5373
|
+
this.scene.backgroundIntensity = envValues.skyboxIntensity;
|
5374
|
+
this.scene.backgroundBlurriness = envValues.skyboxBlurriness;
|
5340
5375
|
this.scene.backgroundRotation = new Euler3(
|
5341
|
-
MathUtils.degToRad(envValues.
|
5342
|
-
MathUtils.degToRad(envValues.
|
5376
|
+
MathUtils.degToRad(envValues.skyboxPolarAngle),
|
5377
|
+
MathUtils.degToRad(envValues.skyboxAzimuthalAngle),
|
5343
5378
|
0
|
5344
5379
|
);
|
5345
5380
|
this.isEnvHDRI = true;
|
@@ -5350,8 +5385,9 @@ var Composer = class {
|
|
5350
5385
|
});
|
5351
5386
|
}
|
5352
5387
|
useHDRI(url, fromFile = false) {
|
5353
|
-
if (this.isEnvHDRI && fromFile === false || !this.renderer)
|
5388
|
+
if (this.isEnvHDRI && fromFile === false || !this.renderer) {
|
5354
5389
|
return;
|
5390
|
+
}
|
5355
5391
|
const pmremGenerator = new PMREMGenerator(this.renderer);
|
5356
5392
|
new RGBELoader(new LoadingManager()).load(
|
5357
5393
|
url,
|
@@ -5361,15 +5397,15 @@ var Composer = class {
|
|
5361
5397
|
envMap.colorSpace = LinearSRGBColorSpace;
|
5362
5398
|
envMap.needsUpdate = true;
|
5363
5399
|
this.scene.environment = envMap;
|
5364
|
-
this.scene.environmentIntensity = envValues.
|
5400
|
+
this.scene.environmentIntensity = envValues.envMapIntensity;
|
5365
5401
|
this.scene.environmentRotation = new Euler3(
|
5366
|
-
MathUtils.degToRad(envValues.
|
5367
|
-
MathUtils.degToRad(envValues.
|
5402
|
+
MathUtils.degToRad(envValues.skyboxPolarAngle),
|
5403
|
+
MathUtils.degToRad(envValues.skyboxAzimuthalAngle),
|
5368
5404
|
0
|
5369
5405
|
);
|
5370
5406
|
this.scene.background = envMap;
|
5371
|
-
this.scene.backgroundIntensity = envValues.
|
5372
|
-
this.scene.backgroundBlurriness = envValues.
|
5407
|
+
this.scene.backgroundIntensity = envValues.skyboxIntensity;
|
5408
|
+
this.scene.backgroundBlurriness = envValues.skyboxBlurriness;
|
5373
5409
|
this.isEnvHDRI = true;
|
5374
5410
|
texture.dispose();
|
5375
5411
|
pmremGenerator.dispose();
|
@@ -5451,27 +5487,27 @@ var Composer = class {
|
|
5451
5487
|
(_i = this.sun) == null ? void 0 : _i.setPolarAngle(this.environmentConfiguration.sun.polarAngle);
|
5452
5488
|
}
|
5453
5489
|
}
|
5454
|
-
|
5455
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o
|
5456
|
-
if (typeof ((_b = (_a = this.environmentConfiguration) == null ? void 0 : _a.
|
5457
|
-
envValues.
|
5490
|
+
updateSkyboxAndEnvValues() {
|
5491
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
5492
|
+
if (typeof ((_b = (_a = this.environmentConfiguration) == null ? void 0 : _a.envMap) == null ? void 0 : _b.intensity) === "number") {
|
5493
|
+
envValues.envMapIntensity = (_c = this.environmentConfiguration) == null ? void 0 : _c.envMap.intensity;
|
5458
5494
|
}
|
5459
|
-
this.scene.
|
5460
|
-
if (typeof ((_e = (_d = this.environmentConfiguration) == null ? void 0 : _d.
|
5461
|
-
envValues.
|
5495
|
+
this.scene.environmentIntensity = envValues.envMapIntensity;
|
5496
|
+
if (typeof ((_e = (_d = this.environmentConfiguration) == null ? void 0 : _d.skybox) == null ? void 0 : _e.intensity) === "number") {
|
5497
|
+
envValues.skyboxIntensity = (_f = this.environmentConfiguration) == null ? void 0 : _f.skybox.intensity;
|
5462
5498
|
}
|
5463
|
-
this.scene.backgroundIntensity = envValues.
|
5499
|
+
this.scene.backgroundIntensity = envValues.skyboxIntensity;
|
5464
5500
|
if (typeof ((_h = (_g = this.environmentConfiguration) == null ? void 0 : _g.skybox) == null ? void 0 : _h.blurriness) === "number") {
|
5465
|
-
envValues.
|
5501
|
+
envValues.skyboxBlurriness = (_i = this.environmentConfiguration) == null ? void 0 : _i.skybox.blurriness;
|
5466
5502
|
}
|
5467
|
-
this.scene.backgroundBlurriness = envValues.
|
5503
|
+
this.scene.backgroundBlurriness = envValues.skyboxBlurriness;
|
5468
5504
|
if (typeof ((_k = (_j = this.environmentConfiguration) == null ? void 0 : _j.skybox) == null ? void 0 : _k.azimuthalAngle) === "number") {
|
5469
|
-
envValues.
|
5470
|
-
this.
|
5505
|
+
envValues.skyboxAzimuthalAngle = (_l = this.environmentConfiguration) == null ? void 0 : _l.skybox.azimuthalAngle;
|
5506
|
+
this.updateSkyboxRotation();
|
5471
5507
|
}
|
5472
|
-
if (typeof ((
|
5473
|
-
envValues.
|
5474
|
-
this.
|
5508
|
+
if (typeof ((_n = (_m = this.environmentConfiguration) == null ? void 0 : _m.skybox) == null ? void 0 : _n.polarAngle) === "number") {
|
5509
|
+
envValues.skyboxPolarAngle = (_o = this.environmentConfiguration) == null ? void 0 : _o.skybox.polarAngle;
|
5510
|
+
this.updateSkyboxRotation();
|
5475
5511
|
}
|
5476
5512
|
}
|
5477
5513
|
updateAmbientLightValues() {
|