@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,62 @@
1
+ import type { Node } from 'three/webgpu';
2
+ import type { LiveTreeEffect } from './live';
3
+ import type { TreeEffectInput } from './mask';
4
+ import type { TreeEffectsChannels } from './pass';
5
+ import type { TreeEffectsSettings } from './suggested';
6
+ /** A built-in Tree Effect, by its key in {@link TreeEffectsSettings}. */
7
+ export type TreeEffectName = keyof TreeEffectsSettings;
8
+ /** The order the built-in Tree Effects run in (the Highlight last of them, on top). */
9
+ export declare const TREE_EFFECT_ORDER: readonly TreeEffectName[];
10
+ /** Where a custom Tree Effect runs: right before a built-in Tree Effect, or `'end'`: after all of them. */
11
+ export type TreeEffectPlace = TreeEffectName | 'end';
12
+ /**
13
+ * A Tree Effect written by the app, for `TreeEffects.addEffect()`. It is built the way the built-in
14
+ * ones are: on the colour so far and the tree mask, returning its colour node and an `update()`
15
+ * that changes its uniforms live (no new graph, no recompile).
16
+ */
17
+ export interface CustomTreeEffect<Options = undefined> {
18
+ /**
19
+ * Runs right before this built-in Tree Effect, whether that one is on or not, or with `'end'` after
20
+ * every built-in Tree Effect, the Highlight too (in the Scene Pipeline still before the Scene
21
+ * Effects); custom effects at the same place run in the order they were added. Default
22
+ * `'highlight'`: after every other built-in effect, and under the Highlight.
23
+ */
24
+ before?: TreeEffectPlace;
25
+ /**
26
+ * The optional channels the effect reads (`treeId`, `normal`): the scene pass adds them (ADR 0009)
27
+ * and they are in the effect's input. Undeclared channels are never in its input, even when a
28
+ * built-in effect has them on. Default: none (colour, tree mask, depth and camera only).
29
+ */
30
+ channels?: TreeEffectsChannels;
31
+ /**
32
+ * Builds the effect. `input.color` is the colour so far (the scene colour, or the result of the
33
+ * effects before this one); `input.mask` is the tree mask: r = any tree, g = leaves only,
34
+ * b = selected trees. Called again with the latest options whenever the graph is rebuilt.
35
+ */
36
+ build(input: TreeEffectInput, options: Options): LiveTreeEffect<Options>;
37
+ }
38
+ /** The options argument of `addEffect`: optional when the effect's options may be `undefined`. */
39
+ export type CustomTreeEffectOptions<Options> = undefined extends Options ? [options?: Options] : [options: Options];
40
+ /**
41
+ * Internal: the custom Tree Effects of a pipeline (`TreeEffects`, the Scene Pipeline) with their
42
+ * latest options. It decides their part of the graph's shape and of the scene pass's channels, and
43
+ * builds them into a graph at their places.
44
+ */
45
+ export declare class CustomTreeEffectList {
46
+ private entries;
47
+ /** The custom effects, in the order they were added. */
48
+ get effects(): readonly CustomTreeEffect<never>[];
49
+ add<Options>(effect: CustomTreeEffect<Options>, options: Options): void;
50
+ /** Stores the options (used on rebuilds) and sets them on the built effect. */
51
+ update<Options>(effect: CustomTreeEffect<Options>, options: Options): void;
52
+ /** Whether the effect was there. */
53
+ remove(effect: CustomTreeEffect<never>): boolean;
54
+ /** The channels the custom effects declare. */
55
+ channels(): TreeEffectsChannels;
56
+ /** Their part of a graph's shape: which effects, in which order and at which places. */
57
+ shape(): string;
58
+ /** Builds the custom effects placed before `name` (or at the `'end'`) onto `input.color` and returns the resulting colour. */
59
+ buildBefore(name: TreeEffectPlace, input: TreeEffectInput): Node<'vec4'>;
60
+ private find;
61
+ }
62
+ //# sourceMappingURL=custom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/effects/custom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,yEAAyE;AACzE,MAAM,MAAM,cAAc,GAAG,MAAM,mBAAmB,CAAC;AAEvD,uFAAuF;AACvF,eAAO,MAAM,iBAAiB,EAAE,SAAS,cAAc,EAA4D,CAAC;AAEpH,2GAA2G;AAC3G,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,KAAK,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,OAAO,GAAG,SAAS;IACnD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;CAC1E;AAED,kGAAkG;AAClG,MAAM,MAAM,uBAAuB,CAAC,OAAO,IAAI,SAAS,SAAS,OAAO,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAWpH;;;;GAIG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,OAAO,CAAe;IAE9B,wDAAwD;IACxD,IAAI,OAAO,IAAI,SAAS,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAEhD;IAED,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAKvE,+EAA+E;IAC/E,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAO1E,oCAAoC;IACpC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,OAAO;IAMhD,+CAA+C;IAC/C,QAAQ,IAAI,mBAAmB;IAO/B,wFAAwF;IACxF,KAAK,IAAI,MAAM;IAIf,8HAA8H;IAC9H,WAAW,CAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC;IAUxE,OAAO,CAAC,IAAI;CAGb"}
@@ -1,15 +1,35 @@
1
1
  import { RenderPipeline, type Camera, type Node, type Object3D, type Renderer, type Scene } from 'three/webgpu';
