genshin-engine 4.1.2 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -71,7 +71,7 @@ A web worker generating the ground imports its generators from the `genshin-engi
71
71
 
72
72
  ## <a name="documentation">📖 Documentation</a>
73
73
 
74
- We highly recommend you take a look at the [documentation](https://esposter.com/docs/api/modules/genshin-engine.html) to level up. The engine's design, from the order a frame runs in to each module's job, is its [architecture page](https://esposter.com/docs/genshin/engine-architecture), and the look it draws is its [rendering style](https://esposter.com/docs/genshin/rendering-style).
74
+ We highly recommend you take a look at the [documentation](https://github.com/Esposter/Esposter/tree/main/openspec/specs/genshin) to level up. The engine's design, from the order a frame runs in to each module's job, is its [architecture page](https://github.com/Esposter/Esposter/blob/main/openspec/specs/genshin/engine-architecture/design.md), and the look it draws is its [rendering style](https://github.com/Esposter/Esposter/blob/main/openspec/specs/genshin/rendering-style/design.md).
75
75
 
76
76
  ## <a name="license">⚖️ License</a>
77
77
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { A as CliffFeature, C as GroundLayerField, D as GroundBand, E as GroundLayers, O as GaussianHills, S as GroundPathSegment, T as GroundLayer, _ as TerrainOptions, a as createTerrainShapeHeight, b as PlateauFeature, c as computeTerrainTile, d as TerrainTileOptions, f as TerrainShape, g as TerrainResidualClearing, h as TerrainResidualFade, i as getTerrainTileColumn, j as TerrainFeatureKind, k as GaussianHill, l as createSeededRandom, m as TerrainResidual, n as getTerrainTileRow, o as createGroundPaintColor, p as TerrainTile, r as getTerrainTileLevel, s as createGroundLayerWeights, t as computeScatterPoints, u as ScatterOptions, v as TerrainFeature, w as GroundLayerColors, x as GroundPaint, y as RidgeFeature } from "./terrainWorker-CLOYYKT1.js";
2
2
  import { Box3, BufferAttribute, BufferGeometry, Camera, CanvasTexture, Color, ColorRepresentation, Data3DTexture, DataTexture, DirectionalLight, Frustum, HemisphereLight, InstancedBufferGeometry, InstancedMesh, Material, Matrix3, Matrix4, Mesh, Object3D, OrthographicCamera, PerspectiveCamera, Quaternion, Scene, Skeleton, SkinnedMesh, Sprite, Texture, ToneMapping, Vector2, Vector3, Vector3Like, Vector3Tuple, Vector4Tuple } from "three";
3
- import { LightingModel, LightingModelDirectInput, Material as Material$1, MeshBasicNodeMaterial, MeshToonNodeMaterial, MeshToonNodeMaterialParameters, Node, NodeBuilder, NodeFrame, NodeMaterial, PassNode, RenderPipeline, RenderTarget, Renderer, Texture as Texture$1, TextureNode, ToonOutlinePassNode, UniformArrayNode, UniformNode, WebGPURenderer } from "three/webgpu";
3
+ import { IndirectStorageBufferAttribute, LightingModel, LightingModelDirectInput, Material as Material$1, MeshBasicNodeMaterial, MeshToonNodeMaterial, MeshToonNodeMaterialParameters, Node, NodeBuilder, NodeFrame, NodeMaterial, PassNode, RenderPipeline, RenderTarget, Renderer, StorageBufferAttribute, Texture as Texture$1, TextureNode, ToonOutlinePassNode, UniformArrayNode, UniformNode, WebGPURenderer } from "three/webgpu";
4
4
  import { CSMShadowNode, CSMShadowNodeData } from "three/examples/jsm/csm/CSMShadowNode.js";
5
5
  import { Capsule } from "three/examples/jsm/math/Capsule.js";
6
6
  import GTAONode from "three/examples/jsm/tsl/display/GTAONode.js";
@@ -260,6 +260,7 @@ export declare enum WeatherKind {
260
260
  Rain = "Rain",
261
261
  Sandstorm = "Sandstorm",
262
262
  Snow = "Snow",
263
+ Snowstorm = "Snowstorm",
263
264
  Thunderstorm = "Thunderstorm"
264
265
  }
265
266
  //#endregion
@@ -640,6 +641,7 @@ export declare const transformFourier: (real: Float64Array, imaginary: Float64Ar
640
641
  export interface FollowCameraSettings {
641
642
  defaultDistance: number;
642
643
  horizontalSensitivity: number;
644
+ slopePitch: boolean;
643
645
  verticalSensitivity: number;
644
646
  }
645
647
  //#endregion
@@ -658,6 +660,7 @@ export declare const FOLLOW_CAMERA_MIN_DISTANCE = 1;
658
660
  export declare const FOLLOW_CAMERA_MAX_DISTANCE = 6;
659
661
  export declare const FOLLOW_CAMERA_DISTANCE_PER_ZOOM_STEP = .5;
660
662
  export declare const FOLLOW_CAMERA_EASE_OUT_SPEED = 4;
663
+ export declare const FOLLOW_CAMERA_SLOPE_PITCH_SPEED = 4;
661
664
  export declare const FOLLOW_CAMERA_CLEARANCE = .2;
662
665
  export declare const FOLLOW_CAMERA_ARM_STEP = .25;
663
666
  //#endregion
@@ -722,6 +725,7 @@ export interface FollowCamera {
722
725
  follow: (pivot: Vector3, origin: Vector3, frameSeconds: number) => void;
723
726
  look: (input: InputState, facing: number) => void;
724
727
  reset: (facing: number) => void;
728
+ returnToDefaultDistance: () => void;
725
729
  readonly yaw: number;
726
730
  }
727
731
  //#endregion
@@ -776,11 +780,21 @@ export interface FreeCameraOptions {
776
780
  //#region src/camera/createFreeCamera.d.ts
777
781
  export declare const createFreeCamera: ({ camera, ground }: FreeCameraOptions) => FreeCamera;
778
782
  //#endregion
783
+ //#region src/models/character/PmxSphereMode.d.ts
784
+ export declare enum PmxSphereMode {
785
+ Disabled = 0,
786
+ Multiply = 1,
787
+ Add = 2,
788
+ AdditionalUv = 3
789
+ }
790
+ //#endregion
791
+ //#region src/character/checkIsPmxSphereDrawn.d.ts
792
+ export declare const checkIsPmxSphereDrawn: (sphereMode: PmxSphereMode) => sphereMode is PmxSphereMode.Add | PmxSphereMode.Multiply;
793
+ //#endregion
779
794
  //#region src/character/checkTransparentTexels.d.ts
780
795
  export declare const checkTransparentTexels: (image: ImageBitmap) => boolean;
781
796
  //#endregion
782
797
  //#region src/character/constants.d.ts
783
- export declare const PMX_UNIT_METRES = .08;
784
798
  export declare const SHARED_TOON_RAMP_SHADES: readonly number[];
785
799
  //#endregion
786
800
  //#region src/models/character/CharacterMaterialKind.d.ts
@@ -821,6 +835,12 @@ export interface ShadingRegionToggles {
821
835
  two: boolean;
822
836
  }
823
837
  //#endregion
838
+ //#region src/models/nodes/OutlineWidthKnots.d.ts
839
+ export interface OutlineWidthKnots {
840
+ depths: Vector3Tuple;
841
+ scales: Vector3Tuple;
842
+ }
843
+ //#endregion
824
844
  //#region src/models/character/CharacterShadingInputs.d.ts
825
845
  export interface CharacterShadingInputs {
826
846
  brightness: number;
@@ -847,13 +867,12 @@ export interface CharacterShadingInputs {
847
867
  metalDarkColor: Vector3Tuple;
848
868
  metalLightColor: Vector3Tuple;
849
869
  metalTexture?: Texture;
850
- outlineDepths: Vector3Tuple;
851
870
  outlineOffset?: {
852
871
  blockBChannel: number;
853
872
  size: number;
854
873
  };
855
874
  outlineRegions?: OutlineRegions;
856
- outlineScales: Vector3Tuple;
875
+ outlineWidthKnots: OutlineWidthKnots;
857
876
  rampLayout: RampLayout;
858
877
  rampTexture: Texture;
859
878
  rampWidth: number;
@@ -864,18 +883,14 @@ export interface CharacterShadingInputs {
864
883
  specularColor: Vector3Tuple;
865
884
  specularInShadow: number;
866
885
  specularMultiplier: number;
886
+ sphere?: {
887
+ mode: PmxSphereMode.Add | PmxSphereMode.Multiply;
888
+ texture: Texture;
889
+ };
867
890
  vertexAo: number;
868
891
  vertexRampWidth: number;
869
892
  }
870
893
  //#endregion
871
- //#region src/models/character/PmxSphereMode.d.ts
872
- export declare enum PmxSphereMode {
873
- Disabled = 0,
874
- Multiply = 1,
875
- Add = 2,
876
- AdditionalUv = 3
877
- }
878
- //#endregion
879
894
  //#region src/models/character/PmxMaterial.d.ts
880
895
  export interface PmxMaterial {
881
896
  ambientColor: Vector3Tuple;
@@ -907,12 +922,6 @@ export interface CharacterMaterialOptions {
907
922
  toonTexture?: Texture;
908
923
  }
909
924
  //#endregion
910
- //#region src/models/nodes/OutlineWidthKnots.d.ts
911
- export interface OutlineWidthKnots {
912
- depths: Vector3Tuple;
913
- scales: Vector3Tuple;
914
- }
915
- //#endregion
916
925
  //#region src/models/nodes/ToonEdge.d.ts
917
926
  export interface ToonEdge {
918
927
  color: Node<"vec4"> | Vector4Tuple;
@@ -929,6 +938,7 @@ export interface ToonEdge {
929
938
  export declare class ToonNodeMaterial extends MeshToonNodeMaterial {
930
939
  edge?: ToonEdge;
931
940
  emissiveNode: Node | null;
941
+ instanceMatrix?: Node<"mat4">;
932
942
  readonly isMeshToonMaterial: boolean;
933
943
  override readonly isMeshToonNodeMaterial: boolean;
934
944
  sphereMap?: Texture$1;
@@ -939,7 +949,7 @@ export declare class ToonNodeMaterial extends MeshToonNodeMaterial {
939
949
  export declare 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 }: CharacterMaterialOptions) => ToonNodeMaterial;
940
950
  //#endregion
941
951
  //#region src/character/createCharacterShadingInputs.d.ts
942
- export type CharacterShadingOverrides = Partial<CharacterShadingInputs> & {
952
+ type CharacterShadingOverrides = Partial<CharacterShadingInputs> & {
943
953
  rampTexture: Texture;
944
954
  };
945
955
  export declare const createCharacterShadingInputs: (overrides: CharacterShadingOverrides) => CharacterShadingInputs;
@@ -1059,7 +1069,7 @@ export interface PmxModel {
1059
1069
  export declare const createPmxGeometry: ({ indices, materials, vertices: { normals, positions, skinIndices, skinWeights, subUvs, uvs } }: Pick<PmxModel, "indices" | "materials" | "vertices">) => BufferGeometry;
1060
1070
  //#endregion
1061
1071
  //#region src/character/createPmxMesh.d.ts
1062
- export declare const createPmxMesh: <TMaterial extends Material>(pmxModel: PmxModel, materials: TMaterial[]) => SkinnedMesh<BufferGeometry, TMaterial[]>;
1072
+ export declare const createPmxMesh: <TMaterial extends Material>(pmxModel: PmxModel, materials: TMaterial[], unitMetres: number) => SkinnedMesh<BufferGeometry, TMaterial[]>;
1063
1073
  //#endregion
1064
1074
  //#region src/character/createPmxSkeleton.d.ts
1065
1075
  export declare const createPmxSkeleton: (pmxBones: readonly PmxBone[]) => Skeleton;
@@ -1251,7 +1261,7 @@ export interface LocomotionPhase {
1251
1261
  export interface CharacterPoser {
1252
1262
  update: (update: CharacterPoseUpdate) => void;
1253
1263
  }
1254
- export interface CharacterPoseUpdate {
1264
+ interface CharacterPoseUpdate {
1255
1265
  delta: number;
1256
1266
  locomotion: Locomotion;
1257
1267
  phase: LocomotionPhase;
@@ -1279,6 +1289,7 @@ export declare const MINIMUM_RAMP_WIDTH_VERTEX = .01;
1279
1289
  export declare const MINIMUM_OUTLINE_KNOT_SPAN = .001;
1280
1290
  export declare const OUTLINE_PROJECTION_SCALE = 2.414;
1281
1291
  export declare const OUTLINE_WIDTH_SCALE = .41425;
1292
+ export declare const UNIT_OUTLINE_WIDTH_KNOTS: OutlineWidthKnots;
1282
1293
  export declare const OUTLINE_MAIN_TEXTURE_SHARE = .2;
1283
1294
  export declare const DESATURATION_WEIGHTS: readonly [number, number, number];
1284
1295
  export declare const HALF_LAMBERT_SCALE = .4975;
@@ -1358,7 +1369,7 @@ export declare const getShadingRegion: (alpha: number, toggles: ShadingRegionTog
1358
1369
  export declare const getToneColour: (colour: Vector3, desaturateScale: number, contrastScale: number) => Vector3;
1359
1370
  //#endregion
1360
1371
  //#region src/character/shading/getToonThreshold.d.ts
1361
- export interface ToonThresholdInputs {
1372
+ interface ToonThresholdInputs {
1362
1373
  isLightMapAo: boolean;
1363
1374
  isVertexAo: boolean;
1364
1375
  lightMapGreen: number;
@@ -1400,6 +1411,46 @@ export declare const createLandmarkCollider: () => LandmarkCollider;
1400
1411
  //#region src/constants.d.ts
1401
1412
  export declare const MAX_BYTE = 255;
1402
1413
  //#endregion
1414
+ //#region src/culling/constants.d.ts
1415
+ export declare const CULLING_FRUSTUM_MARGIN = .1;
1416
+ export declare const CULLING_INDIRECT_ARGUMENT_COUNT = 5;
1417
+ export declare const CULLING_INDEX_COUNT_INDEX = 0;
1418
+ export declare const CULLING_INSTANCE_COUNT_INDEX = 1;
1419
+ export declare const CULLING_MIN_SIZE = 1e-4;
1420
+ export declare const CULLING_MATRIX_COLUMN_COUNT = 4;
1421
+ export declare const CULLING_MATRIX_ELEMENT_COUNT: number;
1422
+ //#endregion
1423
+ //#region src/culling/createFrustumVisibility.d.ts
1424
+ export declare const createFrustumVisibility: (clipFromModel: UniformNode<"mat4", Matrix4>, point: Node<"vec3">) => Node<"float">;
1425
+ //#endregion
1426
+ //#region src/models/culling/InstanceCulling.d.ts
1427
+ export interface InstanceCulling {
1428
+ cull: (renderer: Renderer) => void;
1429
+ dispose: () => void;
1430
+ indirect: IndirectStorageBufferAttribute;
1431
+ survivor: Node<"float">;
1432
+ }
1433
+ //#endregion
1434
+ //#region src/culling/createInstanceCulling.d.ts
1435
+ interface InstanceCullingOptions {
1436
+ count: number;
1437
+ indexCount: number;
1438
+ isVisible: (instance: Node<"float">) => Node<"float">;
1439
+ }
1440
+ export declare const createInstanceCulling: ({ count, indexCount, isVisible }: InstanceCullingOptions) => InstanceCulling;
1441
+ //#endregion
1442
+ //#region src/culling/createInstanceMatrixBuffer.d.ts
1443
+ export declare const createInstanceMatrixBuffer: (matrices: Matrix4[]) => StorageBufferAttribute;
1444
+ //#endregion
1445
+ //#region src/culling/createInstanceMatrixNode.d.ts
1446
+ export declare const createInstanceMatrixNode: (attribute: StorageBufferAttribute, instance: Node<"float">) => Node<"mat4">;
1447
+ //#endregion
1448
+ //#region src/culling/createInstancedGeometry.d.ts
1449
+ export declare const createInstancedGeometry: (geometry: BufferGeometry, instanceCount: number) => InstancedBufferGeometry;
1450
+ //#endregion
1451
+ //#region src/culling/createSurvivorIndices.d.ts
1452
+ export declare const createSurvivorIndices: (count: number) => Uint32Array;
1453
+ //#endregion
1403
1454
  //#region src/input/InputActionBindingMap.d.ts
1404
1455
  export declare const InputActionBindingMap: Readonly<Record<InputAction, readonly (readonly string[])[]>>;
1405
1456
  //#endregion
@@ -1456,8 +1507,29 @@ export interface Input {
1456
1507
  turn: (lookYaw: number, lookPitch: number) => void;
1457
1508
  }
1458
1509
  //#endregion
1510
+ //#region src/models/input/InputGamepad.d.ts
1511
+ export interface InputGamepad {
1512
+ axes: readonly number[];
1513
+ buttons: readonly {
1514
+ pressed: boolean;
1515
+ }[];
1516
+ }
1517
+ //#endregion
1518
+ //#region src/models/input/InputTarget.d.ts
1519
+ export interface InputTarget extends Pick<Window, "addEventListener"> {
1520
+ document: {
1521
+ activeElement: null | {
1522
+ matches: (selectors: string) => boolean;
1523
+ };
1524
+ pointerLockElement: null | object;
1525
+ };
1526
+ navigator: {
1527
+ getGamepads: () => (InputGamepad | null)[];
1528
+ };
1529
+ }
1530
+ //#endregion
1459
1531
  //#region src/input/createInput.d.ts
1460
- export declare const createInput: (target: Window) => Input;
1532
+ export declare const createInput: (target: InputTarget) => Input;
1461
1533
  //#endregion
1462
1534
  //#region src/kits/architecture/createBoxesGeometry.d.ts
1463
1535
  export declare const createBoxesGeometry: (boxes: readonly (readonly number[])[]) => BufferGeometry;
@@ -1688,6 +1760,7 @@ export interface Stamina {
1688
1760
  checkCanSpend: (amount: number) => boolean;
1689
1761
  maximum: number;
1690
1762
  refill: () => void;
1763
+ restore: (amount: number) => void;
1691
1764
  spend: (amount: number) => void;
1692
1765
  step: (phase: LocomotionPhase, isEntered: boolean, isMoving: boolean, stepSeconds: number) => void;
1693
1766
  value: number;
@@ -1708,16 +1781,22 @@ export interface CharacterController {
1708
1781
  }
1709
1782
  //#endregion
1710
1783
  //#region src/models/locomotion/CharacterControllerOptions.d.ts
1711
- export interface CharacterControllerOptions {
1784
+ export type CharacterControllerOptions = ({
1712
1785
  getStaminaConsumptionMultiplier?: () => number;
1786
+ stamina?: never;
1787
+ staminaMaximum: number;
1788
+ } | {
1789
+ getStaminaConsumptionMultiplier?: never;
1790
+ stamina: Stamina;
1791
+ staminaMaximum?: never;
1792
+ }) & {
1713
1793
  ground: GroundQuery;
1714
1794
  landmarkCollider: LandmarkCollider;
1715
1795
  position: Vector3;
1716
- staminaMaximum: number;
1717
- }
1796
+ };
1718
1797
  //#endregion
1719
1798
  //#region src/locomotion/createCharacterController.d.ts
1720
- export declare const createCharacterController: ({ getStaminaConsumptionMultiplier, ground, landmarkCollider, position, staminaMaximum }: CharacterControllerOptions) => CharacterController;
1799
+ export declare const createCharacterController: (options: CharacterControllerOptions) => CharacterController;
1721
1800
  //#endregion
1722
1801
  //#region src/locomotion/createStamina.d.ts
1723
1802
  export declare const createStamina: (maximum: number, getStaminaConsumptionMultiplier?: () => number) => Stamina;
@@ -1771,6 +1850,20 @@ export declare enum PmxWeightDeform {
1771
1850
  DualQuaternion = 4
1772
1851
  }
1773
1852
  //#endregion
1853
+ //#region src/models/culling/PlantCullingOptions.d.ts
1854
+ export interface PlantCullingOptions {
1855
+ attribute: StorageBufferAttribute;
1856
+ bounds: {
1857
+ bottom: number;
1858
+ halfWidth: number;
1859
+ height: number;
1860
+ };
1861
+ clipFromModel: UniformNode<"mat4", Matrix4>;
1862
+ drawDistance: number;
1863
+ eye: UniformNode<"vec3", Vector3>;
1864
+ indexCount: number;
1865
+ }
1866
+ //#endregion
1774
1867
  //#region src/models/vegetation/Impostor.d.ts
1775
1868
  export interface Impostor {
1776
1869
  albedoTarget: RenderTarget;
@@ -1784,6 +1877,7 @@ export interface Impostor {
1784
1877
  export interface ImpostorMaterialOptions {
1785
1878
  fade: Node<"float">;
1786
1879
  impostor: Impostor;
1880
+ instanceMatrix?: Node<"mat4">;
1787
1881
  lightUniforms: LightUniforms;
1788
1882
  rampTexture: DataTexture;
1789
1883
  }
@@ -1913,6 +2007,7 @@ export interface SurfaceDetail {
1913
2007
  export interface ToonMaterialOptions {
1914
2008
  color?: ColorRepresentation;
1915
2009
  detail?: SurfaceDetail;
2010
+ instanceMatrix?: Node<"mat4">;
1916
2011
  isObjectSurface?: boolean;
1917
2012
  isOutlined?: boolean;
1918
2013
  isVertexColors?: boolean;
@@ -1921,7 +2016,7 @@ export interface ToonMaterialOptions {
1921
2016
  }
1922
2017
  //#endregion
1923
2018
  //#region src/models/nodes/createOutlineMaterial.d.ts
1924
- export declare const createOutlineMaterial: (colorNode: Node<"vec4">, thicknessNode: Node<"float">) => NodeMaterial;
2019
+ export declare const createOutlineMaterial: (colorNode: Node<"vec4">, thicknessNode: Node<"float">, instanceMatrix?: Node<"mat4">) => NodeMaterial;
1925
2020
  export declare const createGameOutlineMaterial: (colorNode: Node<"vec4">, widthNode: Node<"float">, offsetNode: Node<"float">) => NodeMaterial;
1926
2021
  //#endregion
1927
2022
  //#region src/models/nodes/getGameOutlineOffset.d.ts
@@ -2047,12 +2142,11 @@ export interface TerrainSelection {
2047
2142
  //#endregion
2048
2143
  //#region src/models/streaming/TileStreamer.d.ts
2049
2144
  export interface TileStreamer<TTile> {
2145
+ checkIsSettled: (key: number) => boolean;
2050
2146
  dispose: () => void;
2051
2147
  fail: (key: number) => boolean;
2052
2148
  get: (key: number) => TTile | undefined;
2053
2149
  has: (key: number) => boolean;
2054
- isSettled: (key: number) => boolean;
2055
- pendingKeys: () => number[];
2056
2150
  receive: (key: number, tile: TTile) => void;
2057
2151
  refresh: (checkIsChanged: (key: number) => boolean) => void;
2058
2152
  update: (wanted: TerrainSelection, drawn: TerrainSelection, surrounding: TerrainSelection) => void;
@@ -2092,6 +2186,14 @@ export interface GrassBlade {
2092
2186
  positions: Float32Array;
2093
2187
  }
2094
2188
  //#endregion
2189
+ //#region src/models/vegetation/GrassCell.d.ts
2190
+ export interface GrassCell {
2191
+ angle: Node<"float">;
2192
+ captured: Node<"vec4">;
2193
+ ground: Node<"vec2">;
2194
+ size: Node<"float">;
2195
+ }
2196
+ //#endregion
2095
2197
  //#region src/models/vegetation/GrassRing.d.ts
2096
2198
  export interface GrassRing {
2097
2199
  cellsPerSide: number;
@@ -2102,12 +2204,47 @@ export interface GrassRing {
2102
2204
  spacing: number;
2103
2205
  }
2104
2206
  //#endregion
2207
+ //#region src/models/vegetation/GrassCellOptions.d.ts
2208
+ export interface GrassCellOptions {
2209
+ cameraGround: UniformNode<"vec2", Vector2>;
2210
+ density: UniformNode<"float", number>;
2211
+ groundCapture: GroundCapture;
2212
+ index: Node<"float">;
2213
+ ring: GrassRing;
2214
+ waterUniforms: Pick<WaterUniforms, "level">;
2215
+ }
2216
+ //#endregion
2217
+ //#region src/models/vegetation/GrassTrail.d.ts
2218
+ export interface GrassTrail {
2219
+ bends: Float32Array;
2220
+ cells: Float64Array;
2221
+ center: UniformNode<"vec2", Vector2>;
2222
+ data: Uint8Array;
2223
+ texture: DataTexture;
2224
+ }
2225
+ //#endregion
2226
+ //#region src/models/vegetation/GrassCullingOptions.d.ts
2227
+ export interface GrassCullingOptions {
2228
+ bladeHeight: number;
2229
+ cameraGround: UniformNode<"vec2", Vector2>;
2230
+ clipFromModel: UniformNode<"mat4", Matrix4>;
2231
+ density: UniformNode<"float", number>;
2232
+ grassTrail: GrassTrail;
2233
+ groundCapture: GroundCapture;
2234
+ ring: GrassRing;
2235
+ segmentCount: number;
2236
+ waterUniforms: Pick<WaterUniforms, "level">;
2237
+ windUniforms: WindUniforms;
2238
+ }
2239
+ //#endregion
2105
2240
  //#region src/models/vegetation/GrassOptions.d.ts
2106
2241
  export interface GrassOptions {
2107
2242
  bladeHeight: number;
2108
2243
  bladeWidth: number;
2109
2244
  cameraGround: UniformNode<"vec2", Vector2>;
2245
+ cellIndex: Node<"float">;
2110
2246
  density: UniformNode<"float", number>;
2247
+ grassTrail: GrassTrail;
2111
2248
  groundCapture: GroundCapture;
2112
2249
  lightUniforms: LightUniforms;
2113
2250
  rampTexture: DataTexture;
@@ -2120,7 +2257,7 @@ export interface GrassOptions {
2120
2257
  export interface ImpostorPart {
2121
2258
  color: ColorRepresentation;
2122
2259
  geometry: BufferGeometry;
2123
- opacityNode?: Node<"float">;
2260
+ maskNode?: Node<"bool">;
2124
2261
  }
2125
2262
  //#endregion
2126
2263
  //#region src/models/water/RiverCoursePoint.d.ts
@@ -2174,12 +2311,19 @@ export declare const computeStoneHarmonics: ([x, y, z]: readonly number[], harmo
2174
2311
  export declare const computeStoneRampCoordinate: (facing: number, visibility: number) => number;
2175
2312
  //#endregion
2176
2313
  //#region src/nodes/computeSurfaceOctaves.d.ts
2177
- export interface SurfaceOctave {
2314
+ interface SurfaceOctave {
2178
2315
  amplitude: number;
2179
2316
  frequency: number;
2180
2317
  }
2181
2318
  export declare const computeSurfaceOctaves: ({ bands, metresPerTexel, variance }: SurfaceDetail) => SurfaceOctave[];
2182
2319
  //#endregion
2320
+ //#region src/nodes/computeWindGust.d.ts
2321
+ export declare const computeWindGust: (downwind: number, time: number, { gustSpeed, gustStrength, gustWidth }: {
2322
+ gustSpeed: number;
2323
+ gustStrength: number;
2324
+ gustWidth: number;
2325
+ }) => number;
2326
+ //#endregion
2183
2327
  //#region src/nodes/constants.d.ts
2184
2328
  export declare const LEAST_DIVISOR = 1e-4;
2185
2329
  export declare const STONE_SHADOW_EXPONENT = .2;
@@ -2193,7 +2337,7 @@ export declare const WET_SHEEN_POWER = 32;
2193
2337
  export declare const WET_SHEEN_STRENGTH = .25;
2194
2338
  export declare const SURFACE_DETAIL_BAND_SIGMAS: number[];
2195
2339
  export declare const SURFACE_OCTAVE_TEXEL_FREQUENCIES: number[];
2196
- export declare const SURFACE_DETAIL_RENDER_GAIN = 4;
2340
+ export declare const SURFACE_OCTAVE_RESPONSES: number[][];
2197
2341
  export declare const OBJECT_SURFACE_KEY = "surface";
2198
2342
  export declare const OBJECT_FADE_KEY = "fade";
2199
2343
  export declare const LEAF_SHAPE_WIDTH = .8;
@@ -2209,13 +2353,13 @@ export declare const createCloudLayerNode: ({ center, curl, curlAmplitude, curlS
2209
2353
  export declare const createDitherFadeNode: (visibility: Node<"float">) => Node<"bool">;
2210
2354
  //#endregion
2211
2355
  //#region src/nodes/createImpostorMaterial.d.ts
2212
- export declare const createImpostorMaterial: ({ fade, impostor, lightUniforms, rampTexture }: ImpostorMaterialOptions) => ToonNodeMaterial;
2356
+ export declare const createImpostorMaterial: ({ fade, impostor, instanceMatrix, lightUniforms, rampTexture }: ImpostorMaterialOptions) => ToonNodeMaterial;
2213
2357
  //#endregion
2214
2358
  //#region src/nodes/createLeafMaterial.d.ts
2215
- export declare const createLeafMaterial: (toonMaterialOptions: ToonMaterialOptions, windUniforms?: WindUniforms) => ToonNodeMaterial;
2359
+ export declare const createLeafMaterial: (toonMaterialOptions: ToonMaterialOptions, windUniforms?: WindUniforms, maskNode?: Node<"bool">) => ToonNodeMaterial;
2216
2360
  //#endregion
2217
2361
  //#region src/nodes/createLeafShapeNode.d.ts
2218
- export declare const createLeafShapeNode: () => Node<"float">;
2362
+ export declare const createLeafShapeNode: () => Node<"bool">;
2219
2363
  //#endregion
2220
2364
  //#region src/nodes/createLightUniforms.d.ts
2221
2365
  export declare const createLightUniforms: () => LightUniforms;
@@ -2223,6 +2367,9 @@ export declare const createLightUniforms: () => LightUniforms;
2223
2367
  //#region src/nodes/createLightningBoltMaterial.d.ts
2224
2368
  export declare const createLightningBoltMaterial: (flash: UniformNode<"float", number>) => MeshBasicNodeMaterial;
2225
2369
  //#endregion
2370
+ //#region src/nodes/createMaterialDetailNode.d.ts
2371
+ export declare const createMaterialDetailNode: (detail: SurfaceDetail) => Node<"float">;
2372
+ //#endregion
2226
2373
  //#region src/nodes/createObjectFadeNode.d.ts
2227
2374
  export declare const createObjectFadeNode: () => Node<"float">;
2228
2375
  //#endregion
@@ -2235,6 +2382,9 @@ export declare const createPrecipitationMaterial: ({ lightUniforms, precipitatio
2235
2382
  //#region src/nodes/createRimNode.d.ts
2236
2383
  export declare const createRimNode: ({ rimColor, rimStrength, sunDirection }: LightUniforms) => Node<"vec3">;
2237
2384
  //#endregion
2385
+ //#region src/nodes/createRiverMaterial.d.ts
2386
+ export declare const createRiverMaterial: (lightUniforms: LightUniforms, skyUniforms: SkyUniforms, waterUniforms: WaterUniforms) => MeshBasicNodeMaterial;
2387
+ //#endregion
2238
2388
  //#region src/nodes/createSkyColorNode.d.ts
2239
2389
  export declare const createSkyColorNode: ({ frontBackBlend, haloColor, haloHeight, horizonBackColor, horizonBand, horizonColor, sunDirection, sunHaloColor, sunHaloSize, zenithBackColor, zenithColor }: SkyUniforms, gradient: Texture, direction: Node<"vec3">) => Node<"vec3">;
2240
2390
  //#endregion
@@ -2260,7 +2410,7 @@ export declare const createSunVisibilityNode: (lightColor: Node, sunRadiance: Un
2260
2410
  export declare const createSurfaceDetailNode: (amplitudes: Node<"float">[], texelsPerMetre: Node<"float">) => Node<"float">;
2261
2411
  //#endregion
2262
2412
  //#region src/nodes/createToonMaterial.d.ts
2263
- export declare const createToonMaterial: ({ color, detail, isObjectSurface, isOutlined, isVertexColors, lightUniforms, rampTexture }: ToonMaterialOptions) => ToonNodeMaterial;
2413
+ export declare const createToonMaterial: ({ color, detail, instanceMatrix, isObjectSurface, isOutlined, isVertexColors, lightUniforms, rampTexture }: ToonMaterialOptions) => ToonNodeMaterial;
2264
2414
  //#endregion
2265
2415
  //#region src/nodes/createWaterMaterial.d.ts
2266
2416
  export declare const createWaterMaterial: ({ lightColor, sunDirection }: Pick<LightUniforms, "lightColor" | "sunDirection">, { horizonColor, zenithColor }: Pick<SkyUniforms, "horizonColor" | "zenithColor">, { deepColor, deepDepth, foamColor, foamDepth, shallowColor }: WaterUniforms, { direction, speed }: WaterFlow, bendFoam?: Node<"float">) => MeshBasicNodeMaterial;
@@ -2283,6 +2433,9 @@ export declare const getCloudSunColors: ({ cloudFrontBackBlend, cloudLitBackColo
2283
2433
  shade: Node<"vec3">;
2284
2434
  };
2285
2435
  //#endregion
2436
+ //#region src/nodes/sampleGrassTrail.d.ts
2437
+ export declare const sampleGrassTrail: (grassTrail: GrassTrail, ground: Node<"vec2">) => Node<"vec2">;
2438
+ //#endregion
2286
2439
  //#region src/nodes/sampleGroundCapture.d.ts
2287
2440
  export declare const sampleGroundCapture: (groundCapture: GroundCapture, ground: Node<"vec2">) => {
2288
2441
  captured: Node<"vec4">;
@@ -2509,6 +2662,18 @@ export declare const bakeImpostor: (renderer: Renderer, parts: readonly Impostor
2509
2662
  //#region src/vegetation/computeGrassBlade.d.ts
2510
2663
  export declare const computeGrassBlade: (segmentCount: number) => GrassBlade;
2511
2664
  //#endregion
2665
+ //#region src/vegetation/computeGrassTrailCell.d.ts
2666
+ export declare const computeGrassTrailCell: (coordinate: number, texelSize: number) => number;
2667
+ //#endregion
2668
+ //#region src/vegetation/computeGrassTrailTexel.d.ts
2669
+ export declare const computeGrassTrailTexel: (cell: number) => number;
2670
+ //#endregion
2671
+ //#region src/vegetation/computeGrassTrailTexelIndex.d.ts
2672
+ export declare const computeGrassTrailTexelIndex: (cellX: number, cellZ: number) => number;
2673
+ //#endregion
2674
+ //#region src/vegetation/computeImpostorFade.d.ts
2675
+ export declare const computeImpostorFade: (distance: number, impostorHeight: number) => number;
2676
+ //#endregion
2512
2677
  //#region src/vegetation/constants.d.ts
2513
2678
  export declare const IMPOSTOR_RESOLUTION = 256;
2514
2679
  export declare const IMPOSTOR_SWITCH_HEIGHTS = 10;
@@ -2516,6 +2681,16 @@ export declare const IMPOSTOR_CROSSFADE_SHARE = .1;
2516
2681
  export declare const FLOWER_BEND_PER_WIND = .12;
2517
2682
  export declare const FLOWER_MATRIX_ATTRIBUTE_NAMES: readonly ["flowerMatrix0", "flowerMatrix1", "flowerMatrix2", "flowerMatrix3"];
2518
2683
  export declare const FLOWER_COLOR_ATTRIBUTE_NAME = "flowerColor";
2684
+ export declare const GRASS_TRAIL_EXTENT = 16;
2685
+ export declare const GRASS_TRAIL_TEXELS = 64;
2686
+ export declare const GRASS_TRAIL_TEXEL_SIZE: number;
2687
+ export declare const GRASS_TRAIL_STAMP_RADIUS = .6;
2688
+ export declare const GRASS_TRAIL_FADE_SECONDS = 1.5;
2689
+ export declare const GRASS_TRAIL_BEND_SHARE = .9;
2690
+ export declare const GRASS_TRAIL_FADE_START_SHARE = .8;
2691
+ export declare const GRASS_TRAIL_FADE_END_SHARE = .95;
2692
+ export declare const GRASS_BEND_PER_WIND = .9;
2693
+ export declare const GRASS_DIP_PER_BEND = .3;
2519
2694
  //#endregion
2520
2695
  //#region src/vegetation/createFlowerGeometry.d.ts
2521
2696
  export declare const createFlowerGeometry: () => BufferGeometry;
@@ -2526,18 +2701,46 @@ export declare const createFlowerMaterial: (toonMaterialOptions: Pick<ToonMateri
2526
2701
  //#region src/vegetation/createFlowerTileGeometry.d.ts
2527
2702
  export declare const createFlowerTileGeometry: (matrices: Float32Array, colors: Float32Array) => InstancedBufferGeometry;
2528
2703
  //#endregion
2704
+ //#region src/vegetation/createGrassBladePoint.d.ts
2705
+ interface GrassBladePointOptions {
2706
+ bladeHeight: number;
2707
+ captured: Node<"vec4">;
2708
+ grassTrail: GrassTrail;
2709
+ ground: Node<"vec2">;
2710
+ offset: Node<"vec2">;
2711
+ size: Node<"float">;
2712
+ up: Node<"float">;
2713
+ windUniforms: WindUniforms;
2714
+ }
2715
+ export declare const createGrassBladePoint: ({ bladeHeight, captured, grassTrail, ground, offset, size, up, windUniforms }: GrassBladePointOptions) => Node<"vec3">;
2716
+ //#endregion
2717
+ //#region src/vegetation/createGrassCell.d.ts
2718
+ export declare const createGrassCell: ({ cameraGround, density, groundCapture, index, ring, waterUniforms }: GrassCellOptions) => GrassCell;
2719
+ //#endregion
2720
+ //#region src/vegetation/createGrassCulling.d.ts
2721
+ export declare const createGrassCulling: ({ bladeHeight, cameraGround, clipFromModel, density, grassTrail, groundCapture, ring, segmentCount, waterUniforms, windUniforms }: GrassCullingOptions) => InstanceCulling;
2722
+ //#endregion
2529
2723
  //#region src/vegetation/createGrassGeometry.d.ts
2530
2724
  export declare const createGrassGeometry: (segmentCount: number, bladeCount: number) => InstancedBufferGeometry;
2531
2725
  //#endregion
2532
2726
  //#region src/vegetation/createGrassMaterial.d.ts
2533
- export declare const createGrassMaterial: ({ bladeHeight, bladeWidth, cameraGround, density, groundCapture, lightUniforms, rampTexture, ring, waterUniforms, windUniforms }: GrassOptions) => ToonNodeMaterial;
2727
+ export declare const createGrassMaterial: ({ bladeHeight, bladeWidth, cameraGround, cellIndex, density, grassTrail, groundCapture, lightUniforms, rampTexture, ring, waterUniforms, windUniforms }: GrassOptions) => ToonNodeMaterial;
2728
+ //#endregion
2729
+ //#region src/vegetation/createGrassTrail.d.ts
2730
+ export declare const createGrassTrail: () => GrassTrail;
2534
2731
  //#endregion
2535
2732
  //#region src/vegetation/createGroundCapture.d.ts
2536
2733
  export declare const createGroundCapture: (size: number, resolution: number) => GroundCapture;
2537
2734
  //#endregion
2735
+ //#region src/vegetation/createPlantCulling.d.ts
2736
+ export declare const createPlantCulling: ({ attribute, bounds: { bottom, halfWidth, height }, clipFromModel, drawDistance, eye, indexCount }: PlantCullingOptions) => InstanceCulling;
2737
+ //#endregion
2538
2738
  //#region src/vegetation/renderGroundCapture.d.ts
2539
2739
  export declare const renderGroundCapture: (renderer: Renderer, scene: Scene, { camera, center, material, renderTarget }: GroundCapture, { maxHeight }: Pick<TerrainOptions, "maxHeight">, worldCenter: Vector3Like, origin: Vector3Like) => void;
2540
2740
  //#endregion
2741
+ //#region src/vegetation/stepGrassTrail.d.ts
2742
+ export declare const stepGrassTrail: (trail: GrassTrail, position: Vector2, velocity: Vector2, delta: number) => void;
2743
+ //#endregion
2541
2744
  //#region src/water/constants.d.ts
2542
2745
  export declare const RIVER_BEND_FOAM_ATTRIBUTE = "bendFoam";
2543
2746
  export declare const BEND_FOAM_FULL_RADIUS_WIDTHS = 2;