@mml-io/3d-web-client-core 0.0.0-experimental-ff88de3-20240530 → 0.0.0-experimental-8634a66-20240605

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.d.ts CHANGED
@@ -15,3 +15,4 @@ export { CollisionsManager } from "./collisions/CollisionsManager";
15
15
  export { Sun } from "./sun/Sun";
16
16
  export { GroundPlane } from "./ground-plane/GroundPlane";
17
17
  export { LoadingScreen } from "./loading-screen/LoadingScreen";
18
+ export { EnvironmentConfiguration } from "./rendering/composer";
package/build/index.js CHANGED
@@ -1810,7 +1810,7 @@ var LocalController = class {
1810
1810
  i
1811
1811
  );
1812
1812
  }
1813
- if (this.config.character.position.y < 0) {
1813
+ if (this.config.character.position.y < -100) {
1814
1814
  this.resetPosition();
1815
1815
  }
1816
1816
  this.updateNetworkState();
@@ -2617,6 +2617,7 @@ var sunOptions = {
2617
2617
  var envValues = {
2618
2618
  hdrAzimuthalAngle: 0,
2619
2619
  hdrPolarAngle: 0,
2620
+ hdrEnvIntensity: 0.07,
2620
2621
  hdrIntensity: 0.8,
2621
2622
  hdrBlurriness: 0,
2622
2623
  ambientLight: {
@@ -3524,37 +3525,37 @@ var TweakPane = class {
3524
3525
  // src/rendering/composer.ts
3525
3526
  import { HDRJPGLoader } from "@monogrid/gainmap-js";
3526
3527
  import {
3528
+ BlendFunction as BlendFunction2,
3529
+ BloomEffect,
3530
+ EdgeDetectionMode,
3527
3531
  EffectComposer as EffectComposer2,
3528
- RenderPass,
3529
3532
  EffectPass as EffectPass2,
3530
3533
  FXAAEffect,
3534
+ NormalPass as NormalPass2,
3535
+ PredicationMode,
3536
+ RenderPass,
3531
3537
  ShaderPass,
3532
- BloomEffect,
3533
- SSAOEffect as SSAOEffect2,
3534
- BlendFunction as BlendFunction2,
3535
- TextureEffect,
3536
- ToneMappingEffect,
3537
3538
  SMAAEffect,
3538
3539
  SMAAPreset,
3539
- EdgeDetectionMode,
3540
- PredicationMode,
3541
- NormalPass as NormalPass2
3540
+ SSAOEffect as SSAOEffect2,
3541
+ TextureEffect,
3542
+ ToneMappingEffect
3542
3543
  } from "postprocessing";
3543
3544
  import {
3544
3545
  AmbientLight,
3545
3546
  Color as Color7,
3547
+ EquirectangularReflectionMapping,
3548
+ Euler as Euler3,
3546
3549
  Fog as Fog2,
3547
3550
  HalfFloatType as HalfFloatType2,
3548
3551
  LinearSRGBColorSpace,
3549
3552
  LoadingManager,
3553
+ MathUtils,
3550
3554
  PMREMGenerator,
3551
- SRGBColorSpace,
3552
3555
  Scene as Scene4,
3556
+ SRGBColorSpace,
3553
3557
  Vector2 as Vector27,
3554
- WebGLRenderer as WebGLRenderer4,
3555
- EquirectangularReflectionMapping,
3556
- MathUtils,
3557
- Euler as Euler3
3558
+ WebGLRenderer as WebGLRenderer4
3558
3559
  } from "three";
3559
3560
  import { RGBELoader } from "three/examples/jsm/loaders/RGBELoader.js";
3560
3561
 
@@ -5097,7 +5098,12 @@ var N8SSAOPass = class extends Pass {
5097
5098
 
5098
5099
  // src/rendering/composer.ts
5099
5100
  var Composer = class {
5100
- constructor(scene, camera, spawnSun = false) {
5101
+ constructor({
5102
+ scene,
5103
+ camera,
5104
+ spawnSun = false,
5105
+ environmentConfiguration
5106
+ }) {
5101
5107
  this.width = 1;
5102
5108
  this.height = 1;
5103
5109
  this.resolution = new Vector27(this.width, this.height);
@@ -5106,6 +5112,7 @@ var Composer = class {
5106
5112
  this.gaussGrainEffect = GaussGrainEffect;
5107
5113
  this.ambientLight = null;
5108
5114
  this.sun = null;
5115
+ var _a;
5109
5116
  this.scene = scene;
5110
5117
  this.postPostScene = new Scene4();
5111
5118
  this.camera = camera;
@@ -5121,9 +5128,9 @@ var Composer = class {
5121
5128
  this.renderer.shadowMap.type = rendererValues.shadowMap;
5122
5129
  this.renderer.toneMapping = rendererValues.toneMapping;
5123
5130
  this.renderer.toneMappingExposure = rendererValues.exposure;
5124
- this.scene.backgroundIntensity = envValues.hdrIntensity;
5125
- this.scene.backgroundBlurriness = envValues.hdrBlurriness;
5126
- this.setAmbientLight();
5131
+ this.environmentConfiguration = environmentConfiguration;
5132
+ this.updateHDRValues();
5133
+ this.updateAmbientLightValues();
5127
5134
  this.setFog();
5128
5135
  this.effectComposer = new EffectComposer2(this.renderer, {
5129
5136
  frameBufferType: HalfFloatType2
@@ -5156,6 +5163,9 @@ var Composer = class {
5156
5163
  this.ppssaoPass = new EffectPass2(this.camera, this.ppssaoEffect, this.normalTextureEffect);
5157
5164
  this.ppssaoPass.enabled = ppssaoValues.enabled;
5158
5165
  this.fxaaEffect = new FXAAEffect();
5166
+ if ((_a = environmentConfiguration == null ? void 0 : environmentConfiguration.postProcessing) == null ? void 0 : _a.bloomIntensity) {
5167
+ extrasValues.bloom = environmentConfiguration.postProcessing.bloomIntensity;
5168
+ }
5159
5169
  this.bloomEffect = new BloomEffect({
5160
5170
  intensity: extrasValues.bloom
5161
5171
  });
@@ -5215,6 +5225,7 @@ var Composer = class {
5215
5225
  this.sun = new Sun();
5216
5226
  this.scene.add(this.sun);
5217
5227
  }
5228
+ this.updateSunValues();
5218
5229
  this.resizeListener = () => {
5219
5230
  this.fitContainer();
5220
5231
  };
@@ -5316,6 +5327,13 @@ var Composer = class {
5316
5327
  if (envMap) {
5317
5328
  envMap.colorSpace = LinearSRGBColorSpace;
5318
5329
  envMap.needsUpdate = true;
5330
+ this.scene.environment = envMap;
5331
+ this.scene.environmentIntensity = envValues.hdrEnvIntensity;
5332
+ this.scene.environmentRotation = new Euler3(
5333
+ MathUtils.degToRad(envValues.hdrPolarAngle),
5334
+ MathUtils.degToRad(envValues.hdrAzimuthalAngle),
5335
+ 0
5336
+ );
5319
5337
  this.scene.background = envMap;
5320
5338
  this.scene.backgroundIntensity = envValues.hdrIntensity;
5321
5339
  this.scene.backgroundBlurriness = envValues.hdrBlurriness;
@@ -5342,6 +5360,13 @@ var Composer = class {
5342
5360
  if (envMap) {
5343
5361
  envMap.colorSpace = LinearSRGBColorSpace;
5344
5362
  envMap.needsUpdate = true;
5363
+ this.scene.environment = envMap;
5364
+ this.scene.environmentIntensity = envValues.hdrEnvIntensity;
5365
+ this.scene.environmentRotation = new Euler3(
5366
+ MathUtils.degToRad(envValues.hdrPolarAngle),
5367
+ MathUtils.degToRad(envValues.hdrAzimuthalAngle),
5368
+ 0
5369
+ );
5345
5370
  this.scene.background = envMap;
5346
5371
  this.scene.backgroundIntensity = envValues.hdrIntensity;
5347
5372
  this.scene.backgroundBlurriness = envValues.hdrBlurriness;
@@ -5411,6 +5436,51 @@ var Composer = class {
5411
5436
  );
5412
5437
  this.scene.add(this.ambientLight);
5413
5438
  }
5439
+ updateSunValues() {
5440
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
5441
+ if (typeof ((_b = (_a = this.environmentConfiguration) == null ? void 0 : _a.sun) == null ? void 0 : _b.intensity) === "number") {
5442
+ sunValues.sunIntensity = this.environmentConfiguration.sun.intensity;
5443
+ (_c = this.sun) == null ? void 0 : _c.setIntensity(this.environmentConfiguration.sun.intensity);
5444
+ }
5445
+ if (typeof ((_e = (_d = this.environmentConfiguration) == null ? void 0 : _d.sun) == null ? void 0 : _e.azimuthalAngle) === "number") {
5446
+ sunValues.sunPosition.sunAzimuthalAngle = this.environmentConfiguration.sun.azimuthalAngle;
5447
+ (_f = this.sun) == null ? void 0 : _f.setAzimuthalAngle(this.environmentConfiguration.sun.azimuthalAngle);
5448
+ }
5449
+ if (typeof ((_h = (_g = this.environmentConfiguration) == null ? void 0 : _g.sun) == null ? void 0 : _h.polarAngle) === "number") {
5450
+ sunValues.sunPosition.sunPolarAngle = this.environmentConfiguration.sun.polarAngle;
5451
+ (_i = this.sun) == null ? void 0 : _i.setPolarAngle(this.environmentConfiguration.sun.polarAngle);
5452
+ }
5453
+ }
5454
+ updateHDRValues() {
5455
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
5456
+ if (typeof ((_b = (_a = this.environmentConfiguration) == null ? void 0 : _a.skybox) == null ? void 0 : _b.intensity) === "number") {
5457
+ envValues.hdrIntensity = (_c = this.environmentConfiguration) == null ? void 0 : _c.skybox.intensity;
5458
+ }
5459
+ this.scene.backgroundIntensity = envValues.hdrIntensity;
5460
+ if (typeof ((_e = (_d = this.environmentConfiguration) == null ? void 0 : _d.envMap) == null ? void 0 : _e.intensity) === "number") {
5461
+ envValues.hdrEnvIntensity = (_f = this.environmentConfiguration) == null ? void 0 : _f.envMap.intensity;
5462
+ }
5463
+ this.scene.backgroundIntensity = envValues.hdrEnvIntensity;
5464
+ if (typeof ((_h = (_g = this.environmentConfiguration) == null ? void 0 : _g.skybox) == null ? void 0 : _h.blurriness) === "number") {
5465
+ envValues.hdrBlurriness = (_i = this.environmentConfiguration) == null ? void 0 : _i.skybox.blurriness;
5466
+ }
5467
+ this.scene.backgroundBlurriness = envValues.hdrBlurriness;
5468
+ if (typeof ((_k = (_j = this.environmentConfiguration) == null ? void 0 : _j.skybox) == null ? void 0 : _k.azimuthalAngle) === "number") {
5469
+ envValues.hdrAzimuthalAngle = (_l = this.environmentConfiguration) == null ? void 0 : _l.skybox.azimuthalAngle;
5470
+ this.setHDRAzimuthalAngle((_m = this.environmentConfiguration) == null ? void 0 : _m.skybox.azimuthalAngle);
5471
+ }
5472
+ if (typeof ((_o = (_n = this.environmentConfiguration) == null ? void 0 : _n.skybox) == null ? void 0 : _o.polarAngle) === "number") {
5473
+ envValues.hdrPolarAngle = (_p = this.environmentConfiguration) == null ? void 0 : _p.skybox.polarAngle;
5474
+ this.setHDRPolarAngle((_q = this.environmentConfiguration) == null ? void 0 : _q.skybox.polarAngle);
5475
+ }
5476
+ }
5477
+ updateAmbientLightValues() {
5478
+ var _a, _b;
5479
+ if (typeof ((_b = (_a = this.environmentConfiguration) == null ? void 0 : _a.ambientLight) == null ? void 0 : _b.intensity) === "number") {
5480
+ envValues.ambientLight.ambientLightIntensity = this.environmentConfiguration.ambientLight.intensity;
5481
+ this.setAmbientLight();
5482
+ }
5483
+ }
5414
5484
  };
5415
5485
 
5416
5486
  // src/time/TimeManager.ts