2
2
  import type { StyleName } from '../styles/registry';
3
- import { type TreeEffectInput, type TreeEffectsPass } from './mask';
3
+ import type { LiveTreeEffect } from './live';
4
+ import { CustomTreeEffectList, type CustomTreeEffect, type CustomTreeEffectOptions } from './custom';
5
+ import type { TreeEffectInput } from './mask';
6
+ import { type TreeEffectsChannels, type TreeEffectsPass } from './pass';
4
7
  import { type TreeEffectsSettings } from './suggested';
8
+ import type { ForestTree } from '../forest';
9
+ import type { Tree } from '../tree';
5
10
  /**
6
11
  * Applies a combination of Tree Effects to `input` and returns the resulting colour node, for use in
7
12
  * your own post-processing pipeline (`pipeline.outputNode = applyTreeEffects(...)`, or feed it into
8
- * more effects). Order: colour grade, leaf glow, outline. Empty settings return `input.color`.
13
+ * more effects). Order: colour grade, leaf glow, inner lines, outline, highlight (always on top).
14
+ * Empty settings return `input.color`. `highlighted`: the trees the Highlight marks (mutable, read every frame).
9
15
  */
10
- export declare function applyTreeEffects(input: TreeEffectInput, settings: TreeEffectsSettings): Node<'vec4'>;
16
+ export declare function applyTreeEffects(input: TreeEffectInput, settings: TreeEffectsSettings, highlighted?: readonly (Tree | ForestTree)[]): Node<'vec4'>;
17
+ /**
18
+ * The shape of a combination: what its graph is built from (the effects that are on, the glow
19
+ * radius, the outline's `betweenTrees` and the normal encoding of Inner Lines). Settings of the same
20
+ * shape only differ in uniforms.
21
+ */
22
+ export declare function treeEffectsShape(settings: TreeEffectsSettings, input: TreeEffectInput, custom?: CustomTreeEffectList): string;
23
+ /**
24
+ * {@link applyTreeEffects} with every colour and number as a uniform; `update()` needs the same shape.
25
+ * Internal (not in the /effects index): shared with the Scene Pipeline (`src/scene`). `custom`: the
26
+ * app's own Tree Effects, built in at their places (their `update()` is the list's, not this one's).
27
+ */
28
+ export declare function liveTreeEffects(input: TreeEffectInput, settings: TreeEffectsSettings, highlighted: readonly (Tree | ForestTree)[], custom?: CustomTreeEffectList): LiveTreeEffect<TreeEffectsSettings>;
11
29
  /** The suggested combination of a built-in Style, or the settings themselves; `null` = no effects. */
12
30
  export type TreeEffectsChoice = StyleName | TreeEffectsSettings | null;
