@adatechnology/game-weather-three 0.5.19 → 0.6.0

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/README.md CHANGED
@@ -9,7 +9,7 @@ The three.js picture of [`@adatechnology/game-weather`](../game-weather): the ra
9
9
  | **Near rain** (`createNearRain`) | the Workshop's streaks (`engine.rain`, up to 4 000, slanted by the wind), the splashes on the `normal` sprite pool and the rings (only where `puddleAt` says there is a puddle, within `12 / (1 + quality)` m); `game-vfx-three` draws them | Workshop W313-331 |
10
10
  | **Mist and ash** (`emitAirborne`) | `mistPerSecond` puffs of low mist and `ashPerSecond` flakes of falling ash a second around the camera, into the same pool | Workshop `neblina`, W1085-1086 |
11
11
  | **Fog** (`createFog`, `fogOf`) | linear fog (near 25 m, far from the weather: 220 clear, 140 rain) or exponential-squared fog where the weather has a density (`fog` 0.075), and the zone fog (colour, far, weight; near 4 m at full weight) | game `skyUpdate` and `ZONA_NEBLINA` |
12
- | **Sky** (`createSky`) | night colour `0x0b0f18` to day `0x8796a6` by `sample.sun`, times `sample.skyScale` (the page's 0.8 in rain), pulled to the zone colour; it also gives the fog its colour | game `skyUpdate` |
12
+ | **Sky** (`createSky`, `createWeatherRenderer({ sun })`) | colour `0x0b0f18` to `0x8796a6` by `sample.sun`, times `sample.skyScale`, pulled to the zone colour; it is the fog's colour and the dome's horizon. With a camera it also builds one dome that follows it (renders first, no depth, no ray target): zenith-to-horizon gradient, sun disc and glow in the host sun's direction (the hour's arc without one), sunrise and sunset warmth, one procedural cloud layer whose cover follows the weather (`cloudCoverOf`: scattered clear, full overcast in rain, darker in storms) and drifts with the wind, and at night the moon and stars (`starVisibilityOf`: none under overcast). `dispose()` releases it | game `skyUpdate` for the colour; the dome is the kit's |
13
13
  | **Lightning** (`createLightning`) | the double flash of `sample.flash`: hemisphere light `+ 3.2 I`, background `+ I * (.25, .27, .32)`, screen white `I * .12` | Workshop `chuva`, W1068-1072 |
14
14
  | **Headlights** (`createHeadlights`) | two spot lights and two additive beam cones on any `Object3D`, lit at night, in rain or in fog, real light only within 40 m of the camera, and rain that glows inside the beam (up to 600 lit drops a second) | Workshop `farol`, W101-103 and W1161-1170 |
15
15
  | **Heat haze** (`createHeatHaze`) | warm bands that rise over the lower half of the view, by `sample.haze` | SDK-made: no team delivered it |
@@ -35,7 +35,7 @@ picture.update(dt)
35
35
  `createWeatherTestModule({ visual: createWeatherVisual({ vfx: room.vfx }) })` (the module of `game-weather`) adds the picture to the weather bench: seven layers
36
36
  (rain curtain, near rain and splashes, mist and ash, sky, lightning, headlights, heat haze; names in pt-BR and en), and a lamp rig in front of the camera to show the headlights. The rig's car is not drawn here: pass
37
37
  `vehicles: (THREE) => createVehiclesThree(THREE, { kit })` (game-vehicles-three, with the fleet installed) and it builds a fleet car (`rigVehicle`, default
38
- `midsize_sedan`) under the lamps, so it follows the vehicles SDK; without it the rig has only the lamps and their beams. `layers: { sky: false }` keeps a room's own sky; the bench's own `fog` layer reaches the
38
+ `midsize_sedan`) under the lamps, so it follows the vehicles SDK; without it the rig has only the lamps and their beams. `layers: { sky: false }` keeps a room's own sky (the dome follows the host's shadow-casting `DirectionalLight`, or `sun`); the bench's own `fog` layer reaches the
39
39
  renderer too. The fog layer gives back the fog the host had when it is switched off.
40
40
 
41
41
  ## Proof
