@casmo/tree.js 0.1.1 → 0.3.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 (220) hide show
  1. package/README.md +312 -16
  2. package/dist/apply-Cio2t7CZ.js +285 -0
  3. package/dist/apply-Cio2t7CZ.js.map +1 -0
  4. package/dist/bake/index.d.ts +44 -5
  5. package/dist/bake/index.d.ts.map +1 -1
  6. package/dist/definition/crown-shape.d.ts +9 -0
  7. package/dist/definition/crown-shape.d.ts.map +1 -0
  8. package/dist/definition/defaults.d.ts +15 -1
  9. package/dist/definition/defaults.d.ts.map +1 -1
  10. package/dist/definition/index.d.ts +4 -3
  11. package/dist/definition/index.d.ts.map +1 -1
  12. package/dist/definition/migrations.d.ts +0 -8
  13. package/dist/definition/migrations.d.ts.map +1 -1
  14. package/dist/definition/schema.d.ts.map +1 -1
  15. package/dist/definition/types.d.ts +181 -6
  16. package/dist/definition/types.d.ts.map +1 -1
  17. package/dist/effects/mask.d.ts +3 -3
  18. package/dist/effects/mask.d.ts.map +1 -1
  19. package/dist/effects.js +3 -3
  20. package/dist/effects.js.map +1 -1
  21. package/dist/forest/Forest.d.ts +37 -2
  22. package/dist/forest/Forest.d.ts.map +1 -1
  23. package/dist/forest/nodes.d.ts +6 -1
  24. package/dist/forest/nodes.d.ts.map +1 -1
  25. package/dist/{forest-OX9WvAwh.js → forest-ChEaWJrf.js} +1763 -684
  26. package/dist/forest-ChEaWJrf.js.map +1 -0
  27. package/dist/generator/branches.d.ts +2 -2
  28. package/dist/generator/branches.d.ts.map +1 -1
  29. package/dist/generator/crown.d.ts +28 -0
  30. package/dist/generator/crown.d.ts.map +1 -0
  31. package/dist/generator/fruit.d.ts +28 -0
  32. package/dist/generator/fruit.d.ts.map +1 -0
  33. package/dist/generator/growth.d.ts +1 -1
  34. package/dist/generator/growth.d.ts.map +1 -1
  35. package/dist/generator/index.d.ts +5 -4
  36. package/dist/generator/index.d.ts.map +1 -1
  37. package/dist/generator/leaf-shapes.d.ts +33 -1
  38. package/dist/generator/leaf-shapes.d.ts.map +1 -1
  39. package/dist/generator/mesh.d.ts +10 -2
  40. package/dist/generator/mesh.d.ts.map +1 -1
  41. package/dist/generator/occlusion.d.ts +8 -0
  42. package/dist/generator/occlusion.d.ts.map +1 -0
  43. package/dist/generator/roots.d.ts +16 -0
  44. package/dist/generator/roots.d.ts.map +1 -0
  45. package/dist/generator/trunk.d.ts +16 -2
  46. package/dist/generator/trunk.d.ts.map +1 -1
  47. package/dist/generator/types.d.ts +61 -6
  48. package/dist/generator/types.d.ts.map +1 -1
  49. package/dist/growth/index.d.ts +1 -1
  50. package/dist/growth/index.d.ts.map +1 -1
  51. package/dist/growth/tsl.d.ts +2 -0
  52. package/dist/growth/tsl.d.ts.map +1 -1
  53. package/dist/index.d.ts +6 -3
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +274 -24
  56. package/dist/index.js.map +1 -1
  57. package/dist/materials/crown-nodes.d.ts +20 -0
  58. package/dist/materials/crown-nodes.d.ts.map +1 -0
  59. package/dist/materials/crown-normals.d.ts +17 -0
  60. package/dist/materials/crown-normals.d.ts.map +1 -0
  61. package/dist/materials/ground-tint.d.ts +13 -0
  62. package/dist/materials/ground-tint.d.ts.map +1 -0
  63. package/dist/materials/index.d.ts +13 -1
  64. package/dist/materials/index.d.ts.map +1 -1
  65. package/dist/materials/leaf-translucency-model.d.ts +14 -0
  66. package/dist/materials/leaf-translucency-model.d.ts.map +1 -0
  67. package/dist/materials/leaf-translucency.d.ts +73 -0
  68. package/dist/materials/leaf-translucency.d.ts.map +1 -0
  69. package/dist/materials/material-features.d.ts +43 -0
  70. package/dist/materials/material-features.d.ts.map +1 -0
  71. package/dist/materials/occlusion.d.ts +10 -0
  72. package/dist/materials/occlusion.d.ts.map +1 -0
  73. package/dist/materials/toon.d.ts +18 -1
  74. package/dist/materials/toon.d.ts.map +1 -1
  75. package/dist/names-BE9he6CS.js +713 -0
  76. package/dist/names-BE9he6CS.js.map +1 -0
  77. package/dist/react/Tree.d.ts +5 -2
  78. package/dist/react/Tree.d.ts.map +1 -1
  79. package/dist/react.js +10 -6
  80. package/dist/react.js.map +1 -1
  81. package/dist/season/nodes.d.ts +16 -0
  82. package/dist/season/nodes.d.ts.map +1 -1
  83. package/dist/season/profile.d.ts +26 -0
  84. package/dist/season/profile.d.ts.map +1 -1
  85. package/dist/species/almond.js +223 -0
  86. package/dist/species/almond.js.map +1 -0
  87. package/dist/species/almond.json +210 -0
  88. package/dist/species/apple.js +230 -0
  89. package/dist/species/apple.js.map +1 -0
  90. package/dist/species/apple.json +220 -0
  91. package/dist/species/ash.js +187 -0
  92. package/dist/species/ash.js.map +1 -0
  93. package/dist/species/ash.json +177 -0
  94. package/dist/species/beech.js +174 -0
  95. package/dist/species/beech.js.map +1 -0
  96. package/dist/species/beech.json +167 -0
  97. package/dist/species/birch.js +170 -0
  98. package/dist/species/birch.js.map +1 -0
  99. package/dist/species/birch.json +163 -0
  100. package/dist/species/catalog.d.ts +61 -0
  101. package/dist/species/catalog.d.ts.map +1 -0
  102. package/dist/species/cedar.js +169 -0
  103. package/dist/species/cedar.js.map +1 -0
  104. package/dist/species/cedar.json +168 -0
  105. package/dist/species/cherry.js +237 -0
  106. package/dist/species/cherry.js.map +1 -0
  107. package/dist/species/cherry.json +224 -0
  108. package/dist/species/chestnut.js +230 -0
  109. package/dist/species/chestnut.js.map +1 -0
  110. package/dist/species/chestnut.json +220 -0
  111. package/dist/species/douglas-fir.js +174 -0
  112. package/dist/species/douglas-fir.js.map +1 -0
  113. package/dist/species/douglas-fir.json +170 -0
  114. package/dist/species/elm.js +173 -0
  115. package/dist/species/elm.js.map +1 -0
  116. package/dist/species/elm.json +163 -0
  117. package/dist/species/hemlock.js +175 -0
  118. package/dist/species/hemlock.js.map +1 -0
  119. package/dist/species/hemlock.json +171 -0
  120. package/dist/species/hickory.js +200 -0
  121. package/dist/species/hickory.js.map +1 -0
  122. package/dist/species/hickory.json +192 -0
  123. package/dist/species/index.d.ts +10 -0
  124. package/dist/species/index.d.ts.map +1 -0
  125. package/dist/species/juniper.js +158 -0
  126. package/dist/species/juniper.js.map +1 -0
  127. package/dist/species/juniper.json +154 -0
  128. package/dist/species/loaders.d.ts +7 -0
  129. package/dist/species/loaders.d.ts.map +1 -0
  130. package/dist/species/mahogany.js +201 -0
  131. package/dist/species/mahogany.js.map +1 -0
  132. package/dist/species/mahogany.json +196 -0
  133. package/dist/species/maple.js +177 -0
  134. package/dist/species/maple.js.map +1 -0
  135. package/dist/species/maple.json +171 -0
  136. package/dist/species/oak.js +220 -0
  137. package/dist/species/oak.js.map +1 -0
  138. package/dist/species/oak.json +212 -0
  139. package/dist/species/olive.js +189 -0
  140. package/dist/species/olive.js.map +1 -0
  141. package/dist/species/olive.json +181 -0
  142. package/dist/species/peach.js +223 -0
  143. package/dist/species/peach.js.map +1 -0
  144. package/dist/species/peach.json +210 -0
  145. package/dist/species/pear.js +213 -0
  146. package/dist/species/pear.js.map +1 -0
  147. package/dist/species/pear.json +200 -0
  148. package/dist/species/pine.js +163 -0
  149. package/dist/species/pine.js.map +1 -0
  150. package/dist/species/pine.json +162 -0
  151. package/dist/species/plum.js +237 -0
  152. package/dist/species/plum.js.map +1 -0
  153. package/dist/species/plum.json +224 -0
  154. package/dist/species/red-oak.js +220 -0
  155. package/dist/species/red-oak.js.map +1 -0
  156. package/dist/species/red-oak.json +212 -0
  157. package/dist/species/redwood.js +174 -0
  158. package/dist/species/redwood.js.map +1 -0
  159. package/dist/species/redwood.json +170 -0
  160. package/dist/species/sequoia.js +167 -0
  161. package/dist/species/sequoia.js.map +1 -0
  162. package/dist/species/sequoia.json +166 -0
  163. package/dist/species/spruce.js +170 -0
  164. package/dist/species/spruce.js.map +1 -0
  165. package/dist/species/spruce.json +166 -0
  166. package/dist/species/teak.js +166 -0
  167. package/dist/species/teak.js.map +1 -0
  168. package/dist/species/teak.json +157 -0
  169. package/dist/species/types.d.ts +65 -0
  170. package/dist/species/types.d.ts.map +1 -0
  171. package/dist/species/walnut.js +220 -0
  172. package/dist/species/walnut.js.map +1 -0
  173. package/dist/species/walnut.json +212 -0
  174. package/dist/species/white-oak.js +213 -0
  175. package/dist/species/white-oak.js.map +1 -0
  176. package/dist/species/white-oak.json +208 -0
  177. package/dist/species.js +160 -0
  178. package/dist/species.js.map +1 -0
  179. package/dist/styles/apply.d.ts +12 -0
  180. package/dist/styles/apply.d.ts.map +1 -0
  181. package/dist/styles/low-poly/index.d.ts +1 -1
  182. package/dist/styles/low-poly/index.d.ts.map +1 -1
  183. package/dist/styles/low-poly.js +13 -10
  184. package/dist/styles/low-poly.js.map +1 -1
  185. package/dist/styles/material-features.d.ts +27 -0
  186. package/dist/styles/material-features.d.ts.map +1 -0
  187. package/dist/styles/names.d.ts +28 -0
  188. package/dist/styles/names.d.ts.map +1 -0
  189. package/dist/styles/realistic/index.d.ts +3 -8
  190. package/dist/styles/realistic/index.d.ts.map +1 -1
  191. package/dist/styles/realistic/textures.d.ts +20 -0
  192. package/dist/styles/realistic/textures.d.ts.map +1 -0
  193. package/dist/styles/realistic.js +14 -18
  194. package/dist/styles/realistic.js.map +1 -1
  195. package/dist/styles/registry.d.ts +2 -13
  196. package/dist/styles/registry.d.ts.map +1 -1
  197. package/dist/styles/stylized/index.d.ts +1 -1
  198. package/dist/styles/stylized/index.d.ts.map +1 -1
  199. package/dist/styles/stylized.js +13 -10
  200. package/dist/styles/stylized.js.map +1 -1
  201. package/dist/styles/types.d.ts +16 -2
  202. package/dist/styles/types.d.ts.map +1 -1
  203. package/dist/textures/realistic/bark-fibrous-normal.png +0 -0
  204. package/dist/textures/realistic/bark-fibrous.png +0 -0
  205. package/dist/textures/realistic/bark-papery-normal.png +0 -0
  206. package/dist/textures/realistic/bark-papery.png +0 -0
  207. package/dist/textures/realistic/bark-plated-normal.png +0 -0
  208. package/dist/textures/realistic/bark-plated.png +0 -0
  209. package/dist/textures/realistic/bark-smooth-normal.png +0 -0
  210. package/dist/textures/realistic/bark-smooth.png +0 -0
  211. package/dist/textures/realistic/leaf-compound.png +0 -0
  212. package/dist/textures/realistic/leaf-lobed.png +0 -0
  213. package/dist/textures/realistic/leaf-palmate.png +0 -0
  214. package/dist/textures/realistic/scale.png +0 -0
  215. package/dist/tree/Tree.d.ts +34 -5
  216. package/dist/tree/Tree.d.ts.map +1 -1
  217. package/package.json +9 -2
  218. package/dist/forest-OX9WvAwh.js.map +0 -1
  219. package/dist/types-BZjHhNz7.js +0 -20
  220. package/dist/types-BZjHhNz7.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leaf-translucency-model.d.ts","sourceRoot":"","sources":["../../src/materials/leaf-translucency-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,wBAAwB,EAC7B,KAAK,IAAI,EAEV,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAOL,KAAK,sBAAsB,EAC5B,MAAM,qBAAqB,CAAC;AA4B7B;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,wBAAwB,EAClC,MAAM,EAAE,sBAAsB,EAC9B,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,GACpB,IAAI,CAON"}
