@casmo/tree.js 0.4.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 (135) hide show
  1. package/README.md +590 -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 +42 -1
  5. package/dist/effects/effects.d.ts.map +1 -1
  6. package/dist/effects/index.d.ts +2 -0
  7. package/dist/effects/index.d.ts.map +1 -1
  8. package/dist/effects/mask.d.ts +9 -1
  9. package/dist/effects/mask.d.ts.map +1 -1
  10. package/dist/effects/tree-id.d.ts.map +1 -1
  11. package/dist/effects-qHx_8Dlk.js +1052 -0
  12. package/dist/effects-qHx_8Dlk.js.map +1 -0
  13. package/dist/effects.js +2 -963
  14. package/dist/forest/Forest.d.ts +80 -4
  15. package/dist/forest/Forest.d.ts.map +1 -1
  16. package/dist/forest/forest-lod.d.ts +70 -0
  17. package/dist/forest/forest-lod.d.ts.map +1 -0
  18. package/dist/forest/impostor-material.d.ts +106 -0
  19. package/dist/forest/impostor-material.d.ts.map +1 -0
  20. package/dist/forest/impostor-season.d.ts +13 -0
  21. package/dist/forest/impostor-season.d.ts.map +1 -0
  22. package/dist/forest/impostor.d.ts +105 -0
  23. package/dist/forest/impostor.d.ts.map +1 -0
  24. package/dist/forest/index.d.ts +1 -0
  25. package/dist/forest/index.d.ts.map +1 -1
  26. package/dist/forest/levels.d.ts +144 -0
  27. package/dist/forest/levels.d.ts.map +1 -0
  28. package/dist/forest/lod.d.ts +106 -0
  29. package/dist/forest/lod.d.ts.map +1 -0
  30. package/dist/forest/nodes.d.ts +42 -1
  31. package/dist/forest/nodes.d.ts.map +1 -1
  32. package/dist/forest/octahedral.d.ts +33 -0
  33. package/dist/forest/octahedral.d.ts.map +1 -0
  34. package/dist/{forest-lg61rhKM.js → forest-CM5DrklM.js} +1723 -340
  35. package/dist/forest-CM5DrklM.js.map +1 -0
  36. package/dist/generator/fruit.d.ts +2 -0
  37. package/dist/generator/fruit.d.ts.map +1 -1
  38. package/dist/generator/index.d.ts +1 -0
  39. package/dist/generator/index.d.ts.map +1 -1
  40. package/dist/generator/light.d.ts +36 -0
  41. package/dist/generator/light.d.ts.map +1 -0
  42. package/dist/index.d.ts +3 -2
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +5 -2
  45. package/dist/index.js.map +1 -1
  46. package/dist/materials/crown-nodes.d.ts +5 -0
  47. package/dist/materials/crown-nodes.d.ts.map +1 -1
  48. package/dist/materials/leaf-translucency-model.d.ts +6 -1
  49. package/dist/materials/leaf-translucency-model.d.ts.map +1 -1
  50. package/dist/materials/material-features.d.ts +12 -0
  51. package/dist/materials/material-features.d.ts.map +1 -1
  52. package/dist/materials/shader-hooks.d.ts +155 -0
  53. package/dist/materials/shader-hooks.d.ts.map +1 -0
  54. package/dist/motion-Qd7xjeZM.js +276 -0
  55. package/dist/motion-Qd7xjeZM.js.map +1 -0
  56. package/dist/nodes-DxgTyF9B.js +436 -0
  57. package/dist/nodes-DxgTyF9B.js.map +1 -0
  58. package/dist/react/Forest.d.ts +17 -3
  59. package/dist/react/Forest.d.ts.map +1 -1
  60. package/dist/react/ScenePipeline.d.ts +63 -0
  61. package/dist/react/ScenePipeline.d.ts.map +1 -0
  62. package/dist/react/SceneShaderHooks.d.ts +25 -0
  63. package/dist/react/SceneShaderHooks.d.ts.map +1 -0
  64. package/dist/react/Tree.d.ts +9 -2
  65. package/dist/react/Tree.d.ts.map +1 -1
  66. package/dist/react/Weather.d.ts +45 -0
  67. package/dist/react/Weather.d.ts.map +1 -0
  68. package/dist/react/Wind.d.ts +12 -1
  69. package/dist/react/Wind.d.ts.map +1 -1
  70. package/dist/react/index.d.ts +7 -1
  71. package/dist/react/index.d.ts.map +1 -1
  72. package/dist/react.js +347 -10
  73. package/dist/react.js.map +1 -1
  74. package/dist/renderer/index.d.ts +6 -0
  75. package/dist/renderer/index.d.ts.map +1 -1
  76. package/dist/scene/antialias.d.ts +35 -0
  77. package/dist/scene/antialias.d.ts.map +1 -0
  78. package/dist/scene/ao.d.ts +46 -0
  79. package/dist/scene/ao.d.ts.map +1 -0
  80. package/dist/scene/bloom.d.ts +19 -0
  81. package/dist/scene/bloom.d.ts.map +1 -0
  82. package/dist/scene/fog.d.ts +49 -0
  83. package/dist/scene/fog.d.ts.map +1 -0
  84. package/dist/scene/godrays.d.ts +37 -0
  85. package/dist/scene/godrays.d.ts.map +1 -0
  86. package/dist/scene/index.d.ts +14 -0
  87. package/dist/scene/index.d.ts.map +1 -0
  88. package/dist/scene/motion-blur.d.ts +23 -0
  89. package/dist/scene/motion-blur.d.ts.map +1 -0
  90. package/dist/scene/pipeline.d.ts +109 -0
  91. package/dist/scene/pipeline.d.ts.map +1 -0
  92. package/dist/scene/settings.d.ts +36 -0
  93. package/dist/scene/settings.d.ts.map +1 -0
  94. package/dist/scene/stack.d.ts +25 -0
  95. package/dist/scene/stack.d.ts.map +1 -0
  96. package/dist/scene/stage.d.ts +52 -0
  97. package/dist/scene/stage.d.ts.map +1 -0
  98. package/dist/scene/suggested.d.ts +12 -0
  99. package/dist/scene/suggested.d.ts.map +1 -0
  100. package/dist/scene/tone-mapping.d.ts +20 -0
  101. package/dist/scene/tone-mapping.d.ts.map +1 -0
  102. package/dist/scene/velocity.d.ts +34 -0
  103. package/dist/scene/velocity.d.ts.map +1 -0
  104. package/dist/scene.js +889 -0
  105. package/dist/scene.js.map +1 -0
  106. package/dist/season/nodes.d.ts +13 -0
  107. package/dist/season/nodes.d.ts.map +1 -1
  108. package/dist/shader-hooks-BFRtlWGI.js +275 -0
  109. package/dist/shader-hooks-BFRtlWGI.js.map +1 -0
  110. package/dist/tree/Tree.d.ts +8 -3
  111. package/dist/tree/Tree.d.ts.map +1 -1
  112. package/dist/tree/index.d.ts.map +1 -1
  113. package/dist/weather/index.d.ts +3 -0
  114. package/dist/weather/index.d.ts.map +1 -0
  115. package/dist/weather/shared.d.ts +43 -0
  116. package/dist/weather/shared.d.ts.map +1 -0
  117. package/dist/weather/snow.d.ts +87 -0
  118. package/dist/weather/snow.d.ts.map +1 -0
  119. package/dist/weather/wetness.d.ts +75 -0
  120. package/dist/weather/wetness.d.ts.map +1 -0
  121. package/dist/weather.js +288 -0
  122. package/dist/weather.js.map +1 -0
  123. package/dist/wind/Wind.d.ts +100 -5
  124. package/dist/wind/Wind.d.ts.map +1 -1
  125. package/dist/wind/burst.d.ts +28 -0
  126. package/dist/wind/burst.d.ts.map +1 -0
  127. package/dist/wind/index.d.ts +3 -2
  128. package/dist/wind/index.d.ts.map +1 -1
  129. package/dist/wind/motion.d.ts +30 -0
  130. package/dist/wind/motion.d.ts.map +1 -0
  131. package/dist/wind/node.d.ts +17 -3
  132. package/dist/wind/node.d.ts.map +1 -1
  133. package/package.json +9 -1
  134. package/dist/effects.js.map +0 -1
  135. package/dist/forest-lg61rhKM.js.map +0 -1
