@takram/three-clouds 0.5.1 → 0.5.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.2] - 2025-11-01
4
+
5
+ ### Fixed
6
+
7
+ - Removed `three-stdlib` from dependencies to fix compatibility with importmaps.
8
+ - Reverted the TS target to `es2017` to fix incorrect code generation.
9
+
3
10
  ## [0.5.1] - 2025-11-01
4
11
 
5
12
  ### Changed
package/build/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./shared.cjs"),a=require("@takram/three-geospatial"),c=require("@takram/three-geospatial/shaders"),n=require("three");class g{size;needsRender=!0;material;mesh;renderTarget;camera=new n.Camera;constructor({size:t,fragmentShader:r}){this.size=t,this.material=new n.RawShaderMaterial({glslVersion:n.GLSL3,vertexShader:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./shared.cjs"),c=require("@takram/three-geospatial"),a=require("@takram/three-geospatial/shaders"),n=require("three");class g{constructor({size:t,fragmentShader:r}){this.needsRender=!0,this.camera=new n.Camera,this.size=t,this.material=new n.RawShaderMaterial({glslVersion:n.GLSL3,vertexShader:`
2
2
  in vec3 position;
3
3
  out vec2 vUv;
4
4
  void main() {
@@ -382,7 +382,7 @@ float getPerlinNoise(const vec3 point, const vec3 frequency, const int octaveCou
382
382
  float getPerlinNoise(const vec3 point, const float frequency, const int octaveCount) {
383
383
  return getPerlinNoise(point, vec3(frequency), octaveCount);
384
384
  }
385
- `;class u extends g{constructor(){super({size:o.CLOUD_SHAPE_TEXTURE_SIZE,fragmentShader:a.resolveIncludes(p,{core:{math:c.math},perlin:s,tileableNoise:l})})}}const v=`// Based on the following work with slight modifications.
385
+ `;class u extends g{constructor(){super({size:o.CLOUD_SHAPE_TEXTURE_SIZE,fragmentShader:c.resolveIncludes(p,{core:{math:a.math},perlin:s,tileableNoise:l})})}}const v=`// Based on the following work with slight modifications.
386
386
  // https://github.com/sebh/TileableVolumeNoise
387
387
 
388
388
  /**
@@ -438,7 +438,7 @@ void main() {
438
438
  );
439
439
  outputColor = dot(fbm, vec3(0.625, 0.25, 0.125));
440
440
  }
441
- `;class d extends g{constructor(){super({size:o.CLOUD_SHAPE_DETAIL_TEXTURE_SIZE,fragmentShader:a.resolveIncludes(v,{core:{math:c.math},perlin:s,tileableNoise:l})})}}class f{size;needsRender=!0;material;mesh;renderTarget;camera=new n.Camera;constructor({size:t,fragmentShader:r}){this.size=t,this.material=new n.RawShaderMaterial({glslVersion:n.GLSL3,vertexShader:`
441
+ `;class d extends g{constructor(){super({size:o.CLOUD_SHAPE_DETAIL_TEXTURE_SIZE,fragmentShader:c.resolveIncludes(v,{core:{math:a.math},perlin:s,tileableNoise:l})})}}class f{constructor({size:t,fragmentShader:r}){this.needsRender=!0,this.camera=new n.Camera,this.size=t,this.material=new n.RawShaderMaterial({glslVersion:n.GLSL3,vertexShader:`
442
442
  in vec3 position;
443
443
  out vec2 vUv;
444
444
  void main() {
@@ -528,7 +528,7 @@ void main() {
528
528
 
529
529
  outputColor.a = 1.0;
530
530
  }
531
- `;class T extends f{constructor(){super({size:512,fragmentShader:a.resolveIncludes(y,{core:{math:c.math},perlin:s,tileableNoise:l})})}}const h=`precision highp float;
531
+ `;class T extends f{constructor(){super({size:512,fragmentShader:c.resolveIncludes(y,{core:{math:a.math},perlin:s,tileableNoise:l})})}}const h=`precision highp float;
532
532
  precision highp int;
533
533
 
534
534
  #include "core/math"
@@ -579,5 +579,5 @@ void main() {
579
579
  outputColor.rgb = 0.5 * curl(point) + 0.5;
580
580
  outputColor.a = 1.0;
581
581
  }
582
- `;class E extends f{constructor(){super({size:128,fragmentShader:a.resolveIncludes(h,{core:{math:c.math},perlin:s,tileableNoise:l})})}}exports.CLOUD_SHAPE_DETAIL_TEXTURE_SIZE=o.CLOUD_SHAPE_DETAIL_TEXTURE_SIZE;exports.CLOUD_SHAPE_TEXTURE_SIZE=o.CLOUD_SHAPE_TEXTURE_SIZE;exports.CloudLayer=o.CloudLayer;exports.CloudLayers=o.CloudLayers;exports.CloudsEffect=o.CloudsEffect;exports.DEFAULT_LOCAL_WEATHER_URL=o.DEFAULT_LOCAL_WEATHER_URL;exports.DEFAULT_SHAPE_DETAIL_URL=o.DEFAULT_SHAPE_DETAIL_URL;exports.DEFAULT_SHAPE_URL=o.DEFAULT_SHAPE_URL;exports.DEFAULT_TURBULENCE_URL=o.DEFAULT_TURBULENCE_URL;exports.DensityProfile=o.DensityProfile;exports.cloudsPassOptionsDefaults=o.cloudsPassOptionsDefaults;exports.CloudShape=u;exports.CloudShapeDetail=d;exports.LocalWeather=T;exports.Procedural3DTextureBase=g;exports.ProceduralTextureBase=f;exports.Turbulence=E;
582
+ `;class E extends f{constructor(){super({size:128,fragmentShader:c.resolveIncludes(h,{core:{math:a.math},perlin:s,tileableNoise:l})})}}exports.CLOUD_SHAPE_DETAIL_TEXTURE_SIZE=o.CLOUD_SHAPE_DETAIL_TEXTURE_SIZE;exports.CLOUD_SHAPE_TEXTURE_SIZE=o.CLOUD_SHAPE_TEXTURE_SIZE;exports.CloudLayer=o.CloudLayer;exports.CloudLayers=o.CloudLayers;exports.CloudsEffect=o.CloudsEffect;exports.DEFAULT_LOCAL_WEATHER_URL=o.DEFAULT_LOCAL_WEATHER_URL;exports.DEFAULT_SHAPE_DETAIL_URL=o.DEFAULT_SHAPE_DETAIL_URL;exports.DEFAULT_SHAPE_URL=o.DEFAULT_SHAPE_URL;exports.DEFAULT_TURBULENCE_URL=o.DEFAULT_TURBULENCE_URL;exports.DensityProfile=o.DensityProfile;exports.cloudsPassOptionsDefaults=o.cloudsPassOptionsDefaults;exports.CloudShape=u;exports.CloudShapeDetail=d;exports.LocalWeather=T;exports.Procedural3DTextureBase=g;exports.ProceduralTextureBase=f;exports.Turbulence=E;
583
583
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/Procedural3DTexture.ts","../src/shaders/cloudShape.frag?raw","../src/shaders/perlin.glsl?raw","../src/shaders/tileableNoise.glsl?raw","../src/CloudShape.ts","../src/shaders/cloudShapeDetail.frag?raw","../src/CloudShapeDetail.ts","../src/ProceduralTexture.ts","../src/shaders/localWeather.frag?raw","../src/LocalWeather.ts","../src/shaders/turbulence.frag?raw","../src/Turbulence.ts"],"sourcesContent":null,"names":["Procedural3DTextureBase","Camera","size","fragmentShader","RawShaderMaterial","GLSL3","Uniform","Mesh","PlaneGeometry","WebGL3DRenderTarget","RedFormat","texture","LinearFilter","RepeatWrapping","NoColorSpace","renderer","deltaTime","layer","fragmentShader$3","perlin","tileableNoise","CloudShape","CLOUD_SHAPE_TEXTURE_SIZE","resolveIncludes","math","fragmentShader$2","CloudShapeDetail","CLOUD_SHAPE_DETAIL_TEXTURE_SIZE","ProceduralTextureBase","WebGLRenderTarget","RGBAFormat","LinearMipMapLinearFilter","fragmentShader$1","LocalWeather","Turbulence"],"mappings":"uNAyBO,MAAMA,CAAuD,CACzD,KACT,YAAc,GAEG,SACA,KACA,aACA,OAAS,IAAIC,EAAAA,OAE9B,YAAY,CAAE,KAAAC,EAAM,eAAAC,GAAqD,CACvE,KAAK,KAAOD,EACZ,KAAK,SAAW,IAAIE,oBAAkB,CACpC,YAAaC,EAAAA,MACb,aAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAQzB,eAAAF,EACA,SAAU,CACR,MAAO,IAAIG,EAAAA,QAAQ,CAAC,CAAA,CACtB,CACD,EACD,KAAK,KAAO,IAAIC,EAAAA,KAAK,IAAIC,EAAAA,cAAc,EAAG,CAAC,EAAG,KAAK,QAAQ,EAE3D,KAAK,aAAe,IAAIC,EAAAA,oBAAoBP,EAAMA,EAAMA,EAAM,CAC5D,YAAa,GACb,OAAQQ,EAAAA,SAAA,CACT,EACD,MAAMC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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECSR,MAAMC,UAAqBL,CAAsB,CACtD,aAAc,CACZ,MAAM,CACJ,KAAM,IACN,eAAgBL,EAAAA,gBAAgBpB,EAAgB,CAC9C,KAAM,CAAA,KAAEqB,EAAAA,IAAA,EACR,OAAAL,EACA,cAAAC,CAAA,CACD,CAAA,CACF,CACH,CACF,CCpBA,MAAAjB,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECSR,MAAM+B,UAAmBN,CAAsB,CACpD,aAAc,CACZ,MAAM,CACJ,KAAM,IACN,eAAgBL,EAAAA,gBAAgBpB,EAAgB,CAC9C,KAAM,CAAA,KAAEqB,EAAAA,IAAA,EACR,OAAAL,EACA,cAAAC,CAAA,CACD,CAAA,CACF,CACH,CACF"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/Procedural3DTexture.ts","../src/shaders/cloudShape.frag?raw","../src/shaders/perlin.glsl?raw","../src/shaders/tileableNoise.glsl?raw","../src/CloudShape.ts","../src/shaders/cloudShapeDetail.frag?raw","../src/CloudShapeDetail.ts","../src/ProceduralTexture.ts","../src/shaders/localWeather.frag?raw","../src/LocalWeather.ts","../src/shaders/turbulence.frag?raw","../src/Turbulence.ts"],"sourcesContent":null,"names":["Procedural3DTextureBase","size","fragmentShader","Camera","RawShaderMaterial","GLSL3","Uniform","Mesh","PlaneGeometry","WebGL3DRenderTarget","RedFormat","texture","LinearFilter","RepeatWrapping","NoColorSpace","renderer","deltaTime","layer","fragmentShader$3","perlin","tileableNoise","CloudShape","CLOUD_SHAPE_TEXTURE_SIZE","resolveIncludes","math","fragmentShader$2","CloudShapeDetail","CLOUD_SHAPE_DETAIL_TEXTURE_SIZE","ProceduralTextureBase","WebGLRenderTarget","RGBAFormat","LinearMipMapLinearFilter","fragmentShader$1","LocalWeather","Turbulence"],"mappings":"uNAyBO,MAAMA,CAAuD,CASlE,YAAY,CAAE,KAAAC,EAAM,eAAAC,GAAqD,CAPzE,KAAA,YAAc,GAKd,KAAiB,OAAS,IAAIC,SAG5B,KAAK,KAAOF,EACZ,KAAK,SAAW,IAAIG,oBAAkB,CACpC,YAAaC,EAAAA,MACb,aAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAQzB,eAAAH,EACA,SAAU,CACR,MAAO,IAAII,EAAAA,QAAQ,CAAC,CAAA,CACtB,CACD,EACD,KAAK,KAAO,IAAIC,EAAAA,KAAK,IAAIC,EAAAA,cAAc,EAAG,CAAC,EAAG,KAAK,QAAQ,EAE3D,KAAK,aAAe,IAAIC,EAAAA,oBAAoBR,EAAMA,EAAMA,EAAM,CAC5D,YAAa,GACb,OAAQS,EAAAA,SAAA,CACT,EACD,MAAMC,EAAU,KAAK,aAAa,QAClCA,EAAQ,UAAYC,EAAAA,aACpBD,EAAQ,UAAYC,EAAAA,aACpBD,EAAQ,MAAQE,EAAAA,eAChBF,EAAQ,MAAQE,EAAAA,eAChBF,EAAQ,MAAQE,EAAAA,eAChBF,EAAQ,WAAaG,E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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECSR,MAAMC,UAAqBL,CAAsB,CACtD,aAAc,CACZ,MAAM,CACJ,KAAM,IACN,eAAgBL,EAAAA,gBAAgBrB,EAAgB,CAC9C,KAAM,CAAA,KAAEsB,EAAAA,IAAA,EACR,OAAAL,EACA,cAAAC,CAAA,CACD,CAAA,CACF,CACH,CACF,CCpBA,MAAAlB,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECSR,MAAMgC,UAAmBN,CAAsB,CACpD,aAAc,CACZ,MAAM,CACJ,KAAM,IACN,eAAgBL,EAAAA,gBAAgBrB,EAAgB,CAC9C,KAAM,CAAA,KAAEsB,EAAAA,IAAA,EACR,OAAAL,EACA,cAAAC,CAAA,CACD,CAAA,CACF,CACH,CACF"}
package/build/index.js CHANGED
@@ -4,14 +4,8 @@ import { resolveIncludes as r } from "@takram/three-geospatial";
4
4
  import { math as c } from "@takram/three-geospatial/shaders";
5
5
  import { Camera as g, RawShaderMaterial as f, Uniform as p, GLSL3 as v, Mesh as u, PlaneGeometry as y, WebGL3DRenderTarget as E, RedFormat as I, LinearFilter as l, RepeatWrapping as i, NoColorSpace as d, WebGLRenderTarget as R, RGBAFormat as x, LinearMipMapLinearFilter as O } from "three";
6
6
  class T {
7
- size;
8
- needsRender = !0;
9
- material;
10
- mesh;
11
- renderTarget;
12
- camera = new g();
13
7
  constructor({ size: e, fragmentShader: o }) {
14
- this.size = e, this.material = new f({
8
+ this.needsRender = !0, this.camera = new g(), this.size = e, this.material = new f({
15
9
  glslVersion: v,
16
10
  vertexShader: (
17
11
  /* glsl */
@@ -128,7 +122,7 @@ void main() {
128
122
  float worleyFbm = getWorleyFbm(point);
129
123
  outputColor = remap(perlinWorley, worleyFbm - 1.0, 1.0);
130
124
  }
131
- `, a = `// Ported from GLM: https://github.com/g-truc/glm/blob/master/glm/gtc/noise.inl
125
+ `, s = `// Ported from GLM: https://github.com/g-truc/glm/blob/master/glm/gtc/noise.inl
132
126
 
133
127
  /**
134
128
  * OpenGL Mathematics (GLM)
@@ -339,7 +333,7 @@ float perlin(const vec4 position, const vec4 rep) {
339
333
  float n_xyzw = mix(n_yzw.x, n_yzw.y, fade_xyzw.x);
340
334
  return 2.2 * n_xyzw;
341
335
  }
342
- `, s = `// Based on the following work with slight modifications.
336
+ `, a = `// Based on the following work with slight modifications.
343
337
  // https://github.com/sebh/TileableVolumeNoise
344
338
 
345
339
  /**
@@ -434,8 +428,8 @@ class b extends T {
434
428
  size: m,
435
429
  fragmentShader: r(N, {
436
430
  core: { math: c },
437
- perlin: a,
438
- tileableNoise: s
431
+ perlin: s,
432
+ tileableNoise: a
439
433
  })
440
434
  });
441
435
  }
@@ -503,21 +497,15 @@ class F extends T {
503
497
  size: w,
504
498
  fragmentShader: r(S, {
505
499
  core: { math: c },
506
- perlin: a,
507
- tileableNoise: s
500
+ perlin: s,
501
+ tileableNoise: a
508
502
  })
509
503
  });
510
504
  }
511
505
  }
512
506
  class h {
513
- size;
514
- needsRender = !0;
515
- material;
516
- mesh;
517
- renderTarget;
518
- camera = new g();
519
507
  constructor({ size: e, fragmentShader: o }) {
520
- this.size = e, this.material = new f({
508
+ this.needsRender = !0, this.camera = new g(), this.size = e, this.material = new f({
521
509
  glslVersion: v,
522
510
  vertexShader: (
523
511
  /* glsl */
@@ -641,8 +629,8 @@ class U extends h {
641
629
  size: 512,
642
630
  fragmentShader: r(A, {
643
631
  core: { math: c },
644
- perlin: a,
645
- tileableNoise: s
632
+ perlin: s,
633
+ tileableNoise: a
646
634
  })
647
635
  });
648
636
  }
@@ -705,8 +693,8 @@ class W extends h {
705
693
  size: 128,
706
694
  fragmentShader: r(P, {
707
695
  core: { math: c },
708
- perlin: a,
709
- tileableNoise: s
696
+ perlin: s,
697
+ tileableNoise: a
710
698
  })
711
699
  });
712
700
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/Procedural3DTexture.ts","../src/shaders/cloudShape.frag?raw","../src/shaders/perlin.glsl?raw","../src/shaders/tileableNoise.glsl?raw","../src/CloudShape.ts","../src/shaders/cloudShapeDetail.frag?raw","../src/CloudShapeDetail.ts","../src/ProceduralTexture.ts","../src/shaders/localWeather.frag?raw","../src/LocalWeather.ts","../src/shaders/turbulence.frag?raw","../src/Turbulence.ts"],"sourcesContent":null,"names":["Procedural3DTextureBase","Camera","size","fragmentShader","RawShaderMaterial","GLSL3","Uniform","Mesh","PlaneGeometry","WebGL3DRenderTarget","RedFormat","texture","LinearFilter","RepeatWrapping","NoColorSpace","renderer","deltaTime","layer","fragmentShader$3","perlin","tileableNoise","CloudShape","CLOUD_SHAPE_TEXTURE_SIZE","resolveIncludes","math","fragmentShader$2","CloudShapeDetail","CLOUD_SHAPE_DETAIL_TEXTURE_SIZE","ProceduralTextureBase","WebGLRenderTarget","RGBAFormat","LinearMipMapLinearFilter","fragmentShader$1","LocalWeather","Turbulence"],"mappings":";;;;;AAyBO,MAAMA,EAAuD;AAAA,EACzD;AAAA,EACT,cAAc;AAAA,EAEG;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,IAAIC,EAAA;AAAA,EAE9B,YAAY,EAAE,MAAAC,GAAM,gBAAAC,KAAqD;AACvE,SAAK,OAAOD,GACZ,KAAK,WAAW,IAAIE,EAAkB;AAAA,MACpC,aAAaC;AAAA,MACb;AAAA;AAA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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACSR,MAAM+B,UAAmBN,EAAsB;AAAA,EACpD,cAAc;AACZ,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,gBAAgBL,EAAgBpB,GAAgB;AAAA,QAC9C,MAAM,EAAE,MAAAqB,EAAA;AAAA,QACR,QAAAL;AAAA,QACA,eAAAC;AAAA,MAAA,CACD;AAAA,IAAA,CACF;AAAA,EACH;AACF;"}
1
+ {"version":3,"file":"index.js","sources":["../src/Procedural3DTexture.ts","../src/shaders/cloudShape.frag?raw","../src/shaders/perlin.glsl?raw","../src/shaders/tileableNoise.glsl?raw","../src/CloudShape.ts","../src/shaders/cloudShapeDetail.frag?raw","../src/CloudShapeDetail.ts","../src/ProceduralTexture.ts","../src/shaders/localWeather.frag?raw","../src/LocalWeather.ts","../src/shaders/turbulence.frag?raw","../src/Turbulence.ts"],"sourcesContent":null,"names":["Procedural3DTextureBase","size","fragmentShader","Camera","RawShaderMaterial","GLSL3","Uniform","Mesh","PlaneGeometry","WebGL3DRenderTarget","RedFormat","texture","LinearFilter","RepeatWrapping","NoColorSpace","renderer","deltaTime","layer","fragmentShader$3","perlin","tileableNoise","CloudShape","CLOUD_SHAPE_TEXTURE_SIZE","resolveIncludes","math","fragmentShader$2","CloudShapeDetail","CLOUD_SHAPE_DETAIL_TEXTURE_SIZE","ProceduralTextureBase","WebGLRenderTarget","RGBAFormat","LinearMipMapLinearFilter","fragmentShader$1","LocalWeather","Turbulence"],"mappings":";;;;;AAyBO,MAAMA,EAAuD;AAAA,EASlE,YAAY,EAAE,MAAAC,GAAM,gBAAAC,KAAqD;AAPzE,SAAA,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;AACF;ACpBA,MAAAlB,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACSR,MAAMgC,UAAmBN,EAAsB;AAAA,EACpD,cAAc;AACZ,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,gBAAgBL,EAAgBrB,GAAgB;AAAA,QAC9C,MAAM,EAAE,MAAAsB,EAAA;AAAA,QACR,QAAAL;AAAA,QACA,eAAAC;AAAA,MAAA,CACD;AAAA,IAAA,CACF;AAAA,EACH;AACF;"}
package/build/shared.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";const w=require("postprocessing"),n=require("three"),F=require("@takram/three-atmosphere"),u=require("@takram/three-geospatial"),P=require("@takram/three-atmosphere/shaders/bruneton"),S=require("@takram/three-geospatial/shaders");class N{constructor(e=0,t=0,a=0,r=0){this.expTerm=e,this.exponent=t,this.linearTerm=a,this.constantTerm=r}set(e=0,t=0,a=0,r=0){return this.expTerm=e,this.exponent=t,this.linearTerm=a,this.constantTerm=r,this}clone(){return new N(this.expTerm,this.exponent,this.linearTerm,this.constantTerm)}copy(e){return this.expTerm=e.expTerm,this.exponent=e.exponent,this.linearTerm=e.linearTerm,this.constantTerm=e.constantTerm,this}}const pe=["channel","altitude","height","densityScale","shapeAmount","shapeDetailAmount","weatherExponent","shapeAlteringBias","coverageFilterWidth","shadow","densityProfile"];function fe(o,e){if(e!=null)for(const t of pe){const a=e[t];a!=null&&(o[t]instanceof N?o[t].copy(a):o[t]=a)}}class g{static DEFAULT=new g;channel="r";altitude=0;height=0;densityScale=.2;shapeAmount=1;shapeDetailAmount=1;weatherExponent=1;shapeAlteringBias=.35;coverageFilterWidth=.6;densityProfile=new N(0,0,.75,.25);shadow=!1;constructor(e){this.set(e)}set(e){return fe(this,e),this}clone(){return new g(this)}copy(e){return this.channel=e.channel,this.altitude=e.altitude,this.height=e.height,this.densityScale=e.densityScale,this.shapeAmount=e.shapeAmount,this.shapeDetailAmount=e.shapeDetailAmount,this.weatherExponent=e.weatherExponent,this.shapeAlteringBias=e.shapeAlteringBias,this.coverageFilterWidth=e.coverageFilterWidth,this.densityProfile.copy(e.densityProfile),this.shadow=e.shadow,this}}const O=Array.from({length:8},()=>({value:0,flag:0})),L=Array.from({length:3},()=>({min:0,max:0}));function me(o,e){return o.value!==e.value?o.value-e.value:o.flag-e.flag}class M extends Array{static DEFAULT=new M([{channel:"r",altitude:750,height:650,densityScale:.2,shapeAmount:1,shapeDetailAmount:1,weatherExponent:1,shapeAlteringBias:.35,coverageFilterWidth:.6,shadow:!0},{channel:"g",altitude:1e3,height:1200,densityScale:.2,shapeAmount:1,shapeDetailAmount:1,weatherExponent:1,shapeAlteringBias:.35,coverageFilterWidth:.6,shadow:!0},{channel:"b",altitude:7500,height:500,densityScale:.003,shapeAmount:.4,shapeDetailAmount:0,weatherExponent:1,shapeAlteringBias:.35,coverageFilterWidth:.5},{channel:"a"}]);constructor(e){super(new g(e?.[0]),new g(e?.[1]),new g(e?.[2]),new g(e?.[3]))}set(e){return this[0].set(e?.[0]),this[1].set(e?.[1]),this[2].set(e?.[2]),this[3].set(e?.[3]),this}reset(){return this[0].copy(g.DEFAULT),this[1].copy(g.DEFAULT),this[2].copy(g.DEFAULT),this[3].copy(g.DEFAULT),this}clone(){return new M(this)}copy(e){return this[0].copy(e[0]),this[1].copy(e[1]),this[2].copy(e[2]),this[3].copy(e[3]),this}get localWeatherChannels(){return this[0].channel+this[1].channel+this[2].channel+this[3].channel}packValues(e,t){return t.set(this[0][e],this[1][e],this[2][e],this[3][e])}packSums(e,t,a){return a.set(this[0][e]+this[0][t],this[1][e]+this[1][t],this[2][e]+this[2][t],this[3][e]+this[3][t])}packDensityProfiles(e,t){return t.set(this[0].densityProfile[e],this[1].densityProfile[e],this[2].densityProfile[e],this[3].densityProfile[e])}packIntervalHeights(e,t){for(let s=0;s<4;++s){const l=this[s];let h=O[s];h.value=l.altitude,h.flag=0,h=O[s+4],h.value=l.altitude+l.height,h.flag=1}O.sort(me);let a=0,r=0;for(let s=0;s<O.length;++s){const{value:l,flag:h}=O[s];if(r===0&&s>0){const d=L[a++];d.min=O[s-1].value,d.max=l}r+=h===0?1:-1}for(;a<3;++a){const s=L[a];s.min=0,s.max=0}let i=L[0];e.x=i.min,t.x=i.max,i=L[1],e.y=i.min,t.y=i.max,i=L[2],e.z=i.min,t.z=i.max}}var ve=process.env.NODE_ENV==="production",X="Invariant failed";function D(o,e){if(!o){if(ve)throw new Error(X);var t=X;throw new Error(t)}}class I{near=[new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3];far=[new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3];constructor(e,t){e!=null&&t!=null&&this.setFromCamera(e,t)}clone(){return new I().copy(this)}copy(e){for(let t=0;t<4;++t)this.near[t].copy(e.near[t]),this.far[t].copy(e.far[t]);return this}setFromCamera(e,t){const a=e.isOrthographicCamera===!0,r=e.projectionMatrixInverse;this.near[0].set(1,1,-1),this.near[1].set(1,-1,-1),this.near[2].set(-1,-1,-1),this.near[3].set(-1,1,-1);for(let i=0;i<4;++i)this.near[i].applyMatrix4(r);this.far[0].set(1,1,1),this.far[1].set(1,-1,1),this.far[2].set(-1,-1,1),this.far[3].set(-1,1,1);for(let i=0;i<4;++i){const s=this.far[i];s.applyMatrix4(r);const l=Math.abs(s.z);a?s.z*=Math.min(t/l,1):s.multiplyScalar(Math.min(t/l,1))}return this}split(e,t=[]){for(let a=0;a<e.length;++a){const r=t[a]??=new I;if(a===0)for(let i=0;i<4;++i)r.near[i].copy(this.near[i]);else for(let i=0;i<4;++i)r.near[i].lerpVectors(this.near[i],this.far[i],e[a-1]);if(a===e.length-1)for(let i=0;i<4;++i)r.far[i].copy(this.far[i]);else for(let i=0;i<4;++i)r.far[i].lerpVectors(this.near[i],this.far[i],e[a])}return t.length=e.length,t}applyMatrix4(e){for(let t=0;t<4;++t)this.near[t].applyMatrix4(e),this.far[t].applyMatrix4(e);return this}}const ge={uniform:(o,e,t,a,r=[])=>{for(let i=0;i<o;++i)r[i]=(e+(t-e)*(i+1)/o)/t;return r.length=o,r},logarithmic:(o,e,t,a,r=[])=>{for(let i=0;i<o;++i)r[i]=e*(t/e)**((i+1)/o)/t;return r.length=o,r},practical:(o,e,t,a=.5,r=[])=>{for(let i=0;i<o;++i){const s=(e+(t-e)*(i+1)/o)/t,l=e*(t/e)**((i+1)/o)/t;r[i]=u.lerp(s,l,a)}return r.length=o,r}};function Se(o,e,t,a,r,i=[]){return ge[o](e,t,a,r,i)}const $=new n.Vector3,J=new n.Vector3,ye=new n.Matrix4,Q=new n.Matrix4,xe=new I,we=new n.Box3,Te={maxFar:null,farScale:1,splitMode:"practical",splitLambda:.5,margin:0,fade:!0};class Ce{cascades=[];mapSize=new n.Vector2;maxFar;farScale;splitMode;splitLambda;margin;fade;cameraFrustum=new I;frusta=[];splits=[];_far=0;constructor(e){const{cascadeCount:t,mapSize:a,maxFar:r,farScale:i,splitMode:s,splitLambda:l,margin:h,fade:d}={...Te,...e};this.cascadeCount=t,this.mapSize.copy(a),this.maxFar=r,this.farScale=i,this.splitMode=s,this.splitLambda=l,this.margin=h,this.fade=d}get cascadeCount(){return this.cascades.length}set cascadeCount(e){if(e!==this.cascadeCount){for(let t=0;t<e;++t)this.cascades[t]??={interval:new n.Vector2,matrix:new n.Matrix4,inverseMatrix:new n.Matrix4,projectionMatrix:new n.Matrix4,inverseProjectionMatrix:new n.Matrix4,viewMatrix:new n.Matrix4,inverseViewMatrix:new n.Matrix4};this.cascades.length=e}}get far(){return this._far}updateIntervals(e){const t=this.cascadeCount,a=this.splits,r=this.far;Se(this.splitMode,t,e.near,r,this.splitLambda,a),this.cameraFrustum.setFromCamera(e,r),this.cameraFrustum.split(a,this.frusta);const i=this.cascades;for(let s=0;s<t;++s)i[s].interval.set(a[s-1]??0,a[s]??0)}getFrustumRadius(e,t){const a=t.near,r=t.far;let i=Math.max(r[0].distanceTo(r[2]),r[0].distanceTo(a[2]));if(this.fade){const s=e.near,l=this.far,h=r[0].z/(l-s);i+=.25*h**2*(l-s)}return i*.5}updateMatrices(e,t,a=1){const r=ye.lookAt($.setScalar(0),J.copy(t).multiplyScalar(-1),n.Object3D.DEFAULT_UP),i=Q.multiplyMatrices(Q.copy(r).invert(),e.matrixWorld),s=this.frusta,l=this.cascades;D(s.length===l.length);const h=this.margin,d=this.mapSize;for(let p=0;p<s.length;++p){const f=s[p],y=l[p],T=this.getFrustumRadius(e,s[p]),A=-T,_=T,j=T,Y=-T;y.projectionMatrix.makeOrthographic(A,_,j,Y,-this.margin,T*2+this.margin);const{near:he,far:de}=xe.copy(f).applyMatrix4(i),b=we.makeEmpty();for(let H=0;H<4;H++)b.expandByPoint(he[H]),b.expandByPoint(de[H]);const C=b.getCenter($);C.z=b.max.z+h;const Z=(_-A)/d.width,q=(j-Y)/d.height;C.x=Math.round(C.x/Z)*Z,C.y=Math.round(C.y/q)*q,C.applyMatrix4(r);const K=J.copy(t).multiplyScalar(a).add(C);y.inverseViewMatrix.lookAt(C,K,n.Object3D.DEFAULT_UP).setPosition(K)}}update(e,t,a){this._far=this.maxFar!=null?Math.min(this.maxFar,e.far*this.farScale):e.far*this.farScale,this.updateIntervals(e),this.updateMatrices(e,t,a);const r=this.cascades,i=this.cascadeCount;for(let s=0;s<i;++s){const{matrix:l,inverseMatrix:h,projectionMatrix:d,inverseProjectionMatrix:p,viewMatrix:f,inverseViewMatrix:y}=r[s];p.copy(d).invert(),f.copy(y).invert(),l.copy(d).multiply(f),h.copy(y).multiply(p)}}}const ee=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5],ne=ee.reduce((o,e,t)=>{const a=new n.Vector2;for(let r=0;r<16;++r)if(ee[r]===t){a.set((r%4+.5)/4,(Math.floor(r/4)+.5)/4);break}return[...o,a]},[]),De={resolutionScale:1,lightShafts:!0,shapeDetail:!0,turbulence:!0,haze:!0,clouds:{multiScatteringOctaves:8,accurateSunSkyLight:!0,accuratePhaseFunction:!1,maxIterationCount:500,minStepSize:50,maxStepSize:1e3,maxRayDistance:2e5,perspectiveStepScale:1.01,minDensity:1e-5,minExtinction:1e-5,minTransmittance:.01,maxIterationCountToGround:3,maxIterationCountToSun:2,minSecondaryStepSize:100,secondaryStepScale:2,maxShadowLengthIterationCount:500,minShadowLengthStepSize:50,maxShadowLengthRayDistance:2e5},shadow:{cascadeCount:3,mapSize:new n.Vector2(512,512),maxIterationCount:50,minStepSize:100,maxStepSize:1e3,minDensity:1e-5,minExtinction:1e-5,minTransmittance:1e-4}},c=De,Ee={low:{...c,lightShafts:!1,shapeDetail:!1,turbulence:!1,clouds:{...c.clouds,accurateSunSkyLight:!1,maxIterationCount:200,minStepSize:100,maxRayDistance:1e5,minDensity:1e-4,minExtinction:1e-4,minTransmittance:.1,maxIterationCountToGround:0,maxIterationCountToSun:1},shadow:{...c.shadow,maxIterationCount:25,minDensity:1e-4,minExtinction:1e-4,minTransmittance:.01,cascadeCount:2,mapSize:new n.Vector2(256,256)}},medium:{...c,lightShafts:!1,turbulence:!1,clouds:{...c.clouds,minDensity:1e-4,minExtinction:1e-4,accurateSunSkyLight:!1,maxIterationCountToSun:2,maxIterationCountToGround:1},shadow:{...c.shadow,minDensity:1e-4,minExtinction:1e-4,mapSize:new n.Vector2(256,256)}},high:c,ultra:{...c,clouds:{...c.clouds,minStepSize:10},shadow:{...c.shadow,mapSize:new n.Vector2(1024,1024)}}},Ae=`precision highp float;
1
+ "use strict";const w=require("postprocessing"),n=require("three"),z=require("@takram/three-atmosphere"),u=require("@takram/three-geospatial"),P=require("@takram/three-atmosphere/shaders/bruneton"),g=require("@takram/three-geospatial/shaders");class b{constructor(e=0,t=0,a=0,i=0){this.expTerm=e,this.exponent=t,this.linearTerm=a,this.constantTerm=i}set(e=0,t=0,a=0,i=0){return this.expTerm=e,this.exponent=t,this.linearTerm=a,this.constantTerm=i,this}clone(){return new b(this.expTerm,this.exponent,this.linearTerm,this.constantTerm)}copy(e){return this.expTerm=e.expTerm,this.exponent=e.exponent,this.linearTerm=e.linearTerm,this.constantTerm=e.constantTerm,this}}const me=["channel","altitude","height","densityScale","shapeAmount","shapeDetailAmount","weatherExponent","shapeAlteringBias","coverageFilterWidth","shadow","densityProfile"];function ve(o,e){if(e!=null)for(const t of me){const a=e[t];a!=null&&(o[t]instanceof b?o[t].copy(a):o[t]=a)}}const I=class I{constructor(e){this.channel="r",this.altitude=0,this.height=0,this.densityScale=.2,this.shapeAmount=1,this.shapeDetailAmount=1,this.weatherExponent=1,this.shapeAlteringBias=.35,this.coverageFilterWidth=.6,this.densityProfile=new b(0,0,.75,.25),this.shadow=!1,this.set(e)}set(e){return ve(this,e),this}clone(){return new I(this)}copy(e){return this.channel=e.channel,this.altitude=e.altitude,this.height=e.height,this.densityScale=e.densityScale,this.shapeAmount=e.shapeAmount,this.shapeDetailAmount=e.shapeDetailAmount,this.weatherExponent=e.weatherExponent,this.shapeAlteringBias=e.shapeAlteringBias,this.coverageFilterWidth=e.coverageFilterWidth,this.densityProfile.copy(e.densityProfile),this.shadow=e.shadow,this}};I.DEFAULT=new I;let S=I;const O=Array.from({length:8},()=>({value:0,flag:0})),L=Array.from({length:3},()=>({min:0,max:0}));function ge(o,e){return o.value!==e.value?o.value-e.value:o.flag-e.flag}const M=class M extends Array{constructor(e){super(new S(e?.[0]),new S(e?.[1]),new S(e?.[2]),new S(e?.[3]))}set(e){return this[0].set(e?.[0]),this[1].set(e?.[1]),this[2].set(e?.[2]),this[3].set(e?.[3]),this}reset(){return this[0].copy(S.DEFAULT),this[1].copy(S.DEFAULT),this[2].copy(S.DEFAULT),this[3].copy(S.DEFAULT),this}clone(){return new M(this)}copy(e){return this[0].copy(e[0]),this[1].copy(e[1]),this[2].copy(e[2]),this[3].copy(e[3]),this}get localWeatherChannels(){return this[0].channel+this[1].channel+this[2].channel+this[3].channel}packValues(e,t){return t.set(this[0][e],this[1][e],this[2][e],this[3][e])}packSums(e,t,a){return a.set(this[0][e]+this[0][t],this[1][e]+this[1][t],this[2][e]+this[2][t],this[3][e]+this[3][t])}packDensityProfiles(e,t){return t.set(this[0].densityProfile[e],this[1].densityProfile[e],this[2].densityProfile[e],this[3].densityProfile[e])}packIntervalHeights(e,t){for(let s=0;s<4;++s){const l=this[s];let h=O[s];h.value=l.altitude,h.flag=0,h=O[s+4],h.value=l.altitude+l.height,h.flag=1}O.sort(ge);let a=0,i=0;for(let s=0;s<O.length;++s){const{value:l,flag:h}=O[s];if(i===0&&s>0){const d=L[a++];d.min=O[s-1].value,d.max=l}i+=h===0?1:-1}for(;a<3;++a){const s=L[a];s.min=0,s.max=0}let r=L[0];e.x=r.min,t.x=r.max,r=L[1],e.y=r.min,t.y=r.max,r=L[2],e.z=r.min,t.z=r.max}};M.DEFAULT=new M([{channel:"r",altitude:750,height:650,densityScale:.2,shapeAmount:1,shapeDetailAmount:1,weatherExponent:1,shapeAlteringBias:.35,coverageFilterWidth:.6,shadow:!0},{channel:"g",altitude:1e3,height:1200,densityScale:.2,shapeAmount:1,shapeDetailAmount:1,weatherExponent:1,shapeAlteringBias:.35,coverageFilterWidth:.6,shadow:!0},{channel:"b",altitude:7500,height:500,densityScale:.003,shapeAmount:.4,shapeDetailAmount:0,weatherExponent:1,shapeAlteringBias:.35,coverageFilterWidth:.5},{channel:"a"}]);let W=M;var Se=process.env.NODE_ENV==="production",J="Invariant failed";function D(o,e){if(!o){if(Se)throw new Error(J);var t=J;throw new Error(t)}}class N{constructor(e,t){this.near=[new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3],this.far=[new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3],e!=null&&t!=null&&this.setFromCamera(e,t)}clone(){return new N().copy(this)}copy(e){for(let t=0;t<4;++t)this.near[t].copy(e.near[t]),this.far[t].copy(e.far[t]);return this}setFromCamera(e,t){const a=e.isOrthographicCamera===!0,i=e.projectionMatrixInverse;this.near[0].set(1,1,-1),this.near[1].set(1,-1,-1),this.near[2].set(-1,-1,-1),this.near[3].set(-1,1,-1);for(let r=0;r<4;++r)this.near[r].applyMatrix4(i);this.far[0].set(1,1,1),this.far[1].set(1,-1,1),this.far[2].set(-1,-1,1),this.far[3].set(-1,1,1);for(let r=0;r<4;++r){const s=this.far[r];s.applyMatrix4(i);const l=Math.abs(s.z);a?s.z*=Math.min(t/l,1):s.multiplyScalar(Math.min(t/l,1))}return this}split(e,t=[]){for(let a=0;a<e.length;++a){const i=t[a]??=new N;if(a===0)for(let r=0;r<4;++r)i.near[r].copy(this.near[r]);else for(let r=0;r<4;++r)i.near[r].lerpVectors(this.near[r],this.far[r],e[a-1]);if(a===e.length-1)for(let r=0;r<4;++r)i.far[r].copy(this.far[r]);else for(let r=0;r<4;++r)i.far[r].lerpVectors(this.near[r],this.far[r],e[a])}return t.length=e.length,t}applyMatrix4(e){for(let t=0;t<4;++t)this.near[t].applyMatrix4(e),this.far[t].applyMatrix4(e);return this}}const ye={uniform:(o,e,t,a,i=[])=>{for(let r=0;r<o;++r)i[r]=(e+(t-e)*(r+1)/o)/t;return i.length=o,i},logarithmic:(o,e,t,a,i=[])=>{for(let r=0;r<o;++r)i[r]=e*(t/e)**((r+1)/o)/t;return i.length=o,i},practical:(o,e,t,a=.5,i=[])=>{for(let r=0;r<o;++r){const s=(e+(t-e)*(r+1)/o)/t,l=e*(t/e)**((r+1)/o)/t;i[r]=u.lerp(s,l,a)}return i.length=o,i}};function xe(o,e,t,a,i,r=[]){return ye[o](e,t,a,i,r)}const Q=new n.Vector3,ee=new n.Vector3,we=new n.Matrix4,te=new n.Matrix4,Ce=new N,Te=new n.Box3,De={maxFar:null,farScale:1,splitMode:"practical",splitLambda:.5,margin:0,fade:!0};class Ee{constructor(e){this.cascades=[],this.mapSize=new n.Vector2,this.cameraFrustum=new N,this.frusta=[],this.splits=[],this._far=0;const{cascadeCount:t,mapSize:a,maxFar:i,farScale:r,splitMode:s,splitLambda:l,margin:h,fade:d}={...De,...e};this.cascadeCount=t,this.mapSize.copy(a),this.maxFar=i,this.farScale=r,this.splitMode=s,this.splitLambda=l,this.margin=h,this.fade=d}get cascadeCount(){return this.cascades.length}set cascadeCount(e){if(e!==this.cascadeCount){for(let t=0;t<e;++t)this.cascades[t]??={interval:new n.Vector2,matrix:new n.Matrix4,inverseMatrix:new n.Matrix4,projectionMatrix:new n.Matrix4,inverseProjectionMatrix:new n.Matrix4,viewMatrix:new n.Matrix4,inverseViewMatrix:new n.Matrix4};this.cascades.length=e}}get far(){return this._far}updateIntervals(e){const t=this.cascadeCount,a=this.splits,i=this.far;xe(this.splitMode,t,e.near,i,this.splitLambda,a),this.cameraFrustum.setFromCamera(e,i),this.cameraFrustum.split(a,this.frusta);const r=this.cascades;for(let s=0;s<t;++s)r[s].interval.set(a[s-1]??0,a[s]??0)}getFrustumRadius(e,t){const a=t.near,i=t.far;let r=Math.max(i[0].distanceTo(i[2]),i[0].distanceTo(a[2]));if(this.fade){const s=e.near,l=this.far,h=i[0].z/(l-s);r+=.25*h**2*(l-s)}return r*.5}updateMatrices(e,t,a=1){const i=we.lookAt(Q.setScalar(0),ee.copy(t).multiplyScalar(-1),n.Object3D.DEFAULT_UP),r=te.multiplyMatrices(te.copy(i).invert(),e.matrixWorld),s=this.frusta,l=this.cascades;D(s.length===l.length);const h=this.margin,d=this.mapSize;for(let p=0;p<s.length;++p){const f=s[p],y=l[p],C=this.getFrustumRadius(e,s[p]),A=-C,_=C,Z=C,q=-C;y.projectionMatrix.makeOrthographic(A,_,Z,q,-this.margin,C*2+this.margin);const{near:pe,far:fe}=Ce.copy(f).applyMatrix4(r),H=Te.makeEmpty();for(let F=0;F<4;F++)H.expandByPoint(pe[F]),H.expandByPoint(fe[F]);const T=H.getCenter(Q);T.z=H.max.z+h;const K=(_-A)/d.width,X=(Z-q)/d.height;T.x=Math.round(T.x/K)*K,T.y=Math.round(T.y/X)*X,T.applyMatrix4(i);const $=ee.copy(t).multiplyScalar(a).add(T);y.inverseViewMatrix.lookAt(T,$,n.Object3D.DEFAULT_UP).setPosition($)}}update(e,t,a){this._far=this.maxFar!=null?Math.min(this.maxFar,e.far*this.farScale):e.far*this.farScale,this.updateIntervals(e),this.updateMatrices(e,t,a);const i=this.cascades,r=this.cascadeCount;for(let s=0;s<r;++s){const{matrix:l,inverseMatrix:h,projectionMatrix:d,inverseProjectionMatrix:p,viewMatrix:f,inverseViewMatrix:y}=i[s];p.copy(d).invert(),f.copy(y).invert(),l.copy(d).multiply(f),h.copy(y).multiply(p)}}}const ne=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5],ie=ne.reduce((o,e,t)=>{const a=new n.Vector2;for(let i=0;i<16;++i)if(ne[i]===t){a.set((i%4+.5)/4,(Math.floor(i/4)+.5)/4);break}return[...o,a]},[]),Ae={resolutionScale:1,lightShafts:!0,shapeDetail:!0,turbulence:!0,haze:!0,clouds:{multiScatteringOctaves:8,accurateSunSkyLight:!0,accuratePhaseFunction:!1,maxIterationCount:500,minStepSize:50,maxStepSize:1e3,maxRayDistance:2e5,perspectiveStepScale:1.01,minDensity:1e-5,minExtinction:1e-5,minTransmittance:.01,maxIterationCountToGround:3,maxIterationCountToSun:2,minSecondaryStepSize:100,secondaryStepScale:2,maxShadowLengthIterationCount:500,minShadowLengthStepSize:50,maxShadowLengthRayDistance:2e5},shadow:{cascadeCount:3,mapSize:new n.Vector2(512,512),maxIterationCount:50,minStepSize:100,maxStepSize:1e3,minDensity:1e-5,minExtinction:1e-5,minTransmittance:1e-4}},c=Ae,_e={low:{...c,lightShafts:!1,shapeDetail:!1,turbulence:!1,clouds:{...c.clouds,accurateSunSkyLight:!1,maxIterationCount:200,minStepSize:100,maxRayDistance:1e5,minDensity:1e-4,minExtinction:1e-4,minTransmittance:.1,maxIterationCountToGround:0,maxIterationCountToSun:1},shadow:{...c.shadow,maxIterationCount:25,minDensity:1e-4,minExtinction:1e-4,minTransmittance:.01,cascadeCount:2,mapSize:new n.Vector2(256,256)}},medium:{...c,lightShafts:!1,turbulence:!1,clouds:{...c.clouds,minDensity:1e-4,minExtinction:1e-4,accurateSunSkyLight:!1,maxIterationCountToSun:2,maxIterationCountToGround:1},shadow:{...c.shadow,minDensity:1e-4,minExtinction:1e-4,mapSize:new n.Vector2(256,256)}},high:c,ultra:{...c,clouds:{...c.clouds,minStepSize:10},shadow:{...c.shadow,mapSize:new n.Vector2(1024,1024)}}},Pe=`precision highp float;
2
2
  precision highp sampler3D;
3
3
  precision highp sampler2DArray;
4
4
 
@@ -1009,7 +1009,7 @@ void main() {
1009
1009
  outputShadowLength = shadowLength * METER_TO_LENGTH_UNIT;
1010
1010
  #endif // SHADOW_LENGTH
1011
1011
  }
1012
- `,ae=`float getSTBN() {
1012
+ `,re=`float getSTBN() {
1013
1013
  ivec3 size = textureSize(stbnTexture, 0);
1014
1014
  vec3 scale = 1.0 / vec3(size);
1015
1015
  return texture(stbnTexture, vec3(gl_FragCoord.xy, float(frame % size.z)) * scale).r;
@@ -1199,7 +1199,7 @@ MediaSample sampleMedia(
1199
1199
  ivec3 sampleCount;
1200
1200
  return sampleMedia(weather, position, uv, mipLevel, jitter, sampleCount);
1201
1201
  }
1202
- `,_e=`precision highp float;
1202
+ `,Oe=`precision highp float;
1203
1203
  precision highp sampler3D;
1204
1204
 
1205
1205
  #include "atmosphere/bruneton/definitions"
@@ -1280,7 +1280,7 @@ void main() {
1280
1280
 
1281
1281
  gl_Position = vec4(position.xy, 1.0, 1.0);
1282
1282
  }
1283
- `,re=`uniform vec2 resolution;
1283
+ `,oe=`uniform vec2 resolution;
1284
1284
  uniform int frame;
1285
1285
  uniform sampler3D stbnTexture;
1286
1286
 
@@ -1346,7 +1346,7 @@ uniform float shadowTopHeight;
1346
1346
  uniform float shadowBottomHeight;
1347
1347
  uniform vec4 shadowLayerMask;
1348
1348
  uniform CloudDensityProfile densityProfile;
1349
- `,V=`struct GroundIrradiance {
1349
+ `,j=`struct GroundIrradiance {
1350
1350
  vec3 sun;
1351
1351
  vec3 sky;
1352
1352
  };
@@ -1364,7 +1364,7 @@ struct CloudDensityProfile {
1364
1364
  vec4 linearTerms;
1365
1365
  vec4 constantTerms;
1366
1366
  };
1367
- `;var Pe=Object.defineProperty,v=(o,e,t,a)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&Pe(e,t,r),r};const Oe=new n.Vector3,Re=new u.Geodetic;class m extends F.AtmosphereMaterialBase{temporalUpscale=!0;previousProjectionMatrix;previousViewMatrix;constructor({parameterUniforms:e,layerUniforms:t,atmosphereUniforms:a},r=F.AtmosphereParameters.DEFAULT){super({name:"CloudsMaterial",glslVersion:n.GLSL3,vertexShader:u.resolveIncludes(_e,{atmosphere:{bruneton:{common:P.common,definitions:P.definitions,runtime:P.runtime}},types:V}),fragmentShader:u.unrollLoops(u.resolveIncludes(Ae,{core:{depth:S.depth,math:S.math,turbo:S.turbo,generators:S.generators,raySphereIntersection:S.raySphereIntersection,cascadedShadowMaps:S.cascadedShadowMaps,interleavedGradientNoise:S.interleavedGradientNoise,vogelDisk:S.vogelDisk},atmosphere:{bruneton:{common:P.common,definitions:P.definitions,runtime:P.runtime}},types:V,parameters:re,clouds:ae})),uniforms:{...e,...t,...a,depthBuffer:new n.Uniform(null),viewMatrix:new n.Uniform(new n.Matrix4),inverseProjectionMatrix:new n.Uniform(new n.Matrix4),inverseViewMatrix:new n.Uniform(new n.Matrix4),reprojectionMatrix:new n.Uniform(new n.Matrix4),viewReprojectionMatrix:new n.Uniform(new n.Matrix4),resolution:new n.Uniform(new n.Vector2),cameraNear:new n.Uniform(0),cameraFar:new n.Uniform(0),cameraHeight:new n.Uniform(0),frame:new n.Uniform(0),temporalJitter:new n.Uniform(new n.Vector2),targetUvScale:new n.Uniform(new n.Vector2),mipLevelScale:new n.Uniform(1),stbnTexture:new n.Uniform(null),skyLightScale:new n.Uniform(1),groundBounceScale:new n.Uniform(1),powderScale:new n.Uniform(.8),powderExponent:new n.Uniform(150),maxIterationCount:new n.Uniform(c.clouds.maxIterationCount),minStepSize:new n.Uniform(c.clouds.minStepSize),maxStepSize:new n.Uniform(c.clouds.maxStepSize),maxRayDistance:new n.Uniform(c.clouds.maxRayDistance),perspectiveStepScale:new n.Uniform(c.clouds.perspectiveStepScale),minDensity:new n.Uniform(c.clouds.minDensity),minExtinction:new n.Uniform(c.clouds.minExtinction),minTransmittance:new n.Uniform(c.clouds.minTransmittance),maxIterationCountToSun:new n.Uniform(c.clouds.maxIterationCountToSun),maxIterationCountToGround:new n.Uniform(c.clouds.maxIterationCountToGround),minSecondaryStepSize:new n.Uniform(c.clouds.minSecondaryStepSize),secondaryStepScale:new n.Uniform(c.clouds.secondaryStepScale),shadowBuffer:new n.Uniform(null),shadowTexelSize:new n.Uniform(new n.Vector2),shadowIntervals:new n.Uniform(Array.from({length:4},()=>new n.Vector2)),shadowMatrices:new n.Uniform(Array.from({length:4},()=>new n.Matrix4)),shadowFar:new n.Uniform(0),maxShadowFilterRadius:new n.Uniform(6),shadowLayerMask:new n.Uniform(new n.Vector4().setScalar(1)),maxShadowLengthIterationCount:new n.Uniform(c.clouds.maxShadowLengthIterationCount),minShadowLengthStepSize:new n.Uniform(c.clouds.minShadowLengthStepSize),maxShadowLengthRayDistance:new n.Uniform(c.clouds.maxShadowLengthRayDistance),hazeDensityScale:new n.Uniform(3e-5),hazeExponent:new n.Uniform(.001),hazeScatteringCoefficient:new n.Uniform(.9),hazeAbsorptionCoefficient:new n.Uniform(.5)}},r)}onBeforeRender(e,t,a,r,i,s){const l=this.defines.USE_LOGARITHMIC_DEPTH_BUFFER!=null,h=e.capabilities.logarithmicDepthBuffer;h!==l&&(h?this.defines.USE_LOGARITHMIC_DEPTH_BUFFER="1":delete this.defines.USE_LOGARITHMIC_DEPTH_BUFFER);const d=this.defines.POWDER!=null,p=this.uniforms.powderScale.value>0;p!==d&&(p?this.defines.POWDER="1":delete this.defines.POWDER,this.needsUpdate=!0);const f=this.defines.GROUND_BOUNCE!=null;(this.uniforms.groundBounceScale.value>0&&this.uniforms.maxIterationCountToGround.value>0)!==f&&(p?this.defines.GROUND_BOUNCE="1":delete this.defines.GROUND_BOUNCE,this.needsUpdate=!0)}copyCameraSettings(e){e.isPerspectiveCamera===!0?this.defines.PERSPECTIVE_CAMERA!=="1"&&(this.defines.PERSPECTIVE_CAMERA="1",this.needsUpdate=!0):this.defines.PERSPECTIVE_CAMERA!=null&&(delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0);const t=this.uniforms;t.viewMatrix.value.copy(e.matrixWorldInverse),t.inverseViewMatrix.value.copy(e.matrixWorld);const a=this.previousProjectionMatrix??e.projectionMatrix,r=this.previousViewMatrix??e.matrixWorldInverse,i=t.inverseProjectionMatrix.value,s=t.inverseViewMatrix.value,l=t.reprojectionMatrix.value,h=t.viewReprojectionMatrix.value;if(this.temporalUpscale){const f=t.frame.value%16,y=t.resolution.value,T=ne[f],A=(T.x-.5)/y.x*4,_=(T.y-.5)/y.y*4;t.temporalJitter.value.set(A,_),t.mipLevelScale.value=.25,i.copy(e.projectionMatrix),i.elements[8]+=A*2,i.elements[9]+=_*2,i.invert(),l.copy(a),l.elements[8]+=A*2,l.elements[9]+=_*2,l.multiply(r),h.copy(l).multiply(s)}else t.temporalJitter.value.setScalar(0),t.mipLevelScale.value=1,i.copy(e.projectionMatrixInverse),l.copy(a).multiply(r),h.copy(l).multiply(s);u.reinterpretType(e),t.cameraNear.value=e.near,t.cameraFar.value=e.far;const d=e.getWorldPosition(t.cameraPosition.value),p=Oe.copy(d).applyMatrix4(t.worldToECEFMatrix.value);try{t.cameraHeight.value=Re.setFromECEF(p).height}catch{}}copyReprojectionMatrix(e){this.previousProjectionMatrix??=new n.Matrix4,this.previousViewMatrix??=new n.Matrix4,this.previousProjectionMatrix.copy(e.projectionMatrix),this.previousViewMatrix.copy(e.matrixWorldInverse)}setSize(e,t,a,r){this.uniforms.resolution.value.set(e,t),a!=null&&r!=null?this.uniforms.targetUvScale.value.set(e/a,t/r):this.uniforms.targetUvScale.value.setScalar(1),this.previousProjectionMatrix=void 0,this.previousViewMatrix=void 0}setShadowSize(e,t){this.uniforms.shadowTexelSize.value.set(1/e,1/t)}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}depthPacking=0;localWeatherChannels="rgba";shapeDetail=c.shapeDetail;turbulence=c.turbulence;shadowLength=c.lightShafts;haze=c.haze;multiScatteringOctaves=c.clouds.multiScatteringOctaves;get accurateSunSkyIrradiance(){return this.accurateSunSkyLight}set accurateSunSkyIrradiance(e){this.accurateSunSkyLight=e}accurateSunSkyLight=c.clouds.accurateSunSkyLight;accuratePhaseFunction=c.clouds.accuratePhaseFunction;shadowCascadeCount=c.shadow.cascadeCount;shadowSampleCount=8;scatterAnisotropy1=.7;scatterAnisotropy2=-.2;scatterAnisotropyMix=.5}v([u.defineInt("DEPTH_PACKING")],m.prototype,"depthPacking");v([u.defineExpression("LOCAL_WEATHER_CHANNELS",{validate:o=>/^[rgba]{4}$/.test(o)})],m.prototype,"localWeatherChannels");v([u.define("SHAPE_DETAIL")],m.prototype,"shapeDetail");v([u.define("TURBULENCE")],m.prototype,"turbulence");v([u.define("SHADOW_LENGTH")],m.prototype,"shadowLength");v([u.define("HAZE")],m.prototype,"haze");v([u.defineInt("MULTI_SCATTERING_OCTAVES",{min:1,max:12})],m.prototype,"multiScatteringOctaves");v([u.define("ACCURATE_SUN_SKY_LIGHT")],m.prototype,"accurateSunSkyLight");v([u.define("ACCURATE_PHASE_FUNCTION")],m.prototype,"accuratePhaseFunction");v([u.defineInt("SHADOW_CASCADE_COUNT",{min:1,max:4})],m.prototype,"shadowCascadeCount");v([u.defineInt("SHADOW_SAMPLE_COUNT",{min:1,max:16})],m.prototype,"shadowSampleCount");v([u.defineFloat("SCATTER_ANISOTROPY_1")],m.prototype,"scatterAnisotropy1");v([u.defineFloat("SCATTER_ANISOTROPY_2")],m.prototype,"scatterAnisotropy2");v([u.defineFloat("SCATTER_ANISOTROPY_MIX")],m.prototype,"scatterAnisotropyMix");const Le=`// Taken from https://gist.github.com/TheRealMJP/c83b8c0f46b63f3a88a5986f4fa982b1
1367
+ `;var Re=Object.defineProperty,v=(o,e,t,a)=>{for(var i=void 0,r=o.length-1,s;r>=0;r--)(s=o[r])&&(i=s(e,t,i)||i);return i&&Re(e,t,i),i};const Le=new n.Vector3,Ue=new u.Geodetic;class m extends z.AtmosphereMaterialBase{constructor({parameterUniforms:e,layerUniforms:t,atmosphereUniforms:a},i=z.AtmosphereParameters.DEFAULT){super({name:"CloudsMaterial",glslVersion:n.GLSL3,vertexShader:u.resolveIncludes(Oe,{atmosphere:{bruneton:{common:P.common,definitions:P.definitions,runtime:P.runtime}},types:j}),fragmentShader:u.unrollLoops(u.resolveIncludes(Pe,{core:{depth:g.depth,math:g.math,turbo:g.turbo,generators:g.generators,raySphereIntersection:g.raySphereIntersection,cascadedShadowMaps:g.cascadedShadowMaps,interleavedGradientNoise:g.interleavedGradientNoise,vogelDisk:g.vogelDisk},atmosphere:{bruneton:{common:P.common,definitions:P.definitions,runtime:P.runtime}},types:j,parameters:oe,clouds:re})),uniforms:{...e,...t,...a,depthBuffer:new n.Uniform(null),viewMatrix:new n.Uniform(new n.Matrix4),inverseProjectionMatrix:new n.Uniform(new n.Matrix4),inverseViewMatrix:new n.Uniform(new n.Matrix4),reprojectionMatrix:new n.Uniform(new n.Matrix4),viewReprojectionMatrix:new n.Uniform(new n.Matrix4),resolution:new n.Uniform(new n.Vector2),cameraNear:new n.Uniform(0),cameraFar:new n.Uniform(0),cameraHeight:new n.Uniform(0),frame:new n.Uniform(0),temporalJitter:new n.Uniform(new n.Vector2),targetUvScale:new n.Uniform(new n.Vector2),mipLevelScale:new n.Uniform(1),stbnTexture:new n.Uniform(null),skyLightScale:new n.Uniform(1),groundBounceScale:new n.Uniform(1),powderScale:new n.Uniform(.8),powderExponent:new n.Uniform(150),maxIterationCount:new n.Uniform(c.clouds.maxIterationCount),minStepSize:new n.Uniform(c.clouds.minStepSize),maxStepSize:new n.Uniform(c.clouds.maxStepSize),maxRayDistance:new n.Uniform(c.clouds.maxRayDistance),perspectiveStepScale:new n.Uniform(c.clouds.perspectiveStepScale),minDensity:new n.Uniform(c.clouds.minDensity),minExtinction:new n.Uniform(c.clouds.minExtinction),minTransmittance:new n.Uniform(c.clouds.minTransmittance),maxIterationCountToSun:new n.Uniform(c.clouds.maxIterationCountToSun),maxIterationCountToGround:new n.Uniform(c.clouds.maxIterationCountToGround),minSecondaryStepSize:new n.Uniform(c.clouds.minSecondaryStepSize),secondaryStepScale:new n.Uniform(c.clouds.secondaryStepScale),shadowBuffer:new n.Uniform(null),shadowTexelSize:new n.Uniform(new n.Vector2),shadowIntervals:new n.Uniform(Array.from({length:4},()=>new n.Vector2)),shadowMatrices:new n.Uniform(Array.from({length:4},()=>new n.Matrix4)),shadowFar:new n.Uniform(0),maxShadowFilterRadius:new n.Uniform(6),shadowLayerMask:new n.Uniform(new n.Vector4().setScalar(1)),maxShadowLengthIterationCount:new n.Uniform(c.clouds.maxShadowLengthIterationCount),minShadowLengthStepSize:new n.Uniform(c.clouds.minShadowLengthStepSize),maxShadowLengthRayDistance:new n.Uniform(c.clouds.maxShadowLengthRayDistance),hazeDensityScale:new n.Uniform(3e-5),hazeExponent:new n.Uniform(.001),hazeScatteringCoefficient:new n.Uniform(.9),hazeAbsorptionCoefficient:new n.Uniform(.5)}},i),this.temporalUpscale=!0,this.depthPacking=0,this.localWeatherChannels="rgba",this.shapeDetail=c.shapeDetail,this.turbulence=c.turbulence,this.shadowLength=c.lightShafts,this.haze=c.haze,this.multiScatteringOctaves=c.clouds.multiScatteringOctaves,this.accurateSunSkyLight=c.clouds.accurateSunSkyLight,this.accuratePhaseFunction=c.clouds.accuratePhaseFunction,this.shadowCascadeCount=c.shadow.cascadeCount,this.shadowSampleCount=8,this.scatterAnisotropy1=.7,this.scatterAnisotropy2=-.2,this.scatterAnisotropyMix=.5}onBeforeRender(e,t,a,i,r,s){const l=this.defines.USE_LOGARITHMIC_DEPTH_BUFFER!=null,h=e.capabilities.logarithmicDepthBuffer;h!==l&&(h?this.defines.USE_LOGARITHMIC_DEPTH_BUFFER="1":delete this.defines.USE_LOGARITHMIC_DEPTH_BUFFER);const d=this.defines.POWDER!=null,p=this.uniforms.powderScale.value>0;p!==d&&(p?this.defines.POWDER="1":delete this.defines.POWDER,this.needsUpdate=!0);const f=this.defines.GROUND_BOUNCE!=null;(this.uniforms.groundBounceScale.value>0&&this.uniforms.maxIterationCountToGround.value>0)!==f&&(p?this.defines.GROUND_BOUNCE="1":delete this.defines.GROUND_BOUNCE,this.needsUpdate=!0)}copyCameraSettings(e){e.isPerspectiveCamera===!0?this.defines.PERSPECTIVE_CAMERA!=="1"&&(this.defines.PERSPECTIVE_CAMERA="1",this.needsUpdate=!0):this.defines.PERSPECTIVE_CAMERA!=null&&(delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0);const t=this.uniforms;t.viewMatrix.value.copy(e.matrixWorldInverse),t.inverseViewMatrix.value.copy(e.matrixWorld);const a=this.previousProjectionMatrix??e.projectionMatrix,i=this.previousViewMatrix??e.matrixWorldInverse,r=t.inverseProjectionMatrix.value,s=t.inverseViewMatrix.value,l=t.reprojectionMatrix.value,h=t.viewReprojectionMatrix.value;if(this.temporalUpscale){const f=t.frame.value%16,y=t.resolution.value,C=ie[f],A=(C.x-.5)/y.x*4,_=(C.y-.5)/y.y*4;t.temporalJitter.value.set(A,_),t.mipLevelScale.value=.25,r.copy(e.projectionMatrix),r.elements[8]+=A*2,r.elements[9]+=_*2,r.invert(),l.copy(a),l.elements[8]+=A*2,l.elements[9]+=_*2,l.multiply(i),h.copy(l).multiply(s)}else t.temporalJitter.value.setScalar(0),t.mipLevelScale.value=1,r.copy(e.projectionMatrixInverse),l.copy(a).multiply(i),h.copy(l).multiply(s);u.reinterpretType(e),t.cameraNear.value=e.near,t.cameraFar.value=e.far;const d=e.getWorldPosition(t.cameraPosition.value),p=Le.copy(d).applyMatrix4(t.worldToECEFMatrix.value);try{t.cameraHeight.value=Ue.setFromECEF(p).height}catch{}}copyReprojectionMatrix(e){this.previousProjectionMatrix??=new n.Matrix4,this.previousViewMatrix??=new n.Matrix4,this.previousProjectionMatrix.copy(e.projectionMatrix),this.previousViewMatrix.copy(e.matrixWorldInverse)}setSize(e,t,a,i){this.uniforms.resolution.value.set(e,t),a!=null&&i!=null?this.uniforms.targetUvScale.value.set(e/a,t/i):this.uniforms.targetUvScale.value.setScalar(1),this.previousProjectionMatrix=void 0,this.previousViewMatrix=void 0}setShadowSize(e,t){this.uniforms.shadowTexelSize.value.set(1/e,1/t)}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}get accurateSunSkyIrradiance(){return this.accurateSunSkyLight}set accurateSunSkyIrradiance(e){this.accurateSunSkyLight=e}}v([u.defineInt("DEPTH_PACKING")],m.prototype,"depthPacking");v([u.defineExpression("LOCAL_WEATHER_CHANNELS",{validate:o=>/^[rgba]{4}$/.test(o)})],m.prototype,"localWeatherChannels");v([u.define("SHAPE_DETAIL")],m.prototype,"shapeDetail");v([u.define("TURBULENCE")],m.prototype,"turbulence");v([u.define("SHADOW_LENGTH")],m.prototype,"shadowLength");v([u.define("HAZE")],m.prototype,"haze");v([u.defineInt("MULTI_SCATTERING_OCTAVES",{min:1,max:12})],m.prototype,"multiScatteringOctaves");v([u.define("ACCURATE_SUN_SKY_LIGHT")],m.prototype,"accurateSunSkyLight");v([u.define("ACCURATE_PHASE_FUNCTION")],m.prototype,"accuratePhaseFunction");v([u.defineInt("SHADOW_CASCADE_COUNT",{min:1,max:4})],m.prototype,"shadowCascadeCount");v([u.defineInt("SHADOW_SAMPLE_COUNT",{min:1,max:16})],m.prototype,"shadowSampleCount");v([u.defineFloat("SCATTER_ANISOTROPY_1")],m.prototype,"scatterAnisotropy1");v([u.defineFloat("SCATTER_ANISOTROPY_2")],m.prototype,"scatterAnisotropy2");v([u.defineFloat("SCATTER_ANISOTROPY_MIX")],m.prototype,"scatterAnisotropyMix");const Ie=`// Taken from https://gist.github.com/TheRealMJP/c83b8c0f46b63f3a88a5986f4fa982b1
1368
1368
  // TODO: Use 5-taps version: https://www.shadertoy.com/view/MtVGWz
1369
1369
  // Or even 4 taps (requires preprocessing in the input buffer):
1370
1370
  // https://www.shadertoy.com/view/4tyGDD
@@ -1477,7 +1477,7 @@ vec4 textureCatmullRom(sampler2DArray tex, vec3 uv) {
1477
1477
  result += texture(tex, vec3(texPos3.x, texPos3.y, uv.z)) * w3.x * w3.y;
1478
1478
  return result;
1479
1479
  }
1480
- `,Ue=`precision highp float;
1480
+ `,Me=`precision highp float;
1481
1481
  precision highp sampler2DArray;
1482
1482
 
1483
1483
  #include "core/turbo"
@@ -1654,7 +1654,7 @@ void main() {
1654
1654
  outputColor.rgb = outputColor.rgb + vec3(abs(texture(depthVelocityBuffer, vUv).gb) * 10.0, 0.0);
1655
1655
  #endif // DEBUG_SHOW_VELOCITY
1656
1656
  }
1657
- `,Me=`precision highp float;
1657
+ `,Ne=`precision highp float;
1658
1658
 
1659
1659
  layout(location = 0) in vec3 position;
1660
1660
 
@@ -1664,7 +1664,7 @@ void main() {
1664
1664
  vUv = position.xy * 0.5 + 0.5;
1665
1665
  gl_Position = vec4(position.xy, 1.0, 1.0);
1666
1666
  }
1667
- `,ie=`#ifdef VARIANCE_9_SAMPLES
1667
+ `,se=`#ifdef VARIANCE_9_SAMPLES
1668
1668
  #define VARIANCE_OFFSET_COUNT 8
1669
1669
  const ivec2 varianceOffsets[8] = ivec2[8](
1670
1670
  ivec2(-1, -1),
@@ -1778,7 +1778,7 @@ vec4 varianceClipping(
1778
1778
  ) {
1779
1779
  return varianceClipping(inputBuffer, coord, current, history, 1.0);
1780
1780
  }
1781
- `;var Ie=Object.defineProperty,oe=(o,e,t,a)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&Ie(e,t,r),r};class k extends n.RawShaderMaterial{constructor({colorBuffer:e=null,depthVelocityBuffer:t=null,shadowLengthBuffer:a=null,colorHistoryBuffer:r=null,shadowLengthHistoryBuffer:i=null}={}){super({name:"CloudsResolveMaterial",glslVersion:n.GLSL3,vertexShader:Me,fragmentShader:u.unrollLoops(u.resolveIncludes(Ue,{core:{turbo:S.turbo},catmullRomSampling:Le,varianceClipping:ie})),uniforms:{colorBuffer:new n.Uniform(e),depthVelocityBuffer:new n.Uniform(t),shadowLengthBuffer:new n.Uniform(a),colorHistoryBuffer:new n.Uniform(r),shadowLengthHistoryBuffer:new n.Uniform(i),texelSize:new n.Uniform(new n.Vector2),frame:new n.Uniform(0),jitterOffset:new n.Uniform(new n.Vector2),varianceGamma:new n.Uniform(2),temporalAlpha:new n.Uniform(.1)}})}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}onBeforeRender(e,t,a,r,i,s){const h=this.uniforms.frame.value%16,d=ne[h],p=(d.x-.5)*4,f=(d.y-.5)*4;this.uniforms.jitterOffset.value.set(p,f)}temporalUpscale=!0;shadowLength=!0}oe([u.define("TEMPORAL_UPSCALE")],k.prototype,"temporalUpscale");oe([u.define("SHADOW_LENGTH")],k.prototype,"shadowLength");class se extends w.Pass{shadow;_mainCamera=new n.Camera;constructor(e,t){super(e);const{shadow:a}=t;this.shadow=a}get mainCamera(){return this._mainCamera}set mainCamera(e){this._mainCamera=e}}function W(o,{depthVelocity:e,shadowLength:t}){const a=new n.WebGLRenderTarget(1,1,{depthBuffer:!1,type:n.HalfFloatType});a.texture.minFilter=n.LinearFilter,a.texture.magFilter=n.LinearFilter,a.texture.name=o;let r;e&&(r=a.texture.clone(),r.isRenderTargetTexture=!0,a.depthVelocity=r,a.textures.push(r));let i;return t&&(i=a.texture.clone(),i.isRenderTargetTexture=!0,i.format=n.RedFormat,a.shadowLength=i,a.textures.push(i)),Object.assign(a,{depthVelocity:r??null,shadowLength:i??null})}class Ne extends se{constructor({parameterUniforms:e,layerUniforms:t,atmosphereUniforms:a,...r},i){super("CloudsPass",r),this.atmosphere=i,this.currentMaterial=new m({parameterUniforms:e,layerUniforms:t,atmosphereUniforms:a},i),this.currentPass=new w.ShaderPass(this.currentMaterial),this.resolveMaterial=new k,this.resolvePass=new w.ShaderPass(this.resolveMaterial),this.initRenderTargets({depthVelocity:!0,shadowLength:c.lightShafts})}currentRenderTarget;currentMaterial;currentPass;resolveRenderTarget;resolveMaterial;resolvePass;historyRenderTarget;width=0;height=0;copyCameraSettings(e){this.currentMaterial.copyCameraSettings(e)}initialize(e,t,a){this.currentPass.initialize(e,t,a),this.resolvePass.initialize(e,t,a)}initRenderTargets(e){this.currentRenderTarget?.dispose(),this.resolveRenderTarget?.dispose(),this.historyRenderTarget?.dispose();const t=W("Clouds",e),a=W("Clouds.A",{...e,depthVelocity:!1}),r=W("Clouds.B",{...e,depthVelocity:!1});this.currentRenderTarget=t,this.resolveRenderTarget=a,this.historyRenderTarget=r;const i=this.resolveMaterial.uniforms;i.colorBuffer.value=t.texture,i.depthVelocityBuffer.value=t.depthVelocity,i.shadowLengthBuffer.value=t.shadowLength,i.colorHistoryBuffer.value=r.texture,i.shadowLengthHistoryBuffer.value=r.shadowLength}copyShadow(){const e=this.shadow,t=this.currentMaterial.uniforms;for(let a=0;a<e.cascadeCount;++a){const r=e.cascades[a];t.shadowIntervals.value[a].copy(r.interval),t.shadowMatrices.value[a].copy(r.matrix)}t.shadowFar.value=e.far}copyReprojection(){this.currentMaterial.copyReprojectionMatrix(this.mainCamera)}swapBuffers(){const e=this.historyRenderTarget,t=this.resolveRenderTarget;this.resolveRenderTarget=e,this.historyRenderTarget=t;const a=this.resolveMaterial.uniforms;a.colorHistoryBuffer.value=t.texture,a.shadowLengthHistoryBuffer.value=t.shadowLength}update(e,t,a){this.currentMaterial.uniforms.frame.value=t,this.resolveMaterial.uniforms.frame.value=t,this.copyCameraSettings(this.mainCamera),this.copyShadow(),this.currentPass.render(e,null,this.currentRenderTarget),this.resolvePass.render(e,null,this.resolveRenderTarget),this.copyReprojection(),this.swapBuffers()}setSize(e,t){if(this.width=e,this.height=t,this.temporalUpscale){const a=Math.ceil(e/4),r=Math.ceil(t/4);this.currentRenderTarget.setSize(a,r),this.currentMaterial.setSize(a*4,r*4,e,t)}else this.currentRenderTarget.setSize(e,t),this.currentMaterial.setSize(e,t);this.resolveRenderTarget.setSize(e,t),this.resolveMaterial.setSize(e,t),this.historyRenderTarget.setSize(e,t)}setShadowSize(e,t,a){this.currentMaterial.shadowCascadeCount=a,this.currentMaterial.setShadowSize(e,t)}setDepthTexture(e,t){this.currentMaterial.depthBuffer=e,this.currentMaterial.depthPacking=t??0}get outputBuffer(){return this.historyRenderTarget.texture}get shadowBuffer(){return this.currentMaterial.uniforms.shadowBuffer.value}set shadowBuffer(e){this.currentMaterial.uniforms.shadowBuffer.value=e}get shadowLengthBuffer(){return this.historyRenderTarget.shadowLength}get temporalUpscale(){return this.currentMaterial.temporalUpscale}set temporalUpscale(e){e!==this.temporalUpscale&&(this.currentMaterial.temporalUpscale=e,this.resolveMaterial.temporalUpscale=e,this.setSize(this.width,this.height))}get lightShafts(){return this.currentMaterial.shadowLength}set lightShafts(e){e!==this.lightShafts&&(this.currentMaterial.shadowLength=e,this.resolveMaterial.shadowLength=e,this.initRenderTargets({depthVelocity:!0,shadowLength:e}),this.setSize(this.width,this.height))}}function be(o,e){const a=o.properties.get(e.texture).__webglTexture,r=o.getContext();D(r instanceof WebGL2RenderingContext),o.setRenderTarget(e);const i=[];if(a!=null)for(let s=0;s<e.depth;++s)r.framebufferTextureLayer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+s,a,0,s),i.push(r.COLOR_ATTACHMENT0+s);r.drawBuffers(i)}class te extends w.ShaderPass{render(e,t,a,r,i){const s=this.fullscreenMaterial.uniforms;t!==null&&s?.[this.input]!=null&&(s[this.input].value=t.texture),be(e,a),e.render(this.scene,this.camera)}}const He=`precision highp float;
1781
+ `;var be=Object.defineProperty,ce=(o,e,t,a)=>{for(var i=void 0,r=o.length-1,s;r>=0;r--)(s=o[r])&&(i=s(e,t,i)||i);return i&&be(e,t,i),i};class Y extends n.RawShaderMaterial{constructor({colorBuffer:e=null,depthVelocityBuffer:t=null,shadowLengthBuffer:a=null,colorHistoryBuffer:i=null,shadowLengthHistoryBuffer:r=null}={}){super({name:"CloudsResolveMaterial",glslVersion:n.GLSL3,vertexShader:Ne,fragmentShader:u.unrollLoops(u.resolveIncludes(Me,{core:{turbo:g.turbo},catmullRomSampling:Ie,varianceClipping:se})),uniforms:{colorBuffer:new n.Uniform(e),depthVelocityBuffer:new n.Uniform(t),shadowLengthBuffer:new n.Uniform(a),colorHistoryBuffer:new n.Uniform(i),shadowLengthHistoryBuffer:new n.Uniform(r),texelSize:new n.Uniform(new n.Vector2),frame:new n.Uniform(0),jitterOffset:new n.Uniform(new n.Vector2),varianceGamma:new n.Uniform(2),temporalAlpha:new n.Uniform(.1)}}),this.temporalUpscale=!0,this.shadowLength=!0}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}onBeforeRender(e,t,a,i,r,s){const h=this.uniforms.frame.value%16,d=ie[h],p=(d.x-.5)*4,f=(d.y-.5)*4;this.uniforms.jitterOffset.value.set(p,f)}}ce([u.define("TEMPORAL_UPSCALE")],Y.prototype,"temporalUpscale");ce([u.define("SHADOW_LENGTH")],Y.prototype,"shadowLength");class le extends w.Pass{constructor(e,t){super(e),this._mainCamera=new n.Camera;const{shadow:a}=t;this.shadow=a}get mainCamera(){return this._mainCamera}set mainCamera(e){this._mainCamera=e}}function G(o,{depthVelocity:e,shadowLength:t}){const a=new n.WebGLRenderTarget(1,1,{depthBuffer:!1,type:n.HalfFloatType});a.texture.minFilter=n.LinearFilter,a.texture.magFilter=n.LinearFilter,a.texture.name=o;let i;e&&(i=a.texture.clone(),i.isRenderTargetTexture=!0,a.depthVelocity=i,a.textures.push(i));let r;return t&&(r=a.texture.clone(),r.isRenderTargetTexture=!0,r.format=n.RedFormat,a.shadowLength=r,a.textures.push(r)),Object.assign(a,{depthVelocity:i??null,shadowLength:r??null})}class He extends le{constructor({parameterUniforms:e,layerUniforms:t,atmosphereUniforms:a,...i},r){super("CloudsPass",i),this.atmosphere=r,this.width=0,this.height=0,this.currentMaterial=new m({parameterUniforms:e,layerUniforms:t,atmosphereUniforms:a},r),this.currentPass=new w.ShaderPass(this.currentMaterial),this.resolveMaterial=new Y,this.resolvePass=new w.ShaderPass(this.resolveMaterial),this.initRenderTargets({depthVelocity:!0,shadowLength:c.lightShafts})}copyCameraSettings(e){this.currentMaterial.copyCameraSettings(e)}initialize(e,t,a){this.currentPass.initialize(e,t,a),this.resolvePass.initialize(e,t,a)}initRenderTargets(e){this.currentRenderTarget?.dispose(),this.resolveRenderTarget?.dispose(),this.historyRenderTarget?.dispose();const t=G("Clouds",e),a=G("Clouds.A",{...e,depthVelocity:!1}),i=G("Clouds.B",{...e,depthVelocity:!1});this.currentRenderTarget=t,this.resolveRenderTarget=a,this.historyRenderTarget=i;const r=this.resolveMaterial.uniforms;r.colorBuffer.value=t.texture,r.depthVelocityBuffer.value=t.depthVelocity,r.shadowLengthBuffer.value=t.shadowLength,r.colorHistoryBuffer.value=i.texture,r.shadowLengthHistoryBuffer.value=i.shadowLength}copyShadow(){const e=this.shadow,t=this.currentMaterial.uniforms;for(let a=0;a<e.cascadeCount;++a){const i=e.cascades[a];t.shadowIntervals.value[a].copy(i.interval),t.shadowMatrices.value[a].copy(i.matrix)}t.shadowFar.value=e.far}copyReprojection(){this.currentMaterial.copyReprojectionMatrix(this.mainCamera)}swapBuffers(){const e=this.historyRenderTarget,t=this.resolveRenderTarget;this.resolveRenderTarget=e,this.historyRenderTarget=t;const a=this.resolveMaterial.uniforms;a.colorHistoryBuffer.value=t.texture,a.shadowLengthHistoryBuffer.value=t.shadowLength}update(e,t,a){this.currentMaterial.uniforms.frame.value=t,this.resolveMaterial.uniforms.frame.value=t,this.copyCameraSettings(this.mainCamera),this.copyShadow(),this.currentPass.render(e,null,this.currentRenderTarget),this.resolvePass.render(e,null,this.resolveRenderTarget),this.copyReprojection(),this.swapBuffers()}setSize(e,t){if(this.width=e,this.height=t,this.temporalUpscale){const a=Math.ceil(e/4),i=Math.ceil(t/4);this.currentRenderTarget.setSize(a,i),this.currentMaterial.setSize(a*4,i*4,e,t)}else this.currentRenderTarget.setSize(e,t),this.currentMaterial.setSize(e,t);this.resolveRenderTarget.setSize(e,t),this.resolveMaterial.setSize(e,t),this.historyRenderTarget.setSize(e,t)}setShadowSize(e,t,a){this.currentMaterial.shadowCascadeCount=a,this.currentMaterial.setShadowSize(e,t)}setDepthTexture(e,t){this.currentMaterial.depthBuffer=e,this.currentMaterial.depthPacking=t??0}get outputBuffer(){return this.historyRenderTarget.texture}get shadowBuffer(){return this.currentMaterial.uniforms.shadowBuffer.value}set shadowBuffer(e){this.currentMaterial.uniforms.shadowBuffer.value=e}get shadowLengthBuffer(){return this.historyRenderTarget.shadowLength}get temporalUpscale(){return this.currentMaterial.temporalUpscale}set temporalUpscale(e){e!==this.temporalUpscale&&(this.currentMaterial.temporalUpscale=e,this.resolveMaterial.temporalUpscale=e,this.setSize(this.width,this.height))}get lightShafts(){return this.currentMaterial.shadowLength}set lightShafts(e){e!==this.lightShafts&&(this.currentMaterial.shadowLength=e,this.resolveMaterial.shadowLength=e,this.initRenderTargets({depthVelocity:!0,shadowLength:e}),this.setSize(this.width,this.height))}}function Fe(o,e){const a=o.properties.get(e.texture).__webglTexture,i=o.getContext();D(i instanceof WebGL2RenderingContext),o.setRenderTarget(e);const r=[];if(a!=null)for(let s=0;s<e.depth;++s)i.framebufferTextureLayer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+s,a,0,s),r.push(i.COLOR_ATTACHMENT0+s);i.drawBuffers(r)}class ae extends w.ShaderPass{render(e,t,a,i,r){const s=this.fullscreenMaterial.uniforms;t!==null&&s?.[this.input]!=null&&(s[this.input].value=t.texture),Fe(e,a),e.render(this.scene,this.camera)}}const ze=`precision highp float;
1782
1782
  precision highp sampler3D;
1783
1783
 
1784
1784
  #include <common>
@@ -1971,7 +1971,7 @@ void main() {
1971
1971
  }
1972
1972
  #pragma unroll_loop_end
1973
1973
  }
1974
- `,Fe=`precision highp float;
1974
+ `,We=`precision highp float;
1975
1975
 
1976
1976
  layout(location = 0) in vec3 position;
1977
1977
 
@@ -1981,7 +1981,7 @@ void main() {
1981
1981
  vUv = position.xy * 0.5 + 0.5;
1982
1982
  gl_Position = vec4(position.xy, 1.0, 1.0);
1983
1983
  }
1984
- `,ze=`// Implements Structured Volume Sampling in fragment shader:
1984
+ `,Be=`// Implements Structured Volume Sampling in fragment shader:
1985
1985
  // https://github.com/huwb/volsample
1986
1986
  // Implementation reference:
1987
1987
  // https://www.shadertoy.com/view/ttVfDc
@@ -2082,7 +2082,7 @@ void intersectStructuredPlanes(
2082
2082
  stepOffset += stepSize;
2083
2083
  }
2084
2084
  }
2085
- `;var We=Object.defineProperty,R=(o,e,t,a)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&We(e,t,r),r};class E extends n.RawShaderMaterial{constructor({parameterUniforms:e,layerUniforms:t,atmosphereUniforms:a}){super({name:"ShadowMaterial",glslVersion:n.GLSL3,vertexShader:Fe,fragmentShader:u.unrollLoops(u.resolveIncludes(He,{core:{math:S.math,raySphereIntersection:S.raySphereIntersection},types:V,parameters:re,structuredSampling:ze,clouds:ae})),uniforms:{...e,...t,...a,inverseShadowMatrices:new n.Uniform(Array.from({length:4},()=>new n.Matrix4)),reprojectionMatrices:new n.Uniform(Array.from({length:4},()=>new n.Matrix4)),resolution:new n.Uniform(new n.Vector2),frame:new n.Uniform(0),stbnTexture:new n.Uniform(null),maxIterationCount:new n.Uniform(c.shadow.maxIterationCount),minStepSize:new n.Uniform(c.shadow.minStepSize),maxStepSize:new n.Uniform(c.shadow.maxStepSize),minDensity:new n.Uniform(c.shadow.minDensity),minExtinction:new n.Uniform(c.shadow.minExtinction),minTransmittance:new n.Uniform(c.shadow.minTransmittance),opticalDepthTailScale:new n.Uniform(2)},defines:{SHADOW:"1",TEMPORAL_PASS:"1",TEMPORAL_JITTER:"1"}}),this.cascadeCount=c.shadow.cascadeCount}setSize(e,t){this.uniforms.resolution.value.set(e,t)}localWeatherChannels="rgba";cascadeCount=c.shadow.cascadeCount;temporalPass=!0;temporalJitter=!0;shapeDetail=c.shapeDetail;turbulence=c.turbulence}R([u.defineExpression("LOCAL_WEATHER_CHANNELS",{validate:o=>/^[rgba]{4}$/.test(o)})],E.prototype,"localWeatherChannels");R([u.defineInt("CASCADE_COUNT",{min:1,max:4})],E.prototype,"cascadeCount");R([u.define("TEMPORAL_PASS")],E.prototype,"temporalPass");R([u.define("TEMPORAL_JITTER")],E.prototype,"temporalJitter");R([u.define("SHAPE_DETAIL")],E.prototype,"shapeDetail");R([u.define("TURBULENCE")],E.prototype,"turbulence");const Be=`precision highp float;
2085
+ `;var Ge=Object.defineProperty,R=(o,e,t,a)=>{for(var i=void 0,r=o.length-1,s;r>=0;r--)(s=o[r])&&(i=s(e,t,i)||i);return i&&Ge(e,t,i),i};class E extends n.RawShaderMaterial{constructor({parameterUniforms:e,layerUniforms:t,atmosphereUniforms:a}){super({name:"ShadowMaterial",glslVersion:n.GLSL3,vertexShader:We,fragmentShader:u.unrollLoops(u.resolveIncludes(ze,{core:{math:g.math,raySphereIntersection:g.raySphereIntersection},types:j,parameters:oe,structuredSampling:Be,clouds:re})),uniforms:{...e,...t,...a,inverseShadowMatrices:new n.Uniform(Array.from({length:4},()=>new n.Matrix4)),reprojectionMatrices:new n.Uniform(Array.from({length:4},()=>new n.Matrix4)),resolution:new n.Uniform(new n.Vector2),frame:new n.Uniform(0),stbnTexture:new n.Uniform(null),maxIterationCount:new n.Uniform(c.shadow.maxIterationCount),minStepSize:new n.Uniform(c.shadow.minStepSize),maxStepSize:new n.Uniform(c.shadow.maxStepSize),minDensity:new n.Uniform(c.shadow.minDensity),minExtinction:new n.Uniform(c.shadow.minExtinction),minTransmittance:new n.Uniform(c.shadow.minTransmittance),opticalDepthTailScale:new n.Uniform(2)},defines:{SHADOW:"1",TEMPORAL_PASS:"1",TEMPORAL_JITTER:"1"}}),this.localWeatherChannels="rgba",this.cascadeCount=c.shadow.cascadeCount,this.temporalPass=!0,this.temporalJitter=!0,this.shapeDetail=c.shapeDetail,this.turbulence=c.turbulence,this.cascadeCount=c.shadow.cascadeCount}setSize(e,t){this.uniforms.resolution.value.set(e,t)}}R([u.defineExpression("LOCAL_WEATHER_CHANNELS",{validate:o=>/^[rgba]{4}$/.test(o)})],E.prototype,"localWeatherChannels");R([u.defineInt("CASCADE_COUNT",{min:1,max:4})],E.prototype,"cascadeCount");R([u.define("TEMPORAL_PASS")],E.prototype,"temporalPass");R([u.define("TEMPORAL_JITTER")],E.prototype,"temporalJitter");R([u.define("SHAPE_DETAIL")],E.prototype,"shapeDetail");R([u.define("TURBULENCE")],E.prototype,"turbulence");const Ve=`precision highp float;
2086
2086
  precision highp sampler2DArray;
2087
2087
 
2088
2088
  #define VARIANCE_9_SAMPLES 1
@@ -2158,7 +2158,7 @@ void main() {
2158
2158
  }
2159
2159
  #pragma unroll_loop_end
2160
2160
  }
2161
- `,Ge=`precision highp float;
2161
+ `,ke=`precision highp float;
2162
2162
 
2163
2163
  layout(location = 0) in vec3 position;
2164
2164
 
@@ -2168,7 +2168,7 @@ void main() {
2168
2168
  vUv = position.xy * 0.5 + 0.5;
2169
2169
  gl_Position = vec4(position.xy, 1.0, 1.0);
2170
2170
  }
2171
- `;var Ve=Object.defineProperty,ke=(o,e,t,a)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&Ve(e,t,r),r};class ce extends n.RawShaderMaterial{constructor({inputBuffer:e=null,historyBuffer:t=null}={}){super({name:"ShadowResolveMaterial",glslVersion:n.GLSL3,vertexShader:Ge,fragmentShader:u.unrollLoops(u.resolveIncludes(Be,{varianceClipping:ie})),uniforms:{inputBuffer:new n.Uniform(e),historyBuffer:new n.Uniform(t),texelSize:new n.Uniform(new n.Vector2),varianceGamma:new n.Uniform(1),temporalAlpha:new n.Uniform(.01)},defines:{}})}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}cascadeCount=c.shadow.cascadeCount}ke([u.defineInt("CASCADE_COUNT",{min:1,max:4})],ce.prototype,"cascadeCount");function B(o){const e=new n.WebGLArrayRenderTarget(1,1,1,{depthBuffer:!1});return e.texture.type=n.HalfFloatType,e.texture.minFilter=n.LinearFilter,e.texture.magFilter=n.LinearFilter,e.texture.name=o,e}class je extends se{currentRenderTarget;currentMaterial;currentPass;resolveRenderTarget;resolveMaterial;resolvePass;historyRenderTarget;width=0;height=0;constructor({parameterUniforms:e,layerUniforms:t,atmosphereUniforms:a,...r}){super("ShadowPass",r),this.currentMaterial=new E({parameterUniforms:e,layerUniforms:t,atmosphereUniforms:a}),this.currentPass=new te(this.currentMaterial),this.resolveMaterial=new ce,this.resolvePass=new te(this.resolveMaterial),this.initRenderTargets()}initialize(e,t,a){this.currentPass.initialize(e,t,a),this.resolvePass.initialize(e,t,a)}initRenderTargets(){this.currentRenderTarget?.dispose(),this.resolveRenderTarget?.dispose(),this.historyRenderTarget?.dispose();const e=B("Shadow"),t=this.temporalPass?B("Shadow.A"):null,a=this.temporalPass?B("Shadow.B"):null;this.currentRenderTarget=e,this.resolveRenderTarget=t,this.historyRenderTarget=a;const r=this.resolveMaterial.uniforms;r.inputBuffer.value=e.texture,r.historyBuffer.value=a?.texture??null}copyShadow(){const e=this.shadow,t=this.currentMaterial.uniforms;for(let a=0;a<e.cascadeCount;++a){const r=e.cascades[a];t.inverseShadowMatrices.value[a].copy(r.inverseMatrix)}}copyReprojection(){const e=this.shadow,t=this.currentMaterial.uniforms;for(let a=0;a<e.cascadeCount;++a){const r=e.cascades[a];t.reprojectionMatrices.value[a].copy(r.matrix)}}swapBuffers(){D(this.historyRenderTarget!=null),D(this.resolveRenderTarget!=null);const e=this.historyRenderTarget,t=this.resolveRenderTarget;this.resolveRenderTarget=e,this.historyRenderTarget=t,this.resolveMaterial.uniforms.historyBuffer.value=t.texture}update(e,t,a){this.currentMaterial.uniforms.frame.value=t,this.copyShadow(),this.currentPass.render(e,null,this.currentRenderTarget),this.temporalPass&&(D(this.resolveRenderTarget!=null),this.resolvePass.render(e,null,this.resolveRenderTarget),this.copyReprojection(),this.swapBuffers())}setSize(e,t,a=this.shadow.cascadeCount){this.width=e,this.height=t,this.currentMaterial.cascadeCount=a,this.resolveMaterial.cascadeCount=a,this.currentMaterial.setSize(e,t),this.resolveMaterial.setSize(e,t),this.currentRenderTarget.setSize(e,t,this.temporalPass?a*2:a),this.resolveRenderTarget?.setSize(e,t,a),this.historyRenderTarget?.setSize(e,t,a)}get outputBuffer(){return this.temporalPass?(D(this.historyRenderTarget!=null),this.historyRenderTarget.texture):this.currentRenderTarget.texture}get temporalPass(){return this.currentMaterial.temporalPass}set temporalPass(e){e!==this.temporalPass&&(this.currentMaterial.temporalPass=e,this.initRenderTargets(),this.setSize(this.width,this.height))}}function Ye(o){return{scatteringCoefficient:new n.Uniform(1),absorptionCoefficient:new n.Uniform(0),coverage:new n.Uniform(.3),localWeatherTexture:new n.Uniform(o.localWeatherTexture),localWeatherRepeat:new n.Uniform(o.localWeatherRepeat),localWeatherOffset:new n.Uniform(o.localWeatherOffset),shapeTexture:new n.Uniform(o.shapeTexture),shapeRepeat:new n.Uniform(o.shapeRepeat),shapeOffset:new n.Uniform(o.shapeOffset),shapeDetailTexture:new n.Uniform(o.shapeDetailTexture),shapeDetailRepeat:new n.Uniform(o.shapeDetailRepeat),shapeDetailOffset:new n.Uniform(o.shapeDetailOffset),turbulenceTexture:new n.Uniform(o.turbulenceTexture),turbulenceRepeat:new n.Uniform(o.turbulenceRepeat),turbulenceDisplacement:new n.Uniform(350)}}function Ze(){return{minLayerHeights:new n.Uniform(new n.Vector4),maxLayerHeights:new n.Uniform(new n.Vector4),minIntervalHeights:new n.Uniform(new n.Vector3),maxIntervalHeights:new n.Uniform(new n.Vector3),densityScales:new n.Uniform(new n.Vector4),shapeAmounts:new n.Uniform(new n.Vector4),shapeDetailAmounts:new n.Uniform(new n.Vector4),weatherExponents:new n.Uniform(new n.Vector4),shapeAlteringBiases:new n.Uniform(new n.Vector4),coverageFilterWidths:new n.Uniform(new n.Vector4),minHeight:new n.Uniform(0),maxHeight:new n.Uniform(0),shadowTopHeight:new n.Uniform(0),shadowBottomHeight:new n.Uniform(0),shadowLayerMask:new n.Uniform(new n.Vector4),densityProfile:new n.Uniform({expTerms:new n.Vector4,exponents:new n.Vector4,linearTerms:new n.Vector4,constantTerms:new n.Vector4})}}const G=[0,0,0,0];function qe(o,e){e.packValues("altitude",o.minLayerHeights.value),e.packSums("altitude","height",o.maxLayerHeights.value),e.packIntervalHeights(o.minIntervalHeights.value,o.maxIntervalHeights.value),e.packValues("densityScale",o.densityScales.value),e.packValues("shapeAmount",o.shapeAmounts.value),e.packValues("shapeDetailAmount",o.shapeDetailAmounts.value),e.packValues("weatherExponent",o.weatherExponents.value),e.packValues("shapeAlteringBias",o.shapeAlteringBiases.value),e.packValues("coverageFilterWidth",o.coverageFilterWidths.value);const t=o.densityProfile.value;e.packDensityProfiles("expTerm",t.expTerms),e.packDensityProfiles("exponent",t.exponents),e.packDensityProfiles("linearTerm",t.linearTerms),e.packDensityProfiles("constantTerm",t.constantTerms);let a=1/0,r=0,i=1/0,s=0;G.fill(0);for(let l=0;l<e.length;++l){const{altitude:h,height:d,shadow:p}=e[l],f=h+d;d>0&&(h<a&&(a=h),p&&h<i&&(i=h),f>r&&(r=f),p&&f>s&&(s=f)),G[l]=p?1:0}a!==1/0?(o.minHeight.value=a,o.maxHeight.value=r):(D(r===0),o.minHeight.value=0),i!==1/0?(o.shadowBottomHeight.value=i,o.shadowTopHeight.value=s):(D(s===0),o.shadowBottomHeight.value=0),o.shadowLayerMask.value.fromArray(G)}function Ke(o,e){return{bottomRadius:new n.Uniform(o.bottomRadius),topRadius:new n.Uniform(o.topRadius),worldToECEFMatrix:new n.Uniform(e.worldToECEFMatrix),ecefToWorldMatrix:new n.Uniform(e.ecefToWorldMatrix),altitudeCorrection:new n.Uniform(e.altitudeCorrection),sunDirection:new n.Uniform(e.sunDirection)}}const Xe=`uniform sampler2D cloudsBuffer;
2171
+ `;var je=Object.defineProperty,Ye=(o,e,t,a)=>{for(var i=void 0,r=o.length-1,s;r>=0;r--)(s=o[r])&&(i=s(e,t,i)||i);return i&&je(e,t,i),i};class ue extends n.RawShaderMaterial{constructor({inputBuffer:e=null,historyBuffer:t=null}={}){super({name:"ShadowResolveMaterial",glslVersion:n.GLSL3,vertexShader:ke,fragmentShader:u.unrollLoops(u.resolveIncludes(Ve,{varianceClipping:se})),uniforms:{inputBuffer:new n.Uniform(e),historyBuffer:new n.Uniform(t),texelSize:new n.Uniform(new n.Vector2),varianceGamma:new n.Uniform(1),temporalAlpha:new n.Uniform(.01)},defines:{}}),this.cascadeCount=c.shadow.cascadeCount}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}}Ye([u.defineInt("CASCADE_COUNT",{min:1,max:4})],ue.prototype,"cascadeCount");function V(o){const e=new n.WebGLArrayRenderTarget(1,1,1,{depthBuffer:!1});return e.texture.type=n.HalfFloatType,e.texture.minFilter=n.LinearFilter,e.texture.magFilter=n.LinearFilter,e.texture.name=o,e}class Ze extends le{constructor({parameterUniforms:e,layerUniforms:t,atmosphereUniforms:a,...i}){super("ShadowPass",i),this.width=0,this.height=0,this.currentMaterial=new E({parameterUniforms:e,layerUniforms:t,atmosphereUniforms:a}),this.currentPass=new ae(this.currentMaterial),this.resolveMaterial=new ue,this.resolvePass=new ae(this.resolveMaterial),this.initRenderTargets()}initialize(e,t,a){this.currentPass.initialize(e,t,a),this.resolvePass.initialize(e,t,a)}initRenderTargets(){this.currentRenderTarget?.dispose(),this.resolveRenderTarget?.dispose(),this.historyRenderTarget?.dispose();const e=V("Shadow"),t=this.temporalPass?V("Shadow.A"):null,a=this.temporalPass?V("Shadow.B"):null;this.currentRenderTarget=e,this.resolveRenderTarget=t,this.historyRenderTarget=a;const i=this.resolveMaterial.uniforms;i.inputBuffer.value=e.texture,i.historyBuffer.value=a?.texture??null}copyShadow(){const e=this.shadow,t=this.currentMaterial.uniforms;for(let a=0;a<e.cascadeCount;++a){const i=e.cascades[a];t.inverseShadowMatrices.value[a].copy(i.inverseMatrix)}}copyReprojection(){const e=this.shadow,t=this.currentMaterial.uniforms;for(let a=0;a<e.cascadeCount;++a){const i=e.cascades[a];t.reprojectionMatrices.value[a].copy(i.matrix)}}swapBuffers(){D(this.historyRenderTarget!=null),D(this.resolveRenderTarget!=null);const e=this.historyRenderTarget,t=this.resolveRenderTarget;this.resolveRenderTarget=e,this.historyRenderTarget=t,this.resolveMaterial.uniforms.historyBuffer.value=t.texture}update(e,t,a){this.currentMaterial.uniforms.frame.value=t,this.copyShadow(),this.currentPass.render(e,null,this.currentRenderTarget),this.temporalPass&&(D(this.resolveRenderTarget!=null),this.resolvePass.render(e,null,this.resolveRenderTarget),this.copyReprojection(),this.swapBuffers())}setSize(e,t,a=this.shadow.cascadeCount){this.width=e,this.height=t,this.currentMaterial.cascadeCount=a,this.resolveMaterial.cascadeCount=a,this.currentMaterial.setSize(e,t),this.resolveMaterial.setSize(e,t),this.currentRenderTarget.setSize(e,t,this.temporalPass?a*2:a),this.resolveRenderTarget?.setSize(e,t,a),this.historyRenderTarget?.setSize(e,t,a)}get outputBuffer(){return this.temporalPass?(D(this.historyRenderTarget!=null),this.historyRenderTarget.texture):this.currentRenderTarget.texture}get temporalPass(){return this.currentMaterial.temporalPass}set temporalPass(e){e!==this.temporalPass&&(this.currentMaterial.temporalPass=e,this.initRenderTargets(),this.setSize(this.width,this.height))}}function qe(o){return{scatteringCoefficient:new n.Uniform(1),absorptionCoefficient:new n.Uniform(0),coverage:new n.Uniform(.3),localWeatherTexture:new n.Uniform(o.localWeatherTexture),localWeatherRepeat:new n.Uniform(o.localWeatherRepeat),localWeatherOffset:new n.Uniform(o.localWeatherOffset),shapeTexture:new n.Uniform(o.shapeTexture),shapeRepeat:new n.Uniform(o.shapeRepeat),shapeOffset:new n.Uniform(o.shapeOffset),shapeDetailTexture:new n.Uniform(o.shapeDetailTexture),shapeDetailRepeat:new n.Uniform(o.shapeDetailRepeat),shapeDetailOffset:new n.Uniform(o.shapeDetailOffset),turbulenceTexture:new n.Uniform(o.turbulenceTexture),turbulenceRepeat:new n.Uniform(o.turbulenceRepeat),turbulenceDisplacement:new n.Uniform(350)}}function Ke(){return{minLayerHeights:new n.Uniform(new n.Vector4),maxLayerHeights:new n.Uniform(new n.Vector4),minIntervalHeights:new n.Uniform(new n.Vector3),maxIntervalHeights:new n.Uniform(new n.Vector3),densityScales:new n.Uniform(new n.Vector4),shapeAmounts:new n.Uniform(new n.Vector4),shapeDetailAmounts:new n.Uniform(new n.Vector4),weatherExponents:new n.Uniform(new n.Vector4),shapeAlteringBiases:new n.Uniform(new n.Vector4),coverageFilterWidths:new n.Uniform(new n.Vector4),minHeight:new n.Uniform(0),maxHeight:new n.Uniform(0),shadowTopHeight:new n.Uniform(0),shadowBottomHeight:new n.Uniform(0),shadowLayerMask:new n.Uniform(new n.Vector4),densityProfile:new n.Uniform({expTerms:new n.Vector4,exponents:new n.Vector4,linearTerms:new n.Vector4,constantTerms:new n.Vector4})}}const k=[0,0,0,0];function Xe(o,e){e.packValues("altitude",o.minLayerHeights.value),e.packSums("altitude","height",o.maxLayerHeights.value),e.packIntervalHeights(o.minIntervalHeights.value,o.maxIntervalHeights.value),e.packValues("densityScale",o.densityScales.value),e.packValues("shapeAmount",o.shapeAmounts.value),e.packValues("shapeDetailAmount",o.shapeDetailAmounts.value),e.packValues("weatherExponent",o.weatherExponents.value),e.packValues("shapeAlteringBias",o.shapeAlteringBiases.value),e.packValues("coverageFilterWidth",o.coverageFilterWidths.value);const t=o.densityProfile.value;e.packDensityProfiles("expTerm",t.expTerms),e.packDensityProfiles("exponent",t.exponents),e.packDensityProfiles("linearTerm",t.linearTerms),e.packDensityProfiles("constantTerm",t.constantTerms);let a=1/0,i=0,r=1/0,s=0;k.fill(0);for(let l=0;l<e.length;++l){const{altitude:h,height:d,shadow:p}=e[l],f=h+d;d>0&&(h<a&&(a=h),p&&h<r&&(r=h),f>i&&(i=f),p&&f>s&&(s=f)),k[l]=p?1:0}a!==1/0?(o.minHeight.value=a,o.maxHeight.value=i):(D(i===0),o.minHeight.value=0),r!==1/0?(o.shadowBottomHeight.value=r,o.shadowTopHeight.value=s):(D(s===0),o.shadowBottomHeight.value=0),o.shadowLayerMask.value.fromArray(k)}function $e(o,e){return{bottomRadius:new n.Uniform(o.bottomRadius),topRadius:new n.Uniform(o.topRadius),worldToECEFMatrix:new n.Uniform(e.worldToECEFMatrix),ecefToWorldMatrix:new n.Uniform(e.ecefToWorldMatrix),altitudeCorrection:new n.Uniform(e.altitudeCorrection),sunDirection:new n.Uniform(e.sunDirection)}}const Je=`uniform sampler2D cloudsBuffer;
2172
2172
 
2173
2173
  void mainImage(const vec4 inputColor, const vec2 uv, out vec4 outputColor) {
2174
2174
  #ifdef SKIP_RENDERING
@@ -2179,5 +2179,5 @@ void mainImage(const vec4 inputColor, const vec2 uv, out vec4 outputColor) {
2179
2179
  outputColor.a = inputColor.a * (1.0 - clouds.a) + clouds.a;
2180
2180
  #endif // SKIP_RENDERING
2181
2181
  }
2182
- `;var $e=Object.defineProperty,Je=(o,e,t,a)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&$e(e,t,r),r};const U=new n.Vector3,Qe=new n.Vector2,et=new n.Matrix3,tt=["maxIterationCount","minStepSize","maxStepSize","maxRayDistance","perspectiveStepScale","minDensity","minExtinction","minTransmittance","maxIterationCountToSun","maxIterationCountToGround","minSecondaryStepSize","secondaryStepScale","maxShadowFilterRadius","maxShadowLengthIterationCount","minShadowLengthStepSize","maxShadowLengthRayDistance","hazeDensityScale","hazeExponent","hazeScatteringCoefficient","hazeAbsorptionCoefficient"],nt=["multiScatteringOctaves","accurateSunSkyLight","accuratePhaseFunction"],at=["maxIterationCount","minStepSize","maxStepSize","minDensity","minExtinction","minTransmittance","opticalDepthTailScale"],rt=["temporalJitter"],it=["temporalPass"],ot=["cascadeCount","mapSize","maxFar","farScale","splitMode","splitLambda"],x={type:"change"},le={resolutionScale:c.resolutionScale,width:w.Resolution.AUTO_SIZE,height:w.Resolution.AUTO_SIZE};class ue extends w.Effect{constructor(e=new n.Camera,t,a=F.AtmosphereParameters.DEFAULT){super("CloudsEffect",Xe,{attributes:w.EffectAttribute.DEPTH,uniforms:new Map([["cloudsBuffer",new n.Uniform(null)]])}),this.camera=e,this.atmosphere=a;const{resolutionScale:r,width:i,height:s,resolutionX:l=i,resolutionY:h=s}={...le,...t};this.shadowMaps=new Ce({cascadeCount:c.shadow.cascadeCount,mapSize:c.shadow.mapSize,splitLambda:.6}),this.parameterUniforms=Ye({localWeatherTexture:this.proceduralLocalWeather?.texture??null,localWeatherRepeat:this.localWeatherRepeat,localWeatherOffset:this.localWeatherOffset,shapeTexture:this.proceduralShape?.texture??null,shapeRepeat:this.shapeRepeat,shapeOffset:this.shapeOffset,shapeDetailTexture:this.proceduralShapeDetail?.texture??null,shapeDetailRepeat:this.shapeDetailRepeat,shapeDetailOffset:this.shapeDetailOffset,turbulenceTexture:this.proceduralTurbulence?.texture??null,turbulenceRepeat:this.turbulenceRepeat}),this.layerUniforms=Ze(),this.atmosphereUniforms=Ke(a,{worldToECEFMatrix:this.worldToECEFMatrix,ecefToWorldMatrix:this.ecefToWorldMatrix,altitudeCorrection:this.altitudeCorrection,sunDirection:this.sunDirection});const d={shadow:this.shadowMaps,parameterUniforms:this.parameterUniforms,layerUniforms:this.layerUniforms,atmosphereUniforms:this.atmosphereUniforms};this.shadowPass=new je(d),this.shadowPass.mainCamera=e,this.cloudsPass=new Ne(d,a),this.cloudsPass.mainCamera=e,this.clouds=u.definePropertyShorthand(u.defineUniformShorthand({},this.cloudsPass.currentMaterial,tt),this.cloudsPass.currentMaterial,nt),this.shadow=u.definePropertyShorthand(u.defineUniformShorthand({},this.shadowPass.currentMaterial,at),this.shadowPass.currentMaterial,rt,this.shadowPass,it,this.shadowMaps,ot),this.resolution=new w.Resolution(this,l,h,r),this.resolution.addEventListener("change",this.onResolutionChange)}cloudLayers=M.DEFAULT.clone();correctAltitude=!0;localWeatherRepeat=new n.Vector2().setScalar(100);localWeatherOffset=new n.Vector2;shapeRepeat=new n.Vector3().setScalar(3e-4);shapeOffset=new n.Vector3;shapeDetailRepeat=new n.Vector3().setScalar(.006);shapeDetailOffset=new n.Vector3;turbulenceRepeat=new n.Vector2().setScalar(20);worldToECEFMatrix=new n.Matrix4;ecefToWorldMatrix=new n.Matrix4;altitudeCorrection=new n.Vector3;sunDirection=new n.Vector3;parameterUniforms;layerUniforms;atmosphereUniforms;localWeatherVelocity=new n.Vector2;shapeVelocity=new n.Vector3;shapeDetailVelocity=new n.Vector3;proceduralLocalWeather;proceduralShape;proceduralShapeDetail;proceduralTurbulence;shadowMaps;shadowPass;cloudsPass;clouds;shadow;_atmosphereOverlay=null;_atmosphereShadow=null;_atmosphereShadowLength=null;resolution;events=new n.EventDispatcher;frame=0;shadowCascadeCount=0;shadowMapSize=new n.Vector2;onResolutionChange=()=>{this.setSize(this.resolution.baseWidth,this.resolution.baseHeight)};get mainCamera(){return this.camera}set mainCamera(e){this.camera=e,this.shadowPass.mainCamera=e,this.cloudsPass.mainCamera=e}initialize(e,t,a){this.shadowPass.initialize(e,t,a),this.cloudsPass.initialize(e,t,a)}updateSharedUniforms(e){qe(this.layerUniforms,this.cloudLayers);const{parameterUniforms:t}=this;t.localWeatherOffset.value.add(Qe.copy(this.localWeatherVelocity).multiplyScalar(e)),t.shapeOffset.value.add(U.copy(this.shapeVelocity).multiplyScalar(e)),t.shapeDetailOffset.value.add(U.copy(this.shapeDetailVelocity).multiplyScalar(e));const a=this.worldToECEFMatrix;this.ecefToWorldMatrix.copy(a).invert();const r=this.camera.getWorldPosition(U).applyMatrix4(this.worldToECEFMatrix),i=this.altitudeCorrection;this.correctAltitude?F.getAltitudeCorrectionOffset(r,this.atmosphere.bottomRadius,this.ellipsoid,i):i.setScalar(0);const s=this.ellipsoid.getSurfaceNormal(r,U),l=this.sunDirection.dot(s),h=u.lerp(1e6,1e3,l),d=et.setFromMatrix4(a).transpose();this.shadowMaps.update(this.camera,U.copy(this.sunDirection).applyMatrix3(d),h)}updateWeatherTextureChannels(){const e=this.cloudLayers.localWeatherChannels;this.cloudsPass.currentMaterial.localWeatherChannels=e,this.shadowPass.currentMaterial.localWeatherChannels=e}updateAtmosphereComposition(){const{shadowMaps:e,shadowPass:t,cloudsPass:a}=this,r=t.currentMaterial.uniforms,i=a.currentMaterial.uniforms,s=this._atmosphereOverlay,l=Object.assign(this._atmosphereOverlay??{},{map:a.outputBuffer});s!==l&&(this._atmosphereOverlay=l,x.target=this,x.property="atmosphereOverlay",this.events.dispatchEvent(x));const h=this._atmosphereShadow,d=Object.assign(this._atmosphereShadow??{},{map:t.outputBuffer,mapSize:e.mapSize,cascadeCount:e.cascadeCount,intervals:i.shadowIntervals.value,matrices:i.shadowMatrices.value,inverseMatrices:r.inverseShadowMatrices.value,far:e.far,topHeight:i.shadowTopHeight.value});h!==d&&(this._atmosphereShadow=d,x.target=this,x.property="atmosphereShadow",this.events.dispatchEvent(x));const p=this._atmosphereShadowLength,f=a.shadowLengthBuffer!=null?Object.assign(this._atmosphereShadowLength??{},{map:a.shadowLengthBuffer}):null;p!==f&&(this._atmosphereShadowLength=f,x.target=this,x.property="atmosphereShadowLength",this.events.dispatchEvent(x))}update(e,t,a=0){const{shadowMaps:r,shadowPass:i,cloudsPass:s}=this;if(r.cascadeCount!==this.shadowCascadeCount||!r.mapSize.equals(this.shadowMapSize)){const{width:l,height:h}=r.mapSize,d=r.cascadeCount;this.shadowMapSize.set(l,h),this.shadowCascadeCount=d,i.setSize(l,h,d),s.setShadowSize(l,h,d)}this.proceduralLocalWeather?.render(e,a),this.proceduralShape?.render(e,a),this.proceduralShapeDetail?.render(e,a),this.proceduralTurbulence?.render(e,a),++this.frame,this.updateSharedUniforms(a),this.updateWeatherTextureChannels(),i.update(e,this.frame,a),s.shadowBuffer=i.outputBuffer,s.update(e,this.frame,a),this.updateAtmosphereComposition(),this.uniforms.get("cloudsBuffer").value=this.cloudsPass.outputBuffer}setSize(e,t){const{resolution:a}=this;a.setBaseSize(e,t);const{width:r,height:i}=a;this.cloudsPass.setSize(r,i)}setDepthTexture(e,t){this.shadowPass.setDepthTexture(e,t),this.cloudsPass.setDepthTexture(e,t)}skipRendering=!0;set qualityPreset(e){const{clouds:t,shadow:a,...r}=Ee[e];Object.assign(this,r),Object.assign(this.clouds,t),Object.assign(this.shadow,a)}get localWeatherTexture(){return this.proceduralLocalWeather??this.parameterUniforms.localWeatherTexture.value}set localWeatherTexture(e){e instanceof n.Texture||e==null?(this.proceduralLocalWeather=void 0,this.parameterUniforms.localWeatherTexture.value=e):(this.proceduralLocalWeather=e,this.parameterUniforms.localWeatherTexture.value=e.texture)}get shapeTexture(){return this.proceduralShape??this.parameterUniforms.shapeTexture.value}set shapeTexture(e){e instanceof n.Data3DTexture||e==null?(this.proceduralShape=void 0,this.parameterUniforms.shapeTexture.value=e):(this.proceduralShape=e,this.parameterUniforms.shapeTexture.value=e.texture)}get shapeDetailTexture(){return this.proceduralShapeDetail??this.parameterUniforms.shapeDetailTexture.value}set shapeDetailTexture(e){e instanceof n.Data3DTexture||e==null?(this.proceduralShapeDetail=void 0,this.parameterUniforms.shapeDetailTexture.value=e):(this.proceduralShapeDetail=e,this.parameterUniforms.shapeDetailTexture.value=e.texture)}get turbulenceTexture(){return this.proceduralTurbulence??this.parameterUniforms.turbulenceTexture.value}set turbulenceTexture(e){e instanceof n.Texture||e==null?(this.proceduralTurbulence=void 0,this.parameterUniforms.turbulenceTexture.value=e):(this.proceduralTurbulence=e,this.parameterUniforms.turbulenceTexture.value=e.texture)}get stbnTexture(){return this.cloudsPass.currentMaterial.uniforms.stbnTexture.value}set stbnTexture(e){this.cloudsPass.currentMaterial.uniforms.stbnTexture.value=e,this.shadowPass.currentMaterial.uniforms.stbnTexture.value=e}get resolutionScale(){return this.resolution.scale}set resolutionScale(e){this.resolution.scale=e}get temporalUpscale(){return this.cloudsPass.temporalUpscale}set temporalUpscale(e){this.cloudsPass.temporalUpscale=e}get lightShafts(){return this.cloudsPass.lightShafts}set lightShafts(e){this.cloudsPass.lightShafts=e}get shapeDetail(){return this.cloudsPass.currentMaterial.shapeDetail}set shapeDetail(e){this.cloudsPass.currentMaterial.shapeDetail=e,this.shadowPass.currentMaterial.shapeDetail=e}get turbulence(){return this.cloudsPass.currentMaterial.turbulence}set turbulence(e){this.cloudsPass.currentMaterial.turbulence=e,this.shadowPass.currentMaterial.turbulence=e}get haze(){return this.cloudsPass.currentMaterial.haze}set haze(e){this.cloudsPass.currentMaterial.haze=e}get scatteringCoefficient(){return this.parameterUniforms.scatteringCoefficient.value}set scatteringCoefficient(e){this.parameterUniforms.scatteringCoefficient.value=e}get absorptionCoefficient(){return this.parameterUniforms.absorptionCoefficient.value}set absorptionCoefficient(e){this.parameterUniforms.absorptionCoefficient.value=e}get coverage(){return this.parameterUniforms.coverage.value}set coverage(e){this.parameterUniforms.coverage.value=e}get turbulenceDisplacement(){return this.parameterUniforms.turbulenceDisplacement.value}set turbulenceDisplacement(e){this.parameterUniforms.turbulenceDisplacement.value=e}get scatterAnisotropy1(){return this.cloudsPass.currentMaterial.scatterAnisotropy1}set scatterAnisotropy1(e){this.cloudsPass.currentMaterial.scatterAnisotropy1=e}get scatterAnisotropy2(){return this.cloudsPass.currentMaterial.scatterAnisotropy2}set scatterAnisotropy2(e){this.cloudsPass.currentMaterial.scatterAnisotropy2=e}get scatterAnisotropyMix(){return this.cloudsPass.currentMaterial.scatterAnisotropyMix}set scatterAnisotropyMix(e){this.cloudsPass.currentMaterial.scatterAnisotropyMix=e}get skyIrradianceScale(){return this.skyLightScale}set skyIrradianceScale(e){this.skyLightScale=e}get skyLightScale(){return this.cloudsPass.currentMaterial.uniforms.skyLightScale.value}set skyLightScale(e){this.cloudsPass.currentMaterial.uniforms.skyLightScale.value=e}get groundIrradianceScale(){return this.groundBounceScale}set groundIrradianceScale(e){this.groundBounceScale=e}get groundBounceScale(){return this.cloudsPass.currentMaterial.uniforms.groundBounceScale.value}set groundBounceScale(e){this.cloudsPass.currentMaterial.uniforms.groundBounceScale.value=e}get powderScale(){return this.cloudsPass.currentMaterial.uniforms.powderScale.value}set powderScale(e){this.cloudsPass.currentMaterial.uniforms.powderScale.value=e}get powderExponent(){return this.cloudsPass.currentMaterial.uniforms.powderExponent.value}set powderExponent(e){this.cloudsPass.currentMaterial.uniforms.powderExponent.value=e}get atmosphereOverlay(){return this._atmosphereOverlay}get atmosphereShadow(){return this._atmosphereShadow}get atmosphereShadowLength(){return this._atmosphereShadowLength}get irradianceTexture(){return this.cloudsPass.currentMaterial.irradianceTexture}set irradianceTexture(e){this.cloudsPass.currentMaterial.irradianceTexture=e}get scatteringTexture(){return this.cloudsPass.currentMaterial.scatteringTexture}set scatteringTexture(e){this.cloudsPass.currentMaterial.scatteringTexture=e}get transmittanceTexture(){return this.cloudsPass.currentMaterial.transmittanceTexture}set transmittanceTexture(e){this.cloudsPass.currentMaterial.transmittanceTexture=e}get singleMieScatteringTexture(){return this.cloudsPass.currentMaterial.singleMieScatteringTexture}set singleMieScatteringTexture(e){this.cloudsPass.currentMaterial.singleMieScatteringTexture=e}get higherOrderScatteringTexture(){return this.cloudsPass.currentMaterial.higherOrderScatteringTexture}set higherOrderScatteringTexture(e){this.cloudsPass.currentMaterial.higherOrderScatteringTexture=e}get ellipsoid(){return this.cloudsPass.currentMaterial.ellipsoid}set ellipsoid(e){this.cloudsPass.currentMaterial.ellipsoid=e}get sunAngularRadius(){return this.cloudsPass.currentMaterial.sunAngularRadius}set sunAngularRadius(e){this.cloudsPass.currentMaterial.sunAngularRadius=e}}Je([u.define("SKIP_RENDERING")],ue.prototype,"skipRendering");const st=128,ct=32,z="45a1c6c1bb9fd38b3680fd120795ff4c32df68ff",lt=`https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${z}/packages/clouds/assets/local_weather.png`,ut=`https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${z}/packages/clouds/assets/shape.bin`,ht=`https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${z}/packages/clouds/assets/shape_detail.bin`,dt=`https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${z}/packages/clouds/assets/turbulence.png`;exports.CLOUD_SHAPE_DETAIL_TEXTURE_SIZE=ct;exports.CLOUD_SHAPE_TEXTURE_SIZE=st;exports.CloudLayer=g;exports.CloudLayers=M;exports.CloudsEffect=ue;exports.DEFAULT_LOCAL_WEATHER_URL=lt;exports.DEFAULT_SHAPE_DETAIL_URL=ht;exports.DEFAULT_SHAPE_URL=ut;exports.DEFAULT_TURBULENCE_URL=dt;exports.DensityProfile=N;exports.cloudsPassOptionsDefaults=le;
2182
+ `;var Qe=Object.defineProperty,et=(o,e,t,a)=>{for(var i=void 0,r=o.length-1,s;r>=0;r--)(s=o[r])&&(i=s(e,t,i)||i);return i&&Qe(e,t,i),i};const U=new n.Vector3,tt=new n.Vector2,nt=new n.Matrix3,at=["maxIterationCount","minStepSize","maxStepSize","maxRayDistance","perspectiveStepScale","minDensity","minExtinction","minTransmittance","maxIterationCountToSun","maxIterationCountToGround","minSecondaryStepSize","secondaryStepScale","maxShadowFilterRadius","maxShadowLengthIterationCount","minShadowLengthStepSize","maxShadowLengthRayDistance","hazeDensityScale","hazeExponent","hazeScatteringCoefficient","hazeAbsorptionCoefficient"],it=["multiScatteringOctaves","accurateSunSkyLight","accuratePhaseFunction"],rt=["maxIterationCount","minStepSize","maxStepSize","minDensity","minExtinction","minTransmittance","opticalDepthTailScale"],ot=["temporalJitter"],st=["temporalPass"],ct=["cascadeCount","mapSize","maxFar","farScale","splitMode","splitLambda"],x={type:"change"},he={resolutionScale:c.resolutionScale,width:w.Resolution.AUTO_SIZE,height:w.Resolution.AUTO_SIZE};class de extends w.Effect{constructor(e=new n.Camera,t,a=z.AtmosphereParameters.DEFAULT){super("CloudsEffect",Je,{attributes:w.EffectAttribute.DEPTH,uniforms:new Map([["cloudsBuffer",new n.Uniform(null)]])}),this.camera=e,this.atmosphere=a,this.cloudLayers=W.DEFAULT.clone(),this.correctAltitude=!0,this.localWeatherRepeat=new n.Vector2().setScalar(100),this.localWeatherOffset=new n.Vector2,this.shapeRepeat=new n.Vector3().setScalar(3e-4),this.shapeOffset=new n.Vector3,this.shapeDetailRepeat=new n.Vector3().setScalar(.006),this.shapeDetailOffset=new n.Vector3,this.turbulenceRepeat=new n.Vector2().setScalar(20),this.worldToECEFMatrix=new n.Matrix4,this.ecefToWorldMatrix=new n.Matrix4,this.altitudeCorrection=new n.Vector3,this.sunDirection=new n.Vector3,this.localWeatherVelocity=new n.Vector2,this.shapeVelocity=new n.Vector3,this.shapeDetailVelocity=new n.Vector3,this._atmosphereOverlay=null,this._atmosphereShadow=null,this._atmosphereShadowLength=null,this.events=new n.EventDispatcher,this.frame=0,this.shadowCascadeCount=0,this.shadowMapSize=new n.Vector2,this.onResolutionChange=()=>{this.setSize(this.resolution.baseWidth,this.resolution.baseHeight)},this.skipRendering=!0;const{resolutionScale:i,width:r,height:s,resolutionX:l=r,resolutionY:h=s}={...he,...t};this.shadowMaps=new Ee({cascadeCount:c.shadow.cascadeCount,mapSize:c.shadow.mapSize,splitLambda:.6}),this.parameterUniforms=qe({localWeatherTexture:this.proceduralLocalWeather?.texture??null,localWeatherRepeat:this.localWeatherRepeat,localWeatherOffset:this.localWeatherOffset,shapeTexture:this.proceduralShape?.texture??null,shapeRepeat:this.shapeRepeat,shapeOffset:this.shapeOffset,shapeDetailTexture:this.proceduralShapeDetail?.texture??null,shapeDetailRepeat:this.shapeDetailRepeat,shapeDetailOffset:this.shapeDetailOffset,turbulenceTexture:this.proceduralTurbulence?.texture??null,turbulenceRepeat:this.turbulenceRepeat}),this.layerUniforms=Ke(),this.atmosphereUniforms=$e(a,{worldToECEFMatrix:this.worldToECEFMatrix,ecefToWorldMatrix:this.ecefToWorldMatrix,altitudeCorrection:this.altitudeCorrection,sunDirection:this.sunDirection});const d={shadow:this.shadowMaps,parameterUniforms:this.parameterUniforms,layerUniforms:this.layerUniforms,atmosphereUniforms:this.atmosphereUniforms};this.shadowPass=new Ze(d),this.shadowPass.mainCamera=e,this.cloudsPass=new He(d,a),this.cloudsPass.mainCamera=e,this.clouds=u.definePropertyShorthand(u.defineUniformShorthand({},this.cloudsPass.currentMaterial,at),this.cloudsPass.currentMaterial,it),this.shadow=u.definePropertyShorthand(u.defineUniformShorthand({},this.shadowPass.currentMaterial,rt),this.shadowPass.currentMaterial,ot,this.shadowPass,st,this.shadowMaps,ct),this.resolution=new w.Resolution(this,l,h,i),this.resolution.addEventListener("change",this.onResolutionChange)}get mainCamera(){return this.camera}set mainCamera(e){this.camera=e,this.shadowPass.mainCamera=e,this.cloudsPass.mainCamera=e}initialize(e,t,a){this.shadowPass.initialize(e,t,a),this.cloudsPass.initialize(e,t,a)}updateSharedUniforms(e){Xe(this.layerUniforms,this.cloudLayers);const{parameterUniforms:t}=this;t.localWeatherOffset.value.add(tt.copy(this.localWeatherVelocity).multiplyScalar(e)),t.shapeOffset.value.add(U.copy(this.shapeVelocity).multiplyScalar(e)),t.shapeDetailOffset.value.add(U.copy(this.shapeDetailVelocity).multiplyScalar(e));const a=this.worldToECEFMatrix;this.ecefToWorldMatrix.copy(a).invert();const i=this.camera.getWorldPosition(U).applyMatrix4(this.worldToECEFMatrix),r=this.altitudeCorrection;this.correctAltitude?z.getAltitudeCorrectionOffset(i,this.atmosphere.bottomRadius,this.ellipsoid,r):r.setScalar(0);const s=this.ellipsoid.getSurfaceNormal(i,U),l=this.sunDirection.dot(s),h=u.lerp(1e6,1e3,l),d=nt.setFromMatrix4(a).transpose();this.shadowMaps.update(this.camera,U.copy(this.sunDirection).applyMatrix3(d),h)}updateWeatherTextureChannels(){const e=this.cloudLayers.localWeatherChannels;this.cloudsPass.currentMaterial.localWeatherChannels=e,this.shadowPass.currentMaterial.localWeatherChannels=e}updateAtmosphereComposition(){const{shadowMaps:e,shadowPass:t,cloudsPass:a}=this,i=t.currentMaterial.uniforms,r=a.currentMaterial.uniforms,s=this._atmosphereOverlay,l=Object.assign(this._atmosphereOverlay??{},{map:a.outputBuffer});s!==l&&(this._atmosphereOverlay=l,x.target=this,x.property="atmosphereOverlay",this.events.dispatchEvent(x));const h=this._atmosphereShadow,d=Object.assign(this._atmosphereShadow??{},{map:t.outputBuffer,mapSize:e.mapSize,cascadeCount:e.cascadeCount,intervals:r.shadowIntervals.value,matrices:r.shadowMatrices.value,inverseMatrices:i.inverseShadowMatrices.value,far:e.far,topHeight:r.shadowTopHeight.value});h!==d&&(this._atmosphereShadow=d,x.target=this,x.property="atmosphereShadow",this.events.dispatchEvent(x));const p=this._atmosphereShadowLength,f=a.shadowLengthBuffer!=null?Object.assign(this._atmosphereShadowLength??{},{map:a.shadowLengthBuffer}):null;p!==f&&(this._atmosphereShadowLength=f,x.target=this,x.property="atmosphereShadowLength",this.events.dispatchEvent(x))}update(e,t,a=0){const{shadowMaps:i,shadowPass:r,cloudsPass:s}=this;if(i.cascadeCount!==this.shadowCascadeCount||!i.mapSize.equals(this.shadowMapSize)){const{width:l,height:h}=i.mapSize,d=i.cascadeCount;this.shadowMapSize.set(l,h),this.shadowCascadeCount=d,r.setSize(l,h,d),s.setShadowSize(l,h,d)}this.proceduralLocalWeather?.render(e,a),this.proceduralShape?.render(e,a),this.proceduralShapeDetail?.render(e,a),this.proceduralTurbulence?.render(e,a),++this.frame,this.updateSharedUniforms(a),this.updateWeatherTextureChannels(),r.update(e,this.frame,a),s.shadowBuffer=r.outputBuffer,s.update(e,this.frame,a),this.updateAtmosphereComposition(),this.uniforms.get("cloudsBuffer").value=this.cloudsPass.outputBuffer}setSize(e,t){const{resolution:a}=this;a.setBaseSize(e,t);const{width:i,height:r}=a;this.cloudsPass.setSize(i,r)}setDepthTexture(e,t){this.shadowPass.setDepthTexture(e,t),this.cloudsPass.setDepthTexture(e,t)}set qualityPreset(e){const{clouds:t,shadow:a,...i}=_e[e];Object.assign(this,i),Object.assign(this.clouds,t),Object.assign(this.shadow,a)}get localWeatherTexture(){return this.proceduralLocalWeather??this.parameterUniforms.localWeatherTexture.value}set localWeatherTexture(e){e instanceof n.Texture||e==null?(this.proceduralLocalWeather=void 0,this.parameterUniforms.localWeatherTexture.value=e):(this.proceduralLocalWeather=e,this.parameterUniforms.localWeatherTexture.value=e.texture)}get shapeTexture(){return this.proceduralShape??this.parameterUniforms.shapeTexture.value}set shapeTexture(e){e instanceof n.Data3DTexture||e==null?(this.proceduralShape=void 0,this.parameterUniforms.shapeTexture.value=e):(this.proceduralShape=e,this.parameterUniforms.shapeTexture.value=e.texture)}get shapeDetailTexture(){return this.proceduralShapeDetail??this.parameterUniforms.shapeDetailTexture.value}set shapeDetailTexture(e){e instanceof n.Data3DTexture||e==null?(this.proceduralShapeDetail=void 0,this.parameterUniforms.shapeDetailTexture.value=e):(this.proceduralShapeDetail=e,this.parameterUniforms.shapeDetailTexture.value=e.texture)}get turbulenceTexture(){return this.proceduralTurbulence??this.parameterUniforms.turbulenceTexture.value}set turbulenceTexture(e){e instanceof n.Texture||e==null?(this.proceduralTurbulence=void 0,this.parameterUniforms.turbulenceTexture.value=e):(this.proceduralTurbulence=e,this.parameterUniforms.turbulenceTexture.value=e.texture)}get stbnTexture(){return this.cloudsPass.currentMaterial.uniforms.stbnTexture.value}set stbnTexture(e){this.cloudsPass.currentMaterial.uniforms.stbnTexture.value=e,this.shadowPass.currentMaterial.uniforms.stbnTexture.value=e}get resolutionScale(){return this.resolution.scale}set resolutionScale(e){this.resolution.scale=e}get temporalUpscale(){return this.cloudsPass.temporalUpscale}set temporalUpscale(e){this.cloudsPass.temporalUpscale=e}get lightShafts(){return this.cloudsPass.lightShafts}set lightShafts(e){this.cloudsPass.lightShafts=e}get shapeDetail(){return this.cloudsPass.currentMaterial.shapeDetail}set shapeDetail(e){this.cloudsPass.currentMaterial.shapeDetail=e,this.shadowPass.currentMaterial.shapeDetail=e}get turbulence(){return this.cloudsPass.currentMaterial.turbulence}set turbulence(e){this.cloudsPass.currentMaterial.turbulence=e,this.shadowPass.currentMaterial.turbulence=e}get haze(){return this.cloudsPass.currentMaterial.haze}set haze(e){this.cloudsPass.currentMaterial.haze=e}get scatteringCoefficient(){return this.parameterUniforms.scatteringCoefficient.value}set scatteringCoefficient(e){this.parameterUniforms.scatteringCoefficient.value=e}get absorptionCoefficient(){return this.parameterUniforms.absorptionCoefficient.value}set absorptionCoefficient(e){this.parameterUniforms.absorptionCoefficient.value=e}get coverage(){return this.parameterUniforms.coverage.value}set coverage(e){this.parameterUniforms.coverage.value=e}get turbulenceDisplacement(){return this.parameterUniforms.turbulenceDisplacement.value}set turbulenceDisplacement(e){this.parameterUniforms.turbulenceDisplacement.value=e}get scatterAnisotropy1(){return this.cloudsPass.currentMaterial.scatterAnisotropy1}set scatterAnisotropy1(e){this.cloudsPass.currentMaterial.scatterAnisotropy1=e}get scatterAnisotropy2(){return this.cloudsPass.currentMaterial.scatterAnisotropy2}set scatterAnisotropy2(e){this.cloudsPass.currentMaterial.scatterAnisotropy2=e}get scatterAnisotropyMix(){return this.cloudsPass.currentMaterial.scatterAnisotropyMix}set scatterAnisotropyMix(e){this.cloudsPass.currentMaterial.scatterAnisotropyMix=e}get skyIrradianceScale(){return this.skyLightScale}set skyIrradianceScale(e){this.skyLightScale=e}get skyLightScale(){return this.cloudsPass.currentMaterial.uniforms.skyLightScale.value}set skyLightScale(e){this.cloudsPass.currentMaterial.uniforms.skyLightScale.value=e}get groundIrradianceScale(){return this.groundBounceScale}set groundIrradianceScale(e){this.groundBounceScale=e}get groundBounceScale(){return this.cloudsPass.currentMaterial.uniforms.groundBounceScale.value}set groundBounceScale(e){this.cloudsPass.currentMaterial.uniforms.groundBounceScale.value=e}get powderScale(){return this.cloudsPass.currentMaterial.uniforms.powderScale.value}set powderScale(e){this.cloudsPass.currentMaterial.uniforms.powderScale.value=e}get powderExponent(){return this.cloudsPass.currentMaterial.uniforms.powderExponent.value}set powderExponent(e){this.cloudsPass.currentMaterial.uniforms.powderExponent.value=e}get atmosphereOverlay(){return this._atmosphereOverlay}get atmosphereShadow(){return this._atmosphereShadow}get atmosphereShadowLength(){return this._atmosphereShadowLength}get irradianceTexture(){return this.cloudsPass.currentMaterial.irradianceTexture}set irradianceTexture(e){this.cloudsPass.currentMaterial.irradianceTexture=e}get scatteringTexture(){return this.cloudsPass.currentMaterial.scatteringTexture}set scatteringTexture(e){this.cloudsPass.currentMaterial.scatteringTexture=e}get transmittanceTexture(){return this.cloudsPass.currentMaterial.transmittanceTexture}set transmittanceTexture(e){this.cloudsPass.currentMaterial.transmittanceTexture=e}get singleMieScatteringTexture(){return this.cloudsPass.currentMaterial.singleMieScatteringTexture}set singleMieScatteringTexture(e){this.cloudsPass.currentMaterial.singleMieScatteringTexture=e}get higherOrderScatteringTexture(){return this.cloudsPass.currentMaterial.higherOrderScatteringTexture}set higherOrderScatteringTexture(e){this.cloudsPass.currentMaterial.higherOrderScatteringTexture=e}get ellipsoid(){return this.cloudsPass.currentMaterial.ellipsoid}set ellipsoid(e){this.cloudsPass.currentMaterial.ellipsoid=e}get sunAngularRadius(){return this.cloudsPass.currentMaterial.sunAngularRadius}set sunAngularRadius(e){this.cloudsPass.currentMaterial.sunAngularRadius=e}}et([u.define("SKIP_RENDERING")],de.prototype,"skipRendering");const lt=128,ut=32,B="45a1c6c1bb9fd38b3680fd120795ff4c32df68ff",ht=`https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${B}/packages/clouds/assets/local_weather.png`,dt=`https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${B}/packages/clouds/assets/shape.bin`,pt=`https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${B}/packages/clouds/assets/shape_detail.bin`,ft=`https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${B}/packages/clouds/assets/turbulence.png`;exports.CLOUD_SHAPE_DETAIL_TEXTURE_SIZE=ut;exports.CLOUD_SHAPE_TEXTURE_SIZE=lt;exports.CloudLayer=S;exports.CloudLayers=W;exports.CloudsEffect=de;exports.DEFAULT_LOCAL_WEATHER_URL=ht;exports.DEFAULT_SHAPE_DETAIL_URL=pt;exports.DEFAULT_SHAPE_URL=dt;exports.DEFAULT_TURBULENCE_URL=ft;exports.DensityProfile=b;exports.cloudsPassOptionsDefaults=he;
2183
2183
  //# sourceMappingURL=shared.cjs.map