@@ -0,0 +1,73 @@
1
+ import type { LightingModelDirectInput, Node, NodeBuilder } from 'three/webgpu';
2
+ import type { CrownVolume } from '../generator';
3
+ /** The diffuse parts of the reflected light a lighting model adds to (RGB). */
4
+ export interface DiffuseLight {
5
+ directDiffuse: Node<'vec3'>;
6
+ indirectDiffuse: Node<'vec3'>;
7
+ }
8
+ /** The part of three's lighting context (`builder.context` in a lighting model) the terms read and write. */
9
+ export interface LightingContext {
10
+ irradiance: Node<'vec3'>;
11
+ ambientOcclusion: Node<'float'>;
12
+ reflectedLight: DiffuseLight;
13
+ }
14
+ /** One direct light as a lighting model's `direct` gets it: view-space direction, colour (with shadow). */
15
+ export interface DirectLight {
16
+ lightDirection: Node<'vec3'>;
17
+ lightColor: Node<'vec3'>;
18
+ reflectedLight: DiffuseLight;
19
+ }
20
+ /** The lighting context of a lighting model's builder, typed (see {@link LightingContext}). */
21
+ export declare const lightingContext: (builder: NodeBuilder) => LightingContext;
22
+ /** A lighting model's `direct` input, typed (see {@link DirectLight}). */
23
+ export declare const directLight: (input: LightingModelDirectInput) => DirectLight;
24
+ /**
25
+ * Leaf Translucency (GLOSSARY) as one shared TSL term, used by both leaf lighting models: the physical
26
+ * one (`TranslucentLightingModel`, flat and standard shading) and `SoftToonLightingModel` (toon).
27
+ * Build it with {@link leafTranslucencyTerm}; the values are uniforms, so changing them needs no recompile.
28
+ */
29
+ export interface LeafTranslucencyTerm extends LeafTranslucencyValues {
30
+ /** How thin the crown is at this fragment: 1 on (or outside) the Crown Volume's shell, towards 0 at its centre. */
31
+ readonly thinness: Node<'float'>;
32
+ }
33
+ /** The settings of `materials.leaf.translucency` as nodes (uniforms, shared by every leaf material of a Tree or Forest). */
34
+ export interface LeafTranslucencyValues {
35
+ /** Direct glow per light (0..1). */
36
+ readonly strength: Node<'float'>;
37
+ /** Indirect (sky) glow (0..1). */
38
+ readonly ambient: Node<'float'>;
39
+ /** Extra glow at the thin edge of the Crown Volume (0..1). */
40
+ readonly edge: Node<'float'>;
41
+ }
42
+ /**
43
+ * The term for a leaf material: `values` the settings of `materials.leaf.translucency`, `crown` the tree's
44
+ * Crown Volume (`TreeData.crown`, tree space, fully grown) and `growth` the Growth node the material
45
+ * grows with (the Tree's uniform, or a Forest's per-instance Growth).
46
+ *
47
+ * Thinness is the Crown Volume distance (`crownNodes`): measured in the tree's own space on the grown
48
+ * position before Wind (so Wind doesn't make it flicker), against the Volume scaled by the same Growth scale
49
+ * the vertices get. Being in tree space, it is the same for every Forest instance whatever its rotation and
50
+ * scale. It needs no vertex attribute.
51
+ */
52
+ export declare function leafTranslucencyTerm(values: LeafTranslucencyValues, crown: CrownVolume, growth: Node<'float'>): LeafTranslucencyTerm;
53
+ /**
54
+ * Direct light shining through the leaf towards the viewer, for one light (add it to `directDiffuse`):
55
+ * `lightColor × leaf diffuse × strength × back × edgeBoost`, where `back` is a smooth power of
56
+ * dot(view direction, -light direction). `lightColor` already carries the light's shadow, so shadowed
57
+ * leaves don't glow. The leaf diffuse is its Season colour (Season Profile x the Seed's tint x leaf map).
58
+ * Unlike the lit side it has no Lambert 1/pi: like a real leaf against the sun, a strongly translucent leaf
59
+ * glows brighter than one lit from the front.
60
+ */
61
+ export declare function translucencyDirect(term: LeafTranslucencyTerm, lightDirection: Node<'vec3'>, lightColor: Node<'vec3'>): Node<'vec3'>;
62
+ /**
63
+ * Indirect light shining through the leaf (add it to `indirectDiffuse` after the model's own AO step):
64
+ * `irradiance × leaf diffuse × ambient × edgeBoost × ambient occlusion`, the leaf diffuse through the
65
+ * Lambert BRDF like the rest of the indirect light.
66
+ *
67
+ * The irradiance from behind would be the irradiance sampled along the flipped normal; three's public
68
+ * lighting-model API only exposes the irradiance already gathered along the normal (`context.irradiance`),
69
+ * so that stands in for it. It is exact for ambient light and light probes' constant part; under a
70
+ * hemisphere light it reads the side facing the viewer.
71
+ */
72
+ export declare function translucencyIndirect(term: LeafTranslucencyTerm, builder: NodeBuilder): Node<'vec3'>;
73
+ //# sourceMappingURL=leaf-translucency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leaf-translucency.d.ts","sourceRoot":"","sources":["../../src/materials/leaf-translucency.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAShD,+EAA+E;AAC/E,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,6GAA6G;AAC7G,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACzB,gBAAgB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,cAAc,EAAE,YAAY,CAAC;CAC9B;AAED,2GAA2G;AAC3G,MAAM,WAAW,WAAW;IAC1B,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7B,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACzB,cAAc,EAAE,YAAY,CAAC;CAC9B;AAED,+FAA+F;AAC/F,eAAO,MAAM,eAAe,GAAI,SAAS,WAAW,KAAG,eAAqD,CAAC;AAE7G,0EAA0E;AAC1E,eAAO,MAAM,WAAW,GAAI,OAAO,wBAAwB,KAAG,WAA8C,CAAC;AAQ7G;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB;IAClE,mHAAmH;IACnH,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;CAClC;AAED,4HAA4H;AAC5H,MAAM,WAAW,sBAAsB;IACrC,oCAAoC;IACpC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,kCAAkC;IAClC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;CAC9B;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,sBAAsB,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,oBAAoB,CAOpI;AAKD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,oBAAoB,EAAE,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAOnI;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,CAQnG"}
@@ -0,0 +1,43 @@
1
+ import type { MeshStandardNodeMaterial, Node, NodeMaterial } from 'three/webgpu';
2
+ import type { MaterialFeatures, TranslucencyDefinition, TreeDefinition } from '../definition';
3
+ import type { CrownVolume } from '../generator';
4
+ /** One tree's materials to give the Material Features (a Tree's, or one Forest Variant's). */
5
+ export interface MaterialFeatureTarget {
6
+ /** The leaf material (Crown Normals, Leaf Translucency). */
7
+ leaf: MeshStandardNodeMaterial;
8
+ /** Every material of the tree: bark, leaf and Fruit (Structural Occlusion). */
9
+ materials: readonly (NodeMaterial | null)[];
10
+ /** The tree's Crown Volume (`TreeData.crown`). */
11
+ crown: CrownVolume;
12
+ /** The Growth node the materials' `positionNode` grows with. */
13
+ growth: Node<'float'>;
14
+ /** Turns a tree-space normal into the mesh's own space (a Forest rotates it by the instance). Default: as is. */
15
+ toObject?: (normal: Node<'vec3'>) => Node<'vec3'>;
16
+ }
17
+ /**
18
+ * The Material Features (GLOSSARY, ADR 0008) of a Tree or Forest: applies those the Definition sets to
19
+ * the materials of each target and owns their values as uniforms, shared by all targets, so a feature
20
+ * that is on can be tuned live (no regeneration, no recompile). A feature that is off leaves the
21
+ * materials exactly as they are and cannot be tuned (switching one on needs a new Tree or Forest).
22
+ */
23
+ export declare class LiveMaterialFeatures {
24
+ private readonly crown;
25
+ private readonly translucencyValues;
26
+ private readonly occlusion;
27
+ constructor(definition: TreeDefinition, targets: readonly MaterialFeatureTarget[]);
28
+ /** The features that are on, with their current values (same shape as `materialFeaturesOf`). */
29
+ get values(): MaterialFeatures;
30
+ /** Crown Normals amount, null when off. */
31
+ get crownNormals(): number | null;
32
+ /** Sets the Crown Normals amount (clamped to 0..1); throws when the feature is off. */
33
+ set crownNormals(value: number);
34
+ /** Leaf Translucency settings (a copy), null when off. */
35
+ get translucency(): TranslucencyDefinition | null;
36
+ /** Sets any of the Leaf Translucency settings (each clamped to 0..1; the others kept); throws when the feature is off. */
37
+ set translucency(value: Partial<TranslucencyDefinition>);
38
+ /** Structural Occlusion strength, null when off. */
39
+ get occlusionStrength(): number | null;
40
+ /** Sets the Structural Occlusion strength (clamped to 0..1); throws when the feature is off. */
41
+ set occlusionStrength(value: number);
42
+ }
43
+ //# sourceMappingURL=material-features.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"material-features.d.ts","sourceRoot":"","sources":["../../src/materials/material-features.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE,YAAY,EAAe,MAAM,cAAc,CAAC;AAC9F,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAQhD,8FAA8F;AAC9F,MAAM,WAAW,qBAAqB;IACpC,4DAA4D;IAC5D,IAAI,EAAE,wBAAwB,CAAC;IAC/B,+EAA+E;IAC/E,SAAS,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,CAAC;IAC5C,kDAAkD;IAClD,KAAK,EAAE,WAAW,CAAC;IACnB,gEAAgE;IAChE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACtB,iHAAiH;IACjH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC;CACnD;AAID;;;;;GAKG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;IAC5C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA+E;IAClH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsB;gBAEpC,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,qBAAqB,EAAE;IAcjF,gGAAgG;IAChG,IAAI,MAAM,IAAI,gBAAgB,CAc7B;IAED,2CAA2C;IAC3C,IAAI,YAAY,IAAI,MAAM,GAAG,IAAI,CAEhC;IAED,uFAAuF;IACvF,IAAI,YAAY,CAAC,KAAK,EAAE,MAAM,EAK7B;IAED,0DAA0D;IAC1D,IAAI,YAAY,IAAI,sBAAsB,GAAG,IAAI,CAEhD;IAED,0HAA0H;IAC1H,IAAI,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,sBAAsB,CAAC,EAQtD;IAED,oDAAoD;IACpD,IAAI,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAErC;IAED,gGAAgG;IAChG,IAAI,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAKlC;CACF"}
@@ -0,0 +1,10 @@
1
+ import type { Node, NodeMaterial } from 'three/webgpu';
2
+ /**
3
+ * Structural Occlusion (GLOSSARY, ADR 0008) on a tree's own materials: each material's `aoNode` becomes
4
+ * `mix(1, aOcclusion, strength)`, from the Generator's baked `aOcclusion` (only generated when
5
+ * `materials.occlusion` is set). three applies it as it does the material's built-in AO (multiplied with an
6
+ * app's SSAO/GTAO through `context.getAO`), so it only darkens ambient and indirect light; the toon model's
7
+ * indirect light multiplies by it too. `strength` is a uniform, so tuning it needs no recompile.
8
+ */
9
+ export declare function applyStructuralOcclusion(materials: readonly (NodeMaterial | null)[], strength: Node<'float'>): void;
10
+ //# sourceMappingURL=occlusion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"occlusion.d.ts","sourceRoot":"","sources":["../../src/materials/occlusion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEvD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAGnH"}
@@ -1,4 +1,21 @@
1
- import { MeshStandardNodeMaterial, type PhysicalLightingModel } from 'three/webgpu';
1
+ import { LightingModel, MeshStandardNodeMaterial, type LightingModelDirectInput, type NodeBuilder, type PhysicalLightingModel } from 'three/webgpu';
2
+ import { type LeafTranslucencyTerm } from './leaf-translucency';
3
+ /**
4
+ * Soft toon lighting: two tones (lit and shaded) per light with a smooth band in between,
5
+ * plus plain diffuse ambient/hemisphere light. No specular or environment reflections. Built
6
+ * in TSL from the light direction only, so it needs no gradient texture (no image files).
7
+ *
8
+ * With a Leaf Translucency term (leaf material only, `applyLeafTranslucency`), leaves with light behind them also glow:
9
+ * the same shared term the physical leaf model adds.
10
+ */
11
+ export declare class SoftToonLightingModel extends LightingModel {
12
+ private readonly translucency;
13
+ constructor(translucency?: LeafTranslucencyTerm | null);
14
+ /** Whether this model adds Leaf Translucency. */
15
+ get isLeafTranslucencyModel(): boolean;
16
+ direct({ lightDirection, lightColor, reflectedLight }: LightingModelDirectInput): void;
17
+ indirect(builder: NodeBuilder): void;
18
+ }
2
19
  /**
3
20
  * The stylized Style's material (`materials.shading: 'toon'`): a `MeshStandardNodeMaterial`
4
21
  * lit by the soft toon model. Staying a standard material keeps every part node (Season
@@ -1 +1 @@
1
- {"version":3,"file":"toon.d.ts","sourceRoot":"","sources":["../../src/materials/toon.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,wBAAwB,EAGxB,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAC;AAiCtB;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,wBAAwB;IAChE,QAAQ,CAAC,kBAAkB,QAAQ;IAE1B,kBAAkB,IAAI,qBAAqB;CAIrD"}
1
+ {"version":3,"file":"toon.d.ts","sourceRoot":"","sources":["../../src/materials/toon.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAA4C,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAY1G;;;;;;;GAOG;AACH,qBAAa,qBAAsB,SAAQ,aAAa;IAC1C,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAAZ,YAAY,GAAE,oBAAoB,GAAG,IAAW;IAI7E,iDAAiD;IACjD,IAAI,uBAAuB,IAAI,OAAO,CAErC;IAEQ,MAAM,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,wBAAwB,GAAG,IAAI;IAQtF,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;CAM9C;AAED;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,wBAAwB;IAChE,QAAQ,CAAC,kBAAkB,QAAQ;IAE1B,kBAAkB,IAAI,qBAAqB;CAIrD"}