@@ -1,8 +1,13 @@
1
- import { BufferGeometry, Group, InstancedMesh, type MeshStandardNodeMaterial } from 'three/webgpu';
1
+ import { BufferGeometry, InstancedMesh, type Camera, type Mesh, type MeshStandardNodeMaterial, type Renderer, type Scene } from 'three/webgpu';
2
2
  import type { MaterialFeatures, TranslucencyDefinition, TreeDefinition } from '../definition';
3
3
  import { type TreeData } from '../generator';
4
+ import { type MaterialFeatureNodes } from '../materials/material-features';
5
+ import { LiveShaderHooks, ShaderHookedGroup, type ShaderHookTarget, type TreeShaderHooks } from '../materials/shader-hooks';
4
6
  import { type TextureOptions } from '../textures';
5
7
  import { Wind, WindResponse, type WindSource } from '../wind';
8
+ import { VariantImpostor } from './impostor';
9
+ import { VariantLevels, type DetailLevelUniforms } from './levels';
10
+ import { type ForestLodOptions, type ForestLodSettings, type ForestLodUpdate } from './lod';
6
11
  import { type ForestPlacement, type ForestTreeTraits } from './placement';
7
12
  /** Options of {@link createForest}. */
8
13
  export interface ForestOptions {
@@ -18,6 +23,15 @@ export interface ForestOptions {
18
23
  wind?: Wind;
19
24
  /** Where the Definition's textures load from (as `createTree(..., { textures })`). */
20
25
  textures?: TextureOptions;
26
+ /**
27
+ * Detail Levels (ADR 0010): draw far trees Light and as Impostors, with a cross-fade. `true` derives
28
+ * the switch distances from the tallest Variant's trunk height. Missing or false: the forest draws
29
+ * every tree in full, exactly as without this option. WebGPU only: on WebGPURenderer's WebGL2
30
+ * fallback it is ignored (one console warning). Switching it on or off needs a new Forest.
31
+ */
32
+ lod?: boolean | ForestLodOptions;
33
+ /** The Tree Shader Hook per tree part (see {@link Forest.shaderHooks}). Default: none. */
34
+ shaderHooks?: TreeShaderHooks;
21
35
  }
22
36
  /** What the GPU draws one tree with (after its offsets). */
23
37
  export interface ForestInstanceState {
@@ -64,6 +78,8 @@ export declare class ForestTree implements ForestTreeTraits {
64
78
  */
65
79
  export declare class ForestVariant {
66
80
  private readonly forest;
81
+ private readonly wind;
82
+ private readonly textures?;
67
83
  readonly index: number;
68
84
  readonly seed: number;
69
85
  readonly data: TreeData;
@@ -82,7 +98,14 @@ export declare class ForestVariant {
82
98
  private readonly woodSource;
83
99
  private readonly leafSource;
84
100
  private readonly fruitSource;
85
- constructor(forest: Forest, definition: TreeDefinition, index: number, seed: number, wind: WindSource, capacity: number, textures?: TextureOptions);
101
+ private readonly definition;
102
+ /** @internal The Detail Levels this Variant draws its trees with; null until they are drawn (lod set, on WebGPU). */
103
+ levels: VariantLevels | null;
104
+ /** Vertex data of the Light level (null until Detail Levels are drawn). */
105
+ private lightSources;
106
+ /** @internal The Impostor of this Variant (atlases and card material); null until Detail Levels are drawn. */
107
+ impostor: VariantImpostor | null;
108
+ constructor(forest: Forest, definition: TreeDefinition, index: number, seed: number, wind: WindSource, capacity: number, textures?: TextureOptions | undefined);
86
109
  /** Instanced mesh of trunks and branches. Replaced (not resized) when the Variant outgrows its capacity. */
87
110
  get wood(): InstancedMesh<BufferGeometry, MeshStandardNodeMaterial>;
88
111
  /** Instanced mesh of the leaves. Replaced along with {@link wood}. */
@@ -92,6 +115,11 @@ export declare class ForestVariant {
92
115
  /** The Variant's meshes: wood, leaves and (with Fruit) fruit. */
93
116
  get meshes(): InstancedMesh<BufferGeometry, MeshStandardNodeMaterial>[];
94
117
  get capacity(): number;
118
+ /**
119
+ * @internal What Tree Shader Hooks shade on this Variant: its bark, leaf and Fruit materials (which draw
120
+ * every Detail Level but Impostor), with each tree's own Season, Growth and position.
121
+ */
122
+ hookTargets(): ShaderHookTarget[];
95
123
  /** @internal */
96
124
  add(tree: ForestTree): void;
97
125
  /** @internal Swap-removes a tree: the last tree takes its slot. */
@@ -100,6 +128,12 @@ export declare class ForestVariant {
100
128
  write(tree: ForestTree): void;
101
129
  /** @internal */
102
130
  state(tree: ForestTree): ForestInstanceState;
131
+ /**
132
+ * @internal Starts drawing this Variant's trees by Detail Level (ADR 0010): a Full and a Light mesh
133
+ * set, drawn indirectly from the level lists, with the Variant's own materials (which get the
134
+ * cross-fade dither). The instanced meshes stay, hidden, for raycasting and Tree IDs.
135
+ */
136
+ enableDetailLevels(uniforms: DetailLevelUniforms, settings: Pick<ForestLodSettings, 'lightDefinition' | 'impostorAtlas'>, setupMesh: (mesh: Mesh) => void, features?: MaterialFeatureNodes | null): void;
103
137
  /** @internal Frees the GPU resources. */
104
138
  dispose(): void;
105
139
  private setCount;
@@ -116,7 +150,7 @@ export declare class ForestVariant {
116
150
  * hash of the forest seed and the tree's id (or position), never from its index, so adding or
117
151
  * removing trees never changes the others. Growth and Season can be set per tree or for all.
118
152
  */
119
- export declare class Forest extends Group {
153
+ export declare class Forest extends ShaderHookedGroup {
120
154
  readonly isForest = true;
121
155
  readonly definition: TreeDefinition;
122
156
  /** The forest seed. */
@@ -129,10 +163,50 @@ export declare class Forest extends Group {
129
163
  private growthValue;
130
164
  private seasonValue;
131
165
  private readonly features;
166
+ protected readonly hooks: LiveShaderHooks;
167
+ /** The trunk height of the tallest Variant (the distances of `lod: true`). */
168
+ private readonly tallestTrunk;
169
+ /** The Detail Levels; null without lod. */
170
+ private readonly detailLevels;
171
+ /**
172
+ * Resolves once every Impostor is baked (far trees draw Light until then); at once without lod; and
173
+ * on dispose. The backend is only known on the first render (three hands the renderer to the
174
+ * Forest's meshes then, not before), so on WebGPURenderer's WebGL2 fallback, where lod is ignored,
175
+ * it resolves on that first render, not at once.
176
+ */
177
+ readonly lodReady: Promise<void>;
132
178
  constructor(definition: TreeDefinition, placements?: readonly ForestPlacement[], options?: ForestOptions);
179
+ /**
180
+ * The Detail Level settings (a copy), null without lod. Setting `light`, `impostor`, `fade` or
181
+ * `camera` (the others kept) only writes uniforms: no rebuild, no recompile. Throws a RangeError for
182
+ * invalid values (keeping the old ones), and on a forest without lod (switching it on needs a new Forest).
183
+ */
184
+ get lod(): ForestLodSettings | null;
185
+ set lod(value: ForestLodUpdate);
186
+ /**
187
+ * @internal The settings `lod` gives this Forest, every default filled in (`lod: true`: the distances
188
+ * from its tallest Variant's trunk height), or null when it is missing or false. Throws a RangeError
189
+ * for invalid settings.
190
+ */
191
+ resolveLod(lod: boolean | ForestLodOptions | undefined): ForestLodSettings | null;
192
+ /** @internal The live Detail Level settings as uniforms (null without lod), for the GPU level selection. */
193
+ get lodUniforms(): DetailLevelUniforms | null;
194
+ /** @internal Whether Detail Levels are drawn: lod is set and the first render was on WebGPU (not the WebGL2 fallback). */
195
+ get lodActive(): boolean;
196
+ /**
197
+ * @internal Called before each instanced mesh is drawn: on the first render of a lod Forest, finds the
198
+ * backend (see `ForestLod`). Does nothing without lod.
199
+ */
200
+ detectLodBackend(renderer: Renderer, scene?: Scene | null, camera?: Camera | null): void;
201
+ /**
202
+ * @internal How many trees each Detail Level drew in the last frame (indexed by DetailLevel; a tree
203
+ * in a cross-fade counts at both levels). All zero until Detail Levels are drawn. Reads the GPU.
204
+ */
205
+ detailLevelCounts(renderer: Renderer): Promise<number[]>;
133
206
  /**
134
207
  * The Wind every tree of this forest sways with. Assigning another Wind only rebinds uniforms:
135
- * no rebuild, no recompile.
208
+ * no rebuild, no recompile (except the one-time node-graph rebuild when the Forest first follows a
209
+ * Wind that has had a Wind Burst, see `Wind.burst`).
136
210
  */
137
211
  get wind(): Wind;
138
212
  set wind(value: Wind);
@@ -162,6 +236,8 @@ export declare class Forest extends Group {
162
236
  /** Season of the whole forest: setting it sets every tree's Season (and that of trees planted later). */
163
237
  get season(): number;
164
238
  set season(value: number);
239
+ /** @internal Materials made later (the Impostor cards) that the hooks shade too. */
240
+ addShaderHookTargets(targets: readonly ShaderHookTarget[]): void;
165
241
  /**
166
242
  * Crown Normals amount (0..1), from the Definition's `materials.leaf.crownNormals`; null when it is off.
167
243
  * Setting it (clamped to 0..1) only writes a uniform: no regeneration, no recompile. Throws on a
@@ -1 +1 @@
1
- {"version":3,"file":"Forest.d.ts","sourceRoot":"","sources":["../../src/forest/Forest.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAGd,KAAK,EAGL,aAAa,EAMb,KAAK,wBAAwB,EAC9B,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAmD,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAO9F,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAa,IAAI,EAAe,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAEtF,OAAO,EAOL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AAErB,uCAAuC;AACvC,MAAM,WAAW,aAAa;IAC5B,iGAAiG;IACjG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2FAA2F;IAC3F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,IAAI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AAsB,CAAC,EAEtD;IAED;;;OAGG;IACH,IAAI,gBAAgB,IAAI,gBAAgB,CAEvC;IAED;;;OAGG;IACH,IAAI,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAErC;IAED,IAAI,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAElC;IAED,gHAAgH;IACvG,OAAO,IAAI,IAAI;CAQzB"}
@@ -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;AAE3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AAM,GAAG,IAAI,GAAG,IAAI;IAoB5E;;;OAGG;IACG,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAUnD,mHAAmH;IACnH,OAAO,IAAI,IAAI;IAKf,8DAA8D;IAC9D,OAAO,CAAC,MAAM;IAOd;;;;OAIG;YACW,IAAI;IAalB;;;OAGG;IACH,OAAO,CAAC,MAAM;CAIf"}
@@ -0,0 +1,106 @@
1
+ import { type MeshStandardNodeMaterial, 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;AAyBlG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAuC,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAIlG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAOzC,8GAA8G;AAC9G,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,IAAI,CAAC;IACb,sGAAsG;IACtG,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wHAAwH;AACxH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC7C;AAgDD,4DAA4D;AAC5D,MAAM,WAAW,aAAa;IAC5B,kHAAkH;IAClH,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;CACvC;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,0DAA0D;IAC1D,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,sFAAsF;IACt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AC,MAAM,CAAC,CAEhH;AAOD,0GAA0G;AAC1G,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,oBAAoB,CAAC;IAC5B,KAAK,EAAE,WAAW,CAAC;CACpB;AAED,iGAAiG;AACjG,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,IAAI,gBAAgB,CAG/G;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,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,E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estTree, 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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