@mml-io/3d-web-client-core 0.0.0-experimental-0b919eb-20230904 → 0.0.0-experimental-b293af2-20230904

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
@@ -263,38 +263,110 @@ ${before}
263
263
  );
264
264
  }
265
265
 
266
- // src/tweakpane/characterSettings.ts
266
+ // src/tweakpane/blades/characterFolder.ts
267
267
  var characterValues = {
268
- material: {
269
- transmission: 1,
270
- metalness: 0.8,
271
- roughness: 0.12,
272
- ior: 1.5,
273
- thickness: 0.1,
274
- specularColor: { r: 1, g: 1, b: 1 },
275
- specularIntensity: 0.1,
276
- emissive: { r: 1, g: 1, b: 1 },
277
- emissiveIntensity: 0.1,
278
- envMapIntensity: 1,
279
- sheenColor: { r: 1, g: 1, b: 1 },
280
- sheen: 0.5,
281
- clearcoat: 0,
282
- clearcoatRoughness: 0
283
- }
268
+ transmission: 0.01,
269
+ metalness: 0.8,
270
+ roughness: 0.05,
271
+ ior: 1,
272
+ thickness: 0.1,
273
+ specularColor: { r: 1, g: 1, b: 1 },
274
+ specularIntensity: 0.1,
275
+ emissive: { r: 1, g: 1, b: 1 },
276
+ emissiveIntensity: 0.1,
277
+ envMapIntensity: 0.8,
278
+ sheenColor: { r: 1, g: 1, b: 1 },
279
+ sheen: 0.5,
280
+ clearcoat: 0,
281
+ clearcoatRoughness: 0
284
282
  };