31
+ /** The settings of a choice; throws for an unknown Style. Internal, shared with the Scene Pipeline. */
32
+ export declare function resolveTreeEffects(choice: TreeEffectsChoice): TreeEffectsSettings;
13
33
  export interface TreeEffectsOptions {
14
34
  /** Which effects: a Style name (its suggested combination), custom settings, or `null` (none). Default: none. */
15
35
  effects?: TreeEffectsChoice;
@@ -18,7 +38,28 @@ export interface TreeEffectsOptions {
18
38
  * Default: every tree in the scene.
19
39
  */
20
40
  selection?: Object3D[];
41
+ /**
42
+ * Keeps the Tree ID channel on even when no effect needs it, for {@link TreeEffects.pick}.
43
+ * Default: false (the channel is only rendered when an effect needs it). Whenever the Tree ID
44
+ * channel is on (this option, `outline.betweenTrees`, `highlight`, or the low-poly suggestion),
45
+ * the scene pass renders without MSAA: an integer target cannot be multisampled.
46
+ */
47
+ treeId?: boolean;
48
+ /**
49
+ * The trees the Highlight marks (`effects: { highlight: {...} }`): Trees and Forest trees, at most
50
+ * 64; mutable, read every frame, so hover and selection changes never recompile. Default: none
51
+ * (a new empty list, see {@link TreeEffects.highlighted}).
52
+ */
53
+ highlighted?: (Tree | ForestTree)[];
21
54
  }
55
+ /**
56
+ * The extra channels the scene pass needs for `settings` (with the `treeId` option and the channels
57
+ * the custom effects declare). Only this set decides the scene pass's MRT: settings that need the
58
+ * same channels keep it.
59
+ */
60
+ export declare function channelsFor(settings: TreeEffectsSettings, options: Pick<TreeEffectsOptions, 'treeId'>, custom?: CustomTreeEffectList): TreeEffectsChannels;
61
+ /** A key that is equal for equal sets of channels. */
62
+ export declare function channelsKey(channels: object): string;
22
63
  /**
23
64
  * A ready-made post-processing pipeline (`RenderPipeline`) with the Tree Effects: render with
24
65
  * `effects.render()` instead of `renderer.render(scene, camera)`. Switch the combination with
@@ -26,21 +67,66 @@ export interface TreeEffectsOptions {
26
67
  * and {@link applyTreeEffects} instead.
27
68
  */
28
69
  export declare class TreeEffects {
70
+ private readonly renderer;
71
+ private readonly scene;
72
+ private readonly camera;
73
+ private readonly options;
29
74
  readonly pipeline: RenderPipeline;
30
- /** The scene pass (colour + tree mask). */
31
- readonly scenePass: TreeEffectsPass;
75
+ /** The trees the Highlight marks (the `highlighted` option, or an empty list): change it in place. */
76
+ readonly highlighted: (Tree | ForestTree)[];
32
77
  private nodes;
33
78
  private current;
79
+ private readonly custom;
80
+ private graph;
81
+ private input;
34
82
  constructor(renderer: Renderer, scene: Scene, camera: Camera, options?: TreeEffectsOptions);
83
+ /**
84
+ * The scene pass (colour + tree mask, plus the channels the settings need, such as the Tree ID).
85
+ *
86
+ * It is replaced by a new one (a new object, the old one disposed) when {@link set} needs another
87
+ * set of channels, and only then; read it again after such a `set()` rather than keeping it.
88
+ * Swapping only the MRT of one PassNode is not feasible with three: a PassNode can add targets
89
+ * (`getTexture`) but has no way to remove one, and its sample count is fixed per target, so
90
+ * turning a channel off (or the Tree ID off, which brings MSAA back) needs a new pass. Either way
91
+ * the scene's materials recompile, because the MRT changes; settings that need the same channels
92
+ * keep this pass and its MRT.
93
+ */
94
+ get scenePass(): TreeEffectsPass;
35
95
  /** The active combination (`{}` = none). */
36
96
  get settings(): TreeEffectsSettings;
37
- /** Switches to a Style's suggested combination, custom settings, or none (`null`). */
97
+ /**
98
+ * Switches to a Style's suggested combination, custom settings, or none (`null`). With the same
99
+ * effects on (and the same glow radius) only the colours and numbers change, without a recompile;
100
+ * otherwise a new graph is built and the old one freed.
101
+ */
38
102
  set(effects: TreeEffectsChoice): void;
103
+ /** The app's own Tree Effects, in the order they were added (see {@link addEffect}). */
104
+ get customEffects(): readonly CustomTreeEffect<never>[];
105
+ /**
106
+ * Adds a Tree Effect of the app's own (see {@link CustomTreeEffect}) with its options, at the place
107
+ * it names among the built-in effects. It stays through {@link set} until {@link removeEffect}.
108
+ * Builds a new graph, and a new scene pass if it declares a channel that is not on yet.
109
+ */
110
+ addEffect<Options>(effect: CustomTreeEffect<Options>, ...[options]: CustomTreeEffectOptions<Options>): void;
111
+ /** Changes the options of an added custom effect live, through its `update()` (no new graph, no recompile). */
112
+ updateEffect<Options>(effect: CustomTreeEffect<Options>, options: Options): void;
113
+ /** Removes a custom effect (nothing happens if it is not added); its channels go when nothing else needs them. */
114
+ removeEffect<Options>(effect: CustomTreeEffect<Options>): void;
115
+ /** Brings the scene pass and the graph in line with the settings and the custom effects. */
116
+ private rebuild;
117
+ /**
118
+ * GPU picking: the Tree or Forest tree under a point of the canvas (CSS pixels from its top left
119
+ * corner, as `event.offsetX/offsetY`) in the last render, or `undefined` where no tree is drawn.
120
+ * Needs the Tree ID channel: throws when it is off (create the effects with `treeId: true`).
121
+ */
122
+ pick(x: number, y: number): Promise<Tree | ForestTree | undefined>;
39
123
  /** Renders the scene with the effects (call instead of `renderer.render(scene, camera)`). */
40
124
  render(): void;
41
125
  dispose(): void;
42
126
  private disposeNodes;
43
127
  }
128
+ /** The render-target owning nodes (blur) in an effects graph, to dispose them on change. */
129
+ export declare function collectEffectNodes(output: Node, stop: Node): Node[];
44
130
  /** Shorthand for `new TreeEffects(renderer, scene, camera, options)`. */
45
131
  export declare function createTreeEffects(renderer: Renderer, scene: Scene, camera: Camera, options?: TreeEffectsOptions): TreeEffects;
46
132
  //# sourceMappingURL=effects.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"effects.d.ts","sourceRoot":"","sources":["../../src/effects/effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,MAAM,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAChH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAmB,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,QAAQ,CAAC;AAErF,OAAO,EAA0B,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE/E;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE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B,GAAG,IAAI;IAKrC,wFAAwF;IACxF,IAAI,aAAa,IAAI,SAAS,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAEtD;IAED;;;;OAIG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,uBAAuB,CAAC,OAAO,CAAC,GAAG,IAAI;IAK3G,+GAA+G;IAC/G,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAIhF,kHAAkH;IAClH,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,IAAI;IAI9D,4FAA4F;IAC5F,OAAO,CAAC,OAAO;IAuBf;;;;OAIG;IACH,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,UAAU,GAAG,SAAS,CAAC;IAMlE,6FAA6F;IAC7F,MAAM,IAAI,IAAI;IAId,OAAO,IAAI,IAAI;IAMf,OAAO,CAAC,YAAY;CAIrB;AAED,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAWnE;AAED,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,WAAW,CAE7H"}
@@ -1,4 +1,5 @@
1
1
  import { type ColorRepresentation, type Node } from 'three/webgpu';
2
+ import type { LiveTreeEffect } from './live';
2
3
  import type { TreeEffectInput } from './mask';
3
4
  /** Leaf glow settings. */
4
5
  export interface LeafGlowOptions {
@@ -11,9 +12,13 @@ export interface LeafGlowOptions {
11
12
  /** Blur radius (Gaussian sigma, in pixels at half resolution; default 6). */
12
13
  radius?: number;
13
14
  }
15
+ /** The blur radius of leaf glow settings (part of a Tree Effects graph's shape). */
16
+ export declare function glowRadius(options: LeafGlowOptions): number;
14
17
  /**
15
18
  * Tree Effect: a soft glow of the leaves. The bright (sunlit) leaf pixels are blurred and added
16
19
  * back onto the tree pixels (leaves and the wood between them), never onto the rest of the scene.
17
20
  */
18
21
  export declare function leafGlow(input: TreeEffectInput, options?: LeafGlowOptions): Node<'vec4'>;
22
+ /** {@link leafGlow} with its settings as uniforms; `radius` is fixed when built. */
23
+ export declare function liveLeafGlow(input: TreeEffectInput, options?: LeafGlowOptions): LiveTreeEffect<LeafGlowOptions>;
19
24
  //# sourceMappingURL=glow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"glow.d.ts","sourceRoot":"","sources":["../../src/effects/glow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,mBAAmB,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAG1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,0BAA0B;AAC1B,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,eAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,CAO5F"}
1
+ {"version":3,"file":"glow.d.ts","sourceRoot":"","sources":["../../src/effects/glow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,mBAAmB,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAG1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,0BAA0B;AAC1B,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAE3D;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,eAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,CAE5F;AAED,oFAAoF;AACpF,wBAAgB,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,eAAoB,GAAG,cAAc,CAAC,eAAe,CAAC,CAmBnH"}
@@ -1,4 +1,5 @@
1
1
  import { type ColorRepresentation, type Node } from 'three/webgpu';
2
+ import type { LiveTreeEffect } from './live';
2
3
  import type { TreeEffectInput } from './mask';
3
4
  /** Tree colour grading settings (all optional; the defaults change nothing). */
4
5
  export interface TreeColorGradeOptions {
@@ -16,4 +17,6 @@ export interface TreeColorGradeOptions {
16
17
  * Returns the graded colour where the tree mask is set and `input.color` unchanged elsewhere.
17
18
  */
18
19
  export declare function treeColorGrade(input: TreeEffectInput, options?: TreeColorGradeOptions): Node<'vec4'>;
20
+ /** {@link treeColorGrade} with its settings as uniforms. */
21
+ export declare function liveTreeColorGrade(input: TreeEffectInput, options?: TreeColorGradeOptions): LiveTreeEffect<TreeColorGradeOptions>;
19
22
  //# sourceMappingURL=grade.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grade.d.ts","sourceRoot":"","sources":["../../src/effects/grade.ts"],"names":[],"mappings":"AAAA,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GAAG,cAAc,CAAC,qBAAqB,CAAC,CAkBrI"}
@@ -0,0 +1,35 @@
1
+ import { type ColorRepresentation, type Node } from 'three/webgpu';
2
+ import type { ForestTree } from '../forest';
3
+ import type { Tree } from '../tree';
4
+ import type { LiveTreeEffect } from './live';
5
+ import type { TreeEffectInput } from './mask';
6
+ /** Highlight settings. */
7
+ export interface TreeHighlightOptions {
8
+ /** Colour the highlighted trees are tinted towards (default a warm yellow, '#ffe066'). */
9
+ color?: ColorRepresentation;
10
+ /** How far the trees are tinted towards `color`, 0..1 (default 0.25). */
11
+ tint?: number;
12
+ /** Brightness multiplier of the highlighted trees (default 1.25). */
13
+ brightness?: number;
14
+ /** Colour of the ring just outside the highlighted trees (default '#ffd23f'). */
15
+ outlineColor?: ColorRepresentation;
16
+ /** Width of the ring in pixels (default 2). */
17
+ thickness?: number;
18
+ /** Opacity of the whole Highlight, 0..1 (default 1). */
19
+ strength?: number;
20
+ /**
21
+ * Pulse frequency in Hz: tint and brightness swing between their value and half of it (half the
22
+ * brightening); the ring stays solid. Default 0 = no pulse.
23
+ */
24
+ pulse?: number;
25
+ }
26
+ /**
27
+ * Tree Effect: marks the trees in `highlighted` (Trees and Forest trees; mutable, read every frame)
28
+ * by brightening and tinting their pixels and drawing a ring just outside them, the one Tree Effect
29
+ * that also changes pixels next to a tree. At most 64 trees (the rest is ignored with one warning); removed, disposed
30
+ * and undrawn trees are skipped. Needs the Tree ID input (`treeEffectsPass` with `{ treeId: true }`).
31
+ */
32
+ export declare function treeHighlight(input: TreeEffectInput, highlighted: readonly (Tree | ForestTree)[], options?: TreeHighlightOptions): Node<'vec4'>;
33
+ /** {@link treeHighlight} with its settings as uniforms. */
34
+ export declare function liveTreeHighlight(input: TreeEffectInput, highlighted: readonly (Tree | ForestTree)[], options?: TreeHighlightOptions): LiveTreeEffect<TreeHighlightOptions>;
35
+ //# sourceMappingURL=highlight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../src/effects/highlight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,mBAAmB,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAI9C,0BAA0B;AAC1B,MAAM,WAAW,oBAAoB;IACnC,0FAA0F;IAC1F,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAgBD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,CAAC,IAAI,GAAG,UAAU,CAAC,EAAE,EAAE,OAAO,GAAE,oBAAyB,GAAG,IAAI,CAAC,MAAM,CAAC,CAEnJ;AAED,2DAA2D;AAC3D,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,eAAe,EACtB,WAAW,EAAE,SAAS,CAAC,IAAI,GAAG,UAAU,CAAC,EAAE,EAC3C,OAAO,GAAE,oBAAyB,GACjC,cAAc,CAAC,oBAAoB,CAAC,CAoFtC"}
@@ -1,7 +1,13 @@
1
- export { TREE_MASK, createTreeMask, treeMaskMRT, treeEffectsPass, treePartOf, type TreeEffectInput, type TreeEffectsPass, type TreePart } from './mask';
1
+ export { TREE_MASK, createTreeMask, treeMaskMRT, treePartOf, type TreeEffectInput, type TreePart } from './mask';
2
+ export { treeEffectsPass, type TreeEffectsChannels, type TreeEffectsPass } from './pass';
2
3
  export { treeOutline, type TreeOutlineOptions } from './outline';
4
+ export { innerLines, TREE_NORMAL, treeNormalMRT, type InnerLinesOptions } from './inner-lines';
3
5
  export { leafGlow, type LeafGlowOptions } from './glow';
4
6
  export { treeColorGrade, type TreeColorGradeOptions } from './grade';
7
+ export { treeHighlight, type TreeHighlightOptions } from './highlight';
8
+ export { TREE_ID, readTreeId, treeFromId, treeIdMRT, treeIdOf, treeIdTexture } from './tree-id';
5
9
  export { SUGGESTED_TREE_EFFECTS, type TreeEffectsSettings } from './suggested';
10
+ export { type CustomTreeEffect, type CustomTreeEffectOptions, type TreeEffectName, type TreeEffectPlace } from './custom';
11
+ export { type LiveTreeEffect } from './live';
6
12
  export { applyTreeEffects, createTreeEffects, TreeEffects, type TreeEffectsChoice, type TreeEffectsOptions, } from './effects';
7
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/effects/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACxJ,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACxB,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/effects/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACjH,OAAO,EAAE,eAAe,EAAE,KAAK,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAChG,OAAO,EAAE,sBAAsB,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAC1H,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACxB,MAAM,WAAW,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { type ColorRepresentation, type MRTNode, type Node } from 'three/webgpu';
2
+ import type { LiveTreeEffect } from './live';
3
+ import type { TreeEffectInput } from './mask';
4
+ /** Name of the view normal output in a pass's MRT (`scenePass.getTextureNode('normal')`), see {@link treeNormalMRT}. */
5
+ export declare const TREE_NORMAL = "normal";
6
+ /**
7
+ * The MRT output that renders view normals in the `'color'` encoding (`packNormalToRGB(normalView)`,
8
+ * the same as `directionToColor`) to a target named `normal`, for Inner Lines. Merge it into the MRT
9
+ * of your own scene pass and make the target RGBA8:
10
+ * `scenePass.setMRT(mrt({ output }).merge(treeMaskMRT()).merge(treeNormalMRT())); scenePass.getTexture('normal').type = UnsignedByteType;`.
11
+ * If your pipeline already renders normals (GTAO, SSR), pass that texture as the `normal` input instead.
12
+ */
13
+ export declare function treeNormalMRT(): MRTNode;
14
+ /** Inner Lines settings. */
15
+ export interface InnerLinesOptions {
16
+ /** Line colour (default a dark green-brown). */
17
+ color?: ColorRepresentation;
18
+ /** How far apart (in pixels) the compared pixels are, which sets the line width (default 1). */
19
+ thickness?: number;
20
+ /** Opacity of the lines, 0..1 (default 1). */
21
+ strength?: number;
22
+ /** A line where the normals of neighbouring pixels differ by more than this, as 1 − dot (default 0.4). */
23
+ normalThreshold?: number;
24
+ /** A line where neighbouring pixels step away by more than this, as relative depth |Δz| / z (default 0.02). */
25
+ depthThreshold?: number;
26
+ }
27
+ /**
28
+ * Tree Effect: ink lines inside the trees where the surface folds (normal edges) or steps away
29
+ * from the viewer (depth edges), such as around each leaf clump. Only drawn on tree pixels (of
30
+ * every tree, regardless of the outline's `selection`), and only from neighbours that are tree
31
+ * pixels too: the silhouette is left to the outline. Needs the `depth`, `camera` and `normal` inputs
32
+ * (`treeEffectsPass(scene, camera, null, { normal: true })` has them) and throws without them.
33
+ * Works with a standard, reversed (`reversedDepthBuffer`) or logarithmic (`logarithmicDepthBuffer`)
34
+ * depth buffer, and with perspective and orthographic cameras.
35
+ */
36
+ export declare function innerLines(input: TreeEffectInput, options?: InnerLinesOptions): Node<'vec4'>;
37
+ /** {@link innerLines} with its settings as uniforms; the normal encoding is fixed when built. */
38
+ export declare function liveInnerLines(input: TreeEffectInput, options?: InnerLinesOptions): LiveTreeEffect<InnerLinesOptions>;
39
+ //# sourceMappingURL=inner-lines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inner-lines.d.ts","sourceRoot":"","sources":["../../src/effects/inner-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,mBAAmB,EAAE,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAExF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAG9C,wHAAwH;AACxH,eAAO,MAAM,WAAW,WAAW,CAAC;AAEpC;;;;;;GAMG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED,4BAA4B;AAC5B,MAAM,WAAW,iBAAiB;IAChC,gDAAgD;IAChD,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,gGAAgG;IAChG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0GAA0G;IAC1G,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+GAA+G;IAC/G,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,iBAAsB,GAAG,IAAI,CAAC,MAAM,CAAC,CAEhG;AAED,iGAAiG;AACjG,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,iBAAsB,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAkDzH"}
@@ -0,0 +1,12 @@
1
+ import type { Node } from 'three/webgpu';
2
+ /**
3
+ * A built Tree Effect whose colours and numbers are uniforms: `update()` changes them in place
4
+ * (no new graph, no recompile). Settings that change the graph itself (its shape) need a new build.
5
+ */
6
+ export interface LiveTreeEffect<Options> {
7
+ /** The resulting colour node. */
8
+ node: Node<'vec4'>;
9
+ /** Sets the uniforms to `options` (the shape-defining settings are ignored). */
10
+ update(options: Options): void;
11
+ }
12
+ //# sourceMappingURL=live.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../../src/effects/live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC;;;GAGG;AACH,MAAM,WAAW,cAAc,CAAC,OAAO;IACrC,iCAAiC;IACjC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACnB,gFAAgF;IAChF,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAChC"}
@@ -1,18 +1,26 @@
1
- import { type Camera, type Material, type MRTNode, type Node, type Object3D, type PassNode, type Scene, type TextureNode } from 'three/webgpu';
1
+ import { type Camera, type Material, type MRTNode, type Node, type Object3D, type TextureNode } from 'three/webgpu';
2
2
  /** Name of the tree mask output in a pass's MRT (`scenePass.getTextureNode(TREE_MASK)`). */
3
3
  export declare const TREE_MASK = "treeMask";
4
4
  /** The part of a tree a material draws. */
5
5
  export type TreePart = 'bark' | 'leaves' | 'fruit';
6
+ /** Every tree part, in their fixed order. */
7
+ export declare const TREE_PARTS: readonly TreePart[];
6
8
  /**
7
9
  * Which tree part a material draws: 'bark', 'leaves' or 'fruit' for tree.js materials (and their clones),
8
10
  * `null` for anything else. Tree Effects only change the pixels drawn by these materials.
9
11
  */
10
12
  export declare function treePartOf(material: Material | null | undefined): TreePart | null;
13
+ /**
14
+ * @internal For a material with `treePart` 'leaves' that also draws wood (an Impostor card): the
15
+ * fragment's leaf amount (0 wood .. 1 leaves), the tree mask's g there.
16
+ */
17
+ export declare function setTreeLeafMask(material: Material, leaf: Node<'float'>): void;
11
18
  /**
12
19
  * TSL node: the tree mask value of the object being drawn, `vec4(tree, leaves, selected, 1)`:
13
20
  * r = 1 on tree pixels (bark, leaves and Fruit), g = 1 on leaf pixels, b = 1 on pixels of selected trees (the outline's
14
21
  * selection), 0 elsewhere. A per-object uniform decided from the drawn material
15
- * ({@link treePartOf}), so no tree material is changed and every other object writes 0.
22
+ * ({@link treePartOf}), so no tree material is changed and every other object writes 0. An Impostor
23
+ * card (wood and leaves in one picture) writes g per fragment, from its baked leaf flag.
16
24
  *
17
25
  * `selection`: the selected tree objects (Trees, Forests, any ancestor of tree meshes), read on
18
26
  * every draw, so it may be changed in place. `null` (default) selects every tree.
@@ -30,15 +38,27 @@ export interface TreeEffectInput {
30
38
  color: Node<'vec4'>;
31
39
  /** Tree mask texture (see {@link createTreeMask}), e.g. `scenePass.getTextureNode(TREE_MASK)`. */
32
40
  mask: TextureNode;
41
+ /**
42
+ * Tree ID texture (`r32uint`, see `treeIdMRT`), e.g. `scenePass.getTextureNode(TREE_ID)`; only
43
+ * needed by effects that tell trees apart. Read it with exact texel loads, never filtered.
44
+ */
45
+ treeId?: TextureNode;
46
+ /**
47
+ * Scene depth texture, e.g. `scenePass.getTextureNode('depth')`; only needed by effects that
48
+ * compare distances (the outline's `betweenTrees`, and Inner Lines with `camera`).
49
+ */
50
+ depth?: TextureNode;
51
+ /** The camera the scene pass renders with (its near and far turn `depth` into view Z). */
52
+ camera?: Camera;
53
+ /**
54
+ * View-space normal texture, e.g. `scenePass.getTextureNode('normal')` (see `treeNormalMRT`, or
55
+ * your own normal MRT); only needed by Inner Lines. Encoded as `normalEncoding` says.
56
+ */
57
+ normal?: TextureNode;
58
+ /**
59
+ * How `normal` stores the view normal: `'color'` (default) = `directionToColor(normalView)`, as in
60
+ * an RGBA8 target; `'direction'` = the normal itself, as in a float target.
61
+ */
62
+ normalEncoding?: 'color' | 'direction';
33
63
  }
34
- /** A scene pass that renders the colour and the tree mask, ready for the Tree Effects. */
35
- export interface TreeEffectsPass extends TreeEffectInput {
36
- pass: PassNode;
37
- }
38
- /**
39
- * Creates `pass(scene, camera)` with MRT `{ output, treeMask }` and returns it with its colour and
40
- * mask texture nodes. `selection`: the trees to outline (default `null` = all trees), see
41
- * {@link createTreeMask}. If your pipeline already has a scene pass, merge {@link treeMaskMRT} into it instead.
42
- */
43
- export declare function treeEffectsPass(scene: Scene, camera: Camera, selection?: readonly Object3D[] | null): TreeEffectsPass;
44
64
  //# sourceMappingURL=mask.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../../src/effects/mask.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,KAAK,EACV,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAGtB,4FAA4F;AAC5F,eAAO,MAAM,SAAS,aAAa,CAAC;AAEpC,2CAA2C;AAC3C,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,IAAI,CAGjF;AAOD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,SAAS,GAAE,SAAS,QAAQ,EAAE,GAAG,IAAW,GAAG,IAAI,CAAC,MAAM,CAAC,CAOzF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,SAAS,GAAE,SAAS,QAAQ,EAAE,GAAG,IAAW,GAAG,OAAO,CAIjF;AAED,6FAA6F;AAC7F,MAAM,WAAW,eAAe;IAC9B,6FAA6F;IAC7F,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACpB,kGAAkG;IAClG,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,0FAA0F;AAC1F,MAAM,WAAW,eAAgB,SAAQ,eAA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W,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,0FAA0F;IAC1F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;CACxC"}
@@ -1,4 +1,5 @@
1
1
  import { type ColorRepresentation, type Node } from 'three/webgpu';
2
+ import type { LiveTreeEffect } from './live';
2
3
  import type { TreeEffectInput } from './mask';
3
4
  /** Tree outline settings. */
4
5
  export interface TreeOutlineOptions {
@@ -8,11 +9,22 @@ export interface TreeOutlineOptions {
8
9
  thickness?: number;
9
10
  /** Opacity of the line, 0..1 (default 1). */
10
11
  strength?: number;
12
+ /**
13
+ * Also draw the line between overlapping trees (Tree–Tree, Forest tree–Forest tree, Tree–Forest
14
+ * tree): on a selected tree pixel next to another tree that is further away, so the line lies on
15
+ * the front tree's side, as thick as the outer outline (with a standard, reversed or logarithmic
16
+ * depth buffer). Needs the `treeId` and `depth` inputs (see `treeEffectsPass`). Default false.
17
+ * Changing it builds a new graph.
18
+ */
19
+ betweenTrees?: boolean;
11
20
  }
12
21
  /**
13
22
  * Tree Effect: an outline along the silhouettes of the selected trees (the `selection` of the
14
23
  * tree mask, see `createTreeMask`; all trees by default), around the outside of the canopy and
15
24
  * the gaps in it. The line is drawn on the inside of the silhouette, so only tree pixels change.
25
+ * With `betweenTrees`, it is also drawn where a tree overlaps another one behind it.
16
26
  */
17
27
  export declare function treeOutline(input: TreeEffectInput, options?: TreeOutlineOptions): Node<'vec4'>;
28
+ /** {@link treeOutline} with its settings as uniforms. */
29
+ export declare function liveTreeOutline(input: TreeEffectInput, options?: TreeOutlineOptions): LiveTreeEffect<TreeOutlineOptions>;
18
30
  //# sourceMappingURL=outline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"outline.d.ts","sourceRoot":"","sources":["../../src/effects/outline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,mBAAmB,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,6BAA6B;AAC7B,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,kBAAuB,GAAG,IAAI,CAAC,MAAM,CAAC,CAYlG"}
1
+ {"version":3,"file":"outline.d.ts","sourceRoot":"","sources":["../../src/effects/outline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,mBAAmB,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAG9C,6BAA6B;AAC7B,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,kBAAuB,GAAG,IAAI,CAAC,MAAM,CAAC,CAElG;AAED,yDAAyD;AACzD,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,kBAAuB,GAAG,cAAc,CAAC,kBAAkB,CAAC,CAwB5H"}
@@ -0,0 +1,27 @@
1
+ import { type Camera, type Object3D, type PassNode, type Scene } from 'three/webgpu';
2
+ import { type TreeEffectInput } from './mask';
3
+ /**
4
+ * The opt-in extra channels of a scene pass, next to the colour and the tree mask (which are always
5
+ * there). Each one adds an MRT target, so leave them off unless an effect (or picking) needs them.
6
+ */
7
+ export interface TreeEffectsChannels {
8
+ /**
9
+ * The Tree ID target (`treeIdMRT`), for effects that tell trees apart and for picking. Turns MSAA
10
+ * off on the scene pass (see `treeIdTexture`).
11
+ */
12
+ treeId?: boolean;
13
+ /** The view normal target (`treeNormalMRT`, RGBA8, the 'color' encoding), for Inner Lines. */
14
+ normal?: boolean;
15
+ }
16
+ /** A scene pass that renders the colour, the tree mask and the chosen channels, ready for the Tree Effects. */
17
+ export interface TreeEffectsPass extends TreeEffectInput {
18
+ pass: PassNode;
19
+ }
20
+ /**
21
+ * Creates `pass(scene, camera)` with MRT `{ output, treeMask }` (plus the opt-in `channels`, e.g.
22
+ * `{ treeId: true }`, `{ normal: true }`) and returns it with the texture nodes of every target (and the depth and camera) as the effects' inputs.
23
+ * `selection`: the trees to outline (default `null` = all trees), see `createTreeMask`. If your
24
+ * pipeline already has a scene pass, merge `treeMaskMRT` (and `treeIdMRT`) into it instead.
25
+ */
26
+ export declare function treeEffectsPass(scene: Scene, camera: Camera, selection?: readonly Object3D[] | null, channels?: TreeEffectsChannels): TreeEffectsPass;
27
+ //# sourceMappingURL=pass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pass.d.ts","sourceRoot":"","sources":["../../src/effects/pass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAEvG,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,QAAQ,CAAC;AAItE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8FAA8F;IAC9F,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,+GAA+G;AAC/G,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,SAAS,QAAQ,EAAE,GAAG,IAAW,EAC5C,QAAQ,GAAE,mBAAwB,GACjC,eAAe,CAwBjB"}
@@ -0,0 +1,31 @@
1
+ import type { Camera, Node, TextureNode } from 'three/webgpu';
2
+ /** Eight sample directions around a pixel, unit length: the four axes and the four diagonals. */
3
+ export declare const EIGHT_DIRECTIONS: readonly (readonly [number, number])[];
4
+ /** Four sample directions around a pixel: the axes. */
5
+ export declare const FOUR_DIRECTIONS: readonly (readonly [number, number])[];
6
+ /** The size of a texture in pixels, as a `vec2`. */
7
+ export declare function sizeOf(texture: TextureNode): Node<'vec2'>;
8
+ /**
9
+ * The texel `offset` px from the pixel being shaded, clamped to the texture, for exact texel loads
10
+ * (`texture.load(texelAt(texture, offset))`) of unfiltered targets such as the Tree ID.
11
+ */
12
+ export declare function texelAt(texture: TextureNode, offset: Node<'vec2'>): Node<'ivec2'>;
13
+ /** The Tree ID at a texel (see {@link texelAt}): 0 where no tree is drawn. */
14
+ export declare function treeIdAt(treeId: TextureNode, texel: Node<'ivec2'>): Node<'uint'>;
15
+ /** An optional input an effect needs, or an error naming the effect, the input and where to get it. */
16
+ export declare function requireInput<T>(effect: string, value: T | undefined, name: string, hint: string): T;
17
+ /**
18
+ * Whether the scene depth `depth` is further from the camera than `than` (both raw values of the
19
+ * scene pass's depth texture). Decided per renderer when the shader is built: a reversed depth
20
+ * buffer (`reversedDepthBuffer`) stores 1 at the near plane and 0 at the far plane, a standard or
21
+ * logarithmic one the other way around.
22
+ */
23
+ export declare const isFurther: (depth: Node<"float">, than: Node<"float">) => Node<"bool">;
24
+ /**
25
+ * A function turning a raw value of the scene pass's depth texture into view Z (negative, in world
26
+ * units) for `camera` (its near and far are read every render). It follows the renderer's depth
27
+ * buffer: standard, reversed (`reversedDepthBuffer`) or logarithmic (`logarithmicDepthBuffer`,
28
+ * which three only applies to perspective cameras).
29
+ */
30
+ export declare function viewZFromDepth(camera: Camera): (depth: Node<'float'>) => Node<'float'>;
31
+ //# sourceMappingURL=screen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../../src/effects/screen.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAe,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3E,iGAAiG;AACjG,eAAO,MAAM,gBAAgB,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAGlE,CAAC;AACF,uDAAuD;AACvD,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAuC,CAAC;AAE1G,oDAAoD;AACpD,wBAAgB,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,CAEzD;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAEjF;AAED,8EAA8E;AAC9E,wBAAgB,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAEhF;AAED,uGAAuG;AACvG,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAGnG;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,EAEN,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC;AAE5E;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,CAkBtF"}
@@ -1,12 +1,17 @@
1
1
  import type { StyleName } from '../styles/registry';
2
2
  import type { TreeColorGradeOptions } from './grade';
3
3
  import type { LeafGlowOptions } from './glow';
4
+ import type { TreeHighlightOptions } from './highlight';
4
5
  import type { TreeOutlineOptions } from './outline';
6
+ import type { InnerLinesOptions } from './inner-lines';
5
7
  /** A combination of Tree Effects; leave an effect out to skip it. `{}` = no effects. */
6
8
  export interface TreeEffectsSettings {
7
9
  grade?: TreeColorGradeOptions;
8
10
  glow?: LeafGlowOptions;
9
11
  outline?: TreeOutlineOptions;
12
+ innerLines?: InnerLinesOptions;
13
+ /** Marks the TreeEffects' `highlighted` trees; never in a suggestion. */
14
+ highlight?: TreeHighlightOptions;
10
15
  }
11
16
  /** The suggested combination of Tree Effects for each built-in Style. */
12
17
  export declare const SUGGESTED_TREE_EFFECTS: Record<StyleName, TreeEffectsSettings>;
@@ -1 +1 @@
1
- {"version":3,"file":"suggested.d.ts","sourceRoot":"","sources":["../../src/effects/suggested.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD,wFAAwF;AACxF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