genshin-engine 4.3.1 → 4.3.3

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/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as TERRAIN_RING_INITIAL_TILE_COUNT, C as getCliffBlend, D as TERRAIN_CELL_SIZE, E as GAUSSIAN_REACH_WIDTHS, F as GroundLayer, I as GroundLayers, L as createSeededRandom, M as TILE_INDEX_SPAN, N as createSimplexNoise, O as TERRAIN_HEIGHT_PADDING, P as TerrainFeatureKind, S as getPlateauBlend, T as getTerrainTileLevel, _ as getTerrainTileRow, a as createTerrainFeaturesBlend, b as TerrainFeatureKindBlendMap, c as sampleTerrainResidualFade, d as sampleGroundLayerField, f as getSegmentBounds, g as computeTerrainTile, h as fileByCell, i as createTerrainFeaturesHeight, j as TILE_INDEX_OFFSET, k as TERRAIN_LAYER, l as createGroundPaintColor, m as getGaussianHillBlend, n as createTerrainShapeHeight, o as getTerrainFeatureBounds, p as createGaussianHillsHeight, r as getTerrainShapeLevel, s as createResidualHeight, t as computeScatterPoints, u as createGroundLayerWeights, v as getTerrainTileColumn, w as measureSegment, x as getRidgeBlend, y as blendGridNodes } from "./terrainWorker-DZ04cA3m.js";
1
+ import { A as TERRAIN_RING_INITIAL_TILE_COUNT, C as getCliffBlend, D as TERRAIN_CELL_SIZE, E as GAUSSIAN_REACH_WIDTHS, F as GroundLayer, I as GroundLayers, L as createSeededRandom, M as TILE_INDEX_SPAN, N as createSimplexNoise, O as TERRAIN_HEIGHT_PADDING, P as TerrainFeatureKind, S as getPlateauBlend, T as getTerrainTileLevel, _ as getTerrainTileRow, a as createTerrainFeaturesBlend, b as TerrainFeatureKindBlendMap, c as sampleTerrainResidualFade, d as sampleGroundLayerField, f as getSegmentBounds, g as computeTerrainTile, h as fileByCell, i as createTerrainFeaturesHeight, j as TILE_INDEX_OFFSET, k as TERRAIN_LAYER, l as createGroundPaintColor, m as getGaussianHillBlend, n as createTerrainShapeHeight, o as getTerrainFeatureBounds, p as createGaussianHillsHeight, r as getTerrainShapeLevel, s as createResidualHeight, t as computeScatterPoints, u as createGroundLayerWeights, v as getTerrainTileColumn, w as measureSegment, x as getRidgeBlend, y as blendGridNodes } from "./terrainWorker-Bgj3rmZs.js";
2
2
  import { AdditiveBlending, BackSide, Bone, Box3, BoxGeometry, BufferAttribute, BufferGeometry, CanvasTexture, ClampToEdgeWrapping, Color, CylinderGeometry, Data3DTexture, DataTexture, DataUtils, DirectionalLight, DoubleSide, Euler, Float32BufferAttribute, FloatType, FrontSide, HalfFloatType, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, InterleavedBufferAttribute, LinearFilter, LinearMipmapLinearFilter, MathUtils, Matrix3, Matrix4, Mesh, NearestFilter, NoColorSpace, NoToneMapping, OrthographicCamera, PerspectiveCamera, Quaternion, RGBAFormat, RedFormat, RepeatWrapping, SRGBColorSpace, Scene, Skeleton, SkinnedMesh, Sphere, Sprite, Texture, UnsignedByteType, Vector2, Vector3 } from "three";
3
3
  import { Fn, If, abs, acos, asin, atan, atomicAdd, atomicStore, attribute, cameraFar, cameraNear, cameraPosition, cameraProjectionMatrix, cameraViewMatrix, clamp, color, cos, cross, diffuseColor, distance, dot, exp, exp2, float, fract, getNormalFromDepth, getViewPosition, hash, instanceIndex, instancedBufferAttribute, interleavedGradientNoise, luminance, mat4, max, min, mix, mod, modelViewMatrix, modelWorldMatrix, modelWorldMatrixInverse, mrt, mx_cell_noise_float, mx_fractal_noise_float, mx_noise_float, normalGeometry, normalLocal, normalView, normalViewGeometry, normalWorld, normalWorldGeometry, normalize, output, pass, perspectiveDepthToViewZ, positionGeometry, positionLocal, positionView, positionViewDirection, positionWorld, pow, reflect, renderOutput, sample, saturate, screenCoordinate, screenUV, select, sin, smoothstep, step, storage, tangentLocal, texture, texture3D, time, transformNormal, transformNormalToView, uint, uniform, uniformArray, uv, varying, vec2, vec3, vec4, velocity, vertexColor, viewportDepthTexture, viewportSharedTexture } from "three/tsl";
4
4
  import { IndirectStorageBufferAttribute, LightingModel, MeshBasicNodeMaterial, MeshToonNodeMaterial, NodeMaterial, RenderPipeline, RenderTarget, SpriteNodeMaterial, StorageBufferAttribute, StorageInstancedBufferAttribute, ToonOutlinePassNode, WebGPURenderer } from "three/webgpu";
@@ -16,15 +16,14 @@ import { godrays } from "three/examples/jsm/tsl/display/GodraysNode.js";
16
16
  import { lut3D } from "three/examples/jsm/tsl/display/Lut3DNode.js";
17
17
  import { smaa } from "three/examples/jsm/tsl/display/SMAANode.js";
18
18
  import { traa } from "three/examples/jsm/tsl/display/TRAANode.js";
19
- //#region src/models/atmosphere/PrecipitationKind.ts
19
+ // src/models/atmosphere/PrecipitationKind.ts
20
20
  let PrecipitationKind = /* @__PURE__ */ function(PrecipitationKind) {
21
21
  PrecipitationKind["Rain"] = "Rain";
22
22
  PrecipitationKind["Sand"] = "Sand";
23
23
  PrecipitationKind["Snow"] = "Snow";
24
24
  return PrecipitationKind;
25
25
  }({});
