@casmo/tree.js 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/README.md +775 -4
  2. package/dist/effects/custom.d.ts +62 -0
  3. package/dist/effects/custom.d.ts.map +1 -0
  4. package/dist/effects/effects.d.ts +92 -6
  5. package/dist/effects/effects.d.ts.map +1 -1
  6. package/dist/effects/glow.d.ts +5 -0
  7. package/dist/effects/glow.d.ts.map +1 -1
  8. package/dist/effects/grade.d.ts +3 -0
  9. package/dist/effects/grade.d.ts.map +1 -1
  10. package/dist/effects/highlight.d.ts +35 -0
  11. package/dist/effects/highlight.d.ts.map +1 -0
  12. package/dist/effects/index.d.ts +7 -1
  13. package/dist/effects/index.d.ts.map +1 -1
  14. package/dist/effects/inner-lines.d.ts +39 -0
  15. package/dist/effects/inner-lines.d.ts.map +1 -0
  16. package/dist/effects/live.d.ts +12 -0
  17. package/dist/effects/live.d.ts.map +1 -0
  18. package/dist/effects/mask.d.ts +32 -12
  19. package/dist/effects/mask.d.ts.map +1 -1
  20. package/dist/effects/outline.d.ts +12 -0
  21. package/dist/effects/outline.d.ts.map +1 -1
  22. package/dist/effects/pass.d.ts +27 -0
  23. package/dist/effects/pass.d.ts.map +1 -0
  24. package/dist/effects/screen.d.ts +31 -0
  25. package/dist/effects/screen.d.ts.map +1 -0
  26. package/dist/effects/suggested.d.ts +5 -0
  27. package/dist/effects/suggested.d.ts.map +1 -1
  28. package/dist/effects/tree-id.d.ts +50 -0
  29. package/dist/effects/tree-id.d.ts.map +1 -0
  30. package/dist/effects-qHx_8Dlk.js +1052 -0
  31. package/dist/effects-qHx_8Dlk.js.map +1 -0
  32. package/dist/effects.js +3 -249
  33. package/dist/forest/Forest.d.ts +82 -4
  34. package/dist/forest/Forest.d.ts.map +1 -1
  35. package/dist/forest/forest-lod.d.ts +70 -0
  36. package/dist/forest/forest-lod.d.ts.map +1 -0
  37. package/dist/forest/impostor-material.d.ts +106 -0
  38. package/dist/forest/impostor-material.d.ts.map +1 -0
  39. package/dist/forest/impostor-season.d.ts +13 -0
  40. package/dist/forest/impostor-season.d.ts.map +1 -0
  41. package/dist/forest/impostor.d.ts +105 -0
  42. package/dist/forest/impostor.d.ts.map +1 -0
  43. package/dist/forest/index.d.ts +1 -0
  44. package/dist/forest/index.d.ts.map +1 -1
  45. package/dist/forest/levels.d.ts +144 -0
  46. package/dist/forest/levels.d.ts.map +1 -0
  47. package/dist/forest/lod.d.ts +106 -0
  48. package/dist/forest/lod.d.ts.map +1 -0
  49. package/dist/forest/nodes.d.ts +42 -1
  50. package/dist/forest/nodes.d.ts.map +1 -1
  51. package/dist/forest/octahedral.d.ts +33 -0
  52. package/dist/forest/octahedral.d.ts.map +1 -0
  53. package/dist/{forest-ChEaWJrf.js → forest-CM5DrklM.js} +1727 -340
  54. package/dist/forest-CM5DrklM.js.map +1 -0
  55. package/dist/generator/fruit.d.ts +2 -0
  56. package/dist/generator/fruit.d.ts.map +1 -1
  57. package/dist/generator/index.d.ts +1 -0
  58. package/dist/generator/index.d.ts.map +1 -1
  59. package/dist/generator/light.d.ts +36 -0
  60. package/dist/generator/light.d.ts.map +1 -0
  61. package/dist/index.d.ts +3 -2
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +5 -2
  64. package/dist/index.js.map +1 -1
  65. package/dist/materials/crown-nodes.d.ts +5 -0
  66. package/dist/materials/crown-nodes.d.ts.map +1 -1
  67. package/dist/materials/leaf-translucency-model.d.ts +6 -1
  68. package/dist/materials/leaf-translucency-model.d.ts.map +1 -1
  69. package/dist/materials/material-features.d.ts +12 -0
  70. package/dist/materials/material-features.d.ts.map +1 -1
  71. package/dist/materials/shader-hooks.d.ts +155 -0
  72. package/dist/materials/shader-hooks.d.ts.map +1 -0
  73. package/dist/motion-Qd7xjeZM.js +276 -0
  74. package/dist/motion-Qd7xjeZM.js.map +1 -0
  75. package/dist/nodes-DxgTyF9B.js +436 -0
  76. package/dist/nodes-DxgTyF9B.js.map +1 -0
  77. package/dist/react/Forest.d.ts +17 -3
  78. package/dist/react/Forest.d.ts.map +1 -1
  79. package/dist/react/ScenePipeline.d.ts +63 -0
  80. package/dist/react/ScenePipeline.d.ts.map +1 -0
  81. package/dist/react/SceneShaderHooks.d.ts +25 -0
  82. package/dist/react/SceneShaderHooks.d.ts.map +1 -0
  83. package/dist/react/Tree.d.ts +9 -2
  84. package/dist/react/Tree.d.ts.map +1 -1
  85. package/dist/react/Weather.d.ts +45 -0
  86. package/dist/react/Weather.d.ts.map +1 -0
  87. package/dist/react/Wind.d.ts +12 -1
  88. package/dist/react/Wind.d.ts.map +1 -1
  89. package/dist/react/index.d.ts +7 -1
  90. package/dist/react/index.d.ts.map +1 -1
  91. package/dist/react.js +347 -10
  92. package/dist/react.js.map +1 -1
  93. package/dist/renderer/index.d.ts +6 -0
  94. package/dist/renderer/index.d.ts.map +1 -1
  95. package/dist/scene/antialias.d.ts +35 -0
  96. package/dist/scene/antialias.d.ts.map +1 -0
  97. package/dist/scene/ao.d.ts +46 -0
  98. package/dist/scene/ao.d.ts.map +1 -0
  99. package/dist/scene/bloom.d.ts +19 -0
  100. package/dist/scene/bloom.d.ts.map +1 -0
  101. package/dist/scene/fog.d.ts +49 -0
  102. package/dist/scene/fog.d.ts.map +1 -0
  103. package/dist/scene/godrays.d.ts +37 -0
  104. package/dist/scene/godrays.d.ts.map +1 -0
  105. package/dist/scene/index.d.ts +14 -0
  106. package/dist/scene/index.d.ts.map +1 -0
  107. package/dist/scene/motion-blur.d.ts +23 -0
  108. package/dist/scene/motion-blur.d.ts.map +1 -0
  109. package/dist/scene/pipeline.d.ts +109 -0
  110. package/dist/scene/pipeline.d.ts.map +1 -0
  111. package/dist/scene/settings.d.ts +36 -0
  112. package/dist/scene/settings.d.ts.map +1 -0
  113. package/dist/scene/stack.d.ts +25 -0
  114. package/dist/scene/stack.d.ts.map +1 -0
  115. package/dist/scene/stage.d.ts +52 -0
  116. package/dist/scene/stage.d.ts.map +1 -0
  117. package/dist/scene/suggested.d.ts +12 -0
  118. package/dist/scene/suggested.d.ts.map +1 -0
  119. package/dist/scene/tone-mapping.d.ts +20 -0
  120. package/dist/scene/tone-mapping.d.ts.map +1 -0
  121. package/dist/scene/velocity.d.ts +34 -0
  122. package/dist/scene/velocity.d.ts.map +1 -0
  123. package/dist/scene.js +889 -0
  124. package/dist/scene.js.map +1 -0
  125. package/dist/season/nodes.d.ts +13 -0
  126. package/dist/season/nodes.d.ts.map +1 -1
  127. package/dist/shader-hooks-BFRtlWGI.js +275 -0
  128. package/dist/shader-hooks-BFRtlWGI.js.map +1 -0
  129. package/dist/tree/Tree.d.ts +8 -3
  130. package/dist/tree/Tree.d.ts.map +1 -1
  131. package/dist/tree/index.d.ts.map +1 -1
  132. package/dist/weather/index.d.ts +3 -0
  133. package/dist/weather/index.d.ts.map +1 -0
  134. package/dist/weather/shared.d.ts +43 -0
  135. package/dist/weather/shared.d.ts.map +1 -0
  136. package/dist/weather/snow.d.ts +87 -0
  137. package/dist/weather/snow.d.ts.map +1 -0
  138. package/dist/weather/wetness.d.ts +75 -0
  139. package/dist/weather/wetness.d.ts.map +1 -0
  140. package/dist/weather.js +288 -0
  141. package/dist/weather.js.map +1 -0
  142. package/dist/wind/Wind.d.ts +100 -5
  143. package/dist/wind/Wind.d.ts.map +1 -1
  144. package/dist/wind/burst.d.ts +28 -0
  145. package/dist/wind/burst.d.ts.map +1 -0
  146. package/dist/wind/index.d.ts +3 -2
  147. package/dist/wind/index.d.ts.map +1 -1
  148. package/dist/wind/motion.d.ts +30 -0
  149. package/dist/wind/motion.d.ts.map +1 -0
  150. package/dist/wind/node.d.ts +17 -3
  151. package/dist/wind/node.d.ts.map +1 -1
  152. package/package.json +9 -1
  153. package/dist/effects.js.map +0 -1
  154. package/dist/forest-ChEaWJrf.js.map +0 -1