285
283
  var characterOptions = {
286
- material: {
287
- transmission: { min: 0.01, max: 3, step: 0.01 },
288
- metalness: { min: 0, max: 1, step: 0.01 },
289
- roughness: { min: 0, max: 1, step: 0.01 },
290
- ior: { min: 0, max: 5, step: 0.01 },
291
- thickness: { min: 0, max: 1, step: 0.01 },
292
- specularIntensity: { min: 0, max: 1, step: 0.01 },
293
- emissiveIntensity: { min: 0, max: 1, step: 0.01 },
294
- envMapIntensity: { min: 0, max: 1, step: 0.01 },
295
- sheen: { min: 0, max: 1, step: 0.01 },
296
- clearcoat: { min: 0, max: 1, step: 0.01 },
297
- clearcoatRoughness: { min: 0, max: 1, step: 0.01 }
284
+ transmission: { min: 0.01, max: 3, step: 0.01 },
285
+ metalness: { min: 0, max: 1, step: 0.01 },
286
+ roughness: { min: 0, max: 1, step: 0.01 },
287
+ ior: { min: 1, max: 5, step: 0.01 },
288
+ thickness: { min: 0, max: 1, step: 0.01 },
289
+ specularIntensity: { min: 0, max: 1, step: 0.01 },
290
+ emissiveIntensity: { min: 0, max: 1, step: 0.01 },
291
+ envMapIntensity: { min: 0, max: 1, step: 0.01 },
292
+ sheen: { min: 0, max: 1, step: 0.01 },
293
+ clearcoat: { min: 0, max: 1, step: 0.01 },
294
+ clearcoatRoughness: { min: 0, max: 1, step: 0.01 }
295
+ };
296
+ var CharacterFolder = class {
297
+ constructor(parentFolder, expand = false) {
298
+ this.folder = parentFolder.addFolder({ title: "characterMaterial", expanded: expand });
299
+ this.folder.addBinding(characterValues, "transmission", characterOptions.transmission);
300
+ this.folder.addBinding(characterValues, "metalness", characterOptions.metalness);
301
+ this.folder.addBinding(characterValues, "roughness", characterOptions.roughness);
302
+ this.folder.addBinding(characterValues, "ior", characterOptions.ior);
303
+ this.folder.addBinding(characterValues, "thickness", characterOptions.thickness);
304
+ this.folder.addBinding(characterValues, "specularColor", {
305
+ color: { type: "float" }
306
+ });
307
+ this.folder.addBinding(
308
+ characterValues,
309
+ "specularIntensity",
310
+ characterOptions.specularIntensity
311
+ );
312
+ this.folder.addBinding(characterValues, "emissive", {
313
+ color: { type: "float" }
314
+ });
315
+ this.folder.addBinding(
316
+ characterValues,
317
+ "emissiveIntensity",
318
+ characterOptions.emissiveIntensity
319
+ );
320
+ this.folder.addBinding(characterValues, "envMapIntensity", characterOptions.envMapIntensity);
321
+ this.folder.addBinding(characterValues, "sheenColor", {
322
+ color: { type: "float" }
323
+ });
324
+ this.folder.addBinding(characterValues, "sheen", characterOptions.sheen);
325
+ this.folder.addBinding(characterValues, "clearcoat", characterOptions.clearcoat);
326
+ this.folder.addBinding(
327
+ characterValues,
328
+ "clearcoatRoughness",
329
+ characterOptions.clearcoatRoughness
330
+ );
331
+ }
332
+ setupChangeEvent() {
333
+ this.folder.on("change", (e) => {
334
+ const target = e.target.key;
335
+ if (!target)
336
+ return;
337
+ switch (target) {
338
+ case "specularColor": {
339
+ const value = e.value;
340
+ characterValues.specularColor = {
341
+ r: value.r,
342
+ g: value.g,
343
+ b: value.b
344
+ };
345
+ break;
346
+ }
347
+ case "emissive": {
348
+ const value = e.value;
349
+ characterValues.emissive = {
350
+ r: value.r,
351
+ g: value.g,
352
+ b: value.b
353
+ };
354
+ break;
355
+ }
356
+ case "sheenColor": {
357
+ const value = e.value;
358
+ characterValues.sheenColor = {
359
+ r: value.r,
360
+ g: value.g,
361
+ b: value.b
362
+ };
363
+ break;
364
+ }
365
+ default: {
366
+ break;
367
+ }
368
+ }
369
+ });
298
370
  }
299
371
  };
300
372
 
@@ -305,32 +377,32 @@ var CharacterMaterial = class extends MeshPhysicalMaterial {
305
377
  this.uniforms = {};
306
378
  this.colorsCube216 = [];
307
379
  this.color = new Color(16777215);
308
- this.transmission = characterValues.material.transmission;
309
- this.metalness = characterValues.material.metalness;
310
- this.roughness = characterValues.material.roughness;
311
- this.ior = characterValues.material.ior;
312
- this.thickness = characterValues.material.thickness;
380
+ this.transmission = characterValues.transmission;
381
+ this.metalness = characterValues.metalness;
382
+ this.roughness = characterValues.roughness;
383
+ this.ior = characterValues.ior;
384
+ this.thickness = characterValues.thickness;
313
385
  this.specularColor = new Color().setRGB(
314
- characterValues.material.specularColor.r,
315
- characterValues.material.specularColor.g,
316
- characterValues.material.specularColor.b
386
+ characterValues.specularColor.r,
387
+ characterValues.specularColor.g,
388
+ characterValues.specularColor.b
317
389
  );
318
- this.specularIntensity = characterValues.material.specularIntensity;
390
+ this.specularIntensity = characterValues.specularIntensity;
319
391
  this.emissive = new Color().setRGB(
320
- characterValues.material.emissive.r,
321
- characterValues.material.emissive.g,
322
- characterValues.material.emissive.b
392
+ characterValues.emissive.r,
393
+ characterValues.emissive.g,
394
+ characterValues.emissive.b
323
395
  );
324
- this.emissiveIntensity = characterValues.material.emissiveIntensity;
325
- this.envMapIntensity = characterValues.material.envMapIntensity;
396
+ this.emissiveIntensity = characterValues.emissiveIntensity;
397
+ this.envMapIntensity = characterValues.envMapIntensity;
326
398
  this.sheenColor = new Color().setRGB(
327
- characterValues.material.sheenColor.r,
328
- characterValues.material.sheenColor.g,
329
- characterValues.material.sheenColor.b
399
+ characterValues.sheenColor.r,
400
+ characterValues.sheenColor.g,
401
+ characterValues.sheenColor.b
330
402
  );
331
- this.sheen = characterValues.material.sheen;
332
- this.clearcoat = characterValues.material.clearcoat;
333
- this.clearcoatRoughness = characterValues.material.clearcoatRoughness;
403
+ this.sheen = characterValues.sheen;
404
+ this.clearcoat = characterValues.clearcoat;
405
+ this.clearcoatRoughness = characterValues.clearcoatRoughness;
334
406
  this.onBeforeCompile = (shader) => {
335
407
  this.uniforms = UniformsUtils.clone(shader.uniforms);
336
408
  this.uniforms.nearClip = { value: 0.01 };
@@ -430,32 +502,32 @@ var CharacterMaterial = class extends MeshPhysicalMaterial {
430
502
  }
431
503
  }
432
504
  update() {
433
- this.transmission = characterValues.material.transmission;
434
- this.metalness = characterValues.material.metalness;
435
- this.roughness = characterValues.material.roughness;
436
- this.ior = characterValues.material.ior;
437
- this.thickness = characterValues.material.thickness;
505
+ this.transmission = characterValues.transmission;
506
+ this.metalness = characterValues.metalness;
507
+ this.roughness = characterValues.roughness;
508
+ this.ior = characterValues.ior;
509
+ this.thickness = characterValues.thickness;
438
510
  this.specularColor = new Color().setRGB(
439
- characterValues.material.specularColor.r,
440
- characterValues.material.specularColor.g,
441
- characterValues.material.specularColor.b
511
+ characterValues.specularColor.r,
512
+ characterValues.specularColor.g,
513
+ characterValues.specularColor.b
442
514
  );
443
- this.specularIntensity = characterValues.material.specularIntensity;
515
+ this.specularIntensity = characterValues.specularIntensity;
444
516
  this.emissive = new Color().setRGB(
445
- characterValues.material.emissive.r,
446
- characterValues.material.emissive.g,
447
- characterValues.material.emissive.b
517
+ characterValues.emissive.r,
518
+ characterValues.emissive.g,
519
+ characterValues.emissive.b
448
520
  );
449
- this.emissiveIntensity = characterValues.material.emissiveIntensity;
450
- this.envMapIntensity = characterValues.material.envMapIntensity;
521
+ this.emissiveIntensity = characterValues.emissiveIntensity;
522
+ this.envMapIntensity = characterValues.envMapIntensity;
451
523
  this.sheenColor = new Color().setRGB(
452
- characterValues.material.sheenColor.r,
453
- characterValues.material.sheenColor.g,
454
- characterValues.material.sheenColor.b
524
+ characterValues.sheenColor.r,
525
+ characterValues.sheenColor.g,
526
+ characterValues.sheenColor.b
455
527
  );
456
- this.sheen = characterValues.material.sheen;
457
- this.clearcoat = characterValues.material.clearcoat;
458
- this.clearcoatRoughness = characterValues.material.clearcoatRoughness;
528
+ this.sheen = characterValues.sheen;
529
+ this.clearcoat = characterValues.clearcoat;
530
+ this.clearcoatRoughness = characterValues.clearcoatRoughness;
459
531
  }
460
532
  };
461
533
 
@@ -1650,22 +1722,23 @@ var MMLCompositionScene = class {
1650
1722
  };
1651
1723
 
1652
1724
  // src/rendering/composer.ts
1725
+ import { N8AOPostPass } from "n8ao";
1653
1726
  import {
1654
1727
  EffectComposer as EffectComposer2,
1655
1728
  RenderPass,
1656
1729
  EffectPass as EffectPass2,
1657
1730
  FXAAEffect,
1658
1731
  ShaderPass,
1659
- BloomEffect as BloomEffect2,
1732
+ BloomEffect,
1660
1733
  SSAOEffect as SSAOEffect2,
1661
- BlendFunction as BlendFunction3,
1734
+ BlendFunction as BlendFunction2,
1662
1735
  TextureEffect,
1663
- ToneMappingEffect as ToneMappingEffect2,
1736
+ ToneMappingEffect,
1664
1737
  SMAAEffect,
1665
1738
  SMAAPreset,
1666
1739
  EdgeDetectionMode,
1667
1740
  PredicationMode,
1668
- NormalPass
1741
+ NormalPass as NormalPass2
1669
1742
  } from "postprocessing";
1670
1743
  import {
1671
1744
  AmbientLight,
@@ -1676,21 +1749,21 @@ import {
1676
1749
  LoadingManager as LoadingManager2,
1677
1750
  PMREMGenerator,
1678
1751
  Vector2 as Vector22,
1679
- WebGLRenderer as WebGLRenderer3
1752
+ WebGLRenderer as WebGLRenderer2
1680
1753
  } from "three";
1681
1754
  import { RGBELoader } from "three/examples/jsm/loaders/RGBELoader.js";
1682
1755
 
1683
1756
  // src/sun/Sun.ts
1684
1757
  import { CameraHelper, Color as Color4, DirectionalLight, Group as Group3, OrthographicCamera, Vector3 as Vector37 } from "three";
1685
1758
 
1686
- // src/tweakpane/sunSettings.ts
1759
+ // src/tweakpane/blades/environmentFolder.ts
1687
1760
  var sunValues = {
1688
1761
  sunPosition: {
1689
1762
  sunAzimuthalAngle: 39,
1690
1763
  sunPolarAngle: 50
1691
1764
  },
1692
1765
  sunIntensity: 0.5,
1693
- sunColor: { r: 1, g: 1, b: 1 }
1766
+ sunColor: { r: 1, g: 0.74, b: 0.5 }
1694
1767
  };
1695
1768
  var sunOptions = {
1696
1769
  sunPosition: {
@@ -1699,6 +1772,144 @@ var sunOptions = {
1699
1772
  },
1700
1773
  sunIntensity: { min: 0, max: 1, step: 0.05 }
1701
1774
  };
1775
+ var envValues = {
1776
+ ambientLight: {
1777
+ ambientLightIntensity: 0,
1778
+ ambientLightColor: { r: 1, g: 1, b: 1 }
1779
+ },
1780
+ fog: {
1781
+ fogNear: 30,
1782
+ fogFar: 210,
1783
+ fogColor: { r: 0.42, g: 0.48, b: 0.59 }
1784
+ }
1785
+ };
1786
+ var envOptions = {
1787
+ ambientLight: {
1788
+ ambientLightIntensity: { min: 0, max: 1, step: 0.01 }
1789
+ },
1790
+ fog: {
1791
+ fogNear: { min: 0, max: 80, step: 1 },
1792
+ fogFar: { min: 81, max: 300, step: 1 }
1793
+ }
1794
+ };
1795
+ var EnvironmentFolder = class {
1796
+ constructor(parentFolder, expand = false) {
1797
+ this.folder = parentFolder.addFolder({ title: "environment", expanded: expand });
1798
+ this.sun = this.folder.addFolder({ title: "sun", expanded: true });
1799
+ this.ambient = this.folder.addFolder({ title: "ambient", expanded: true });
1800
+ this.sun.addBinding(
1801
+ sunValues.sunPosition,
1802
+ "sunAzimuthalAngle",
1803
+ sunOptions.sunPosition.sunAzimuthalAngle
1804
+ );
1805
+ this.sun.addBinding(
1806
+ sunValues.sunPosition,
1807
+ "sunPolarAngle",
1808
+ sunOptions.sunPosition.sunPolarAngle
1809
+ );
1810
+ this.sun.addBinding(sunValues, "sunIntensity", sunOptions.sunIntensity);
1811
+ this.sun.addBinding(sunValues, "sunColor", {
1812
+ color: { type: "float" }
1813
+ });
1814
+ this.sunButton = this.sun.addButton({ title: "Set HDRI" });
1815
+ this.ambient.addBinding(
1816
+ envValues.ambientLight,
1817
+ "ambientLightIntensity",
1818
+ envOptions.ambientLight.ambientLightIntensity
1819
+ );
1820
+ this.ambient.addBinding(envValues.ambientLight, "ambientLightColor", {
1821
+ color: { type: "float" }
1822
+ });
1823
+ this.ambient.addBinding(envValues.fog, "fogNear", envOptions.fog.fogNear);
1824
+ this.ambient.addBinding(envValues.fog, "fogFar", envOptions.fog.fogFar);
1825
+ this.ambient.addBinding(envValues.fog, "fogColor", {
1826
+ color: { type: "float" }
1827
+ });
1828
+ }
1829
+ setupChangeEvent(setHDR, setAmbientLight, setFog, sun) {
1830
+ this.sun.on("change", (e) => {
1831
+ const target = e.target.key;
1832
+ if (!target)
1833
+ return;
1834
+ switch (target) {
1835
+ case "sunAzimuthalAngle": {
1836
+ const value = e.value;
1837
+ sun == null ? void 0 : sun.setAzimuthalAngle(value * (Math.PI / 180));
1838
+ break;
1839
+ }
1840
+ case "sunPolarAngle": {
1841
+ const value = e.value;
1842
+ sun == null ? void 0 : sun.setPolarAngle(value * (Math.PI / 180));
1843
+ break;
1844
+ }
1845
+ case "sunIntensity": {
1846
+ const value = e.value;
1847
+ sun == null ? void 0 : sun.setIntensity(value);
1848
+ break;
1849
+ }
1850
+ case "sunColor": {
1851
+ const value = e.value;
1852
+ sunValues.sunColor = {
1853
+ r: value.r,
1854
+ g: value.g,
1855
+ b: value.b
1856
+ };
1857
+ sun == null ? void 0 : sun.setColor();
1858
+ break;
1859
+ }
1860
+ default:
1861
+ break;
1862
+ }
1863
+ });
1864
+ this.sunButton.on("click", () => {
1865
+ setHDR();
1866
+ });
1867
+ this.ambient.on("change", (e) => {
1868
+ const target = e.target.key;
1869
+ if (!target)
1870
+ return;
1871
+ switch (target) {
1872
+ case "ambientLightIntensity": {
1873
+ envValues.ambientLight.ambientLightIntensity = e.value;
1874
+ setAmbientLight();
1875
+ break;
1876
+ }
1877
+ case "ambientLightColor": {
1878
+ const value = e.value;
1879
+ envValues.ambientLight.ambientLightColor = {
1880
+ r: value.r,
1881
+ g: value.g,
1882
+ b: value.b
1883
+ };
1884
+ setAmbientLight();
1885
+ break;
1886
+ }
1887
+ case "fogNear": {
1888
+ envValues.fog.fogNear = e.value;
1889
+ setFog();
1890
+ break;
1891
+ }
1892
+ case "fogFar": {
1893
+ envValues.fog.fogFar = e.value;
1894
+ setFog();
1895
+ break;
1896
+ }
1897
+ case "fogColor": {
1898
+ const value = e.value;
1899
+ envValues.fog.fogColor = {
1900
+ r: value.r,
1901
+ g: value.g,
1902
+ b: value.b
1903
+ };
1904
+ setFog();
1905
+ break;
1906
+ }
1907
+ default:
1908
+ break;
1909
+ }
1910
+ });
1911
+ }
1912
+ };
1702
1913
 
1703
1914
  // src/sun/Sun.ts
1704
1915
  var Sun = class extends Group3 {
@@ -1731,6 +1942,7 @@ var Sun = class extends Group3 {
1731
1942
  this.directionalLight.shadow.camera = this.shadowCamera;
1732
1943
  this.directionalLight.shadow.mapSize.set(this.shadowResolution, this.shadowResolution);
1733
1944
  this.directionalLight.castShadow = true;
1945
+ this.setColor();
1734
1946
  this.updateCharacterPosition(new Vector37(0, 0, 0));
1735
1947
  this.add(this.directionalLight);
1736
1948
  if (this.debug === true && this.camHelper instanceof CameraHelper) {
@@ -1781,80 +1993,13 @@ var Sun = class extends Group3 {
1781
1993
  }
1782
1994
  };
1783
1995
 
1784
- // src/tweakpane/composerSettings.ts
1785
- import { BlendFunction } from "postprocessing";
1786
- var composerValues = {
1787
- renderer: {
1788
- shadowMap: 2,
1789
- toneMapping: 5,
1790
- exposure: 1,
1791
- bgIntensity: 0.5,
1792
- bgBlurriness: 0
1793
- },
1794
- ssao: {
1795
- blendFunction: BlendFunction.MULTIPLY,
1796
- distanceScaling: true,
1797
- depthAwareUpsampling: true,
1798
- samples: 17,
1799
- rings: 7,
1800
- luminanceInfluence: 0.7,
1801
- radius: 0.03,
1802
- intensity: 2.5,
1803
- bias: 0.05,
1804
- fade: 0.03,
1805
- resolutionScale: 0.75,
1806
- color: { r: 0, g: 0, b: 0 },
1807
- worldDistanceThreshold: 30,
1808
- worldDistanceFalloff: 7,
1809
- worldProximityThreshold: 0.5,
1810
- worldProximityFalloff: 0.3
1811
- },
1812
- toneMapping: {
1813
- mode: 2,
1814
- resolution: 512,
1815
- whitePoint: 32,
1816
- middleGrey: 21,
1817
- minLuminance: 0.01,
1818
- averageLuminance: 0.01,
1819
- adaptationRate: 2
1820
- },
1821
- brightness: -0.03,
1822
- contrast: 1.21,
1823
- saturation: 0.91,
1824
- grain: 0.061,
1825
- bloom: 0.25
1996
+ // src/tweakpane/blades/bcsFolder.ts
1997
+ var bcsValues = {
1998
+ brightness: 0,
1999
+ contrast: 1.25,
2000
+ saturation: 1
1826
2001
  };
1827
- var composerOptions = {
1828
- renderer: {
1829
- shadowMap: { min: 0, max: 2, step: 1 },
1830
- toneMapping: { min: 0, max: 5, step: 1 },
1831
- exposure: { min: 0, max: 3, step: 0.01 },
1832
- bgIntensity: { min: 0, max: 1.3, step: 0.01 },
1833
- bgBlurriness: { min: 0, max: 0.1, step: 1e-3 }
1834
- },
1835
- ssao: {
1836
- samples: { min: 1, max: 50, step: 1 },
1837
- rings: { min: 1, max: 50, step: 1 },
1838
- luminanceInfluence: { min: 0, max: 1, step: 0.01 },
1839
- radius: { min: 0, max: 0.1, step: 1e-3 },
1840
- intensity: { min: 0, max: 5, step: 0.1 },
1841
- bias: { min: 0, max: 0.1, step: 1e-3 },
1842
- fade: { min: 0, max: 0.1, step: 1e-3 },
1843
- resolutionScale: { min: 0.25, max: 2, step: 0.25 },
1844
- worldDistanceThreshold: { min: 0, max: 200, step: 1 },
1845
- worldDistanceFalloff: { min: 0, max: 200, step: 1 },
1846
- worldProximityThreshold: { min: 0, max: 2, step: 0.01 },
1847
- worldProximityFalloff: { min: 0, max: 2, step: 0.01 }
1848
- },
1849
- toneMapping: {
1850
- mode: { min: 0, max: 4, step: 1 },
1851
- resolution: { min: 64, max: 512, step: 64 },
1852
- whitePoint: { min: 0, max: 32, step: 0.01 },
1853
- middleGrey: { min: 0, max: 32, step: 0.01 },
1854
- minLuminance: { min: 0, max: 32, step: 1e-3 },
1855
- averageLuminance: { min: 1e-3, max: 0.2, step: 1e-3 },
1856
- adaptationRate: { min: 0.1, max: 2, step: 0.1 }
1857
- },
2002
+ var bcsOptions = {
1858
2003
  brightness: {
1859
2004
  amount: { min: -1, max: 1, step: 0.01 }
1860
2005
  },
@@ -1863,7 +2008,44 @@ var composerOptions = {
1863
2008
  },
1864
2009
  saturation: {
1865
2010
  amount: { min: 0, max: 2, step: 0.01 }
1866
- },
2011
+ }
2012
+ };
2013
+ var BrightnessContrastSaturationFolder = class {
2014
+ constructor(parentFolder, expand = false) {
2015
+ this.folder = parentFolder.addFolder({
2016
+ title: "brightness / contrast / sat",
2017
+ expanded: expand
2018
+ });
2019
+ this.folder.addBinding(bcsValues, "brightness", bcsOptions.brightness.amount);
2020
+ this.folder.addBinding(bcsValues, "contrast", bcsOptions.contrast.amount);
2021
+ this.folder.addBinding(bcsValues, "saturation", bcsOptions.saturation.amount);
2022
+ }
2023
+ setupChangeEvent(brightnessContrastSaturation) {
2024
+ this.folder.on("change", (e) => {
2025
+ const target = e.target.key;
2026
+ if (!target)
2027
+ return;
2028
+ switch (target) {
2029
+ case "brightness":
2030
+ brightnessContrastSaturation.uniforms.brightness.value = e.value;
2031
+ break;
2032
+ case "contrast":
2033
+ brightnessContrastSaturation.uniforms.contrast.value = e.value;
2034
+ break;
2035
+ case "saturation":
2036
+ brightnessContrastSaturation.uniforms.saturation.value = e.value;
2037
+ break;
2038
+ }
2039
+ });
2040
+ }
2041
+ };
2042
+
2043
+ // src/tweakpane/blades/postExtrasFolder.ts
2044
+ var extrasValues = {
2045
+ grain: 0.055,
2046
+ bloom: 0.25
2047
+ };
2048
+ var extrasOptions = {
1867
2049
  grain: {
1868
2050
  amount: { min: 0, max: 0.2, step: 2e-3 }
1869
2051
  },
@@ -1871,12 +2053,52 @@ var composerOptions = {
1871
2053
  amount: { min: 0, max: 2, step: 0.05 }
1872
2054
  }
1873
2055
  };
2056
+ var PostExtrasFolder = class {
2057
+ constructor(parentFolder, expand = false) {
2058
+ this.folder = parentFolder.addFolder({ title: "bloom / grain", expanded: expand });
2059
+ this.folder.addBinding(extrasValues, "bloom", extrasOptions.bloom.amount);
2060
+ this.folder.addBinding(extrasValues, "grain", extrasOptions.grain.amount);
2061
+ }
2062
+ setupChangeEvent(bloomEffect, gaussGrainEffect) {
2063
+ this.folder.on("change", (e) => {
2064
+ const target = e.target.key;
2065
+ if (!target)
2066
+ return;
2067
+ switch (target) {
2068
+ case "bloom":
2069
+ bloomEffect.intensity = e.value;
2070
+ break;
2071
+ case "grain":
2072
+ gaussGrainEffect.uniforms.amount.value = e.value;
2073
+ break;
2074
+ default:
2075
+ break;
2076
+ }
2077
+ });
2078
+ }
2079
+ };
2080
+
2081
+ // src/tweakpane/blades/rendererFolder.ts
2082
+ var rendererValues = {
2083
+ shadowMap: 2,
2084
+ toneMapping: 5,
2085
+ exposure: 1,
2086
+ bgIntensity: 0.45,
2087
+ bgBlurriness: 0
2088
+ };
2089
+ var rendererOptions = {
2090
+ shadowMap: { min: 0, max: 2, step: 1 },
2091
+ toneMapping: { min: 0, max: 5, step: 1 },
2092
+ exposure: { min: 0, max: 3, step: 0.01 },
2093
+ bgIntensity: { min: 0, max: 1.3, step: 0.01 },
2094
+ bgBlurriness: { min: 0, max: 0.1, step: 1e-3 }
2095
+ };
1874
2096
  var shadowMapTypes = {
1875
2097
  0: "BasicShadowMap",
1876
2098
  1: "PCFShadowMap",
1877
2099
  2: "PCFSoftShadowMap"
1878
2100
  };
1879
- var rendererToneMappingTypes = {
2101
+ var toneMappingTypes = {
1880
2102
  0: "NoToneMapping",
1881
2103
  1: "LinearToneMapping",
1882
2104
  2: "ReinhardToneMapping",
@@ -1884,28 +2106,120 @@ var rendererToneMappingTypes = {
1884
2106
  4: "ACESFilmicToneMapping",
1885
2107
  5: "CustomToneMapping"
1886
2108
  };
1887
- var customToneMappingTypes = {
1888
- 0: "REINHARD",
1889
- 1: "REINHARD2",
1890
- 2: "REINHARD2_ADAPTIVE",
1891
- 3: "OPTIMIZED_CINEON",
1892
- 4: "ACES_FILMIC"
1893
- };
1894
- var rendererBlades = {
1895
- shadowMapType: shadowMapTypes[composerValues.renderer.shadowMap],
1896
- toneMappingType: rendererToneMappingTypes[composerValues.renderer.toneMapping]
2109
+ var monitoredValues = {
2110
+ shadowMapType: shadowMapTypes[rendererValues.shadowMap],
2111
+ toneMappingType: toneMappingTypes[rendererValues.toneMapping]
1897
2112
  };
1898
2113
  var setShadowMapType = (value) => {
1899
- rendererBlades.shadowMapType = shadowMapTypes[value];
2114
+ monitoredValues.shadowMapType = shadowMapTypes[value];
1900
2115
  };
1901
2116
  var setToneMappingType = (value) => {
1902
- rendererBlades.toneMappingType = rendererToneMappingTypes[value];
2117
+ monitoredValues.toneMappingType = toneMappingTypes[value];
1903
2118
  };
1904
- var customToneMappingBlade = {
1905
- customToneMappingType: customToneMappingTypes[composerValues.toneMapping.mode]
2119
+ var RendererFolder = class {
2120
+ constructor(parentFolder, expand = false) {
2121
+ this.folder = parentFolder.addFolder({
2122
+ title: "rendererOptions",
2123
+ expanded: expand
2124
+ });
2125
+ this.folder.addBinding(rendererValues, "shadowMap", rendererOptions.shadowMap);
2126
+ this.folder.addBinding(monitoredValues, "shadowMapType", { readonly: true });
2127
+ this.folder.addBinding(rendererValues, "toneMapping", rendererOptions.toneMapping);
2128
+ this.folder.addBinding(monitoredValues, "toneMappingType", { readonly: true });
2129
+ this.folder.addBinding(rendererValues, "exposure", rendererOptions.exposure);
2130
+ this.folder.addBinding(rendererValues, "bgIntensity", rendererOptions.bgIntensity);
2131
+ this.folder.addBinding(rendererValues, "bgBlurriness", rendererOptions.bgBlurriness);
2132
+ }
2133
+ setupChangeEvent(scene, renderer, toneMappingFolder, toneMappingPass) {
2134
+ this.folder.on("change", (e) => {
2135
+ const target = e.target.key;
2136
+ if (!target)
2137
+ return;
2138
+ switch (target) {
2139
+ case "shadowMap": {
2140
+ const value = e.value;
2141
+ renderer.shadowMap.type = value;
2142
+ setShadowMapType(value);
2143
+ break;
2144
+ }
2145
+ case "toneMapping":
2146
+ renderer.toneMapping = e.value;
2147
+ toneMappingFolder.hidden = e.value !== 5;
2148
+ toneMappingPass.enabled = e.value === 5 ? true : false;
2149
+ setToneMappingType(e.value);
2150
+ break;
2151
+ case "exposure":
2152
+ renderer.toneMappingExposure = e.value;
2153
+ break;
2154
+ case "bgIntensity":
2155
+ scene.backgroundIntensity = e.value;
2156
+ break;
2157
+ case "bgBlurriness":
2158
+ scene.backgroundBlurriness = e.value;
2159
+ break;
2160
+ default:
2161
+ break;
2162
+ }
2163
+ });
2164
+ }
1906
2165
  };
1907
- var setCustomToneMappingType = (value) => {
1908
- customToneMappingBlade.customToneMappingType = customToneMappingTypes[value];
2166
+
2167
+ // src/tweakpane/blades/ssaoFolder.ts
2168
+ import { BlendFunction } from "postprocessing";
2169
+ import { Color as Color5 } from "three";
2170
+ var ppssaoValues = {
2171
+ enabled: false,
2172
+ blendFunction: BlendFunction.MULTIPLY,
2173
+ distanceScaling: true,
2174
+ depthAwareUpsampling: true,
2175
+ samples: 30,
2176
+ rings: 11,
2177
+ luminanceInfluence: 0.7,
2178
+ radius: 0.03,
2179
+ intensity: 2.5,
2180
+ bias: 0.05,
2181
+ fade: 0.03,
2182
+ resolutionScale: 0.5,
2183
+ color: { r: 0, g: 0, b: 0 },
2184
+ worldDistanceThreshold: 30,
2185
+ worldDistanceFalloff: 7,
2186
+ worldProximityThreshold: 0.5,
2187
+ worldProximityFalloff: 0.3
2188
+ };
2189
+ var ppssaoOptions = {
2190
+ samples: { min: 1, max: 50, step: 1 },
2191
+ rings: { min: 1, max: 50, step: 1 },
2192
+ luminanceInfluence: { min: 0, max: 1, step: 0.01 },
2193
+ radius: { min: 0, max: 0.1, step: 1e-3 },
2194
+ intensity: { min: 0, max: 5, step: 0.1 },
2195
+ bias: { min: 0, max: 0.1, step: 1e-3 },
2196
+ fade: { min: 0, max: 0.1, step: 1e-3 },
2197
+ resolutionScale: { min: 0.25, max: 2, step: 0.25 },
2198
+ worldDistanceThreshold: { min: 0, max: 200, step: 1 },
2199
+ worldDistanceFalloff: { min: 0, max: 200, step: 1 },
2200
+ worldProximityThreshold: { min: 0, max: 2, step: 0.01 },
2201
+ worldProximityFalloff: { min: 0, max: 2, step: 0.01 }
2202
+ };
2203
+ var n8ssaoValues = {
2204
+ enabled: true,
2205
+ halfRes: false,
2206
+ aoRadius: 5,
2207
+ distanceFalloff: 3,
2208
+ intensity: 1,
2209
+ color: { r: 0, g: 0, b: 0 },
2210
+ aoSamples: 16,
2211
+ denoiseSamples: 4,
2212
+ denoiseRadius: 12,
2213
+ viewMode: "Combined"
2214
+ };
2215
+ var n8ssaoOptions = {
2216
+ radius: { min: 0.1, max: 6, step: 0.1 },
2217
+ distanceFalloff: { min: 1, max: 6, step: 0.1 },
2218
+ intensity: { min: 0.1, max: 5, step: 0.1 },
2219
+ aoSamples: [2, 4, 8, 16, 32, 64],
2220
+ denoiseSamples: [2, 4, 8, 16, 32, 64],
2221
+ denoiseRadius: [3, 6, 12],
2222
+ viewMode: ["Combined", "AO", "Split", "No AO"]
1909
2223
  };
1910
2224
  var ssaoMaterialParams = [
1911
2225
  "fade",
@@ -1916,69 +2230,336 @@ var ssaoMaterialParams = [
1916
2230
  "worldProximityThreshold",
1917
2231
  "worldProximityFalloff"
1918
2232
  ];
1919
- var statsData = {
1920
- triangles: "0",
1921
- geometries: "0",
1922
- textures: "0",
1923
- shaders: "0",
1924
- postPasses: "0",
1925
- drawCalls: "0",
1926
- rawDeltaTime: "0",
1927
- deltaTime: "0",
1928
- FPS: "0"
2233
+ var SSAOFolder = class {
2234
+ constructor(parentFolder, expand = false) {
2235
+ this.postProcessingSSAOIndex = 1;
2236
+ this.folder = parentFolder.addFolder({ title: "ambientOcclusion", expanded: expand });
2237
+ this.n8ssao = this.folder.addFolder({
2238
+ title: "N8 ambientOcclusion",
2239
+ expanded: n8ssaoValues.enabled
2240
+ });
2241
+ this.ppssao = this.folder.addFolder({
2242
+ title: "PP ambientOcclusion",
2243
+ expanded: ppssaoValues.enabled
2244
+ });
2245
+ {
2246
+ this.ppssao.addBinding({ enabled: ppssaoValues.enabled }, "enabled");
2247
+ this.ppssao.addBinding({ showEffectOnly: false }, "showEffectOnly");
2248
+ this.ppssao.addBinding(ppssaoValues, "samples", ppssaoOptions.samples);
2249
+ this.ppssao.addBinding(ppssaoValues, "rings", ppssaoOptions.rings);
2250
+ this.ppssao.addBinding(ppssaoValues, "luminanceInfluence", ppssaoOptions.luminanceInfluence);
2251
+ this.ppssao.addBinding(ppssaoValues, "radius", ppssaoOptions.radius);
2252
+ this.ppssao.addBinding(ppssaoValues, "intensity", ppssaoOptions.intensity);
2253
+ this.ppssao.addBinding(ppssaoValues, "bias", ppssaoOptions.bias);
2254
+ this.ppssao.addBinding(ppssaoValues, "fade", ppssaoOptions.fade);
2255
+ this.ppssao.addBinding(ppssaoValues, "resolutionScale", ppssaoOptions.resolutionScale);
2256
+ this.ppssao.addBinding(
2257
+ ppssaoValues,
2258
+ "worldDistanceThreshold",
2259
+ ppssaoOptions.worldDistanceThreshold
2260
+ );
2261
+ this.ppssao.addBinding(
2262
+ ppssaoValues,
2263
+ "worldDistanceFalloff",
2264
+ ppssaoOptions.worldDistanceFalloff
2265
+ );
2266
+ this.ppssao.addBinding(
2267
+ ppssaoValues,
2268
+ "worldProximityThreshold",
2269
+ ppssaoOptions.worldProximityThreshold
2270
+ );
2271
+ this.ppssao.addBinding(
2272
+ ppssaoValues,
2273
+ "worldProximityFalloff",
2274
+ ppssaoOptions.worldProximityFalloff
2275
+ );
2276
+ this.ppssao.addBinding(ppssaoValues, "color", { color: { alpha: false, type: "float" } });
2277
+ }
2278
+ {
2279
+ this.n8ssao.addBinding({ enabled: n8ssaoValues.enabled }, "enabled");
2280
+ this.n8ssao.addBinding({ halfRes: n8ssaoValues.halfRes }, "halfRes");
2281
+ this.n8ssao.addBinding(n8ssaoValues, "aoRadius", n8ssaoOptions.radius);
2282
+ this.n8ssao.addBinding(n8ssaoValues, "distanceFalloff", n8ssaoOptions.distanceFalloff);
2283
+ this.n8ssao.addBinding(n8ssaoValues, "intensity", n8ssaoOptions.intensity);
2284
+ this.n8ssao.addBinding(n8ssaoValues, "color", { color: { alpha: false, type: "float" } });
2285
+ this.aoSamples = this.n8ssao.addBinding(n8ssaoValues, "aoSamples", {
2286
+ view: "radiogrid",
2287
+ groupName: "aoSamples",
2288
+ size: [3, 2],
2289
+ cells: (x, y) => ({
2290
+ title: `${n8ssaoOptions.aoSamples[y * 3 + x]}`,
2291
+ value: n8ssaoOptions.aoSamples[y * 3 + x]
2292
+ }),
2293
+ label: "aoSamples"
2294
+ });
2295
+ this.denoiseSamples = this.n8ssao.addBinding(n8ssaoValues, "denoiseSamples", {
2296
+ view: "radiogrid",
2297
+ groupName: "denoiseSamples",
2298
+ size: [3, 2],
2299
+ cells: (x, y) => ({
2300
+ title: `${n8ssaoOptions.denoiseSamples[y * 3 + x]}`,
2301
+ value: n8ssaoOptions.denoiseSamples[y * 3 + x]
2302
+ }),
2303
+ label: "denoiseSamples"
2304
+ });
2305
+ this.denoiseRadius = this.n8ssao.addBinding(n8ssaoValues, "denoiseRadius", {
2306
+ view: "radiogrid",
2307
+ groupName: "denoiseRadius",
2308
+ size: [3, 1],
2309
+ cells: (x, y) => ({
2310
+ title: `${n8ssaoOptions.denoiseRadius[y * 3 + x]}`,
2311
+ value: n8ssaoOptions.denoiseRadius[y * 3 + x]
2312
+ }),
2313
+ label: "denoiseRadius"
2314
+ });
2315
+ this.aoDisplay = this.n8ssao.addBinding(n8ssaoValues, "viewMode", {
2316
+ view: "radiogrid",
2317
+ groupName: "viewMode",
2318
+ size: [2, 2],
2319
+ cells: (x, y) => ({
2320
+ title: `${n8ssaoOptions.viewMode[y * 2 + x]}`,
2321
+ value: `${n8ssaoOptions.viewMode[y * 2 + x]}`
2322
+ }),
2323
+ label: "viewMode"
2324
+ });
2325
+ }
2326
+ this.folder.addBlade({ view: "separator" });
2327
+ }
2328
+ setupChangeEvent(composer, normalPass, ppssaoEffect, ppssaoPass, n8aopass) {
2329
+ this.ppssao.on("change", (e) => {
2330
+ const target = e.target.key;
2331
+ if (!target)
2332
+ return;
2333
+ switch (target) {
2334
+ case "enabled": {
2335
+ const value = e.value;
2336
+ if (e.value === true) {
2337
+ composer.addPass(normalPass, this.postProcessingSSAOIndex);
2338
+ composer.addPass(ppssaoPass, this.postProcessingSSAOIndex + 1);
2339
+ } else {
2340
+ composer.removePass(ppssaoPass);
2341
+ composer.removePass(normalPass);
2342
+ }
2343
+ ppssaoValues.enabled = value;
2344
+ normalPass.enabled = value;
2345
+ ppssaoPass.enabled = value;
2346
+ break;
2347
+ }
2348
+ case "showEffectOnly": {
2349
+ const value = e.value;
2350
+ const blend = value === true ? BlendFunction.NORMAL : BlendFunction.MULTIPLY;
2351
+ ppssaoEffect.blendMode.blendFunction = blend;
2352
+ break;
2353
+ }
2354
+ case "resolutionScale": {
2355
+ const value = e.value;
2356
+ ppssaoEffect.resolution.scale = value;
2357
+ break;
2358
+ }
2359
+ case "color": {
2360
+ const value = e.value;
2361
+ ppssaoEffect.color = new Color5().setRGB(value.r, value.g, value.b);
2362
+ break;
2363
+ }
2364
+ default: {
2365
+ break;
2366
+ }
2367
+ }
2368
+ if (ssaoMaterialParams.includes(target)) {
2369
+ ppssaoEffect.ssaoMaterial[target] = e.value;
2370
+ return;
2371
+ }
2372
+ ppssaoEffect[target] = e.value;
2373
+ });
2374
+ this.n8ssao.on("change", (e) => {
2375
+ const target = e.target.key;
2376
+ if (!target)
2377
+ return;
2378
+ switch (target) {
2379
+ case "enabled":
2380
+ if (e.value === true) {
2381
+ composer.addPass(n8aopass, this.postProcessingSSAOIndex + 2);
2382
+ } else {
2383
+ composer.removePass(n8aopass);
2384
+ }
2385
+ n8aopass.enabled = e.value;
2386
+ break;
2387
+ case "halfRes":
2388
+ n8aopass.configuration.halfRes = e.value;
2389
+ break;
2390
+ case "aoRadius":
2391
+ n8aopass.configuration.aoRadius = e.value;
2392
+ break;
2393
+ case "distanceFalloff":
2394
+ n8aopass.configuration.distanceFalloff = e.value;
2395
+ break;
2396
+ case "intensity":
2397
+ n8aopass.configuration.intensity = e.value;
2398
+ break;
2399
+ case "color":
2400
+ const value = e.value;
2401
+ n8aopass.configuration.color = new Color5().setRGB(value.r, value.g, value.b);
2402
+ break;
2403
+ default:
2404
+ break;
2405
+ }
2406
+ });
2407
+ this.aoSamples.on("change", (e) => {
2408
+ n8aopass.configuration.aoSamples = e.value;
2409
+ });
2410
+ this.denoiseSamples.on("change", (e) => {
2411
+ n8aopass.configuration.denoiseSamples = e.value;
2412
+ });
2413
+ this.denoiseRadius.on("change", (e) => {
2414
+ n8aopass.configuration.denoiseRadius = e.value;
2415
+ });
2416
+ this.aoDisplay.on("change", (e) => {
2417
+ n8aopass.setDisplayMode(e.value);
2418
+ });
2419
+ }
1929
2420
  };
1930
2421
 
1931
- // src/tweakpane/envSettings.ts
1932
- var envValues = {
1933
- ambientLight: {
1934
- ambientLightIntensity: 0,
1935
- ambientLightColor: { r: 1, g: 1, b: 1 }
1936
- },
1937
- fog: {
1938
- fogNear: 30,
1939
- fogFar: 210,
1940
- fogColor: { r: 0.42, g: 0.48, b: 0.59 }
1941
- }
2422
+ // src/tweakpane/blades/toneMappingFolder.ts
2423
+ var toneMappingValues = {
2424
+ mode: 2,
2425
+ resolution: 512,
2426
+ whitePoint: 32,
2427
+ middleGrey: 21,
2428
+ minLuminance: 0.01,
2429
+ averageLuminance: 0.01,
2430
+ adaptationRate: 2
1942
2431
  };
1943
- var envOptions = {
1944
- ambientLight: {
1945
- ambientLightIntensity: { min: 0, max: 1, step: 0.01 }
1946
- },
1947
- fog: {
1948
- fogNear: { min: 0, max: 80, step: 1 },
1949
- fogFar: { min: 81, max: 300, step: 1 }
2432
+ var toneMappingOptions = {
2433
+ mode: { min: 0, max: 4, step: 1 },
2434
+ resolution: { min: 64, max: 512, step: 64 },
2435
+ whitePoint: { min: 0, max: 32, step: 0.01 },
2436
+ middleGrey: { min: 0, max: 32, step: 0.01 },
2437
+ minLuminance: { min: 0, max: 32, step: 1e-3 },
2438
+ averageLuminance: { min: 1e-3, max: 0.2, step: 1e-3 },
2439
+ adaptationRate: { min: 0.1, max: 2, step: 0.1 }
2440
+ };
2441
+ var customToneMappingTypes = {
2442
+ 0: "REINHARD",
2443
+ 1: "REINHARD2",
2444
+ 2: "REINHARD2_ADAPTIVE",
2445
+ 3: "OPTIMIZED_CINEON",
2446
+ 4: "ACES_FILMIC"
2447
+ };
2448
+ var customToneMappingBlade = {
2449
+ customToneMappingType: customToneMappingTypes[toneMappingValues.mode]
2450
+ };
2451
+ var setCustomToneMappingType = (value) => {
2452
+ customToneMappingBlade.customToneMappingType = customToneMappingTypes[value];
2453
+ };
2454
+ var ToneMappingFolder = class {
2455
+ constructor(parentFolder, expand = false) {
2456
+ this.folder = parentFolder.addFolder({
2457
+ title: "customToneMapping",
2458
+ expanded: expand
2459
+ });
2460
+ this.folder.addBinding(toneMappingValues, "mode", toneMappingOptions.mode);
2461
+ this.folder.addBinding(customToneMappingBlade, "customToneMappingType", { readonly: true });
2462
+ this.folder.addBinding(toneMappingValues, "whitePoint", toneMappingOptions.whitePoint);
2463
+ this.folder.addBinding(toneMappingValues, "middleGrey", toneMappingOptions.middleGrey);
2464
+ this.minLuminance = this.folder.addBinding(
2465
+ toneMappingValues,
2466
+ "minLuminance",
2467
+ toneMappingOptions.minLuminance
2468
+ );
2469
+ this.minLuminance.hidden = toneMappingValues.mode === 2 ? true : false;
2470
+ this.avgLuminance = this.folder.addBinding(
2471
+ toneMappingValues,
2472
+ "averageLuminance",
2473
+ toneMappingOptions.averageLuminance
2474
+ );
2475
+ this.avgLuminance.hidden = toneMappingValues.mode === 2 ? true : false;
2476
+ this.folder.addBinding(toneMappingValues, "adaptationRate", toneMappingOptions.adaptationRate);
2477
+ }
2478
+ setupChangeEvent(toneMappingEffect) {
2479
+ this.folder.on("change", (e) => {
2480
+ const target = e.target.key;
2481
+ if (!target)
2482
+ return;
2483
+ if (target === "mode") {
2484
+ this.minLuminance.hidden = toneMappingValues.mode === 2 ? true : false;
2485
+ this.avgLuminance.hidden = toneMappingValues.mode === 2 ? true : false;
2486
+ setCustomToneMappingType(e.value);
2487
+ }
2488
+ toneMappingEffect[target] = e.value;
2489
+ return;
2490
+ });
1950
2491
  }
1951
2492
  };
1952
2493
 
1953
2494
  // src/tweakpane/TweakPane.ts
1954
- import {
1955
- BlendFunction as BlendFunction2
1956
- } from "postprocessing";
1957
- import { Color as Color5 } from "three";
2495
+ import * as EssentialsPlugin from "@tweakpane/plugin-essentials";
1958
2496
  import { Pane } from "tweakpane";
1959
- var TweakPane = class {
1960
- constructor(renderer, scene, composer) {
1961
- this.guiStyle = `
2497
+
2498
+ // src/tweakpane/blades/rendererStatsFolder.ts
2499
+ var RendererStatsFolder = class {
2500
+ constructor(parentFolder, expanded = true) {
2501
+ this.statsData = {
2502
+ triangles: "0",
2503
+ geometries: "0",
2504
+ textures: "0",
2505
+ shaders: "0",
2506
+ postPasses: "0",
2507
+ drawCalls: "0",
2508
+ rawDeltaTime: "0",
2509
+ deltaTime: "0",
2510
+ FPS: "0"
2511
+ };
2512
+ this.folder = parentFolder.addFolder({ title: "renderStats", expanded });
2513
+ this.performance = this.folder.addFolder({ title: "performance", expanded: true });
2514
+ this.defails = this.folder.addFolder({ title: "pipeline details", expanded: false });
2515
+ this.folder.addBlade({ view: "separator" });
2516
+ this.performance.addBinding(this.statsData, "FPS", { readonly: true });
2517
+ this.performance.addBinding(this.statsData, "deltaTime", { readonly: true });
2518
+ this.performance.addBinding(this.statsData, "rawDeltaTime", { readonly: true });
2519
+ this.defails.addBinding(this.statsData, "triangles", { readonly: true });
2520
+ this.defails.addBinding(this.statsData, "geometries", { readonly: true });
2521
+ this.defails.addBinding(this.statsData, "textures", { readonly: true });
2522
+ this.defails.addBinding(this.statsData, "shaders", { readonly: true });
2523
+ this.defails.addBinding(this.statsData, "postPasses", { readonly: true });
2524
+ this.defails.addBinding(this.statsData, "drawCalls", { readonly: true });
2525
+ }
2526
+ update(renderer, composer, timeManager) {
2527
+ const { geometries, textures } = renderer.info.memory;
2528
+ const { triangles, calls } = renderer.info.render;
2529
+ this.statsData.triangles = triangles.toString();
2530
+ this.statsData.geometries = geometries.toString();
2531
+ this.statsData.textures = textures.toString();
2532
+ this.statsData.shaders = renderer.info.programs.length.toString();
2533
+ this.statsData.postPasses = composer.passes.length.toString();
2534
+ this.statsData.drawCalls = calls.toString();
2535
+ this.statsData.rawDeltaTime = (Math.round(timeManager.rawDeltaTime * 1e5) / 1e5).toString();
2536
+ this.statsData.deltaTime = (Math.round(timeManager.deltaTime * 1e5) / 1e5).toString();
2537
+ this.statsData.FPS = timeManager.fps.toString();
2538
+ }
2539
+ };
2540
+
2541
+ // src/tweakpane/tweakPaneStyle.ts
2542
+ var tweakPaneStyle = `
1962
2543
  :root {
1963
- --tp-base-background-color: hsla(0, 0%, 10%, 0.8);
2544
+ --tp-base-background-color: rgba(0, 0, 0, 0.6);
1964
2545
  --tp-base-shadow-color: hsla(0, 0%, 0%, 0.2);
1965
2546
  --tp-button-background-color: hsla(0, 0%, 80%, 1);
1966
2547
  --tp-button-background-color-active: hsla(0, 0%, 100%, 1);
1967
2548
  --tp-button-background-color-focus: hsla(0, 0%, 95%, 1);
1968
2549
  --tp-button-background-color-hover: hsla(0, 0%, 85%, 1);
1969
- --tp-button-foreground-color: hsla(0, 0%, 0%, 0.8);
2550
+ --tp-button-foreground-color: hsla(0, 0%, 0%, 0.7);
1970
2551
  --tp-container-background-color: hsla(0, 0%, 0%, 0.3);
1971
2552
  --tp-container-background-color-active: hsla(0, 0%, 0%, 0.6);
1972
2553
  --tp-container-background-color-focus: hsla(0, 0%, 0%, 0.5);
1973
2554
  --tp-container-background-color-hover: hsla(0, 0%, 0%, 0.4);
1974
- --tp-container-foreground-color: hsla(0, 0%, 100%, 0.5);
2555
+ --tp-container-foreground-color: hsla(0, 0%, 90%, 0.6);
1975
2556
  --tp-groove-foreground-color: hsla(0, 0%, 0%, 0.2);
1976
- --tp-input-background-color: hsla(0, 0%, 0%, 0.3);
2557
+ --tp-input-background-color: hsla(0, 0%, 30%, 0.3);
1977
2558
  --tp-input-background-color-active: hsla(0, 0%, 0%, 0.6);
1978
2559
  --tp-input-background-color-focus: hsla(0, 0%, 0%, 0.5);
1979
2560
  --tp-input-background-color-hover: hsla(0, 0%, 0%, 0.4);
1980
- --tp-input-foreground-color: hsla(0, 0%, 100%, 0.5);
1981
- --tp-label-foreground-color: hsla(0, 0%, 100%, 0.5);
2561
+ --tp-input-foreground-color: hsla(0, 0%, 100%, 0.6);
2562
+ --tp-label-foreground-color: hsla(0, 0%, 100%, 0.6);
1982
2563
  --tp-monitor-background-color: hsla(0, 0%, 0%, 0.3);
1983
2564
  --tp-monitor-foreground-color: hsla(0, 0%, 100%, 0.3);
1984
2565
  }
@@ -1990,19 +2571,50 @@ var TweakPane = class {
1990
2571
  }
1991
2572
 
1992
2573
  .tp-dfwv {
1993
- width: 333px !important;
2574
+ color: white;
2575
+ backdrop-filter: blur(12px);
2576
+ width: 360px !important;
1994
2577
  display: none;
2578
+ -webkit-user-select: none;
2579
+ -ms-user-select: none;
2580
+ user-select: none;
2581
+ }
2582
+
2583
+ .tp-fldv_t {
2584
+ font-size: 11px;
2585
+ background-color: rgba(0, 0, 0, 0.1);
1995
2586
  }
1996
2587
 
1997
2588
  .tp-lblv_l {
1998
- font-size: 10px;
2589
+ font-size: 11px;
1999
2590
  padding-left: 0px !important;
2000
2591
  padding-right: 0px !important;
2001
2592
  }
2593
+
2594
+ .tp-lblv_v {
2595
+ width: 180px;
2596
+ }
2597
+
2598
+ .tp-sldtxtv_t {
2599
+ max-width: 50px;
2600
+ }
2601
+
2602
+ .tp-sglv_i {
2603
+ font-size: 11px;
2604
+ color: rgba(255, 255, 255, 0.7);
2605
+ }
2002
2606
  `;
2607
+
2608
+ // src/tweakpane/TweakPane.ts
2609
+ var TweakPane = class {
2610
+ constructor(renderer, scene, composer) {
2611
+ this.renderer = renderer;
2612
+ this.scene = scene;
2613
+ this.composer = composer;
2003
2614
  this.gui = new Pane();
2004
2615
  this.saveVisibilityInLocalStorage = true;
2005
2616
  this.guiVisible = false;
2617
+ this.gui.registerPlugin(EssentialsPlugin);
2006
2618
  if (this.saveVisibilityInLocalStorage) {
2007
2619
  const localStorageGuiVisible = localStorage.getItem("guiVisible");
2008
2620
  if (localStorageGuiVisible !== null) {
@@ -2013,120 +2625,20 @@ var TweakPane = class {
2013
2625
  }
2014
2626
  }
2015
2627
  }
2016
- this.renderer = renderer;
2017
- this.scene = scene;
2018
- this.composer = composer;
2019
2628
  const styleElement = document.createElement("style");
2020
2629
  styleElement.type = "text/css";
2021
- styleElement.appendChild(document.createTextNode(this.guiStyle));
2630
+ styleElement.appendChild(document.createTextNode(tweakPaneStyle));
2022
2631
  document.head.appendChild(styleElement);
2023
- this.render = this.gui.addFolder({ title: "rendering", expanded: true });
2024
- this.stats = this.render.addFolder({ title: "stats", expanded: true });
2025
- this.renderOptions = this.render.addFolder({ title: "renderOptions", expanded: false });
2026
- this.toneMapping = this.render.addFolder({ title: "customToneMapping", expanded: false });
2027
- this.ssao = this.render.addFolder({ title: "ambientOcclusion", expanded: false });
2028
- this.post = this.render.addFolder({ title: "post", expanded: false });
2029
- this.toneMapping.hidden = composerValues.renderer.toneMapping === 5 ? false : true;
2030
- {
2031
- this.characterMaterial = this.gui.addFolder({ title: "characterMaterial", expanded: false });
2032
- this.characterMaterial.addInput(
2033
- characterValues.material,
2034
- "transmission",
2035
- characterOptions.material.transmission
2036
- );
2037
- this.characterMaterial.addInput(
2038
- characterValues.material,
2039
- "metalness",
2040
- characterOptions.material.metalness
2041
- );
2042
- this.characterMaterial.addInput(
2043
- characterValues.material,
2044
- "roughness",
2045
- characterOptions.material.roughness
2046
- );
2047
- this.characterMaterial.addInput(
2048
- characterValues.material,
2049
- "ior",
2050
- characterOptions.material.ior
2051
- );
2052
- this.characterMaterial.addInput(
2053
- characterValues.material,
2054
- "thickness",
2055
- characterOptions.material.thickness
2056
- );
2057
- this.characterMaterial.addInput(characterValues.material, "specularColor", {
2058
- color: { type: "float" }
2059
- });
2060
- this.characterMaterial.addInput(
2061
- characterValues.material,
2062
- "specularIntensity",
2063
- characterOptions.material.specularIntensity
2064
- );
2065
- this.characterMaterial.addInput(characterValues.material, "emissive", {
2066
- color: { type: "float" }
2067
- });
2068
- this.characterMaterial.addInput(
2069
- characterValues.material,
2070
- "emissiveIntensity",
2071
- characterOptions.material.emissiveIntensity
2072
- );
2073
- this.characterMaterial.addInput(
2074
- characterValues.material,
2075
- "envMapIntensity",
2076
- characterOptions.material.envMapIntensity
2077
- );
2078
- this.characterMaterial.addInput(characterValues.material, "sheenColor", {
2079
- color: { type: "float" }
2080
- });
2081
- this.characterMaterial.addInput(
2082
- characterValues.material,
2083
- "sheen",
2084
- characterOptions.material.sheen
2085
- );
2086
- this.characterMaterial.addInput(
2087
- characterValues.material,
2088
- "clearcoat",
2089
- characterOptions.material.clearcoat
2090
- );
2091
- this.characterMaterial.addInput(
2092
- characterValues.material,
2093
- "clearcoatRoughness",
2094
- characterOptions.material.clearcoatRoughness
2095
- );
2096
- this.characterMaterial.on("change", (e) => {
2097
- if (!e.presetKey) {
2098
- return;
2099
- }
2100
- if (e.presetKey === "specularColor") {
2101
- characterValues.material.specularColor = {
2102
- r: e.value.r,
2103
- g: e.value.g,
2104
- b: e.value.b
2105
- };
2106
- return;
2107
- }
2108
- if (e.presetKey === "emissive") {
2109
- characterValues.material.emissive = {
2110
- r: e.value.r,
2111
- g: e.value.g,
2112
- b: e.value.b
2113
- };
2114
- return;
2115
- }
2116
- if (e.presetKey === "sheenColor") {
2117
- characterValues.material.sheenColor = {
2118
- r: e.value.r,
2119
- g: e.value.g,
2120
- b: e.value.b
2121
- };
2122
- return;
2123
- }
2124
- });
2125
- }
2126
- this.environment = this.gui.addFolder({ title: "environment", expanded: false });
2127
- this.sun = this.environment.addFolder({ title: "sun", expanded: true });
2128
- this.ambient = this.environment.addFolder({ title: "ambient", expanded: true });
2129
- this.export = this.gui.addFolder({ title: "import/export", expanded: false });
2632
+ this.renderStatsFolder = new RendererStatsFolder(this.gui, true);
2633
+ this.rendererFolder = new RendererFolder(this.gui, false);
2634
+ this.toneMappingFolder = new ToneMappingFolder(this.gui, false);
2635
+ this.ssaoFolder = new SSAOFolder(this.gui, false);
2636
+ this.bcsFolder = new BrightnessContrastSaturationFolder(this.gui, false);
2637
+ this.postExtrasFolder = new PostExtrasFolder(this.gui, false);
2638
+ this.character = new CharacterFolder(this.gui, false);
2639
+ this.environment = new EnvironmentFolder(this.gui, false);
2640
+ this.toneMappingFolder.folder.hidden = rendererValues.toneMapping === 5 ? false : true;
2641
+ this.export = this.gui.addFolder({ title: "import / export", expanded: false });
2130
2642
  window.addEventListener("keydown", this.processKey.bind(this));
2131
2643
  this.setupGUIListeners.bind(this)();
2132
2644
  this.setupRenderPane = this.setupRenderPane.bind(this);
@@ -2143,319 +2655,33 @@ var TweakPane = class {
2143
2655
  this.gui.element.addEventListener("mouseup", () => setTweakpaneActive(false));
2144
2656
  this.gui.element.addEventListener("mouseleave", () => setTweakpaneActive(false));
2145
2657
  }
2146
- setupRenderPane(ssaoEffect, toneMappingEffect, toneMappingPass, brightnessContrastSaturation, bloomEffect, gaussGrainEffect, hasLighting, sun, setHDR, setAmbientLight, setFog) {
2147
- {
2148
- this.stats.addMonitor(statsData, "triangles");
2149
- this.stats.addMonitor(statsData, "geometries");
2150
- this.stats.addMonitor(statsData, "textures");
2151
- this.stats.addMonitor(statsData, "shaders");
2152
- this.stats.addMonitor(statsData, "postPasses");
2153
- this.stats.addMonitor(statsData, "drawCalls");
2154
- this.stats.addMonitor(statsData, "rawDeltaTime");
2155
- this.stats.addMonitor(statsData, "deltaTime");
2156
- this.stats.addMonitor(statsData, "FPS");
2157
- }
2158
- {
2159
- this.renderOptions.addInput(
2160
- composerValues.renderer,
2161
- "shadowMap",
2162
- composerOptions.renderer.shadowMap
2163
- );
2164
- this.renderOptions.addMonitor(rendererBlades, "shadowMapType");
2165
- this.renderOptions.addInput(
2166
- composerValues.renderer,
2167
- "toneMapping",
2168
- composerOptions.renderer.toneMapping
2169
- );
2170
- this.renderOptions.addMonitor(rendererBlades, "toneMappingType");
2171
- this.renderOptions.addInput(
2172
- composerValues.renderer,
2173
- "exposure",
2174
- composerOptions.renderer.exposure
2175
- );
2176
- this.renderOptions.addInput(
2177
- composerValues.renderer,
2178
- "bgIntensity",
2179
- composerOptions.renderer.bgIntensity
2180
- );
2181
- this.renderOptions.addInput(
2182
- composerValues.renderer,
2183
- "bgBlurriness",
2184
- composerOptions.renderer.bgBlurriness
2185
- );
2186
- this.renderOptions.on("change", (e) => {
2187
- const target = e.target;
2188
- switch (target.label) {
2189
- case "shadowMap":
2190
- this.renderer.shadowMap.type = e.value;
2191
- setShadowMapType(e.value);
2192
- break;
2193
- case "toneMapping":
2194
- this.renderer.toneMapping = e.value;
2195
- this.toneMapping.hidden = e.value !== 5;
2196
- toneMappingPass.enabled = e.value === 5 ? true : false;
2197
- setToneMappingType(e.value);
2198
- break;
2199
- case "exposure":
2200
- this.renderer.toneMappingExposure = e.value;
2201
- break;
2202
- case "bgIntensity":
2203
- this.scene.backgroundIntensity = e.value;
2204
- break;
2205
- case "bgBlurriness":
2206
- this.scene.backgroundBlurriness = e.value;
2207
- break;
2208
- default:
2209
- break;
2210
- }
2211
- });
2212
- }
2213
- {
2214
- this.ssao.addInput({ showEffectOnly: false }, "showEffectOnly");
2215
- this.ssao.addInput(composerValues.ssao, "samples", composerOptions.ssao.samples);
2216
- this.ssao.addInput(composerValues.ssao, "rings", composerOptions.ssao.rings);
2217
- this.ssao.addInput(
2218
- composerValues.ssao,
2219
- "luminanceInfluence",
2220
- composerOptions.ssao.luminanceInfluence
2221
- );
2222
- this.ssao.addInput(composerValues.ssao, "radius", composerOptions.ssao.radius);
2223
- this.ssao.addInput(composerValues.ssao, "intensity", composerOptions.ssao.intensity);
2224
- this.ssao.addInput(composerValues.ssao, "bias", composerOptions.ssao.bias);
2225
- this.ssao.addInput(composerValues.ssao, "fade", composerOptions.ssao.fade);
2226
- this.ssao.addInput(
2227
- composerValues.ssao,
2228
- "resolutionScale",
2229
- composerOptions.ssao.resolutionScale
2230
- );
2231
- this.ssao.addInput(
2232
- composerValues.ssao,
2233
- "worldDistanceThreshold",
2234
- composerOptions.ssao.worldDistanceThreshold
2235
- );
2236
- this.ssao.addInput(
2237
- composerValues.ssao,
2238
- "worldDistanceFalloff",
2239
- composerOptions.ssao.worldDistanceFalloff
2240
- );
2241
- this.ssao.addInput(
2242
- composerValues.ssao,
2243
- "worldProximityThreshold",
2244
- composerOptions.ssao.worldProximityThreshold
2245
- );
2246
- this.ssao.addInput(
2247
- composerValues.ssao,
2248
- "worldProximityFalloff",
2249
- composerOptions.ssao.worldProximityFalloff
2250
- );
2251
- this.ssao.addInput(composerValues.ssao, "color", {
2252
- color: { alpha: false, type: "float" }
2253
- });
2254
- this.ssao.on("change", (e) => {
2255
- if (!e.presetKey) {
2256
- return;
2257
- }
2258
- const preset = e.presetKey;
2259
- if (preset === "showEffectOnly") {
2260
- ssaoEffect.blendMode.blendFunction = e.value === true ? BlendFunction2.NORMAL : BlendFunction2.MULTIPLY;
2261
- return;
2262
- }
2263
- if (preset === "resolutionScale") {
2264
- ssaoEffect.resolution.scale = e.value;
2265
- return;
2266
- }
2267
- if (ssaoMaterialParams.includes(e.presetKey)) {
2268
- ssaoEffect.ssaoMaterial[preset] = e.value;
2269
- return;
2270
- }
2271
- if (e.presetKey === "color") {
2272
- ssaoEffect.color = new Color5().setRGB(e.value.r, e.value.g, e.value.b);
2273
- return;
2274
- }
2275
- ssaoEffect[preset] = e.value;
2276
- });
2277
- }
2278
- {
2279
- this.toneMapping.addInput(
2280
- composerValues.toneMapping,
2281
- "mode",
2282
- composerOptions.toneMapping.mode
2283
- );
2284
- this.toneMapping.addMonitor(customToneMappingBlade, "customToneMappingType");
2285
- this.toneMapping.addInput(
2286
- composerValues.toneMapping,
2287
- "whitePoint",
2288
- composerOptions.toneMapping.whitePoint
2289
- );
2290
- this.toneMapping.addInput(
2291
- composerValues.toneMapping,
2292
- "middleGrey",
2293
- composerOptions.toneMapping.middleGrey
2294
- );
2295
- const minLuminance = this.toneMapping.addInput(
2296
- composerValues.toneMapping,
2297
- "minLuminance",
2298
- composerOptions.toneMapping.minLuminance
2299
- );
2300
- minLuminance.hidden = composerValues.toneMapping.mode === 2 ? true : false;
2301
- const averageLuminance = this.toneMapping.addInput(
2302
- composerValues.toneMapping,
2303
- "averageLuminance",
2304
- composerOptions.toneMapping.averageLuminance
2305
- );
2306
- averageLuminance.hidden = composerValues.toneMapping.mode === 2 ? true : false;
2307
- this.toneMapping.addInput(
2308
- composerValues.toneMapping,
2309
- "adaptationRate",
2310
- composerOptions.toneMapping.adaptationRate
2311
- );
2312
- this.toneMapping.on("change", (e) => {
2313
- if (!e.presetKey) {
2314
- return;
2315
- }
2316
- const preset = e.presetKey;
2317
- if (preset === "mode") {
2318
- minLuminance.hidden = composerValues.toneMapping.mode === 2 ? true : false;
2319
- averageLuminance.hidden = composerValues.toneMapping.mode === 2 ? true : false;
2320
- setCustomToneMappingType(e.value);
2321
- }
2322
- toneMappingEffect[preset] = e.value;
2323
- return;
2324
- });
2325
- }
2326
- {
2327
- this.post.addInput(composerValues, "brightness", composerOptions.brightness.amount);
2328
- this.post.addInput(composerValues, "contrast", composerOptions.contrast.amount);
2329
- this.post.addInput(composerValues, "saturation", composerOptions.saturation.amount);
2330
- this.post.addInput(composerValues, "bloom", composerOptions.bloom.amount);
2331
- this.post.addInput(composerValues, "grain", composerOptions.grain.amount);
2332
- this.post.on("change", (e) => {
2333
- const target = e.presetKey;
2334
- switch (target) {
2335
- case "brightness":
2336
- brightnessContrastSaturation.uniforms.brightness.value = e.value;
2337
- break;
2338
- case "contrast":
2339
- brightnessContrastSaturation.uniforms.contrast.value = e.value;
2340
- break;
2341
- case "saturation":
2342
- brightnessContrastSaturation.uniforms.saturation.value = e.value;
2343
- break;
2344
- case "bloom":
2345
- bloomEffect.intensity = e.value;
2346
- break;
2347
- case "grain":
2348
- gaussGrainEffect.uniforms.amount.value = e.value;
2349
- break;
2350
- default:
2351
- break;
2352
- }
2353
- });
2354
- }
2355
- {
2356
- this.environment.hidden = hasLighting === false || sun === null;
2357
- this.sun.addInput(
2358
- sunValues.sunPosition,
2359
- "sunAzimuthalAngle",
2360
- sunOptions.sunPosition.sunAzimuthalAngle
2361
- );
2362
- this.sun.addInput(
2363
- sunValues.sunPosition,
2364
- "sunPolarAngle",
2365
- sunOptions.sunPosition.sunPolarAngle
2366
- );
2367
- this.sun.addInput(sunValues, "sunIntensity", sunOptions.sunIntensity);
2368
- this.sun.addInput(sunValues, "sunColor", {
2369
- color: { type: "float" }
2370
- });
2371
- this.sunButton = this.sun.addButton({ title: "Set HDRI" });
2372
- this.sunButton.on("click", () => {
2373
- setHDR();
2374
- });
2375
- this.sun.on("change", (e) => {
2376
- const target = e.presetKey;
2377
- switch (target) {
2378
- case "sunAzimuthalAngle":
2379
- sun == null ? void 0 : sun.setAzimuthalAngle(e.value * (Math.PI / 180));
2380
- break;
2381
- case "sunPolarAngle":
2382
- sun == null ? void 0 : sun.setPolarAngle(e.value * (Math.PI / 180));
2383
- break;
2384
- case "sunIntensity":
2385
- sun == null ? void 0 : sun.setIntensity(e.value);
2386
- break;
2387
- case "sunColor":
2388
- sunValues.sunColor = {
2389
- r: e.value.r,
2390
- g: e.value.g,
2391
- b: e.value.b
2392
- };
2393
- sun == null ? void 0 : sun.setColor();
2394
- break;
2395
- default:
2396
- break;
2397
- }
2398
- });
2399
- this.ambient.addInput(
2400
- envValues.ambientLight,
2401
- "ambientLightIntensity",
2402
- envOptions.ambientLight.ambientLightIntensity
2403
- );
2404
- this.ambient.addInput(envValues.ambientLight, "ambientLightColor", {
2405
- color: { type: "float" }
2406
- });
2407
- this.ambient.addInput(envValues.fog, "fogNear", envOptions.fog.fogNear);
2408
- this.ambient.addInput(envValues.fog, "fogFar", envOptions.fog.fogFar);
2409
- this.ambient.addInput(envValues.fog, "fogColor", {
2410
- color: { type: "float" }
2411
- });
2412
- this.ambient.on("change", (e) => {
2413
- const target = e.presetKey;
2414
- switch (target) {
2415
- case "ambientLightIntensity":
2416
- envValues.ambientLight.ambientLightIntensity = e.value;
2417
- setAmbientLight();
2418
- break;
2419
- case "ambientLightColor":
2420
- envValues.ambientLight.ambientLightColor = {
2421
- r: e.value.r,
2422
- g: e.value.g,
2423
- b: e.value.b
2424
- };
2425
- setAmbientLight();
2426
- break;
2427
- case "fogNear":
2428
- envValues.fog.fogNear = e.value;
2429
- setFog();
2430
- break;
2431
- case "fogFar":
2432
- envValues.fog.fogFar = e.value;
2433
- setFog();
2434
- break;
2435
- case "fogColor":
2436
- envValues.fog.fogColor = {
2437
- r: e.value.r,
2438
- g: e.value.g,
2439
- b: e.value.b
2440
- };
2441
- setFog();
2442
- break;
2443
- default:
2444
- break;
2445
- }
2446
- });
2447
- }
2658
+ setupRenderPane(composer, normalPass, ppssaoEffect, ppssaoPass, n8aopass, toneMappingEffect, toneMappingPass, brightnessContrastSaturation, bloomEffect, gaussGrainEffect, hasLighting, sun, setHDR, setAmbientLight, setFog) {
2659
+ this.rendererFolder.setupChangeEvent(
2660
+ this.scene,
2661
+ this.renderer,
2662
+ this.toneMappingFolder.folder,
2663
+ toneMappingPass
2664
+ );
2665
+ this.toneMappingFolder.setupChangeEvent(toneMappingEffect);
2666
+ this.ssaoFolder.setupChangeEvent(composer, normalPass, ppssaoEffect, ppssaoPass, n8aopass);
2667
+ this.bcsFolder.setupChangeEvent(brightnessContrastSaturation);
2668
+ this.postExtrasFolder.setupChangeEvent(bloomEffect, gaussGrainEffect);
2669
+ this.environment.setupChangeEvent(setHDR, setAmbientLight, setFog, sun);
2670
+ this.environment.folder.hidden = hasLighting === false || sun === null;
2448
2671
  const exportButton = this.export.addButton({ title: "export" });
2449
2672
  exportButton.on("click", () => {
2450
- this.downloadSettingsAsJSON(this.gui.exportPreset());
2673
+ this.downloadSettingsAsJSON(this.gui.exportState());
2451
2674
  });
2452
2675
  const importButton = this.export.addButton({ title: "import" });
2453
2676
  importButton.on("click", () => {
2454
2677
  this.importSettingsFromJSON((settings) => {
2455
- this.gui.importPreset(settings);
2678
+ this.gui.importState(settings);
2456
2679
  });
2457
2680
  });
2458
2681
  }
2682
+ updateStats(timeManager) {
2683
+ this.renderStatsFolder.update(this.renderer, this.composer, timeManager);
2684
+ }
2459
2685
  formatDateForFilename() {
2460
2686
  const date = /* @__PURE__ */ new Date();
2461
2687
  const year = date.getFullYear();
@@ -2499,19 +2725,6 @@ var TweakPane = class {
2499
2725
  });
2500
2726
  input.click();
2501
2727
  }
2502
- updateStats(timeManager) {
2503
- const { geometries, textures } = this.renderer.info.memory;
2504
- const { triangles, calls } = this.renderer.info.render;
2505
- statsData.triangles = triangles.toString();
2506
- statsData.geometries = geometries.toString();
2507
- statsData.textures = textures.toString();
2508
- statsData.shaders = this.renderer.info.programs.length.toString();
2509
- statsData.postPasses = this.composer.passes.length.toString();
2510
- statsData.drawCalls = calls.toString();
2511
- statsData.rawDeltaTime = (Math.round(timeManager.rawDeltaTime * 1e5) / 1e5).toString();
2512
- statsData.deltaTime = (Math.round(timeManager.deltaTime * 1e5) / 1e5).toString();
2513
- statsData.FPS = timeManager.fps.toString();
2514
- }
2515
2728
  toggleGUI() {
2516
2729
  const gui = this.gui;
2517
2730
  const paneElement = gui.containerElem_;
@@ -2681,7 +2894,7 @@ var Composer = class {
2681
2894
  this.scene = scene;
2682
2895
  this.camera = camera;
2683
2896
  this.spawnSun = spawnSun;
2684
- this.renderer = new WebGLRenderer3({
2897
+ this.renderer = new WebGLRenderer2({
2685
2898
  powerPreference: "high-performance",
2686
2899
  antialias: false,
2687
2900
  stencil: false,
@@ -2690,9 +2903,9 @@ var Composer = class {
2690
2903
  this.renderer.info.autoReset = false;
2691
2904
  this.renderer.setSize(this.width, this.height);
2692
2905
  this.renderer.shadowMap.enabled = true;
2693
- this.renderer.shadowMap.type = composerValues.renderer.shadowMap;
2694
- this.renderer.toneMapping = composerValues.renderer.toneMapping;
2695
- this.renderer.toneMappingExposure = composerValues.renderer.exposure;
2906
+ this.renderer.shadowMap.type = rendererValues.shadowMap;
2907
+ this.renderer.toneMapping = rendererValues.toneMapping;
2908
+ this.renderer.toneMappingExposure = rendererValues.exposure;
2696
2909
  this.setAmbientLight();
2697
2910
  this.setFog();
2698
2911
  document.body.appendChild(this.renderer.domElement);
@@ -2701,44 +2914,59 @@ var Composer = class {
2701
2914
  });
2702
2915
  this.tweakPane = new TweakPane(this.renderer, this.scene, this.composer);
2703
2916
  this.renderPass = new RenderPass(this.scene, this.camera);
2704
- this.normalPass = new NormalPass(this.scene, this.camera);
2917
+ this.normalPass = new NormalPass2(this.scene, this.camera);
2918
+ this.normalPass.enabled = ppssaoValues.enabled;
2705
2919
  this.normalTextureEffect = new TextureEffect({
2706
- blendFunction: BlendFunction3.SKIP,
2920
+ blendFunction: BlendFunction2.SKIP,
2707
2921
  texture: this.normalPass.texture
2708
2922
  });
2709
- this.fxaaEffect = new FXAAEffect();
2710
- this.bloomEffect = new BloomEffect2({
2711
- intensity: composerValues.bloom
2923
+ this.ppssaoEffect = new SSAOEffect2(this.camera, this.normalPass.texture, {
2924
+ blendFunction: ppssaoValues.blendFunction,
2925
+ distanceScaling: ppssaoValues.distanceScaling,
2926
+ depthAwareUpsampling: ppssaoValues.depthAwareUpsampling,
2927
+ samples: ppssaoValues.samples,
2928
+ rings: ppssaoValues.rings,
2929
+ luminanceInfluence: ppssaoValues.luminanceInfluence,
2930
+ radius: ppssaoValues.radius,
2931
+ intensity: ppssaoValues.intensity,
2932
+ bias: ppssaoValues.bias,
2933
+ fade: ppssaoValues.fade,
2934
+ resolutionScale: ppssaoValues.resolutionScale,
2935
+ color: new Color6().setRGB(ppssaoValues.color.r, ppssaoValues.color.g, ppssaoValues.color.b),
2936
+ worldDistanceThreshold: ppssaoValues.worldDistanceThreshold,
2937
+ worldDistanceFalloff: ppssaoValues.worldDistanceFalloff,
2938
+ worldProximityThreshold: ppssaoValues.worldProximityThreshold,
2939
+ worldProximityFalloff: ppssaoValues.worldProximityFalloff
2712
2940
  });
2713
- this.ssaoEffect = new SSAOEffect2(this.camera, this.normalPass.texture, {
2714
- blendFunction: composerValues.ssao.blendFunction,
2715
- distanceScaling: composerValues.ssao.distanceScaling,
2716
- depthAwareUpsampling: composerValues.ssao.depthAwareUpsampling,
2717
- samples: composerValues.ssao.samples,
2718
- rings: composerValues.ssao.rings,
2719
- luminanceInfluence: composerValues.ssao.luminanceInfluence,
2720
- radius: composerValues.ssao.radius,
2721
- intensity: composerValues.ssao.intensity,
2722
- bias: composerValues.ssao.bias,
2723
- fade: composerValues.ssao.fade,
2724
- resolutionScale: composerValues.ssao.resolutionScale,
2725
- color: new Color6().setRGB(composerValues.ssao.color.r, composerValues.ssao.color.g, composerValues.ssao.color.b),
2726
- worldDistanceThreshold: composerValues.ssao.worldDistanceThreshold,
2727
- worldDistanceFalloff: composerValues.ssao.worldDistanceFalloff,
2728
- worldProximityThreshold: composerValues.ssao.worldProximityThreshold,
2729
- worldProximityFalloff: composerValues.ssao.worldProximityFalloff
2941
+ this.ppssaoPass = new EffectPass2(this.camera, this.ppssaoEffect, this.normalTextureEffect);
2942
+ this.ppssaoPass.enabled = ppssaoValues.enabled;
2943
+ this.fxaaEffect = new FXAAEffect();
2944
+ this.bloomEffect = new BloomEffect({
2945
+ intensity: extrasValues.bloom
2730
2946
  });
2947
+ this.n8aopass = new N8AOPostPass(this.scene, this.camera, this.width, this.height);
2948
+ this.n8aopass.configuration.aoRadius = n8ssaoValues.aoRadius;
2949
+ this.n8aopass.configuration.distanceFalloff = n8ssaoValues.distanceFalloff;
2950
+ this.n8aopass.configuration.intensity = n8ssaoValues.intensity;
2951
+ this.n8aopass.configuration.color = new Color6().setRGB(
2952
+ n8ssaoValues.color.r,
2953
+ n8ssaoValues.color.g,
2954
+ n8ssaoValues.color.b
2955
+ );
2956
+ this.n8aopass.configuration.aoSamples = n8ssaoValues.aoSamples;
2957
+ this.n8aopass.configuration.denoiseSamples = n8ssaoValues.denoiseSamples;
2958
+ this.n8aopass.configuration.denoiseRadius = n8ssaoValues.denoiseRadius;
2959
+ this.n8aopass.enabled = n8ssaoValues.enabled;
2731
2960
  this.fxaaPass = new EffectPass2(this.camera, this.fxaaEffect);
2732
2961
  this.bloomPass = new EffectPass2(this.camera, this.bloomEffect);
2733
- this.ssaoPass = new EffectPass2(this.camera, this.ssaoEffect, this.normalTextureEffect);
2734
- this.toneMappingEffect = new ToneMappingEffect2({
2735
- mode: composerValues.toneMapping.mode,
2736
- resolution: composerValues.toneMapping.resolution,
2737
- whitePoint: composerValues.toneMapping.whitePoint,
2738
- middleGrey: composerValues.toneMapping.middleGrey,
2739
- minLuminance: composerValues.toneMapping.minLuminance,
2740
- averageLuminance: composerValues.toneMapping.averageLuminance,
2741
- adaptationRate: composerValues.toneMapping.adaptationRate
2962
+ this.toneMappingEffect = new ToneMappingEffect({
2963
+ mode: toneMappingValues.mode,
2964
+ resolution: toneMappingValues.resolution,
2965
+ whitePoint: toneMappingValues.whitePoint,
2966
+ middleGrey: toneMappingValues.middleGrey,
2967
+ minLuminance: toneMappingValues.minLuminance,
2968
+ averageLuminance: toneMappingValues.averageLuminance,
2969
+ adaptationRate: toneMappingValues.adaptationRate
2742
2970
  });
2743
2971
  this.smaaEffect = new SMAAEffect({
2744
2972
  preset: SMAAPreset.ULTRA,
@@ -2746,16 +2974,21 @@ var Composer = class {
2746
2974
  predicationMode: PredicationMode.DEPTH
2747
2975
  });
2748
2976
  this.toneMappingPass = new EffectPass2(this.camera, this.toneMappingEffect);
2749
- this.toneMappingPass.enabled = composerValues.renderer.toneMapping === 5 || composerValues.renderer.toneMapping === 0 ? true : false;
2977
+ this.toneMappingPass.enabled = rendererValues.toneMapping === 5 || rendererValues.toneMapping === 0 ? true : false;
2750
2978
  this.bcsPass = new ShaderPass(this.bcs, "tDiffuse");
2751
- this.bcs.uniforms.brightness.value = composerValues.brightness;
2752
- this.bcs.uniforms.contrast.value = composerValues.contrast;
2753
- this.bcs.uniforms.saturation.value = composerValues.saturation;
2979
+ this.bcs.uniforms.brightness.value = bcsValues.brightness;
2980
+ this.bcs.uniforms.contrast.value = bcsValues.contrast;
2981
+ this.bcs.uniforms.saturation.value = bcsValues.saturation;
2754
2982
  this.gaussGrainPass = new ShaderPass(this.gaussGrainEffect, "tDiffuse");
2755
2983
  this.smaaPass = new EffectPass2(this.camera, this.smaaEffect);
2756
2984
  this.composer.addPass(this.renderPass);
2757
- this.composer.addPass(this.normalPass);
2758
- this.composer.addPass(this.ssaoPass);
2985
+ if (ppssaoValues.enabled) {
2986
+ this.composer.addPass(this.normalPass);
2987
+ this.composer.addPass(this.ppssaoPass);
2988
+ }
2989
+ if (n8ssaoValues.enabled) {
2990
+ this.composer.addPass(this.n8aopass);
2991
+ }
2759
2992
  this.composer.addPass(this.fxaaPass);
2760
2993
  this.composer.addPass(this.smaaPass);
2761
2994
  this.composer.addPass(this.bloomPass);
@@ -2767,7 +3000,11 @@ var Composer = class {
2767
3000
  this.scene.add(this.sun);
2768
3001
  }
2769
3002
  this.tweakPane.setupRenderPane(
2770
- this.ssaoEffect,
3003
+ this.composer,
3004
+ this.normalPass,
3005
+ this.ppssaoEffect,
3006
+ this.ppssaoPass,
3007
+ this.n8aopass,
2771
3008
  this.toneMappingEffect,
2772
3009
  this.toneMappingPass,
2773
3010
  this.bcs,
@@ -2788,8 +3025,14 @@ var Composer = class {
2788
3025
  this.resolution = new Vector22(this.width, this.height);
2789
3026
  this.composer.setSize(this.width, this.height);
2790
3027
  this.renderPass.setSize(this.width, this.height);
2791
- this.normalPass.setSize(this.width, this.height);
2792
- this.ssaoPass.setSize(this.width, this.height);
3028
+ if (ppssaoValues.enabled) {
3029
+ this.normalPass.setSize(this.width, this.height);
3030
+ this.normalTextureEffect.setSize(this.width, this.height);
3031
+ this.ppssaoPass.setSize(this.width, this.height);
3032
+ }
3033
+ if (n8ssaoValues.enabled) {
3034
+ this.n8aopass.setSize(this.width, this.height);
3035
+ }
2793
3036
  this.fxaaPass.setSize(this.width, this.height);
2794
3037
  this.smaaPass.setSize(this.width, this.height);
2795
3038
  this.bloomPass.setSize(this.width, this.height);
@@ -2824,7 +3067,7 @@ var Composer = class {
2824
3067
  envMap.needsUpdate = true;
2825
3068
  this.scene.environment = envMap;
2826
3069
  this.scene.background = envMap;
2827
- this.scene.backgroundIntensity = composerValues.renderer.bgIntensity;
3070
+ this.scene.backgroundIntensity = rendererValues.bgIntensity;
2828
3071
  this.isEnvHDRI = true;
2829
3072
  texture.dispose();
2830
3073
  pmremGenerator.dispose();