webgpu-trees 0.0.0-stage → 0.2.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 (330) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1547 -2
  3. package/assets/SOURCES.md +263 -0
  4. package/assets/bark/alder.albedo.avif +0 -0
  5. package/assets/bark/alder.normal.avif +0 -0
  6. package/assets/bark/aleppoPine.albedo.avif +0 -0
  7. package/assets/bark/aleppoPine.normal.avif +0 -0
  8. package/assets/bark/ash.albedo.avif +0 -0
  9. package/assets/bark/ash.normal.avif +0 -0
  10. package/assets/bark/aspen.albedo.avif +0 -0
  11. package/assets/bark/aspen.normal.avif +0 -0
  12. package/assets/bark/beech.albedo.avif +0 -0
  13. package/assets/bark/beech.normal.avif +0 -0
  14. package/assets/bark/birch.albedo.avif +0 -0
  15. package/assets/bark/birch.normal.avif +0 -0
  16. package/assets/bark/birchFoot.albedo.avif +0 -0
  17. package/assets/bark/birchFoot.normal.avif +0 -0
  18. package/assets/bark/corsicanPine.albedo.avif +0 -0
  19. package/assets/bark/corsicanPine.normal.avif +0 -0
  20. package/assets/bark/cypress.albedo.avif +0 -0
  21. package/assets/bark/cypress.normal.avif +0 -0
  22. package/assets/bark/douglas.albedo.avif +0 -0
  23. package/assets/bark/douglas.normal.avif +0 -0
  24. package/assets/bark/eucalyptus.albedo.avif +0 -0
  25. package/assets/bark/eucalyptus.normal.avif +0 -0
  26. package/assets/bark/eucalyptusUpper.albedo.avif +0 -0
  27. package/assets/bark/eucalyptusUpper.normal.avif +0 -0
  28. package/assets/bark/fibrous.albedo.avif +0 -0
  29. package/assets/bark/fibrous.normal.avif +0 -0
  30. package/assets/bark/hemlock.albedo.avif +0 -0
  31. package/assets/bark/hemlock.normal.avif +0 -0
  32. package/assets/bark/hornbeam.albedo.avif +0 -0
  33. package/assets/bark/hornbeam.normal.avif +0 -0
  34. package/assets/bark/larch.albedo.avif +0 -0
  35. package/assets/bark/larch.normal.avif +0 -0
  36. package/assets/bark/lime.albedo.avif +0 -0
  37. package/assets/bark/lime.normal.avif +0 -0
  38. package/assets/bark/liveOak.albedo.avif +0 -0
  39. package/assets/bark/liveOak.normal.avif +0 -0
  40. package/assets/bark/magnolia.albedo.avif +0 -0
  41. package/assets/bark/magnolia.normal.avif +0 -0
  42. package/assets/bark/maple.albedo.avif +0 -0
  43. package/assets/bark/maple.normal.avif +0 -0
  44. package/assets/bark/montereyPine.albedo.avif +0 -0
  45. package/assets/bark/montereyPine.normal.avif +0 -0
  46. package/assets/bark/norMaple.albedo.avif +0 -0
  47. package/assets/bark/norMaple.normal.avif +0 -0
  48. package/assets/bark/oak.albedo.avif +0 -0
  49. package/assets/bark/oak.normal.avif +0 -0
  50. package/assets/bark/palmLattice.albedo.avif +0 -0
  51. package/assets/bark/palmLattice.normal.avif +0 -0
  52. package/assets/bark/palmPineapple.albedo.avif +0 -0
  53. package/assets/bark/palmPineapple.normal.avif +0 -0
  54. package/assets/bark/palmRings.albedo.avif +0 -0
  55. package/assets/bark/palmRings.normal.avif +0 -0
  56. package/assets/bark/pine.albedo.avif +0 -0
  57. package/assets/bark/pine.normal.avif +0 -0
  58. package/assets/bark/pineFlakes.albedo.avif +0 -0
  59. package/assets/bark/pineFlakes.normal.avif +0 -0
  60. package/assets/bark/plane.albedo.avif +0 -0
  61. package/assets/bark/plane.normal.avif +0 -0
  62. package/assets/bark/poplar.albedo.avif +0 -0
  63. package/assets/bark/poplar.normal.avif +0 -0
  64. package/assets/bark/redAlder.albedo.avif +0 -0
  65. package/assets/bark/redAlder.normal.avif +0 -0
  66. package/assets/bark/redOak.albedo.avif +0 -0
  67. package/assets/bark/redOak.normal.avif +0 -0
  68. package/assets/bark/ridged.albedo.avif +0 -0
  69. package/assets/bark/ridged.normal.avif +0 -0
  70. package/assets/bark/sitkaSpruce.albedo.avif +0 -0
  71. package/assets/bark/sitkaSpruce.normal.avif +0 -0
  72. package/assets/bark/spruce.albedo.avif +0 -0
  73. package/assets/bark/spruce.normal.avif +0 -0
  74. package/assets/bark/stonePine.albedo.avif +0 -0
  75. package/assets/bark/stonePine.normal.avif +0 -0
  76. package/assets/bark/sweetgum.albedo.avif +0 -0
  77. package/assets/bark/sweetgum.normal.avif +0 -0
  78. package/assets/bark/sycMaple.albedo.avif +0 -0
  79. package/assets/bark/sycMaple.normal.avif +0 -0
  80. package/assets/bark/torreyPine.albedo.avif +0 -0
  81. package/assets/bark/torreyPine.normal.avif +0 -0
  82. package/assets/bark/whitePine.albedo.avif +0 -0
  83. package/assets/bark/whitePine.normal.avif +0 -0
  84. package/assets/bark/whiteSpruce.albedo.avif +0 -0
  85. package/assets/bark/whiteSpruce.normal.avif +0 -0
  86. package/assets/bark/whiteWillow.albedo.avif +0 -0
  87. package/assets/bark/whiteWillow.normal.avif +0 -0
  88. package/assets/bark/willow.albedo.avif +0 -0
  89. package/assets/bark/willow.normal.avif +0 -0
  90. package/assets/leaves/alder.albedo.avif +0 -0
  91. package/assets/leaves/alder.normal.avif +0 -0
  92. package/assets/leaves/ash.albedo.avif +0 -0
  93. package/assets/leaves/ash.normal.avif +0 -0
  94. package/assets/leaves/aspen.albedo.avif +0 -0
  95. package/assets/leaves/aspen.normal.avif +0 -0
  96. package/assets/leaves/beech.albedo.avif +0 -0
  97. package/assets/leaves/beech.normal.avif +0 -0
  98. package/assets/leaves/birch.albedo.avif +0 -0
  99. package/assets/leaves/birch.normal.avif +0 -0
  100. package/assets/leaves/blackthorn.albedo.avif +0 -0
  101. package/assets/leaves/blackthorn.normal.avif +0 -0
  102. package/assets/leaves/blade.albedo.avif +0 -0
  103. package/assets/leaves/blade.normal.avif +0 -0
  104. package/assets/leaves/broomSprig.albedo.avif +0 -0
  105. package/assets/leaves/broomSprig.normal.avif +0 -0
  106. package/assets/leaves/corsicanShoot.albedo.avif +0 -0
  107. package/assets/leaves/corsicanShoot.normal.avif +0 -0
  108. package/assets/leaves/cypress.albedo.avif +0 -0
  109. package/assets/leaves/cypress.normal.avif +0 -0
  110. package/assets/leaves/cypressPad.albedo.avif +0 -0
  111. package/assets/leaves/cypressPad.normal.avif +0 -0
  112. package/assets/leaves/deadFronds.albedo.avif +0 -0
  113. package/assets/leaves/deadFronds.normal.avif +0 -0
  114. package/assets/leaves/deltoid.albedo.avif +0 -0
  115. package/assets/leaves/deltoid.normal.avif +0 -0
  116. package/assets/leaves/douglasShoot.albedo.avif +0 -0
  117. package/assets/leaves/douglasShoot.normal.avif +0 -0
  118. package/assets/leaves/elderSprig.albedo.avif +0 -0
  119. package/assets/leaves/elderSprig.normal.avif +0 -0
  120. package/assets/leaves/elliptic.albedo.avif +0 -0
  121. package/assets/leaves/elliptic.normal.avif +0 -0
  122. package/assets/leaves/eucalyptus.albedo.avif +0 -0
  123. package/assets/leaves/eucalyptus.normal.avif +0 -0
  124. package/assets/leaves/fan.albedo.avif +0 -0
  125. package/assets/leaves/fan.normal.avif +0 -0
  126. package/assets/leaves/fanB.albedo.avif +0 -0
  127. package/assets/leaves/fanB.normal.avif +0 -0
  128. package/assets/leaves/fir.albedo.avif +0 -0
  129. package/assets/leaves/fir.normal.avif +0 -0
  130. package/assets/leaves/frond.albedo.avif +0 -0
  131. package/assets/leaves/frond.normal.avif +0 -0
  132. package/assets/leaves/gorse.albedo.avif +0 -0
  133. package/assets/leaves/gorse.normal.avif +0 -0
  134. package/assets/leaves/hawthorn.albedo.avif +0 -0
  135. package/assets/leaves/hawthorn.normal.avif +0 -0
  136. package/assets/leaves/hemlockShoot.albedo.avif +0 -0
  137. package/assets/leaves/hemlockShoot.normal.avif +0 -0
  138. package/assets/leaves/hornbeam.albedo.avif +0 -0
  139. package/assets/leaves/hornbeam.normal.avif +0 -0
  140. package/assets/leaves/lance.albedo.avif +0 -0
  141. package/assets/leaves/lance.normal.avif +0 -0
  142. package/assets/leaves/larchShoot.albedo.avif +0 -0
  143. package/assets/leaves/larchShoot.normal.avif +0 -0
  144. package/assets/leaves/lime.albedo.avif +0 -0
  145. package/assets/leaves/lime.normal.avif +0 -0
  146. package/assets/leaves/liveOak.albedo.avif +0 -0
  147. package/assets/leaves/liveOak.normal.avif +0 -0
  148. package/assets/leaves/londonPlane.albedo.avif +0 -0
  149. package/assets/leaves/londonPlane.normal.avif +0 -0
  150. package/assets/leaves/magnolia.albedo.avif +0 -0
  151. package/assets/leaves/magnolia.normal.avif +0 -0
  152. package/assets/leaves/maple.albedo.avif +0 -0
  153. package/assets/leaves/maple.normal.avif +0 -0
  154. package/assets/leaves/norMaple.albedo.avif +0 -0
  155. package/assets/leaves/norMaple.normal.avif +0 -0
  156. package/assets/leaves/oak.albedo.avif +0 -0
  157. package/assets/leaves/oak.normal.avif +0 -0
  158. package/assets/leaves/paintFan.albedo.avif +0 -0
  159. package/assets/leaves/paintFan.normal.avif +0 -0
  160. package/assets/leaves/paintFrond.albedo.avif +0 -0
  161. package/assets/leaves/paintFrond.normal.avif +0 -0
  162. package/assets/leaves/pine.albedo.avif +0 -0
  163. package/assets/leaves/pine.normal.avif +0 -0
  164. package/assets/leaves/pineClumpDark.albedo.avif +0 -0
  165. package/assets/leaves/pineClumpDark.normal.avif +0 -0
  166. package/assets/leaves/pineClumpLight.albedo.avif +0 -0
  167. package/assets/leaves/pineClumpLight.normal.avif +0 -0
  168. package/assets/leaves/poplar.albedo.avif +0 -0
  169. package/assets/leaves/poplar.normal.avif +0 -0
  170. package/assets/leaves/queenFrond.albedo.avif +0 -0
  171. package/assets/leaves/queenFrond.normal.avif +0 -0
  172. package/assets/leaves/redAlder.albedo.avif +0 -0
  173. package/assets/leaves/redAlder.normal.avif +0 -0
  174. package/assets/leaves/redOak.albedo.avif +0 -0
  175. package/assets/leaves/redOak.normal.avif +0 -0
  176. package/assets/leaves/round.albedo.avif +0 -0
  177. package/assets/leaves/round.normal.avif +0 -0
  178. package/assets/leaves/scale.albedo.avif +0 -0
  179. package/assets/leaves/scale.normal.avif +0 -0
  180. package/assets/leaves/scotsPineClump.albedo.avif +0 -0
  181. package/assets/leaves/scotsPineClump.normal.avif +0 -0
  182. package/assets/leaves/seaBuckthornSprig.albedo.avif +0 -0
  183. package/assets/leaves/seaBuckthornSprig.normal.avif +0 -0
  184. package/assets/leaves/serrate.albedo.avif +0 -0
  185. package/assets/leaves/serrate.normal.avif +0 -0
  186. package/assets/leaves/sitkaShoot.albedo.avif +0 -0
  187. package/assets/leaves/sitkaShoot.normal.avif +0 -0
  188. package/assets/leaves/stonePineCanopy.albedo.avif +0 -0
  189. package/assets/leaves/stonePineCanopy.normal.avif +0 -0
  190. package/assets/leaves/stonePineCushion.albedo.avif +0 -0
  191. package/assets/leaves/stonePineCushion.normal.avif +0 -0
  192. package/assets/leaves/sweetgum.albedo.avif +0 -0
  193. package/assets/leaves/sweetgum.normal.avif +0 -0
  194. package/assets/leaves/sycamore.albedo.avif +0 -0
  195. package/assets/leaves/sycamore.normal.avif +0 -0
  196. package/assets/leaves/torreyPine.albedo.avif +0 -0
  197. package/assets/leaves/torreyPine.normal.avif +0 -0
  198. package/assets/leaves/whitePine.albedo.avif +0 -0
  199. package/assets/leaves/whitePine.normal.avif +0 -0
  200. package/assets/leaves/whiteSpruceShoot.albedo.avif +0 -0
  201. package/assets/leaves/whiteSpruceShoot.normal.avif +0 -0
  202. package/assets/leaves/whiteWillow.albedo.avif +0 -0
  203. package/assets/leaves/whiteWillow.normal.avif +0 -0
  204. package/assets/leaves/willow.albedo.avif +0 -0
  205. package/assets/leaves/willow.normal.avif +0 -0
  206. package/assets/marks/marks.json +894 -0
  207. package/assets/marks/painterly.avif +0 -0
  208. package/assets/marks/sheets.avif +0 -0
  209. package/assets/scans.json +6406 -0
  210. package/lib/age.d.ts +36 -0
  211. package/lib/age.d.ts.map +1 -0
  212. package/lib/age.js +170 -0
  213. package/lib/age.js.map +1 -0
  214. package/lib/atmosphere.d.ts +64 -0
  215. package/lib/atmosphere.d.ts.map +1 -0
  216. package/lib/atmosphere.js +260 -0
  217. package/lib/atmosphere.js.map +1 -0
  218. package/lib/dabs.d.ts +4 -0
  219. package/lib/dabs.d.ts.map +1 -0
  220. package/lib/dabs.js +77 -0
  221. package/lib/dabs.js.map +1 -0
  222. package/lib/engine.d.ts +211 -0
  223. package/lib/engine.d.ts.map +1 -0
  224. package/lib/engine.js +3808 -0
  225. package/lib/engine.js.map +1 -0
  226. package/lib/genetics.d.ts +129 -0
  227. package/lib/genetics.d.ts.map +1 -0
  228. package/lib/genetics.js +721 -0
  229. package/lib/genetics.js.map +1 -0
  230. package/lib/geometry.d.ts +237 -0
  231. package/lib/geometry.d.ts.map +1 -0
  232. package/lib/geometry.js +1944 -0
  233. package/lib/geometry.js.map +1 -0
  234. package/lib/grow.d.ts +83 -0
  235. package/lib/grow.d.ts.map +1 -0
  236. package/lib/grow.js +3851 -0
  237. package/lib/grow.js.map +1 -0
  238. package/lib/hiz.d.ts +74 -0
  239. package/lib/hiz.d.ts.map +1 -0
  240. package/lib/hiz.js +161 -0
  241. package/lib/hiz.js.map +1 -0
  242. package/lib/impostor.d.ts +106 -0
  243. package/lib/impostor.d.ts.map +1 -0
  244. package/lib/impostor.js +450 -0
  245. package/lib/impostor.js.map +1 -0
  246. package/lib/index.d.ts +17 -0
  247. package/lib/index.d.ts.map +1 -0
  248. package/lib/index.js +16 -0
  249. package/lib/index.js.map +1 -0
  250. package/lib/leaves.d.ts +30 -0
  251. package/lib/leaves.d.ts.map +1 -0
  252. package/lib/leaves.js +829 -0
  253. package/lib/leaves.js.map +1 -0
  254. package/lib/light.d.ts +110 -0
  255. package/lib/light.d.ts.map +1 -0
  256. package/lib/light.js +430 -0
  257. package/lib/light.js.map +1 -0
  258. package/lib/lobes.d.ts +25 -0
  259. package/lib/lobes.d.ts.map +1 -0
  260. package/lib/lobes.js +151 -0
  261. package/lib/lobes.js.map +1 -0
  262. package/lib/marks.d.ts +63 -0
  263. package/lib/marks.d.ts.map +1 -0
  264. package/lib/marks.js +553 -0
  265. package/lib/marks.js.map +1 -0
  266. package/lib/mips.d.ts +42 -0
  267. package/lib/mips.d.ts.map +1 -0
  268. package/lib/mips.js +220 -0
  269. package/lib/mips.js.map +1 -0
  270. package/lib/paintedMarks.d.ts +21 -0
  271. package/lib/paintedMarks.d.ts.map +1 -0
  272. package/lib/paintedMarks.js +53 -0
  273. package/lib/paintedMarks.js.map +1 -0
  274. package/lib/palm.d.ts +162 -0
  275. package/lib/palm.d.ts.map +1 -0
  276. package/lib/palm.js +779 -0
  277. package/lib/palm.js.map +1 -0
  278. package/lib/palmAtlas.d.ts +79 -0
  279. package/lib/palmAtlas.d.ts.map +1 -0
  280. package/lib/palmAtlas.js +335 -0
  281. package/lib/palmAtlas.js.map +1 -0
  282. package/lib/palmGeometry.d.ts +41 -0
  283. package/lib/palmGeometry.d.ts.map +1 -0
  284. package/lib/palmGeometry.js +309 -0
  285. package/lib/palmGeometry.js.map +1 -0
  286. package/lib/phenology.d.ts +21 -0
  287. package/lib/phenology.d.ts.map +1 -0
  288. package/lib/phenology.js +168 -0
  289. package/lib/phenology.js.map +1 -0
  290. package/lib/random.d.ts +34 -0
  291. package/lib/random.d.ts.map +1 -0
  292. package/lib/random.js +92 -0
  293. package/lib/random.js.map +1 -0
  294. package/lib/scans.d.ts +232 -0
  295. package/lib/scans.d.ts.map +1 -0
  296. package/lib/scans.js +397 -0
  297. package/lib/scans.js.map +1 -0
  298. package/lib/scatter.d.ts +70 -0
  299. package/lib/scatter.d.ts.map +1 -0
  300. package/lib/scatter.js +186 -0
  301. package/lib/scatter.js.map +1 -0
  302. package/lib/species.d.ts +369 -0
  303. package/lib/species.d.ts.map +1 -0
  304. package/lib/species.js +2978 -0
  305. package/lib/species.js.map +1 -0
  306. package/lib/sprays.d.ts +112 -0
  307. package/lib/sprays.d.ts.map +1 -0
  308. package/lib/sprays.js +1137 -0
  309. package/lib/sprays.js.map +1 -0
  310. package/lib/stand.d.ts +52 -0
  311. package/lib/stand.d.ts.map +1 -0
  312. package/lib/stand.js +279 -0
  313. package/lib/stand.js.map +1 -0
  314. package/lib/styles.d.ts +135 -0
  315. package/lib/styles.d.ts.map +1 -0
  316. package/lib/styles.js +79 -0
  317. package/lib/styles.js.map +1 -0
  318. package/lib/tree.d.ts +134 -0
  319. package/lib/tree.d.ts.map +1 -0
  320. package/lib/tree.js +57 -0
  321. package/lib/tree.js.map +1 -0
  322. package/lib/variants.d.ts +157 -0
  323. package/lib/variants.d.ts.map +1 -0
  324. package/lib/variants.js +532 -0
  325. package/lib/variants.js.map +1 -0
  326. package/lib/visibility.d.ts +105 -0
  327. package/lib/visibility.d.ts.map +1 -0
  328. package/lib/visibility.js +242 -0
  329. package/lib/visibility.js.map +1 -0
  330. package/package.json +62 -3