@@ -0,0 +1,70 @@
1
+ import { type Camera, type Object3D, type Renderer, type Scene } from 'three/webgpu';
2
+ import type { MaterialFeatureNodes } from '../materials/material-features';
3
+ import type { ForestVariant } from './Forest';
4
+ import { type DetailLevelUniforms } from './levels';
5
+ import { type ForestLodSettings, type ForestLodUpdate } from './lod';
6
+ /** What the Detail Levels need from their Forest. */
7
+ export interface ForestLodHost {
8
+ /** The Forest: its world matrix places the trees, and the Detail Level meshes are added to it. */
9
+ readonly object: Object3D;
10
+ readonly variants: readonly ForestVariant[];
11
+ /** Resolves once the Definition's textures have loaded (the Impostors are baked with them). */
12
+ readonly texturesReady: Promise<void>;
13
+ /** The Forest's live Material Feature uniforms (the Impostor cards use them too). */
14
+ readonly features: MaterialFeatureNodes | null;
15
+ }
16
+ /**
17
+ * The Detail Levels of one Forest. Which backend draws the Forest is only known on its first render
18
+ * (three calls `onBeforeRender` with the renderer then, and not before), so:
19
+ *
20
+ * - On WebGPURenderer's WebGL2 fallback (`detect`): one console warning, `lod` is ignored and `ready`
21
+ * resolves on that first render.
22
+ * - On WebGPU: that first frame still draws every tree in full. Right after it, every Variant gets its
23
+ * Detail Level meshes (they cannot join a frame whose render list is already made), the Impostors are
24
+ * baked once the textures have loaded, and then `ready` resolves.
25
+ */
26
+ export declare class ForestLod {
27
+ private readonly host;
28
+ /** The live values the GPU level selection reads. */
29
+ readonly uniforms: DetailLevelUniforms;
30
+ /** Resolves once the Impostors are baked; on the WebGL2 fallback on the first render; on dispose. */
31
+ readonly ready: Promise<void>;
32
+ private readonly settings;
33
+ private readonly selection;
34
+ private backend;
35
+ private resolveReady;
36
+ private disposed;
37
+ constructor(settings: ForestLodSettings, host: ForestLodHost);
38
+ /** The settings (a copy). */
39
+ get values(): ForestLodSettings;
40
+ /** Sets distances, fade or camera (the others kept): only uniforms. Throws a RangeError for invalid values, keeping the old ones. */
41
+ update(value: ForestLodUpdate): void;
42
+ /** Whether the Detail Levels are drawn: the first render was on WebGPU (not the WebGL2 fallback). */
43
+ get active(): boolean;
44
+ /**
45
+ * Called before each of the Forest's instanced meshes is drawn: notes the camera and, on the first
46
+ * render, finds the backend (see the class).
47
+ */
48
+ detect(renderer: Renderer, scene: Scene | null, camera: Camera | null): void;
49
+ /**
50
+ * How many trees each Detail Level drew in the last frame (indexed by DetailLevel; a tree in a
51
+ * cross-fade counts at both levels). All zero until the Detail Levels are drawn. Reads the GPU.
52
+ */
53
+ counts(renderer: Renderer): Promise<number[]>;
54
+ /** Stops what is pending (the Detail Level meshes, the bake) and resolves `ready`: nothing is left to wait for. */
55
+ dispose(): void;
56
+ /** Builds every Variant's Detail Level meshes and buffers. */
57
+ private enable;
58
+ /**
59
+ * Bakes every Variant's Impostor with the app's renderer (after the textures have loaded), then lets
60
+ * far trees draw as Impostors and resolves `ready`. Until then they draw Light. If the bake fails,
61
+ * they keep drawing Light (one console error) and `ready` still resolves.
62
+ */
63
+ private bake;
64
+ /**
65
+ * Before a Detail Level mesh is drawn: the first time in a frame, picks every tree's level for the
66
+ * camera that picks the levels, on the GPU (shadow passes and other cameras reuse that frame's levels).
67
+ */
68
+ private select;
69
+ }
70
+ //# sourceMappingURL=forest-lod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forest-lod.d.ts","sourceRoot":"","sources":["../../src/forest/forest-lod.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,KAAK,MAAM,EAAa,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAElH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,EAAqE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,OAAO,CAAC;AAExI,qDAAqD;AACrD,MAAM,WAAW,aAAa;IAC5B,kGAAkG;IAClG,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,QAAQ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Material, type Node, type Texture } from 'three/webgpu';
2
+ import type { TreeDefinition } from '../definition';
3
+ import type { CrownVolume } from '../generator';
4
+ import type { MaterialFeatureNodes } from '../materials/material-features';
5
+ import type { ShaderHookTarget } from '../materials/shader-hooks';
6
+ import { type WindResponse, type WindSource } from '../wind';
7
+ import type { Vec3 } from './octahedral';
8
+ /** Where a Variant's frames are: the tree's centre and the half size of each frame (tree space, Growth 1). */
9
+ export interface ImpostorBounds {
10
+ center: Vec3;
11
+ /** Half the width of a frame's picture and of the card (the tree's bounding radius plus a margin). */
12
+ half: number;
13
+ }
14
+ /** A Variant's baked atlases, one texture per channel (by name, see `ImpostorChannel`), frames × frames frames each. */
15
+ export interface ImpostorAtlases {
16
+ frames: number;
17
+ bounds: ImpostorBounds;
18
+ textures: Readonly<Record<string, Texture>>;
19
+ }
20
+ /** One of the (up to) four frames blended at a fragment. */
21
+ export interface ImpostorFrame {
22
+ /** A channel's atlas texel in this frame, as baked (premultiplied by coverage; 0 outside the frame's picture). */
23
+ sample(channel: string): Node<'vec4'>;
24
+ }
25
+ /**
26
+ * The card of an Impostor tree and what it shows (built for a Detail Level mesh: the tree comes from
27
+ * the level list). Everything here is per tree and per camera, so shadow passes see the card and
28
+ * the frames turned to the light.
29
+ */
30
+ export interface ImpostorView {
31
+ /** The card's vertex in forest space (`positionNode`). */
32
+ position: Node<'vec3'>;
33
+ /** The Wind displacement of the card's vertex in forest space (null without Wind). */
34
+ sway: Node<'vec3'> | null;
35
+ /** The card pushed back from the viewer by its half size (`castShadowPositionNode`), so it does not shadow itself. */
36
+ shadowPosition: Node<'vec3'>;
37
+ /** Coverage of this fragment (0..1), blended over the frames. */
38
+ coverage: Node<'float'>;
39
+ /**
40
+ * With `sway`: where the card's vertex was at Wind time `previous` relative to `position` (forest
41
+ * space), for Wind-aware velocity (ADR 0011).
42
+ */
43
+ windShift?: (previous: Node<'float'>) => Node<'vec3'>;
44
+ /**
45
+ * Blends `perFrame` over the frames by their weights. Decode per frame what does not blend
46
+ * linearly (a colour that depends on the leaf flag, Season ranks); `perFrame` gets premultiplied
47
+ * samples and should return a premultiplied value.
48
+ */
49
+ blend(perFrame: (frame: ImpostorFrame) => Node<'vec4'>): Node<'vec4'>;
50
+ /** A channel blended over the frames, divided by the coverage (for values that blend linearly). */
51
+ value(channel: string): Node<'vec4'>;
52
+ }
53
+ /**
54
+ * Builds the card and the frame blend. In the vertex stage: the direction to the camera (or, for
55
+ * an orthographic camera such as a sun's shadow camera, its forward axis) in tree space, the card
56
+ * across it, the four nearest frames and where each pictured the card's vertex (`frameUv`). In the
57
+ * fragment stage: the atlases sampled in those frames and blended bilinearly.
58
+ *
59
+ * `sway`: a displacement (tree space) of a card point at its tree-space position (the Wind) at Wind
60
+ * time `time` (default the Wind's clock); the pictures move with the card.
61
+ */
62
+ export declare function impostorView(atlases: ImpostorAtlases, sway?: (point: Node<'vec3'>, time?: Node<'float'>) => Node<'vec3'>): ImpostorView;
63
+ /** The colour atlas: the MRT `output` (rgb = colour, a = coverage). */
64
+ export declare const COLOR_CHANNEL = "output";
65
+ /** The normal atlas: rgb = tree-space normal (encoded 0..1), a = 1 on leaves, 0 on wood. */
66
+ export declare const NORMAL_CHANNEL = "normal";
67
+ /** The Season atlas (`encodeSeasonTexel`): r = leaf timing shift, g = coverage rank, b = blossom rank, a = 1 on leaves. */
68
+ export declare const SEASON_CHANNEL = "season";
69
+ /** The wood layer's colour atlas: the wood alone (rgb = colour, a = coverage), shown where leaves have dropped. */
70
+ export declare const WOOD_COLOR_CHANNEL = "woodOutput";
71
+ /** The wood layer's normal atlas (as `NORMAL_CHANNEL`, a = 0). */
72
+ export declare const WOOD_NORMAL_CHANNEL = "woodNormal";
73
+ /**
74
+ * The Material Feature atlas (only baked when a Material Feature is on, ADR 0008): rgb = the pictured
75
+ * point in tree space (Growth 1, encoded over the frame's box, see `featureTexel`), from which the card
76
+ * measures the Crown Volume (Crown Normals, Leaf Translucency); a = the raw Structural Occlusion
77
+ * (`aOcclusion`, 0 when that feature is off).
78
+ */
79
+ export declare const FEATURES_CHANNEL = "features";
80
+ /** The Material Feature atlas texel the bake writes for a tree-space `point` and raw `occlusion`. */
81
+ export declare function featureTexel(point: Node<'vec3'>, occlusion: Node<'float'>, bounds: ImpostorBounds): Node<'vec4'>;
82
+ /** The Material Features an Impostor applies: the Forest's live values and the Variant's Crown Volume. */
83
+ export interface ImpostorFeatures {
84
+ nodes: MaterialFeatureNodes;
85
+ crown: CrownVolume;
86
+ }
87
+ /** Whether any Material Feature is on (then the Impostor bakes and reads `FEATURES_CHANNEL`). */
88
+ export declare function hasImpostorFeatures(features: ImpostorFeatures | null | undefined): features is ImpostorFeatures;
89
+ /**
90
+ * The material of a Variant's Impostor cards: the Definition's shading (smooth: the baked normals
91
+ * carry the shape), the baked colour with each leaf texel in the Season Profile at the tree's Season
92
+ * plus the leaf's own timing shift (colour, blossom; a dropped leaf shows the wood layer behind it,
93
+ * or nothing), the baked normal turned with the tree, bark or leaf roughness, cut out by the coverage
94
+ * and the Detail Level cross-fade (in the shadow pass too, so the shadow is tree-shaped). With
95
+ * `wind`, the card bends with height as the tree sways, in the tree's own Wind phase.
96
+ */
97
+ export declare function createImpostorMaterial(definition: TreeDefinition, atlases: ImpostorAtlases, features?: ImpostorFeatures | null, wind?: {
98
+ source: WindSource;
99
+ response: WindResponse;
100
+ }): MeshStandardNodeMaterial;
101
+ /**
102
+ * What Tree Shader Hooks shade on an Impostor card (ADR 0012): its baked colour, leaf flag and normal at
103
+ * draw time, so hooks follow live settings without a rebake.
104
+ */
105
+ export declare function impostorHookTarget(material: MeshStandardNodeMaterial): ShaderHookTarget;
106
+ //# sourceMappingURL=impostor-material.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impostor-material.d.ts","sourceRoot":"","sources":["../../src/forest/impostor-material.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,wBAAwB,EAAE,KAAK,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;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,EAAE,cAAc,EAC1B,OAAO,EAAE,eAAe,EACxB,QAAQ,GAAE,gBAAgB,GAAG,IAAW,EACxC,IAAI,CAAC,EAAE;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,GACpD,wBAAwB,CAgF1B;AAID;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,wBAAwB,GAAG,gBAAgB,CAIvF"}
@@ -0,0 +1,13 @@
1
+ import type { PartSeason } from '../season/profile';
2
+ /** A texel: r = timing shift (−1..1 as 0..1), g = coverage rank, b = blossom rank, a = 1 on leaves. */
3
+ export type SeasonTexel = readonly [number, number, number, number];
4
+ /** The leaf timing shift is within ±`variation.season` (at most 1); the atlas keeps it as `shift · SCALE + 0.5`. */
5
+ export declare const SEASON_SHIFT_SCALE = 0.5;
6
+ /** The texel the bake writes for a leaf (`aSeason`), or for wood (`null`: empty). */
7
+ export declare function encodeSeasonTexel(part: PartSeason | null): SeasonTexel;
8
+ /**
9
+ * The leaf Season timing a (filtered, premultiplied) texel pictures: divided by its leaf share `a`
10
+ * (mipmaps and frame blends mix texels with the empty background).
11
+ */
12
+ export declare function decodeSeasonTexel(texel: SeasonTexel): PartSeason;
13
+ //# sourceMappingURL=impostor-season.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impostor-season.d.ts","sourceRoot":"","sources":["../../src/forest/impostor-season.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,uGAAuG;AACvG,MAAM,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpE,oHAAoH;AACpH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,qFAAqF;AACrF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,WAAW,CAGtE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,UAAU,CAGhE"}
@@ -0,0 +1,105 @@
1
+ import { BufferGeometry, Matrix4, MeshBasicNodeMaterial, type Node, type Renderer } from 'three/webgpu';
2
+ import type { TreeDefinition } from '../definition';
3
+ import type { GeometryBuffers } from '../generator';
4
+ import type { TextureOptions } from '../textures';
5
+ import type { WindResponse, WindSource } from '../wind';
6
+ import { type ImpostorAtlases, type ImpostorBounds, type ImpostorFeatures } from './impostor-material';
7
+ import type { LevelPart } from './levels';
8
+ import type { ImpostorAtlasOptions } from './lod';
9
+ /** One part of the tree as the bake draws it. */
10
+ export interface ImpostorBakePart {
11
+ kind: 'wood' | 'leaves';
12
+ /** The part's vertex data (tree space, Growth 1). */
13
+ geometry: BufferGeometry;
14
+ /** The unlit bake material of the part: its colour, alpha cut and the Definition's maps. */
15
+ material: MeshBasicNodeMaterial;
16
+ }
17
+ /**
18
+ * One atlas of an Impostor: what the bake writes per covered texel for each part. The background
19
+ * stays 0, so every atlas is premultiplied by coverage (mipmaps and frame blends stay right; the
20
+ * material divides by the coverage). `name` is the MRT output and texture name.
21
+ */
22
+ export interface ImpostorChannel {
23
+ name: string;
24
+ bake(part: ImpostorBakePart): Node<'vec4'>;
25
+ }
26
+ /**
27
+ * The channels of the tree layer every Impostor bakes: colour (rgb, coverage in a), the tree-space
28
+ * normal (a = leaf flag), the leaves' Season timing (`encodeSeasonTexel`: shift, coverage rank,
29
+ * blossom rank, leaf flag; empty on wood), plus, only when a Material Feature is on, the features
30
+ * atlas (`FEATURES_CHANNEL`: the pictured point and the raw Structural Occlusion).
31
+ *
32
+ * Each channel is one RGBA8 attachment of a single render pass: WebGPU's default limit
33
+ * (`maxColorAttachmentBytesPerSample` 32, 8 per RGBA8) allows 4, which these use up. More inputs need
34
+ * another layer (as the wood layer, `impostorWoodChannels`).
35
+ */
36
+ export declare function impostorChannels(bounds: ImpostorBounds, features?: ImpostorFeatures | null): ImpostorChannel[];
37
+ /**
38
+ * The channels of the wood layer: the wood alone (colour with coverage, normal), so an Impostor shows
39
+ * bare branches where its leaves have dropped instead of holes.
40
+ */
41
+ export declare function impostorWoodChannels(): ImpostorChannel[];
42
+ /** The tree's centre and the half size of a frame, from its wood and leaves (Fruit is not on Impostors). */
43
+ export declare function impostorBounds(parts: readonly GeometryBuffers[]): ImpostorBounds;
44
+ /**
45
+ * Where the bake draws the tree for frame (i, j): seen from the frame's direction (its basis turned
46
+ * to the camera's axes), scaled so the frame spans 2·half, moved into its cell of the atlas. The bake
47
+ * camera is orthographic over the atlas (0..1 in x and y), so one draw renders every frame.
48
+ */
49
+ export declare function frameTransform(i: number, j: number, frames: number, bounds: ImpostorBounds): Matrix4;
50
+ /** What the Impostor of one Variant is made from. */
51
+ export interface VariantImpostorOptions {
52
+ definition: TreeDefinition;
53
+ /** The Variant's vertex data the bake draws (shared: never disposed by the Impostor). */
54
+ sources: {
55
+ wood: BufferGeometry;
56
+ leaves: BufferGeometry;
57
+ };
58
+ /** The tree's centre and the half size of a frame: `impostorBounds` of the wood and leaves. */
59
+ bounds: ImpostorBounds;
60
+ atlas: Required<ImpostorAtlasOptions>;
61
+ /** Name of the card mesh. */
62
+ name: string;
63
+ /** Where the Definition's textures load from. */
64
+ textures?: TextureOptions;
65
+ /** The Forest's live Material Feature uniforms and the Variant's Crown Volume; null when none is on. */
66
+ features?: ImpostorFeatures | null;
67
+ /** The Wind the cards sway with and the Variant's response to it. */
68
+ wind?: {
69
+ source: WindSource;
70
+ response: WindResponse;
71
+ };
72
+ }
73
+ /**
74
+ * The Impostor of one Variant: the atlases (allocated at once, filled by `bake`), the card material
75
+ * that samples them, and the card geometry. `part` is what the Variant's Impostor Detail Level draws.
76
+ *
77
+ * Two layers are baked: the tree (wood and leaves, with the leaves' Season timing) and the wood
78
+ * alone, which shows where leaves have dropped.
79
+ */
80
+ export declare class VariantImpostor {
81
+ readonly frames: number;
82
+ readonly bounds: ImpostorBounds;
83
+ /** The channels of every layer (one atlas each). */
84
+ readonly channels: readonly ImpostorChannel[];
85
+ /** The Impostor level's single mesh: a card per tree. */
86
+ readonly part: LevelPart;
87
+ private readonly definition;
88
+ private readonly sources;
89
+ private readonly textures;
90
+ private readonly layers;
91
+ private baked;
92
+ constructor({ definition, sources, bounds, atlas, name, textures, features, wind }: VariantImpostorOptions);
93
+ /** The atlases by channel name. */
94
+ get atlases(): ImpostorAtlases;
95
+ /** Whether `bake` has run. */
96
+ get isBaked(): boolean;
97
+ /**
98
+ * Renders every frame into the atlases with the app's renderer, one pass per layer, then restores
99
+ * the renderer as it was. Deterministic: the same Definition and Variant Seed give the same atlases.
100
+ */
101
+ bake(renderer: Renderer): void;
102
+ /** Frees the atlases, the card geometry and its material (the level mesh's geometry belongs to the levels). */
103
+ dispose(): void;
104
+ }
105
+ //# sourceMappingURL=impostor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impostor.d.ts","sourceRoot":"","sources":["../../src/forest/impostor.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,cAAc,EAKd,OAAO,EACP,qBAAqB,EAMrB,KAAK,IAAI,EACT,KAAK,QAAQ,EAEd,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAUL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAMlD,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM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AAY,CAAA;KAAE,CAAC;CACvD;AAED;;;;;;GAMG;AACH,qBAAa,eAAe;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,oDAAoD;IACpD,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IAC9C,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAiB;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmD;IAC3E,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;IACtD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2B;IAClD,OAAO,CAAC,KAAK,CAAS;gBAEV,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAe,EAAE,IAAI,EAAE,EAAE,sBAAsB;IAYjH,mCAAmC;IACnC,IAAI,OAAO,IAAI,eAAe,CAI7B;IAED,8BAA8B;IAC9B,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;OAGG;IACH,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAgD9B,+GAA+G;IAC/G,OAAO,IAAI,IAAI;CAKhB"}
@@ -3,6 +3,7 @@ import { Forest, type ForestOptions } from './Forest';
3
3
  import type { ForestPlacement } from './placement';