@@ -132,22 +132,282 @@ function createHeadlights(THREE, rules = {}) {
132
132
  // src/fog.ts
133
133
  import { createFog as createStableFog } from "@adatechnology/game-render-three";
134
134
 
135
+ // src/sky-shader.ts
136
+ var SKY_VERTEX = (
137
+ /* glsl */
138
+ `
139
+ varying vec3 vDir;
140
+ void main() {
141
+ vDir = normalize(position);
142
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
143
+ }
144
+ `
145
+ );
146
+ var SKY_FRAGMENT = (
147
+ /* glsl */
148
+ `
149
+ precision highp float;
150
+ uniform vec3 uZenith;
151
+ uniform vec3 uHorizon;
152
+ uniform vec3 uTint;
153
+ uniform vec3 uSunDir;
154
+ uniform vec3 uSunColor;
155
+ uniform vec3 uMoonDir;
156
+ uniform vec3 uCloudLit;
157
+ uniform vec3 uCloudShade;
158
+ uniform vec3 uDrift;
159
+ uniform float uSunsetAmount;
160
+ uniform float uSunVis;
161
+ uniform float uMoonVis;
162
+ uniform float uStars;
163
+ uniform float uCover;
164
+ uniform float uTime;
165
+ uniform float uFlash;
166
+ varying vec3 vDir;
167
+
168
+ float hash2(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
169
+ float hash3(vec3 p) { return fract(sin(dot(p, vec3(127.1, 311.7, 74.7))) * 43758.5453); }
170
+ float noise(vec2 p) {
171
+ vec2 i = floor(p);
172
+ vec2 f = fract(p);
173
+ f = f * f * (3.0 - 2.0 * f);
174
+ return mix(mix(hash2(i), hash2(i + vec2(1.0, 0.0)), f.x), mix(hash2(i + vec2(0.0, 1.0)), hash2(i + vec2(1.0, 1.0)), f.x), f.y);
175
+ }
176
+ float fbm(vec2 p) {
177
+ float value = 0.0;
178
+ float amplitude = 0.5;
179
+ for (int octave = 0; octave < 4; octave++) {
180
+ value += amplitude * noise(p);
181
+ p = p * 2.03 + vec2(17.1, 9.2);
182
+ amplitude *= 0.5;
183
+ }
184
+ return value;
185
+ }
186
+
187
+ void main() {
188
+ vec3 d = normalize(vDir);
189
+ float height = max(d.y, 0.0);
190
+ vec3 color = mix(uHorizon, uZenith, pow(height, 0.6));
191
+
192
+ vec2 azimuth = normalize(d.xz + vec2(1e-5));
193
+ vec2 sunAzimuth = normalize(uSunDir.xz + vec2(1e-5));
194
+ float towardSun = max(dot(azimuth, sunAzimuth), 0.0);
195
+ color = mix(color, uTint, uSunsetAmount * exp(-height * 6.0) * (0.25 + 0.75 * towardSun * towardSun));
196
+
197
+ float aboveHorizon = smoothstep(-0.05, 0.05, d.y);
198
+ if (uStars > 0.001 && d.y > 0.0) {
199
+ vec3 p = d * 120.0;
200
+ vec3 cell = floor(p);
201
+ float pick = hash3(cell);
202
+ if (pick > 0.985) {
203
+ vec3 spot = vec3(hash3(cell + 1.7), hash3(cell + 5.3), hash3(cell + 9.1)) * 0.4 + 0.3;
204
+ float twinkle = 0.78 + 0.22 * sin(uTime * 2.0 + pick * 60.0);
205
+ float star = (1.0 - smoothstep(0.04, 0.32, length(fract(p) - spot))) * (0.45 + 0.55 * fract(pick * 97.0)) * twinkle;
206
+ color += vec3(0.85, 0.9, 1.0) * star * uStars * smoothstep(0.0, 0.12, d.y);
207
+ }
208
+ }
209
+
210
+ if (uMoonVis > 0.001) {
211
+ float toMoon = dot(d, uMoonDir);
212
+ vec3 tangent = normalize(cross(uMoonDir, vec3(0.0, 1.0, 0.0)));
213
+ vec2 onDisc = vec2(dot(d, tangent), dot(d, cross(uMoonDir, tangent))) / 0.045;
214
+ float disc = (1.0 - smoothstep(0.93, 1.0, length(onDisc))) * step(0.0, toMoon);
215
+ vec3 moon = vec3(0.7, 0.73, 0.8) * (0.62 + 0.38 * fbm(onDisc * 3.0 + 3.0));
216
+ color += (moon * disc + vec3(0.55, 0.62, 0.8) * pow(max(toMoon, 0.0), 220.0) * 0.5) * uMoonVis * aboveHorizon;
217
+ }
218
+
219
+ if (uSunVis > 0.001) {
220
+ float toSun = dot(d, uSunDir);
221
+ float disc = smoothstep(0.99935, 0.99965, toSun);
222
+ float glow = pow(max(toSun, 0.0), 48.0) * 0.5 + pow(max(toSun, 0.0), 6.0) * 0.14;
223
+ color += uSunColor * (glow + disc * 2.5) * uSunVis * aboveHorizon;
224
+ }
225
+
226
+ if (d.y > -0.05) {
227
+ vec2 uv = d.xz / (height + 0.18) * 1.1 + uDrift.xy;
228
+ float density = fbm(uv);
229
+ float threshold = 0.74 - uCover * 0.9;
230
+ float coverage = smoothstep(threshold, threshold + 0.22, density) * smoothstep(-0.05, 0.12, d.y);
231
+ float thick = smoothstep(threshold, threshold + 0.5, density);
232
+ vec3 cloud = mix(uCloudLit, uCloudShade, thick * 0.8);
233
+ cloud = mix(uHorizon, cloud, smoothstep(0.0, 0.3, d.y));
234
+ color = mix(color, cloud, coverage);
235
+ }
236
+
237
+ color = mix(color, vec3(0.78, 0.82, 0.95), uFlash * 0.7);
238
+ gl_FragColor = vec4(color, 1.0);
239
+ #include <colorspace_fragment>
240
+ }
241
+ `
242
+ );
243
+
244
+ // src/sky-state.ts
245
+ var clamp01 = (value) => value < 0 ? 0 : value > 1 ? 1 : value;
246
+ var smoothstep = (from, to, value) => {
247
+ const t = clamp01((value - from) / (to - from));
248
+ return t * t * (3 - 2 * t);
249
+ };
250
+ var CLOUD_COVER = { clear: 0.2, perSkyDimming: 7, perRainMm: 0.4, rainFullAtMm: 5, windMax: 0.15, windFullAt: 20 };
251
+ var DARK_FROM_SKY_SCALE = 0.95;
252
+ var DARK_SPAN = 0.45;
253
+ function cloudCoverOf(sample) {
254
+ const dimming = clamp01(1 - sample.skyScale);
255
+ const rain = Math.min(1, sample.rain / CLOUD_COVER.rainFullAtMm);
256
+ const wind = Math.min(1, Math.hypot(sample.windX, sample.windZ) / CLOUD_COVER.windFullAt) * CLOUD_COVER.windMax;
257
+ return clamp01(CLOUD_COVER.clear + dimming * CLOUD_COVER.perSkyDimming + rain * CLOUD_COVER.perRainMm + wind);
258
+ }
259
+ function cloudDarknessOf(sample) {
260
+ return clamp01((DARK_FROM_SKY_SCALE - sample.skyScale) / DARK_SPAN);
261
+ }
262
+ var nightnessOf = (sample) => clamp01(sample.nightFactor) ** 3;
263
+ function starVisibilityOf(sample) {
264
+ return nightnessOf(sample) * clamp01(1 - cloudCoverOf(sample) * 1.25);
265
+ }
266
+ function sunsetOf(sample) {
267
+ const low = smoothstep(0.02, 0.15, sample.sun) * (1 - smoothstep(0.15, 0.5, sample.sun));
268
+ return low * (1 - cloudCoverOf(sample) * 0.75);
269
+ }
270
+ var sunVisibilityOf = (sample) => smoothstep(0.02, 0.15, sample.sun);
271
+ function sunDirectionOf(sample, host, out) {
272
+ if (host) {
273
+ const target = host.target?.position;
274
+ out.x = host.position.x - (target?.x ?? 0);
275
+ out.y = host.position.y - (target?.y ?? 0);
276
+ out.z = host.position.z - (target?.z ?? 0);
277
+ } else {
278
+ const angle = (sample.dayFraction - 0.25) * Math.PI * 2;
279
+ out.x = Math.cos(angle);
280
+ out.y = Math.sin(angle);
281
+ out.z = -0.3;
282
+ }
283
+ const length = Math.hypot(out.x, out.y, out.z) || 1;
284
+ out.x /= length;
285
+ out.y /= length;
286
+ out.z /= length;
287
+ return out;
288
+ }
289
+
135
290
  // src/sky.ts
136
291
  var SKY_NIGHT = 724760;
137
292
  var SKY_DAY = 8885926;
138
293
  var ZONE_LIGHT = { base: 0.35, sun: 0.65 };
139
294
  var ZONE_FOG_DEFAULTS = { color: 3820090, far: 60 };
140
- function createSky(THREE, scene) {
295
+ var SKY_DOME = {
296
+ zenithDay: 4159684,
297
+ zenithNight: 132106,
298
+ sunsetTint: 16742973,
299
+ sunDay: 16774368,
300
+ sunSet: 16751184,
301
+ cloudDay: 16054010,
302
+ cloudOvercast: 12107462,
303
+ cloudStorm: 4080460,
304
+ cloudNight: 1712176,
305
+ /** How much of the sunset warmth the horizon (and so the fog) takes. */
306
+ fogWarmth: 0.3,
307
+ /** Clouds drift this many noise units per second for each m/s of wind (wind capped at `driftMaxWind`). */
308
+ drift: 25e-4,
309
+ driftMaxWind: 20,
310
+ /** Largest radius of the dome; it is 90 % of the camera's far plane when that is smaller. */
311
+ radius: 900,
312
+ renderOrder: -1e3
313
+ };
314
+ function createDome(THREE, camera) {
315
+ const vector = () => ({ value: new THREE.Vector3() });
316
+ const colour = (hex) => ({ value: new THREE.Color(hex) });
317
+ const uniforms = {
318
+ uZenith: colour(SKY_DOME.zenithDay),
319
+ uHorizon: colour(SKY_DAY),
320
+ uTint: colour(SKY_DOME.sunsetTint),
321
+ uSunDir: vector(),
322
+ uSunColor: colour(SKY_DOME.sunDay),
323
+ uMoonDir: vector(),
324
+ uCloudLit: colour(SKY_DOME.cloudDay),
325
+ uCloudShade: colour(SKY_DOME.cloudOvercast),
326
+ uDrift: vector(),
327
+ uSunsetAmount: { value: 0 },
328
+ uSunVis: { value: 0 },
329
+ uMoonVis: { value: 0 },
330
+ uStars: { value: 0 },
331
+ uCover: { value: 0 },
332
+ uTime: { value: 0 },
333
+ uFlash: { value: 0 }
334
+ };
335
+ const geometry = new THREE.SphereGeometry(1, 24, 12);
336
+ const material = new THREE.ShaderMaterial({ uniforms, vertexShader: SKY_VERTEX, fragmentShader: SKY_FRAGMENT, side: THREE.BackSide, depthTest: false, depthWrite: false, fog: false, toneMapped: false });
337
+ const mesh = new THREE.Mesh(geometry, material);
338
+ mesh.name = "sky-dome";
339
+ mesh.renderOrder = SKY_DOME.renderOrder;
340
+ mesh.frustumCulled = false;
341
+ mesh.raycast = () => void 0;
342
+ const far = camera.far;
343
+ mesh.scale.setScalar(far > 0 ? Math.min(SKY_DOME.radius, far * 0.9) : SKY_DOME.radius);
344
+ return {
345
+ mesh,
346
+ uniforms,
347
+ dispose() {
348
+ mesh.removeFromParent();
349
+ geometry.dispose();
350
+ material.dispose();
351
+ }
352
+ };
353
+ }
354
+ function createSky(THREE, scene, options = {}) {
141
355
  const night = new THREE.Color(SKY_NIGHT);
142
356
  const day = new THREE.Color(SKY_DAY);
143
357
  const zoneColor = new THREE.Color(ZONE_FOG_DEFAULTS.color);
144
358
  const tint = new THREE.Color();
145
359
  const color = new THREE.Color();
360
+ const sunsetColor = new THREE.Color(SKY_DOME.sunsetTint);
361
+ const zenithDay = new THREE.Color(SKY_DOME.zenithDay);
362
+ const zenithNight = new THREE.Color(SKY_DOME.zenithNight);
363
+ const sunDay = new THREE.Color(SKY_DOME.sunDay);
364
+ const sunSet = new THREE.Color(SKY_DOME.sunSet);
365
+ const cloudDay = new THREE.Color(SKY_DOME.cloudDay);
366
+ const cloudOvercast = new THREE.Color(SKY_DOME.cloudOvercast);
367
+ const cloudStorm = new THREE.Color(SKY_DOME.cloudStorm);
368
+ const cloudNight = new THREE.Color(SKY_DOME.cloudNight);
369
+ const sunDirection = { x: 0, y: 1, z: 0 };
370
+ const dome = options.camera ? createDome(THREE, options.camera) : void 0;
371
+ let time = 0;
372
+ const updateDome = (sample, dt) => {
373
+ if (!dome || !options.camera) return;
374
+ const { uniforms, mesh } = dome;
375
+ time += dt;
376
+ const cover = cloudCoverOf(sample);
377
+ const sunset = sunsetOf(sample);
378
+ const dark = cloudDarknessOf(sample);
379
+ mesh.visible = true;
380
+ mesh.position.copy(options.camera.position);
381
+ const zenith = uniforms.uZenith.value;
382
+ zenith.lerpColors(zenithNight, zenithDay, sample.sun).multiplyScalar(sample.skyScale).lerp(color, cover * 0.85);
383
+ uniforms.uHorizon.value.copy(color);
384
+ const lit = uniforms.uCloudLit.value;
385
+ lit.lerpColors(cloudDay, cloudOvercast, cover * cover).lerp(cloudStorm, dark).lerp(cloudNight, 1 - Math.min(1, sample.sun * 2.2));
386
+ lit.lerp(sunsetColor, sunset * 0.45);
387
+ uniforms.uCloudShade.value.copy(lit).multiplyScalar(0.62);
388
+ uniforms.uSunColor.value.lerpColors(sunDay, sunSet, sunset);
389
+ const sunVector = uniforms.uSunDir.value;
390
+ sunDirectionOf(sample, options.sun, sunDirection);
391
+ sunVector.set(sunDirection.x, sunDirection.y, sunDirection.z);
392
+ uniforms.uMoonDir.value.set(-sunDirection.x, Math.abs(sunDirection.y) * 0.9 + 0.1, -sunDirection.z).normalize();
393
+ const drift = uniforms.uDrift.value;
394
+ drift.x += Math.max(-SKY_DOME.driftMaxWind, Math.min(SKY_DOME.driftMaxWind, sample.windX)) * SKY_DOME.drift * dt;
395
+ drift.y += Math.max(-SKY_DOME.driftMaxWind, Math.min(SKY_DOME.driftMaxWind, sample.windZ)) * SKY_DOME.drift * dt;
396
+ uniforms.uCover.value = cover;
397
+ uniforms.uSunsetAmount.value = sunset;
398
+ uniforms.uSunVis.value = sunVisibilityOf(sample);
399
+ uniforms.uMoonVis.value = nightnessOf(sample);
400
+ uniforms.uStars.value = starVisibilityOf(sample);
401
+ uniforms.uTime.value = time;
402
+ uniforms.uFlash.value = sample.flash;
403
+ };
146
404
  return {
147
405
  color,
148
- update(sample, zone) {
406
+ ...dome ? { object: dome.mesh } : {},
407
+ update(sample, zone, dt = 0) {
149
408
  color.lerpColors(night, day, sample.sun);
150
409
  color.multiplyScalar(sample.skyScale);
410
+ if (dome) color.lerp(sunsetColor, sunsetOf(sample) * SKY_DOME.fogWarmth);
151
411
  if (zone && zone.weight > 0) {
152
412
  zoneColor.setHex(zone.color ?? ZONE_FOG_DEFAULTS.color);
153
413
  color.lerp(tint.copy(zoneColor).multiplyScalar(ZONE_LIGHT.base + sample.sun * ZONE_LIGHT.sun), zone.weight);
@@ -155,7 +415,11 @@ function createSky(THREE, scene) {
155
415
  const background = scene.background;
156
416
  if (background && background.isColor) background.copy(color);
157
417
  else scene.background = color.clone();
418
+ updateDome(sample, dt);
158
419
  return color;
420
+ },
421
+ dispose() {
422
+ dome?.dispose();
159
423
  }
160
424
  };
161
425
  }
@@ -389,7 +653,8 @@ function createWeatherRenderer(THREE, options) {
389
653
  const curtain = createRainCurtain(THREE, { ...options.random ? { random: options.random } : {}, ...options.profile ? { profile: options.profile } : {} });
390
654
  const haze = createHeatHaze(THREE);
391
655
  group.add(curtain.object, haze.object);
392
- const sky = createSky(THREE, scene);
656
+ const sky = createSky(THREE, scene, { camera, ...options.sun ? { sun: options.sun } : {} });
657
+ if (sky.object) group.add(sky.object);
393
658
  const fog = createFog(THREE, scene, { stable: options.lights !== void 0 });
394
659
  const lightning = createLightning(THREE, scene, vfx, options.lights ? { lights: options.lights } : {});
395
660
  const headlights = createHeadlights(THREE, options.lights ? { ...options.headlights, lights: options.lights } : options.headlights);
@@ -404,6 +669,7 @@ function createWeatherRenderer(THREE, options) {
404
669
  else if (id === "fog") fog.clear();
405
670
  else if (id === "lightning") lightning.light.intensity = 0;
406
671
  else if (id === "haze") haze.object.visible = false;
672
+ else if (id === "sky" && sky.object) sky.object.visible = false;
407
673
  };
408
674
  return {
409
675
  curtain,
@@ -423,7 +689,7 @@ function createWeatherRenderer(THREE, options) {
423
689
  const where = [eye.x, eye.y, eye.z];
424
690
  const background = scene.background ?? void 0;
425
691
  const ownSky = on.get("sky") === true;
426
- const color = ownSky ? sky.update(sample, zone) : background && background.isColor ? background : sky.color;
692
+ const color = ownSky ? sky.update(sample, zone, dt) : background && background.isColor ? background : sky.color;
427
693
  if (on.get("fog")) fog.update(sample, color, zone);
428
694
  if (on.get("lightning")) lightning.update(sample, ownSky ? scene.background : void 0);
429
695
  if (on.get("far_rain")) curtain.update(sample, eye, time, sample.sun);
@@ -450,6 +716,7 @@ function createWeatherRenderer(THREE, options) {
450
716
  scene.remove(group);
451
717
  curtain.dispose();
452
718
  haze.dispose();
719
+ sky.dispose();
453
720
  lightning.dispose();
454
721
  headlights.dispose();
455
722
  nearRain.clear();
@@ -505,6 +772,7 @@ function createWeatherVisual(options = {}) {
505
772
  ...options.puddleAt ? { puddleAt: options.puddleAt } : {},
506
773
  ...options.headlights ? { headlights: options.headlights } : {},
507
774
  ...options.layers ? { layers: options.layers } : {},
775
+ ...sunOption(options.sun ?? sunOf(host.scene)),
508
776
  ...isLightBudget(host.lights) ? { lights: host.lights } : {}
509
777
  });
510
778
  const item = options.rigItem && host.addObject ? options.rigItem : void 0;
@@ -512,6 +780,15 @@ function createWeatherVisual(options = {}) {
512
780
  }
513
781
  };
514
782
  }
783
+ function sunOf(scene) {
784
+ let found;
785
+ scene.traverse((node) => {
786
+ const light = node;
787
+ if (!found && light.isDirectionalLight && light.castShadow) found = light;
788
+ });
789
+ return found;
790
+ }
791
+ var sunOption = (sun) => sun ? { sun } : {};
515
792
  function footprintOf(car) {
516
793
  if (!car.width) return void 0;
517
794
  const z = car.group.position.z;
@@ -581,10 +858,19 @@ function attachRig(THREE, host, renderer, place, vehicles, key, item) {
581
858
  var WEATHER_IDS = ["far_rain", "near_rain", "mist", "fog", "sky", "lightning", "headlights", "haze"];
582
859
 
583
860
  export {
861
+ CLOUD_COVER,
862
+ cloudCoverOf,
863
+ cloudDarknessOf,
864
+ nightnessOf,
865
+ starVisibilityOf,
866
+ sunsetOf,
867
+ sunVisibilityOf,
868
+ sunDirectionOf,
584
869
  SKY_NIGHT,
585
870
  SKY_DAY,
586
871
  ZONE_LIGHT,
587
872
  ZONE_FOG_DEFAULTS,
873
+ SKY_DOME,
588
874
  createSky,
589
875
  FOG_NEAR,
590
876
  FOG_ZONE_NEAR,
@@ -618,4 +904,4 @@ export {
618
904
  weatherVisualTextOf,
619
905
  createWeatherVisual
620
906
  };
621
- //# sourceMappingURL=chunk-SOEOSGSU.js.map
907
+ //# sourceMappingURL=chunk-BTGKQODB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/bench/visual.ts","../src/headlights.ts","../src/fog.ts","../src/sky-shader.ts","../src/sky-state.ts","../src/sky.ts","../src/heat-haze.ts","../src/lightning.ts","../src/rain-near.ts","../src/rain-curtain.ts","../src/renderer.ts","../src/bench/text.ts"],"sourcesContent":["import { isLightBudget } from '@adatechnology/game-render-three'\nimport { footprintBlocker } from '@adatechnology/game-contracts'\nimport type { Footprint, ModuleHost, ModuleLayer } from '@adatechnology/game-contracts'\nimport type { VfxWorld } from '@adatechnology/game-vfx'\nimport type { WeatherVisual, WeatherVisualContext, WeatherVisualFactory } from '@adatechnology/game-weather/testing'\nimport type * as THREE_NS from 'three'\nimport { HEADLIGHTS } from '../headlights'\nimport { createWeatherRenderer } from '../renderer'\nimport type { WeatherLayerId, WeatherRenderer, WeatherRendererOptions } from '../renderer'\nimport type { HostSun } from '../sky'\nimport type { ThreeLib } from '../types'\nimport { weatherVisualTextOf } from './text'\n\nexport type WeatherVisualOptions = Pick<WeatherRendererOptions, 'profile' | 'random' | 'zone' | 'puddles' | 'puddleAt' | 'headlights'> & {\n /** The effects world of the room (`room.vfx`); without it the near rain, mist, ash, white flash and lit drops are left out. */\n readonly vfx?: VfxWorld\n /** Where the lamp rig stands (the two headlights of the Workshop's car, to see the beams); `false` leaves it out. Default 2.5 m ahead of the test room camera, lamps toward it. */\n readonly rig?: readonly [x: number, z: number, turn: number] | false\n /**\n * The car the lamps are mounted on, built by the vehicles SDK for the host's three.js (`createVehiclesThree` of game-vehicles-three with the fleet installed), so the rig follows the fleet when it\n * changes. Without it the rig has only the lamps and their beams: no car drawn here.\n */\n readonly vehicles?: (THREE: ThreeLib) => RigVehicles\n /** Fleet id of the rig's car (default `midsize_sedan`). */\n readonly rigVehicle?: string\n /**\n * The rig's car as an item of the host's catalogue (`sedan` of the vehicles test module): the host puts it in its world (`ModuleHost.addObject`), so shots, blows, blasts and fire damage it, it\n * blocks the player and its doors open, and the lamps go on its nose. Wins over `vehicles` when the host can place it; until a loaded module has the item the rig has only the lamps.\n */\n readonly rigItem?: string\n /** The host's sun the sky's disc sits in; default the first shadow-casting `DirectionalLight` of the host's scene, and the hour's own arc when there is none. */\n readonly sun?: HostSun\n /** Which layers start on (all do by default); the room that is not about weather starts the sky and the fog off to keep its own look. */\n readonly layers?: Partial<Record<WeatherLayerId, boolean>>\n}\n\n/** What the rig needs of the vehicles SDK (`VehiclesThree` of game-vehicles-three): a car in the game frame (front on +z, wheels on y = 0) and its length. */\nexport interface RigVehicles {\n build(key: string, options?: { quality?: 'high' | 'lite' }): { readonly group: THREE_NS.Object3D; readonly length: number; readonly width?: number; dispose(): void }\n}\n\nconst RIG_VEHICLE = 'midsize_sedan'\nconst LAYER_ORDER: readonly Exclude<WeatherLayerId, 'fog'>[] = ['far_rain', 'near_rain', 'mist', 'sky', 'lightning', 'headlights', 'haze']\nconst RIG_DEFAULT = [1.6, -2.5, 0] as const\n\n/**\n * The lamps of the Workshop's car and, when the vehicles SDK is lent, a car of the fleet under them, its nose just ahead of the lamps: what the headlights are attached to when the viewer has no\n * car in the room.\n */\nfunction buildRig(THREE: ThreeLib, vehicles: RigVehicles | undefined, key: string): { readonly group: THREE_NS.Group; readonly footprint?: Footprint; dispose(): void } {\n const group = new THREE.Group()\n group.name = 'weather-lamp-rig'\n const car = vehicles?.build(key, { quality: 'lite' })\n if (car) {\n car.group.position.z = HEADLIGHTS.lamp[2] + 0.1 - car.length / 2\n group.add(car.group)\n }\n // the car is solid: the walking player stops at its body (its length and width, measured by the vehicles SDK) instead of walking through it\n const footprint = car ? footprintOf(car) : undefined\n return {\n group,\n ...(footprint ? { footprint } : {}),\n dispose() {\n car?.dispose()\n },\n }\n}\n\n/**\n * The picture of the weather for the weather bench: `createWeatherTestModule({ visual: createWeatherVisual({ vfx: room.vfx }) })`. It draws the weather the bench shows with\n * `createWeatherRenderer` on the room's scene and camera, switches each part with the bench layers and puts a lamp rig in front of the camera for the headlights.\n */\nexport function createWeatherVisual(options: WeatherVisualOptions = {}): WeatherVisualFactory {\n return {\n layers(locale): readonly ModuleLayer[] {\n const text = weatherVisualTextOf(locale)\n return LAYER_ORDER.map((id) => ({ id, name: text.layers[id], default: options.layers?.[id] ?? true }))\n },\n create({ host, weather }: WeatherVisualContext): WeatherVisual {\n const THREE = host.THREE as ThreeLib\n const renderer: WeatherRenderer = createWeatherRenderer(THREE, {\n scene: host.scene as THREE_NS.Scene,\n camera: host.camera as THREE_NS.Camera,\n weather,\n ...(options.vfx ? { vfx: options.vfx } : {}),\n ...(options.profile ? { profile: options.profile } : {}),\n ...(options.random ? { random: options.random } : {}),\n ...(options.zone ? { zone: options.zone } : {}),\n ...(options.puddles ? { puddles: options.puddles } : {}),\n ...(options.puddleAt ? { puddleAt: options.puddleAt } : {}),\n ...(options.headlights ? { headlights: options.headlights } : {}),\n ...(options.layers ? { layers: options.layers } : {}),\n ...sunOption(options.sun ?? sunOf(host.scene as THREE_NS.Scene)),\n ...(isLightBudget(host.lights) ? { lights: host.lights } : {}),\n })\n const item = options.rigItem && host.addObject ? options.rigItem : undefined\n return attachRig(THREE, host, renderer, options.rig === undefined ? RIG_DEFAULT : options.rig, item ? undefined : options.vehicles?.(THREE), options.rigVehicle ?? RIG_VEHICLE, item)\n },\n }\n}\n\n/** The sun a host lights its scene with: its first shadow-casting directional light. */\nfunction sunOf(scene: THREE_NS.Scene): THREE_NS.DirectionalLight | undefined {\n let found: THREE_NS.DirectionalLight | undefined\n scene.traverse((node) => {\n const light = node as THREE_NS.DirectionalLight\n if (!found && light.isDirectionalLight && light.castShadow) found = light\n })\n return found\n}\n\nconst sunOption = (sun: HostSun | undefined): { readonly sun?: HostSun } => (sun ? { sun } : {})\n\nfunction footprintOf(car: { readonly group: THREE_NS.Object3D; readonly length: number; readonly width?: number }): Footprint | undefined {\n if (!car.width) return undefined\n const z = car.group.position.z\n return { minX: -car.width / 2, maxX: car.width / 2, minZ: z - car.length / 2, maxZ: z + car.length / 2 }\n}\n\n/** Length (m, along its own z) of what an object draws, measured in its own space. */\nfunction lengthOf(THREE: ThreeLib, root: THREE_NS.Object3D): number {\n root.updateMatrixWorld(true)\n const inverse = new THREE.Matrix4().copy(root.matrixWorld).invert()\n const box = new THREE.Box3()\n const piece = new THREE.Box3()\n const matrix = new THREE.Matrix4()\n root.traverse((mesh) => {\n const m = mesh as THREE_NS.Mesh\n if (!m.isMesh || !m.geometry) return\n if (!m.geometry.boundingBox) m.geometry.computeBoundingBox()\n piece.copy(m.geometry.boundingBox!).applyMatrix4(matrix.multiplyMatrices(inverse, m.matrixWorld))\n box.union(piece)\n })\n return box.isEmpty() ? 0 : box.max.z - box.min.z\n}\n\nfunction attachRig(\n THREE: ThreeLib,\n host: ModuleHost,\n renderer: WeatherRenderer,\n place: readonly [number, number, number] | false,\n vehicles: RigVehicles | undefined,\n key: string,\n item?: string,\n): WeatherVisual {\n const scene = host.scene as THREE_NS.Scene\n const rig = place === false ? undefined : buildRig(THREE, vehicles, key)\n let detach: (() => void) | undefined\n let unblock: (() => void) | undefined\n if (rig && place) {\n rig.group.position.set(place[0], 0, place[1])\n rig.group.rotation.y = place[2]\n scene.add(rig.group)\n detach = renderer.headlights.attach(rig.group)\n if (rig.footprint) unblock = host.addBlocker?.(footprintBlocker(rig.group, rig.footprint))\n }\n // the car as a real object of the host: placed as soon as a loaded module has the item (the vehicles module may load after this one), centred on the rig's place, and the lamps then\n // move to its nose (the car's centre is where the rig's car stood, the lamps just behind its front)\n let car: { remove(): void } | null = null\n let stopWaiting: (() => void) | undefined\n if (item && place) {\n const tryPlace = (): void => {\n if (car || !host.addObject) return\n const placed = host.addObject(item, { position: [place[0], 0, place[1]], rotationY: place[2] })\n if (!placed) return\n car = placed\n stopWaiting?.()\n stopWaiting = undefined\n const ahead = lengthOf(THREE, placed.root as THREE_NS.Object3D) / 2 - HEADLIGHTS.lamp[2] - 0.1\n rig!.group.position.set(place[0] + Math.sin(place[2]) * ahead, 0, place[1] + Math.cos(place[2]) * ahead)\n }\n tryPlace()\n if (!car) stopWaiting = host.onFrame(tryPlace)\n }\n return {\n update: (dt) => renderer.update(dt),\n setLayer(id, on) {\n if ((WEATHER_IDS as readonly string[]).includes(id)) renderer.setLayer(id as WeatherLayerId, on)\n },\n dispose() {\n detach?.()\n unblock?.()\n stopWaiting?.()\n car?.remove()\n if (rig) {\n scene.remove(rig.group)\n rig.dispose()\n }\n renderer.dispose()\n },\n }\n}\n\nconst WEATHER_IDS: readonly WeatherLayerId[] = ['far_rain', 'near_rain', 'mist', 'fog', 'sky', 'lightning', 'headlights', 'haze']\n","import type * as THREE_NS from 'three'\nimport { LIGHT_PRIORITY } from '@adatechnology/game-render-three'\nimport type { LightBudget, SourceHandle } from '@adatechnology/game-render-three'\nimport type { WorkshopEngine } from '@adatechnology/game-vfx'\nimport type { WeatherSample } from '@adatechnology/game-weather'\nimport type { ThreeLib, Vec3 } from './types'\n\n/** The Workshop's car lamps (W101-103) and the rain that glows inside their beam (W1161-1170). */\nexport const HEADLIGHTS = {\n spot: { color: 0xfff1d0, intensity: 2.4, distance: 26, angle: 0.33, penumbra: 0.5, decay: 1.6 },\n /** Lamp position on the car (x is mirrored), where the spot points, and the cone drawn in the air. */\n lamp: [0.65, 0.74, 2.15],\n aim: [0.65, 0.2, 12],\n cone: { radius: 2.4, length: 9, segments: 18, color: 0xfff1d0, opacity: 0.06 },\n lens: { on: 0xfff1d0, off: 0x3a3a34 },\n /** Lit drops a second, thrown into the beam 1 to 13 m ahead (W1176). */\n lit: { rate: 600, depth: [1, 13], spread: 0.33, color: 0xcfdcf0, alpha: 0.9, life: 0.06, len: 0.035, velocity: [0.8, -14, 0] },\n /** Beyond this many metres a car keeps only the cone: no real light (W-b text of `farol`). */\n lightRange: 40,\n} as const\n\nexport type HeadlightRules = {\n /** Whether the lamps are lit in this weather and light (default: night, rain or fog). */\n readonly lit?: (sample: WeatherSample) => boolean\n readonly lightRange?: number\n /**\n * The host's light budget: each lamp is a source of it (it competes for a spot slot by distance) instead of a `SpotLight` on the car. Without it the lamps create their own spots (deprecated,\n * removed in the next major).\n */\n readonly lights?: LightBudget\n}\n\n/** Night (the sun below the page's 0.3 night factor), rain or fog make a driver turn the lamps on. */\nexport const defaultHeadlightRule = (sample: WeatherSample): boolean => sample.nightFactor > 0.3 || sample.rain > 0 || sample.fogDensity > 0.02 || sample.visibility < 150\n\ntype Rig = { readonly car: THREE_NS.Object3D; readonly spots: THREE_NS.SpotLight[]; readonly sources: SourceHandle[]; readonly cones: THREE_NS.Mesh[]; readonly lens: THREE_NS.MeshBasicMaterial | undefined; readonly targets: THREE_NS.Object3D[] }\n\nexport type Headlights = {\n /** Gives `car` its two spot lights and two beam cones (`lens`, when given, is the material of the lamp glass, lit with them). Returns the function that takes them off. */\n attach(car: THREE_NS.Object3D, lens?: THREE_NS.MeshBasicMaterial): () => void\n /** Lights the lamps of the cars attached, the real light only within range of `camera`; throws the lit drops of the beams into the Workshop's streak pool. */\n update(sample: WeatherSample, dt: number, camera: Vec3, engine?: WorkshopEngine, enabled?: boolean): void\n count(): number\n dispose(): void\n}\n\nexport function createHeadlights(THREE: ThreeLib, rules: HeadlightRules = {}): Headlights {\n const rigs = new Set<Rig>()\n const cone = HEADLIGHTS.cone\n const lampWorld = new THREE.Vector3()\n const aimWorld = new THREE.Vector3()\n const forward = new THREE.Vector3()\n const rule = rules.lit ?? defaultHeadlightRule\n const range = rules.lightRange ?? HEADLIGHTS.lightRange\n const lights = rules.lights\n const forwardAxis = new THREE.Vector3(0, 0, -1)\n\n /** A lamp the budget lights: a node on the car whose -z points where the spot aims, followed by the source. */\n function lampSource(side: number, car: THREE_NS.Object3D, targets: THREE_NS.Object3D[]): SourceHandle {\n const lamp = new THREE.Object3D()\n lamp.position.set(side * HEADLIGHTS.lamp[0], HEADLIGHTS.lamp[1], HEADLIGHTS.lamp[2])\n const aim = new THREE.Vector3(side * HEADLIGHTS.aim[0], HEADLIGHTS.aim[1], HEADLIGHTS.aim[2]).sub(lamp.position).normalize()\n lamp.quaternion.setFromUnitVectors(forwardAxis, aim)\n car.add(lamp)\n targets.push(lamp)\n const spot = HEADLIGHTS.spot\n return lights!.addSource({ owner: 'weather.headlight', kind: 'spot', priority: LIGHT_PRIORITY.headlight, color: spot.color, intensity: 0, distance: spot.distance, decay: spot.decay, angle: spot.angle, penumbra: spot.penumbra, position: [0, 0, 0], follow: lamp })\n }\n\n function legacySpot(side: number, car: THREE_NS.Object3D, targets: THREE_NS.Object3D[]): THREE_NS.SpotLight {\n // eslint-disable-next-line no-restricted-syntax -- D2: legacy path without LightBudget, removed in the next major\n const spot = new THREE.SpotLight(HEADLIGHTS.spot.color, 0, HEADLIGHTS.spot.distance, HEADLIGHTS.spot.angle, HEADLIGHTS.spot.penumbra, HEADLIGHTS.spot.decay)\n spot.position.set(side * HEADLIGHTS.lamp[0], HEADLIGHTS.lamp[1], HEADLIGHTS.lamp[2])\n const target = new THREE.Object3D()\n target.position.set(side * HEADLIGHTS.aim[0], HEADLIGHTS.aim[1], HEADLIGHTS.aim[2])\n car.add(spot, target)\n spot.target = target\n targets.push(target)\n return spot\n }\n\n function attach(car: THREE_NS.Object3D, lens?: THREE_NS.MeshBasicMaterial): () => void {\n const spots: THREE_NS.SpotLight[] = []\n const cones: THREE_NS.Mesh[] = []\n const targets: THREE_NS.Object3D[] = []\n const sources: SourceHandle[] = []\n for (const side of [-1, 1]) {\n if (lights) sources.push(lampSource(side, car, targets))\n else spots.push(legacySpot(side, car, targets))\n const geometry = new THREE.ConeGeometry(cone.radius, cone.length, cone.segments, 1, true)\n geometry.translate(0, -cone.length / 2, 0)\n geometry.rotateX(-Math.PI / 2)\n const material = new THREE.MeshBasicMaterial({ color: cone.color, transparent: true, opacity: cone.opacity, blending: THREE.AdditiveBlending, depthWrite: false, side: THREE.DoubleSide, fog: false })\n const beam = new THREE.Mesh(geometry, material)\n beam.position.set(side * HEADLIGHTS.lamp[0], HEADLIGHTS.lamp[1], HEADLIGHTS.lamp[2])\n beam.visible = false\n car.add(beam)\n cones.push(beam)\n }\n const rig: Rig = { car, spots, sources, cones, lens, targets }\n rigs.add(rig)\n return () => {\n rigs.delete(rig)\n for (const object of [...spots, ...cones, ...targets]) car.remove(object)\n for (const beam of cones) {\n beam.geometry.dispose()\n ;(beam.material as THREE_NS.Material).dispose()\n }\n for (const spot of spots) spot.dispose()\n for (const source of sources) source.remove()\n lens?.color.setHex(HEADLIGHTS.lens.off)\n }\n }\n\n return {\n attach,\n update(sample, dt, camera, engine, enabled = true) {\n const on = enabled && rule(sample)\n let index = 0\n for (const rig of rigs) {\n rig.car.updateWorldMatrix(true, false)\n lampWorld.set(0, HEADLIGHTS.lamp[1], HEADLIGHTS.lamp[2]).applyMatrix4(rig.car.matrixWorld)\n const near = Math.hypot(lampWorld.x - camera[0], lampWorld.z - camera[2]) <= range\n for (const spot of rig.spots) spot.intensity = on && near ? HEADLIGHTS.spot.intensity : 0\n for (const source of rig.sources) source.update({ intensity: on && near ? HEADLIGHTS.spot.intensity : 0 })\n for (const beam of rig.cones) beam.visible = on\n rig.lens?.color.setHex(on ? HEADLIGHTS.lens.on : HEADLIGHTS.lens.off)\n if (!on || !engine || sample.rain <= 0 || !near) {\n index++\n continue\n }\n aimWorld.set(0, HEADLIGHTS.lamp[1], HEADLIGHTS.lamp[2] + 1).applyMatrix4(rig.car.matrixWorld)\n forward.copy(aimWorld).sub(lampWorld).normalize()\n const side: [number, number] = [forward.z, -forward.x]\n const { random } = engine\n const lit = HEADLIGHTS.lit\n engine.emit(`weather-lit-${index}`, 'streak', lit.rate, dt, () => {\n const depth = random.between(lit.depth[0], lit.depth[1])\n const spread = depth * lit.spread * Math.sqrt(random.next())\n const turn = random.between(0, 6.283)\n return {\n p: [lampWorld.x + forward.x * depth + side[0] * Math.cos(turn) * spread, lampWorld.y + forward.y * depth + Math.sin(turn) * spread * 0.6, lampWorld.z + forward.z * depth + side[1] * Math.cos(turn) * spread],\n v: lit.velocity as unknown as [number, number, number],\n sp: 0,\n life: lit.life,\n len: lit.len,\n c0: lit.color,\n a: lit.alpha,\n }\n })\n index++\n }\n },\n count: () => rigs.size,\n dispose() {\n for (const rig of [...rigs]) {\n rigs.delete(rig)\n for (const object of [...rig.spots, ...rig.cones, ...rig.targets]) rig.car.remove(object)\n for (const source of rig.sources) source.remove()\n }\n },\n }\n}\n","import type * as THREE_NS from 'three'\nimport { createFog as createStableFog } from '@adatechnology/game-render-three'\nimport type { WeatherSample } from '@adatechnology/game-weather'\nimport type { WorkshopEngine } from '@adatechnology/game-vfx'\nimport { ZONE_FOG_DEFAULTS } from './sky'\nimport type { ThreeLib, Vec3, ZoneFog } from './types'\n\n/** The page's linear fog starts at 25 m and, in the zone, at 4 m (`scene.fog.near = lerp(25, 4, weight)`). */\nexport const FOG_NEAR = 25\nexport const FOG_ZONE_NEAR = 4\n/** Below this exponential-squared density the weather uses the linear fog (the clear weathers have 0). */\nexport const FOG_EXP_FROM = 0.0005\n/** exp2 density that sees as far as a linear fog of `far` metres (2 % left): used to blend the zone fog in the exponential case. */\nexport const densityForFar = (far: number): number => Math.sqrt(Math.log(50)) / far\n\nexport type FogValues = { readonly mode: 'linear'; readonly near: number; readonly far: number } | { readonly mode: 'exp2'; readonly density: number }\n\n/** The fog the weather and the zone ask for. Pure. */\nexport function fogOf(sample: WeatherSample, zone?: ZoneFog, expFrom: number = FOG_EXP_FROM): FogValues {\n const weight = zone?.weight ?? 0\n const zoneFar = zone?.far ?? ZONE_FOG_DEFAULTS.far\n if (sample.fogDensity >= expFrom) return { mode: 'exp2', density: sample.fogDensity + (densityForFar(zoneFar) - sample.fogDensity) * weight }\n return { mode: 'linear', near: FOG_NEAR + (FOG_ZONE_NEAR - FOG_NEAR) * weight, far: sample.fogFar + (zoneFar - sample.fogFar) * weight }\n}\n\nexport type Fog = {\n /** Puts the weather's fog on the scene (the page's `fog.far` and `fog.near`, or the exponential-squared one) with the sky's colour. */\n update(sample: WeatherSample, sky: THREE_NS.Color, zone?: ZoneFog): void\n /** Takes the fog off the scene (a layer switched off). */\n clear(): void\n}\n\nexport type FogOptions = {\n readonly expFrom?: number\n /**\n * The scene's fog never goes back to `null` (the layer switched off leaves the host's own linear fog or a neutral one that fogs nothing), so its presence and type, which are part of every\n * lit material's program key, never change. Needs a real `Scene`. Default false: the host's fog (or none) comes back, as before.\n */\n readonly stable?: boolean\n}\n\nexport function createFog(THREE: ThreeLib, scene: { fog: unknown }, options: FogOptions = {}): Fog {\n if (options.stable) return stableFog(THREE, scene as THREE_NS.Scene, options)\n // the fog the host had before: it comes back when the layer is switched off (the first update changes it in place, so a copy is kept)\n const original = scene.fog\n const kept = original && (original as { isFog?: boolean }).isFog ? (original as THREE_NS.Fog).clone() : original\n return {\n update(sample, sky, zone) {\n const values = fogOf(sample, zone, options.expFrom)\n const current = scene.fog as (THREE_NS.Fog & THREE_NS.FogExp2 & { isFog?: boolean; isFogExp2?: boolean }) | null | undefined\n if (values.mode === 'linear') {\n if (current?.isFog) {\n current.color.copy(sky)\n current.near = values.near\n current.far = values.far\n } else scene.fog = new THREE.Fog(sky.getHex(), values.near, values.far)\n } else if (current?.isFogExp2) {\n current.color.copy(sky)\n current.density = values.density\n } else scene.fog = new THREE.FogExp2(sky.getHex(), values.density)\n const fog = scene.fog as { color: THREE_NS.Color }\n fog.color.copy(sky)\n },\n clear() {\n scene.fog = kept && (kept as { isFog?: boolean }).isFog ? (kept as THREE_NS.Fog).clone() : (kept ?? null)\n },\n }\n}\n\nfunction stableFog(THREE: ThreeLib, scene: THREE_NS.Scene, options: FogOptions): Fog {\n const controller = createStableFog(THREE, scene, { stable: true })\n return {\n update(sample, sky, zone) {\n const values = fogOf(sample, zone, options.expFrom)\n if (values.mode === 'linear') controller.useLinear(sky.getHex(), values.near, values.far)\n else controller.useExp2(sky.getHex(), values.density)\n ;(scene.fog as { color: THREE_NS.Color }).color.copy(sky)\n },\n clear: () => controller.clear(),\n }\n}\n\n/** The Workshop's mist (W1073: low, slow, 3 to 5 m wide) and ash (fine, falling in a spiral), in a box that follows the camera. */\nexport const MIST = { box: { x: [-14, 10], y: [0.2, 1.1], z: [-3, 8] }, drift: [0.15, 0.35], life: [9, 13], size: [3, 5], grow: 1.4, color: 0x7d8aa0, alpha: 0.13, fadeIn: 0.35 } as const\nexport const ASH = { box: { x: [-10, 8], y: [4, 6], z: [-3, 7] }, fall: -0.35, life: [8, 12], size: [0.025, 0.04], color: 0xa09a90, alpha: 0.75, fadeIn: 0.1 } as const\n\n/**\n * Feeds the `normal` sprite pool of the Workshop with `mistPerSecond` puffs of mist and `ashPerSecond` flakes of ash a second (the page's `emit('fog', ...)`\n * and `emit('ash', ...)`, at the weather's rate instead of 5 and 14), around `camera`. The renderer of game-vfx-three draws them.\n */\nexport function emitAirborne(engine: WorkshopEngine, sample: WeatherSample, dt: number, camera: Vec3): void {\n const { random } = engine\n const around = (box: { readonly x: readonly number[]; readonly y: readonly number[]; readonly z: readonly number[] }): [number, number, number] => [\n camera[0] + random.between(box.x[0]!, box.x[1]!),\n random.between(box.y[0]!, box.y[1]!),\n camera[2] + random.between(box.z[0]!, box.z[1]!),\n ]\n if (sample.mistPerSecond > 0) {\n engine.emit('weather-mist', 'normal', sample.mistPerSecond, dt, () => ({\n p: around(MIST.box),\n v: [random.between(MIST.drift[0], MIST.drift[1]), 0, random.between(-0.05, 0.05)],\n sp: 0,\n life: MIST.life,\n size: MIST.size,\n grow: MIST.grow,\n c0: MIST.color,\n a: MIST.alpha,\n fi: MIST.fadeIn,\n }))\n }\n if (sample.ashPerSecond > 0) {\n engine.emit('weather-ash', 'normal', sample.ashPerSecond, dt, () => ({\n p: around(ASH.box),\n v: [random.between(0.1, 0.4), ASH.fall, random.between(-0.1, 0.1)],\n sp: [0.05, 0.15],\n life: ASH.life,\n size: ASH.size,\n c0: ASH.color,\n a: ASH.alpha,\n fi: ASH.fadeIn,\n gnd: 1,\n }))\n }\n}\n","export const SKY_VERTEX = /* glsl */ `\nvarying vec3 vDir;\nvoid main() {\n vDir = normalize(position);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n`\n\n/** One dome: the vertical gradient, sunset warmth, stars, moon, sun with its glow and one procedural cloud layer (4 octaves of value noise on a plane projected from the dome). */\nexport const SKY_FRAGMENT = /* glsl */ `\nprecision highp float;\nuniform vec3 uZenith;\nuniform vec3 uHorizon;\nuniform vec3 uTint;\nuniform vec3 uSunDir;\nuniform vec3 uSunColor;\nuniform vec3 uMoonDir;\nuniform vec3 uCloudLit;\nuniform vec3 uCloudShade;\nuniform vec3 uDrift;\nuniform float uSunsetAmount;\nuniform float uSunVis;\nuniform float uMoonVis;\nuniform float uStars;\nuniform float uCover;\nuniform float uTime;\nuniform float uFlash;\nvarying vec3 vDir;\n\nfloat hash2(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }\nfloat hash3(vec3 p) { return fract(sin(dot(p, vec3(127.1, 311.7, 74.7))) * 43758.5453); }\nfloat noise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n f = f * f * (3.0 - 2.0 * f);\n return mix(mix(hash2(i), hash2(i + vec2(1.0, 0.0)), f.x), mix(hash2(i + vec2(0.0, 1.0)), hash2(i + vec2(1.0, 1.0)), f.x), f.y);\n}\nfloat fbm(vec2 p) {\n float value = 0.0;\n float amplitude = 0.5;\n for (int octave = 0; octave < 4; octave++) {\n value += amplitude * noise(p);\n p = p * 2.03 + vec2(17.1, 9.2);\n amplitude *= 0.5;\n }\n return value;\n}\n\nvoid main() {\n vec3 d = normalize(vDir);\n float height = max(d.y, 0.0);\n vec3 color = mix(uHorizon, uZenith, pow(height, 0.6));\n\n vec2 azimuth = normalize(d.xz + vec2(1e-5));\n vec2 sunAzimuth = normalize(uSunDir.xz + vec2(1e-5));\n float towardSun = max(dot(azimuth, sunAzimuth), 0.0);\n color = mix(color, uTint, uSunsetAmount * exp(-height * 6.0) * (0.25 + 0.75 * towardSun * towardSun));\n\n float aboveHorizon = smoothstep(-0.05, 0.05, d.y);\n if (uStars > 0.001 && d.y > 0.0) {\n vec3 p = d * 120.0;\n vec3 cell = floor(p);\n float pick = hash3(cell);\n if (pick > 0.985) {\n vec3 spot = vec3(hash3(cell + 1.7), hash3(cell + 5.3), hash3(cell + 9.1)) * 0.4 + 0.3;\n float twinkle = 0.78 + 0.22 * sin(uTime * 2.0 + pick * 60.0);\n float star = (1.0 - smoothstep(0.04, 0.32, length(fract(p) - spot))) * (0.45 + 0.55 * fract(pick * 97.0)) * twinkle;\n color += vec3(0.85, 0.9, 1.0) * star * uStars * smoothstep(0.0, 0.12, d.y);\n }\n }\n\n if (uMoonVis > 0.001) {\n float toMoon = dot(d, uMoonDir);\n vec3 tangent = normalize(cross(uMoonDir, vec3(0.0, 1.0, 0.0)));\n vec2 onDisc = vec2(dot(d, tangent), dot(d, cross(uMoonDir, tangent))) / 0.045;\n float disc = (1.0 - smoothstep(0.93, 1.0, length(onDisc))) * step(0.0, toMoon);\n vec3 moon = vec3(0.7, 0.73, 0.8) * (0.62 + 0.38 * fbm(onDisc * 3.0 + 3.0));\n color += (moon * disc + vec3(0.55, 0.62, 0.8) * pow(max(toMoon, 0.0), 220.0) * 0.5) * uMoonVis * aboveHorizon;\n }\n\n if (uSunVis > 0.001) {\n float toSun = dot(d, uSunDir);\n float disc = smoothstep(0.99935, 0.99965, toSun);\n float glow = pow(max(toSun, 0.0), 48.0) * 0.5 + pow(max(toSun, 0.0), 6.0) * 0.14;\n color += uSunColor * (glow + disc * 2.5) * uSunVis * aboveHorizon;\n }\n\n if (d.y > -0.05) {\n vec2 uv = d.xz / (height + 0.18) * 1.1 + uDrift.xy;\n float density = fbm(uv);\n float threshold = 0.74 - uCover * 0.9;\n float coverage = smoothstep(threshold, threshold + 0.22, density) * smoothstep(-0.05, 0.12, d.y);\n float thick = smoothstep(threshold, threshold + 0.5, density);\n vec3 cloud = mix(uCloudLit, uCloudShade, thick * 0.8);\n cloud = mix(uHorizon, cloud, smoothstep(0.0, 0.3, d.y));\n color = mix(color, cloud, coverage);\n }\n\n color = mix(color, vec3(0.78, 0.82, 0.95), uFlash * 0.7);\n gl_FragColor = vec4(color, 1.0);\n #include <colorspace_fragment>\n}\n`\n","import type { WeatherSample } from '@adatechnology/game-weather'\n\nconst clamp01 = (value: number): number => (value < 0 ? 0 : value > 1 ? 1 : value)\nconst smoothstep = (from: number, to: number, value: number): number => {\n const t = clamp01((value - from) / (to - from))\n return t * t * (3 - 2 * t)\n}\n\n/** Share of the sky the clouds cover with nothing else in the sample: a clear sky keeps a few scattered clouds, every state that dims the sky (`skyScale` below 1) or rains is a full overcast. */\nexport const CLOUD_COVER = { clear: 0.2, perSkyDimming: 7, perRainMm: 0.4, rainFullAtMm: 5, windMax: 0.15, windFullAt: 20 } as const\n/** `skyScale` where the clouds start to darken, and the dimming at which they are as dark as a typhoon's. */\nconst DARK_FROM_SKY_SCALE = 0.95\nconst DARK_SPAN = 0.45\n\n/** 0..1 cloud cover for this weather: scattered when clear, full overcast when it rains or the sky is dimmed. Pure. */\nexport function cloudCoverOf(sample: WeatherSample): number {\n const dimming = clamp01(1 - sample.skyScale)\n const rain = Math.min(1, sample.rain / CLOUD_COVER.rainFullAtMm)\n const wind = Math.min(1, Math.hypot(sample.windX, sample.windZ) / CLOUD_COVER.windFullAt) * CLOUD_COVER.windMax\n return clamp01(CLOUD_COVER.clear + dimming * CLOUD_COVER.perSkyDimming + rain * CLOUD_COVER.perRainMm + wind)\n}\n\n/** 0..1 how dark the cloud undersides are: grey in rain, near black in a storm or typhoon. Pure. */\nexport function cloudDarknessOf(sample: WeatherSample): number {\n return clamp01((DARK_FROM_SKY_SCALE - sample.skyScale) / DARK_SPAN)\n}\n\n/** 0..1 how dark the sky is: the stars and the moon come out only once the dusk is over. Pure. */\nexport const nightnessOf = (sample: WeatherSample): number => clamp01(sample.nightFactor) ** 3\n\n/** 0..1 how many stars show: the night's, hidden by the clouds (none under a full overcast). Pure. */\nexport function starVisibilityOf(sample: WeatherSample): number {\n return nightnessOf(sample) * clamp01(1 - cloudCoverOf(sample) * 1.25)\n}\n\n/** 0..1 sunrise or sunset warmth: the sun is low (a bell over `sun`), less under clouds. Pure. */\nexport function sunsetOf(sample: WeatherSample): number {\n const low = smoothstep(0.02, 0.15, sample.sun) * (1 - smoothstep(0.15, 0.5, sample.sun))\n return low * (1 - cloudCoverOf(sample) * 0.75)\n}\n\n/** 0..1 how much of the sun disc and its glow shows (before the clouds put themselves in front): none at night. Pure. */\nexport const sunVisibilityOf = (sample: WeatherSample): number => smoothstep(0.02, 0.15, sample.sun)\n\ntype Direction = { x: number; y: number; z: number }\nexport type HostSun = { readonly position: Direction; readonly target?: { readonly position: Direction } }\n\n/** The unit direction to the sun, written into `out`: the host sun's (its position seen from its target) or, with none, an arc over the day (rises east at 06:00, sets west at 18:00). */\nexport function sunDirectionOf(sample: WeatherSample, host: HostSun | undefined, out: Direction): Direction {\n if (host) {\n const target = host.target?.position\n out.x = host.position.x - (target?.x ?? 0)\n out.y = host.position.y - (target?.y ?? 0)\n out.z = host.position.z - (target?.z ?? 0)\n } else {\n const angle = (sample.dayFraction - 0.25) * Math.PI * 2\n out.x = Math.cos(angle)\n out.y = Math.sin(angle)\n out.z = -0.3\n }\n const length = Math.hypot(out.x, out.y, out.z) || 1\n out.x /= length\n out.y /= length\n out.z /= length\n return out\n}\n","import type * as THREE_NS from 'three'\nimport type { WeatherSample } from '@adatechnology/game-weather'\nimport { SKY_FRAGMENT, SKY_VERTEX } from './sky-shader'\nimport { cloudCoverOf, cloudDarknessOf, nightnessOf, starVisibilityOf, sunDirectionOf, sunsetOf, sunVisibilityOf } from './sky-state'\nimport type { HostSun } from './sky-state'\nimport type { ThreeLib, ZoneFog } from './types'\n\nexport { cloudCoverOf, cloudDarknessOf, CLOUD_COVER, nightnessOf, starVisibilityOf, sunDirectionOf, sunsetOf, sunVisibilityOf } from './sky-state'\nexport type { HostSun } from './sky-state'\n\n/** The colours of the game's `skyUpdate` (jogo.js `_skyN` and `_skyD`): the sky goes from the night one to the day one with the sun height. */\nexport const SKY_NIGHT = 0x0b0f18\nexport const SKY_DAY = 0x8796a6\n/** The zone fog colour is lit by `0.35 + 0.65 s` (the page's `ZONA_NEBLINA` blend). */\nexport const ZONE_LIGHT = { base: 0.35, sun: 0.65 } as const\n/** The page's zone fog (`ZONA_NEBLINA`): colour and far distance; its weight is the game's to set. */\nexport const ZONE_FOG_DEFAULTS = { color: 0x3a4a3a, far: 60 } as const\n/** The dome's colours: the zenith (deep blue by day, black by night), the sunset warmth, the sun, and the cloud tops, undersides and storm underside. */\nexport const SKY_DOME = {\n zenithDay: 0x3f78c4,\n zenithNight: 0x02040a,\n sunsetTint: 0xff7a3d,\n sunDay: 0xfff4e0,\n sunSet: 0xff9a50,\n cloudDay: 0xf4f6fa,\n cloudOvercast: 0xb8bec6,\n cloudStorm: 0x3e434c,\n cloudNight: 0x1a2030,\n /** How much of the sunset warmth the horizon (and so the fog) takes. */\n fogWarmth: 0.3,\n /** Clouds drift this many noise units per second for each m/s of wind (wind capped at `driftMaxWind`). */\n drift: 0.0025,\n driftMaxWind: 20,\n /** Largest radius of the dome; it is 90 % of the camera's far plane when that is smaller. */\n radius: 900,\n renderOrder: -1000,\n} as const\n\nexport type SkyOptions = {\n /** The camera the dome follows (centred on it every frame). Without it there is no dome: only the colour. */\n readonly camera?: THREE_NS.Camera\n /** The host's sun (a `DirectionalLight` or anything with `position` and `target.position`): the disc and the glow sit in its direction. Without it the sun follows the hour. */\n readonly sun?: HostSun\n}\n\nexport type Sky = {\n /** The sky colour for this weather: night to day by `sample.sun`, dimmed by `sample.skyScale` (the page's 0.8 in rain), pulled to the zone colour by its weight. It is also the horizon's colour and the fog's. `dt` (seconds) drifts the clouds and moves the stars. */\n update(sample: WeatherSample, zone?: ZoneFog, dt?: number): THREE_NS.Color\n readonly color: THREE_NS.Color\n /** The dome, to add to the scene (absent without a camera). It follows the camera and renders behind everything. */\n readonly object?: THREE_NS.Mesh\n dispose(): void\n}\n\ntype DomeUniforms = Record<'uZenith' | 'uHorizon' | 'uTint' | 'uSunDir' | 'uSunColor' | 'uMoonDir' | 'uCloudLit' | 'uCloudShade' | 'uDrift', { value: THREE_NS.Color | THREE_NS.Vector3 }> &\n Record<'uSunsetAmount' | 'uSunVis' | 'uMoonVis' | 'uStars' | 'uCover' | 'uTime' | 'uFlash', { value: number }>\n\nfunction createDome(THREE: ThreeLib, camera: THREE_NS.Camera): { readonly mesh: THREE_NS.Mesh; readonly uniforms: DomeUniforms; dispose(): void } {\n const vector = (): { value: THREE_NS.Vector3 } => ({ value: new THREE.Vector3() })\n const colour = (hex: number): { value: THREE_NS.Color } => ({ value: new THREE.Color(hex) })\n const uniforms: DomeUniforms = {\n uZenith: colour(SKY_DOME.zenithDay),\n uHorizon: colour(SKY_DAY),\n uTint: colour(SKY_DOME.sunsetTint),\n uSunDir: vector(),\n uSunColor: colour(SKY_DOME.sunDay),\n uMoonDir: vector(),\n uCloudLit: colour(SKY_DOME.cloudDay),\n uCloudShade: colour(SKY_DOME.cloudOvercast),\n uDrift: vector(),\n uSunsetAmount: { value: 0 },\n uSunVis: { value: 0 },\n uMoonVis: { value: 0 },\n uStars: { value: 0 },\n uCover: { value: 0 },\n uTime: { value: 0 },\n uFlash: { value: 0 },\n }\n const geometry = new THREE.SphereGeometry(1, 24, 12)\n const material = new THREE.ShaderMaterial({ uniforms, vertexShader: SKY_VERTEX, fragmentShader: SKY_FRAGMENT, side: THREE.BackSide, depthTest: false, depthWrite: false, fog: false, toneMapped: false })\n const mesh = new THREE.Mesh(geometry, material)\n mesh.name = 'sky-dome'\n mesh.renderOrder = SKY_DOME.renderOrder\n mesh.frustumCulled = false\n // the dome is no target: a ray from the player or a bullet goes through it\n mesh.raycast = () => undefined\n const far = (camera as THREE_NS.PerspectiveCamera).far\n mesh.scale.setScalar(far > 0 ? Math.min(SKY_DOME.radius, far * 0.9) : SKY_DOME.radius)\n return {\n mesh,\n uniforms,\n dispose() {\n mesh.removeFromParent()\n geometry.dispose()\n material.dispose()\n },\n }\n}\n\n/** Writes the sky into `scene.background` (a `Color`; made when the scene has none) and hands the colour to the fog; with a `camera` it also builds the dome that draws it. */\nexport function createSky(THREE: ThreeLib, scene: { background: unknown }, options: SkyOptions = {}): Sky {\n const night = new THREE.Color(SKY_NIGHT)\n const day = new THREE.Color(SKY_DAY)\n const zoneColor = new THREE.Color(ZONE_FOG_DEFAULTS.color)\n const tint = new THREE.Color()\n const color = new THREE.Color()\n const sunsetColor = new THREE.Color(SKY_DOME.sunsetTint)\n const zenithDay = new THREE.Color(SKY_DOME.zenithDay)\n const zenithNight = new THREE.Color(SKY_DOME.zenithNight)\n const sunDay = new THREE.Color(SKY_DOME.sunDay)\n const sunSet = new THREE.Color(SKY_DOME.sunSet)\n const cloudDay = new THREE.Color(SKY_DOME.cloudDay)\n const cloudOvercast = new THREE.Color(SKY_DOME.cloudOvercast)\n const cloudStorm = new THREE.Color(SKY_DOME.cloudStorm)\n const cloudNight = new THREE.Color(SKY_DOME.cloudNight)\n const sunDirection = { x: 0, y: 1, z: 0 }\n const dome = options.camera ? createDome(THREE, options.camera) : undefined\n let time = 0\n\n const updateDome = (sample: WeatherSample, dt: number): void => {\n if (!dome || !options.camera) return\n const { uniforms, mesh } = dome\n time += dt\n const cover = cloudCoverOf(sample)\n const sunset = sunsetOf(sample)\n const dark = cloudDarknessOf(sample)\n mesh.visible = true\n mesh.position.copy(options.camera.position)\n // the zenith greys into the horizon colour as the cloud thickens\n const zenith = uniforms.uZenith.value as THREE_NS.Color\n zenith.lerpColors(zenithNight, zenithDay, sample.sun).multiplyScalar(sample.skyScale).lerp(color, cover * 0.85)\n ;(uniforms.uHorizon.value as THREE_NS.Color).copy(color)\n const lit = uniforms.uCloudLit.value as THREE_NS.Color\n lit.lerpColors(cloudDay, cloudOvercast, cover * cover).lerp(cloudStorm, dark).lerp(cloudNight, 1 - Math.min(1, sample.sun * 2.2))\n lit.lerp(sunsetColor, sunset * 0.45)\n ;(uniforms.uCloudShade.value as THREE_NS.Color).copy(lit).multiplyScalar(0.62)\n ;(uniforms.uSunColor.value as THREE_NS.Color).lerpColors(sunDay, sunSet, sunset)\n const sunVector = uniforms.uSunDir.value as THREE_NS.Vector3\n sunDirectionOf(sample, options.sun, sunDirection)\n sunVector.set(sunDirection.x, sunDirection.y, sunDirection.z)\n // the moon rides opposite the sun in azimuth and is always above the horizon\n ;(uniforms.uMoonDir.value as THREE_NS.Vector3).set(-sunDirection.x, Math.abs(sunDirection.y) * 0.9 + 0.1, -sunDirection.z).normalize()\n const drift = uniforms.uDrift.value as THREE_NS.Vector3\n drift.x += Math.max(-SKY_DOME.driftMaxWind, Math.min(SKY_DOME.driftMaxWind, sample.windX)) * SKY_DOME.drift * dt\n drift.y += Math.max(-SKY_DOME.driftMaxWind, Math.min(SKY_DOME.driftMaxWind, sample.windZ)) * SKY_DOME.drift * dt\n uniforms.uCover.value = cover\n uniforms.uSunsetAmount.value = sunset\n uniforms.uSunVis.value = sunVisibilityOf(sample)\n uniforms.uMoonVis.value = nightnessOf(sample)\n uniforms.uStars.value = starVisibilityOf(sample)\n uniforms.uTime.value = time\n uniforms.uFlash.value = sample.flash\n }\n\n return {\n color,\n ...(dome ? { object: dome.mesh } : {}),\n update(sample, zone, dt = 0) {\n color.lerpColors(night, day, sample.sun)\n color.multiplyScalar(sample.skyScale)\n if (dome) color.lerp(sunsetColor, sunsetOf(sample) * SKY_DOME.fogWarmth)\n if (zone && zone.weight > 0) {\n zoneColor.setHex(zone.color ?? ZONE_FOG_DEFAULTS.color)\n color.lerp(tint.copy(zoneColor).multiplyScalar(ZONE_LIGHT.base + sample.sun * ZONE_LIGHT.sun), zone.weight)\n }\n const background = scene.background as THREE_NS.Color | null | undefined\n if (background && (background as { isColor?: boolean }).isColor) background.copy(color)\n else scene.background = color.clone()\n updateDome(sample, dt)\n return color\n },\n dispose() {\n dome?.dispose()\n },\n }\n}\n","import type * as THREE_NS from 'three'\nimport type { WeatherSample } from '@adatechnology/game-weather'\nimport type { ThreeLib } from './types'\n\n/** Peak opacity of the shimmer at full haze, and how fast the bands rise (SDK-made: no team delivered heat haze, see the open question). */\nexport const HEAT_HAZE = { opacity: 0.09, bands: 38, rise: 1.4, color: [1, 0.93, 0.82] } as const\n\nexport const HEAT_HAZE_VERTEX = 'varying vec2 vUv; void main(){ vUv = uv; gl_Position = vec4(position.xy, 0., 1.); }'\nexport const HEAT_HAZE_FRAGMENT =\n 'uniform float uTime; uniform float uHaze; uniform vec3 uColor; varying vec2 vUv; void main(){ float low = 1. - smoothstep(0.15, 0.7, vUv.y); float wave = sin(vUv.y*38. - uTime*1.4 + sin(vUv.x*11. + uTime*.7)*2.2) * .5 + .5; gl_FragColor = vec4(uColor, uHaze*low*wave*.09); }'\n\nexport type HeatHaze = {\n readonly object: THREE_NS.Mesh\n update(sample: WeatherSample, time: number): void\n dispose(): void\n}\n\n/**\n * The heat shimmer of `extreme_heat` (`WeatherSample.haze`, 0..1): a screen-space layer of warm bands that rise over the lower half of the view. It is a layer, not a\n * distortion of the picture, because bending the picture needs a render target that only the host owns.\n */\nexport function createHeatHaze(THREE: ThreeLib): HeatHaze {\n const uniforms = { uTime: { value: 0 }, uHaze: { value: 0 }, uColor: { value: new THREE.Vector3(...HEAT_HAZE.color) } }\n const material = new THREE.ShaderMaterial({ uniforms, vertexShader: HEAT_HAZE_VERTEX, fragmentShader: HEAT_HAZE_FRAGMENT, transparent: true, depthTest: false, depthWrite: false })\n const object = new THREE.Mesh(new THREE.PlaneGeometry(2, 2), material)\n object.frustumCulled = false\n object.renderOrder = 999\n object.name = 'weather-heat-haze'\n object.visible = false\n return {\n object,\n update(sample, time) {\n uniforms.uHaze.value = sample.haze\n uniforms.uTime.value = time\n object.visible = sample.haze > 0\n },\n dispose() {\n object.geometry.dispose()\n material.dispose()\n },\n }\n}\n","import type * as THREE_NS from 'three'\nimport type { LightBudget } from '@adatechnology/game-render-three'\nimport type { VfxWorld } from '@adatechnology/game-vfx'\nimport type { WeatherSample } from '@adatechnology/game-weather'\nimport type { ThreeLib } from './types'\n\n/**\n * What the Workshop's double flash does to the scene (W1072): the hemisphere light gains `I * 3.2`, the background gains `I * (.25, .27, .32)` and the screen goes\n * white by `I * .12`, where `I` is the flash the weather samples (1, then .2, then .8 for 0.26 s).\n */\nexport const LIGHTNING = { light: 3.2, background: [0.25, 0.27, 0.32], white: 0.12, skyColor: 0x3a4c6a, groundColor: 0x0b0b0c } as const\n\nexport type Lightning = {\n readonly light: THREE_NS.HemisphereLight\n /**\n * Lights the scene with the flash of `sample`. `background`, when given, is the sky just written for this frame (the renderer passes it only when it owns the sky),\n * and gains the flash; a background the host keeps for itself is left alone.\n */\n update(sample: WeatherSample, background?: THREE_NS.Color): void\n dispose(): void\n}\n\nexport type LightningOptions = {\n /**\n * The host's light budget: the flash uses one of its hemisphere slots (leased for good) instead of a light of its own, so the weather coming up in the middle of the game does not\n * change the number of lights. Without it the light is created here (deprecated, removed in the next major).\n */\n readonly lights?: LightBudget\n}\n\nexport function createLightning(THREE: ThreeLib, scene: { add(object: THREE_NS.Object3D): unknown; remove(object: THREE_NS.Object3D): unknown }, vfx?: VfxWorld, options: LightningOptions = {}): Lightning {\n const leased = options.lights?.leaseHemisphere('weather.lightning') ?? null\n // eslint-disable-next-line no-restricted-syntax -- D2: legacy path without LightBudget (or a budget with no hemisphere slot left: then it stays out of the scene), removed in the next major\n const light = leased ?? new THREE.HemisphereLight(LIGHTNING.skyColor, LIGHTNING.groundColor, 0)\n light.name = 'weather-lightning'\n light.color.setHex(LIGHTNING.skyColor)\n light.groundColor.setHex(LIGHTNING.groundColor)\n if (!options.lights) scene.add(light)\n return {\n light,\n update(sample, background) {\n const flash = sample.flash\n light.intensity = flash * LIGHTNING.light\n if (flash <= 0) return\n if (background) {\n background.r += flash * LIGHTNING.background[0]!\n background.g += flash * LIGHTNING.background[1]!\n background.b += flash * LIGHTNING.background[2]!\n }\n const screen = vfx?.workshop().screen\n if (screen) screen.white = Math.max(screen.white, flash * LIGHTNING.white)\n },\n dispose() {\n light.intensity = 0\n if (options.lights) return\n scene.remove(light)\n light.dispose()\n },\n }\n}\n","import type { Puddle, VfxWorld } from '@adatechnology/game-vfx'\nimport { inPuddle } from '@adatechnology/game-vfx'\nimport type { WeatherSample } from '@adatechnology/game-weather'\nimport type { Vec3 } from './types'\n\n/** The rain (mm/h) from which a drop that lands splashes (the Workshop's garoa, 2.5, does not; its chuva, 15, does). */\nexport const SPLASH_FROM_MM = 5\n\nexport type NearRainOptions = {\n /** Ground ellipses where a drop leaves a ring (the Workshop's four dark puddles; a game has its own). None by default. */\n readonly puddles?: readonly Puddle[]\n /** Replaces the puddle test. */\n readonly puddleAt?: (x: number, z: number) => boolean\n readonly splashFrom?: number\n}\n\nexport type NearRain = {\n update(sample: WeatherSample, dt: number, camera: Vec3): void\n /** Streaks alive. */\n count(): number\n clear(): void\n}\n\n/**\n * The Workshop's near rain (W313-331) driven by the weather: the streaks live in the world's Workshop engine (`engine.rain`), game-vfx-three draws them, and the\n * splashes and rings they leave go to the `normal` sprite pool and the rings. `drops` (900 garoa, 2 200 chuva, 4 000 temporal) and the wind along x are the Workshop's own\n * numbers for its three intensities.\n */\nexport function createNearRain(vfx: VfxWorld | undefined, options: NearRainOptions = {}): NearRain {\n const puddles = options.puddles ?? []\n return {\n update(sample, dt, camera) {\n const raining = sample.rain > 0\n const engine = raining ? vfx?.workshop() : vfx?.peekWorkshop()\n if (!engine) return\n const field = engine.rain\n if (!raining) {\n if (field.on) field.clear()\n return\n }\n field.puddleAt = options.puddleAt ?? ((x, z) => inPuddle(puddles, x, z))\n field.drive(sample.drops, sample.windX, camera[0], camera[2])\n field.update(dt, sample.rain >= (options.splashFrom ?? SPLASH_FROM_MM), camera)\n },\n count: () => vfx?.peekWorkshop()?.rain.count ?? 0,\n clear() {\n vfx?.peekWorkshop()?.rain.clear()\n },\n }\n}\n","import type * as THREE_NS from 'three'\nimport type { WeatherSample } from '@adatechnology/game-weather'\nimport type { ThreeLib, WeatherProfileName } from './types'\n\n/**\n * The game's rain curtain (jogo.js `const RAIN = 14000`): a box of points that follows the camera, 70 m wide and 25 m high, falling 13 m/s. The shader texts and the\n * numbers are the page's, character for character (a golden cuts them from the page and compares).\n */\nexport const RAIN_CURTAIN = { count: 14000, width: 70, height: 25, speed: 13, pointSize: 1.6 } as const\n\nexport const RAIN_CURTAIN_VERTEX =\n 'uniform float uTime; uniform vec3 uCam; void main(){ vec3 p = position; p.y = mod(p.y - uTime*13., 25.); p.xz = uCam.xz + mod(p.xz - uCam.xz + 35., 70.) - 35.; gl_Position = projectionMatrix*viewMatrix*vec4(p,1.); gl_PointSize = 1.6; }'\nexport const RAIN_CURTAIN_FRAGMENT = 'uniform float uDay; void main(){ gl_FragColor = vec4(vec3(.68,.72,.78)*(0.25+0.75*uDay), .22+.1*uDay); }'\n\n/** The share of the 14 000 points each quality draws. */\nexport const RAIN_CURTAIN_PROFILES: Readonly<Record<WeatherProfileName, number>> = { low: 0.35, medium: 0.7, high: 1 }\n/** The weather's `drops` at which the whole curtain is drawn (the storm's 4 000). */\nexport const RAIN_CURTAIN_FULL_AT = 4000\n\n/** The page's loop: x and z in -35..35, y in 0..25, three draws a point in that order, stored as Float32. */\nexport function rainCurtainPositions(random: () => number = Math.random, count: number = RAIN_CURTAIN.count): Float32Array {\n const positions = new Float32Array(count * 3)\n for (let index = 0; index < count; index++) {\n positions[index * 3] = (random() - 0.5) * RAIN_CURTAIN.width\n positions[index * 3 + 1] = random() * RAIN_CURTAIN.height\n positions[index * 3 + 2] = (random() - 0.5) * RAIN_CURTAIN.width\n }\n return positions\n}\n\nexport type RainCurtainOptions = {\n readonly random?: () => number\n readonly profile?: WeatherProfileName\n /** Drops (`WeatherSample.drops`) that draw the whole curtain. */\n readonly fullAt?: number\n readonly count?: number\n}\n\nexport type RainCurtain = {\n readonly object: THREE_NS.Points\n /** Draws `sample.drops` of the curtain around `camera`; `daylight` is the game's `s` (0 night, 1 day). */\n update(sample: WeatherSample, camera: { readonly x: number; readonly y: number; readonly z: number }, time: number, daylight: number): void\n setProfile(profile: WeatherProfileName): void\n /** How many points are drawn now. */\n drawn(): number\n dispose(): void\n}\n\nexport function createRainCurtain(THREE: ThreeLib, options: RainCurtainOptions = {}): RainCurtain {\n const count = options.count ?? RAIN_CURTAIN.count\n const geometry = new THREE.BufferGeometry()\n geometry.setAttribute('position', new THREE.BufferAttribute(rainCurtainPositions(options.random, count), 3))\n const uniforms = { uTime: { value: 0 }, uCam: { value: new THREE.Vector3() }, uDay: { value: 1 } }\n const material = new THREE.ShaderMaterial({ uniforms, transparent: true, depthWrite: false, vertexShader: RAIN_CURTAIN_VERTEX, fragmentShader: RAIN_CURTAIN_FRAGMENT })\n const object = new THREE.Points(geometry, material)\n object.frustumCulled = false\n object.name = 'weather-rain-curtain'\n object.visible = false\n let share = RAIN_CURTAIN_PROFILES[options.profile ?? 'high']\n let drawn = 0\n return {\n object,\n update(sample, camera, time, daylight) {\n const fullAt = options.fullAt ?? RAIN_CURTAIN_FULL_AT\n drawn = sample.rain > 0 ? Math.round(count * share * Math.min(1, sample.drops / fullAt)) : 0\n object.visible = drawn > 0\n geometry.setDrawRange(0, drawn)\n uniforms.uTime.value = time\n uniforms.uDay.value = daylight\n uniforms.uCam.value.set(camera.x, camera.y, camera.z)\n },\n setProfile(profile) {\n share = RAIN_CURTAIN_PROFILES[profile]\n },\n drawn: () => drawn,\n dispose() {\n geometry.dispose()\n material.dispose()\n },\n }\n}\n","import type { LightBudget } from '@adatechnology/game-render-three'\nimport type * as THREE_NS from 'three'\nimport type { VfxWorld } from '@adatechnology/game-vfx'\nimport type { Puddle } from '@adatechnology/game-vfx'\nimport { createFog, emitAirborne } from './fog'\nimport type { Fog } from './fog'\nimport { createHeadlights } from './headlights'\nimport type { HeadlightRules, Headlights } from './headlights'\nimport { createHeatHaze } from './heat-haze'\nimport type { HeatHaze } from './heat-haze'\nimport { createLightning } from './lightning'\nimport type { Lightning } from './lightning'\nimport { createNearRain } from './rain-near'\nimport type { NearRain } from './rain-near'\nimport { createRainCurtain } from './rain-curtain'\nimport type { RainCurtain } from './rain-curtain'\nimport { createSky } from './sky'\nimport type { HostSun, Sky } from './sky'\nimport type { ThreeLib, Vec3, WeatherProfileName, WeatherSource, ZoneFog } from './types'\n\n/** The parts the renderer draws, each of which a layer switches. */\nexport const WEATHER_LAYERS = ['far_rain', 'near_rain', 'mist', 'fog', 'sky', 'lightning', 'headlights', 'haze'] as const\nexport type WeatherLayerId = (typeof WEATHER_LAYERS)[number]\n\nexport type WeatherRendererOptions = {\n readonly scene: THREE_NS.Scene\n readonly camera: THREE_NS.Camera\n readonly weather: WeatherSource\n /** The effects world: near rain, splashes, mist, ash, the white of lightning and the lit drops of headlights live in its Workshop pools (game-vfx-three draws them). */\n readonly vfx?: VfxWorld\n readonly profile?: WeatherProfileName\n /** Seeds the rain curtain (default `Math.random`). */\n readonly random?: () => number\n readonly zone?: ZoneFog\n readonly puddles?: readonly Puddle[]\n readonly puddleAt?: (x: number, z: number) => boolean\n readonly headlights?: HeadlightRules\n /**\n * The host's light budget: the headlights are sources of it and the lightning flash leases one of its hemisphere slots. With it the fog is also stable (never `null`), because the budget seals\n * the fog state of the scene. Without it the lights are created here, as before (deprecated, removed in the next major).\n */\n readonly lights?: LightBudget\n /** The host's sun (its `DirectionalLight`): the sun disc of the sky dome sits in its direction. Without it the disc follows the hour. */\n readonly sun?: HostSun\n readonly layers?: Partial<Record<WeatherLayerId, boolean>>\n}\n\nexport type WeatherRenderer = {\n readonly curtain: RainCurtain\n readonly nearRain: NearRain\n readonly fog: Fog\n readonly sky: Sky\n readonly lightning: Lightning\n readonly headlights: Headlights\n readonly haze: HeatHaze\n /** Draws the weather of the source for a frame of `dt` seconds. Call once per frame, after the weather advanced. */\n update(dt: number): void\n setLayer(id: WeatherLayerId, on: boolean): void\n layer(id: WeatherLayerId): boolean\n setZoneFog(zone: ZoneFog | undefined): void\n setProfile(profile: WeatherProfileName): void\n stats(): { readonly rainCurtain: number; readonly rainNear: number; readonly cars: number }\n dispose(): void\n}\n\n/** The whole weather picture: rain curtain, near rain with splashes, mist and ash, fog, sky, lightning, headlights and heat haze, from one `WeatherSource`. */\nexport function createWeatherRenderer(THREE: ThreeLib, options: WeatherRendererOptions): WeatherRenderer {\n const { scene, camera, weather, vfx } = options\n const group = new THREE.Group()\n group.name = 'weather'\n scene.add(group)\n const curtain = createRainCurtain(THREE, { ...(options.random ? { random: options.random } : {}), ...(options.profile ? { profile: options.profile } : {}) })\n const haze = createHeatHaze(THREE)\n group.add(curtain.object, haze.object)\n const sky = createSky(THREE, scene, { camera, ...(options.sun ? { sun: options.sun } : {}) })\n if (sky.object) group.add(sky.object)\n const fog = createFog(THREE, scene, { stable: options.lights !== undefined })\n const lightning = createLightning(THREE, scene, vfx, options.lights ? { lights: options.lights } : {})\n const headlights = createHeadlights(THREE, options.lights ? { ...options.headlights, lights: options.lights } : options.headlights)\n const nearRain = createNearRain(vfx, { ...(options.puddles ? { puddles: options.puddles } : {}), ...(options.puddleAt ? { puddleAt: options.puddleAt } : {}) })\n const on = new Map<WeatherLayerId, boolean>(WEATHER_LAYERS.map((id) => [id, options.layers?.[id] ?? true]))\n let zone = options.zone\n let time = 0\n const eye: { x: number; y: number; z: number } = { x: 0, y: 0, z: 0 }\n\n const switchedOff = (id: WeatherLayerId): void => {\n if (id === 'far_rain') curtain.object.visible = false\n else if (id === 'near_rain') nearRain.clear()\n else if (id === 'fog') fog.clear()\n else if (id === 'lightning') lightning.light.intensity = 0\n else if (id === 'haze') haze.object.visible = false\n else if (id === 'sky' && sky.object) sky.object.visible = false\n }\n\n return {\n curtain,\n nearRain,\n fog,\n sky,\n lightning,\n headlights,\n haze,\n update(dt) {\n time += dt\n const sample = weather.sample()\n const position = camera.position\n eye.x = position.x\n eye.y = position.y\n eye.z = position.z\n const where: Vec3 = [eye.x, eye.y, eye.z]\n const background = (scene.background as THREE_NS.Color | null) ?? undefined\n const ownSky = on.get('sky') === true\n const color = ownSky ? sky.update(sample, zone, dt) : background && (background as { isColor?: boolean }).isColor ? background : sky.color\n if (on.get('fog')) fog.update(sample, color, zone)\n if (on.get('lightning')) lightning.update(sample, ownSky ? (scene.background as THREE_NS.Color) : undefined)\n if (on.get('far_rain')) curtain.update(sample, eye, time, sample.sun)\n if (on.get('haze')) haze.update(sample, time)\n if (vfx) {\n if (on.get('near_rain')) nearRain.update(sample, dt, where)\n if (on.get('mist')) emitAirborne(vfx.workshop(), sample, dt, where)\n }\n headlights.update(sample, dt, where, vfx && sample.rain > 0 ? vfx.workshop() : undefined, on.get('headlights'))\n },\n setLayer(id, value) {\n on.set(id, value)\n if (!value) switchedOff(id)\n },\n layer: (id) => on.get(id) === true,\n setZoneFog(next) {\n zone = next\n },\n setProfile(profile) {\n curtain.setProfile(profile)\n },\n stats: () => ({ rainCurtain: curtain.drawn(), rainNear: nearRain.count(), cars: headlights.count() }),\n dispose() {\n scene.remove(group)\n curtain.dispose()\n haze.dispose()\n sky.dispose()\n lightning.dispose()\n headlights.dispose()\n nearRain.clear()\n },\n }\n}\n","import type { WeatherLayerId } from '../renderer'\n\n/** The names of the visual layers in the bench; any other locale falls back to English. */\nexport type WeatherVisualText = { readonly layers: Readonly<Record<Exclude<WeatherLayerId, 'fog'>, string>> }\n\nconst TEXTS: Readonly<Record<string, WeatherVisualText>> = {\n en: { layers: { far_rain: 'Rain curtain', near_rain: 'Near rain and splashes', mist: 'Mist and ash', sky: 'Sky', lightning: 'Lightning', headlights: 'Headlights', haze: 'Heat haze' } },\n 'pt-BR': { layers: { far_rain: 'Cortina de chuva', near_rain: 'Chuva perto e respingos', mist: 'Névoa e cinza', sky: 'Céu', lightning: 'Relâmpago', headlights: 'Faróis', haze: 'Névoa de calor' } },\n}\n\nexport const weatherVisualTextOf = (locale: string): WeatherVisualText => TEXTS[locale] ?? TEXTS[locale.split('-')[0] ?? 'en'] ?? TEXTS.en!\n"],"mappings":";AAAA,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;;;ACAjC,SAAS,sBAAsB;AAOxB,IAAM,aAAa;AAAA,EACxB,MAAM,EAAE,OAAO,UAAU,WAAW,KAAK,UAAU,IAAI,OAAO,MAAM,UAAU,KAAK,OAAO,IAAI;AAAA;AAAA,EAE9F,MAAM,CAAC,MAAM,MAAM,IAAI;AAAA,EACvB,KAAK,CAAC,MAAM,KAAK,EAAE;AAAA,EACnB,MAAM,EAAE,QAAQ,KAAK,QAAQ,GAAG,UAAU,IAAI,OAAO,UAAU,SAAS,KAAK;AAAA,EAC7E,MAAM,EAAE,IAAI,UAAU,KAAK,QAAS;AAAA;AAAA,EAEpC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,MAAM,OAAO,UAAU,OAAO,KAAK,MAAM,MAAM,KAAK,OAAO,UAAU,CAAC,KAAK,KAAK,CAAC,EAAE;AAAA;AAAA,EAE7H,YAAY;AACd;AAcO,IAAM,uBAAuB,CAAC,WAAmC,OAAO,cAAc,OAAO,OAAO,OAAO,KAAK,OAAO,aAAa,QAAQ,OAAO,aAAa;AAahK,SAAS,iBAAiB,OAAiB,QAAwB,CAAC,GAAe;AACxF,QAAM,OAAO,oBAAI,IAAS;AAC1B,QAAM,OAAO,WAAW;AACxB,QAAM,YAAY,IAAI,MAAM,QAAQ;AACpC,QAAM,WAAW,IAAI,MAAM,QAAQ;AACnC,QAAM,UAAU,IAAI,MAAM,QAAQ;AAClC,QAAM,OAAO,MAAM,OA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Q,OAAO;AACjB,UAAM,WAAW,MAAY;AAC3B,UAAI,OAAO,CAAC,KAAK,UAAW;AAC5B,YAAM,SAAS,KAAK,UAAU,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC,GAAG,WAAW,MAAM,CAAC,EAAE,CAAC;AAC9F,UAAI,CAAC,OAAQ;AACb,YAAM;AACN,oBAAc;AACd,oBAAc;AACd,YAAM,QAAQ,SAAS,OAAO,OAAO,IAAyB,IAAI,IAAI,WAAW,KAAK,CAAC,IAAI;AAC3F,UAAK,MAAM,SAAS,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,MAAM,CAAC,CAAC,IAAI,OAAO,GAAG,MAAM,CAAC,IAAI,KAAK,IAAI,MAAM,CAAC,CAAC,IAAI,KAAK;AAAA,IACzG;AACA,aAAS;AACT,QAAI,CAAC,IAAK,eAAc,KAAK,QAAQ,QAAQ;AAAA,EAC/C;AACA,SAAO;AAAA,IACL,QAAQ,CAAC,OAAO,SAAS,OAAO,EAAE;AAAA,IAClC,SAAS,IAAI,IAAI;AACf,UAAK,YAAkC,SAAS,EAAE,EAAG,UAAS,SAAS,IAAsB,EAAE;AAAA,IACjG;AAAA,IACA,UAAU;AACR,eAAS;AACT,gBAAU;AACV,oBAAc;AACd,WAAK,OAAO;AACZ,UAAI,KAAK;AACP,cAAM,OAAO,IAAI,KAAK;AACtB,YAAI,QAAQ;AAAA,MACd;AACA,eAAS,QAAQ;AAAA,IACnB;AAAA,EACF;AACF;AAEA,IAAM,cAAyC,CAAC,YAAY,aAAa,QAAQ,OAAO,OAAO,aAAa,cAAc,MAAM;","names":[]}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as ASH, F as FOG_EXP_FROM, a as FOG_NEAR, b as FOG_ZONE_NEAR, c as Fog, d as FogValues, H as HEADLIGHTS, e as HEAT_HAZE, f as HEAT_HAZE_FRAGMENT, g as HEAT_HAZE_VERTEX, h as HeadlightRules, i as Headlights, j as HeatHaze, L as LIGHTNING, k as Lightning, l as LightningOptions, M as MIST, N as NearRain, m as NearRainOptions, R as RAIN_CURTAIN, n as RAIN_CURTAIN_FRAGMENT, o as RAIN_CURTAIN_FULL_AT, p as RAIN_CURTAIN_PROFILES, q as RAIN_CURTAIN_VERTEX, r as RainCurtain, s as RainCurtainOptions, RigVehicles, S as SKY_DAY, t as SKY_NIGHT, u as SPLASH_FROM_MM, v as Sky, T as ThreeLib, V as Vec3, W as WEATHER_LAYERS, w as WeatherLayerId, x as WeatherProfileName, y as WeatherRenderer, z as WeatherRendererOptions, B as WeatherSource, WeatherVisualOptions, WeatherVisualText, Z as ZONE_FOG_DEFAULTS, C as ZONE_LIGHT, D as ZoneFog, E as createFog, G as createHeadlights, I as createHeatHaze, J as createLightning, K as createNearRain, O as createRainCurtain, P as createSky, Q as createWeatherRenderer, createWeatherVisual, U as defaultHeadlightRule, X as densityForFar, Y as emitAirborne, _ as fogOf, $ as rainCurtainPositions, weatherVisualTextOf } from './testing.js';
1
+ export { A as ASH, C as CLOUD_COVER, F as FOG_EXP_FROM, a as FOG_NEAR, b as FOG_ZONE_NEAR, c as Fog, d as FogValues, H as HEADLIGHTS, e as HEAT_HAZE, f as HEAT_HAZE_FRAGMENT, g as HEAT_HAZE_VERTEX, h as HeadlightRules, i as Headlights, j as HeatHaze, k as HostSun, L as LIGHTNING, l as Lightning, m as LightningOptions, M as MIST, N as NearRain, n as NearRainOptions, R as RAIN_CURTAIN, o as RAIN_CURTAIN_FRAGMENT, p as RAIN_CURTAIN_FULL_AT, q as RAIN_CURTAIN_PROFILES, r as RAIN_CURTAIN_VERTEX, s as RainCurtain, t as RainCurtainOptions, RigVehicles, S as SKY_DAY, u as SKY_DOME, v as SKY_NIGHT, w as SPLASH_FROM_MM, x as Sky, y as SkyOptions, T as ThreeLib, V as Vec3, W as WEATHER_LAYERS, z as WeatherLayerId, B as WeatherProfileName, D as WeatherRenderer, E as WeatherRendererOptions, G as WeatherSource, WeatherVisualOptions, WeatherVisualText, Z as ZONE_FOG_DEFAULTS, I as ZONE_LIGHT, J as ZoneFog, K as cloudCoverOf, O as cloudDarknessOf, P as createFog, Q as createHeadlights, U as createHeatHaze, X as createLightning, Y as createNearRain, _ as createRainCurtain, $ as createSky, a0 as createWeatherRenderer, createWeatherVisual, a1 as defaultHeadlightRule, a2 as densityForFar, a3 as emitAirborne, a4 as fogOf, a5 as nightnessOf, a6 as rainCurtainPositions, a7 as starVisibilityOf, a8 as sunDirectionOf, a9 as sunVisibilityOf, aa as sunsetOf, weatherVisualTextOf } from './testing.js';
2
2
  import '@adatechnology/game-render-three';
3
3
  import 'three';
4
4
  import '@adatechnology/game-vfx';