26
- //#endregion
27
- //#region src/models/atmosphere/WeatherKind.ts
26
+ // src/models/atmosphere/WeatherKind.ts
28
27
  let WeatherKind = /* @__PURE__ */ function(WeatherKind) {
29
28
  WeatherKind["Clear"] = "Clear";
30
29
  WeatherKind["Cloudy"] = "Cloudy";
@@ -36,8 +35,7 @@ let WeatherKind = /* @__PURE__ */ function(WeatherKind) {
36
35
  WeatherKind["Thunderstorm"] = "Thunderstorm";
37
36
  return WeatherKind;
38
37
  }({});
39
- //#endregion
40
- //#region src/atmosphere/constants.ts
38
+ // src/atmosphere/constants.ts
41
39
  const SUN_REDRAW_COSINE = Math.cos(.6 * Math.PI / 180);
42
40
  const DEFAULT_SKY_SHAPE = {
43
41
  frontBackBlend: 1,
@@ -168,8 +166,7 @@ const SPLASH_LIFETIME = .35;
168
166
  const SPLASH_SIZE = .4;
169
167
  const SPLASH_OPACITY = .5;
170
168
  const SPLASH_LIFT = .03;
171
- //#endregion
172
- //#region src/atmosphere/applyLightningFlash.ts
169
+ // src/atmosphere/applyLightningFlash.ts
173
170
  const applyLightningFlash = (flash, flashColor, skyUniforms, hemisphere) => {
174
171
  const amount = Math.min(flash, 1) * LIGHTNING_FLASH_SKY;
175
172
  skyUniforms.cloudLitBackColor.value.lerp(flashColor, amount);
@@ -182,8 +179,7 @@ const applyLightningFlash = (flash, flashColor, skyUniforms, hemisphere) => {
182
179
  skyUniforms.zenithColor.value.lerp(flashColor, amount);
183
180
  hemisphere.intensity += flash * LIGHTNING_FLASH_AMBIENT;
184
181
  };
185
- //#endregion
186
- //#region src/atmosphere/applyPrecipitationSettings.ts
182
+ // src/atmosphere/applyPrecipitationSettings.ts
187
183
  const applyPrecipitationSettings = ({ fallSpeed, length, opacity, sway, width, windDrift }, precipitationUniforms) => {
188
184
  precipitationUniforms.fallSpeed.value = fallSpeed;
189
185
  precipitationUniforms.length.value = length;
@@ -192,11 +188,9 @@ const applyPrecipitationSettings = ({ fallSpeed, length, opacity, sway, width, w
192
188
  precipitationUniforms.width.value = width;
193
189
  precipitationUniforms.windDrift.value = windDrift;
194
190
  };
195
- //#endregion
196
- //#region src/atmosphere/checkSunTurned.ts
191
+ // src/atmosphere/checkSunTurned.ts
197
192
  const checkSunTurned = (drawnDirection, direction) => drawnDirection.dot(direction) < SUN_REDRAW_COSINE;
198
- //#endregion
199
- //#region src/post/computeWhiteBalance.ts
193
+ // src/post/computeWhiteBalance.ts
200
194
  const LINEAR_TO_LMS = new Matrix3().set(.390405, .549941, .00892632, .0708416, .963172, .00135775, .0231082, .128021, .936245);
201
195
  const LMS_TO_LINEAR = new Matrix3().set(2.85847, -1.62879, -.024891, -.210182, 1.1582, 324281e-9, -.041812, -.118169, 1.06867);
202
196
  const D65_LMS = [
@@ -214,20 +208,17 @@ const computeWhiteBalance = ({ temperature, tint }, whiteBalance = new Matrix3()
214
208
  balance.set(D65_LMS[0] / (.7328 * whiteX + .4296 - .1624 * whiteZ), 0, 0, 0, D65_LMS[1] / (-.7036 * whiteX + 1.6975 + .0061 * whiteZ), 0, 0, 0, D65_LMS[2] / (.003 * whiteX + .0136 + .9834 * whiteZ));
215
209
  return whiteBalance.copy(LMS_TO_LINEAR).multiply(balance).multiply(LINEAR_TO_LMS);
216
210
  };
217
- //#endregion
218
- //#region src/renderer/constants.ts
211
+ // src/renderer/constants.ts
219
212
  const GENSHIN_TONE_MAPPING = NoToneMapping;
220
213
  const GENSHIN_TONE_CONTRAST = .5;
221
214
  const GENSHIN_TONE_EXPOSURE = 1;
222
215
  const TONE_CONTRAST_OFFSET = .01;
223
216
  const TONE_CURVE_LIFT = 1e-4;
224
217
  const TONE_CURVE_FLOOR = -Math.log2(1.0001) / 1;
225
- //#endregion
226
- //#region src/post/toSceneColor.ts
218
+ // src/post/toSceneColor.ts
227
219
  const toSceneChannel = (channel) => -Math.log2(1.0001 - Math.min(Math.max(channel, 0), 1) ** (1 / .51)) / 1;
228
220
  const toSceneColor = (displayColor, sceneColor = new Color()) => sceneColor.setRGB(toSceneChannel(displayColor.r), toSceneChannel(displayColor.g), toSceneChannel(displayColor.b));
229
- //#endregion
230
- //#region src/atmosphere/applySkyState.ts
221
+ // src/atmosphere/applySkyState.ts
231
222
  const godraysDirection = new Vector3();
232
223
  const inverseWhiteBalance = new Matrix3();
233
224
  const writeShownColor = (displayColor, sceneColor) => toSceneColor(displayColor, sceneColor).applyMatrix3(inverseWhiteBalance);
@@ -277,8 +268,7 @@ const applySkyState = (skyState, { fogUniforms, godraysLight, hemisphere, light,
277
268
  godraysLight.position.copy(godraysLight.target.position).addScaledVector(lightDirection, lightDistance);
278
269
  godraysLight.shadow.needsUpdate = true;
279
270
  };
280
- //#endregion
281
- //#region src/atmosphere/applyWeatherState.ts
271
+ // src/atmosphere/applyWeatherState.ts
282
272
  const applyWeatherState = ({ cloudCoverage, fogDensity, precipitationDensity, precipitationKind, wetness }, { fogUniforms, lightUniforms, precipitationUniforms, skyUniforms }, baseCloudCoverage, baseFogDensity) => {
283
273
  skyUniforms.cloudCoverage.value = Math.max(baseCloudCoverage, cloudCoverage);
284
274
  fogUniforms.density.value = Math.max(baseFogDensity, fogDensity);
@@ -287,8 +277,7 @@ const applyWeatherState = ({ cloudCoverage, fogDensity, precipitationDensity, pr
287
277
  precipitationUniforms.splashDensity.value = precipitationKind === "Rain" ? precipitationDensity : 0;
288
278
  applyPrecipitationSettings(PRECIPITATION_SETTINGS_MAP[precipitationKind], precipitationUniforms);
289
279
  };
290
- //#endregion
291
- //#region src/atmosphere/blendWeatherState.ts
280
+ // src/atmosphere/blendWeatherState.ts
292
281
  const blendWeatherState = (from, { cloudCoverage, fogColor, fogDensity, lightningRate = 0, precipitation, wetness }, amount, weatherState) => {
293
282
  const fromKind = from.precipitationKind;
294
283
  const fromDensity = from.precipitationDensity;
@@ -311,8 +300,7 @@ const blendWeatherState = (from, { cloudCoverage, fogColor, fogDensity, lightnin
311
300
  weatherState.precipitationDensity = toDensity * (amount * 2 - 1);
312
301
  }
313
302
  };
314
- //#endregion
315
- //#region src/kits/writeQuadIndices.ts
303
+ // src/kits/writeQuadIndices.ts
316
304
  const writeQuadIndices = (indices, indexStart, vertexStart) => {
317
305
  indices[indexStart] = vertexStart;
318
306
  indices[indexStart + 1] = vertexStart + 1;
@@ -321,8 +309,7 @@ const writeQuadIndices = (indices, indexStart, vertexStart) => {
321
309
  indices[indexStart + 4] = vertexStart + 2;
322
310
  indices[indexStart + 5] = vertexStart + 3;
323
311
  };
324
- //#endregion
325
- //#region src/atmosphere/computeLightningBolt.ts
312
+ // src/atmosphere/computeLightningBolt.ts
326
313
  const VERTICES_PER_SEGMENT = 4;
327
314
  const INDICES_PER_SEGMENT = 6;
328
315
  const BRANCH_SEGMENT_SHARE = 1 / 3;
@@ -429,29 +416,24 @@ const computeLightningBolt = ({ branchCount, height, roughness, seed, segmentCou
429
416
  sides
430
417
  };
431
418
  };
432
- //#endregion
433
- //#region src/atmosphere/computeLightningFlash.ts
419
+ // src/atmosphere/computeLightningFlash.ts
434
420
  const computeLightningFlash = (elapsed) => {
435
421
  let flash = 0;
436
422
  for (const { seconds, strength } of LIGHTNING_FLASH_PULSES) if (elapsed >= seconds) flash += strength * Math.exp(-(elapsed - seconds) / LIGHTNING_FLASH_DECAY_SECONDS);
437
423
  return flash;
438
424
  };
439
- //#endregion
440
- //#region src/clock/constants.ts
425
+ // src/clock/constants.ts
441
426
  const MINUTES_PER_DAY = 1440;
442
427
  const GAME_MINUTES_PER_SECOND = 1;
443
- //#endregion
444
- //#region src/atmosphere/computeSunDirection.ts
428
+ // src/atmosphere/computeSunDirection.ts
445
429
  const computeSunDirection = (minutes, tilt, sunDirection) => {
446
430
  const hourAngle = minutes / MINUTES_PER_DAY * Math.PI * 2;
447
431
  const height = -Math.cos(hourAngle);
448
432
  return sunDirection.set(Math.sin(hourAngle), height * Math.cos(tilt), height * Math.sin(tilt));
449
433
  };
450
- //#endregion
451
- //#region src/atmosphere/getCloudAtlasColumns.ts
434
+ // src/atmosphere/getCloudAtlasColumns.ts
452
435
  const getCloudAtlasColumns = (spriteCount) => Math.ceil(Math.sqrt(spriteCount));
453
- //#endregion
454
- //#region src/materials/addSmoothLoop.ts
436
+ // src/materials/addSmoothLoop.ts
455
437
  const addSmoothLoop = (path, points) => {
456
438
  if (points.length < 3) return;
457
439
  const getMidpoint = (index) => {
@@ -463,8 +445,7 @@ const addSmoothLoop = (path, points) => {
463
445
  for (const [index, [x, y]] of points.entries()) path.quadraticCurveTo(x, y, ...getMidpoint(index));
464
446
  path.closePath();
465
447
  };
466
- //#endregion
467
- //#region src/atmosphere/createCloudAtlasTexture.ts
448
+ // src/atmosphere/createCloudAtlasTexture.ts
468
449
  const EDGE_BLUR_SHARE = .02;
469
450
  const CROWN_BLUR_SHARE = .035;
470
451
  const createCloudAtlasTexture = (sprites, cellSize) => {
@@ -495,8 +476,7 @@ const createCloudAtlasTexture = (sprites, cellSize) => {
495
476
  texture.generateMipmaps = false;
496
477
  return texture;
497
478
  };
498
- //#endregion
499
- //#region src/atmosphere/orderByViewDepth.ts
479
+ // src/atmosphere/orderByViewDepth.ts
500
480
  const orderByViewDepth = (places, { elements }, depths, order) => {
501
481
  for (let index = 0; index < places.length; index++) {
502
482
  const place = places[index];
@@ -520,8 +500,7 @@ const orderByViewDepth = (places, { elements }, depths, order) => {
520
500
  }
521
501
  return isReordered;
522
502
  };
523
- //#endregion
524
- //#region src/nodes/getCloudSunColors.ts
503
+ // src/nodes/getCloudSunColors.ts
525
504
  const getCloudSunColors = ({ cloudFrontBackBlend, cloudLitBackColor, cloudLitColor, cloudShadeBackColor, cloudShadeColor }, sunCosine) => {
526
505
  const toward = pow(max(sunCosine.mul(cloudFrontBackBlend).add(float(1).sub(cloudFrontBackBlend)), 0), 3);
527
506
  return {
@@ -529,8 +508,7 @@ const getCloudSunColors = ({ cloudFrontBackBlend, cloudLitBackColor, cloudLitCol
529
508
  shade: mix(cloudShadeBackColor, cloudShadeColor, toward)
530
509
  };
531
510
  };
532
- //#endregion
533
- //#region src/atmosphere/createCloudBandSprite.ts
511
+ // src/atmosphere/createCloudBandSprite.ts
534
512
  const BELOW_FADE_START = .1;
535
513
  const BELOW_FADE_SCALE = 5;
536
514
  const COVERAGE_LIGHT_SHARE = .4;
@@ -614,8 +592,7 @@ const createCloudBandSprite = (atlas, clouds, { aspect, spriteCount }, skyUnifor
614
592
  sprite
615
593
  };
616
594
  };
617
- //#endregion
618
- //#region src/atmosphere/createCloudLayerProfileTexture.ts
595
+ // src/atmosphere/createCloudLayerProfileTexture.ts
619
596
  const PROFILE_SAMPLE_COUNT$1 = 64;
620
597
  const RIGHT_ANGLE = 90;
621
598
  const readProfile = (elevations, values, elevation) => {
@@ -644,8 +621,7 @@ const createCloudLayerProfileTexture = ({ elevations, far, near, normalElevation
644
621
  texture.needsUpdate = true;
645
622
  return texture;
646
623
  };
647
- //#endregion
648
- //#region src/atmosphere/createCloudLayerTexture.ts
624
+ // src/atmosphere/createCloudLayerTexture.ts
649
625
  const createCloudLayerTexture = ({ height, width }) => {
650
626
  const texture = new DataTexture(new Uint8Array(width * height * 4), width, height, RGBAFormat);
651
627
  texture.wrapS = RepeatWrapping;
@@ -656,16 +632,14 @@ const createCloudLayerTexture = ({ height, width }) => {
656
632
  texture.needsUpdate = true;
657
633
  return texture;
658
634
  };
659
- //#endregion
660
- //#region src/atmosphere/createCloudLayerTextures.ts
635
+ // src/atmosphere/createCloudLayerTextures.ts
661
636
  const createCloudLayerTextures = ({ curl, density, normal, wisps }) => ({
662
637
  curl: createCloudLayerTexture(curl),
663
638
  density: createCloudLayerTexture(density),
664
639
  normal: createCloudLayerTexture(normal.height),
665
640
  wisps: createCloudLayerTexture(wisps)
666
641
  });
667
- //#endregion
668
- //#region src/atmosphere/createCloudLayerUniforms.ts
642
+ // src/atmosphere/createCloudLayerUniforms.ts
669
643
  const createCloudLayerUniforms = ({ center, turn, wispsTurn, ...profiles }, textures) => ({
670
644
  center: uniform(new Vector2().fromArray(center)),
671
645
  curl: texture(textures.curl),
@@ -693,8 +667,7 @@ const createCloudLayerUniforms = ({ center, turn, wispsTurn, ...profiles }, text
693
667
  wispsOpacity: uniform(0),
694
668
  wispsTurn: uniform(MathUtils.degToRad(wispsTurn))
695
669
  });
696
- //#endregion
697
- //#region src/atmosphere/createLightningBoltGeometry.ts
670
+ // src/atmosphere/createLightningBoltGeometry.ts
698
671
  const createLightningBoltGeometry = ({ directions, indices, positions, sides }) => {
699
672
  const geometry = new BufferGeometry();
700
673
  geometry.setAttribute("position", new BufferAttribute(positions, 3));
@@ -704,8 +677,7 @@ const createLightningBoltGeometry = ({ directions, indices, positions, sides })
704
677
  geometry.computeBoundingSphere();
705
678
  return geometry;
706
679
  };
707
- //#endregion
708
- //#region src/atmosphere/createPrecipitationGeometry.ts
680
+ // src/atmosphere/createPrecipitationGeometry.ts
709
681
  const createPrecipitationGeometry = (particleCount) => {
710
682
  const precipitationGeometry = new InstancedBufferGeometry();
711
683
  precipitationGeometry.setAttribute("position", new Float32BufferAttribute([
@@ -733,8 +705,7 @@ const createPrecipitationGeometry = (particleCount) => {
733
705
  precipitationGeometry.instanceCount = particleCount;
734
706
  return precipitationGeometry;
735
707
  };
736
- //#endregion
737
- //#region src/atmosphere/createPrecipitationUniforms.ts
708
+ // src/atmosphere/createPrecipitationUniforms.ts
738
709
  const createPrecipitationUniforms = () => ({
739
710
  density: uniform(0),
740
711
  eye: uniform(new Vector3()),
@@ -746,11 +717,9 @@ const createPrecipitationUniforms = () => ({
746
717
  width: uniform(0),
747
718
  windDrift: uniform(0)
748
719
  });
749
- //#endregion
750
- //#region src/constants.ts
720
+ // src/constants.ts
751
721
  const MAX_BYTE = 255;
752
- //#endregion
753
- //#region src/atmosphere/createSkyGradientTexture.ts
722
+ // src/atmosphere/createSkyGradientTexture.ts
754
723
  const createSkyGradientTexture = ({ green, red }) => {
755
724
  const width = Math.max(red.length, green.length, 1);
756
725
  const data = new Uint8Array(width * 4);
@@ -767,8 +736,7 @@ const createSkyGradientTexture = ({ green, red }) => {
767
736
  texture.needsUpdate = true;
768
737
  return texture;
769
738
  };
770
- //#endregion
771
- //#region src/atmosphere/createSkyState.ts
739
+ // src/atmosphere/createSkyState.ts
772
740
  const createSkyState = () => ({
773
741
  cloudLitColor: new Color(),
774
742
  cloudShadeColor: new Color(),
@@ -784,8 +752,7 @@ const createSkyState = () => ({
784
752
  sunDirection: new Vector3(),
785
753
  zenithColor: new Color()
786
754
  });
787
- //#endregion
788
- //#region src/atmosphere/createSkyUniforms.ts
755
+ // src/atmosphere/createSkyUniforms.ts
789
756
  const createSkyUniforms = () => ({
790
757
  cloudCoverage: uniform(0),
791
758
  cloudDrift: uniform(new Vector2()),
@@ -812,8 +779,7 @@ const createSkyUniforms = () => ({
812
779
  zenithBackColor: uniform(new Color()),
813
780
  zenithColor: uniform(new Color())
814
781
  });
815
- //#endregion
816
- //#region src/camera/constants.ts
782
+ // src/camera/constants.ts
817
783
  const FREE_CAMERA_BASE_SPEED = 8;
818
784
  const FREE_CAMERA_SPEED_PER_HEIGHT = .5;
819
785
  const FREE_CAMERA_CLEARANCE = 1.5;
@@ -836,8 +802,7 @@ const FOLLOW_CAMERA_EASE_OUT_SPEED = 4;
836
802
  const FOLLOW_CAMERA_SLOPE_PITCH_SPEED = 4;
837
803
  const FOLLOW_CAMERA_CLEARANCE = .2;
838
804
  const FOLLOW_CAMERA_ARM_STEP = .25;
839
- //#endregion
840
- //#region src/models/nodes/AnchoredCascadeShadowNode.ts
805
+ // src/models/nodes/AnchoredCascadeShadowNode.ts
841
806
  const UP = new Vector3(0, 1, 0);
842
807
  const NOT_DRAWN = new Vector3(NaN, NaN, NaN);
843
808
  const ANCHOR_STEP_TEXELS = 16;
@@ -898,8 +863,7 @@ var AnchoredCascadeShadowNode = class extends CSMShadowNode {
898
863
  return extent;
899
864
  }
900
865
  };
901
- //#endregion
902
- //#region src/atmosphere/createSunLight.ts
866
+ // src/atmosphere/createSunLight.ts
903
867
  const LIGHT_MARGIN = 100;
904
868
  const SHADOW_BIAS = -5e-4;
905
869
  const SHADOW_NORMAL_BIAS = .05;
@@ -925,8 +889,7 @@ const createSunLight = ({ cascadeCount, maxFar, shadowMapSize }) => {
925
889
  light
926
890
  };
927
891
  };
928
- //#endregion
929
- //#region src/atmosphere/placeCloudBand.ts
892
+ // src/atmosphere/placeCloudBand.ts
930
893
  const placeCloudBand = ({ count, distanceRange: [near, far], heightRange: [low, high], seed, widthRange: [narrow, wide] }, spriteCount) => {
931
894
  const random = createSeededRandom(seed);
932
895
  return Array.from({ length: count }, () => {
@@ -944,8 +907,7 @@ const placeCloudBand = ({ count, distanceRange: [near, far], heightRange: [low,
944
907
  };
945
908
  });
946
909
  };
947
- //#endregion
948
- //#region src/atmosphere/sampleSkyState.ts
910
+ // src/atmosphere/sampleSkyState.ts
949
911
  const sampleSkyState = (skyKeyframes, minutes, tilt, skyState) => {
950
912
  let nextIndex = 0;
951
913
  while (nextIndex < skyKeyframes.length && (skyKeyframes[nextIndex]?.minutes ?? 0) <= minutes) nextIndex++;
@@ -970,8 +932,7 @@ const sampleSkyState = (skyKeyframes, minutes, tilt, skyState) => {
970
932
  skyState.lightDirection.copy(skyState.sunDirection.y >= 0 ? skyState.sunDirection : skyState.moonDirection);
971
933
  return skyState;
972
934
  };
973
- //#endregion
974
- //#region src/atmosphere/writeCloudLayerTexture.ts
935
+ // src/atmosphere/writeCloudLayerTexture.ts
975
936
  const toByte = (share) => Math.round(Math.min(Math.max(share, 0), 1) * 255);
976
937
  const writeCloudLayerTexture = (texture, readTexel) => {
977
938
  const { data, height, width } = texture.image;
@@ -979,12 +940,10 @@ const writeCloudLayerTexture = (texture, readTexel) => {
979
940
  for (let row = 0; row < height; row++) for (let column = 0; column < width; column++) data.set(readTexel(row * width + column).map((share) => toByte(share)), ((height - 1 - row) * width + column) * 4);
980
941
  texture.needsUpdate = true;
981
942
  };
982
- //#endregion
983
- //#region src/noise/constants.ts
943
+ // src/noise/constants.ts
984
944
  const SPECTRAL_RADIAL_BIN_COUNT = 16;
985
945
  const SPECTRAL_ANGULAR_BIN_COUNT = 8;
986
- //#endregion
987
- //#region src/noise/getSpectralBin.ts
946
+ // src/noise/getSpectralBin.ts
988
947
  const getSpectralBin = (column, row, width, height) => {
989
948
  const across = (column > width / 2 ? column - width : column) / width;
990
949
  const down = (row > height / 2 ? row - height : row) / height;
@@ -996,8 +955,7 @@ const getSpectralBin = (column, row, width, height) => {
996
955
  const angular = Math.min(Math.floor(angle / Math.PI * 8), 7);
997
956
  return radial * 8 + angular;
998
957
  };
999
- //#endregion
1000
- //#region src/audio/transformFourier.ts
958
+ // src/audio/transformFourier.ts
1001
959
  const twiddleTableMap = /* @__PURE__ */ new Map();
1002
960
  const getTwiddleTable = (length) => {
1003
961
  const cachedTable = twiddleTableMap.get(length);
@@ -1047,8 +1005,7 @@ const transformFourier = (real, imaginary) => {
1047
1005
  }
1048
1006
  }
1049
1007
  };
1050
- //#endregion
1051
- //#region src/noise/transformFourierGrid.ts
1008
+ // src/noise/transformFourierGrid.ts
1052
1009
  const transformFourierGrid = (real, imaginary, width, height) => {
1053
1010
  for (let row = 0; row < height; row++) transformFourier(real.subarray(row * width, (row + 1) * width), imaginary.subarray(row * width, (row + 1) * width));
1054
1011
  const [columnReal, columnImaginary] = [new Float64Array(height), new Float64Array(height)];
@@ -1064,8 +1021,7 @@ const transformFourierGrid = (real, imaginary, width, height) => {
1064
1021
  }
1065
1022
  }
1066
1023
  };
1067
- //#endregion
1068
- //#region src/noise/synthesizeSpectralNoise.ts
1024
+ // src/noise/synthesizeSpectralNoise.ts
1069
1025
  const countUnder = (sorted, value) => {
1070
1026
  let [low, high] = [0, sorted.length];
1071
1027
  while (low < high) {
@@ -1131,8 +1087,7 @@ const synthesizeSpectralNoise = ({ channels, height, width }, random) => {
1131
1087
  return field;
1132
1088
  });
1133
1089
  };
1134
- //#endregion
1135
- //#region src/atmosphere/synthesizeCloudLayerTextures.ts
1090
+ // src/atmosphere/synthesizeCloudLayerTextures.ts
1136
1091
  const CLOUD_LAYER_TEXTURE_SEED = 1668050805;
1137
1092
  const IDLE_TIMEOUT_MS = 1e3;
1138
1093
  const waitForIdle = () => new Promise((resolve) => {
@@ -1175,8 +1130,7 @@ const synthesizeCloudLayerTextures = async ({ curl, density, normal, wisps }, te
1175
1130
  ].map((value) => value * .5 + .5), 1];
1176
1131
  });
1177
1132
  };
1178
- //#endregion
1179
- //#region src/audio/collectMusicNotes.ts
1133
+ // src/audio/collectMusicNotes.ts
1180
1134
  const collectMusicNotes = ({ segment, start }, from, to) => segment.voices.flatMap((voice) => voice.notes.flatMap((note) => {
1181
1135
  const time = start + note.start;
1182
1136
  return time >= from && time < to ? [{
@@ -1185,8 +1139,7 @@ const collectMusicNotes = ({ segment, start }, from, to) => segment.voices.flatM
1185
1139
  voice
1186
1140
  }] : [];
1187
1141
  }));
1188
- //#endregion
1189
- //#region src/audio/collectMusicSegments.ts
1142
+ // src/audio/collectMusicSegments.ts
1190
1143
  const collectMusicSegments = ({ isLooping, order, segments }, from, to) => {
1191
1144
  const passDuration = order.reduce((sum, index) => sum + (segments[index]?.duration ?? 0), 0);
1192
1145
  if (passDuration <= 0) return [];
@@ -1207,8 +1160,7 @@ const collectMusicSegments = ({ isLooping, order, segments }, from, to) => {
1207
1160
  }
1208
1161
  return scheduledSegments;
1209
1162
  };
1210
- //#endregion
1211
- //#region src/audio/constants.ts
1163
+ // src/audio/constants.ts
1212
1164
  const MUSIC_LOOKAHEAD_SECONDS = 2;
1213
1165
  const MUSIC_SCHEDULE_INTERVAL_MS = 500;
1214
1166
  const RELEASE_TIME_CONSTANTS = 7;
@@ -1255,8 +1207,7 @@ const SOUND_EFFECT_BAND_EDGES = [
1255
1207
  22387
1256
1208
  ];
1257
1209
  const SOUND_EFFECT_FRAME_LENGTH = 2048;
1258
- //#endregion
1259
- //#region src/audio/computeNoiseSamples.ts
1210
+ // src/audio/computeNoiseSamples.ts
1260
1211
  const computeNoiseSamples = (noiseBands, sampleRate) => {
1261
1212
  const real = new Float64Array(MUSIC_NOISE_LENGTH);
1262
1213
  const imaginary = new Float64Array(MUSIC_NOISE_LENGTH);
@@ -1281,16 +1232,14 @@ const computeNoiseSamples = (noiseBands, sampleRate) => {
1281
1232
  transformFourier(real, imaginary);
1282
1233
  return Float32Array.from(real);
1283
1234
  };
1284
- //#endregion
1285
- //#region src/audio/getSoundEffectBandBins.ts
1235
+ // src/audio/getSoundEffectBandBins.ts
1286
1236
  const getSoundEffectBandBins = (sampleRate) => SOUND_EFFECT_BAND_EDGES.slice(1).map((high, band) => {
1287
1237
  const low = SOUND_EFFECT_BAND_EDGES[band] ?? 0;
1288
1238
  const lowBin = Math.max(Math.round(low * SOUND_EFFECT_FRAME_LENGTH / sampleRate), 1);
1289
1239
  const highBin = Math.max(Math.round(high * SOUND_EFFECT_FRAME_LENGTH / sampleRate) - 1, lowBin);
1290
1240
  return [lowBin, Math.min(highBin, SOUND_EFFECT_FRAME_LENGTH / 2 - 1)];
1291
1241
  });
1292
- //#endregion
1293
- //#region src/audio/computeSoundEffectSamples.ts
1242
+ // src/audio/computeSoundEffectSamples.ts
1294
1243
  const HOP_SHARE = 4;
1295
1244
  const WINDOW_SQUARES_PER_HOP = 1.5;
1296
1245
  const window$1 = Float64Array.from({ length: SOUND_EFFECT_FRAME_LENGTH }, (_value, index) => .5 - .5 * Math.cos(2 * Math.PI * index / SOUND_EFFECT_FRAME_LENGTH));
@@ -1339,11 +1288,9 @@ const computeSoundEffectSamples = ({ frameSeconds, leftLevels, rightLevels, shar
1339
1288
  }
1340
1289
  return [left, right];
1341
1290
  };
1342
- //#endregion
1343
- //#region src/audio/createInstrumentWave.ts
1291
+ // src/audio/createInstrumentWave.ts
1344
1292
  const createInstrumentWave = (context, harmonics) => context.createPeriodicWave(new Float32Array(harmonics.length + 1), Float32Array.of(0, ...harmonics), { disableNormalization: true });
1345
- //#endregion
1346
- //#region src/audio/createNoiseBuffer.ts
1293
+ // src/audio/createNoiseBuffer.ts
1347
1294
  const createNoiseBuffer = (context, noiseBands) => {
1348
1295
  if (noiseBands.every((level) => level <= 0)) return void 0;
1349
1296
  const { sampleRate } = context;
@@ -1354,8 +1301,7 @@ const createNoiseBuffer = (context, noiseBands) => {
1354
1301
  buffer.getChannelData(0).set(computeNoiseSamples(noiseBands, sampleRate));
1355
1302
  return buffer;
1356
1303
  };
1357
- //#endregion
1358
- //#region src/audio/scheduleMusicExpression.ts
1304
+ // src/audio/scheduleMusicExpression.ts
1359
1305
  const toAmplitude = (gain) => 10 ** (gain / 20);
1360
1306
  const scheduleMusicExpression = (gain, expression, start) => {
1361
1307
  const [first = 0, ...rest] = expression;
@@ -1364,8 +1310,7 @@ const scheduleMusicExpression = (gain, expression, start) => {
1364
1310
  gain.setValueAtTime(toAmplitude(first), start + 4);
1365
1311
  for (const [index, windowGain] of rest.entries()) gain.exponentialRampToValueAtTime(toAmplitude(windowGain), start + (index + 1.5) * 8);
1366
1312
  };
1367
- //#endregion
1368
- //#region src/audio/scheduleMusicNote.ts
1313
+ // src/audio/scheduleMusicNote.ts
1369
1314
  const scheduleMusicNote = (context, destination, wave, noiseBuffer, { attack, decay, level, release, sustain, tuning }, { duration, pitch, velocity }, time) => {
1370
1315
  const peak = level * velocity;
1371
1316
  const end = time + duration;
@@ -1397,14 +1342,11 @@ const scheduleMusicNote = (context, destination, wave, noiseBuffer, { attack, de
1397
1342
  noiseSource.start(time, time % noiseBuffer.duration);
1398
1343
  noiseSource.stop(end + release * 7);
1399
1344
  };
1400
- //#endregion
1401
- //#region src/audio/getMusicRecordingGain.ts
1345
+ // src/audio/getMusicRecordingGain.ts
1402
1346
  const getMusicRecordingGain = ({ gain }, velocity) => velocity * 10 ** (gain / 20);
1403
- //#endregion
1404
- //#region src/audio/getMusicRecordingRate.ts
1347
+ // src/audio/getMusicRecordingRate.ts
1405
1348
  const getMusicRecordingRate = ({ keyCenter, tune }, pitch, tuning) => 2 ** ((pitch - keyCenter + tuning) / 12 + tune / 1200);
1406
- //#endregion
1407
- //#region src/audio/selectMusicSample.ts
1349
+ // src/audio/selectMusicSample.ts
1408
1350
  const getOutsideDistance = (value, low, high) => value < low ? low - value : Math.max(value - high, 0);
1409
1351
  const selectMusicSample = (samples, pitch, velocity) => {
1410
1352
  const midiVelocity = Math.min(Math.max(Math.round(velocity * 127), 1), 127);
@@ -1421,8 +1363,7 @@ const selectMusicSample = (samples, pitch, velocity) => {
1421
1363
  }
1422
1364
  return selected;
1423
1365
  };
1424
- //#endregion
1425
- //#region src/audio/scheduleMusicRecording.ts
1366
+ // src/audio/scheduleMusicRecording.ts
1426
1367
  const scheduleMusicRecording = (context, destination, recordingBufferMap, { recordingLevel, recordings, release, tuning }, { duration, pitch, velocity }, time) => {
1427
1368
  const recording = selectMusicSample(recordings, pitch, velocity);
1428
1369
  const buffer = recording && recordingBufferMap.get(recording.file);
@@ -1442,8 +1383,7 @@ const scheduleMusicRecording = (context, destination, recordingBufferMap, { reco
1442
1383
  source.start(time);
1443
1384
  source.stop(end + release * 7);
1444
1385
  };
1445
- //#endregion
1446
- //#region src/audio/createMusicPlayer.ts
1386
+ // src/audio/createMusicPlayer.ts
1447
1387
  const createMusicPlayer = (context, music, recordingBufferMap, destination = context.destination) => {
1448
1388
  const output = new GainNode(context);
1449
1389
  const instrumentSoundMap = /* @__PURE__ */ new Map();
@@ -1495,8 +1435,7 @@ const createMusicPlayer = (context, music, recordingBufferMap, destination = con
1495
1435
  }
1496
1436
  };
1497
1437
  };
1498
- //#endregion
1499
- //#region src/audio/createSoundEffectBuffer.ts
1438
+ // src/audio/createSoundEffectBuffer.ts
1500
1439
  const createSoundEffectBuffer = (context, soundEffect) => {
1501
1440
  const { sampleRate } = context;
1502
1441
  const channels = computeSoundEffectSamples(soundEffect, sampleRate);
@@ -1508,8 +1447,7 @@ const createSoundEffectBuffer = (context, soundEffect) => {
1508
1447
  for (const [channel, samples] of channels.entries()) buffer.getChannelData(channel).set(samples);
1509
1448
  return buffer;
1510
1449
  };
1511
- //#endregion
1512
- //#region src/audio/renderMusicSegment.ts
1450
+ // src/audio/renderMusicSegment.ts
1513
1451
  const renderMusicSegment = (music, segmentIndex, sampleRate, recordingBufferMap) => {
1514
1452
  const segment = music.segments[segmentIndex];
1515
1453
  const context = new OfflineAudioContext({
@@ -1530,8 +1468,7 @@ const renderMusicSegment = (music, segmentIndex, sampleRate, recordingBufferMap)
1530
1468
  }
1531
1469
  return context.startRendering();
1532
1470
  };
1533
- //#endregion
1534
- //#region src/models/input/InputAction.ts
1471
+ // src/models/input/InputAction.ts
1535
1472
  let InputAction = /* @__PURE__ */ function(InputAction) {
1536
1473
  InputAction["Aim"] = "Aim";
1537
1474
  InputAction["Cancel"] = "Cancel";
@@ -1575,8 +1512,7 @@ let InputAction = /* @__PURE__ */ function(InputAction) {
1575
1512
  return InputAction;
1576
1513
  }({});
1577
1514
  const InputActions = Object.values(InputAction);
1578
- //#endregion
1579
- //#region src/camera/createFollowCamera.ts
1515
+ // src/camera/createFollowCamera.ts
1580
1516
  const clampPitch = (value) => Math.max(FOLLOW_CAMERA_MIN_PITCH, Math.min(FOLLOW_CAMERA_MAX_PITCH, value));
1581
1517
  const createFollowCamera = ({ camera, ground, landmarkCollider, settings }) => {
1582
1518
  const euler = new Euler().setFromQuaternion(camera.quaternion, "YXZ");
@@ -1655,8 +1591,7 @@ const createFollowCamera = ({ camera, ground, landmarkCollider, settings }) => {
1655
1591
  }
1656
1592
  };
1657
1593
  };
1658
- //#endregion
1659
- //#region src/camera/createFreeCamera.ts
1594
+ // src/camera/createFreeCamera.ts
1660
1595
  const createFreeCamera = ({ camera, ground }) => {
1661
1596
  const euler = new Euler().setFromQuaternion(camera.quaternion, "YXZ");
1662
1597
  let yaw = euler.y;
@@ -1683,8 +1618,7 @@ const createFreeCamera = ({ camera, ground }) => {
1683
1618
  }
1684
1619
  };
1685
1620
  };
1686
- //#endregion
1687
- //#region src/models/character/PmxSphereMode.ts
1621
+ // src/models/character/PmxSphereMode.ts
1688
1622
  let PmxSphereMode = /* @__PURE__ */ function(PmxSphereMode) {
1689
1623
  PmxSphereMode[PmxSphereMode["Disabled"] = 0] = "Disabled";
1690
1624
  PmxSphereMode[PmxSphereMode["Multiply"] = 1] = "Multiply";
@@ -1692,11 +1626,9 @@ let PmxSphereMode = /* @__PURE__ */ function(PmxSphereMode) {
1692
1626
  PmxSphereMode[PmxSphereMode["AdditionalUv"] = 3] = "AdditionalUv";
1693
1627
  return PmxSphereMode;
1694
1628
  }({});
1695
- //#endregion
1696
- //#region src/character/checkIsPmxSphereDrawn.ts
1629
+ // src/character/checkIsPmxSphereDrawn.ts
1697
1630
  const checkIsPmxSphereDrawn = (sphereMode) => sphereMode === 1 || sphereMode === 2;
1698
- //#endregion
1699
- //#region src/character/checkTransparentTexels.ts
1631
+ // src/character/checkTransparentTexels.ts
1700
1632
  const checkTransparentTexels = (image) => {
1701
1633
  const context = new OffscreenCanvas(image.width, image.height).getContext("2d", { willReadFrequently: true });
1702
1634
  if (!context) return false;
@@ -1708,8 +1640,7 @@ const checkTransparentTexels = (image) => {
1708
1640
  }
1709
1641
  return false;
1710
1642
  };
1711
- //#endregion
1712
- //#region src/character/constants.ts
1643
+ // src/character/constants.ts
1713
1644
  const SHARED_TOON_RAMP_SHADES = [
1714
1645
  .4,
1715
1646
  .45,
@@ -1722,8 +1653,7 @@ const SHARED_TOON_RAMP_SHADES = [
1722
1653
  .8,
1723
1654
  .85
1724
1655
  ];
1725
- //#endregion
1726
- //#region src/character/shading/constants.ts
1656
+ // src/character/shading/constants.ts
1727
1657
  const REGION_FLOORS = {
1728
1658
  five: .6,
1729
1659
  four: .2,
@@ -1772,8 +1702,7 @@ const FLAT_LIGHT_MAP = [
1772
1702
  0,
1773
1703
  0
1774
1704
  ];
1775
- //#endregion
1776
- //#region src/character/shading/updateFaceDraw.ts
1705
+ // src/character/shading/updateFaceDraw.ts
1777
1706
  const HALF_TURN_DEGREES = 180;
1778
1707
  const RIGHT_ANGLE_DEGREES = 90;
1779
1708
  const rootAxisY = new Vector3();
@@ -1807,23 +1736,20 @@ const updateFaceDraw = (faceDraw, lightDirection, rootRotation) => {
1807
1736
  faceDraw.threshold.value = getThreshold(Math.abs(angle) / HALF_TURN_DEGREES, faceDraw.rotateOffset);
1808
1737
  faceDraw.flip.value = checkIsFlipped(angle, faceDraw.flipFactor) ? 1 : 0;
1809
1738
  };
1810
- //#endregion
1811
- //#region src/models/character/CharacterMaterialKind.ts
1739
+ // src/models/character/CharacterMaterialKind.ts
1812
1740
  let CharacterMaterialKind = /* @__PURE__ */ function(CharacterMaterialKind) {
1813
1741
  CharacterMaterialKind[CharacterMaterialKind["Body"] = 0] = "Body";
1814
1742
  CharacterMaterialKind[CharacterMaterialKind["Face"] = 1] = "Face";
1815
1743
  CharacterMaterialKind[CharacterMaterialKind["Hair"] = 2] = "Hair";
1816
1744
  return CharacterMaterialKind;
1817
1745
  }({});
1818
- //#endregion
1819
- //#region src/models/character/RampLayout.ts
1746
+ // src/models/character/RampLayout.ts
1820
1747
  let RampLayout = /* @__PURE__ */ function(RampLayout) {
1821
1748
  RampLayout[RampLayout["Horizontal"] = 0] = "Horizontal";
1822
1749
  RampLayout[RampLayout["Vertical"] = 1] = "Vertical";
1823
1750
  return RampLayout;
1824
1751
  }({});
1825
- //#endregion
1826
- //#region src/character/createCharacterShadingInputs.ts
1752
+ // src/character/createCharacterShadingInputs.ts
1827
1753
  const WHITE = [
1828
1754
  1,
1829
1755
  1,
@@ -1894,8 +1820,7 @@ const createCharacterShadingInputs = (overrides) => {
1894
1820
  ...overrides
1895
1821
  };
1896
1822
  };
1897
- //#endregion
1898
- //#region src/materials/computeRampValues.ts
1823
+ // src/materials/computeRampValues.ts
1899
1824
  const computeRampValues = ({ resolution, shade, softness, terminator }) => {
1900
1825
  const lowerEdge = terminator - softness / 2;
1901
1826
  const upperEdge = terminator + softness / 2;
@@ -1905,8 +1830,7 @@ const computeRampValues = ({ resolution, shade, softness, terminator }) => {
1905
1830
  return Math.round(MathUtils.lerp(shade, 1, lit) * 255);
1906
1831
  });
1907
1832
  };
1908
- //#endregion
1909
- //#region src/materials/createRampTexture.ts
1833
+ // src/materials/createRampTexture.ts
1910
1834
  const createRampTexture = (rampOptions) => {
1911
1835
  const rampValues = computeRampValues(rampOptions);
1912
1836
  const rampTexture = new DataTexture(rampValues, rampOptions.resolution, 1, RedFormat);
@@ -1915,8 +1839,7 @@ const createRampTexture = (rampOptions) => {
1915
1839
  rampTexture.needsUpdate = true;
1916
1840
  return rampTexture;
1917
1841
  };
1918
- //#endregion
1919
- //#region src/character/getSharedToonRamp.ts
1842
+ // src/character/getSharedToonRamp.ts
1920
1843
  let sharedToonRamps;
1921
1844
  const getSharedToonRamp = (toonIndex) => {
1922
1845
  sharedToonRamps ??= SHARED_TOON_RAMP_SHADES.map((shade) => createRampTexture({
@@ -1927,8 +1850,7 @@ const getSharedToonRamp = (toonIndex) => {
1927
1850
  }));
1928
1851
  return sharedToonRamps.at(toonIndex);
1929
1852
  };
1930
- //#endregion
1931
- //#region src/character/shading/createFaceShadeNode.ts
1853
+ // src/character/shading/createFaceShadeNode.ts
1932
1854
  const createFaceUv = (flip) => vec2(select(flip.greaterThan(.5), float(1).sub(uv().x), uv().x), uv().y);
1933
1855
  const createFaceShadeNode = (faceMap, softness, { flip, threshold }) => {
1934
1856
  const window = max(float(softness), float(1e-6));
@@ -1937,17 +1859,14 @@ const createFaceShadeNode = (faceMap, softness, { flip, threshold }) => {
1937
1859
  const faceTexel = faceMap ? texture(faceMap, createFaceUv(flip)).a : float(1);
1938
1860
  return smoothstep(0, 1, saturate(faceTexel.sub(low).div(high.sub(low))));
1939
1861
  };
1940
- //#endregion
1941
- //#region src/character/shading/createRampColumnNode.ts
1862
+ // src/character/shading/createRampColumnNode.ts
1942
1863
  const createRampColumnNode = (threshold, lightArea, rampWidth) => {
1943
1864
  const shortfall = float(lightArea).sub(threshold).div(lightArea).div(rampWidth);
1944
1865
  return float(1).sub(clamp(shortfall, 0, 1));
1945
1866
  };
1946
- //#endregion
1947
- //#region src/character/shading/createRampUvNode.ts
1867
+ // src/character/shading/createRampUvNode.ts
1948
1868
  const createRampUvNode = (layout, column, row) => layout === 0 ? vec2(column, float(1).sub(row)) : vec2(float(.5), column);
1949
- //#endregion
1950
- //#region src/character/shading/createShadingRegionNode.ts
1869
+ // src/character/shading/createShadingRegionNode.ts
1951
1870
  const createShadingRegionNode = (alpha, toggles) => {
1952
1871
  let region = float(1);
1953
1872
  if (toggles.four) region = select(alpha.greaterThanEqual(REGION_FLOORS.four).and(alpha.lessThan(REGION_FLOORS.three)), float(4), region);
@@ -1956,16 +1875,14 @@ const createShadingRegionNode = (alpha, toggles) => {
1956
1875
  if (toggles.two) region = select(alpha.greaterThanEqual(REGION_FLOORS.two), float(2), region);
1957
1876
  return region;
1958
1877
  };
1959
- //#endregion
1960
- //#region src/character/shading/createToneNode.ts
1878
+ // src/character/shading/createToneNode.ts
1961
1879
  const createToneNode = (colour, desaturateScale, contrastScale) => {
1962
1880
  const [weightRed, weightGreen, weightBlue] = DESATURATION_WEIGHTS;
1963
1881
  const luminance = dot(colour, vec3(weightRed, weightGreen, weightBlue));
1964
1882
  const desaturated = mix(colour, vec3(luminance), desaturateScale);
1965
1883
  return vec3(.5).add(desaturated.sub(.5).mul(float(1).add(contrastScale)));
1966
1884
  };
1967
- //#endregion
1968
- //#region src/character/shading/createToonThresholdNode.ts
1885
+ // src/character/shading/createToonThresholdNode.ts
1969
1886
  const createToonThresholdNode = ({ isLightMapAo, isVertexAo, lightMapGreen, sunTerm, vertexAo }) => {
1970
1887
  const offset = (isLightMapAo ? lightMapGreen : float(NEUTRAL_LIGHT_MAP_GREEN)).sub(NEUTRAL_LIGHT_MAP_GREEN);
1971
1888
  const remapped = float(2).mul(offset).mul(abs(offset)).add(NEUTRAL_LIGHT_MAP_GREEN);
@@ -1973,8 +1890,7 @@ const createToonThresholdNode = ({ isLightMapAo, isVertexAo, lightMapGreen, sunT
1973
1890
  const mixed = occluded.add(sunTerm).div(2);
1974
1891
  return select(occluded.lessThan(TOON_LOW), float(0), select(occluded.greaterThan(TOON_HIGH), float(1), mixed));
1975
1892
  };
1976
- //#endregion
1977
- //#region src/character/shading/selectRegionNode.ts
1893
+ // src/character/shading/selectRegionNode.ts
1978
1894
  const LATER_REGIONS = [
1979
1895
  [2, "two"],
1980
1896
  [3, "three"],
@@ -1982,8 +1898,7 @@ const LATER_REGIONS = [
1982
1898
  [5, "five"]
1983
1899
  ];
1984
1900
  const selectRegionNode = (region, toRegionNode) => LATER_REGIONS.reduce((current, [regionNumber, regionName]) => select(region.equal(float(regionNumber)), toRegionNode(regionName), current), toRegionNode("one"));
1985
- //#endregion
1986
- //#region src/character/shading/createCharacterShadingNode.ts
1901
+ // src/character/shading/createCharacterShadingNode.ts
1987
1902
  const toVec3 = ([red, green, blue]) => vec3(red, green, blue);
1988
1903
  const laySphere = (diffuse, sphere) => {
1989
1904
  const sample = texture(sphere.texture, vec2(normalView.x, normalView.y.negate()).mul(.5).add(.5)).rgb;
@@ -2031,8 +1946,7 @@ const createCharacterShadingNode = (inputs, { lightColor, sunDirection }) => {
2031
1946
  const coloured = metalTexture && kind === 0 ? select(lightMap.r.greaterThan(.9), mix(toVec3(inputs.metalDarkColor), toVec3(inputs.metalLightColor), texture(metalTexture, normalView.xy.mul(.5).add(.5)).r), lightColour) : lightColour;
2032
1947
  return createToneNode(coloured, inputs.desaturateScale, inputs.contrastScale);
2033
1948
  };
2034
- //#endregion
2035
- //#region src/character/shading/createOutlineColorNode.ts
1949
+ // src/character/shading/createOutlineColorNode.ts
2036
1950
  const UNTINTED = [
2037
1951
  1,
2038
1952
  1,
@@ -2054,22 +1968,19 @@ const createOutlineColorNode = ({ color, contrastScale, desaturateScale, lightMa
2054
1968
  const intensity = selectRegionNode(region, (regionName) => float(intensities[regionName]));
2055
1969
  return createToneNode(mix(outlineColor, mainShare, intensity), desaturateScale, contrastScale);
2056
1970
  };
2057
- //#endregion
2058
- //#region src/character/shading/getDesaturatedColour.ts
1971
+ // src/character/shading/getDesaturatedColour.ts
2059
1972
  const getDesaturatedColour = (colour, desaturateScale) => {
2060
1973
  const [weightRed, weightGreen, weightBlue] = DESATURATION_WEIGHTS;
2061
1974
  const luminance = colour.x * weightRed + colour.y * weightGreen + colour.z * weightBlue;
2062
1975
  return new Vector3(colour.x + (luminance - colour.x) * desaturateScale, colour.y + (luminance - colour.y) * desaturateScale, colour.z + (luminance - colour.z) * desaturateScale);
2063
1976
  };
2064
- //#endregion
2065
- //#region src/character/shading/getToneColour.ts
1977
+ // src/character/shading/getToneColour.ts
2066
1978
  const getToneColour = (colour, desaturateScale, contrastScale) => {
2067
1979
  const desaturated = getDesaturatedColour(colour, desaturateScale);
2068
1980
  const gain = 1 + contrastScale;
2069
1981
  return new Vector3(.5 + (desaturated.x - .5) * gain, .5 + (desaturated.y - .5) * gain, .5 + (desaturated.z - .5) * gain);
2070
1982
  };
2071
- //#endregion
2072
- //#region src/models/nodes/ToonNodeMaterial.ts
1983
+ // src/models/nodes/ToonNodeMaterial.ts
2073
1984
  var ToonNodeMaterial = class extends MeshToonNodeMaterial {
2074
1985
  edge;
2075
1986
  emissiveNode = null;
@@ -2084,8 +1995,7 @@ var ToonNodeMaterial = class extends MeshToonNodeMaterial {
2084
1995
  this.isMeshToonNodeMaterial = isOutlined;
2085
1996
  }
2086
1997
  };
2087
- //#endregion
2088
- //#region src/character/createCharacterMaterial.ts
1998
+ // src/character/createCharacterMaterial.ts
2089
1999
  const createCharacterMaterial = ({ isTextureTransparent, lightUniforms, pmxMaterial: { diffuseColor: [red, green, blue, opacity], edgeColor, edgeSize, isDoubleSided, isOutlined, isToonShared, specularColor, specularity, sphereMode, toonIndex }, rampTexture, shadingInputs: gameShadingInputs, sphereTexture, texture: diffuseTexture, toonTexture }) => {
2090
2000
  const isTransparent = opacity !== 1 || isTextureTransparent;
2091
2001
  const color = [
@@ -2132,8 +2042,7 @@ const createCharacterMaterial = ({ isTextureTransparent, lightUniforms, pmxMater
2132
2042
  if (sphereTexture && checkIsPmxSphereDrawn(sphereMode)) characterMaterial.sphereMap = sphereTexture;
2133
2043
  return characterMaterial;
2134
2044
  };
2135
- //#endregion
2136
- //#region src/kits/createIndexedGeometry.ts
2045
+ // src/kits/createIndexedGeometry.ts
2137
2046
  const createIndexedGeometry = ({ indices, normals, positions, uvs }) => {
2138
2047
  const geometry = new BufferGeometry();
2139
2048
  geometry.setAttribute("position", new BufferAttribute(positions, 3));
@@ -2143,8 +2052,7 @@ const createIndexedGeometry = ({ indices, normals, positions, uvs }) => {
2143
2052
  geometry.computeBoundingSphere();
2144
2053
  return geometry;
2145
2054
  };
2146
- //#endregion
2147
- //#region src/character/createPmxGeometry.ts
2055
+ // src/character/createPmxGeometry.ts
2148
2056
  const createPmxGeometry = ({ indices, materials, vertices: { normals, positions, skinIndices, skinWeights, subUvs, uvs } }) => {
2149
2057
  const geometry = createIndexedGeometry({
2150
2058
  indices,
@@ -2162,8 +2070,7 @@ const createPmxGeometry = ({ indices, materials, vertices: { normals, positions,
2162
2070
  }
2163
2071
  return geometry;
2164
2072
  };
2165
- //#endregion
2166
- //#region src/character/createPmxSkeleton.ts
2073
+ // src/character/createPmxSkeleton.ts
2167
2074
  const createPmxSkeleton = (pmxBones) => {
2168
2075
  const bones = pmxBones.map(({ name, parentIndex, position: [x, y, z] }) => {
2169
2076
  const bone = new Bone();
@@ -2183,8 +2090,7 @@ const createPmxSkeleton = (pmxBones) => {
2183
2090
  }
2184
2091
  return new Skeleton(bones);
2185
2092
  };
2186
- //#endregion
2187
- //#region src/character/createPmxMesh.ts
2093
+ // src/character/createPmxMesh.ts
2188
2094
  const createPmxMesh = (pmxModel, materials, unitMetres) => {
2189
2095
  const geometry = createPmxGeometry(pmxModel);
2190
2096
  const mesh = new SkinnedMesh(geometry, materials);
@@ -2195,8 +2101,7 @@ const createPmxMesh = (pmxModel, materials, unitMetres) => {
2195
2101
  mesh.bind(skeleton);
2196
2102
  return mesh;
2197
2103
  };
2198
- //#endregion
2199
- //#region src/character/createPmxTexture.ts
2104
+ // src/character/createPmxTexture.ts
2200
2105
  const createPmxTexture = async (blob) => {
2201
2106
  const image = await createImageBitmap(blob, {
2202
2107
  colorSpaceConversion: "none",
@@ -2218,8 +2123,7 @@ const createPmxToonTexture = async (blob) => {
2218
2123
  texture.needsUpdate = true;
2219
2124
  return texture;
2220
2125
  };
2221
- //#endregion
2222
- //#region src/models/character/PmxBoneFlag.ts
2126
+ // src/models/character/PmxBoneFlag.ts
2223
2127
  let PmxBoneFlag = /* @__PURE__ */ function(PmxBoneFlag) {
2224
2128
  PmxBoneFlag[PmxBoneFlag["IndexedTail"] = 1] = "IndexedTail";
2225
2129
  PmxBoneFlag[PmxBoneFlag["InverseKinematics"] = 32] = "InverseKinematics";
@@ -2230,8 +2134,7 @@ let PmxBoneFlag = /* @__PURE__ */ function(PmxBoneFlag) {
2230
2134
  PmxBoneFlag[PmxBoneFlag["ExternalParent"] = 8192] = "ExternalParent";
2231
2135
  return PmxBoneFlag;
2232
2136
  }({});
2233
- //#endregion
2234
- //#region src/character/parsePmxBones.ts
2137
+ // src/character/parsePmxBones.ts
2235
2138
  const parsePmxBones = (reader) => Array.from({ length: reader.readInt32() }, () => {
2236
2139
  const name = reader.readText();
2237
2140
  reader.readText();
@@ -2263,8 +2166,7 @@ const parsePmxBones = (reader) => Array.from({ length: reader.readInt32() }, ()
2263
2166
  position
2264
2167
  };
2265
2168
  });
2266
- //#endregion
2267
- //#region src/character/parsePmxJoints.ts
2169
+ // src/character/parsePmxJoints.ts
2268
2170
  const parsePmxJoints = (reader) => Array.from({ length: reader.readInt32() }, () => {
2269
2171
  const name = reader.readText();
2270
2172
  reader.readText();
@@ -2310,15 +2212,13 @@ const parsePmxJoints = (reader) => Array.from({ length: reader.readInt32() }, ()
2310
2212
  translationSpring
2311
2213
  };
2312
2214
  });
2313
- //#endregion
2314
- //#region src/models/character/PmxMaterialFlag.ts
2215
+ // src/models/character/PmxMaterialFlag.ts
2315
2216
  let PmxMaterialFlag = /* @__PURE__ */ function(PmxMaterialFlag) {
2316
2217
  PmxMaterialFlag[PmxMaterialFlag["DoubleSided"] = 1] = "DoubleSided";
2317
2218
  PmxMaterialFlag[PmxMaterialFlag["Outlined"] = 16] = "Outlined";
2318
2219
  return PmxMaterialFlag;
2319
2220
  }({});
2320
- //#endregion
2321
- //#region src/character/parsePmxMaterials.ts
2221
+ // src/character/parsePmxMaterials.ts
2322
2222
  const parsePmxMaterials = (reader) => Array.from({ length: reader.readInt32() }, () => {
2323
2223
  const name = reader.readText();
2324
2224
  reader.readText();
@@ -2371,8 +2271,7 @@ const parsePmxMaterials = (reader) => Array.from({ length: reader.readInt32() },
2371
2271
  toonIndex
2372
2272
  };
2373
2273
  });
2374
- //#endregion
2375
- //#region src/models/character/PmxMorphKind.ts
2274
+ // src/models/character/PmxMorphKind.ts
2376
2275
  let PmxMorphKind = /* @__PURE__ */ function(PmxMorphKind) {
2377
2276
  PmxMorphKind[PmxMorphKind["Group"] = 0] = "Group";
2378
2277
  PmxMorphKind[PmxMorphKind["Vertex"] = 1] = "Vertex";
@@ -2387,8 +2286,7 @@ let PmxMorphKind = /* @__PURE__ */ function(PmxMorphKind) {
2387
2286
  PmxMorphKind[PmxMorphKind["Impulse"] = 10] = "Impulse";
2388
2287
  return PmxMorphKind;
2389
2288
  }({});
2390
- //#endregion
2391
- //#region src/character/parsePmxMorphs.ts
2289
+ // src/character/parsePmxMorphs.ts
2392
2290
  const PmxMorphKindOffsetSizeMap = {
2393
2291
  [4]: ({ vertexIndexSize }) => vertexIndexSize + 16,
2394
2292
  [5]: ({ vertexIndexSize }) => vertexIndexSize + 16,
@@ -2442,8 +2340,7 @@ const parsePmxMorphs = (reader) => Array.from({ length: reader.readInt32() }, ()
2442
2340
  values: /* @__PURE__ */ new Float32Array()
2443
2341
  };
2444
2342
  });
2445
- //#endregion
2446
- //#region src/character/parsePmxRigidBodies.ts
2343
+ // src/character/parsePmxRigidBodies.ts
2447
2344
  const parsePmxRigidBodies = (reader) => Array.from({ length: reader.readInt32() }, () => {
2448
2345
  const name = reader.readText();
2449
2346
  reader.readText();
@@ -2475,8 +2372,7 @@ const parsePmxRigidBodies = (reader) => Array.from({ length: reader.readInt32()
2475
2372
  size
2476
2373
  };
2477
2374
  });
2478
- //#endregion
2479
- //#region src/models/character/PmxWeightDeform.ts
2375
+ // src/models/character/PmxWeightDeform.ts
2480
2376
  let PmxWeightDeform = /* @__PURE__ */ function(PmxWeightDeform) {
2481
2377
  PmxWeightDeform[PmxWeightDeform["OneBone"] = 0] = "OneBone";
2482
2378
  PmxWeightDeform[PmxWeightDeform["TwoBones"] = 1] = "TwoBones";
@@ -2485,8 +2381,7 @@ let PmxWeightDeform = /* @__PURE__ */ function(PmxWeightDeform) {
2485
2381
  PmxWeightDeform[PmxWeightDeform["DualQuaternion"] = 4] = "DualQuaternion";
2486
2382
  return PmxWeightDeform;
2487
2383
  }({});
2488
- //#endregion
2489
- //#region src/character/parsePmxVertices.ts
2384
+ // src/character/parsePmxVertices.ts
2490
2385
  const PmxWeightDeformBoneCountMap = {
2491
2386
  [4]: 4,
2492
2387
  [2]: 4,
@@ -2534,15 +2429,13 @@ const parsePmxVertices = (reader) => {
2534
2429
  uvs
2535
2430
  };
2536
2431
  };
2537
- //#endregion
2538
- //#region src/models/character/PmxTextEncoding.ts
2432
+ // src/models/character/PmxTextEncoding.ts
2539
2433
  let PmxTextEncoding = /* @__PURE__ */ function(PmxTextEncoding) {
2540
2434
  PmxTextEncoding[PmxTextEncoding["Utf16LittleEndian"] = 0] = "Utf16LittleEndian";
2541
2435
  PmxTextEncoding[PmxTextEncoding["Utf8"] = 1] = "Utf8";
2542
2436
  return PmxTextEncoding;
2543
2437
  }({});
2544
- //#endregion
2545
- //#region src/models/character/PmxReader.ts
2438
+ // src/models/character/PmxReader.ts
2546
2439
  var PmxReader = class {
2547
2440
  additionalVectorCount;
2548
2441
  boneIndexSize;
@@ -2655,8 +2548,7 @@ var PmxReader = class {
2655
2548
  else return this.#view.getInt32(offset, true);
2656
2549
  }
2657
2550
  };
2658
- //#endregion
2659
- //#region src/character/parsePmx.ts
2551
+ // src/character/parsePmx.ts
2660
2552
  const parsePmx = (buffer) => {
2661
2553
  const reader = new PmxReader(buffer);
2662
2554
  const name = reader.readText();
@@ -2697,11 +2589,9 @@ const parsePmx = (buffer) => {
2697
2589
  vertices
2698
2590
  };
2699
2591
  };
2700
- //#endregion
2701
- //#region src/character/pose/advanceStridePhase.ts
2592
+ // src/character/pose/advanceStridePhase.ts
2702
2593
  const advanceStridePhase = (stridePhase, speed, strideMetres, delta) => stridePhase + Math.PI * 2 * speed * delta / strideMetres;
2703
- //#endregion
2704
- //#region src/models/character/MmdBoneName.ts
2594
+ // src/models/character/MmdBoneName.ts
2705
2595
  let MmdBoneName = /* @__PURE__ */ function(MmdBoneName) {
2706
2596
  MmdBoneName["Center"] = "センター";
2707
2597
  MmdBoneName["Head"] = "頭";
@@ -2725,8 +2615,7 @@ let MmdBoneName = /* @__PURE__ */ function(MmdBoneName) {
2725
2615
  MmdBoneName["Upper2"] = "上半身2";
2726
2616
  return MmdBoneName;
2727
2617
  }({});
2728
- //#endregion
2729
- //#region src/models/locomotion/LocomotionState.ts
2618
+ // src/models/locomotion/LocomotionState.ts
2730
2619
  let LocomotionState = /* @__PURE__ */ function(LocomotionState) {
2731
2620
  LocomotionState["Climb"] = "Climb";
2732
2621
  LocomotionState["ClimbJump"] = "ClimbJump";
@@ -2744,8 +2633,7 @@ let LocomotionState = /* @__PURE__ */ function(LocomotionState) {
2744
2633
  LocomotionState["Walk"] = "Walk";
2745
2634
  return LocomotionState;
2746
2635
  }({});
2747
- //#endregion
2748
- //#region src/character/pose/constants.ts
2636
+ // src/character/pose/constants.ts
2749
2637
  const POSE_BREATH_SECONDS = 4;
2750
2638
  const POSE_CHEST_BREATH_RADIANS = .02;
2751
2639
  const POSE_SHOULDER_BREATH_RADIANS = .02;
@@ -2820,8 +2708,7 @@ const POSE_AIR_STANCES = {
2820
2708
  }
2821
2709
  };
2822
2710
  const MMD_BONE_NAME_MAP = Object.fromEntries(Object.values(MmdBoneName).map((name) => [name, name]));
2823
- //#endregion
2824
- //#region src/character/pose/computeCharacterPose.ts
2711
+ // src/character/pose/computeCharacterPose.ts
2825
2712
  const TAU$1 = Math.PI * 2;
2826
2713
  const AXIS_X = new Vector3(1, 0, 0);
2827
2714
  const AXIS_Z = new Vector3(0, 0, 1);
@@ -2868,11 +2755,9 @@ const computeCharacterPose = ({ elapsed, state, stridePhase }, rotations) => {
2868
2755
  setBoneRotation(rotations["左足首"], 0, 0);
2869
2756
  setBoneRotation(rotations["右足首"], 0, 0);
2870
2757
  };
2871
- //#endregion
2872
- //#region src/character/pose/createCharacterPoseRotations.ts
2758
+ // src/character/pose/createCharacterPoseRotations.ts
2873
2759
  const createCharacterPoseRotations = () => Object.fromEntries(Object.values(MmdBoneName).map((name) => [name, new Quaternion()]));
2874
- //#endregion
2875
- //#region src/character/pose/createCharacterPoser.ts
2760
+ // src/character/pose/createCharacterPoser.ts
2876
2761
  const getRestWorldRotation = (bone, armRaises) => {
2877
2762
  const rotation = new Quaternion();
2878
2763
  let raise;
@@ -2948,8 +2833,7 @@ const createCharacterPoser = (skinnedMesh, boneNameMap = MMD_BONE_NAME_MAP) => {
2948
2833
  }
2949
2834
  } };
2950
2835
  };
2951
- //#endregion
2952
- //#region src/character/pose/findSkinnedMesh.ts
2836
+ // src/character/pose/findSkinnedMesh.ts
2953
2837
  const findSkinnedMesh = (object) => {
2954
2838
  if (object instanceof SkinnedMesh) return object;
2955
2839
  for (const child of object.children) {
@@ -2957,8 +2841,7 @@ const findSkinnedMesh = (object) => {
2957
2841
  if (skinnedMesh) return skinnedMesh;
2958
2842
  }
2959
2843
  };
2960
- //#endregion
2961
- //#region src/character/shading/createOutlineScaleNode.ts
2844
+ // src/character/shading/createOutlineScaleNode.ts
2962
2845
  const createOutlineScaleNode = (depths, scales) => {
2963
2846
  const [nearDepth, middleDepth, farDepth] = depths;
2964
2847
  const [nearScale, middleScale, farScale] = scales;
@@ -2971,11 +2854,9 @@ const createOutlineScaleNode = (depths, scales) => {
2971
2854
  const highScale = select(isNear, float(middleScale), float(farScale));
2972
2855
  return clamp(depth.sub(low).div(max(high.sub(low), float(MINIMUM_OUTLINE_KNOT_SPAN))), 0, 1).mul(highScale.sub(lowScale)).add(lowScale);
2973
2856
  };
2974
- //#endregion
2975
- //#region src/character/shading/getOutlineDepth.ts
2857
+ // src/character/shading/getOutlineDepth.ts
2976
2858
  const getOutlineDepth = (viewZ, projectionYScale) => -(OUTLINE_PROJECTION_SCALE / projectionYScale) * viewZ;
2977
- //#endregion
2978
- //#region src/character/shading/getOutlineScale.ts
2859
+ // src/character/shading/getOutlineScale.ts
2979
2860
  const getOutlineScale = (depth, knotDepths, knotScales) => {
2980
2861
  const isNear = depth < knotDepths.y;
2981
2862
  const near = isNear ? knotDepths.x : knotDepths.y;
@@ -2984,19 +2865,15 @@ const getOutlineScale = (depth, knotDepths, knotScales) => {
2984
2865
  const farScale = isNear ? knotScales.y : knotScales.z;
2985
2866
  return Math.min(Math.max((depth - near) / Math.max(far - near, MINIMUM_OUTLINE_KNOT_SPAN), 0), 1) * (farScale - nearScale) + nearScale;
2986
2867
  };
2987
- //#endregion
2988
- //#region src/character/shading/getRampColumn.ts
2868
+ // src/character/shading/getRampColumn.ts
2989
2869
  const getRampColumn = (threshold, lightArea, rampWidth) => {
2990
2870
  return 1 - Math.min(Math.max((lightArea - threshold) / lightArea / rampWidth, 0), 1);
2991
2871
  };
2992
- //#endregion
2993
- //#region src/character/shading/getRampRow.ts
2872
+ // src/character/shading/getRampRow.ts
2994
2873
  const getRampRow = (region, isCoolShadow) => (isCoolShadow ? COOL_RAMP_ROW_BASE : RAMP_ROW_BASE) + RAMP_ROW_STEP * (region - 1);
2995
- //#endregion
2996
- //#region src/character/shading/getRampWidth.ts
2874
+ // src/character/shading/getRampWidth.ts
2997
2875
  const getRampWidth = ({ isVertexRampWidth, rampWidth, vertexRampWidth }) => isVertexRampWidth ? Math.max(2 * vertexRampWidth, MINIMUM_RAMP_WIDTH_VERTEX) * rampWidth : rampWidth;
2998
- //#endregion
2999
- //#region src/character/shading/getShadingRegion.ts
2876
+ // src/character/shading/getShadingRegion.ts
3000
2877
  const getShadingRegion = (alpha, toggles) => {
3001
2878
  if (alpha >= REGION_FLOORS.two && toggles.two) return 2;
3002
2879
  if (alpha >= REGION_FLOORS.five && alpha < REGION_FLOORS.two && toggles.five) return 5;
@@ -3004,8 +2881,7 @@ const getShadingRegion = (alpha, toggles) => {
3004
2881
  if (alpha >= REGION_FLOORS.four && alpha < REGION_FLOORS.three && toggles.four) return 4;
3005
2882
  return 1;
3006
2883
  };
3007
- //#endregion
3008
- //#region src/character/shading/getToonThreshold.ts
2884
+ // src/character/shading/getToonThreshold.ts
3009
2885
  const getToonThreshold = ({ isLightMapAo, isVertexAo, lightMapGreen, sunTerm, vertexAo }) => {
3010
2886
  const offset = (isLightMapAo ? lightMapGreen : NEUTRAL_LIGHT_MAP_GREEN) - NEUTRAL_LIGHT_MAP_GREEN;
3011
2887
  const remapped = 2 * offset * Math.abs(offset) + NEUTRAL_LIGHT_MAP_GREEN;
@@ -3014,17 +2890,14 @@ const getToonThreshold = ({ isLightMapAo, isVertexAo, lightMapGreen, sunTerm, ve
3014
2890
  if (occluded > .95) return 1;
3015
2891
  return (occluded + sunTerm) / 2;
3016
2892
  };
3017
- //#endregion
3018
- //#region src/clock/advanceGameClock.ts
2893
+ // src/clock/advanceGameClock.ts
3019
2894
  const advanceGameClock = (gameClock, deltaSeconds) => {
3020
2895
  gameClock.minutes = (gameClock.minutes + deltaSeconds * gameClock.minutesPerSecond) % MINUTES_PER_DAY;
3021
2896
  };
3022
- //#endregion
3023
- //#region src/collision/constants.ts
2897
+ // src/collision/constants.ts
3024
2898
  const GROUND_NORMAL_SPAN = .1;
3025
2899
  const SPHERE_CAST_STRIDE_SHARE = .5;
3026
- //#endregion
3027
- //#region src/collision/createGroundQuery.ts
2900
+ // src/collision/createGroundQuery.ts
3028
2901
  const createGroundQuery = (getHeight, waterLevel) => {
3029
2902
  const normal = new Vector3();
3030
2903
  const sample = {
@@ -3043,8 +2916,7 @@ const createGroundQuery = (getHeight, waterLevel) => {
3043
2916
  getWaterLevel: () => waterLevel
3044
2917
  };
3045
2918
  };
3046
- //#endregion
3047
- //#region src/collision/createLandmarkCollider.ts
2919
+ // src/collision/createLandmarkCollider.ts
3048
2920
  const buildLandmarkGeometry = (landmark, rootInverse) => {
3049
2921
  const meshes = [];
3050
2922
  let vertexCount = 0;
@@ -3156,8 +3028,7 @@ const createLandmarkCollider = () => {
3156
3028
  }
3157
3029
  };
3158
3030
  };
3159
- //#endregion
3160
- //#region src/culling/constants.ts
3031
+ // src/culling/constants.ts
3161
3032
  const CULLING_FRUSTUM_MARGIN = .1;
3162
3033
  const CULLING_INDIRECT_ARGUMENT_COUNT = 5;
3163
3034
  const CULLING_INDEX_COUNT_INDEX = 0;
@@ -3165,18 +3036,15 @@ const CULLING_INSTANCE_COUNT_INDEX = 1;
3165
3036
  const CULLING_MIN_SIZE = 1e-4;
3166
3037
  const CULLING_MATRIX_COLUMN_COUNT = 4;
3167
3038
  const CULLING_MATRIX_ELEMENT_COUNT = 16;
3168
- //#endregion
3169
- //#region src/culling/createFrustumVisibility.ts
3039
+ // src/culling/createFrustumVisibility.ts
3170
3040
  const createFrustumVisibility = (clipFromModel, point) => {
3171
3041
  const clip = clipFromModel.mul(vec4(point, 1));
3172
3042
  const limit = clip.w.mul(1.1);
3173
3043
  return step(0, clip.w).mul(step(clip.x.abs(), limit)).mul(step(clip.y.abs(), limit)).mul(step(0, clip.z)).mul(step(clip.z, limit));
3174
3044
  };
3175
- //#endregion
3176
- //#region src/culling/createSurvivorIndices.ts
3045
+ // src/culling/createSurvivorIndices.ts
3177
3046
  const createSurvivorIndices = (count) => Uint32Array.from({ length: count }, (_value, index) => index);
3178
- //#endregion
3179
- //#region src/culling/createInstanceCulling.ts
3047
+ // src/culling/createInstanceCulling.ts
3180
3048
  const createInstanceCulling = ({ count, indexCount, isVisible }) => {
3181
3049
  const indirectArray = /* @__PURE__ */ new Uint32Array(5);
3182
3050
  indirectArray[0] = indexCount;
@@ -3206,23 +3074,20 @@ const createInstanceCulling = ({ count, indexCount, isVisible }) => {
3206
3074
  survivor: float(storage(survivorAttribute, "uint", count).toReadOnly().element(instanceIndex))
3207
3075
  };
3208
3076
  };
3209
- //#endregion
3210
- //#region src/culling/createInstanceMatrixBuffer.ts
3077
+ // src/culling/createInstanceMatrixBuffer.ts
3211
3078
  const createInstanceMatrixBuffer = (matrices) => {
3212
3079
  const array = new Float32Array(matrices.length * 16);
3213
3080
  for (const [index, matrix] of matrices.entries()) array.set(matrix.elements, index * 16);
3214
3081
  return new StorageBufferAttribute(array, 4);
3215
3082
  };
3216
- //#endregion
3217
- //#region src/culling/createInstanceMatrixNode.ts
3083
+ // src/culling/createInstanceMatrixNode.ts
3218
3084
  const createInstanceMatrixNode = (attribute, instance) => {
3219
3085
  const columns = storage(attribute, "vec4", attribute.count).toReadOnly();
3220
3086
  const firstColumn = uint(instance).mul(uint(4));
3221
3087
  const column = (offset) => columns.element(firstColumn.add(uint(offset)));
3222
3088
  return mat4(column(0), column(1), column(2), column(3));
3223
3089
  };
3224
- //#endregion
3225
- //#region src/culling/createInstancedGeometry.ts
3090
+ // src/culling/createInstancedGeometry.ts
3226
3091
  const createInstancedGeometry = (geometry, instanceCount) => {
3227
3092
  const instancedGeometry = new InstancedBufferGeometry();
3228
3093
  for (const [name, attribute] of Object.entries(geometry.attributes)) instancedGeometry.setAttribute(name, attribute);
@@ -3230,8 +3095,7 @@ const createInstancedGeometry = (geometry, instanceCount) => {
3230
3095
  instancedGeometry.instanceCount = instanceCount;
3231
3096
  return instancedGeometry;
3232
3097
  };
3233
- //#endregion
3234
- //#region src/models/input/GamepadButton.ts
3098
+ // src/models/input/GamepadButton.ts
3235
3099
  let GamepadButton = /* @__PURE__ */ function(GamepadButton) {
3236
3100
  GamepadButton["Back"] = "GamepadBack";
3237
3101
  GamepadButton["DirectionalPadDown"] = "GamepadDirectionalPadDown";
@@ -3251,16 +3115,14 @@ let GamepadButton = /* @__PURE__ */ function(GamepadButton) {
3251
3115
  GamepadButton["Start"] = "GamepadStart";
3252
3116
  return GamepadButton;
3253
3117
  }({});
3254
- //#endregion
3255
- //#region src/models/input/MouseButton.ts
3118
+ // src/models/input/MouseButton.ts
3256
3119
  let MouseButton = /* @__PURE__ */ function(MouseButton) {
3257
3120
  MouseButton["Auxiliary"] = "MouseAuxiliary";
3258
3121
  MouseButton["Primary"] = "MousePrimary";
3259
3122
  MouseButton["Secondary"] = "MouseSecondary";
3260
3123
  return MouseButton;
3261
3124
  }({});
3262
- //#endregion
3263
- //#region src/input/InputActionBindingMap.ts
3125
+ // src/input/InputActionBindingMap.ts
3264
3126
  const InputActionBindingMap = {
3265
3127
  ["Aim"]: [["KeyR"], ["GamepadLeftTrigger"]],
3266
3128
  ["Cancel"]: [["GamepadFaceBottom"]],
@@ -3306,8 +3168,7 @@ const InputActionBindingMap = {
3306
3168
  ["SwitchToPartyMemberAndBurst4"]: [["AltLeft", "Digit4"]],
3307
3169
  ["SwitchWalkRun"]: [["ControlLeft"]]
3308
3170
  };
3309
- //#endregion
3310
- //#region src/input/constants.ts
3171
+ // src/input/constants.ts
3311
3172
  const KEY_CODE_FORWARD = "KeyW";
3312
3173
  const KEY_CODE_BACKWARD = "KeyS";
3313
3174
  const KEY_CODE_LEFT = "KeyA";
@@ -3347,8 +3208,7 @@ const MOUSE_LOOK_RADIANS_PER_PIXEL = .002;
3347
3208
  const MOUSE_LOOK_MAX_PIXELS_PER_EVENT = Math.PI / MOUSE_LOOK_RADIANS_PER_PIXEL;
3348
3209
  const GAMEPAD_LOOK_RADIANS_PER_SECOND = 2.5;
3349
3210
  const GAMEPAD_STICK_DEADZONE = .15;
3350
- //#endregion
3351
- //#region src/input/createInput.ts
3211
+ // src/input/createInput.ts
3352
3212
  const toAxis = (positive, negative) => Number(positive) - Number(negative);
3353
3213
  const toDeadzoned = (stickAxis) => Math.abs(stickAxis) < .15 ? 0 : stickAxis;
3354
3214
  const createInput = (target) => {
@@ -3462,28 +3322,24 @@ const createInput = (target) => {
3462
3322
  }
3463
3323
  };
3464
3324
  };
3465
- //#endregion
3466
- //#region src/kits/mergeGeometryParts.ts
3325
+ // src/kits/mergeGeometryParts.ts
3467
3326
  const mergeGeometryParts = (parts) => {
3468
3327
  const geometry = mergeGeometries(parts) ?? new BufferGeometry();
3469
3328
  for (const part of parts) part.dispose();
3470
3329
  return geometry;
3471
3330
  };
3472
- //#endregion
3473
- //#region src/kits/architecture/createBoxesGeometry.ts
3331
+ // src/kits/architecture/createBoxesGeometry.ts
3474
3332
  const createBoxesGeometry = (boxes) => {
3475
3333
  const parts = boxes.map(([minX = 0, minY = 0, minZ = 0, maxX = 0, maxY = 0, maxZ = 0]) => new BoxGeometry(maxX - minX, maxY - minY, maxZ - minZ).translate((minX + maxX) / 2, (minY + maxY) / 2, (minZ + maxZ) / 2));
3476
3334
  return mergeGeometryParts(parts);
3477
3335
  };
3478
- //#endregion
3479
- //#region src/models/kits/architecture/RoofKind.ts
3336
+ // src/models/kits/architecture/RoofKind.ts
3480
3337
  let RoofKind = /* @__PURE__ */ function(RoofKind) {
3481
3338
  RoofKind["Conical"] = "Conical";
3482
3339
  RoofKind["Flat"] = "Flat";
3483
3340
  return RoofKind;
3484
3341
  }({});
3485
- //#endregion
3486
- //#region src/kits/architecture/createBuildingGeometry.ts
3342
+ // src/kits/architecture/createBuildingGeometry.ts
3487
3343
  const CONICAL_ROOF_SEGMENTS = 16;
3488
3344
  const createBuildingGeometry = ({ depth, platformHeight, roofHeight, roofKind, wallHeight, wallThickness, width }) => {
3489
3345
  const halfDepth = depth / 2;
@@ -3546,8 +3402,7 @@ const createBuildingGeometry = ({ depth, platformHeight, roofHeight, roofKind, w
3546
3402
  const roofGeometry = new CylinderGeometry(0, 1, roofHeight, CONICAL_ROOF_SEGMENTS).scale(halfWidth, 1, halfDepth).translate(0, wallTop + roofHeight / 2, 0);
3547
3403
  return mergeGeometryParts([buildingGeometry, roofGeometry]);
3548
3404
  };
3549
- //#endregion
3550
- //#region src/kits/architecture/createLatheStackGeometry.ts
3405
+ // src/kits/architecture/createLatheStackGeometry.ts
3551
3406
  const createLatheStackGeometry = ({ isFaceted, radialSegments, sections }) => {
3552
3407
  let footHeight = 0;
3553
3408
  const parts = sections.map(({ bottomRadius, height, topRadius }) => {
@@ -3559,8 +3414,7 @@ const createLatheStackGeometry = ({ isFaceted, radialSegments, sections }) => {
3559
3414
  if (isFaceted) stackGeometry.computeVertexNormals();
3560
3415
  return stackGeometry;
3561
3416
  };
3562
- //#endregion
3563
- //#region src/kits/architecture/createPavingStoneGeometry.ts
3417
+ // src/kits/architecture/createPavingStoneGeometry.ts
3564
3418
  const createPavingStoneGeometry = ({ bottom, radii, top }) => {
3565
3419
  const sideCount = radii.length;
3566
3420
  const getCorner = (side, height) => {
@@ -3598,11 +3452,9 @@ const createPavingStoneGeometry = ({ bottom, radii, top }) => {
3598
3452
  geometry.computeVertexNormals();
3599
3453
  return geometry;
3600
3454
  };
3601
- //#endregion
3602
- //#region src/kits/architecture/createPavingGeometry.ts
3455
+ // src/kits/architecture/createPavingGeometry.ts
3603
3456
  const createPavingGeometry = (stones) => mergeGeometryParts(stones.map(({ position, quaternion, scale, shape }) => createPavingStoneGeometry(shape).applyMatrix4(new Matrix4().compose(new Vector3().fromArray(position), new Quaternion().fromArray(quaternion), new Vector3().fromArray(scale)))));
3604
- //#endregion
3605
- //#region src/kits/statue/computeStatueSurface.ts
3457
+ // src/kits/statue/computeStatueSurface.ts
3606
3458
  const FULL_TURN$1 = Math.PI * 2;
3607
3459
  const sectionColor = new Color();
3608
3460
  const writeRingVertex = ({ colors, positions }, vertex, { centre: [x = 0, z = 0], colors: ringColors, height, radii }, sector, angleCount) => {
@@ -3709,8 +3561,7 @@ const computeStatueSurface = (sections) => {
3709
3561
  indices
3710
3562
  };
3711
3563
  };
3712
- //#endregion
3713
- //#region src/kits/statue/createStatueGeometries.ts
3564
+ // src/kits/statue/createStatueGeometries.ts
3714
3565
  const createStackGeometry = ({ position: [x = 0, y = 0, z = 0], rotation: [rotationX = 0, rotationY = 0, rotationZ = 0, rotationW = 1], sections }) => {
3715
3566
  const { colors, indices, positions } = computeStatueSurface(sections);
3716
3567
  const geometry = new BufferGeometry();
@@ -3721,8 +3572,7 @@ const createStackGeometry = ({ position: [x = 0, y = 0, z = 0], rotation: [rotat
3721
3572
  return geometry.applyQuaternion(new Quaternion(rotationX, rotationY, rotationZ, rotationW).normalize()).translate(x, y, z);
3722
3573
  };
3723
3574
  const createStatueGeometries = (parts) => Object.fromEntries(Object.entries(Object.groupBy(parts, ({ part }) => part)).map(([part, stacks]) => [part, mergeGeometryParts((stacks ?? []).map((stack) => createStackGeometry(stack)))]));
3724
- //#endregion
3725
- //#region src/kits/tree/sampleTreeNormalField.ts
3575
+ // src/kits/tree/sampleTreeNormalField.ts
3726
3576
  const sampleTreeNormalField = ({ cellSize, normals, origin, size }, position) => {
3727
3577
  const [sizeX = 1, sizeY = 1, sizeZ = 1] = size;
3728
3578
  const cellCoordinate = (axis, cellCount) => {
@@ -3758,8 +3608,7 @@ const sampleTreeNormalField = ({ cellSize, normals, origin, size }, position) =>
3758
3608
  sum[2] / length
3759
3609
  ];
3760
3610
  };
3761
- //#endregion
3762
- //#region src/nodes/constants.ts
3611
+ // src/nodes/constants.ts
3763
3612
  const LEAST_DIVISOR = 1e-4;
3764
3613
  const STONE_SHADOW_EXPONENT = .2;
3765
3614
  const STONE_RAMP_KNOT_COUNT = 16;
@@ -3824,8 +3673,7 @@ const OBJECT_SURFACE_KEY = "surface";
3824
3673
  const OBJECT_FADE_KEY = "fade";
3825
3674
  const LEAF_SHAPE_WIDTH = .8;
3826
3675
  const LEAF_SHAPE_KEPT_SHARE = LEAF_SHAPE_WIDTH * 2 / 3;
3827
- //#endregion
3828
- //#region src/kits/tree/computeLeafCards.ts
3676
+ // src/kits/tree/computeLeafCards.ts
3829
3677
  const VERTICES_PER_CARD = 4;
3830
3678
  const INDICES_PER_CARD = 6;
3831
3679
  const CORNER_SIGNS = [
@@ -3898,8 +3746,7 @@ const computeLeafCards = (clusters, { cardSize, leafAreaScale, normalField, seed
3898
3746
  uvs
3899
3747
  };
3900
3748
  };
3901
- //#endregion
3902
- //#region src/kits/tree/computeTreeTubes.ts
3749
+ // src/kits/tree/computeTreeTubes.ts
3903
3750
  const MIN_TUBE_SIDES = 6;
3904
3751
  const TUBE_SIDE_LENGTH = 1;
3905
3752
  const TUBE_SECTION_LENGTH = .5;
@@ -4050,14 +3897,12 @@ const computeTreeTubes = (tubes) => {
4050
3897
  uvs
4051
3898
  };
4052
3899
  };
4053
- //#endregion
4054
- //#region src/kits/tree/createTreeGeometry.ts
3900
+ // src/kits/tree/createTreeGeometry.ts
4055
3901
  const createTreeGeometry = ({ limbs, roots, ...treeOptions }) => ({
4056
3902
  branchGeometry: createIndexedGeometry(computeTreeTubes([...limbs, ...roots])),
4057
3903
  leafGeometry: createIndexedGeometry(computeLeafCards(treeOptions.clusters, treeOptions))
4058
3904
  });
4059
- //#endregion
4060
- //#region src/locomotion/constants.ts
3905
+ // src/locomotion/constants.ts
4061
3906
  const STAMINA_MAX = 100;
4062
3907
  const STAMINA_REFILL_PER_SECOND = 25;
4063
3908
  const STAMINA_REFILL_DELAY_SECONDS = 1.5;
@@ -4100,8 +3945,7 @@ const WALL_PRESS_SPEED = 1;
4100
3945
  const WALL_PROBE_DISTANCE = .1;
4101
3946
  const STEEP_SLIDE_SPEED = 4;
4102
3947
  const CLIMB_REGRAB_SECONDS = .5;
4103
- //#endregion
4104
- //#region src/locomotion/computeLocomotionState.ts
3948
+ // src/locomotion/computeLocomotionState.ts
4105
3949
  const checkIsMoving = ({ moveForward, moveRight }) => moveForward !== 0 || moveRight !== 0;
4106
3950
  const checkIsClimbable = (contact, stamina) => contact.isFacingWall && stamina >= 5;
4107
3951
  const getFootState = (input) => {
@@ -4161,8 +4005,7 @@ const computeLocomotionState = (phase, input, contact, stamina, locomotion) => {
4161
4005
  else if (state === "Drown") return stateSeconds < locomotion.drownSeconds ? "Drown" : "Idle";
4162
4006
  else return getNextWaterState(phase, input, contact, stamina);
4163
4007
  };
4164
- //#endregion
4165
- //#region src/locomotion/createStamina.ts
4008
+ // src/locomotion/createStamina.ts
4166
4009
  const computeSpend = ({ state, stateSeconds }, isEntered, isMoving, stepSeconds) => {
4167
4010
  if (state === "Climb") return isMoving ? 2 * stepSeconds : 0;
4168
4011
  else if (state === "ClimbJump") return isEntered ? 25 : 0;
@@ -4201,8 +4044,7 @@ const createStamina = (maximum, getStaminaConsumptionMultiplier = () => 1) => {
4201
4044
  };
4202
4045
  return stamina;
4203
4046
  };
4204
- //#endregion
4205
- //#region src/locomotion/createCharacterController.ts
4047
+ // src/locomotion/createCharacterController.ts
4206
4048
  const getSpeed = (state, locomotion) => {
4207
4049
  if (state === "Walk") return locomotion.walkSpeed;
4208
4050
  else if (["Dash", "Sprint"].includes(state)) return locomotion.sprintSpeed;
@@ -4412,8 +4254,7 @@ const createCharacterController = (options) => {
4412
4254
  }
4413
4255
  };
4414
4256
  };
4415
- //#endregion
4416
- //#region src/models/character/PmxJointKind.ts
4257
+ // src/models/character/PmxJointKind.ts
4417
4258
  let PmxJointKind = /* @__PURE__ */ function(PmxJointKind) {
4418
4259
  PmxJointKind[PmxJointKind["SpringSixDegreesOfFreedom"] = 0] = "SpringSixDegreesOfFreedom";
4419
4260
  PmxJointKind[PmxJointKind["SixDegreesOfFreedom"] = 1] = "SixDegreesOfFreedom";
@@ -4423,24 +4264,21 @@ let PmxJointKind = /* @__PURE__ */ function(PmxJointKind) {
4423
4264
  PmxJointKind[PmxJointKind["Hinge"] = 5] = "Hinge";
4424
4265
  return PmxJointKind;
4425
4266
  }({});
4426
- //#endregion
4427
- //#region src/models/character/PmxPhysicsMode.ts
4267
+ // src/models/character/PmxPhysicsMode.ts
4428
4268
  let PmxPhysicsMode = /* @__PURE__ */ function(PmxPhysicsMode) {
4429
4269
  PmxPhysicsMode[PmxPhysicsMode["FollowBone"] = 0] = "FollowBone";
4430
4270
  PmxPhysicsMode[PmxPhysicsMode["Physics"] = 1] = "Physics";
4431
4271
  PmxPhysicsMode[PmxPhysicsMode["PhysicsWithBone"] = 2] = "PhysicsWithBone";
4432
4272
  return PmxPhysicsMode;
4433
4273
  }({});
4434
- //#endregion
4435
- //#region src/models/character/PmxRigidBodyShape.ts
4274
+ // src/models/character/PmxRigidBodyShape.ts
4436
4275
  let PmxRigidBodyShape = /* @__PURE__ */ function(PmxRigidBodyShape) {
4437
4276
  PmxRigidBodyShape[PmxRigidBodyShape["Sphere"] = 0] = "Sphere";
4438
4277
  PmxRigidBodyShape[PmxRigidBodyShape["Box"] = 1] = "Box";
4439
4278
  PmxRigidBodyShape[PmxRigidBodyShape["Capsule"] = 2] = "Capsule";
4440
4279
  return PmxRigidBodyShape;
4441
4280
  }({});
4442
- //#endregion
4443
- //#region src/models/nodes/ObjectSurface.ts
4281
+ // src/models/nodes/ObjectSurface.ts
4444
4282
  var ObjectSurface = class {
4445
4283
  amplitudes;
4446
4284
  color;
@@ -4451,8 +4289,7 @@ var ObjectSurface = class {
4451
4289
  this.texelsPerMetre = texelsPerMetre;
4452
4290
  }
4453
4291
  };
4454
- //#endregion
4455
- //#region src/models/nodes/createOutlineMaterial.ts
4292
+ // src/models/nodes/createOutlineMaterial.ts
4456
4293
  const createOutlineMaterial = (colorNode, thicknessNode, instanceMatrix) => {
4457
4294
  const material = Object.assign(new NodeMaterial(), { isMeshToonOutlineMaterial: true });
4458
4295
  material.name = "Toon_Outline";
@@ -4481,8 +4318,7 @@ const createGameOutlineMaterial = (colorNode, widthNode, offsetNode) => {
4481
4318
  material.colorNode = colorNode;
4482
4319
  return material;
4483
4320
  };
4484
- //#endregion
4485
- //#region src/models/nodes/SharedToonOutlinePassNode.ts
4321
+ // src/models/nodes/SharedToonOutlinePassNode.ts
4486
4322
  var SharedToonOutlinePassNode = class extends ToonOutlinePassNode {
4487
4323
  #drawn;
4488
4324
  #edgeOutlineMaterials = /* @__PURE__ */ new Map();
@@ -4543,11 +4379,9 @@ var SharedToonOutlinePassNode = class extends ToonOutlinePassNode {
4543
4379
  return this.#outlineMaterial;
4544
4380
  }
4545
4381
  };
4546
- //#endregion
4547
- //#region src/nodes/createSunVisibilityNode.ts
4382
+ // src/nodes/createSunVisibilityNode.ts
4548
4383
  const createSunVisibilityNode = (lightColor, sunRadiance) => luminance(lightColor).div(luminance(sunRadiance).max(LEAST_DIVISOR)).saturate();
4549
- //#endregion
4550
- //#region src/models/nodes/StoneLightingModel.ts
4384
+ // src/models/nodes/StoneLightingModel.ts
4551
4385
  var StoneLightingModel = class extends LightingModel {
4552
4386
  stoneLight;
4553
4387
  constructor(stoneLight) {
@@ -4571,8 +4405,7 @@ var StoneLightingModel = class extends LightingModel {
4571
4405
  reflectedLight.indirectDiffuse.addAssign(ambient.mul(diffuseColor.rgb).mul(this.createDarkeningNode()));
4572
4406
  }
4573
4407
  };
4574
- //#endregion
4575
- //#region src/models/nodes/StoneNodeMaterial.ts
4408
+ // src/models/nodes/StoneNodeMaterial.ts
4576
4409
  var StoneNodeMaterial = class extends NodeMaterial {
4577
4410
  emissiveNode = null;
4578
4411
  stoneLight;
@@ -4589,29 +4422,25 @@ var StoneNodeMaterial = class extends NodeMaterial {
4589
4422
  return new StoneLightingModel(this.stoneLight);
4590
4423
  }
4591
4424
  };
4592
- //#endregion
4593
- //#region src/models/nodes/getGameOutlineOffset.ts
4425
+ // src/models/nodes/getGameOutlineOffset.ts
4594
4426
  const getGameOutlineOffset = (viewPosition, blue, blockBChannel, size) => {
4595
4427
  const scale = blockBChannel < .5 ? blue - .5 : 1;
4596
4428
  return viewPosition.clone().normalize().multiplyScalar(size * scale);
4597
4429
  };
4598
- //#endregion
4599
- //#region src/models/renderer/AntialiasingMode.ts
4430
+ // src/models/renderer/AntialiasingMode.ts
4600
4431
  let AntialiasingMode = /* @__PURE__ */ function(AntialiasingMode) {
4601
4432
  AntialiasingMode["Smaa"] = "Smaa";
4602
4433
  AntialiasingMode["Traa"] = "Traa";
4603
4434
  return AntialiasingMode;
4604
4435
  }({});
4605
- //#endregion
4606
- //#region src/models/renderer/QualityTier.ts
4436
+ // src/models/renderer/QualityTier.ts
4607
4437
  let QualityTier = /* @__PURE__ */ function(QualityTier) {
4608
4438
  QualityTier["High"] = "High";
4609
4439
  QualityTier["Low"] = "Low";
4610
4440
  QualityTier["Medium"] = "Medium";
4611
4441
  return QualityTier;
4612
4442
  }({});
4613
- //#endregion
4614
- //#region src/nodes/applyStoneLight.ts
4443
+ // src/nodes/applyStoneLight.ts
4615
4444
  const applyStoneLight = ({ harmonics, hazeColor, hazeScatterColor, heightDarkening, heightFade, ramp }, { harmonics: harmonicsUniform, hazeColor: hazeColorUniform, hazeScatterColor: hazeScatterColorUniform, heightDarkening: heightDarkeningUniform, heightFade: heightFadeUniform, ramp: rampTexture, sunRadiance }, light) => {
4616
4445
  const { data } = rampTexture.image;
4617
4446
  if (data) for (const [knot, [red = 0, green = 0, blue = 0]] of ramp.entries()) {
@@ -4631,11 +4460,9 @@ const applyStoneLight = ({ harmonics, hazeColor, hazeScatterColor, heightDarkeni
4631
4460
  hazeScatterColorUniform.value.fromArray(hazeScatterColor);
4632
4461
  sunRadiance.value.copy(light.color).multiplyScalar(light.intensity);
4633
4462
  };
4634
- //#endregion
4635
- //#region src/nodes/computeStoneDarkening.ts
4463
+ // src/nodes/computeStoneDarkening.ts
4636
4464
  const computeStoneDarkening = (height, heightDarkening) => Math.exp(-heightDarkening * Math.min(Math.max(height, 0), 20));
4637
- //#endregion
4638
- //#region src/nodes/computeStoneHarmonics.ts
4465
+ // src/nodes/computeStoneHarmonics.ts
4639
4466
  const computeStoneHarmonics = ([x = 0, y = 0, z = 0], harmonics) => {
4640
4467
  harmonics[0] = 1;
4641
4468
  harmonics[1] = x;
@@ -4647,11 +4474,9 @@ const computeStoneHarmonics = ([x = 0, y = 0, z = 0], harmonics) => {
4647
4474
  harmonics[7] = x * x - z * z;
4648
4475
  harmonics[8] = 3 * y * y - 1;
4649
4476
  };
4650
- //#endregion
4651
- //#region src/nodes/computeStoneRampCoordinate.ts
4477
+ // src/nodes/computeStoneRampCoordinate.ts
4652
4478
  const computeStoneRampCoordinate = (facing, visibility) => .5 + .5 * facing * Math.max(visibility, 0) ** STONE_SHADOW_EXPONENT;
4653
- //#endregion
4654
- //#region src/nodes/computeSurfaceOctaves.ts
4479
+ // src/nodes/computeSurfaceOctaves.ts
4655
4480
  const SOLVE_ITERATIONS = 300;
4656
4481
  const SOLVE_START_ENERGY = 1e-6;
4657
4482
  const computeResponses = (targets) => SURFACE_OCTAVE_RESPONSES.map((responses) => responses.map((response, row) => targets[row] ? response / targets[row] : 0));
@@ -4675,14 +4500,12 @@ const computeSurfaceOctaves = ({ bands, metresPerTexel, variance }) => {
4675
4500
  frequency: texelFrequency / metresPerTexel
4676
4501
  }));
4677
4502
  };
4678
- //#endregion
4679
- //#region src/nodes/computeWindGust.ts
4503
+ // src/nodes/computeWindGust.ts
4680
4504
  const computeWindGust = (downwind, time, { gustSpeed, gustStrength, gustWidth }) => {
4681
4505
  const gustPhase = (downwind - time * gustSpeed) / gustWidth * Math.PI * 2;
4682
4506
  return MathUtils.smoothstep(Math.sin(gustPhase) * .5 + .5, .2, 1) * gustStrength;
4683
4507
  };
4684
- //#endregion
4685
- //#region src/nodes/createCausticsNode.ts
4508
+ // src/nodes/createCausticsNode.ts
4686
4509
  const CAUSTIC_SCALE = .35;
4687
4510
  const CAUSTIC_SPEED = .6;
4688
4511
  const createCausticsNode = ({ lightColor }, { causticStrength, deepDepth, level }) => {
@@ -4694,8 +4517,7 @@ const createCausticsNode = ({ lightColor }, { causticStrength, deepDepth, level
4694
4517
  const fade = smoothstep(0, .3, depthBelow).mul(float(1).sub(smoothstep(0, deepDepth, depthBelow)));
4695
4518
  return lightColor.mul(veins.mul(fade).mul(causticStrength));
4696
4519
  };
4697
- //#endregion
4698
- //#region src/nodes/createCloudLayerNode.ts
4520
+ // src/nodes/createCloudLayerNode.ts
4699
4521
  const PROFILE_SAMPLE_COUNT = 64;
4700
4522
  const DENSITY_FIRST_SCALE = 1.2;
4701
4523
  const DENSITY_SECOND_SCALE = .9;
@@ -4777,28 +4599,23 @@ const createCloudLayerNode = ({ center, curl, curlAmplitude, curlSpeed, curlTili
4777
4599
  const color = shaded.sub(wispsColor).mul(alpha).add(wispsColor).mul(sunSide.mul(cloudSunBrighten).add(1));
4778
4600
  return vec4(color, alpha);
4779
4601
  })();
4780
- //#endregion
4781
- //#region src/nodes/createDitherFadeNode.ts
4602
+ // src/nodes/createDitherFadeNode.ts
4782
4603
  const createDitherFadeNode = (visibility) => interleavedGradientNoise(screenCoordinate.xy).lessThan(visibility);
4783
- //#endregion
4784
- //#region src/nodes/createSurfaceDetailNode.ts
4604
+ // src/nodes/createSurfaceDetailNode.ts
4785
4605
  const createSurfaceDetailNode = (amplitudes, texelsPerMetre) => {
4786
4606
  const texelPosition = vec3(positionWorld.mul(texelsPerMetre));
4787
4607
  return SURFACE_OCTAVE_TEXEL_FREQUENCIES.reduce((node, texelFrequency, octave) => node.add(mx_noise_float(texelPosition.mul(texelFrequency)).mul(amplitudes[octave] ?? float(0))), float(1));
4788
4608
  };
4789
- //#endregion
4790
- //#region src/nodes/createMaterialDetailNode.ts
4609
+ // src/nodes/createMaterialDetailNode.ts
4791
4610
  const createMaterialDetailNode = (detail) => createSurfaceDetailNode(computeSurfaceOctaves(detail).map(({ amplitude }) => uniform(amplitude)), uniform(1 / detail.metresPerTexel));
4792
- //#endregion
4793
- //#region src/nodes/createObjectSurfaceNode.ts
4611
+ // src/nodes/createObjectSurfaceNode.ts
4794
4612
  const DEFAULT_SURFACE = new ObjectSurface(new Color(16777215), [], 0);
4795
4613
  const readObjectSurface = (object) => {
4796
4614
  const surface = object?.userData[OBJECT_SURFACE_KEY];
4797
4615
  return surface instanceof ObjectSurface ? surface : DEFAULT_SURFACE;
4798
4616
  };
4799
4617
  const createObjectSurfaceNode = () => vertexColor().rgb.mul(uniform(new Color()).onObjectUpdate(({ object }) => readObjectSurface(object).color)).mul(createSurfaceDetailNode(SURFACE_OCTAVE_TEXEL_FREQUENCIES.map((_frequency, octave) => uniform(0).onObjectUpdate(({ object }) => readObjectSurface(object).amplitudes[octave] ?? 0)), uniform(0).onObjectUpdate(({ object }) => readObjectSurface(object).texelsPerMetre)));
4800
- //#endregion
4801
- //#region src/nodes/createRimNode.ts
4618
+ // src/nodes/createRimNode.ts
4802
4619
  const RIM_POWER = 4;
4803
4620
  const createRimNode = ({ rimColor, rimStrength, sunDirection }) => {
4804
4621
  const sunDirectionView = cameraViewMatrix.mul(vec4(sunDirection, 0)).xyz.normalize();
@@ -4806,11 +4623,9 @@ const createRimNode = ({ rimColor, rimStrength, sunDirection }) => {
4806
4623
  const litMask = normalView.dot(sunDirectionView).saturate();
4807
4624
  return rimColor.mul(fresnel.mul(litMask).mul(rimStrength));
4808
4625
  };
4809
- //#endregion
4810
- //#region src/nodes/createWetDarkeningNode.ts
4626
+ // src/nodes/createWetDarkeningNode.ts
4811
4627
  const createWetDarkeningNode = ({ wetness }) => float(1).sub(wetness.mul(WET_DARKENING));
4812
- //#endregion
4813
- //#region src/nodes/createWetSheenNode.ts
4628
+ // src/nodes/createWetSheenNode.ts
4814
4629
  const createWetSheenNode = ({ lightColor, sunDirection, wetness }) => {
4815
4630
  const sunDirectionView = cameraViewMatrix.mul(vec4(sunDirection, 0)).xyz.normalize();
4816
4631
  const halfway = sunDirectionView.add(positionViewDirection).normalize();
@@ -4818,8 +4633,7 @@ const createWetSheenNode = ({ lightColor, sunDirection, wetness }) => {
4818
4633
  const glint = normalView.dot(halfway).saturate().pow(32);
4819
4634
  return lightColor.mul(glint.mul(litMask).mul(wetness).mul(WET_SHEEN_STRENGTH));
4820
4635
  };
4821
- //#endregion
4822
- //#region src/nodes/createToonMaterial.ts
4636
+ // src/nodes/createToonMaterial.ts
4823
4637
  const createMaterialSurfaceNode = (color, detail) => {
4824
4638
  const colorUniform = uniform(new Color(color ?? 16777215));
4825
4639
  if (detail === void 0) return colorUniform;
@@ -4840,8 +4654,7 @@ const createToonMaterial = ({ color, detail, instanceMatrix, isObjectSurface = f
4840
4654
  }
4841
4655
  return toonMaterial;
4842
4656
  };
4843
- //#endregion
4844
- //#region src/nodes/createImpostorMaterial.ts
4657
+ // src/nodes/createImpostorMaterial.ts
4845
4658
  const IMPOSTOR_ALPHA_TEST = .5;
4846
4659
  const createImpostorMaterial = ({ fade, impostor, instanceMatrix, lightUniforms, rampTexture }) => {
4847
4660
  const impostorMaterial = createToonMaterial({
@@ -4864,15 +4677,13 @@ const createImpostorMaterial = ({ fade, impostor, instanceMatrix, lightUniforms,
4864
4677
  impostorMaterial.side = DoubleSide;
4865
4678
  return impostorMaterial;
4866
4679
  };
4867
- //#endregion
4868
- //#region src/nodes/createLeafShapeNode.ts
4680
+ // src/nodes/createLeafShapeNode.ts
4869
4681
  const createLeafShapeNode = () => {
4870
4682
  const centered = uv().sub(.5).mul(2);
4871
4683
  const width = float(1).sub(centered.y.abs().pow(2)).mul(LEAF_SHAPE_WIDTH);
4872
4684
  return centered.x.abs().lessThanEqual(width);
4873
4685
  };
4874
- //#endregion
4875
- //#region src/nodes/createWindNode.ts
4686
+ // src/nodes/createWindNode.ts
4876
4687
  const TURBULENCE_SCALE = .07;
4877
4688
  const TURBULENCE_SPEED = .4;
4878
4689
  const createWindNode = ({ direction, gustSpeed, gustStrength, gustWidth, strength }, groundPosition) => {
@@ -4881,8 +4692,7 @@ const createWindNode = ({ direction, gustSpeed, gustStrength, gustWidth, strengt
4881
4692
  const turbulence = mx_noise_float(vec3(groundPosition.mul(TURBULENCE_SCALE), time.mul(TURBULENCE_SPEED))).mul(.35);
4882
4693
  return direction.mul(strength.add(gust).mul(turbulence.add(1)));
4883
4694
  };
4884
- //#endregion
4885
- //#region src/nodes/createLeafMaterial.ts
4695
+ // src/nodes/createLeafMaterial.ts
4886
4696
  const SWAY_PER_WIND = .03;
4887
4697
  const FLUTTER = .06;
4888
4698
  const createLeafMaterial = (toonMaterialOptions, windUniforms, maskNode) => {
@@ -4903,8 +4713,7 @@ const createLeafMaterial = (toonMaterialOptions, windUniforms, maskNode) => {
4903
4713
  }
4904
4714
  return leafMaterial;
4905
4715
  };
4906
- //#endregion
4907
- //#region src/nodes/createLightUniforms.ts
4716
+ // src/nodes/createLightUniforms.ts
4908
4717
  const createLightUniforms = () => ({
4909
4718
  lightColor: uniform(new Color()),
4910
4719
  rimColor: uniform(new Color()),
@@ -4912,8 +4721,7 @@ const createLightUniforms = () => ({
4912
4721
  sunDirection: uniform(new Vector3(0, 1, 0)),
4913
4722
  wetness: uniform(0)
4914
4723
  });
4915
- //#endregion
4916
- //#region src/nodes/createLightningBoltMaterial.ts
4724
+ // src/nodes/createLightningBoltMaterial.ts
4917
4725
  const createLightningBoltMaterial = (flash) => {
4918
4726
  const lightningBoltMaterial = new MeshBasicNodeMaterial({
4919
4727
  blending: AdditiveBlending,
@@ -4928,14 +4736,12 @@ const createLightningBoltMaterial = (flash) => {
4928
4736
  lightningBoltMaterial.opacityNode = flash;
4929
4737
  return lightningBoltMaterial;
4930
4738
  };
4931
- //#endregion
4932
- //#region src/nodes/createObjectFadeNode.ts
4739
+ // src/nodes/createObjectFadeNode.ts
4933
4740
  const createObjectFadeNode = () => uniform(0).onObjectUpdate(({ object }) => {
4934
4741
  const fade = object?.userData[OBJECT_FADE_KEY];
4935
4742
  return typeof fade === "number" ? fade : 0;
4936
4743
  });
4937
- //#endregion
4938
- //#region src/nodes/createPrecipitationMaterial.ts
4744
+ // src/nodes/createPrecipitationMaterial.ts
4939
4745
  const TAU = Math.PI * 2;
4940
4746
  const VOLUME_SPAN = vec3(60, 30, 60);
4941
4747
  const createPrecipitationMaterial = ({ lightUniforms, precipitationUniforms, windUniforms }) => {
@@ -4962,8 +4768,7 @@ const createPrecipitationMaterial = ({ lightUniforms, precipitationUniforms, win
4962
4768
  precipitationMaterial.positionNode = center.add(streak);
4963
4769
  return precipitationMaterial;
4964
4770
  };
4965
- //#endregion
4966
- //#region src/nodes/createWaterMaterial.ts
4771
+ // src/nodes/createWaterMaterial.ts
4967
4772
  const RIPPLE_SCALE = .08;
4968
4773
  const RIPPLE_SPEED = .05;
4969
4774
  const REFRACTION_STRENGTH = .015;
@@ -5005,21 +4810,17 @@ const createWaterMaterial = ({ lightColor, sunDirection }, { horizonColor, zenit
5005
4810
  waterMaterial.colorNode = mix(reflected, foamColor, foam).add(glints);
5006
4811
  return waterMaterial;
5007
4812
  };
5008
- //#endregion
5009
- //#region src/water/constants.ts
4813
+ // src/water/constants.ts
5010
4814
  const RIVER_BEND_FOAM_ATTRIBUTE = "bendFoam";
5011
4815
  const BEND_FOAM_FULL_RADIUS_WIDTHS = 2;
5012
- //#endregion
5013
- //#region src/water/createWaterFlowUniforms.ts
4816
+ // src/water/createWaterFlowUniforms.ts
5014
4817
  const createWaterFlowUniforms = () => ({
5015
4818
  direction: uniform(new Vector2()),
5016
4819
  speed: uniform(0)
5017
4820
  });
5018
- //#endregion
5019
- //#region src/nodes/createRiverMaterial.ts
4821
+ // src/nodes/createRiverMaterial.ts
5020
4822
  const createRiverMaterial = (lightUniforms, skyUniforms, waterUniforms) => createWaterMaterial(lightUniforms, skyUniforms, waterUniforms, createWaterFlowUniforms(), attribute(RIVER_BEND_FOAM_ATTRIBUTE, "float"));
5021
- //#endregion
5022
- //#region src/nodes/createSkyColorNode.ts
4823
+ // src/nodes/createSkyColorNode.ts
5023
4824
  const HALO_TOWARD_START = .3;
5024
4825
  const HALO_TOWARD_SPAN = .7;
5025
4826
  const HALO_SUN_HEIGHT_START = .2;
@@ -5045,8 +4846,7 @@ const createSkyColorNode = ({ frontBackBlend, haloColor, haloHeight, horizonBack
5045
4846
  const sunHalo = min(pow(sunSide, spread), 1).add(min(pow(sunSide, spread.mul(SUN_HALO_MIDDLE_SPREAD)), 1).mul(SUN_HALO_MIDDLE_WEIGHT)).add(min(pow(sunSide, spread.mul(SUN_HALO_OUTER_SPREAD)), 1).mul(SUN_HALO_OUTER_WEIGHT)).mul(smoothstep(0, 1, max(sunSide.sub(.5).mul(2), 0)));
5046
4847
  return mix(top, bottom, bottomShare).add(halo).add(sunHaloColor.mul(sunHalo));
5047
4848
  };
5048
- //#endregion
5049
- //#region src/nodes/createSkyNode.ts
4849
+ // src/nodes/createSkyNode.ts
5050
4850
  const SUN_DISC_COSINE = Math.cos(.035);
5051
4851
  const MOON_DISC_COSINE = Math.cos(.05);
5052
4852
  const SUN_DISC_BRIGHTNESS = 6;
@@ -5085,8 +4885,7 @@ const createSkyNode = (uniforms, gradient, cloudLayer) => {
5085
4885
  return mix(sky, cloudColor, cloudDensity);
5086
4886
  })();
5087
4887
  };
5088
- //#endregion
5089
- //#region src/nodes/sampleGroundCapture.ts
4888
+ // src/nodes/sampleGroundCapture.ts
5090
4889
  const sampleGroundCapture = (groundCapture, ground) => {
5091
4890
  const captureUV = vec2(ground.x.sub(groundCapture.center.x).div(groundCapture.size).add(.5), float(.5).sub(ground.y.sub(groundCapture.center.y).div(groundCapture.size)));
5092
4891
  return {
@@ -5094,8 +4893,7 @@ const sampleGroundCapture = (groundCapture, ground) => {
5094
4893
  isInsideCapture: step(0, captureUV.x).mul(step(captureUV.x, 1)).mul(step(0, captureUV.y)).mul(step(captureUV.y, 1))
5095
4894
  };
5096
4895
  };
5097
- //#endregion
5098
- //#region src/nodes/createSplashMaterial.ts
4896
+ // src/nodes/createSplashMaterial.ts
5099
4897
  const createSplashMaterial = ({ groundCapture, lightUniforms, precipitationUniforms, waterUniforms }) => {
5100
4898
  const { eye, splashDensity } = precipitationUniforms;
5101
4899
  const index = float(instanceIndex);
@@ -5120,15 +4918,13 @@ const createSplashMaterial = ({ groundCapture, lightUniforms, precipitationUnifo
5120
4918
  splashMaterial.opacityNode = ring.mul(float(1).sub(varying(age))).mul(SPLASH_OPACITY);
5121
4919
  return splashMaterial;
5122
4920
  };
5123
- //#endregion
5124
- //#region src/nodes/createStoneGlowNode.ts
4921
+ // src/nodes/createStoneGlowNode.ts
5125
4922
  const createStoneGlowNode = ({ glowRange, rimColor, rimPower, rimStrength }) => {
5126
4923
  const fresnel = float(1).sub(normalView.dot(positionViewDirection).saturate()).pow(rimPower).min(1);
5127
4924
  const glow = color(new Color().fromArray(rimColor)).mul(fresnel.mul(rimStrength));
5128
4925
  return glow.mul(step(glowRange, glow.length()));
5129
4926
  };
5130
- //#endregion
5131
- //#region src/nodes/createStoneLightUniforms.ts
4927
+ // src/nodes/createStoneLightUniforms.ts
5132
4928
  const createStoneLightUniforms = () => {
5133
4929
  const ramp = new DataTexture(/* @__PURE__ */ new Float32Array(64), 16, 1, RGBAFormat, FloatType);
5134
4930
  ramp.magFilter = LinearFilter;
@@ -5146,16 +4942,14 @@ const createStoneLightUniforms = () => {
5146
4942
  sunRadiance: uniform(new Color())
5147
4943
  };
5148
4944
  };
5149
- //#endregion
5150
- //#region src/nodes/createStoneMaterial.ts
4945
+ // src/nodes/createStoneMaterial.ts
5151
4946
  const createStoneMaterial = (options, stoneLight, glowNode = vec3(0)) => {
5152
4947
  const material = new StoneNodeMaterial(stoneLight);
5153
4948
  material.colorNode = color(new Color(options.albedo));
5154
4949
  material.emissiveNode = createStoneGlowNode(options).add(glowNode);
5155
4950
  return material;
5156
4951
  };
5157
- //#endregion
5158
- //#region src/nodes/createWaterfallMaterial.ts
4952
+ // src/nodes/createWaterfallMaterial.ts
5159
4953
  const STREAK_DENSITY = 14;
5160
4954
  const STREAK_LENGTH = .25;
5161
4955
  const FALL_SPEED = 1.6;
@@ -5172,8 +4966,7 @@ const createWaterfallMaterial = ({ foamColor }) => {
5172
4966
  waterfallMaterial.opacityNode = smoothstep(STREAK_LOW, STREAK_HIGH, streakNoise);
5173
4967
  return waterfallMaterial;
5174
4968
  };
5175
- //#endregion
5176
- //#region src/vegetation/constants.ts
4969
+ // src/vegetation/constants.ts
5177
4970
  const IMPOSTOR_RESOLUTION = 256;
5178
4971
  const IMPOSTOR_SWITCH_HEIGHTS = 10;
5179
4972
  const IMPOSTOR_CROSSFADE_SHARE = .1;
@@ -5195,8 +4988,7 @@ const GRASS_TRAIL_FADE_START_SHARE = .8;
5195
4988
  const GRASS_TRAIL_FADE_END_SHARE = .95;
5196
4989
  const GRASS_BEND_PER_WIND = .9;
5197
4990
  const GRASS_DIP_PER_BEND = .3;
5198
- //#endregion
5199
- //#region src/nodes/sampleGrassTrail.ts
4991
+ // src/nodes/sampleGrassTrail.ts
5200
4992
  const sampleGrassTrail = (grassTrail, ground) => {
5201
4993
  const encoded = texture(grassTrail.texture, fract(ground.div(16))).level(float(0));
5202
4994
  const offset = ground.sub(grassTrail.center).abs();
@@ -5204,20 +4996,17 @@ const sampleGrassTrail = (grassTrail, ground) => {
5204
4996
  const reachFade = float(1).sub(smoothstep(GRASS_TRAIL_FADE_START_SHARE, GRASS_TRAIL_FADE_END_SHARE, reachShare));
5205
4997
  return encoded.xy.mul(2).sub(1).mul(reachFade);
5206
4998
  };
5207
- //#endregion
5208
- //#region src/nodes/setObjectFade.ts
4999
+ // src/nodes/setObjectFade.ts
5209
5000
  const setObjectFade = (object, fade) => {
5210
5001
  object.userData[OBJECT_FADE_KEY] = fade;
5211
5002
  };
5212
- //#endregion
5213
- //#region src/nodes/setObjectSurface.ts
5003
+ // src/nodes/setObjectSurface.ts
5214
5004
  const setObjectSurface = (object, color, detail) => {
5215
5005
  const amplitudes = detail ? computeSurfaceOctaves(detail).map(({ amplitude }) => amplitude) : [];
5216
5006
  const texelsPerMetre = detail ? 1 / detail.metresPerTexel : 0;
5217
5007
  object.userData[OBJECT_SURFACE_KEY] = new ObjectSurface(new Color(color), amplitudes, texelsPerMetre);
5218
5008
  };
5219
- //#endregion
5220
- //#region src/post/computeGradeLut.ts
5009
+ // src/post/computeGradeLut.ts
5221
5010
  const RED_LUMINANCE = .2126;
5222
5011
  const GREEN_LUMINANCE = .7152;
5223
5012
  const BLUE_LUMINANCE = .0722;
@@ -5248,8 +5037,7 @@ const computeGradeLut = ({ contrast, highlightTint, saturation, shadowTint, size
5248
5037
  }
5249
5038
  return values;
5250
5039
  };
5251
- //#endregion
5252
- //#region src/post/createFogUniforms.ts
5040
+ // src/post/createFogUniforms.ts
5253
5041
  const createFogUniforms = () => ({
5254
5042
  baseHeight: uniform(0),
5255
5043
  color: uniform(new Color()),
@@ -5262,8 +5050,7 @@ const createFogUniforms = () => ({
5262
5050
  scatterStrength: uniform(0),
5263
5051
  startDistance: uniform(0)
5264
5052
  });
5265
- //#endregion
5266
- //#region src/post/createGodraysLight.ts
5053
+ // src/post/createGodraysLight.ts
5267
5054
  const createGodraysLight = (shadowMapSize, halfExtent) => {
5268
5055
  const godraysLight = new DirectionalLight(16777215, 0);
5269
5056
  godraysLight.castShadow = true;
@@ -5278,8 +5065,7 @@ const createGodraysLight = (shadowMapSize, halfExtent) => {
5278
5065
  camera.far = halfExtent * 4;
5279
5066
  return godraysLight;
5280
5067
  };
5281
- //#endregion
5282
- //#region src/post/createGradeLutTexture.ts
5068
+ // src/post/createGradeLutTexture.ts
5283
5069
  const createGradeLutTexture = (gradeOptions) => {
5284
5070
  const { size } = gradeOptions;
5285
5071
  const gradeLutTexture = new Data3DTexture(computeGradeLut(gradeOptions), size, size, size);
@@ -5288,8 +5074,7 @@ const createGradeLutTexture = (gradeOptions) => {
5288
5074
  gradeLutTexture.needsUpdate = true;
5289
5075
  return gradeLutTexture;
5290
5076
  };
5291
- //#endregion
5292
- //#region src/post/createHeightFogNode.ts
5077
+ // src/post/createHeightFogNode.ts
5293
5078
  const MIN_RAY_CLIMB = 1e-6;
5294
5079
  const createHeightFogNode = (colorNode, depthNode, camera, { baseHeight, color, density, heightFalloff, maxOpacity, scatterColor, scatterDirection, scatterPower, scatterStrength, startDistance }, stoneHaze) => {
5295
5080
  const cameraWorldMatrix = uniform(camera.matrixWorld);
@@ -5320,8 +5105,7 @@ const createHeightFogNode = (colorNode, depthNode, camera, { baseHeight, color,
5320
5105
  return output;
5321
5106
  })();
5322
5107
  };
5323
- //#endregion
5324
- //#region src/post/createOcclusionNode.ts
5108
+ // src/post/createOcclusionNode.ts
5325
5109
  const OCCLUSION_THICKNESS_SHARE = 4;
5326
5110
  const createOcclusionNode = (depthNode, camera, radius) => {
5327
5111
  const cameraProjectionMatrixInverse = uniform(camera.projectionMatrixInverse);
@@ -5331,8 +5115,7 @@ const createOcclusionNode = (depthNode, camera, radius) => {
5331
5115
  occlusionNode.thickness.value = radius * OCCLUSION_THICKNESS_SHARE;
5332
5116
  return occlusionNode;
5333
5117
  };
5334
- //#endregion
5335
- //#region src/post/createSightNode.ts
5118
+ // src/post/createSightNode.ts
5336
5119
  const SIGHT_MUTE_BRIGHTNESS = .25;
5337
5120
  const SIGHT_HIGHLIGHT_STRENGTH = .85;
5338
5121
  const SIGHT_RING_WIDTH = .6;
@@ -5363,11 +5146,9 @@ const createSightNode = (colorNode, depthNode, camera, litPass, { origin, radius
5363
5146
  return output;
5364
5147
  })();
5365
5148
  };
5366
- //#endregion
5367
- //#region src/post/toneMapGenshinNode.ts
5149
+ // src/post/toneMapGenshinNode.ts
5368
5150
  const toneMapGenshinNode = (sceneColor) => min(max(vec3(1.0001).sub(exp2(sceneColor.mul(-1))), 0).pow(.51), 1);
5369
- //#endregion
5370
- //#region src/post/createPostPipeline.ts
5151
+ // src/post/createPostPipeline.ts
5371
5152
  const BLOOM_STRENGTH = .35;
5372
5153
  const BLOOM_RADIUS = .4;
5373
5154
  const BLOOM_THRESHOLD = .85;
@@ -5442,8 +5223,7 @@ const createPostPipeline = ({ camera, fogUniforms, godraysLight, gradeLutTexture
5442
5223
  }
5443
5224
  return postPipeline;
5444
5225
  };
5445
- //#endregion
5446
- //#region src/post/createPostUniforms.ts
5226
+ // src/post/createPostUniforms.ts
5447
5227
  const createPostUniforms = () => ({
5448
5228
  godraysColor: uniform(new Color(16773590)),
5449
5229
  gradeIntensity: uniform(1),
@@ -5452,15 +5232,13 @@ const createPostUniforms = () => ({
5452
5232
  outlineThickness: uniform(.003),
5453
5233
  whiteBalance: uniform(new Matrix3())
5454
5234
  });
5455
- //#endregion
5456
- //#region src/post/createSightUniforms.ts
5235
+ // src/post/createSightUniforms.ts
5457
5236
  const createSightUniforms = () => ({
5458
5237
  origin: uniform(new Vector2()),
5459
5238
  radius: uniform(0),
5460
5239
  strength: uniform(0)
5461
5240
  });
5462
- //#endregion
5463
- //#region src/post/toneMapGenshin.ts
5241
+ // src/post/toneMapGenshin.ts
5464
5242
  const toneMapGenshin = (sceneColor, toneMapped = [
5465
5243
  0,
5466
5244
  0,
@@ -5469,8 +5247,7 @@ const toneMapGenshin = (sceneColor, toneMapped = [
5469
5247
  for (let index = 0; index < 3; index++) toneMapped[index] = Math.min(Math.max(1.0001 - 2 ** (-1 * (sceneColor[index] ?? 0)), 0) ** .51, 1);
5470
5248
  return toneMapped;
5471
5249
  };
5472
- //#endregion
5473
- //#region src/renderer/QualityTierSettingsMap.ts
5250
+ // src/renderer/QualityTierSettingsMap.ts
5474
5251
  const QualityTierSettingsMap = {
5475
5252
  ["High"]: {
5476
5253
  antialiasingMode: "Traa",
@@ -5503,8 +5280,7 @@ const QualityTierSettingsMap = {
5503
5280
  shadowMapSize: 1024
5504
5281
  }
5505
5282
  };
5506
- //#endregion
5507
- //#region src/renderer/attachInspector.ts
5283
+ // src/renderer/attachInspector.ts
5508
5284
  const attachInspector = async (renderer) => {
5509
5285
  const { Inspector } = await import("three/examples/jsm/inspector/Inspector.js");
5510
5286
  if (renderer.inspector instanceof Inspector) return renderer.inspector;
@@ -5512,8 +5288,7 @@ const attachInspector = async (renderer) => {
5512
5288
  renderer.inspector = inspector;
5513
5289
  return inspector;
5514
5290
  };
5515
- //#endregion
5516
- //#region src/renderer/createGenshinRenderer.ts
5291
+ // src/renderer/createGenshinRenderer.ts
5517
5292
  const createGenshinRenderer = (canvas) => {
5518
5293
  const isWindows = window.navigator.userAgent.includes("Windows");
5519
5294
  const renderer = new WebGPURenderer({
@@ -5525,26 +5300,22 @@ const createGenshinRenderer = (canvas) => {
5525
5300
  if (import.meta.env?.DEV && !window.navigator.webdriver) attachInspector(renderer);
5526
5301
  return renderer;
5527
5302
  };
5528
- //#endregion
5529
- //#region src/renderer/createInstancedMesh.ts
5303
+ // src/renderer/createInstancedMesh.ts
5530
5304
  const createInstancedMesh = (geometry, material, count) => {
5531
5305
  const mesh = new InstancedMesh(geometry, material, count);
5532
5306
  mesh.instanceMatrix = new StorageInstancedBufferAttribute(mesh.instanceMatrix.array, mesh.instanceMatrix.itemSize);
5533
5307
  return mesh;
5534
5308
  };
5535
- //#endregion
5536
- //#region src/renderer/getScreenDirection.ts
5309
+ // src/renderer/getScreenDirection.ts
5537
5310
  const X_AXIS = new Vector3(1, 0, 0);
5538
5311
  const Y_AXIS = new Vector3(0, 1, 0);
5539
5312
  const getScreenDirection = ({ aspect, fov, pitch, yaw }, [x, y]) => {
5540
5313
  const halfHeight = Math.tan(MathUtils.degToRad(fov) / 2);
5541
5314
  return new Vector3((x * 2 - 1) * halfHeight * aspect, (1 - y * 2) * halfHeight, -1).normalize().applyAxisAngle(X_AXIS, pitch).applyAxisAngle(Y_AXIS, yaw);
5542
5315
  };
5543
- //#endregion
5544
- //#region src/simulation/constants.ts
5316
+ // src/simulation/constants.ts
5545
5317
  const MAX_STEPS_PER_FRAME = 5;
5546
- //#endregion
5547
- //#region src/simulation/createFixedStepLoop.ts
5318
+ // src/simulation/createFixedStepLoop.ts
5548
5319
  const createFixedStepLoop = (stepSeconds, step) => {
5549
5320
  let accumulator = 0;
5550
5321
  return {
@@ -5561,11 +5332,9 @@ const createFixedStepLoop = (stepSeconds, step) => {
5561
5332
  getStepShare: () => accumulator / stepSeconds
5562
5333
  };
5563
5334
  };
5564
- //#endregion
5565
- //#region src/streaming/constants.ts
5335
+ // src/streaming/constants.ts
5566
5336
  const MAX_TILE_ATTEMPTS = 3;
5567
- //#endregion
5568
- //#region src/streaming/createTileStreamer.ts
5337
+ // src/streaming/createTileStreamer.ts
5569
5338
  const createTileStreamer = ({ disposeTile, maxCachedCount, maxPendingCount, requestTile }) => {
5570
5339
  const cachedTileMap = /* @__PURE__ */ new Map();
5571
5340
  const pendingWantedFrameMap = /* @__PURE__ */ new Map();
@@ -5663,11 +5432,9 @@ const createTileStreamer = ({ disposeTile, maxCachedCount, maxPendingCount, requ
5663
5432
  }
5664
5433
  };
5665
5434
  };
5666
- //#endregion
5667
- //#region src/terrain/checkTerrainBoundsOverlap.ts
5435
+ // src/terrain/checkTerrainBoundsOverlap.ts
5668
5436
  const checkTerrainBoundsOverlap = (first, second) => first.minX <= second.maxX && second.minX <= first.maxX && first.minZ <= second.maxZ && second.minZ <= first.maxZ;
5669
- //#endregion
5670
- //#region src/terrain/checkTerrainDrawsChanged.ts
5437
+ // src/terrain/checkTerrainDrawsChanged.ts
5671
5438
  const otherKeys = /* @__PURE__ */ new Set();
5672
5439
  const checkAddedWithin = (finestTileSize, selection, other, center, halfSize) => {
5673
5440
  otherKeys.clear();
@@ -5690,11 +5457,9 @@ const checkTerrainDrawsChanged = ({ finestTileSize }, previous, next, center, ha
5690
5457
  }
5691
5458
  return checkAddedWithin(finestTileSize, next, previous, center, halfSize) || checkAddedWithin(finestTileSize, previous, next, center, halfSize);
5692
5459
  };
5693
- //#endregion
5694
- //#region src/terrain/checkTerrainTileCasts.ts
5460
+ // src/terrain/checkTerrainTileCasts.ts
5695
5461
  const checkTerrainTileCasts = ({ finestRange }, key, shadowReach) => finestRange * 2 ** getTerrainTileLevel(key) <= shadowReach;
5696
- //#endregion
5697
- //#region src/terrain/computeTerrainIndices.ts
5462
+ // src/terrain/computeTerrainIndices.ts
5698
5463
  const MAX_UINT16_VERTEX_COUNT = 2 ** 16;
5699
5464
  const computeTerrainIndices = (cellsPerSide) => {
5700
5465
  const side = cellsPerSide + 1;
@@ -5713,11 +5478,9 @@ const computeTerrainIndices = (cellsPerSide) => {
5713
5478
  }
5714
5479
  return indices;
5715
5480
  };
5716
- //#endregion
5717
- //#region src/terrain/getTerrainMorphStart.ts
5481
+ // src/terrain/getTerrainMorphStart.ts
5718
5482
  const getTerrainMorphStart = ({ finestRange, finestTileSize }) => finestRange / 2 + Math.SQRT2 * finestTileSize;
5719
- //#endregion
5720
- //#region src/terrain/createTerrainMaterial.ts
5483
+ // src/terrain/createTerrainMaterial.ts
5721
5484
  const createTerrainMaterial = (terrainOptions, eye, toonMaterialOptions, waterUniforms) => {
5722
5485
  const terrainMaterial = createToonMaterial({
5723
5486
  ...toonMaterialOptions,
@@ -5740,8 +5503,7 @@ const createTerrainMaterial = (terrainOptions, eye, toonMaterialOptions, waterUn
5740
5503
  if (waterUniforms) terrainMaterial.emissiveNode = createRimNode(lightUniforms).add(createWetSheenNode(lightUniforms)).add(createCausticsNode(lightUniforms, waterUniforms));
5741
5504
  return terrainMaterial;
5742
5505
  };
5743
- //#endregion
5744
- //#region src/terrain/createTerrainTileGeometry.ts
5506
+ // src/terrain/createTerrainTileGeometry.ts
5745
5507
  const createTerrainTileGeometry = ({ coarseColors, coarseNormals, coarsePositions, colors, normals, positions }, index, boundingBox) => {
5746
5508
  const geometry = new BufferGeometry();
5747
5509
  geometry.setAttribute("position", new BufferAttribute(positions, 3));
@@ -5755,8 +5517,7 @@ const createTerrainTileGeometry = ({ coarseColors, coarseNormals, coarsePosition
5755
5517
  geometry.boundingSphere = boundingBox.getBoundingSphere(new Sphere());
5756
5518
  return geometry;
5757
5519
  };
5758
- //#endregion
5759
- //#region src/terrain/writeTerrainRingIndices.ts
5520
+ // src/terrain/writeTerrainRingIndices.ts
5760
5521
  const writeTerrainRingIndices = (ringIndices, tileIndices, drawnOrdinals, vertexCount) => {
5761
5522
  let cursor = 0;
5762
5523
  for (const ordinal of drawnOrdinals) {
@@ -5765,8 +5526,7 @@ const writeTerrainRingIndices = (ringIndices, tileIndices, drawnOrdinals, vertex
5765
5526
  }
5766
5527
  return cursor;
5767
5528
  };
5768
- //#endregion
5769
- //#region src/terrain/writeTerrainRingTile.ts
5529
+ // src/terrain/writeTerrainRingTile.ts
5770
5530
  const writeTerrainRingTile = (ring, base, tile, finestTileSize) => {
5771
5531
  const size = finestTileSize * 2 ** getTerrainTileLevel(tile.key);
5772
5532
  const offsetX = getTerrainTileColumn(tile.key) * size;
@@ -5790,8 +5550,7 @@ const writeTerrainRingTile = (ring, base, tile, finestTileSize) => {
5790
5550
  ring.coarsePositions[ring4 + 3] = tile.coarsePositions[tile4 + 3] ?? 0;
5791
5551
  }
5792
5552
  };
5793
- //#endregion
5794
- //#region src/terrain/createTerrainRing.ts
5553
+ // src/terrain/createTerrainRing.ts
5795
5554
  const TERRAIN_TILE_ARRAY_KEYS = [
5796
5555
  "coarseColors",
5797
5556
  "coarseNormals",
@@ -5896,25 +5655,21 @@ const createTerrainRing = ({ cellsPerSide, finestTileSize }, tileIndices, materi
5896
5655
  }
5897
5656
  };
5898
5657
  };
5899
- //#endregion
5900
- //#region src/terrain/createTerrainSelection.ts
5658
+ // src/terrain/createTerrainSelection.ts
5901
5659
  const createTerrainSelection = (capacity) => ({
5902
5660
  count: 0,
5903
5661
  keys: new Float64Array(capacity)
5904
5662
  });
5905
- //#endregion
5906
- //#region src/terrain/getTerrainTileKey.ts
5663
+ // src/terrain/getTerrainTileKey.ts
5907
5664
  const getTerrainTileKey = (level, column, row) => (level * TILE_INDEX_SPAN + row + TILE_INDEX_OFFSET) * TILE_INDEX_SPAN + column + TILE_INDEX_OFFSET;
5908
- //#endregion
5909
- //#region src/terrain/getParentTerrainTileKey.ts
5665
+ // src/terrain/getParentTerrainTileKey.ts
5910
5666
  const getParentTerrainTileKey = (key) => {
5911
5667
  const level = getTerrainTileLevel(key);
5912
5668
  const column = getTerrainTileColumn(key);
5913
5669
  const row = getTerrainTileRow(key);
5914
5670
  return getTerrainTileKey(level + 1, Math.floor(column / 2), Math.floor(row / 2));
5915
5671
  };
5916
- //#endregion
5917
- //#region src/terrain/getTerrainOverlayBounds.ts
5672
+ // src/terrain/getTerrainOverlayBounds.ts
5918
5673
  const getTerrainOverlayBounds = (shape) => {
5919
5674
  const { features = [], residual } = shape;
5920
5675
  if (residual && !residual.fade) return {
@@ -5953,8 +5708,7 @@ const getTerrainOverlayBounds = (shape) => {
5953
5708
  minZ: Math.floor(minZ / 64) * 64
5954
5709
  };
5955
5710
  };
5956
- //#endregion
5957
- //#region src/terrain/getTerrainTileBounds.ts
5711
+ // src/terrain/getTerrainTileBounds.ts
5958
5712
  const getTerrainTileBounds = (key, finestTileSize, cellsPerSide) => {
5959
5713
  const size = finestTileSize * 2 ** getTerrainTileLevel(key);
5960
5714
  const padding = 2 * size / cellsPerSide;
@@ -5967,8 +5721,7 @@ const getTerrainTileBounds = (key, finestTileSize, cellsPerSide) => {
5967
5721
  minZ
5968
5722
  };
5969
5723
  };
5970
- //#endregion
5971
- //#region src/terrain/resolveTerrainDraws.ts
5724
+ // src/terrain/resolveTerrainDraws.ts
5972
5725
  const fallbackKeys = /* @__PURE__ */ new Set();
5973
5726
  const checkFallbackAncestor = (key, levelCount) => {
5974
5727
  if (fallbackKeys.size === 0) return false;
@@ -6005,8 +5758,7 @@ const resolveTerrainDraws = ({ levelCount }, wanted, checkTileLoaded, draws) =>
6005
5758
  }
6006
5759
  return draws;
6007
5760
  };
6008
- //#endregion
6009
- //#region src/terrain/selectTerrainTiles.ts
5761
+ // src/terrain/selectTerrainTiles.ts
6010
5762
  const tileBox = new Box3();
6011
5763
  const addKey = (selection, key) => {
6012
5764
  if (selection.count === selection.keys.length) return;
@@ -6045,8 +5797,7 @@ const selectTerrainTiles = (terrainOptions, eye, frustum, selection) => {
6045
5797
  for (let row = Math.floor((eye.z - range) / size); row <= Math.floor((eye.z + range) / size); row++) for (let column = Math.floor((eye.x - range) / size); column <= Math.floor((eye.x + range) / size); column++) selectTile(terrainOptions, eye, frustum, selection, level, column, row);
6046
5798
  return selection;
6047
5799
  };
6048
- //#endregion
6049
- //#region src/vegetation/bakeImpostor.ts
5800
+ // src/vegetation/bakeImpostor.ts
6050
5801
  const CLEAR_COLOR$1 = new Color();
6051
5802
  const previousClearColor$1 = new Color();
6052
5803
  const bakeImpostor = (renderer, parts, resolution) => {
@@ -6104,8 +5855,7 @@ const bakeImpostor = (renderer, parts, resolution) => {
6104
5855
  width
6105
5856
  };
6106
5857
  };
6107
- //#endregion
6108
- //#region src/vegetation/computeGrassBlade.ts
5858
+ // src/vegetation/computeGrassBlade.ts
6109
5859
  const computeGrassBlade = (segmentCount) => {
6110
5860
  const positions = new Float32Array((segmentCount * 2 + 1) * 3);
6111
5861
  for (let segment = 0; segment < segmentCount; segment++) {
@@ -6138,24 +5888,19 @@ const computeGrassBlade = (segmentCount) => {
6138
5888
  positions
6139
5889
  };
6140
5890
  };
6141
- //#endregion
6142
- //#region src/vegetation/computeGrassTrailCell.ts
5891
+ // src/vegetation/computeGrassTrailCell.ts
6143
5892
  const computeGrassTrailCell = (coordinate, texelSize) => Math.floor(coordinate / texelSize);
6144
- //#endregion
6145
- //#region src/vegetation/computeGrassTrailTexel.ts
5893
+ // src/vegetation/computeGrassTrailTexel.ts
6146
5894
  const computeGrassTrailTexel = (cell) => (cell % 64 + 64) % 64;
6147
- //#endregion
6148
- //#region src/vegetation/computeGrassTrailTexelIndex.ts
5895
+ // src/vegetation/computeGrassTrailTexelIndex.ts
6149
5896
  const computeGrassTrailTexelIndex = (cellX, cellZ) => computeGrassTrailTexel(cellZ) * 64 + computeGrassTrailTexel(cellX);
6150
- //#endregion
6151
- //#region src/vegetation/computeImpostorFade.ts
5897
+ // src/vegetation/computeImpostorFade.ts
6152
5898
  const computeImpostorFade = (distance, impostorHeight) => {
6153
5899
  const switchDistance = impostorHeight * 10;
6154
5900
  const halfBand = switchDistance * IMPOSTOR_CROSSFADE_SHARE / 2;
6155
5901
  return MathUtils.smoothstep(distance, switchDistance - halfBand, switchDistance + halfBand);
6156
5902
  };
6157
- //#endregion
6158
- //#region src/vegetation/createFlowerGeometry.ts
5903
+ // src/vegetation/createFlowerGeometry.ts
6159
5904
  const createFlowerGeometry = () => {
6160
5905
  const flowerGeometry = new BufferGeometry();
6161
5906
  flowerGeometry.setAttribute("position", new Float32BufferAttribute([
@@ -6219,8 +5964,7 @@ const createFlowerGeometry = () => {
6219
5964
  flowerGeometry.computeVertexNormals();
6220
5965
  return flowerGeometry;
6221
5966
  };
6222
- //#endregion
6223
- //#region src/vegetation/createFlowerMaterial.ts
5967
+ // src/vegetation/createFlowerMaterial.ts
6224
5968
  const HEAD_CENTER = vec2(.5, .7);
6225
5969
  const HEAD_RADIUS = .28;
6226
5970
  const STEM_HALF_WIDTH = .04;
@@ -6242,8 +5986,7 @@ const createFlowerMaterial = (toonMaterialOptions, windUniforms) => {
6242
5986
  flowerMaterial.normalNode = cameraViewMatrix.mul(vec4(0, 1, 0, 0)).xyz;
6243
5987
  return flowerMaterial;
6244
5988
  };
6245
- //#endregion
6246
- //#region src/vegetation/createFlowerTileGeometry.ts
5989
+ // src/vegetation/createFlowerTileGeometry.ts
6247
5990
  const MATRIX_SIZE = 16;
6248
5991
  const COLUMN_SIZE = 4;
6249
5992
  const corner = new Vector3();
@@ -6267,8 +6010,7 @@ const createFlowerTileGeometry = (matrices, colors) => {
6267
6010
  geometry.boundingSphere = bounds.getBoundingSphere(new Sphere());
6268
6011
  return geometry;
6269
6012
  };
6270
- //#endregion
6271
- //#region src/vegetation/createGrassBladePoint.ts
6013
+ // src/vegetation/createGrassBladePoint.ts
6272
6014
  const createGrassBladePoint = ({ bladeHeight, captured, grassTrail, ground, offset, size, up, windUniforms }) => {
6273
6015
  const bend = up.mul(up);
6274
6016
  const wind = createWindNode(windUniforms, ground).mul(GRASS_BEND_PER_WIND).mul(bend);
@@ -6277,8 +6019,7 @@ const createGrassBladePoint = ({ bladeHeight, captured, grassTrail, ground, offs
6277
6019
  const height = up.mul(bladeHeight).mul(size).sub(wind.length().mul(bladeHeight).mul(size).mul(GRASS_DIP_PER_BEND)).sub(trailBend.length().mul(bladeHeight).mul(size).mul(GRASS_DIP_PER_BEND));
6278
6020
  return vec3(ground.x.add(offset.x).add(wind.x.mul(bladeHeight).mul(size)).add(trailOffset.x), captured.a.add(height), ground.y.add(offset.y).add(wind.y.mul(bladeHeight).mul(size)).add(trailOffset.y));
6279
6021
  };
6280
- //#endregion
6281
- //#region src/vegetation/createGrassCell.ts
6022
+ // src/vegetation/createGrassCell.ts
6282
6023
  const MIN_GREENNESS = .05;
6283
6024
  const createGrassCell = ({ cameraGround, density, groundCapture, index, ring, waterUniforms }) => {
6284
6025
  const { cellsPerSide, fadeEnd, fadeStart, innerRadius, scale, spacing } = ring;
@@ -6301,8 +6042,7 @@ const createGrassCell = ({ cameraGround, density, groundCapture, index, ring, wa
6301
6042
  size
6302
6043
  };
6303
6044
  };
6304
- //#endregion
6305
- //#region src/vegetation/createGrassCulling.ts
6045
+ // src/vegetation/createGrassCulling.ts
6306
6046
  const createGrassCulling = ({ bladeHeight, cameraGround, clipFromModel, density, grassTrail, groundCapture, ring, segmentCount, waterUniforms, windUniforms }) => createInstanceCulling({
6307
6047
  count: ring.cellsPerSide * ring.cellsPerSide,
6308
6048
  indexCount: computeGrassBlade(segmentCount).indices.length,
@@ -6331,8 +6071,7 @@ const createGrassCulling = ({ bladeHeight, cameraGround, clipFromModel, density,
6331
6071
  return step(CULLING_MIN_SIZE, size).mul(max(max(root, top), tip));
6332
6072
  }
6333
6073
  });
6334
- //#endregion
6335
- //#region src/vegetation/createGrassGeometry.ts
6074
+ // src/vegetation/createGrassGeometry.ts
6336
6075
  const createGrassGeometry = (segmentCount, bladeCount) => {
6337
6076
  const { indices, positions } = computeGrassBlade(segmentCount);
6338
6077
  const grassGeometry = new InstancedBufferGeometry();
@@ -6342,8 +6081,7 @@ const createGrassGeometry = (segmentCount, bladeCount) => {
6342
6081
  grassGeometry.instanceCount = bladeCount;
6343
6082
  return grassGeometry;
6344
6083
  };
6345
- //#endregion
6346
- //#region src/vegetation/createGrassMaterial.ts
6084
+ // src/vegetation/createGrassMaterial.ts
6347
6085
  const createGrassMaterial = ({ bladeHeight, bladeWidth, cameraGround, cellIndex, density, grassTrail, groundCapture, lightUniforms, rampTexture, ring, waterUniforms, windUniforms }) => {
6348
6086
  const grassMaterial = createToonMaterial({
6349
6087
  isOutlined: false,
@@ -6376,8 +6114,7 @@ const createGrassMaterial = ({ bladeHeight, bladeWidth, cameraGround, cellIndex,
6376
6114
  grassMaterial.colorNode = mix(groundColor.mul(.72), groundColor.mul(1.12).add(vec3(.03, .03, 0)), up).mul(createWetDarkeningNode(lightUniforms));
6377
6115
  return grassMaterial;
6378
6116
  };
6379
- //#endregion
6380
- //#region src/vegetation/createGrassTrail.ts
6117
+ // src/vegetation/createGrassTrail.ts
6381
6118
  const createGrassTrail = () => {
6382
6119
  const texelCount = 4096;
6383
6120
  const data = new Uint8Array(texelCount * 4);
@@ -6395,8 +6132,7 @@ const createGrassTrail = () => {
6395
6132
  texture
6396
6133
  };
6397
6134
  };
6398
- //#endregion
6399
- //#region src/vegetation/createGroundCapture.ts
6135
+ // src/vegetation/createGroundCapture.ts
6400
6136
  const createGroundCapture = (size, resolution) => {
6401
6137
  const renderTarget = new RenderTarget(resolution, resolution, { type: HalfFloatType });
6402
6138
  renderTarget.texture.magFilter = LinearFilter;
@@ -6415,8 +6151,7 @@ const createGroundCapture = (size, resolution) => {
6415
6151
  size
6416
6152
  };
6417
6153
  };
6418
- //#endregion
6419
- //#region src/vegetation/createPlantCulling.ts
6154
+ // src/vegetation/createPlantCulling.ts
6420
6155
  const createPlantCulling = ({ attribute, bounds: { bottom, halfWidth, height }, clipFromModel, drawDistance, eye, indexCount }) => {
6421
6156
  const middle = bottom + height / 2;
6422
6157
  const boxPoints = [
@@ -6461,8 +6196,7 @@ const createPlantCulling = ({ attribute, bounds: { bottom, halfWidth, height },
6461
6196
  }
6462
6197
  });
6463
6198
  };
6464
- //#endregion
6465
- //#region src/vegetation/renderGroundCapture.ts
6199
+ // src/vegetation/renderGroundCapture.ts
6466
6200
  const CLEAR_COLOR = new Color();
6467
6201
  const previousClearColor = new Color();
6468
6202
  const renderGroundCapture = (renderer, scene, { camera, center, material, renderTarget }, { maxHeight }, worldCenter, origin) => {
@@ -6487,8 +6221,7 @@ const renderGroundCapture = (renderer, scene, { camera, center, material, render
6487
6221
  scene.overrideMaterial = previousOverrideMaterial;
6488
6222
  scene.backgroundNode = previousBackgroundNode;
6489
6223
  };
6490
- //#endregion
6491
- //#region src/vegetation/stepGrassTrail.ts
6224
+ // src/vegetation/stepGrassTrail.ts
6492
6225
  const encodeBend = (bend) => Math.round((Math.min(Math.max(bend, -1), 1) * .5 + .5) * 255);
6493
6226
  const stepGrassTrail = (trail, position, velocity, delta) => {
6494
6227
  const { bends, cells, data, texture } = trail;
@@ -6526,8 +6259,7 @@ const stepGrassTrail = (trail, position, velocity, delta) => {
6526
6259
  }
6527
6260
  texture.needsUpdate = true;
6528
6261
  };
6529
- //#endregion
6530
- //#region src/water/createRiverGeometry.ts
6262
+ // src/water/createRiverGeometry.ts
6531
6263
  const createRiverGeometry = (course) => {
6532
6264
  const positions = [];
6533
6265
  const uvs = [];
@@ -6577,8 +6309,7 @@ const createRiverGeometry = (course) => {
6577
6309
  geometry.computeVertexNormals();
6578
6310
  return geometry;
6579
6311
  };
6580
- //#endregion
6581
- //#region src/water/createUnderwaterFogState.ts
6312
+ // src/water/createUnderwaterFogState.ts
6582
6313
  const createUnderwaterFogState = () => ({
6583
6314
  aboveDensity: 0,
6584
6315
  aboveHeightFalloff: 0,
@@ -6587,8 +6318,7 @@ const createUnderwaterFogState = () => ({
6587
6318
  isUnderwater: false,
6588
6319
  underwaterDensity: 0
6589
6320
  });
6590
- //#endregion
6591
- //#region src/water/createWaterUniforms.ts
6321
+ // src/water/createWaterUniforms.ts
6592
6322
  const createWaterUniforms = () => ({
6593
6323
  causticStrength: uniform(0),
6594
6324
  deepColor: uniform(new Color()),
@@ -6600,8 +6330,7 @@ const createWaterUniforms = () => ({
6600
6330
  underwaterFogColor: uniform(new Color()),
6601
6331
  underwaterFogDensity: uniform(0)
6602
6332
  });
6603
- //#endregion
6604
- //#region src/water/createWaterfallGeometry.ts
6333
+ // src/water/createWaterfallGeometry.ts
6605
6334
  const createWaterfallGeometry = ({ across, drop, lip, width }) => {
6606
6335
  const halfWidth = width / 2;
6607
6336
  const left = lip.clone().addScaledVector(across, -halfWidth);
@@ -6641,8 +6370,7 @@ const createWaterfallGeometry = ({ across, drop, lip, width }) => {
6641
6370
  ]);
6642
6371
  return geometry;
6643
6372
  };
6644
- //#endregion
6645
- //#region src/water/updateUnderwaterFog.ts
6373
+ // src/water/updateUnderwaterFog.ts
6646
6374
  const updateUnderwaterFog = (eyeHeight, { level, underwaterFogColor, underwaterFogDensity }, { color, density, heightFalloff, maxOpacity, startDistance }, underwaterFogState) => {
6647
6375
  const isUnderwater = eyeHeight < level.value;
6648
6376
  if (isUnderwater) {
@@ -6665,8 +6393,7 @@ const updateUnderwaterFog = (eyeHeight, { level, underwaterFogColor, underwaterF
6665
6393
  }
6666
6394
  underwaterFogState.isUnderwater = isUnderwater;
6667
6395
  };
6668
- //#endregion
6669
- //#region src/wind/createWindUniforms.ts
6396
+ // src/wind/createWindUniforms.ts
6670
6397
  const createWindUniforms = () => ({
6671
6398
  direction: uniform(new Vector2(1, 0)),
6672
6399
  gustSpeed: uniform(0),
@@ -6674,15 +6401,13 @@ const createWindUniforms = () => ({
6674
6401
  gustWidth: uniform(1),
6675
6402
  strength: uniform(0)
6676
6403
  });
6677
- //#endregion
6678
- //#region src/world/computeOriginShift.ts
6404
+ // src/world/computeOriginShift.ts
6679
6405
  const computeOriginShift = (cameraPosition, threshold, step, shift) => {
6680
6406
  if (Math.hypot(cameraPosition.x, cameraPosition.z) <= threshold) return false;
6681
6407
  shift.set(Math.round(cameraPosition.x / step) * step, 0, Math.round(cameraPosition.z / step) * step);
6682
6408
  return shift.x !== 0 || shift.z !== 0;
6683
6409
  };
6684
- //#endregion
6685
- //#region src/world/computeOutlineDistance.ts
6410
+ // src/world/computeOutlineDistance.ts
6686
6411
  const computeOutlineDistance = (outline, x, z) => {
6687
6412
  let isInside = false;
6688
6413
  let nearestSquared = Infinity;
@@ -6701,5 +6426,4 @@ const computeOutlineDistance = (outline, x, z) => {
6701
6426
  }
6702
6427
  return isInside ? 0 : Math.sqrt(nearestSquared);
6703
6428
  };
6704
- //#endregion
6705
6429
  export { A4_FREQUENCY, A4_PITCH, AIR_LOCOMOTION_STATES, AnchoredCascadeShadowNode, AntialiasingMode, BEND_FOAM_FULL_RADIUS_WIDTHS, CLIMB_JUMP_STAMINA_COST, CLIMB_LOCOMOTION_STATES, CLIMB_REGRAB_SECONDS, CLIMB_STAMINA_PER_SECOND, CLIMB_START_STAMINA, COOL_RAMP_ROW_BASE, CULLING_FRUSTUM_MARGIN, CULLING_INDEX_COUNT_INDEX, CULLING_INDIRECT_ARGUMENT_COUNT, CULLING_INSTANCE_COUNT_INDEX, CULLING_MATRIX_COLUMN_COUNT, CULLING_MATRIX_ELEMENT_COUNT, CULLING_MIN_SIZE, CharacterMaterialKind, DASH_STAMINA_COST, DEFAULT_LIGHT_AREA, DEFAULT_RAMP_WIDTH, DEFAULT_SKY_GRADIENT, DEFAULT_SKY_SHAPE, DESATURATION_WEIGHTS, EMISSION_ALPHA_FLOOR, FIELD_SELECTOR, FLAT_LIGHT_MAP, FLOWER_BEND_PER_WIND, FLOWER_COLOR_ATTRIBUTE_NAME, FLOWER_MATRIX_ATTRIBUTE_NAMES, FOCUS_KEY_CODES, FOLLOW_CAMERA_ARM_STEP, FOLLOW_CAMERA_CLEARANCE, FOLLOW_CAMERA_DEFAULT_SETTINGS, FOLLOW_CAMERA_DISTANCE_PER_ZOOM_STEP, FOLLOW_CAMERA_EASE_OUT_SPEED, FOLLOW_CAMERA_FOV, FOLLOW_CAMERA_MAX_DISTANCE, FOLLOW_CAMERA_MAX_PITCH, FOLLOW_CAMERA_MIN_DISTANCE, FOLLOW_CAMERA_MIN_PITCH, FOLLOW_CAMERA_NEUTRAL_SENSITIVITY, FOLLOW_CAMERA_PIVOT_SHARE, FOLLOW_CAMERA_SLOPE_PITCH_SPEED, FREE_CAMERA_BASE_SPEED, FREE_CAMERA_CLEARANCE, FREE_CAMERA_MAX_PITCH, FREE_CAMERA_SPEED_PER_HEIGHT, GAMEPAD_BUTTONS, GAMEPAD_LOOK_RADIANS_PER_SECOND, GAMEPAD_STICK_DEADZONE, GAME_MINUTES_PER_SECOND, GAUSSIAN_REACH_WIDTHS, GENSHIN_TONE_CONTRAST, GENSHIN_TONE_EXPOSURE, GENSHIN_TONE_MAPPING, GLIDE_STAMINA_PER_SECOND, GRASS_BEND_PER_WIND, GRASS_DIP_PER_BEND, GRASS_TRAIL_BEND_SHARE, GRASS_TRAIL_EXTENT, GRASS_TRAIL_FADE_END_SHARE, GRASS_TRAIL_FADE_SECONDS, GRASS_TRAIL_FADE_START_SHARE, GRASS_TRAIL_STAMP_RADIUS, GRASS_TRAIL_TEXELS, GRASS_TRAIL_TEXEL_SIZE, GROUND_CONTACT_DISTANCE, GROUND_LOCOMOTION_STATES, GROUND_NORMAL_SPAN, GROUND_PRESS_SPEED, GamepadButton, GroundLayer, GroundLayers, HALF_LAMBERT_OFFSET, HALF_LAMBERT_SCALE, IMPOSTOR_CROSSFADE_SHARE, IMPOSTOR_RESOLUTION, IMPOSTOR_SWITCH_HEIGHTS, InputAction, InputActionBindingMap, InputActions, KEY_CODE_BACKWARD, KEY_CODE_DOWN, KEY_CODE_FORWARD, KEY_CODE_LEFT, KEY_CODE_RIGHT, KEY_CODE_UP, LEAF_SHAPE_KEPT_SHARE, LEAF_SHAPE_WIDTH, LEAST_DIVISOR, LIGHTNING_BOLT_BRIGHTNESS, LIGHTNING_BOLT_COLOR, LIGHTNING_BOLT_OPTIONS, LIGHTNING_FLASH_AMBIENT, LIGHTNING_FLASH_COLOR, LIGHTNING_FLASH_DECAY_SECONDS, LIGHTNING_FLASH_END, LIGHTNING_FLASH_PULSES, LIGHTNING_FLASH_SKY, LIGHTNING_MAX_DISTANCE, LIGHTNING_MIN_DISTANCE, LocomotionState, MAXIMUM_FACE_THRESHOLD, MAXIMUM_WINDOW_FLOOR, MAX_BYTE, MAX_STEPS_PER_FRAME, MAX_TILE_ATTEMPTS, MIDI_VELOCITY_MAX, MINIMUM_FACE_THRESHOLD, MINIMUM_OUTLINE_KNOT_SPAN, MINIMUM_RAMP_WIDTH_VERTEX, MINUTES_PER_DAY, MMD_BONE_NAME_MAP, MOUSE_BUTTONS, MOUSE_LOOK_MAX_PIXELS_PER_EVENT, MOUSE_LOOK_RADIANS_PER_PIXEL, MUSIC_EXPRESSION_WINDOW_SECONDS, MUSIC_LOOKAHEAD_SECONDS, MUSIC_NOISE_BAND_CENTRES, MUSIC_NOISE_LENGTH, MUSIC_SCHEDULE_INTERVAL_MS, MmdBoneName, MouseButton, NEUTRAL_LIGHT_MAP_GREEN, OBJECT_FADE_KEY, OBJECT_SURFACE_KEY, OUTLINE_MAIN_TEXTURE_SHARE, OUTLINE_PROJECTION_SCALE, OUTLINE_WIDTH_SCALE, ObjectSurface, POSE_AIR_STANCES, POSE_ARM_BEND_RADIANS, POSE_ARM_CHAINS, POSE_ARM_LOWER_RADIANS, POSE_BREATH_SECONDS, POSE_CHEST_BREATH_RADIANS, POSE_CROSSFADE_SECONDS, POSE_GAITS, POSE_SHOULDER_BREATH_RADIANS, PRECIPITATION_COUNT, PRECIPITATION_SETTINGS_MAP, PRECIPITATION_SWAY_SPEED, PRECIPITATION_VOLUME_HEIGHT, PRECIPITATION_VOLUME_SIZE, PmxBoneFlag, PmxJointKind, PmxMaterialFlag, PmxMorphKind, PmxPhysicsMode, PmxReader, PmxRigidBodyShape, PmxSphereMode, PmxTextEncoding, PmxWeightDeform, PrecipitationKind, QualityTier, QualityTierSettingsMap, RAMP_ROW_BASE, RAMP_ROW_STEP, REGION_FLOORS, RELEASE_TIME_CONSTANTS, RIVER_BEND_FOAM_ATTRIBUTE, RampLayout, RoofKind, SHARED_TOON_RAMP_SHADES, SOUND_EFFECT_BAND_EDGES, SOUND_EFFECT_FRAME_LENGTH, SPECTRAL_ANGULAR_BIN_COUNT, SPECTRAL_RADIAL_BIN_COUNT, SPHERE_CAST_STRIDE_SHARE, SPLASH_COUNT, SPLASH_LIFETIME, SPLASH_LIFT, SPLASH_OPACITY, SPLASH_RADIUS, SPLASH_SIZE, SPRINT_STAMINA_PER_SECOND, STAMINA_MAX, STAMINA_REFILL_DELAY_SECONDS, STAMINA_REFILL_PER_SECOND, STAMINA_REFILL_STATES, STEEP_SLIDE_SPEED, STONE_DARKENING_TOP, STONE_HARMONIC_COUNT, STONE_HEIGHT_FALLOFF, STONE_MASK_OUTPUT, STONE_RAMP_KNOT_COUNT, STONE_SHADOW_EXPONENT, SUN_REDRAW_COSINE, SURFACE_DETAIL_BAND_SIGMAS, SURFACE_OCTAVE_RESPONSES, SURFACE_OCTAVE_TEXEL_FREQUENCIES, SWIM_DASH_STAMINA_COST, SWIM_DASH_STAMINA_PER_SECOND, SWIM_STROKE_SECONDS, SWIM_STROKE_STAMINA_COST, SharedToonOutlinePassNode, StoneLightingModel, StoneNodeMaterial, TERRAIN_CELL_SIZE, TERRAIN_HEIGHT_PADDING, TERRAIN_LAYER, TERRAIN_RING_INITIAL_TILE_COUNT, TILE_INDEX_OFFSET, TILE_INDEX_SPAN, TONE_CONTRAST_OFFSET, TONE_CURVE_FLOOR, TONE_CURVE_LIFT, TOON_HIGH, TOON_LOW, TerrainFeatureKind, TerrainFeatureKindBlendMap, ToonNodeMaterial, UNIT_OUTLINE_WIDTH_KNOTS, WALK_MOVE_MAGNITUDE, WALL_PRESS_SPEED, WALL_PROBE_DISTANCE, WATER_LOCOMOTION_STATES, WEATHER_SETTINGS_MAP, WEATHER_TRANSITION_SECONDS, WET_DARKENING, WET_SHEEN_POWER, WET_SHEEN_STRENGTH, WeatherKind, addSmoothLoop, advanceGameClock, advanceStridePhase, applyLightningFlash, applyPrecipitationSettings, applySkyState, applyStoneLight, applyWeatherState, attachInspector, bakeImpostor, blendGridNodes, blendWeatherState, checkIsPmxSphereDrawn, checkSunTurned, checkTerrainBoundsOverlap, checkTerrainDrawsChanged, checkTerrainTileCasts, checkTransparentTexels, collectMusicNotes, collectMusicSegments, computeCharacterPose, computeGradeLut, computeGrassBlade, computeGrassTrailCell, computeGrassTrailTexel, computeGrassTrailTexelIndex, computeImpostorFade, computeLeafCards, computeLightningBolt, computeLightningFlash, computeLocomotionState, computeNoiseSamples, computeOriginShift, computeOutlineDistance, computeRampValues, computeScatterPoints, computeSoundEffectSamples, computeStatueSurface, computeStoneDarkening, computeStoneHarmonics, computeStoneRampCoordinate, computeSunDirection, computeSurfaceOctaves, computeTerrainIndices, computeTerrainTile, computeTreeTubes, computeWhiteBalance, computeWindGust, createBoxesGeometry, createBuildingGeometry, createCausticsNode, createCharacterController, createCharacterMaterial, createCharacterPoseRotations, createCharacterPoser, createCharacterShadingInputs, createCharacterShadingNode, createCloudAtlasTexture, createCloudBandSprite, createCloudLayerNode, createCloudLayerProfileTexture, createCloudLayerTexture, createCloudLayerTextures, createCloudLayerUniforms, createDitherFadeNode, createFaceDraw, createFaceShadeNode, createFixedStepLoop, createFlowerGeometry, createFlowerMaterial, createFlowerTileGeometry, createFogUniforms, createFollowCamera, createFreeCamera, createFrustumVisibility, createGameOutlineMaterial, createGaussianHillsHeight, createGenshinRenderer, createGodraysLight, createGradeLutTexture, createGrassBladePoint, createGrassCell, createGrassCulling, createGrassGeometry, createGrassMaterial, createGrassTrail, createGroundCapture, createGroundLayerWeights, createGroundPaintColor, createGroundQuery, createHeightFogNode, createImpostorMaterial, createIndexedGeometry, createInput, createInstanceCulling, createInstanceMatrixBuffer, createInstanceMatrixNode, createInstancedGeometry, createInstancedMesh, createInstrumentWave, createLandmarkCollider, createLatheStackGeometry, createLeafMaterial, createLeafShapeNode, createLightUniforms, createLightningBoltGeometry, createLightningBoltMaterial, createMaterialDetailNode, createMusicPlayer, createNoiseBuffer, createObjectFadeNode, createObjectSurfaceNode, createOcclusionNode, createOutlineColorNode, createOutlineMaterial, createOutlineScaleNode, createPavingGeometry, createPavingStoneGeometry, createPlantCulling, createPmxGeometry, createPmxMesh, createPmxSkeleton, createPmxTexture, createPmxToonTexture, createPostPipeline, createPostUniforms, createPrecipitationGeometry, createPrecipitationMaterial, createPrecipitationUniforms, createRampColumnNode, createRampTexture, createRampUvNode, createResidualHeight, createRimNode, createRiverGeometry, createRiverMaterial, createSeededRandom, createShadingRegionNode, createSightNode, createSightUniforms, createSimplexNoise, createSkyColorNode, createSkyGradientTexture, createSkyNode, createSkyState, createSkyUniforms, createSoundEffectBuffer, createSplashMaterial, createStamina, createStatueGeometries, createStoneGlowNode, createStoneLightUniforms, createStoneMaterial, createSunLight, createSunVisibilityNode, createSurfaceDetailNode, createSurvivorIndices, createTerrainFeaturesBlend, createTerrainFeaturesHeight, createTerrainMaterial, createTerrainRing, createTerrainSelection, createTerrainShapeHeight, createTerrainTileGeometry, createTileStreamer, createToneNode, createToonMaterial, createToonThresholdNode, createTreeGeometry, createUnderwaterFogState, createWaterFlowUniforms, createWaterMaterial, createWaterUniforms, createWaterfallGeometry, createWaterfallMaterial, createWetDarkeningNode, createWetSheenNode, createWindNode, createWindUniforms, fileByCell, findSkinnedMesh, getCliffBlend, getCloudAtlasColumns, getCloudSunColors, getDesaturatedColour, getGameOutlineOffset, getGaussianHillBlend, getMusicRecordingGain, getMusicRecordingRate, getOutlineDepth, getOutlineScale, getParentTerrainTileKey, getPlateauBlend, getRampColumn, getRampRow, getRampWidth, getRidgeBlend, getScreenDirection, getSegmentBounds, getShadingRegion, getSharedToonRamp, getSoundEffectBandBins, getSpectralBin, getTerrainFeatureBounds, getTerrainMorphStart, getTerrainOverlayBounds, getTerrainShapeLevel, getTerrainTileBounds, getTerrainTileColumn, getTerrainTileKey, getTerrainTileLevel, getTerrainTileRow, getToneColour, getToonThreshold, measureSegment, mergeGeometryParts, orderByViewDepth, parsePmx, parsePmxBones, parsePmxJoints, parsePmxMaterials, parsePmxMorphs, parsePmxRigidBodies, parsePmxVertices, placeCloudBand, renderGroundCapture, renderMusicSegment, resolveTerrainDraws, sampleGrassTrail, sampleGroundCapture, sampleGroundLayerField, sampleSkyState, sampleTerrainResidualFade, sampleTreeNormalField, scheduleMusicExpression, scheduleMusicNote, scheduleMusicRecording, selectMusicSample, selectRegionNode, selectTerrainTiles, setObjectFade, setObjectSurface, stepGrassTrail, synthesizeCloudLayerTextures, synthesizeSpectralNoise, toSceneColor, toneMapGenshin, toneMapGenshinNode, transformFourier, transformFourierGrid, updateFaceDraw, updateUnderwaterFog, writeCloudLayerTexture, writeQuadIndices, writeTerrainRingIndices, writeTerrainRingTile };