4
4
  export { Forest, ForestTree, ForestVariant, type ForestOptions, type ForestInstanceState } from './Forest';
5
5
  export type { ForestPlacement, ForestTreeTraits } from './placement';
6
+ export { DetailLevel, selectDetailLevel, type DetailLevelSelection, type ForestLodOptions, type ForestLodSettings, type ForestLodUpdate, type ImpostorAtlasOptions, } from './lod';
6
7
  /**
7
8
  * Places many trees of one Tree Definition cheaply: `variants` Seeds are generated once and each
8
9
  * is drawn instanced. Each tree's Variant and small Growth/Season offsets come from a hash of
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/forest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC3G,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAErE;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,mBAAmB,GAAG,cAAc,EAChD,UAAU,GAAE,SAAS,eAAe,EAAO,EAC3C,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAER"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/forest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC3G,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,OAAO,CAAC;AAEf;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,mBAAmB,GAAG,cAAc,EAChD,UAAU,GAAE,SAAS,eAAe,EAAO,EAC3C,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAER"}
@@ -0,0 +1,144 @@
1
+ import { BufferGeometry, IndirectStorageBufferAttribute, Matrix4, Mesh, StorageBufferAttribute, Vector3, type Camera, type ComputeNode, type Material, type Object3D, type Renderer, type Scene, type UniformNode } from 'three/webgpu';
2
+ import { DetailLevel } from './lod';
3
+ /** Detail Levels a Variant can draw: Full, Light and Impostor. Lists and draw arguments have room for all three. */
4
+ export declare const LEVEL_COUNT = 3;
5
+ /** Meshes (materials) one Detail Level draws at most: wood, leaves and Fruit. */
6
+ export declare const MAX_LEVEL_PARTS = 3;
7
+ /** The live values every Variant's level selection reads (one set per Forest). */
8
+ export interface DetailLevelUniforms {
9
+ light: UniformNode<'float', number>;
10
+ impostor: UniformNode<'float', number>;
11
+ fade: UniformNode<'float', number>;
12
+ /** World position of the camera that picks the levels this frame. */
13
+ camera: UniformNode<'vec3', Vector3>;
14
+ /** The Forest's world matrix (tree positions are in forest space). */
15
+ forest: UniformNode<'mat4', Matrix4>;
16
+ /**
17
+ * The farthest Detail Level that can be drawn: Light until the Impostors are baked. Trees
18
+ * beyond it draw at it, without a cross-fade into the level that is not there.
19
+ */
20
+ farthest: UniformNode<'uint', number>;
21
+ }
22
+ /** One mesh of a Detail Level: the geometry (shared vertex data) and the material it draws with. */
23
+ export interface LevelPart {
24
+ name: string;
25
+ geometry: BufferGeometry;
26
+ material: Material;
27
+ }
28
+ /** The meshes of one Detail Level of a Variant. */
29
+ export interface LevelMeshes {
30
+ level: DetailLevel;
31
+ meshes: Mesh[];
32
+ }
33
+ /**
34
+ * The GPU side of one Variant's Detail Levels: the tree data by slot, one list of tree slots per
35
+ * level (with each entry's cross-fade), the indirect draw arguments, the compute pass that fills
36
+ * them, and the meshes of every level (they draw indirectly and read their trees by slot).
37
+ *
38
+ * - `setLevel(level, parts)` gives a level its meshes (Full and Light now; an Impostor card later).
39
+ * - `write(slot, …)` / `count` mirror the Variant's instance data; `resize(capacity)` keeps them.
40
+ * - `dispatches` run once per frame for the camera that picks the levels, before any of the meshes is drawn.
41
+ */
42
+ export declare class VariantLevels {
43
+ private readonly uniforms;
44
+ private readonly setupMesh;
45
+ /** Every level's meshes, nearest level first. */
46
+ readonly levels: LevelMeshes[];
47
+ private capacityValue;
48
+ private treeData;
49
+ private lists;
50
+ private dithers;
51
+ private readonly counters;
52
+ private readonly args;
53
+ private readonly treeNode;
54
+ private readonly listNode;
55
+ private readonly ditherNode;
56
+ private readonly countNode;
57
+ private readonly levelOf;
58
+ private computeNodes;
59
+ /** Bumped whenever the trees change (data, count, capacity): the levels must be selected again. */
60
+ version: number;
61
+ /** What the meshes read per tree (see `drawsDetailLevel`). */
62
+ private readonly instance;
63
+ constructor(capacity: number, uniforms: DetailLevelUniforms, setupMesh: (mesh: Mesh) => void);
64
+ get capacity(): number;
65
+ /** Number of trees (slots 0..count-1 are in use). */
66
+ get count(): number;
67
+ set count(value: number);
68
+ /** The compute dispatches to run once per frame (reset, select, draw arguments). */
69
+ get dispatches(): readonly ComputeNode[];
70
+ /** Every mesh of every level. */
71
+ get meshes(): Mesh[];
72
+ /**
73
+ * The GPU buffers in use: the tree data by slot (`TREE_VEC4S` vec4 per slot), the level lists and
74
+ * their cross-fades (`LEVEL_COUNT` × capacity), the level counters and the draw arguments. The first
75
+ * three are replaced when the Variant grows; the counters and the draw arguments are kept.
76
+ */
77
+ get buffers(): {
78
+ trees: StorageBufferAttribute;
79
+ lists: StorageBufferAttribute;
80
+ dithers: StorageBufferAttribute;
81
+ counters: StorageBufferAttribute;
82
+ args: IndirectStorageBufferAttribute;
83
+ };
84
+ /** The indirect draw arguments, LEVEL_COUNT × MAX_LEVEL_PARTS draws of 5 u32 (for read-back). */
85
+ get drawArguments(): IndirectStorageBufferAttribute;
86
+ /**
87
+ * How many trees each Detail Level drew in the last selection (indexed by DetailLevel; a tree in a
88
+ * cross-fade counts at both levels), read back from the draw arguments on the GPU.
89
+ */
90
+ drawnCounts(renderer: Renderer): Promise<number[]>;
91
+ /**
92
+ * Gives `level` its meshes (at most MAX_LEVEL_PARTS parts), one per part, each drawn
93
+ * indirectly from the level's list. A part without indices (e.g. the leaves of a bare
94
+ * Definition) gets no mesh: WebGPU would draw it with an index count of 0. Returns the meshes;
95
+ * the caller adds them to the scene.
96
+ */
97
+ setLevel(level: DetailLevel, parts: readonly LevelPart[]): Mesh[];
98
+ /**
99
+ * Writes one tree: `instance` = its INSTANCE_STRIDE floats of instance data (rotation, state),
100
+ * `position` = its base in forest space.
101
+ */
102
+ write(slot: number, instance: ArrayLike<number>, position: readonly [number, number, number]): void;
103
+ /** Room for `capacity` trees (the tree data is kept; the lists are refilled every frame). */
104
+ resize(capacity: number): void;
105
+ /** Frees the meshes' geometry, the buffers and the compute pass (the materials belong to the Variant). */
106
+ dispose(): void;
107
+ private disposeBuffers;
108
+ /**
109
+ * The compute pass: reset the level counters; sort every tree into its level list (and, in a
110
+ * cross-fade, the next level's too), mirroring `selectDetailLevel`; copy the counts into the draw
111
+ * arguments of every level's meshes.
112
+ */
113
+ private createDispatches;
114
+ }
115
+ /**
116
+ * Picks the level camera (the camera whose distance picks every tree's Detail Level) and runs every
117
+ * Variant's level selection before a Detail Level mesh of the Forest is drawn: once per frame (`renderer.info.frame`), and again in the same frame only when
118
+ * something it depends on changed (trees, settings, the level camera's or the Forest's position). So
119
+ * every render of a frame (shadow passes, other cameras) draws the levels of the frame's level camera.
120
+ */
121
+ export declare class LevelSelection {
122
+ private readonly uniforms;
123
+ private frame;
124
+ /** The level camera of the current frame. */
125
+ private camera;
126
+ /** The last non-shadow camera seen drawing the Forest (before the first selection). */
127
+ private seen;
128
+ /** What the last selection was made from (see `inputs`). */
129
+ private last;
130
+ private readonly position;
131
+ constructor(uniforms: DetailLevelUniforms);
132
+ /** Notes the camera of a render that draws the Forest, unless it is a shadow pass. */
133
+ observe(scene: Scene | null, camera: Camera | null): void;
134
+ /**
135
+ * Called before a Detail Level mesh is drawn. The first call of a frame fixes the frame's level
136
+ * camera: `explicit` (`lod.camera`) when set, otherwise the camera of this render. A shadow map can
137
+ * be drawn before the camera's own render reaches the Forest: then it is the previous frame's level
138
+ * camera (or, on the first frame, the last camera seen drawing the Forest).
139
+ */
140
+ prepare(renderer: Renderer, scene: Scene | null, camera: Camera | null, explicit: Camera | null, forest: Object3D, variants: readonly VariantLevels[]): void;
141
+ /** Everything the selection reads (leaves the camera's world position in `this.position`). */
142
+ private inputs;
143
+ }
144
+ //# sourceMappingURL=levels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"levels.d.ts","sourceRoot":"","sources":["../../src/forest/levels.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,8BAA8B,EAC9B,OAAO,EACP,IAAI,EACJ,sBAAsB,EACtB,OAAO,EACP,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,QAAQ,EAEb,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,KAAK,EAEV,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,WAAW,EAA8B,MAAM,OAAO,CAAC;AAGhE,oHAAoH;AACpH,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,iFAAiF;AACjF,eAAO,MAAM,eAAe,IAAI,CAAC;AAMjC,kFAAkF;AAClF,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACvC,IAAI,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACnC,qEAAqE;IACrE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,sEAAsE;IACtE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAA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IACnC,4DAA4D;IAC5D,OAAO,CAAC,IAAI,CAAgB;IAC5B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;gBAEb,QAAQ,EAAE,mBAAmB;IAE1D,sFAAsF;IACtF,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIzD;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI;IAqB5J,8FAA8F;IAC9F,OAAO,CAAC,MAAM;CAcf"}
@@ -0,0 +1,106 @@
1
+ import type { Camera } from 'three/webgpu';
2
+ import type { TreeDefinitionInput } from '../definition';
3
+ /** A Forest tree's Detail Level (GLOSSARY): Full (as without Detail Levels), Light (fewer faces and leaves) or Impostor (one card). */
4
+ export declare const DetailLevel: {
5
+ readonly Full: 0;
6
+ readonly Light: 1;
7
+ readonly Impostor: 2;
8
+ };
9
+ export type DetailLevel = (typeof DetailLevel)[keyof typeof DetailLevel];
10
+ /** Resolution of a Variant's Impostor atlases. */
11
+ export interface ImpostorAtlasOptions {
12
+ /**
13
+ * Directions per side (frames × frames pictures). They are hemi-octahedral: they cover the upper
14
+ * hemisphere only, from the horizon to straight above (a view from below uses the horizon frames).
15
+ * Default 12.
16
+ */
17
+ frames?: number;
18
+ /** Atlas width and height in pixels. Default 2048. */
19
+ size?: number;
20
+ }
21
+ /** The Detail Levels of a Forest (`ForestOptions.lod`). */
22
+ export interface ForestLodOptions {
23
+ /** Camera distance (world units, divided by the tree's placement scale) from which a tree draws Light. */
24
+ light: number;
25
+ /** Camera distance (as `light`, at least `light`) from which a fully grown tree draws as an Impostor. */
26
+ impostor: number;
27
+ /** Width of the cross-fade band, as a fraction (0..1) of each switch distance, centred on it. Default 0.1. */
28
+ fade?: number;
29
+ /** Impostor atlas resolution. Default 12 × 12 directions at 2048². */
30
+ impostorAtlas?: ImpostorAtlasOptions;
31
+ /** Partial Definition merged over the automatic Light reduction of every Variant. */
32
+ lightDefinition?: Omit<TreeDefinitionInput, 'schemaVersion'>;
33
+ /** The camera whose distance picks every tree's level. Default: the first non-shadow camera that draws the Forest in a frame. */
34
+ camera?: Camera | null;
35
+ }
36
+ /** A Forest's current Detail Level settings (`forest.lod`), every default filled in. */
37
+ export interface ForestLodSettings {
38
+ light: number;
39
+ impostor: number;
40
+ fade: number;
41
+ impostorAtlas: Required<ImpostorAtlasOptions>;
42
+ lightDefinition: Omit<TreeDefinitionInput, 'schemaVersion'> | null;
43
+ /** null: the first non-shadow camera that draws the Forest in a frame. */
44
+ camera: Camera | null;
45
+ }
46
+ /** What `forest.lod = …` can change live (only uniforms are written: no rebuild, no recompile). */
47
+ export type ForestLodUpdate = Partial<Pick<ForestLodSettings, 'light' | 'impostor' | 'fade' | 'camera'>>;
48
+ /** The distances the level selection needs. */
49
+ export type DetailLevelDistances = Pick<ForestLodSettings, 'light' | 'impostor' | 'fade'>;
50
+ /** A tree's Detail Level and how far it has faded into the next one. */
51
+ export interface DetailLevelSelection {
52
+ /** The nearer level the tree draws at. */
53
+ level: DetailLevel;
54
+ /**
55
+ * 0..1: how far the tree is into the cross-fade towards `level + 1`. The tree draws at `level`
56
+ * with amount `1 - fade` and, when `fade > 0`, also at `level + 1` with amount `fade`.
57
+ */
58
+ fade: number;
59
+ }
60
+ export declare const DEFAULT_LOD_FADE = 0.1;
61
+ export declare const DEFAULT_IMPOSTOR_ATLAS: Required<ImpostorAtlasOptions>;
62
+ /** `lod: true`: Light from this many trunk heights away, Impostor from … */
63
+ export declare const DEFAULT_LIGHT_HEIGHTS = 6;
64
+ /** … this many trunk heights away. */
65
+ export declare const DEFAULT_IMPOSTOR_HEIGHTS = 20;
66
+ /** Smallest placement scale the selection divides by (a scale of 0 must not divide by zero). */
67
+ export declare const MIN_LOD_SCALE = 0.000001;
68
+ /**
69
+ * Picks a Forest tree's Detail Level. The single source of truth for level selection: the GPU
70
+ * compute pass mirrors it line by line.
71
+ *
72
+ * - `t = distance / max(scale, 1e-6)`: a tree at placement scale 2 switches at twice the distance.
73
+ * - Each switch distance `d` (`light`, `impostor`) has a cross-fade band from `d·(1 − fade/2)` to
74
+ * `d·(1 + fade/2)`; inside it the tree fades linearly from the nearer level to the next one.
75
+ * - A tree whose drawn Growth is below 1 is never an Impostor: it is capped at Light.
76
+ * - The Impostor switch is checked first, so if the two bands overlap the farther one wins.
77
+ *
78
+ * @param distance distance from the camera that picks the levels to the tree's base, world units
79
+ * @param scale the tree's placement scale
80
+ * @param growth the tree's drawn Growth (after its Growth delay)
81
+ */
82
+ export declare function selectDetailLevel(distance: number, scale: number, growth: number, settings: DetailLevelDistances): DetailLevelSelection;
83
+ /** Throws a RangeError unless the distances and fade are valid. */
84
+ export declare function checkDetailLevelDistances({ light, impostor, fade }: DetailLevelDistances): void;
85
+ /** The switch distances of `lod: true`, from the tallest Variant's trunk height. */
86
+ export declare function defaultDetailLevelDistances(trunkHeight: number): Pick<ForestLodSettings, 'light' | 'impostor'>;
87
+ /**
88
+ * The settings of `ForestOptions.lod` with every default filled in, or null when it is missing or
89
+ * false. `trunkHeight` (the tallest Variant's) gives the distances of `lod: true`. Throws a RangeError
90
+ * for invalid settings.
91
+ */
92
+ export declare function resolveForestLod(lod: boolean | ForestLodOptions | undefined, trunkHeight: number): ForestLodSettings | null;
93
+ /** Side of the ordered-dither (Bayer) matrix the cross-fade uses. */
94
+ export declare const DITHER_SIZE = 8;
95
+ /**
96
+ * The cross-fade threshold of screen pixel (x, y), in 0..1: an 8 × 8 Bayer matrix, the same in every
97
+ * frame (no temporal noise), so a still frame is deterministic. The GPU mirrors it bit for bit.
98
+ */
99
+ export declare function ditherThreshold(x: number, y: number): number;
100
+ /**
101
+ * Whether a tree drawn at a level shows a pixel with dither `threshold`. A tree at `level` with
102
+ * `fade` shows the nearer level where `threshold < 1 − fade` and the next level (`next`) everywhere
103
+ * else, so the two levels together cover every pixel exactly once.
104
+ */
105
+ export declare function showsPixel(fade: number, next: boolean, threshold: number): boolean;
106
+ //# sourceMappingURL=lod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lod.d.ts","sourceRoot":"","sources":["../../src/forest/lod.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,uIAAuI;AACvI,eAAO,MAAM,WAAW;;;;CAA8C,CAAC;AACvE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEzE,kDAAkD;AAClD,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,2DAA2D;AAC3D,MAAM,WAAW,gBAAgB;IAC/B,0GAA0G;IAC1G,KAAK,EAAE,MAAM,CAAC;IACd,yGAAyG;IACzG,QAAQ,EAAE,MAAM,CAAC;IACjB,8GAA8G;IAC9G,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,qFAAqF;IACrF,eAAe,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;IAC7D,iIAAiI;IACjI,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,wFAAwF;AACxF,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE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