package/lib/scans.js ADDED
@@ -0,0 +1,397 @@
1
+ // The realistic look's photographs: scanned bark and leaves (assets/, made by tools/scans from CC0 scans, or
2
+ // from generated pictures where no scan exists; assets/SOURCES.md says which), which species wears which,
3
+ // and loading them.
4
+ //
5
+ // A species' bark is a set (a tile of bark, its colour and its relief) laid round its wood at its real size,
6
+ // or two, one giving way to the other up the stem (a Scots pine's grey plates to its copper flakes, a blue
7
+ // gum's rough stocking to its smooth streaks, a birch's black foot to its white). Its leaves are a sheet of single leaves, each laid on the species' own twigs at
8
+ // its own size (sprays.ts). Which a species wears is looked up by its name here (a host may give its own:
9
+ // `TreesOptions.scans.looks`), and failing that by its kind of leaf.
10
+ //
11
+ // The pictures are fetched once a page, whichever trees ask first, and kept: the trees are drawn as they
12
+ // were (arithmetic bark, drawn sprays) until they come.
13
+ import manifest from "../assets/scans.json" with { type: "json" };
14
+ const M = manifest;
15
+ export const BARK_SETS = M.bark.sets;
16
+ export const LEAF_SETS = M.leaves.sets;
17
+ export const BARK_SIZE = M.bark.size;
18
+ export const barkSet = (id) => BARK_SETS.find((b) => b.id === id);
19
+ export const leafSet = (id) => LEAF_SETS.find((l) => l.id === id);
20
+ export const SPRAY_KINDS = ["alternate", "opposite", "hanging", "weeping", "sprays", "tufts", "pinnate", "fan", "whole"];
21
+ /**
22
+ * Common gorse's year (Ulex europaeus): in flower mainly from January to June, at its height in spring (March to
23
+ * May), and with a few flowers on it most of the year besides ("when gorse is out of blossom, kissing's out of
24
+ * fashion"), fewest in late summer and autumn (Clements, Peterson and Prasad 2001, The biology of Canadian weeds:
25
+ * Ulex europaeus; Tarayre et al. 2007, flowering phenology of Ulex europaeus).
26
+ */
27
+ export const GORSE_FLOWERING = [
28
+ [1, 0.3], // 1 January: out, here and there
29
+ [32, 0.5], // 1 February
30
+ [74, 0.85], // 15 March
31
+ [110, 0.95], // 20 April: at its height
32
+ [140, 0.8], // 20 May
33
+ [171, 0.45], // 20 June
34
+ [201, 0.15], // 20 July: going over
35
+ [244, 0.08], // 1 September: a few flowers
36
+ [305, 0.1], // 1 November
37
+ [335, 0.18], // 1 December: coming out again
38
+ ];
39
+ /** Scotch broom's flush of yellow pea flowers across the late-spring peak (May–June). */
40
+ export const BROOM_FLOWERING = [
41
+ [1, 0.02],
42
+ [90, 0.06],
43
+ [122, 0.52],
44
+ [145, 0.95], // late May peak
45
+ [170, 0.75], // mid June
46
+ [198, 0.12],
47
+ [245, 0.02],
48
+ [335, 0.02],
49
+ ];
50
+ /** Elder's early-summer creamy corymb flush (`26–34%` peak in late May–June so leaves stay richly dominant). */
51
+ export const ELDER_FLOWERING = [
52
+ [1, 0],
53
+ [130, 0.02],
54
+ [148, 0.26],
55
+ [166, 0.34],
56
+ [185, 0.14],
57
+ [205, 0.02],
58
+ [335, 0],
59
+ ];
60
+ /** Sea buckthorn's late-summer and autumn orange berry crop. */
61
+ export const SEA_BUCKTHORN_FRUITING = [
62
+ [1, 0.06],
63
+ [120, 0],
64
+ [205, 0.08],
65
+ [235, 0.36],
66
+ [280, 0.42],
67
+ [330, 0.14],
68
+ ];
69
+ /** The year's length the flowering is laid round (days). */
70
+ const YEAR_DAYS = 365.25;
71
+ /**
72
+ * How far in flower a species is, 0..1 (the share of its sprays in flower): on `day` (of the year, 1 on the 1st of
73
+ * January), as its `flowering` says, eased between the days it names; with no day given, or no flowering of its own,
74
+ * `bloom` (the style's).
75
+ */
76
+ export function bloomShare(look, day, bloom) {
77
+ const year = look.flowering;
78
+ if (day === null || !Number.isFinite(day) || !year || year.length === 0)
79
+ return bloom;
80
+ const d = (((day - 1) % YEAR_DAYS) + YEAR_DAYS) % YEAR_DAYS + 1;
81
+ for (let i = 0; i < year.length; i++) {
82
+ const [d0, s0] = year[i];
83
+ const [d1raw, s1] = year[(i + 1) % year.length];
84
+ const d1 = i + 1 < year.length ? d1raw : d1raw + YEAR_DAYS;
85
+ // (Past the last named day, or before the first: round the year from December to January.)
86
+ const at = d < year[0][0] ? d + YEAR_DAYS : d;
87
+ if (at >= d0 && at <= d1) {
88
+ const f = (at - d0) / Math.max(d1 - d0, 1e-6);
89
+ return s0 + (s1 - s0) * (0.5 - 0.5 * Math.cos(Math.PI * f));
90
+ }
91
+ }
92
+ return year[year.length - 1][1];
93
+ }
94
+ /** The photographs each of the library's species wears, by name. */
95
+ export const SCAN_LOOKS = {
96
+ Oak: { bark: "oak", leaves: "oak", leafCm: 10, spray: "alternate" },
97
+ // (The plane's leaf on its long stalk: some 16 cm of blade.)
98
+ Plane: { bark: "plane", leaves: "londonPlane", leafCm: 30, spray: "alternate" },
99
+ // (Its rough stocking, a few metres, giving way to the smooth mottled stem.)
100
+ // (Its adult leaves 12–30 by 1.7–3 cm (EUCLID): narrower than the picture's.)
101
+ Eucalyptus: { bark: "eucalyptus", upper: { set: "eucalyptusUpper", from: 0.04, to: 0.12 }, leaves: "eucalyptus", leafCm: 22, spray: "hanging", leafWidth: 0.6, leafBend: 0.03, hang: 0.85, perSpray: 8 },
102
+ Spruce: { bark: "spruce", leaves: "fir", leafCm: 30, spray: "sprays" },
103
+ // (Its grey-brown plates giving way, from about a third of the way up, to copper-orange flakes: the plates
104
+ // its own grey-brown, not the orange its species is known by from afar.)
105
+ "Scots pine": { bark: "pine", barkFoot: "#6a625a", upper: { set: "pineFlakes", from: 0.25, to: 0.5, color: "#b4643c" }, leaves: "pine", leafCm: 28, spray: "tufts", needleCm: 6, brush: 1.6 },
106
+ Shrub: { bark: "ridged", barkScale: 0.4, leaves: "elliptic", leafCm: 5, spray: "alternate" },
107
+ Beech: { bark: "beech", leaves: "beech", leafCm: 8, spray: "alternate" },
108
+ // (Its own rugged blackish foot giving way to its white upper bark; its own leaves, 3–6 cm and a thin stalk.)
109
+ "Silver birch": { bark: "birchFoot", barkFoot: "#2f2c29", upper: { set: "birch", from: 0.06, to: 0.2 }, leaves: "birch", leafCm: 6, spray: "weeping", hang: 0.7 },
110
+ // (Its own leaves, almost round, 5–9 cm and a short stalk; its own dark bark of small squarish plates.)
111
+ "Black alder": { bark: "alder", leaves: "alder", leafCm: 9, spray: "alternate" },
112
+ // (Its own leaves, 5–8 cm on a long flattened stalk.)
113
+ "Lombardy poplar": { bark: "poplar", leaves: "poplar", leafCm: 10, spray: "alternate" },
114
+ // (Its own leaves, 8–15 cm and as narrow as they grow; its own netted bark.)
115
+ "Weeping willow": { bark: "willow", leaves: "willow", leafCm: 12, spray: "weeping", hang: 0.95 },
116
+ // (Its own deeply cut leaves, 3–5 cm with their stalk.)
117
+ Hawthorn: { bark: "oak", barkScale: 0.45, leaves: "hawthorn", leafCm: 5, spray: "alternate", perSpray: 14 },
118
+ // (Its own sprigs, spines and yellow flowers, whole: a twig's end of a few of them, the flowers kept yellow.)
119
+ // (In flower mainly from January to June, a few flowers most of the year: `GORSE_FLOWERING`, for the host's day.)
120
+ Gorse: { bark: "ridged", barkScale: 0.35, leaves: "gorse", leafCm: 22, spray: "sprays", flowers: "#f2c230", flowering: GORSE_FLOWERING },
121
+ // (Its own bark of loose round scales, its own branch tips of stiff sharp blue-green needles.)
122
+ "Sitka spruce": { bark: "sitkaSpruce", leaves: "sitkaShoot", leafCm: 28, spray: "sprays" },
123
+ // (Its own bark of long scaly plates; its own shoots, a stout twig in a brush of long stiff needles in pairs, 10–15
124
+ // cm: its tufts laid from them, `tuftPicture`, the picture some two needles long.)
125
+ "Corsican pine": { bark: "corsicanPine", leaves: "corsicanShoot", leafCm: 32, spray: "tufts", needleCm: 12, tuftPicture: true, tuftShoot: 2.2 },
126
+ // (Its own branch tips, soft flat needles all round the twig, a pointed bud.)
127
+ "Douglas fir": { bark: "douglas", barkScale: 1.4, leaves: "douglasShoot", leafCm: 25, spray: "sprays" },
128
+ "Western red cedar": { bark: "fibrous", leaves: "scale", leafCm: 30, spray: "sprays", hang: 0.4 },
129
+ // (Its own bark of long fibrous strips, lichened.)
130
+ "Monterey cypress": { bark: "cypress", leaves: "cypress", leafCm: 28, spray: "sprays", cushion: "cypressPad", padThick: 0.45, cushionSize: 2.8 },
131
+ // (Its own very thick dark ridged bark, reddish in the furrows.)
132
+ "Monterey pine": { bark: "montereyPine", leaves: "pine", leafCm: 34, spray: "tufts", needleCm: 12, brush: 1.8, cushionSize: 1.32 },
133
+ // (Its shoot: a stout twig and a brush of needles 20–30 cm long, grey-green and stiff: its tufts laid from its own
134
+ // shoot pictures, `tuftPicture`, the brush two thirds of the picture.)
135
+ "Torrey pine": { bark: "torreyPine", leaves: "torreyPine", leafCm: 48, spray: "tufts", needleCm: 25, brush: 1.3, tuftPicture: true, tuftShoot: 1.6, tuftFrom: 0.3, tuftFan: 5 },
136
+ // (Its own bark of broad flat plates.)
137
+ "Aleppo pine": { bark: "aleppoPine", leaves: "pine", leafCm: 26, spray: "tufts", needleCm: 8, brush: 1.2 },
138
+ "Stone pine": { bark: "stonePine", barkScale: 1, leaves: "pine", leafCm: 32, spray: "tufts", needleCm: 14, brush: 2, cushion: "stonePineCushion", cushionFar: "stonePineCanopy", cushionCards: 3, cushionSize: 1.24 },
139
+ "Canary date palm": { bark: "palmLattice", leaves: "frond", leafCm: 450, spray: "whole" },
140
+ "Mexican fan palm": { bark: "palmRings", leaves: "blade", leafCm: 60, spray: "fan" },
141
+ "California fan palm": { bark: "palmRings", barkScale: 1.3, leaves: "blade", leafCm: 70, spray: "fan" },
142
+ "Queen palm": { bark: "palmRings", barkScale: 0.75, leaves: "frond", leafCm: 400, spray: "whole" },
143
+ "Coast live oak": { bark: "liveOak", leaves: "liveOak", leafCm: 5, spray: "alternate", perSpray: 12 },
144
+ "California sycamore": { bark: "ridged", barkScale: 0.6, barkFoot: "#5e5348", upper: { set: "plane", from: 0.05, to: 0.22 }, leaves: "sycamore", leafCm: 24, spray: "alternate" },
145
+ "Sugar maple": { bark: "maple", leaves: "maple", leafCm: 12, spray: "opposite" },
146
+ "Red oak": { bark: "redOak", leaves: "redOak", leafCm: 17, spray: "alternate" },
147
+ // (Its own shoots, soft feathery brushes of fine needles 8–12 cm in fives: its tufts laid from them, `tuftPicture`.)
148
+ "Eastern white pine": { bark: "whitePine", leaves: "whitePine", leafCm: 26, spray: "tufts", needleCm: 10, tuftPicture: true },
149
+ // (Its own pale flaky scales; its own branch tips, short stiff needles crowded on the twig's upper side.)
150
+ "White spruce": { bark: "whiteSpruce", leaves: "whiteSpruceShoot", leafCm: 22, spray: "sprays" },
151
+ // (Fourteen European and Pacific Northwest trees and shrubs added 2026-11-25.)
152
+ Ash: { bark: "ash", leaves: "ash", leafCm: 26, spray: "opposite" },
153
+ // (Its own leaves are queued; using Sugar maple's palmate sheet until they arrive.)
154
+ "Sycamore maple": { bark: "sycMaple", leaves: "maple", leafCm: 13, spray: "opposite" },
155
+ "White willow": { bark: "whiteWillow", leaves: "whiteWillow", leafCm: 9, spray: "alternate" },
156
+ "European larch": { bark: "larch", leaves: "larchShoot", leafCm: 24, spray: "sprays" },
157
+ "Small-leaved lime": { bark: "lime", leaves: "lime", leafCm: 6, spray: "alternate" },
158
+ "Western hemlock": { bark: "hemlock", leaves: "hemlockShoot", leafCm: 22, spray: "sprays", hang: 0.45 },
159
+ "Red alder": { bark: "redAlder", leaves: "redAlder", leafCm: 10, spray: "alternate" },
160
+ "Norway maple": { bark: "norMaple", leaves: "norMaple", leafCm: 13, spray: "opposite" },
161
+ Hornbeam: { bark: "hornbeam", leaves: "hornbeam", leafCm: 8, spray: "alternate" },
162
+ Aspen: { bark: "aspen", leaves: "aspen", leafCm: 6, spray: "alternate" },
163
+ "Sea buckthorn": { bark: "ridged", barkScale: 0.4, leaves: "seaBuckthornSprig", leafCm: 20, spray: "sprays", flowers: "#e87824", flowering: SEA_BUCKTHORN_FRUITING },
164
+ Elder: { bark: "ridged", barkScale: 0.45, leaves: "elderSprig", leafCm: 20, spray: "sprays", flowers: "#f5f1dc", flowering: ELDER_FLOWERING },
165
+ "Scotch broom": { bark: "ridged", barkScale: 0.35, leaves: "broomSprig", leafCm: 24, spray: "sprays", flowers: "#f2c230", flowering: BROOM_FLOWERING },
166
+ Blackthorn: { bark: "oak", barkScale: 0.45, leaves: "blackthorn", leafCm: 4, spray: "alternate", perSpray: 14 },
167
+ Rowan: { bark: "hornbeam", barkScale: 0.65, leaves: "ash", leafCm: 16, spray: "alternate" },
168
+ "Sweet chestnut": { bark: "oak", barkScale: 1.35, leaves: "serrate", leafCm: 16, spray: "alternate" },
169
+ "Black poplar": { bark: "poplar", barkScale: 1.15, leaves: "deltoid", leafCm: 10, spray: "alternate" },
170
+ "Crack willow": { bark: "willow", barkScale: 1.1, leaves: "lance", leafCm: 13, spray: "alternate", leafWidth: 0.72 },
171
+ "Holm oak": { bark: "liveOak", barkScale: 0.9, leaves: "liveOak", leafCm: 8.5, spray: "alternate", leafWidth: 0.85, perSpray: 12 },
172
+ // (The magnolia's own big glossy leaves, 13–25 cm, and smooth grey bark; the sweetgum's own star-shaped leaves and
173
+ // corky furrowed bark. The Leyland cypress, a Monterey cypress hybrid, wears that cypress's bark and the flat
174
+ // scale-leaf sprays of the western red cedar's until it has its own: tools/ai-textures/PROMPTS.md.)
175
+ "Southern magnolia": { bark: "magnolia", leaves: "magnolia", leafCm: 18, spray: "alternate", perSpray: 8 },
176
+ "American sweetgum": { bark: "sweetgum", leaves: "sweetgum", leafCm: 14, spray: "alternate" },
177
+ "Leyland cypress": { bark: "cypress", leaves: "scale", leafCm: 28, spray: "sprays", hang: 0.2 },
178
+ "Subalpine fir": { bark: "whiteSpruce", barkScale: 0.95, leaves: "fir", leafCm: 24, spray: "sprays" },
179
+ };
180
+ /**
181
+ * A look's upper bark colour packed in one number for the shaders (a float holds it exactly): its sRGB bytes,
182
+ * red · 65536 + green · 256 + blue, plus 1; 0 where it has none.
183
+ */
184
+ export function upperColorCode(look) {
185
+ const hex = look.upper?.color;
186
+ if (!hex)
187
+ return 0;
188
+ if (!/^#?[0-9a-f]{6}$/i.test(hex))
189
+ throw new Error(`upper bark colour ${hex}: not #rrggbb`);
190
+ return parseInt(hex.replace(/^#/, ""), 16) + 1;
191
+ }
192
+ /** A look's flower colour packed as an upper bark colour is (`upperColorCode`); 0 where it has none. */
193
+ export function flowerColorCode(look) {
194
+ return look.flowers ? upperColorCode({ ...look, upper: { set: "", from: 0, to: 0, color: look.flowers } }) : 0;
195
+ }
196
+ /** The sRGB colour (0..1) an upper bark colour code holds (as the shader reads it), or null for none. */
197
+ export function upperColorOf(code) {
198
+ if (code < 0.5)
199
+ return null;
200
+ const v = code - 1;
201
+ const r = Math.floor(v / 65536);
202
+ const g = Math.floor((v - r * 65536) / 256);
203
+ return [r / 255, g / 255, (v - r * 65536 - g * 256) / 255];
204
+ }
205
+ /** What a species with no look of its own here wears: by its kind of leaf. */
206
+ const BY_KIND = {
207
+ broad: SCAN_LOOKS.Oak,
208
+ narrow: SCAN_LOOKS["Weeping willow"],
209
+ needle: SCAN_LOOKS.Spruce,
210
+ small: SCAN_LOOKS.Shrub,
211
+ frond: SCAN_LOOKS["Canary date palm"],
212
+ pine: SCAN_LOOKS["Scots pine"],
213
+ };
214
+ /**
215
+ * The photographs a species wears: a host's (`looks`, by the species' name) over its name's here, else its kind
216
+ * of leaf's.
217
+ */
218
+ export function scanLookOf(s, looks) {
219
+ const own = looks?.[s.name];
220
+ const base = SCAN_LOOKS[s.name] ?? BY_KIND[s.leafKind] ?? SCAN_LOOKS.Oak;
221
+ return own ? { ...base, ...own } : base;
222
+ }
223
+ /** Validate a partial or complete `ScanLook` against known bark/leaf sets and parameter ranges. */
224
+ export function checkScanLook(look) {
225
+ const out = [];
226
+ const hex = /^#[0-9a-f]{6}$/i;
227
+ if (look.bark !== undefined && (typeof look.bark !== "string" || !barkSet(look.bark))) {
228
+ out.push(`bark "${String(look.bark)}" is not a known bark set`);
229
+ }
230
+ if (look.barkScale !== undefined && !(typeof look.barkScale === "number" && Number.isFinite(look.barkScale) && look.barkScale > 0 && look.barkScale <= 10)) {
231
+ out.push("barkScale must be > 0 and <= 10");
232
+ }
233
+ if (look.barkFoot !== undefined && (typeof look.barkFoot !== "string" || !hex.test(look.barkFoot))) {
234
+ out.push("barkFoot must be a hex colour like #6a625a");
235
+ }
236
+ if (look.flowers !== undefined && (typeof look.flowers !== "string" || !hex.test(look.flowers))) {
237
+ out.push("flowers must be a hex colour like #f2c230");
238
+ }
239
+ if (look.upper !== undefined) {
240
+ const u = look.upper;
241
+ if (typeof u !== "object" || u === null || Array.isArray(u)) {
242
+ out.push("upper must be an object");
243
+ }
244
+ else {
245
+ if (typeof u.set !== "string" || !barkSet(u.set))
246
+ out.push(`upper.set "${String(u.set)}" is not a known bark set`);
247
+ if (!(typeof u.from === "number" && Number.isFinite(u.from) && u.from >= 0 && typeof u.to === "number" && Number.isFinite(u.to) && u.from < u.to && u.to <= 1)) {
248
+ out.push("upper.from and upper.to must satisfy 0 <= from < to <= 1");
249
+ }
250
+ if (u.scale !== undefined && !(typeof u.scale === "number" && Number.isFinite(u.scale) && u.scale > 0 && u.scale <= 10)) {
251
+ out.push("upper.scale must be > 0 and <= 10");
252
+ }
253
+ if (u.color !== undefined && (typeof u.color !== "string" || !hex.test(u.color))) {
254
+ out.push("upper.color must be a hex colour like #b4643c");
255
+ }
256
+ }
257
+ }
258
+ if (look.leaves !== undefined && (typeof look.leaves !== "string" || !leafSet(look.leaves))) {
259
+ out.push(`leaves "${String(look.leaves)}" is not a known leaf set`);
260
+ }
261
+ if (look.leafCm !== undefined && !(typeof look.leafCm === "number" && Number.isFinite(look.leafCm) && look.leafCm > 0 && look.leafCm <= 1000)) {
262
+ out.push("leafCm must be > 0 and <= 1000");
263
+ }
264
+ if (look.spray !== undefined && !SPRAY_KINDS.includes(look.spray)) {
265
+ out.push(`spray must be one of ${SPRAY_KINDS.join(", ")}`);
266
+ }
267
+ for (const [k, lo, hi, strictLo] of [
268
+ ["leafWidth", 0, 4, true],
269
+ ["leafBend", -1, 1, false],
270
+ ["hang", 0, 1, false],
271
+ ["perSpray", 1, 60, false],
272
+ ["needleCm", 0, 100, true],
273
+ ["brush", 0, 10, true],
274
+ ["padThick", 0, 4, true],
275
+ ["tuftShoot", 0, 10, true],
276
+ ["tuftFrom", 0, 0.95, false],
277
+ ["tuftFan", 1, 16, false],
278
+ ["cushionCards", 0, 16, false],
279
+ ["cushionSize", 0, 6, true],
280
+ ]) {
281
+ const v = look[k];
282
+ if (v === undefined)
283
+ continue;
284
+ const ok = typeof v === "number" && Number.isFinite(v) && (strictLo ? v > lo : v >= lo) && v <= hi;
285
+ if (!ok)
286
+ out.push(`${k} must be ${strictLo ? ">" : ">="} ${lo} and <= ${hi}`);
287
+ }
288
+ if (look.tuftPicture !== undefined && typeof look.tuftPicture !== "boolean") {
289
+ out.push("tuftPicture must be a boolean");
290
+ }
291
+ for (const ck of ["cushion", "cushionFar"]) {
292
+ const c = look[ck];
293
+ if (c !== undefined && (typeof c !== "string" || (c !== "drawn" && !leafSet(c)))) {
294
+ out.push(`${ck} "${String(c)}" must be "drawn" or a known leaf set`);
295
+ }
296
+ }
297
+ return out;
298
+ }
299
+ /** How far a species' near cards reach from their middle (m): a twig's end, a few shoots with their leaves. */
300
+ export function nearCardHalf(look) {
301
+ const leaf = look.leafCm / 100;
302
+ if (look.spray === "pinnate")
303
+ return 0;
304
+ // (A fan palm's leaf, whole, a card: about its own width.)
305
+ if (look.spray === "fan")
306
+ return Math.min(1, leaf * 1.25);
307
+ // (A palm's frond, a stretch of it a card, a couple of metres: the picture holds no finer.)
308
+ if (look.spray === "whole")
309
+ return Math.min(1.1, leaf * 0.25);
310
+ // (A twig's end of several shoots: some five leaves long for broad leaves, a few shoots' length for needles.)
311
+ if (look.spray === "sprays" || look.spray === "tufts")
312
+ return Math.min(0.45, Math.max(0.2, leaf * 1.4));
313
+ if (look.spray === "hanging")
314
+ return Math.min(0.45, Math.max(0.2, leaf * 1.6));
315
+ if (look.spray === "weeping")
316
+ return Math.min(0.45, Math.max(0.2, leaf * 2.2));
317
+ return Math.min(0.45, Math.max(0.2, leaf * 2.5));
318
+ }
319
+ // ---------------------------------------------------------------------------------------------------------------------
320
+ // Loading.
321
+ /** Where the pictures are by default: beside this module in the package (assets/), unless a host says. */
322
+ let assetBase = null;
323
+ /**
324
+ * Fetch the photographs from `base` (a folder holding bark/ and leaves/, as assets/ does) instead of from
325
+ * beside the package: for a host whose bundler moves the package's modules away from its files. The default
326
+ * for trees made without a `base` of their own (`scanSource`); one made with its own keeps to it.
327
+ */
328
+ export function setScanBase(base) {
329
+ assetBase = base;
330
+ }
331
+ const under = (base, path) => `${base.replace(/\/?$/, "/")}${path}`;
332
+ function besidePackage(kind, id, map) {
333
+ // (Written out whole, so a bundler sees each folder and copies its pictures.)
334
+ return kind === "bark" ? new URL(`../assets/bark/${id}.${map}.avif`, import.meta.url).href : new URL(`../assets/leaves/${id}.${map}.avif`, import.meta.url).href;
335
+ }
336
+ /**
337
+ * Pictures fetched from `base`, a folder laid out as assets/ is; with none (undefined), from where
338
+ * `setScanBase` says when they are fetched, else from beside the package; `null`, from beside the package.
339
+ */
340
+ export function scanSource(base) {
341
+ const from = () => (base === undefined ? assetBase : base);
342
+ return {
343
+ asset: (path, here) => {
344
+ const b = from();
345
+ return b !== null ? under(b, path) : here;
346
+ },
347
+ picture: (kind, id, map) => {
348
+ const b = from();
349
+ return b !== null ? under(b, `${kind}/${id}.${map}.avif`) : besidePackage(kind, id, map);
350
+ },
351
+ };
352
+ }
353
+ /** The pictures of trees made without a `base`: from where `setScanBase` says, else beside the package. */
354
+ export const DEFAULT_SCAN_SOURCE = scanSource();
355
+ /** A file of assets/ at `path` there: from where `setScanBase` says, if it was set, else `here` (its URL beside the package). */
356
+ export function assetUrl(path, here) {
357
+ return DEFAULT_SCAN_SOURCE.asset(path, here);
358
+ }
359
+ /** The pictures fetched, by URL and size: two sets of trees fetching from two places share none. */
360
+ const loaded = new Map();
361
+ /** A picture's texels, as they are in the file: RGBA8, no colour conversion, alpha not multiplied in. */
362
+ export async function decode(url, size) {
363
+ const res = await fetch(url);
364
+ if (!res.ok)
365
+ throw new Error(`${url}: ${res.status}`);
366
+ const blob = await res.blob();
367
+ const bmp = await createImageBitmap(blob, { premultiplyAlpha: "none", colorSpaceConversion: "none", ...(size ? { resizeWidth: size, resizeHeight: size, resizeQuality: "high" } : {}) });
368
+ const canvas = new OffscreenCanvas(bmp.width, bmp.height);
369
+ const ctx = canvas.getContext("2d", { colorSpace: "srgb", willReadFrequently: true });
370
+ ctx.drawImage(bmp, 0, 0);
371
+ const img = ctx.getImageData(0, 0, bmp.width, bmp.height);
372
+ bmp.close();
373
+ return { data: new Uint8Array(img.data.buffer), width: img.width, height: img.height };
374
+ }
375
+ function picture(source, kind, id, map, size) {
376
+ const url = source.picture(kind, id, map);
377
+ const key = `${url}@${size ?? 0}`;
378
+ let p = loaded.get(key);
379
+ if (!p) {
380
+ p = decode(url, size);
381
+ loaded.set(key, p);
382
+ p.catch(() => loaded.delete(key));
383
+ }
384
+ return p;
385
+ }
386
+ /** A bark set's colour (roughness in alpha) and relief (normal x, y, height), `size` texels square, from `source`. */
387
+ export async function loadBark(id, size = BARK_SIZE, source = DEFAULT_SCAN_SOURCE) {
388
+ const s = size === BARK_SIZE ? undefined : size;
389
+ const [albedo, normal] = await Promise.all([picture(source, "bark", id, "albedo", s), picture(source, "bark", id, "normal", s)]);
390
+ return { albedo, normal };
391
+ }
392
+ /** A leaf sheet's colour (coverage in alpha) and surface (normal x, y, light let through), from `source`. */
393
+ export async function loadLeaves(id, source = DEFAULT_SCAN_SOURCE) {
394
+ const [albedo, normal] = await Promise.all([picture(source, "leaves", id, "albedo"), picture(source, "leaves", id, "normal")]);
395
+ return { albedo, normal };
396
+ }
397
+ //# sourceMappingURL=scans.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scans.js","sourceRoot":"","sources":["../src/scans.ts"],"names":[],"mappings":"AAAA,6GAA6G;AAC7G,0GAA0G;AAC1G,oBAAoB;AACpB,EAAE;AACF,6GAA6G;AAC7G,2GAA2G;AAC3G,kKAAkK;AAClK,0GAA0G;AAC1G,qEAAqE;AACrE,EAAE;AACF,yGAAyG;AACzG,wDAAwD;AAExD,OAAO,QAAQ,MAAM,sBAAsB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAsClE,MAAM,CAAC,GAAG,QAA+F,CAAC;AAC1G,MAAM,CAAC,MAAM,SAAS,GAAuB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AACzD,MAAM,CAAC,MAAM,SAAS,GAAuB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;AAC3D,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AACrC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAU,EAAuB,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAC/F,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAU,EAAuB,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAuB/F,MAAM,CAAC,MAAM,WAAW,GAAyB,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AA6F/I;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GA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AAM,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACjI,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC;AAED,6GAA6G;AAC7G,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,EAAU,EAAE,MAAM,GAAe,mBAAmB;IACnF,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC/H,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["// The realistic look's photographs: scanned bark and leaves (assets/, made by tools/scans from CC0 scans, or\n// from generated pictures where no scan exists; assets/SOURCES.md says which), which species wears which,\n// and loading them.\n//\n// A species' bark is a set (a tile of bark, its colour and its relief) laid round its wood at its real size,\n// or two, one giving way to the other up the stem (a Scots pine's grey plates to its copper flakes, a blue\n// gum's rough stocking to its smooth streaks, a birch's black foot to its white). Its leaves are a sheet of single leaves, each laid on the species' own twigs at\n// its own size (sprays.ts). Which a species wears is looked up by its name here (a host may give its own:\n// `TreesOptions.scans.looks`), and failing that by its kind of leaf.\n//\n// The pictures are fetched once a page, whichever trees ask first, and kept: the trees are drawn as they\n// were (arithmetic bark, drawn sprays) until they come.\n\nimport manifest from \"../assets/scans.json\" with { type: \"json\" };\nimport { type Pixels } from \"./mips.ts\";\nimport { type TreeSpecies } from \"./species.ts\";\n\n/** What assets/scans.json says of one bark set. */\nexport interface BarkSet {\n id: string;\n layer: number;\n /** How much bark one tile covers: across the stem, along it (cm). */\n tileCm: [number, number];\n /** Its mean colour, linear. */\n meanLinear: [number, number, number];\n origin?: \"scan\" | \"generated\";\n}\n\n/** One leaf on a sheet: its box (texels from the sheet's top left), its stalk's end and tip, its length over its set's longest. */\nexport interface LeafSprite {\n x: number;\n y: number;\n w: number;\n h: number;\n base: [number, number];\n tip: [number, number];\n size: number;\n}\n\n/** What assets/scans.json says of one leaf sheet. */\nexport interface LeafSet {\n id: string;\n size: [number, number];\n /** How long its longest leaf is, stalk to tip, on the tree it came from (cm). */\n lengthCm: number;\n tone: boolean;\n meanLinear: [number, number, number];\n sprites: LeafSprite[];\n origin?: \"scan\" | \"generated\";\n}\n\nconst M = manifest as unknown as { bark: { size: number; sets: BarkSet[] }; leaves: { sets: LeafSet[] } };\nexport const BARK_SETS: readonly BarkSet[] = M.bark.sets;\nexport const LEAF_SETS: readonly LeafSet[] = M.leaves.sets;\nexport const BARK_SIZE = M.bark.size;\nexport const barkSet = (id: string): BarkSet | undefined => BARK_SETS.find((b) => b.id === id);\nexport const leafSet = (id: string): LeafSet | undefined => LEAF_SETS.find((l) => l.id === id);\n\n/** How a species' twigs carry its leaves, as sprays.ts lays them. */\nexport type SprayKind =\n /** Broad or small leaves, one at a node, to either side in turn, a cluster at the shoot's tip. */\n | \"alternate\"\n /** Leaves in pairs at each node (a maple's). */\n | \"opposite\"\n /** A few long leaves hanging from the twig's end (a eucalyptus's adult leaves, sickle-curved). */\n | \"hanging\"\n /** A long hanging shoot with narrow leaves all along it (a weeping willow's, a birch's drooping twigs). */\n | \"weeping\"\n /** Whole scanned sprays (a fir's, a cedar's): the picture is already a twig with its needles or scales. */\n | \"sprays\"\n /** Whole scanned shoots ending in a brush of needles (a pine's). */\n | \"tufts\"\n /** A palm's feather-shaped leaf: leaflets along a rachis. */\n | \"pinnate\"\n /** A palm's fan: segments from the petiole's end. */\n | \"fan\"\n /** The sheet's picture is the whole leaf (a palm's frond): one to a card. */\n | \"whole\";\n\nexport const SPRAY_KINDS: readonly SprayKind[] = [\"alternate\", \"opposite\", \"hanging\", \"weeping\", \"sprays\", \"tufts\", \"pinnate\", \"fan\", \"whole\"];\n\n/** The realistic look's photographs for a species. */\nexport interface ScanLook {\n /** Its bark: the set (assets/scans.json) and how much bigger or smaller its pattern is than the scan's (1). */\n bark: string;\n barkScale?: number;\n /** Its colour at its foot, where not the species' bark colour (a birch's black foot). */\n barkFoot?: string;\n /**\n * The bark it takes on up the stem: from `from` to `to` (shares of the tree's height) the one gives way to\n * the other, raggedly, in tongues up and down the furrows; and its colour (sRGB), where not the species' bark\n * colour paled up the trunk (a Scots pine's copper flakes over its grey-brown plates).\n */\n upper?: { set: string; from: number; to: number; scale?: number; color?: string };\n /** Its leaves: the sheet, and how long one is on this species, stalk to tip (cm). */\n leaves: string;\n leafCm: number;\n spray: SprayKind;\n /** How narrow its leaves are beside the scan's (1: as scanned; under 1 narrower). */\n leafWidth?: number;\n /** How far its leaves curve to one side, a share of their length (a eucalyptus's sickle). */\n leafBend?: number;\n /** How far its near sprays hang down, 0..1 (a eucalyptus's, a willow's, a birch's). */\n hang?: number;\n /** How many leaves a near spray carries, about (else as its kind does). */\n perSpray?: number;\n /** A pine's needles, how long (cm): its tufts are as big (else a share of `leafCm`, `sprays.ts` `needleOf`). */\n needleCm?: number;\n /**\n * How long a pine's brush of needles is along its shoot's end, in its needles' lengths (else `TUFT_STRETCH`,\n * a starburst at the tip): a pine keeps its needles two to four years, so a dense one's shoots are clothed\n * along their last years' growth, bottle brushes standing side by side (a stone pine's, a Monterey pine's).\n */\n brush?: number;\n /**\n * A pine's cushions (a leaf set of whole pictures, assets/scans.json): its foliage as it is seen from a little\n * way off, each picture one dense cushion or clump seen from the side, its flat base down, its own light and\n * shade (its sunlit top yellow-green, its underside near black). Laid one to a big card (sprays.ts\n * `drawCushionCard`), which stands upright and turns to the eye about the vertical, so its flat base stays\n * flat: the canopy's cushions as game foliage lays its cluster cards. Its near cards stay its own drawn tufts.\n * \"drawn\": no picture, its cushions drawn needle by needle (sprays.ts `drawnCushionCard`).\n */\n cushion?: string;\n /**\n * Pictures of a pine's canopy for its far cards (a mid tree's, a far dab's), where they differ from its\n * cushions: a strip of cushions side by side (a stone pine's wide flat crown), laid one to a card.\n */\n cushionFar?: string;\n /**\n * How thick its cushions are for their width, where they are pads thinner in their pictures (a Monterey cypress's\n * shelves, 1–2 m deep on old coastal trees): each picture laid in layers on its card until it is so thick\n * (sprays.ts `drawCushionCard`).\n */\n padThick?: number;\n /**\n * A pine whose leaf pictures are its whole shoots (a twig ending in its brush, an eastern white pine's soft fine\n * needles): its tufts laid from them, one to a shoot's end, and not drawn needle by needle (sprays.ts `needleTuft`).\n */\n tuftPicture?: boolean;\n /**\n * How long a shoot picture laid at a tuft is, in the pine's needles' lengths (`tuftPicture`; else `sprays.ts`\n * `TUFT_SHOOT`, 3: a white pine's 30 cm shoot of 8–12 cm needles). A Torrey pine's picture is mostly its brush, its\n * needles some two thirds of it.\n */\n tuftShoot?: number;\n /**\n * Where along a shoot picture its brush begins, a share of the way from its stalk's end (`tuftPicture`): the picture\n * laid from there on, its bare twig left to the card's own wood. And how many of it to lay at a tuft, fanned about the\n * brush's foot (`tuftFan`; else one): a long-needled pine's brush stands out all round its shoot's end.\n */\n tuftFrom?: number;\n tuftFan?: number;\n /**\n * How many cushion cards to a clump near to, and how big (half width over the clump's radius), where not as closed\n * as its crown is (engine.ts `closedOf`: four of two radii on a closed crown, one of 1.1 on an open one).\n */\n cushionCards?: number;\n cushionSize?: number;\n /**\n * The colour of its flowers (sRGB), where its leaf pictures show them (a gorse sprig's yellow pea flowers): the\n * cards keep where they are (sprays.ts `Layer.flower`), and the shader colours them so, as far as the style's\n * `bloom` says (0 out of flower: the flowers gone, its spines left).\n */\n flowers?: string;\n /**\n * When it flowers: the share of its sprays in flower through the year, as [day of the year, share] from January on,\n * eased between them and round from December to January (`bloomShare`). Without it, or with no day given, the\n * style's `bloom`.\n */\n flowering?: readonly (readonly [number, number])[];\n}\n\n/**\n * Common gorse's year (Ulex europaeus): in flower mainly from January to June, at its height in spring (March to\n * May), and with a few flowers on it most of the year besides (\"when gorse is out of blossom, kissing's out of\n * fashion\"), fewest in late summer and autumn (Clements, Peterson and Prasad 2001, The biology of Canadian weeds:\n * Ulex europaeus; Tarayre et al. 2007, flowering phenology of Ulex europaeus).\n */\nexport const GORSE_FLOWERING: readonly (readonly [number, number])[] = [\n [1, 0.3], // 1 January: out, here and there\n [32, 0.5], // 1 February\n [74, 0.85], // 15 March\n [110, 0.95], // 20 April: at its height\n [140, 0.8], // 20 May\n [171, 0.45], // 20 June\n [201, 0.15], // 20 July: going over\n [244, 0.08], // 1 September: a few flowers\n [305, 0.1], // 1 November\n [335, 0.18], // 1 December: coming out again\n];\n\n/** Scotch broom's flush of yellow pea flowers across the late-spring peak (May–June). */\nexport const BROOM_FLOWERING: readonly (readonly [number, number])[] = [\n [1, 0.02],\n [90, 0.06],\n [122, 0.52],\n [145, 0.95], // late May peak\n [170, 0.75], // mid June\n [198, 0.12],\n [245, 0.02],\n [335, 0.02],\n];\n\n/** Elder's early-summer creamy corymb flush (`26–34%` peak in late May–June so leaves stay richly dominant). */\nexport const ELDER_FLOWERING: readonly (readonly [number, number])[] = [\n [1, 0],\n [130, 0.02],\n [148, 0.26],\n [166, 0.34],\n [185, 0.14],\n [205, 0.02],\n [335, 0],\n];\n\n/** Sea buckthorn's late-summer and autumn orange berry crop. */\nexport const SEA_BUCKTHORN_FRUITING: readonly (readonly [number, number])[] = [\n [1, 0.06],\n [120, 0],\n [205, 0.08],\n [235, 0.36],\n [280, 0.42],\n [330, 0.14],\n];\n\n/** The year's length the flowering is laid round (days). */\nconst YEAR_DAYS = 365.25;\n\n/**\n * How far in flower a species is, 0..1 (the share of its sprays in flower): on `day` (of the year, 1 on the 1st of\n * January), as its `flowering` says, eased between the days it names; with no day given, or no flowering of its own,\n * `bloom` (the style's).\n */\nexport function bloomShare(look: ScanLook, day: number | null, bloom: number): number {\n const year = look.flowering;\n if (day === null || !Number.isFinite(day) || !year || year.length === 0) return bloom;\n const d = (((day - 1) % YEAR_DAYS) + YEAR_DAYS) % YEAR_DAYS + 1;\n for (let i = 0; i < year.length; i++) {\n const [d0, s0] = year[i];\n const [d1raw, s1] = year[(i + 1) % year.length];\n const d1 = i + 1 < year.length ? d1raw : d1raw + YEAR_DAYS;\n // (Past the last named day, or before the first: round the year from December to January.)\n const at = d < year[0][0] ? d + YEAR_DAYS : d;\n if (at >= d0 && at <= d1) {\n const f = (at - d0) / Math.max(d1 - d0, 1e-6);\n return s0 + (s1 - s0) * (0.5 - 0.5 * Math.cos(Math.PI * f));\n }\n }\n return year[year.length - 1][1];\n}\n\n/** The photographs each of the library's species wears, by name. */\nexport const SCAN_LOOKS: Readonly<Record<string, ScanLook>> = {\n Oak: { bark: \"oak\", leaves: \"oak\", leafCm: 10, spray: \"alternate\" },\n // (The plane's leaf on its long stalk: some 16 cm of blade.)\n Plane: { bark: \"plane\", leaves: \"londonPlane\", leafCm: 30, spray: \"alternate\" },\n // (Its rough stocking, a few metres, giving way to the smooth mottled stem.)\n // (Its adult leaves 12–30 by 1.7–3 cm (EUCLID): narrower than the picture's.)\n Eucalyptus: { bark: \"eucalyptus\", upper: { set: \"eucalyptusUpper\", from: 0.04, to: 0.12 }, leaves: \"eucalyptus\", leafCm: 22, spray: \"hanging\", leafWidth: 0.6, leafBend: 0.03, hang: 0.85, perSpray: 8 },\n Spruce: { bark: \"spruce\", leaves: \"fir\", leafCm: 30, spray: \"sprays\" },\n // (Its grey-brown plates giving way, from about a third of the way up, to copper-orange flakes: the plates\n // its own grey-brown, not the orange its species is known by from afar.)\n \"Scots pine\": { bark: \"pine\", barkFoot: \"#6a625a\", upper: { set: \"pineFlakes\", from: 0.25, to: 0.5, color: \"#b4643c\" }, leaves: \"pine\", leafCm: 28, spray: \"tufts\", needleCm: 6, brush: 1.6 },\n Shrub: { bark: \"ridged\", barkScale: 0.4, leaves: \"elliptic\", leafCm: 5, spray: \"alternate\" },\n Beech: { bark: \"beech\", leaves: \"beech\", leafCm: 8, spray: \"alternate\" },\n // (Its own rugged blackish foot giving way to its white upper bark; its own leaves, 3–6 cm and a thin stalk.)\n \"Silver birch\": { bark: \"birchFoot\", barkFoot: \"#2f2c29\", upper: { set: \"birch\", from: 0.06, to: 0.2 }, leaves: \"birch\", leafCm: 6, spray: \"weeping\", hang: 0.7 },\n // (Its own leaves, almost round, 5–9 cm and a short stalk; its own dark bark of small squarish plates.)\n \"Black alder\": { bark: \"alder\", leaves: \"alder\", leafCm: 9, spray: \"alternate\" },\n // (Its own leaves, 5–8 cm on a long flattened stalk.)\n \"Lombardy poplar\": { bark: \"poplar\", leaves: \"poplar\", leafCm: 10, spray: \"alternate\" },\n // (Its own leaves, 8–15 cm and as narrow as they grow; its own netted bark.)\n \"Weeping willow\": { bark: \"willow\", leaves: \"willow\", leafCm: 12, spray: \"weeping\", hang: 0.95 },\n // (Its own deeply cut leaves, 3–5 cm with their stalk.)\n Hawthorn: { bark: \"oak\", barkScale: 0.45, leaves: \"hawthorn\", leafCm: 5, spray: \"alternate\", perSpray: 14 },\n // (Its own sprigs, spines and yellow flowers, whole: a twig's end of a few of them, the flowers kept yellow.)\n // (In flower mainly from January to June, a few flowers most of the year: `GORSE_FLOWERING`, for the host's day.)\n Gorse: { bark: \"ridged\", barkScale: 0.35, leaves: \"gorse\", leafCm: 22, spray: \"sprays\", flowers: \"#f2c230\", flowering: GORSE_FLOWERING },\n // (Its own bark of loose round scales, its own branch tips of stiff sharp blue-green needles.)\n \"Sitka spruce\": { bark: \"sitkaSpruce\", leaves: \"sitkaShoot\", leafCm: 28, spray: \"sprays\" },\n // (Its own bark of long scaly plates; its own shoots, a stout twig in a brush of long stiff needles in pairs, 10–15\n // cm: its tufts laid from them, `tuftPicture`, the picture some two needles long.)\n \"Corsican pine\": { bark: \"corsicanPine\", leaves: \"corsicanShoot\", leafCm: 32, spray: \"tufts\", needleCm: 12, tuftPicture: true, tuftShoot: 2.2 },\n // (Its own branch tips, soft flat needles all round the twig, a pointed bud.)\n \"Douglas fir\": { bark: \"douglas\", barkScale: 1.4, leaves: \"douglasShoot\", leafCm: 25, spray: \"sprays\" },\n \"Western red cedar\": { bark: \"fibrous\", leaves: \"scale\", leafCm: 30, spray: \"sprays\", hang: 0.4 },\n // (Its own bark of long fibrous strips, lichened.)\n \"Monterey cypress\": { bark: \"cypress\", leaves: \"cypress\", leafCm: 28, spray: \"sprays\", cushion: \"cypressPad\", padThick: 0.45, cushionSize: 2.8 },\n // (Its own very thick dark ridged bark, reddish in the furrows.)\n \"Monterey pine\": { bark: \"montereyPine\", leaves: \"pine\", leafCm: 34, spray: \"tufts\", needleCm: 12, brush: 1.8, cushionSize: 1.32 },\n // (Its shoot: a stout twig and a brush of needles 20–30 cm long, grey-green and stiff: its tufts laid from its own\n // shoot pictures, `tuftPicture`, the brush two thirds of the picture.)\n \"Torrey pine\": { bark: \"torreyPine\", leaves: \"torreyPine\", leafCm: 48, spray: \"tufts\", needleCm: 25, brush: 1.3, tuftPicture: true, tuftShoot: 1.6, tuftFrom: 0.3, tuftFan: 5 },\n // (Its own bark of broad flat plates.)\n \"Aleppo pine\": { bark: \"aleppoPine\", leaves: \"pine\", leafCm: 26, spray: \"tufts\", needleCm: 8, brush: 1.2 },\n \"Stone pine\": { bark: \"stonePine\", barkScale: 1, leaves: \"pine\", leafCm: 32, spray: \"tufts\", needleCm: 14, brush: 2, cushion: \"stonePineCushion\", cushionFar: \"stonePineCanopy\", cushionCards: 3, cushionSize: 1.24 },\n \"Canary date palm\": { bark: \"palmLattice\", leaves: \"frond\", leafCm: 450, spray: \"whole\" },\n \"Mexican fan palm\": { bark: \"palmRings\", leaves: \"blade\", leafCm: 60, spray: \"fan\" },\n \"California fan palm\": { bark: \"palmRings\", barkScale: 1.3, leaves: \"blade\", leafCm: 70, spray: \"fan\" },\n \"Queen palm\": { bark: \"palmRings\", barkScale: 0.75, leaves: \"frond\", leafCm: 400, spray: \"whole\" },\n \"Coast live oak\": { bark: \"liveOak\", leaves: \"liveOak\", leafCm: 5, spray: \"alternate\", perSpray: 12 },\n \"California sycamore\": { bark: \"ridged\", barkScale: 0.6, barkFoot: \"#5e5348\", upper: { set: \"plane\", from: 0.05, to: 0.22 }, leaves: \"sycamore\", leafCm: 24, spray: \"alternate\" },\n \"Sugar maple\": { bark: \"maple\", leaves: \"maple\", leafCm: 12, spray: \"opposite\" },\n \"Red oak\": { bark: \"redOak\", leaves: \"redOak\", leafCm: 17, spray: \"alternate\" },\n // (Its own shoots, soft feathery brushes of fine needles 8–12 cm in fives: its tufts laid from them, `tuftPicture`.)\n \"Eastern white pine\": { bark: \"whitePine\", leaves: \"whitePine\", leafCm: 26, spray: \"tufts\", needleCm: 10, tuftPicture: true },\n // (Its own pale flaky scales; its own branch tips, short stiff needles crowded on the twig's upper side.)\n \"White spruce\": { bark: \"whiteSpruce\", leaves: \"whiteSpruceShoot\", leafCm: 22, spray: \"sprays\" },\n // (Fourteen European and Pacific Northwest trees and shrubs added 2026-11-25.)\n Ash: { bark: \"ash\", leaves: \"ash\", leafCm: 26, spray: \"opposite\" },\n // (Its own leaves are queued; using Sugar maple's palmate sheet until they arrive.)\n \"Sycamore maple\": { bark: \"sycMaple\", leaves: \"maple\", leafCm: 13, spray: \"opposite\" },\n \"White willow\": { bark: \"whiteWillow\", leaves: \"whiteWillow\", leafCm: 9, spray: \"alternate\" },\n \"European larch\": { bark: \"larch\", leaves: \"larchShoot\", leafCm: 24, spray: \"sprays\" },\n \"Small-leaved lime\": { bark: \"lime\", leaves: \"lime\", leafCm: 6, spray: \"alternate\" },\n \"Western hemlock\": { bark: \"hemlock\", leaves: \"hemlockShoot\", leafCm: 22, spray: \"sprays\", hang: 0.45 },\n \"Red alder\": { bark: \"redAlder\", leaves: \"redAlder\", leafCm: 10, spray: \"alternate\" },\n \"Norway maple\": { bark: \"norMaple\", leaves: \"norMaple\", leafCm: 13, spray: \"opposite\" },\n Hornbeam: { bark: \"hornbeam\", leaves: \"hornbeam\", leafCm: 8, spray: \"alternate\" },\n Aspen: { bark: \"aspen\", leaves: \"aspen\", leafCm: 6, spray: \"alternate\" },\n \"Sea buckthorn\": { bark: \"ridged\", barkScale: 0.4, leaves: \"seaBuckthornSprig\", leafCm: 20, spray: \"sprays\", flowers: \"#e87824\", flowering: SEA_BUCKTHORN_FRUITING },\n Elder: { bark: \"ridged\", barkScale: 0.45, leaves: \"elderSprig\", leafCm: 20, spray: \"sprays\", flowers: \"#f5f1dc\", flowering: ELDER_FLOWERING },\n \"Scotch broom\": { bark: \"ridged\", barkScale: 0.35, leaves: \"broomSprig\", leafCm: 24, spray: \"sprays\", flowers: \"#f2c230\", flowering: BROOM_FLOWERING },\n Blackthorn: { bark: \"oak\", barkScale: 0.45, leaves: \"blackthorn\", leafCm: 4, spray: \"alternate\", perSpray: 14 },\n Rowan: { bark: \"hornbeam\", barkScale: 0.65, leaves: \"ash\", leafCm: 16, spray: \"alternate\" },\n \"Sweet chestnut\": { bark: \"oak\", barkScale: 1.35, leaves: \"serrate\", leafCm: 16, spray: \"alternate\" },\n \"Black poplar\": { bark: \"poplar\", barkScale: 1.15, leaves: \"deltoid\", leafCm: 10, spray: \"alternate\" },\n \"Crack willow\": { bark: \"willow\", barkScale: 1.1, leaves: \"lance\", leafCm: 13, spray: \"alternate\", leafWidth: 0.72 },\n \"Holm oak\": { bark: \"liveOak\", barkScale: 0.9, leaves: \"liveOak\", leafCm: 8.5, spray: \"alternate\", leafWidth: 0.85, perSpray: 12 },\n // (The magnolia's own big glossy leaves, 13–25 cm, and smooth grey bark; the sweetgum's own star-shaped leaves and\n // corky furrowed bark. The Leyland cypress, a Monterey cypress hybrid, wears that cypress's bark and the flat\n // scale-leaf sprays of the western red cedar's until it has its own: tools/ai-textures/PROMPTS.md.)\n \"Southern magnolia\": { bark: \"magnolia\", leaves: \"magnolia\", leafCm: 18, spray: \"alternate\", perSpray: 8 },\n \"American sweetgum\": { bark: \"sweetgum\", leaves: \"sweetgum\", leafCm: 14, spray: \"alternate\" },\n \"Leyland cypress\": { bark: \"cypress\", leaves: \"scale\", leafCm: 28, spray: \"sprays\", hang: 0.2 },\n \"Subalpine fir\": { bark: \"whiteSpruce\", barkScale: 0.95, leaves: \"fir\", leafCm: 24, spray: \"sprays\" },\n};\n\n/**\n * A look's upper bark colour packed in one number for the shaders (a float holds it exactly): its sRGB bytes,\n * red · 65536 + green · 256 + blue, plus 1; 0 where it has none.\n */\nexport function upperColorCode(look: ScanLook): number {\n const hex = look.upper?.color;\n if (!hex) return 0;\n if (!/^#?[0-9a-f]{6}$/i.test(hex)) throw new Error(`upper bark colour ${hex}: not #rrggbb`);\n return parseInt(hex.replace(/^#/, \"\"), 16) + 1;\n}\n\n/** A look's flower colour packed as an upper bark colour is (`upperColorCode`); 0 where it has none. */\nexport function flowerColorCode(look: ScanLook): number {\n return look.flowers ? upperColorCode({ ...look, upper: { set: \"\", from: 0, to: 0, color: look.flowers } }) : 0;\n}\n\n/** The sRGB colour (0..1) an upper bark colour code holds (as the shader reads it), or null for none. */\nexport function upperColorOf(code: number): [number, number, number] | null {\n if (code < 0.5) return null;\n const v = code - 1;\n const r = Math.floor(v / 65536);\n const g = Math.floor((v - r * 65536) / 256);\n return [r / 255, g / 255, (v - r * 65536 - g * 256) / 255];\n}\n\n/** What a species with no look of its own here wears: by its kind of leaf. */\nconst BY_KIND: Readonly<Record<TreeSpecies[\"leafKind\"], ScanLook>> = {\n broad: SCAN_LOOKS.Oak,\n narrow: SCAN_LOOKS[\"Weeping willow\"],\n needle: SCAN_LOOKS.Spruce,\n small: SCAN_LOOKS.Shrub,\n frond: SCAN_LOOKS[\"Canary date palm\"],\n pine: SCAN_LOOKS[\"Scots pine\"],\n};\n\n/**\n * The photographs a species wears: a host's (`looks`, by the species' name) over its name's here, else its kind\n * of leaf's.\n */\nexport function scanLookOf(s: TreeSpecies, looks?: Readonly<Record<string, Partial<ScanLook>>>): ScanLook {\n const own = looks?.[s.name];\n const base = SCAN_LOOKS[s.name] ?? BY_KIND[s.leafKind] ?? SCAN_LOOKS.Oak;\n return own ? { ...base, ...own } : base;\n}\n\n/** Validate a partial or complete `ScanLook` against known bark/leaf sets and parameter ranges. */\nexport function checkScanLook(look: Partial<ScanLook>): string[] {\n const out: string[] = [];\n const hex = /^#[0-9a-f]{6}$/i;\n if (look.bark !== undefined && (typeof look.bark !== \"string\" || !barkSet(look.bark))) {\n out.push(`bark \"${String(look.bark)}\" is not a known bark set`);\n }\n if (look.barkScale !== undefined && !(typeof look.barkScale === \"number\" && Number.isFinite(look.barkScale) && look.barkScale > 0 && look.barkScale <= 10)) {\n out.push(\"barkScale must be > 0 and <= 10\");\n }\n if (look.barkFoot !== undefined && (typeof look.barkFoot !== \"string\" || !hex.test(look.barkFoot))) {\n out.push(\"barkFoot must be a hex colour like #6a625a\");\n }\n if (look.flowers !== undefined && (typeof look.flowers !== \"string\" || !hex.test(look.flowers))) {\n out.push(\"flowers must be a hex colour like #f2c230\");\n }\n if (look.upper !== undefined) {\n const u = look.upper;\n if (typeof u !== \"object\" || u === null || Array.isArray(u)) {\n out.push(\"upper must be an object\");\n } else {\n if (typeof u.set !== \"string\" || !barkSet(u.set)) out.push(`upper.set \"${String(u.set)}\" is not a known bark set`);\n if (!(typeof u.from === \"number\" && Number.isFinite(u.from) && u.from >= 0 && typeof u.to === \"number\" && Number.isFinite(u.to) && u.from < u.to && u.to <= 1)) {\n out.push(\"upper.from and upper.to must satisfy 0 <= from < to <= 1\");\n }\n if (u.scale !== undefined && !(typeof u.scale === \"number\" && Number.isFinite(u.scale) && u.scale > 0 && u.scale <= 10)) {\n out.push(\"upper.scale must be > 0 and <= 10\");\n }\n if (u.color !== undefined && (typeof u.color !== \"string\" || !hex.test(u.color))) {\n out.push(\"upper.color must be a hex colour like #b4643c\");\n }\n }\n }\n if (look.leaves !== undefined && (typeof look.leaves !== \"string\" || !leafSet(look.leaves))) {\n out.push(`leaves \"${String(look.leaves)}\" is not a known leaf set`);\n }\n if (look.leafCm !== undefined && !(typeof look.leafCm === \"number\" && Number.isFinite(look.leafCm) && look.leafCm > 0 && look.leafCm <= 1000)) {\n out.push(\"leafCm must be > 0 and <= 1000\");\n }\n if (look.spray !== undefined && !SPRAY_KINDS.includes(look.spray)) {\n out.push(`spray must be one of ${SPRAY_KINDS.join(\", \")}`);\n }\n for (const [k, lo, hi, strictLo] of [\n [\"leafWidth\", 0, 4, true],\n [\"leafBend\", -1, 1, false],\n [\"hang\", 0, 1, false],\n [\"perSpray\", 1, 60, false],\n [\"needleCm\", 0, 100, true],\n [\"brush\", 0, 10, true],\n [\"padThick\", 0, 4, true],\n [\"tuftShoot\", 0, 10, true],\n [\"tuftFrom\", 0, 0.95, false],\n [\"tuftFan\", 1, 16, false],\n [\"cushionCards\", 0, 16, false],\n [\"cushionSize\", 0, 6, true],\n ] as const) {\n const v = look[k];\n if (v === undefined) continue;\n const ok = typeof v === \"number\" && Number.isFinite(v) && (strictLo ? v > lo : v >= lo) && v <= hi;\n if (!ok) out.push(`${k} must be ${strictLo ? \">\" : \">=\"} ${lo} and <= ${hi}`);\n }\n if (look.tuftPicture !== undefined && typeof look.tuftPicture !== \"boolean\") {\n out.push(\"tuftPicture must be a boolean\");\n }\n for (const ck of [\"cushion\", \"cushionFar\"] as const) {\n const c = look[ck];\n if (c !== undefined && (typeof c !== \"string\" || (c !== \"drawn\" && !leafSet(c)))) {\n out.push(`${ck} \"${String(c)}\" must be \"drawn\" or a known leaf set`);\n }\n }\n return out;\n}\n\n/** How far a species' near cards reach from their middle (m): a twig's end, a few shoots with their leaves. */\nexport function nearCardHalf(look: ScanLook): number {\n const leaf = look.leafCm / 100;\n if (look.spray === \"pinnate\") return 0;\n // (A fan palm's leaf, whole, a card: about its own width.)\n if (look.spray === \"fan\") return Math.min(1, leaf * 1.25);\n // (A palm's frond, a stretch of it a card, a couple of metres: the picture holds no finer.)\n if (look.spray === \"whole\") return Math.min(1.1, leaf * 0.25);\n // (A twig's end of several shoots: some five leaves long for broad leaves, a few shoots' length for needles.)\n if (look.spray === \"sprays\" || look.spray === \"tufts\") return Math.min(0.45, Math.max(0.2, leaf * 1.4));\n if (look.spray === \"hanging\") return Math.min(0.45, Math.max(0.2, leaf * 1.6));\n if (look.spray === \"weeping\") return Math.min(0.45, Math.max(0.2, leaf * 2.2));\n return Math.min(0.45, Math.max(0.2, leaf * 2.5));\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n// Loading.\n\n/** Where the pictures are by default: beside this module in the package (assets/), unless a host says. */\nlet assetBase: string | null = null;\n/**\n * Fetch the photographs from `base` (a folder holding bark/ and leaves/, as assets/ does) instead of from\n * beside the package: for a host whose bundler moves the package's modules away from its files. The default\n * for trees made without a `base` of their own (`scanSource`); one made with its own keeps to it.\n */\nexport function setScanBase(base: string | null): void {\n assetBase = base;\n}\n\n/**\n * Where one set of trees fetches its pictures from: bound when the trees are made, so another set's `base`\n * never changes where this one's come from, even while both are loading.\n */\nexport interface ScanSource {\n /** A file of assets/ at `path` there; `here` its URL beside the package. */\n asset(path: string, here: string): string;\n /** A photograph's URL: a bark set's or a leaf sheet's colour or surface. */\n picture(kind: \"bark\" | \"leaves\", id: string, map: \"albedo\" | \"normal\"): string;\n}\n\nconst under = (base: string, path: string): string => `${base.replace(/\\/?$/, \"/\")}${path}`;\n\nfunction besidePackage(kind: \"bark\" | \"leaves\", id: string, map: \"albedo\" | \"normal\"): string {\n // (Written out whole, so a bundler sees each folder and copies its pictures.)\n return kind === \"bark\" ? new URL(`../assets/bark/${id}.${map}.avif`, import.meta.url).href : new URL(`../assets/leaves/${id}.${map}.avif`, import.meta.url).href;\n}\n\n/**\n * Pictures fetched from `base`, a folder laid out as assets/ is; with none (undefined), from where\n * `setScanBase` says when they are fetched, else from beside the package; `null`, from beside the package.\n */\nexport function scanSource(base?: string | null): ScanSource {\n const from = (): string | null => (base === undefined ? assetBase : base);\n return {\n asset: (path, here) => {\n const b = from();\n return b !== null ? under(b, path) : here;\n },\n picture: (kind, id, map) => {\n const b = from();\n return b !== null ? under(b, `${kind}/${id}.${map}.avif`) : besidePackage(kind, id, map);\n },\n };\n}\n\n/** The pictures of trees made without a `base`: from where `setScanBase` says, else beside the package. */\nexport const DEFAULT_SCAN_SOURCE: ScanSource = scanSource();\n\n/** A file of assets/ at `path` there: from where `setScanBase` says, if it was set, else `here` (its URL beside the package). */\nexport function assetUrl(path: string, here: string): string {\n return DEFAULT_SCAN_SOURCE.asset(path, here);\n}\n\n/** The pictures fetched, by URL and size: two sets of trees fetching from two places share none. */\nconst loaded = new Map<string, Promise<Pixels>>();\n\n/** A picture's texels, as they are in the file: RGBA8, no colour conversion, alpha not multiplied in. */\nexport async function decode(url: string, size?: number): Promise<Pixels> {\n const res = await fetch(url);\n if (!res.ok) throw new Error(`${url}: ${res.status}`);\n const blob = await res.blob();\n const bmp = await createImageBitmap(blob, { premultiplyAlpha: \"none\", colorSpaceConversion: \"none\", ...(size ? { resizeWidth: size, resizeHeight: size, resizeQuality: \"high\" as const } : {}) });\n const canvas = new OffscreenCanvas(bmp.width, bmp.height);\n const ctx = canvas.getContext(\"2d\", { colorSpace: \"srgb\", willReadFrequently: true }) as OffscreenCanvasRenderingContext2D;\n ctx.drawImage(bmp, 0, 0);\n const img = ctx.getImageData(0, 0, bmp.width, bmp.height);\n bmp.close();\n return { data: new Uint8Array(img.data.buffer), width: img.width, height: img.height };\n}\n\nfunction picture(source: ScanSource, kind: \"bark\" | \"leaves\", id: string, map: \"albedo\" | \"normal\", size?: number): Promise<Pixels> {\n const url = source.picture(kind, id, map);\n const key = `${url}@${size ?? 0}`;\n let p = loaded.get(key);\n if (!p) {\n p = decode(url, size);\n loaded.set(key, p);\n p.catch(() => loaded.delete(key));\n }\n return p;\n}\n\n/** A bark set's colour (roughness in alpha) and relief (normal x, y, height), `size` texels square, from `source`. */\nexport async function loadBark(id: string, size = BARK_SIZE, source: ScanSource = DEFAULT_SCAN_SOURCE): Promise<{ albedo: Pixels; normal: Pixels }> {\n const s = size === BARK_SIZE ? undefined : size;\n const [albedo, normal] = await Promise.all([picture(source, \"bark\", id, \"albedo\", s), picture(source, \"bark\", id, \"normal\", s)]);\n return { albedo, normal };\n}\n\n/** A leaf sheet's colour (coverage in alpha) and surface (normal x, y, light let through), from `source`. */\nexport async function loadLeaves(id: string, source: ScanSource = DEFAULT_SCAN_SOURCE): Promise<{ albedo: Pixels; normal: Pixels }> {\n const [albedo, normal] = await Promise.all([picture(source, \"leaves\", id, \"albedo\"), picture(source, \"leaves\", id, \"normal\")]);\n return { albedo, normal };\n}\n"]}
@@ -0,0 +1,70 @@
1
+ import * as THREE from "three/webgpu";
2
+ import { type TreeSpecies } from "./species.js";
3
+ export interface ScatterBiome {
4
+ /** Species row index into `species`. */
5
+ species: number;
6
+ /** Relative selection weight when multiple biomes overlap. */
7
+ weight: number;
8
+ minElevation?: number;
9
+ maxElevation?: number;
10
+ /** Maximum terrain slope in degrees where this species grows. */
11
+ maxSlopeDeg?: number;
12
+ /** Moisture range in `[0, 1]`. */
13
+ moistureRange?: [number, number];
14
+ /** Optional random height/crown scale multiplier `[min, max]`. */
15
+ scaleRange?: [number, number];
16
+ }
17
+ export interface ScatterOptions {
18
+ x0: number;
19
+ z0: number;
20
+ width: number;
21
+ depth: number;
22
+ /** Nominal spacing between candidate grid cells (m). */
23
+ spacing: number;
24
+ seed?: number;
25
+ /** Jitter within each cell, 0..1 (default 0.85). */
26
+ jitter?: number;
27
+ /** Cap on total emitted trees. */
28
+ maxTrees?: number;
29
+ biomes: readonly ScatterBiome[];
30
+ heightAt?: (x: number, z: number) => number;
31
+ moistureAt?: (x: number, z: number) => number;
32
+ allowAt?: (x: number, z: number) => boolean;
33
+ species: readonly TreeSpecies[];
34
+ }
35
+ /**
36
+ * Deterministic jittered-grid biome scatterer. Emits a tight `Float32Array` with
37
+ * `TREE_STRIDE` floats per tree ready to pass into `createTrees({ trees, species })`.
38
+ */
39
+ export declare function scatterTrees(options: ScatterOptions): Float32Array;
40
+ export interface GpuScatterOptions {
41
+ x0: number;
42
+ z0: number;
43
+ width: number;
44
+ depth: number;
45
+ spacing: number;
46
+ maxTrees: number;
47
+ /** Texture storing elevation in `.r` (metres) and moisture `[0..1]` in `.g`. */
48
+ terrainTex: THREE.DataTexture;
49
+ minElevation?: number;
50
+ maxElevation?: number;
51
+ maxSlopeCos?: number;
52
+ speciesCount: number;
53
+ seed?: number;
54
+ }
55
+ export interface GpuScatter {
56
+ readonly packedAttr: THREE.StorageBufferAttribute;
57
+ readonly countAttr: THREE.StorageBufferAttribute;
58
+ /** Dispatch compute scatter and return `{ count, packed }` read back on CPU. */
59
+ run(renderer: THREE.WebGPURenderer): Promise<{
60
+ count: number;
61
+ packed: Float32Array;
62
+ }>;
63
+ dispose(): void;
64
+ }
65
+ /**
66
+ * WebGPU compute scatterer sampling a terrain height/moisture texture in parallel,
67
+ * filtering by elevation and slope, and compacting `TREE_STRIDE` instances via `atomicAdd`.
68
+ */
69
+ export declare function createGpuScatter(options: GpuScatterOptions): GpuScatter;
70
+ //# sourceMappingURL=scatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scatter.d.ts","sourceRoot":"","sources":["../src/scatter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,kEAAkE;IAClE,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,M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