@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
@@ -1,14 +1,14 @@
1
- import "../types-BZjHhNz7.js";
1
+ import { x as coneCurve } from "../names-BE9he6CS.js";
2
2
  import { t as SEASON_PROFILES } from "../profiles-BAiyeFlh.js";
3
+ import { t as applyStyle } from "../apply-Cio2t7CZ.js";
3
4
  // src/styles/low-poly/index.ts
4
5
  /**
5
6
  * Low-poly broadleaf: a short, stout trunk and a few branches, crowned by faceted foliage
6
7
  * clumps. Deciduous Season Profile: fresh green in spring, autumn colours, bare in winter.
7
8
  */
8
9
  var broadleaf = {
9
- schemaVersion: 2,
10
+ schemaVersion: 3,
10
11
  name: "Low-poly broadleaf",
11
- form: "broadleaf",
12
12
  trunk: {
13
13
  length: 3,
14
14
  radius: .22,
@@ -16,7 +16,8 @@ var broadleaf = {
16
16
  sides: 5,
17
17
  sections: 3,
18
18
  lengthVariation: .15,
19
- bend: .12
19
+ bend: .12,
20
+ flareSections: 2
20
21
  },
21
22
  branches: [{
22
23
  count: 5,
@@ -87,12 +88,11 @@ var broadleaf = {
87
88
  };
88
89
  /**
89
90
  * Low-poly conifer: a straight trunk with drooping whorls that shrink towards the top
90
- * (the conifer Form), covered in faceted needle tufts. Evergreen Season Profile: it only darkens a little in winter.
91
+ * (a cone Crown Shape), covered in faceted needle tufts. Evergreen Season Profile: it only darkens a little in winter.
91
92
  */
92
93
  var conifer = {
93
- schemaVersion: 2,
94
+ schemaVersion: 3,
94
95
  name: "Low-poly conifer",
95
- form: "conifer",
96
96
  trunk: {
97
97
  length: 5,
98
98
  radius: .2,
@@ -100,7 +100,8 @@ var conifer = {
100
100
  sides: 5,
101
101
  sections: 4,
102
102
  lengthVariation: .15,
103
- bend: .03
103
+ bend: .03,
104
+ flareSections: 2
104
105
  },
105
106
  branches: [{
106
107
  count: 24,
@@ -116,7 +117,8 @@ var conifer = {
116
117
  sides: 3,
117
118
  sections: 2,
118
119
  bend: .05,
119
- gravity: -.08
120
+ gravity: -.08,
121
+ lengthProfile: coneCurve(.18)
120
122
  }],
121
123
  leaves: {
122
124
  count: 7,
@@ -158,7 +160,8 @@ var conifer = {
158
160
  var lowPoly = {
159
161
  name: "low-poly",
160
162
  broadleaf,
161
- conifer
163
+ conifer,
164
+ apply: (source, overrides) => applyStyle("low-poly", source, overrides)
162
165
  };
163
166
  export { broadleaf, conifer, lowPoly as default };
164
167
 
@@ -1 +1 @@
1
- {"version":3,"file":"low-poly.js","names":[],"sources":["../../src/styles/low-poly/index.ts"],"sourcesContent":["// @casmo/tree.js/styles/low-poly: faceted geometry, flat vertex colours, no image files.\n// Pure data (no library code beyond shared constants), so it stays a tiny chunk fetched only when imported.\nimport { CURRENT_SCHEMA_VERSION, type TreeDefinition } from '../../definition/types';\nimport { SEASON_PROFILES } from '../../season/profiles';\nimport type { TreeStyle } from '../types';\n\n/**\n * Low-poly broadleaf: a short, stout trunk and a few branches, crowned by faceted foliage\n * clumps. Deciduous Season Profile: fresh green in spring, autumn colours, bare in winter.\n */\nexport const broadleaf: TreeDefinition = {\n schemaVersion: CURRENT_SCHEMA_VERSION,\n name: 'Low-poly broadleaf',\n form: 'broadleaf',\n trunk: { length: 3, radius: 0.22, taper: 0.5, sides: 5, sections: 3, lengthVariation: 0.15, bend: 0.12 },\n branches: [\n { count: 5, start: 0.5, end: 0.92, angle: 42, angleVariation: 0.2, spiral: 137.5, length: 0.5, lengthVariation: 0.2, radius: 0.55, taper: 0.45, sides: 4, sections: 2, bend: 0.12, gravity: 0.15 },\n { count: 3, start: 0.35, end: 1, angle: 38, angleVariation: 0.25, spiral: 120, length: 0.55, lengthVariation: 0.25, radius: 0.6, taper: 0.4, sides: 3, sections: 1, bend: 0.1, gravity: 0.1 },\n ],\n leaves: { count: 2, shape: 'clump', size: 1, sizeVariation: 0.25, start: 0.55, angle: 25 },\n materials: {\n shading: 'flat',\n bark: { color: '#7a5233', roughness: 1, map: null, normalMap: null },\n leaf: { roughness: 1, map: null, alphaTest: 0.5 },\n },\n season: SEASON_PROFILES.deciduous,\n wind: { trunk: 0.15, branches: 0.4, leaves: 0.5, frequency: 1 },\n variation: { color: 0.12, growth: 0.1, season: 0.05 },\n sculpts: [],\n};\n\n/**\n * Low-poly conifer: a straight trunk with drooping whorls that shrink towards the top\n * (the conifer Form), covered in faceted needle tufts. Evergreen Season Profile: it only darkens a little in winter.\n */\nexport const conifer: TreeDefinition = {\n schemaVersion: CURRENT_SCHEMA_VERSION,\n name: 'Low-poly conifer',\n form: 'conifer',\n trunk: { length: 5, radius: 0.2, taper: 0.15, sides: 5, sections: 4, lengthVariation: 0.15, bend: 0.03 },\n branches: [\n { count: 24, start: 0.18, end: 0.97, angle: 95, angleVariation: 0.08, spiral: 137.5, length: 0.42, lengthVariation: 0.15, radius: 0.4, taper: 0.3, sides: 3, sections: 2, bend: 0.05, gravity: -0.08 },\n ],\n leaves: { count: 7, shape: 'needle', size: 0.65, sizeVariation: 0.2, start: 0, angle: 35 },\n materials: {\n shading: 'flat',\n bark: { color: '#5c4030', roughness: 1, map: null, normalMap: null },\n leaf: { roughness: 1, map: null, alphaTest: 0.5 },\n },\n season: SEASON_PROFILES.evergreen,\n wind: { trunk: 0.1, branches: 0.3, leaves: 0.3, frequency: 0.8 },\n variation: { color: 0.08, growth: 0.1, season: 0.05 },\n sculpts: [],\n};\n\n/** The low-poly Style. */\nconst lowPoly: TreeStyle = { name: 'low-poly', broadleaf, conifer };\nexport default lowPoly;\n"],"mappings":";;;;;;;AAUA,IAAa,YAA4B;CACvC,eAAA;C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,OAAO;EAAK,OAAO;EAAG,UAAU;EAAG,MAAM;EAAM,SAAS;CAAM,CACvM;CACA,QAAQ;EAAE,OAAO;EAAG,OAAO;EAAU,MAAM;EAAM,eAAe;EAAK,OAAO;EAAG,OAAO;CAAG;CACzF,WAAW;EACT,SAAS;EACT,MAAM;GAAE,OAAO;GAAW,WAAW;GAAG,KAAK;GAAM,WAAW;EAAK;EACnE,MAAM;GAAE,WAAW;GAAG,KAAK;GAAM,WAAW;EAAI;CAClD;CACA,QAAQ,gBAAgB;CACxB,MAAM;EAAE,OAAO;EAAK,UAAU;EAAK,QAAQ;EAAK,WAAW;CAAI;CAC/D,WAAW;EAAE,OAAO;EAAM,QAAQ;EAAK,QAAQ;CAAK;CACpD,SAAS,CAAC;AACZ;;AAGA,IAAM,UAAqB;CAAE,MAAM;CAAY;CAAW;AAAQ"}
1
+ {"version":3,"file":"low-poly.js","names":[],"sources":["../../src/styles/low-poly/index.ts"],"sourcesContent":["// @casmo/tree.js/styles/low-poly: faceted geometry, flat vertex colours, no image files.\n// Pure data plus `apply` (shared with the other Styles), fetched only when imported.\nimport { coneCurve } from '../../definition/crown-shape';\nimport { CURRENT_SCHEMA_VERSION, type TreeDefinition } from '../../definition/types';\nimport { SEASON_PROFILES } from '../../season/profiles';\nimport { applyStyle } from '../apply';\nimport type { TreeStyle } from '../types';\n\n/**\n * Low-poly broadleaf: a short, stout trunk and a few branches, crowned by faceted foliage\n * clumps. Deciduous Season Profile: fresh green in spring, autumn colours, bare in winter.\n */\nexport const broadleaf: TreeDefinition = {\n schemaVersion: CURRENT_SCHEMA_VERSION,\n name: 'Low-poly broadleaf',\n trunk: { length: 3, radius: 0.22, taper: 0.5, sides: 5, sections: 3, lengthVariation: 0.15, bend: 0.12, flareSections: 2 },\n branches: [\n { count: 5, start: 0.5, end: 0.92, angle: 42, angleVariation: 0.2, spiral: 137.5, length: 0.5, lengthVariation: 0.2, radius: 0.55, taper: 0.45, sides: 4, sections: 2, bend: 0.12, gravity: 0.15 },\n { count: 3, start: 0.35, end: 1, angle: 38, angleVariation: 0.25, spiral: 120, length: 0.55, lengthVariation: 0.25, radius: 0.6, taper: 0.4, sides: 3, sections: 1, bend: 0.1, gravity: 0.1 },\n ],\n leaves: { count: 2, shape: 'clump', size: 1, sizeVariation: 0.25, start: 0.55, angle: 25 },\n materials: {\n shading: 'flat',\n bark: { color: '#7a5233', roughness: 1, map: null, normalMap: null },\n leaf: { roughness: 1, map: null, alphaTest: 0.5 },\n },\n season: SEASON_PROFILES.deciduous,\n wind: { trunk: 0.15, branches: 0.4, leaves: 0.5, frequency: 1 },\n variation: { color: 0.12, growth: 0.1, season: 0.05 },\n sculpts: [],\n};\n\n/**\n * Low-poly conifer: a straight trunk with drooping whorls that shrink towards the top\n * (a cone Crown Shape), covered in faceted needle tufts. Evergreen Season Profile: it only darkens a little in winter.\n */\nexport const conifer: TreeDefinition = {\n schemaVersion: CURRENT_SCHEMA_VERSION,\n name: 'Low-poly conifer',\n trunk: { length: 5, radius: 0.2, taper: 0.15, sides: 5, sections: 4, lengthVariation: 0.15, bend: 0.03, flareSections: 2 },\n branches: [\n { count: 24, start: 0.18, end: 0.97, angle: 95, angleVariation: 0.08, spiral: 137.5, length: 0.42, lengthVariation: 0.15, radius: 0.4, taper: 0.3, sides: 3, sections: 2, bend: 0.05, gravity: -0.08,\n // Crown Shape: a cone, full length at the lowest whorl, a tenth of it at the top.\n lengthProfile: coneCurve(0.18) },\n ],\n leaves: { count: 7, shape: 'needle', size: 0.65, sizeVariation: 0.2, start: 0, angle: 35 },\n materials: {\n shading: 'flat',\n bark: { color: '#5c4030', roughness: 1, map: null, normalMap: null },\n leaf: { roughness: 1, map: null, alphaTest: 0.5 },\n },\n season: SEASON_PROFILES.evergreen,\n wind: { trunk: 0.1, branches: 0.3, leaves: 0.3, frequency: 0.8 },\n variation: { color: 0.08, growth: 0.1, season: 0.05 },\n sculpts: [],\n};\n\n/** The low-poly Style. */\nconst lowPoly: TreeStyle = { name: 'low-po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E,OAAO;EAAI,OAAO;EAAM,KAAK;EAAM,OAAO;EAAI,gBAAgB;EAAM,QAAQ;EAAO,QAAQ;EAAM,iBAAiB;EAAM,QAAQ;EAAK,OAAO;EAAK,OAAO;EAAG,UAAU;EAAG,MAAM;EAAM,SAAS;EAE7L,eAAe,UAAU,GAAI;CAAE,CACnC;CACA,QAAQ;EAAE,OAAO;EAAG,OAAO;EAAU,MAAM;EAAM,eAAe;EAAK,OAAO;EAAG,OAAO;CAAG;CACzF,WAAW;EACT,SAAS;EACT,MAAM;GAAE,OAAO;GAAW,WAAW;GAAG,KAAK;GAAM,WAAW;EAAK;EACnE,MAAM;GAAE,WAAW;GAAG,KAAK;GAAM,WAAW;EAAI;CAClD;CACA,QAAQ,gBAAgB;CACxB,MAAM;EAAE,OAAO;EAAK,UAAU;EAAK,QAAQ;EAAK,WAAW;CAAI;CAC/D,WAAW;EAAE,OAAO;EAAM,QAAQ;EAAK,QAAQ;CAAK;CACpD,SAAS,CAAC;AACZ;;AAGA,IAAM,UAAqB;CAAE,MAAM;CAAY;CAAW;CAAS,QAAQ,QAAQ,cAAc,WAAW,YAAY,QAAQ,SAAS;AAAE"}
@@ -0,0 +1,27 @@
1
+ import type { MaterialFeatures, TreeDefinition, TreeDefinitionInput } from '../definition/types';
2
+ import type { StyleName } from './names';
3
+ /**
4
+ * Suggested Material Features for each built-in Style (like `SUGGESTED_TREE_EFFECTS`). Nothing uses
5
+ * them by default; pass one to {@link withMaterialFeatures} to opt a Definition in.
6
+ *
7
+ * Tuned against the e2e screenshots (e2e/material-features.spec.ts). Structural Occlusion only darkens
8
+ * ambient light, so it is set high; translucency stays low enough that a crown against the sun keeps its shape.
9
+ */
10
+ export declare const SUGGESTED_MATERIAL_FEATURES: Record<StyleName, MaterialFeatures>;
11
+ /**
12
+ * The Material Features a Tree Definition has (`materials.leaf.crownNormals`, `materials.leaf.translucency`,
13
+ * `materials.occlusion`), in the shape {@link withMaterialFeatures} takes. A feature that is absent is left
14
+ * out; the values are the Definition's own (not copies).
15
+ */
16
+ export declare function materialFeaturesOf(definition: TreeDefinition): MaterialFeatures;
17
+ /**
18
+ * Returns a new Tree Definition whose Material Features are exactly `features`: each feature given is
19
+ * set, each feature left out is switched off (`{}` switches them all off). Everything else is kept. The
20
+ * input is not changed. Throws a TreeDefinitionError for an out-of-range value.
21
+ *
22
+ * ```ts
23
+ * const tree = createTree(withMaterialFeatures(stylized.broadleaf, SUGGESTED_MATERIAL_FEATURES.stylized));
24
+ * ```
25
+ */
26
+ export declare function withMaterialFeatures(definition: TreeDefinition | TreeDefinitionInput, features: MaterialFeatures): TreeDefinition;
27
+ //# sourceMappingURL=material-features.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"material-features.d.ts","sourceRoot":"","sources":["../../src/styles/material-features.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACjG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,SAAS,EAAE,gBAAgB,CAkB3E,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,cAAc,GAAG,gBAAgB,CAQ/E;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,cAAc,GAAG,mBAAmB,EAAE,QAAQ,EAAE,gBAAgB,GAAG,cAAc,CAqBjI"}
@@ -0,0 +1,28 @@
1
+ import type { Shading } from '../definition/types';
2
+ /** Every built-in Style: its display label and the shading its Definitions use (one shading per Style). */
3
+ declare const STYLES: {
4
+ readonly 'low-poly': {
5
+ readonly label: "Low-poly";
6
+ readonly shading: "flat";
7
+ };
8
+ readonly stylized: {
9
+ readonly label: "Stylized";
10
+ readonly shading: "toon";
11
+ };
12
+ readonly realistic: {
13
+ readonly label: "Realistic";
14
+ readonly shading: "standard";
15
+ };
16
+ };
17
+ /** Name of a built-in Style, e.g. 'low-poly'. */
18
+ export type StyleName = keyof typeof STYLES;
19
+ /** Names of all built-in Styles. */
20
+ export declare const STYLE_NAMES: StyleName[];
21
+ /** Display label of a built-in Style, e.g. 'Low-poly'. */
22
+ export declare function styleLabel(name: StyleName): string;
23
+ /** The shading a built-in Style draws with. */
24
+ export declare function styleShading(name: StyleName): Shading;
25
+ /** The built-in Style a Definition was drawn in, recognised by its `materials.shading`. */
26
+ export declare function styleOfShading(shading: Shading): StyleName;
27
+ export {};
28
+ //# sourceMappingURL=names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"names.d.ts","sourceRoot":"","sources":["../../src/styles/names.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,2GAA2G;AAC3G,QAAA,MAAM,MAAM;;;;;;;;;;;;;CAI4D,CAAC;AAEzE,iDAAiD;AACjD,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,MAAM,CAAC;AAE5C,oCAAoC;AACpC,eAAO,MAAM,WAAW,EAA0B,SAAS,EAAE,CAAC;AAE9D,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAElD;AAED,+CAA+C;AAC/C,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAErD;AAED,2FAA2F;AAC3F,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,CAE1D"}
@@ -1,12 +1,7 @@
1
1
  import { type TreeDefinition } from '../../definition/types';
2
2
  import type { TreeStyle } from '../types';
3
- /** The realistic Style's texture files, as relative URLs (resolved against the texture base path). */
4
- export declare const TEXTURES: {
5
- readonly bark: "realistic/bark.png";
6
- readonly barkNormal: "realistic/bark-normal.png";
7
- readonly leaf: "realistic/leaf.png";
8
- readonly needles: "realistic/needles.png";
9
- };
3
+ import { BARK_TEXTURES, LEAF_TEXTURES, TEXTURES } from './textures';
4
+ export { BARK_TEXTURES, LEAF_TEXTURES, TEXTURES };
10
5
  /**
11
6
  * Realistic broadleaf: a tall, slightly leaning trunk with three branching levels and many
12
7
  * leaf-spray cards. Deciduous Season Profile: fresh green in spring, autumn colours, bare in winter.
@@ -14,7 +9,7 @@ export declare const TEXTURES: {
14
9
  export declare const broadleaf: TreeDefinition;
15
10
  /**
16
11
  * Realistic conifer: a straight trunk with dense, drooping whorls that shrink towards the top
17
- * (the conifer Form), covered in needle-spray cards. Evergreen Season Profile.
12
+ * (a cone Crown Shape), covered in needle-spray cards. Evergreen Season Profile.
18
13
  */
19
14
  export declare const conifer: TreeDefinition;
20
15
  /** The realistic Style. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/styles/realistic/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAErF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,sGAAsG;AACtG,eAAO,MAAM,QAAQ;;;;;CAKX,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,cAoBvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,cAmBrB,CAAC;AAEF,2BAA2B;AAC3B,QAAA,MAAM,SAAS,EAAE,SAAqD,CAAC;AACvE,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/styles/realistic/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,cAmBvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,cAoBrB,CAAC;AAEF,2BAA2B;AAC3B,QAAA,MAAM,SAAS,EAAE,SAA+H,CAAC;AACjJ,eAAe,SAAS,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { BarkType, LeafType } from '../../definition/types';
2
+ /**
3
+ * The realistic Style's texture files, as relative URLs (resolved against the texture base path).
4
+ * All made by scripts/generate-textures.mjs. `bark`/`barkNormal` are the furrowed pair, `leaf` the
5
+ * broad card and `needles` the needle card (the generic broadleaf / conifer use these).
6
+ */
7
+ export declare const TEXTURES: {
8
+ readonly bark: "realistic/bark.png";
9
+ readonly barkNormal: "realistic/bark-normal.png";
10
+ readonly leaf: "realistic/leaf.png";
11
+ readonly needles: "realistic/needles.png";
12
+ };
13
+ /** The alpha-cut leaf card texture for each Leaf Type. */
14
+ export declare const LEAF_TEXTURES: Readonly<Record<LeafType, string>>;
15
+ /** The colour + normal map pair for each Bark Type. */
16
+ export declare const BARK_TEXTURES: Readonly<Record<BarkType, {
17
+ map: string;
18
+ normalMap: string;
19
+ }>>;
20
+ //# sourceMappingURL=textures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textures.d.ts","sourceRoot":"","sources":["../../../src/styles/realistic/textures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,QAAQ;;;;;CAKX,CAAC;AAEX,0DAA0D;AAC1D,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAO5D,CAAC;AAEF,uDAAuD;AACvD,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAMxF,CAAC"}
@@ -1,21 +1,14 @@
1
- import "../types-BZjHhNz7.js";
1
+ import { x as coneCurve } from "../names-BE9he6CS.js";
2
2
  import { t as SEASON_PROFILES } from "../profiles-BAiyeFlh.js";
3
+ import { i as TEXTURES, n as BARK_TEXTURES, r as LEAF_TEXTURES, t as applyStyle } from "../apply-Cio2t7CZ.js";
3
4
  // src/styles/realistic/index.ts
4
- /** The realistic Style's texture files, as relative URLs (resolved against the texture base path). */
5
- var TEXTURES = {
6
- bark: "realistic/bark.png",
7
- barkNormal: "realistic/bark-normal.png",
8
- leaf: "realistic/leaf.png",
9
- needles: "realistic/needles.png"
10
- };
11
5
  /**
12
6
  * Realistic broadleaf: a tall, slightly leaning trunk with three branching levels and many
13
7
  * leaf-spray cards. Deciduous Season Profile: fresh green in spring, autumn colours, bare in winter.
14
8
  */
15
9
  var broadleaf = {
16
- schemaVersion: 2,
10
+ schemaVersion: 3,
17
11
  name: "Realistic broadleaf",
18
- form: "broadleaf",
19
12
  trunk: {
20
13
  length: 5,
21
14
  radius: .28,
@@ -23,7 +16,8 @@ var broadleaf = {
23
16
  sides: 12,
24
17
  sections: 10,
25
18
  lengthVariation: .15,
26
- bend: .1
19
+ bend: .1,
20
+ flareSections: 3
27
21
  },
28
22
  branches: [
29
23
  {
@@ -113,12 +107,11 @@ var broadleaf = {
113
107
  };
114
108
  /**
115
109
  * Realistic conifer: a straight trunk with dense, drooping whorls that shrink towards the top
116
- * (the conifer Form), covered in needle-spray cards. Evergreen Season Profile.
110
+ * (a cone Crown Shape), covered in needle-spray cards. Evergreen Season Profile.
117
111
  */
118
112
  var conifer = {
119
- schemaVersion: 2,
113
+ schemaVersion: 3,
120
114
  name: "Realistic conifer",
121
- form: "conifer",
122
115
  trunk: {
123
116
  length: 7,
124
117
  radius: .24,
@@ -126,7 +119,8 @@ var conifer = {
126
119
  sides: 10,
127
120
  sections: 10,
128
121
  lengthVariation: .12,
129
- bend: .03
122
+ bend: .03,
123
+ flareSections: 3
130
124
  },
131
125
  branches: [{
132
126
  count: 34,
@@ -142,7 +136,8 @@ var conifer = {
142
136
  sides: 5,
143
137
  sections: 4,
144
138
  bend: .08,
145
- gravity: .12
139
+ gravity: .12,
140
+ lengthProfile: coneCurve(.12)
146
141
  }, {
147
142
  count: 6,
148
143
  start: .15,
@@ -199,8 +194,9 @@ var conifer = {
199
194
  var realistic = {
200
195
  name: "realistic",
201
196
  broadleaf,
202
- conifer
197
+ conifer,
198
+ apply: (source, overrides) => applyStyle("realistic", source, overrides)
203
199
  };
204
- export { TEXTURES, broadleaf, conifer, realistic as default };
200
+ export { BARK_TEXTURES, LEAF_TEXTURES, TEXTURES, broadleaf, conifer, realistic as default };
205
201
 
206
202
  //# sourceMappingURL=realistic.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"realistic.js","names":[],"sources":["../../src/styles/realistic/index.ts"],"sourcesContent":["// @casmo/tree.js/styles/realistic: smooth PBR shading, textured bark and alpha-cut leaf cards.\n// Pure data (no library code beyond shared constants), so it stays a tiny chunk fetched only when imported.\n// The textures are separate files (dist/textures/realistic/*.png, made by scripts/generate-textures.mjs),\n// referenced by relative URLs that resolve against the texture base path (`setTextureOptions`,\n// or `createTree(definition, { textures: { basePath } })`), so an app can host them on its own CDN.\nimport { CURRENT_SCHEMA_VERSION, type TreeDefinition } from '../../definition/types';\nimport { SEASON_PROFILES } from '../../season/profiles';\nimport type { TreeStyle } from '../types';\n\n/** The realistic Style's texture files, as relative URLs (resolved against the texture base path). */\nexport const TEXTURES = {\n bark: 'realistic/bark.png',\n barkNormal: 'realistic/bark-normal.png',\n leaf: 'realistic/leaf.png',\n needles: 'realistic/needles.png',\n} as const;\n\n/**\n * Realistic broadleaf: a tall, slightly leaning trunk with three branching levels and many\n * leaf-spray cards. Deciduous Season Profile: fresh green in spring, autumn colours, bare in winter.\n */\nexport const broadleaf: TreeDefinition = {\n schemaVersion: CURRENT_SCHEMA_VERSION,\n name: 'Realistic broadleaf',\n form: 'broadleaf',\n trunk: { length: 5, radius: 0.28, taper: 0.35, sides: 12, sections: 10, lengthVariation: 0.15, bend: 0.1 },\n branches: [\n { count: 8, start: 0.4, end: 0.95, angle: 48, angleVariation: 0.2, spiral: 137.5, length: 0.5, lengthVariation: 0.2, radius: 0.5, taper: 0.5, sides: 8, sections: 6, bend: 0.15, gravity: 0.05 },\n { count: 5, start: 0.25, end: 1, angle: 40, angleVariation: 0.25, spiral: 120, length: 0.5, lengthVariation: 0.25, radius: 0.55, taper: 0.5, sides: 5, sections: 4, bend: 0.15, gravity: 0.1 },\n { count: 3, start: 0.3, end: 1, angle: 35, angleVariation: 0.3, spiral: 140, length: 0.5, lengthVariation: 0.3, radius: 0.6, taper: 0.5, sides: 3, sections: 2, bend: 0.1, gravity: 0.15 },\n ],\n leaves: { count: 6, shape: 'card', size: 0.7, sizeVariation: 0.25, start: 0.2, angle: 45 },\n materials: {\n shading: 'standard',\n bark: { color: '#c9bba8', roughness: 0.95, map: TEXTURES.bark, normalMap: TEXTURES.barkNormal },\n leaf: { roughness: 0.65, map: TEXTURES.leaf, alphaTest: 0.4 },\n },\n season: SEASON_PROFILES.deciduous,\n wind: { trunk: 0.15, branches: 0.45, leaves: 0.8, frequency: 1 },\n variation: { color: 0.1, growth: 0.1, season: 0.05 },\n sculpts: [],\n};\n\n/**\n * Realistic conifer: a straight trunk with dense, drooping whorls that shrink towards the top\n * (the conifer Form), covered in needle-spray cards. Evergreen Season Profile.\n */\nexport const conifer: TreeDefinition = {\n schemaVersion: CURRENT_SCHEMA_VERSION,\n name: 'Realistic conifer',\n form: 'conifer',\n trunk: { length: 7, radius: 0.24, taper: 0.08, sides: 10, sections: 10, lengthVariation: 0.12, bend: 0.03 },\n branches: [\n { count: 34, start: 0.12, end: 0.97, angle: 88, angleVariation: 0.1, spiral: 137.5, length: 0.38, lengthVariation: 0.15, radius: 0.22, taper: 0.25, sides: 5, sections: 4, bend: 0.08, gravity: 0.12 },\n { count: 6, start: 0.15, end: 1, angle: 55, angleVariation: 0.2, spiral: 180, length: 0.45, lengthVariation: 0.2, radius: 0.5, taper: 0.4, sides: 3, sections: 2, bend: 0.05, gravity: 0.1 },\n ],\n leaves: { count: 8, shape: 'card', size: 0.8, sizeVariation: 0.2, start: 0, angle: 35 },\n materials: {\n shading: 'standard',\n bark: { color: '#b0a090', roughness: 0.95, map: TEXTURES.bark, normalMap: TEXTURES.barkNormal },\n leaf: { roughness: 0.7, map: TEXTURES.needles, alphaTest: 0.4 },\n },\n season: SEASON_PROFILES.evergreen,\n wind: { trunk: 0.08, branches: 0.3, leaves: 0.4, frequency: 0.8 },\n variation: { color: 0.08, growth: 0.1, season: 0.05 },\n sculpts: [],\n};\n\n/** The realistic Style. */\nconst realistic: TreeStyle = { name: 'realistic', broadleaf, conifer };\nexport default realistic;\n"],"mappings":";;;;AAUA,IAAa,WAAW;CACtB,MAAM;CACN,YAAY;CACZ,MAAM;CACN,SAAS;AACX;;;;;AAMA,IAAa,YAA4B;CACvC,eAAA;CACA,MAAM;CACN,MAAM;CACN,OAAO;EAAE,QAAQ;EAAG,QAAQ;EAAM,OAAO;EAAM,OAAO;EAAI,UAAU;EAAI,iBAAiB;EAAM,MAAM;CAAI;CACzG,UAAU;EACR;GAAE,OAAO;GAAG,OAAO;GAAK,KAAK;GAAM,OAAO;GAAI,gBAAgB;GAAK,QAAQ;GAAO,QAAQ;GAAK,iBAAiB;GAAK,QAAQ;GAAK,OAAO;GAAK,OAAO;GAAG,UAAU;GAAG,MAAM;GAAM,SAAS;EAAK;EAC/L;GAAE,OAAO;GAAG,OAAO;GAAM,KAAK;GAAG,OAAO;GAAI,gBAAgB;GAAM,QAAQ;GAAK,QAAQ;GAAK,iBAAiB;GAAM,QAAQ;GAAM,OAAO;GAAK,OAAO;GAAG,UAAU;GAAG,MAAM;GAAM,SAAS;EAAI;EAC7L;GAAE,OAAO;GAAG,OAAO;GAAK,KAAK;GAAG,OAAO;GAAI,gBAAgB;GAAK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MAAM;GAAE,OAAO;GAAW,WAAW;GAAM,KAAK,SAAS;GAAM,WAAW,SAAS;EAAW;EAC9F,MAAM;GAAE,WAAW;GAAK,KAAK,SAAS;GAAS,WAAW;EAAI;CAChE;CACA,QAAQ,gBAAgB;CACxB,MAAM;EAAE,OAAO;EAAM,UAAU;EAAK,QAAQ;EAAK,WAAW;CAAI;CAChE,WAAW;EAAE,OAAO;EAAM,QAAQ;EAAK,QAAQ;CAAK;CACpD,SAAS,CAAC;AACZ;;AAGA,IAAM,YAAuB;CAAE,MAAM;CAAa;CAAW;AAAQ"}
1
+ {"version":3,"file":"realistic.js","names":[],"sources":["../../src/styles/realistic/index.ts"],"sourcesContent":["// @casmo/tree.js/styles/realistic: smooth PBR shading, textured bark and alpha-cut leaf cards.\n// Pure data plus `apply` (shared with the other Styles), fetched only when imported.\n// The textures are separate files (dist/textures/realistic/*.png, made by scripts/generate-textures.mjs),\n// referenced by relative URLs that resolve against the texture base path (`setTextureOptions`,\n// or `createTree(definition, { textures: { basePath } })`), so an app can host them on its own CDN.\nimport { coneCurve } from '../../definition/crown-shape';\nimport { CURRENT_SCHEMA_VERSION, type TreeDefinition } from '../../definition/types';\nimport { SEASON_PROFILES } from '../../season/profiles';\nimport { applyStyle } from '../apply';\nimport type { TreeStyle } from '../types';\nimport { BARK_TEXTURES, LEAF_TEXTURES, TEXTURES } from './textures';\n\nexport { BARK_TEXTURES, LEAF_TEXTURES, TEXTURES };\n\n/**\n * Realistic broadleaf: a tall, slightly leaning trunk with three branching levels and many\n * leaf-spray cards. Deciduous Season Profile: fresh green in spring, autumn colours, bare in winter.\n */\nexport const broadleaf: TreeDefinition = {\n schemaVersion: CURRENT_SCHEMA_VERSION,\n name: 'Realistic broadleaf',\n trunk: { length: 5, radius: 0.28, taper: 0.35, sides: 12, sections: 10, lengthVariation: 0.15, bend: 0.1, flareSections: 3 },\n branches: [\n { count: 8, start: 0.4, end: 0.95, angle: 48, angleVariation: 0.2, spiral: 137.5, length: 0.5, lengthVariation: 0.2, radius: 0.5, taper: 0.5, sides: 8, sections: 6, bend: 0.15, gravity: 0.05 },\n { count: 5, start: 0.25, end: 1, angle: 40, angleVariation: 0.25, spiral: 120, length: 0.5, lengthVariation: 0.25, radius: 0.55, taper: 0.5, sides: 5, sections: 4, bend: 0.15, gravity: 0.1 },\n { count: 3, start: 0.3, end: 1, angle: 35, angleVariation: 0.3, spiral: 140, length: 0.5, lengthVariation: 0.3, radius: 0.6, taper: 0.5, sides: 3, sections: 2, bend: 0.1, gravity: 0.15 },\n ],\n leaves: { count: 6, shape: 'card', size: 0.7, sizeVariation: 0.25, start: 0.2, angle: 45 },\n materials: {\n shading: 'standard',\n bark: { color: '#c9bba8', roughness: 0.95, map: TEXTURES.bark, normalMap: TEXTURES.barkNormal },\n leaf: { roughness: 0.65, map: TEXTURES.leaf, alphaTest: 0.4 },\n },\n season: SEASON_PROFILES.deciduous,\n wind: { trunk: 0.15, branches: 0.45, leaves: 0.8, frequency: 1 },\n variation: { color: 0.1, growth: 0.1, season: 0.05 },\n sculpts: [],\n};\n\n/**\n * Realistic conifer: a straight trunk with dense, drooping whorls that shrink towards the top\n * (a cone Crown Shape), covered in needle-spray cards. Evergreen Season Profile.\n */\nexport const conifer: TreeDefinition = {\n schemaVersion: CURRENT_SCHEMA_VERSION,\n name: 'Realistic conifer',\n trunk: { length: 7, radius: 0.24, taper: 0.08, sides: 10, sections: 10, lengthVariation: 0.12, bend: 0.03, flareSections: 3 },\n branches: [\n { count: 34, start: 0.12, end: 0.97, angle: 88, angleVariation: 0.1, spiral: 137.5, length: 0.38, lengthVariation: 0.15, radius: 0.22, taper: 0.25, sides: 5, sections: 4, bend: 0.08, gravity: 0.12,\n // Crown Shape: a cone, full length at the lowest whorl, a tenth of it at the top.\n lengthProfile: coneCurve(0.12) },\n { count: 6, start: 0.15, end: 1, angle: 55, angleVariation: 0.2, spiral: 180, length: 0.45, lengthVariation: 0.2, radius: 0.5, taper: 0.4, sides: 3, sections: 2, bend: 0.05, gravity: 0.1 },\n ],\n leaves: { count: 8, shape: 'card', size: 0.8, sizeVariation: 0.2, start: 0, angle: 35 },\n materials: {\n shading: 'standard',\n bark: { color: '#b0a090', roughness: 0.95, map: TEXTURES.bark, normalMap: TEXTURES.barkNormal },\n leaf: { roughness: 0.7, map: TEXTURES.needles, alphaTest: 0.4 },\n },\n season: SEASON_PROFILES.evergreen,\n wind: { trunk: 0.08, branches: 0.3, leaves: 0.4, frequency: 0.8 },\n variation: { color: 0.08, growth: 0.1, season: 0.05 },\n sculpts: [],\n};\n\n/** The realistic Style. */\nconst realistic: TreeStyle = { name: 'realistic', broadleaf, conifer, apply: (source, overrides) => applyStyle('realistic', source, overrides) };\nexport default realistic;\n"],"mappings":";;;;;;;;AAkBA,IAAa,YAA4B;CACvC,eAAA;CACA,MAAM;CACN,OAAO;EAAE,QAAQ;EAAG,QAAQ;EAAM,OAAO;EAAM,OAAO;EAAI,UAAU;EAAI,iBAAiB;EAAM,MAAM;EAAK,eAAe;CAAE;CAC3H,UAAU;EACR;GAAE,OAAO;GAAG,OAAO;GAAK,KAAK;GAAM,OAAO;GAAI,gBAAgB;GAAK,QAAQ;GAAO,QAAQ;GAAK,iBAAiB;GAAK,QAAQ;GAAK,OAAO;GAAK,OAAO;GAAG,UAAU;GAAG,MAAM;GAAM,SAAS;EAAK;EAC/L;GAAE,OAAO;GAAG,OAAO;GAAM,KAAK;GAAG,OAAO;GAAI,gBAAgB;GAAM,QAAQ;GAAK,QAAQ;GAAK,iBAAiB;GAAM,QAAQ;GAAM,OAAO;GAAK,OAAO;GAAG,UAAU;GAAG,MAAM;GAAM,SAAS;EAAI;EAC7L;GAAE,OAAO;GAAG,OAAO;GAAK,KAAK;GAAG,OAAO;GAAI,gBAAgB;GAAK,QAAQ;GAAK,QAAQ;GAAK,iBAAiB;GAAK,QAAQ;GAAK,OAAO;GAAK,OAAO;GAAG,UAAU;GAAG,MAAM;GAAK,SAAS;EAAK;CAC3L;CACA,QAAQ;EAAE,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;GAAS,WAAW;EAAI;CAChE;CACA,QAAQ,gBAAgB;CACxB,MAAM;EAAE,OAAO;EAAM,UAAU;EAAK,QAAQ;EAAK,WAAW;CAAI;CAChE,WAAW;EAAE,OAAO;EAAM,QAAQ;EAAK,QAAQ;CAAK;CACpD,SAAS,CAAC;AACZ;;AAGA,IAAM,YAAuB;CAAE,MAAM;CAAa;CAAW;CAAS,QAAQ,QAAQ,cAAc,WAAW,aAAa,QAAQ,SAAS;AAAE"}
@@ -1,17 +1,6 @@
1
+ import { type StyleName } from './names';
1
2
  import type { TreeStyle } from './types';
2
- /**
3
- * The built-in Styles, each a lazily loaded chunk (`@casmo/tree.js/styles/<name>`).
4
- * To add a Style: one line here (plus its vite entry and package.json export).
5
- */
6
- export declare const STYLE_LOADERS: {
7
- 'low-poly': () => Promise<typeof import("./low-poly")>;
8
- stylized: () => Promise<typeof import("./stylized")>;
9
- realistic: () => Promise<typeof import("./realistic")>;
10
- };
11
- /** Name of a built-in Style, e.g. 'low-poly'. */
12
- export type StyleName = keyof typeof STYLE_LOADERS;
13
- /** Names of all built-in Styles. */
14
- export declare const STYLE_NAMES: StyleName[];
3
+ export { STYLE_NAMES, styleLabel, styleOfShading, styleShading, type StyleName } from './names';
15
4
  /** Downloads a built-in Style (dynamic import) and resolves to it. Rejects for an unknown name. */
16
5
  export declare function loadStyle(name: StyleName): Promise<TreeStyle>;
17
6
  //# sourceMappingURL=registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/styles/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;CAIuC,CAAC;AAElE,iDAAiD;AACjD,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,aAAa,CAAC;AAEnD,oCAAoC;AACpC,eAAO,MAAM,WAAW,EAAiC,SAAS,EAAE,CAAC;AAErE,mGAAmG;AACnG,wBAAsB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAInE"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/styles/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAahG,mGAAmG;AACnG,wBAAsB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAInE"}
@@ -7,7 +7,7 @@ import type { TreeStyle } from '../types';
7
7
  export declare const broadleaf: TreeDefinition;
8
8
  /**
9
9
  * Stylized conifer: a straight trunk with soft, upturned whorls that shrink towards the top
10
- * (the conifer Form), each carrying a few rounded clumps, so the tree reads as a stack of puffs.
10
+ * (a cone Crown Shape), each carrying a few rounded clumps, so the tree reads as a stack of puffs.
11
11
  * Evergreen: it only darkens a little in winter.
12
12
  */
13
13
  export declare const conifer: TreeDefinition;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/styles/stylized/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwD,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEnH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AA4C1C;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,cAmBvB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,cAkBrB,CAAC;AAEF,0BAA0B;AAC1B,QAAA,MAAM,QAAQ,EAAE,SAAoD,CAAC;AACrE,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/styles/stylized/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwD,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGnH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AA4C1C;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,cAkBvB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,cAmBrB,CAAC;AAEF,0BAA0B;AAC1B,QAAA,MAAM,QAAQ,EAAE,SAA6H,CAAC;AAC9I,eAAe,QAAQ,CAAC"}
@@ -1,5 +1,6 @@
1
- import "../types-BZjHhNz7.js";
1
+ import { x as coneCurve } from "../names-BE9he6CS.js";
2
2
  import { t as SEASON_PROFILES } from "../profiles-BAiyeFlh.js";
3
+ import { t as applyStyle } from "../apply-Cio2t7CZ.js";
3
4
  // src/styles/stylized/index.ts
4
5
  /**
5
6
  * Deciduous with blossom: bright, saturated colours for the toon look. Pink blossom covers
@@ -106,9 +107,8 @@ var evergreen = {
106
107
  * Flowers pink in early spring, then follows the deciduous year.
107
108
  */
108
109
  var broadleaf = {
109
- schemaVersion: 2,
110
+ schemaVersion: 3,
110
111
  name: "Stylized broadleaf",
111
- form: "broadleaf",
112
112
  trunk: {
113
113
  length: 3.2,
114
114
  radius: .24,
@@ -116,7 +116,8 @@ var broadleaf = {
116
116
  sides: 10,
117
117
  sections: 8,
118
118
  lengthVariation: .15,
119
- bend: .25
119
+ bend: .25,
120
+ flareSections: 3
120
121
  },
121
122
  branches: [{
122
123
  count: 6,
@@ -187,13 +188,12 @@ var broadleaf = {
187
188
  };
188
189
  /**
189
190
  * Stylized conifer: a straight trunk with soft, upturned whorls that shrink towards the top
190
- * (the conifer Form), each carrying a few rounded clumps, so the tree reads as a stack of puffs.
191
+ * (a cone Crown Shape), each carrying a few rounded clumps, so the tree reads as a stack of puffs.
191
192
  * Evergreen: it only darkens a little in winter.
192
193
  */
193
194
  var conifer = {
194
- schemaVersion: 2,
195
+ schemaVersion: 3,
195
196
  name: "Stylized conifer",
196
- form: "conifer",
197
197
  trunk: {
198
198
  length: 5,
199
199
  radius: .2,
@@ -201,7 +201,8 @@ var conifer = {
201
201
  sides: 8,
202
202
  sections: 6,
203
203
  lengthVariation: .15,
204
- bend: .05
204
+ bend: .05,
205
+ flareSections: 3
205
206
  },
206
207
  branches: [{
207
208
  count: 18,
@@ -217,7 +218,8 @@ var conifer = {
217
218
  sides: 5,
218
219
  sections: 3,
219
220
  bend: .1,
220
- gravity: .05
221
+ gravity: .05,
222
+ lengthProfile: coneCurve(.15)
221
223
  }],
222
224
  leaves: {
223
225
  count: 4,
@@ -259,7 +261,8 @@ var conifer = {
259
261
  var stylized = {
260
262
  name: "stylized",
261
263
  broadleaf,
262
- conifer
264
+ conifer,
265
+ apply: (source, overrides) => applyStyle("stylized", source, overrides)
263
266
  };
264
267
  export { broadleaf, conifer, stylized as default };
265
268
 
@@ -1 +1 @@
1
- {"version":3,"file":"stylized.js","names":[],"sources":["../../src/styles/stylized/index.ts"],"sourcesContent":["// @casmo/tree.js/styles/stylized: soft toon shading, rounded leaf clumps, blossom in early spring, no image files.\n// Pure data (no library code beyond shared constants), so it stays a tiny chunk fetched only when imported.\nimport { CURRENT_SCHEMA_VERSION, type SeasonProfileDefinition, type TreeDefinition } from '../../definition/types';\nimport { SEASON_PROFILES } from '../../season/profiles';\nimport type { TreeStyle } from '../types';\n\n/**\n * Deciduous with blossom: bright, saturated colours for the toon look. Pink blossom covers\n * most of the crown in early spring (Season 0 .. ~0.12, opening in the last days of winter),\n * then the leaves take over: fresh green, summer green, orange and red, bare in winter.\n * Drop the blossom with `extendDefinition(broadleaf, { season: { blossom: [{ t: 0, value: 0 }] } })`.\n */\nconst blossoming: SeasonProfileDefinition = {\n leafColor: [\n { t: 0, value: '#a5d65a' },\n { t: 0.2, value: '#55a83c' },\n { t: 0.5, value: '#55a83c' },\n { t: 0.58, value: '#f0a530' },\n { t: 0.68, value: '#d9502e' },\n { t: 0.97, value: '#d9502e' },\n { t: 1, value: '#a5d65a' },\n ],\n leafCoverage: SEASON_PROFILES.deciduous.leafCoverage,\n blossom: [\n { t: 0, value: 0.75 },\n { t: 0.08, value: 0.75 },\n { t: 0.15, value: 0 },\n { t: 0.95, value: 0 },\n { t: 1, value: 0.75 },\n ],\n blossomColor: '#ffb3d1',\n};\n\n/** Evergreen in toon colours: full all year, a little darker in winter. */\nconst evergreen: SeasonProfileDefinition = {\n leafColor: [\n { t: 0, value: '#4f9a4a' },\n { t: 0.25, value: '#3c8a45' },\n { t: 0.55, value: '#3c8a45' },\n { t: 0.75, value: '#2e6b40' },\n { t: 0.92, value: '#2e6b40' },\n { t: 1, value: '#4f9a4a' },\n ],\n leafCoverage: [{ t: 0, value: 1 }],\n blossom: [{ t: 0, value: 0 }],\n blossomColor: '#ffb3d1',\n};\n\n/**\n * Stylized broadleaf: a curvy trunk with a round crown of big, soft foliage clumps.\n * Flowers pink in early spring, then follows the deciduous year.\n */\nexport const broadleaf: TreeDefinition = {\n schemaVersion: CURRENT_SCHEMA_VERSION,\n name: 'Stylized broadleaf',\n form: 'broadleaf',\n trunk: { length: 3.2, radius: 0.24, taper: 0.55, sides: 10, sections: 8, lengthVariation: 0.15, bend: 0.25 },\n branches: [\n { count: 6, start: 0.45, end: 0.9, angle: 48, angleVariation: 0.2, spiral: 137.5, length: 0.5, lengthVariation: 0.2, radius: 0.55, taper: 0.5, sides: 8, sections: 5, bend: 0.25, gravity: 0.05 },\n { count: 3, start: 0.4, end: 1, angle: 40, angleVariation: 0.25, spiral: 120, length: 0.5, lengthVariation: 0.25, radius: 0.6, taper: 0.45, sides: 6, sections: 3, bend: 0.2, gravity: 0 },\n ],\n leaves: { count: 2, shape: 'puff', size: 1.1, sizeVariation: 0.3, start: 0.6, angle: 30 },\n materials: {\n shading: 'toon',\n bark: { color: '#8a5a3b', roughness: 1, map: null, normalMap: null },\n leaf: { roughness: 1, map: null, alphaTest: 0.5 },\n },\n season: blossoming,\n wind: { trunk: 0.15, branches: 0.45, leaves: 0.6, frequency: 1 },\n variation: { color: 0.1, growth: 0.1, season: 0.05 },\n sculpts: [],\n};\n\n/**\n * Stylized conifer: a straight trunk with soft, upturned whorls that shrink towards the top\n * (the conifer Form), each carrying a few rounded clumps, so the tree reads as a stack of puffs.\n * Evergreen: it only darkens a little in winter.\n */\nexport const conifer: TreeDefinition = {\n schemaVersion: CURRENT_SCHEMA_VERSION,\n name: 'Stylized conifer',\n form: 'conifer',\n trunk: { length: 5, radius: 0.2, taper: 0.2, sides: 8, sections: 6, lengthVariation: 0.15, bend: 0.05 },\n branches: [\n { count: 18, start: 0.15, end: 0.97, angle: 85, angleVariation: 0.1, spiral: 137.5, length: 0.5, lengthVariation: 0.1, radius: 0.4, taper: 0.35, sides: 5, sections: 3, bend: 0.1, gravity: 0.05 },\n ],\n leaves: { count: 4, shape: 'puff', size: 0.6, sizeVariation: 0.2, start: 0.1, angle: 20 },\n materials: {\n shading: 'toon',\n bark: { color: '#6e4a35', roughness: 1, map: null, normalMap: null },\n leaf: { roughness: 1, map: null, alphaTest: 0.5 },\n },\n season: evergreen,\n wind: { trunk: 0.1, branches: 0.3, leaves: 0.4, frequency: 0.8 },\n variation: { color: 0.08, growth: 0.1, season: 0.05 },\n sculpts: [],\n};\n\n/** The stylized Style. */\nconst stylized: TreeStyle = { name: 'stylized', broadleaf, conifer };\nexport default stylized;\n"],"mappings":";;;;;;;;;AAYA,IAAM,aAAsC;CAC1C,WAAW;EACT;GAAE,GAAG;GAAG,OAAO;EAAU;EACzB;GAAE,GAAG;GAAK,OAAO;EAAU;EAC3B;GAAE,GAAG;GAAK,OAAO;EAAU;EAC3B;GAAE,GAAG;GAAM,OAAO;EAAU;EAC5B;GAAE,GAAG;GAAM,OAAO;EAAU;EAC5B;GAAE,GAAG;GAAM,OAAO;EAAU;EAC5B;GAAE,GAAG;GAAG,OAAO;EAAU;CAC3B;CACA,cAAc,gBAAgB,UAAU;CACxC,SAAS;EACP;GAAE,GAAG;GAAG,OAAO;EAAK;EACpB;GA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AAE,OAAO;GAAW,WAAW;GAAG,KAAK;GAAM,WAAW;EAAK;EACnE,MAAM;GAAE,WAAW;GAAG,KAAK;GAAM,WAAW;EAAI;CAClD;CACA,QAAQ;CACR,MAAM;EAAE,OAAO;EAAM,UAAU;EAAM,QAAQ;EAAK,WAAW;CAAE;CAC/D,WAAW;EAAE,OAAO;EAAK,QAAQ;EAAK,QAAQ;CAAK;CACnD,SAAS,CAAC;AACZ;;;;;;AAOA,IAAa,UAA0B;CACrC,eAAA;CACA,MAAM;CACN,MAAM;CACN,OAAO;EAAE,QAAQ;EAAG,QAAQ;EAAK,OAAO;EAAK,OAAO;EAAG,UAAU;EAAG,iBAAiB;EAAM,MAAM;CAAK;CACtG,UAAU,CACR;EAAE,OAAO;EAAI,OAAO;EAAM,KAAK;EAAM,OAAO;EAAI,gBAAgB;EAAK,QAAQ;EAAO,QAAQ;EAAK,iBAAiB;EAAK,QAAQ;EAAK,OAAO;EAAM,OAAO;EAAG,UAAU;EAAG,MAAM;EAAK,SAAS;CAAK,CACnM;CACA,QAAQ;EAAE,OAAO;EAAG,OAAO;EAAQ,MAAM;EAAK,eAAe;EAAK,OAAO;EAAK,OAAO;CAAG;CACxF,WAAW;EACT,SAAS;EACT,MAAM;GAAE,OAAO;GAAW,WAAW;GAAG,KAAK;GAAM,WAAW;EAAK;EACnE,MAAM;GAAE,WAAW;GAAG,KAAK;GAAM,WAAW;EAAI;CAClD;CACA,QAAQ;CACR,MAAM;EAAE,OAAO;EAAK,UAAU;EAAK,QAAQ;EAAK,WAAW;CAAI;CAC/D,WAAW;EAAE,OAAO;EAAM,QAAQ;EAAK,QAAQ;CAAK;CACpD,SAAS,CAAC;AACZ;;AAGA,IAAM,WAAsB;CAAE,MAAM;CAAY;CAAW;AAAQ"}
1
+ {"version":3,"file":"stylized.js","names":[],"sources":["../../src/styles/stylized/index.ts"],"sourcesContent":["// @casmo/tree.js/styles/stylized: soft toon shading, rounded leaf clumps, blossom in early spring, no image files.\n// Pure data plus `apply` (shared with the other Styles), fetched only when imported.\nimport { coneCurve } from '../../definition/crown-shape';\nimport { CURRENT_SCHEMA_VERSION, type SeasonProfileDefinition, type TreeDefinition } from '../../definition/types';\nimport { SEASON_PROFILES } from '../../season/profiles';\nimport { applyStyle } from '../apply';\nimport type { TreeStyle } from '../types';\n\n/**\n * Deciduous with blossom: bright, saturated colours for the toon look. Pink blossom covers\n * most of the crown in early spring (Season 0 .. ~0.12, opening in the last days of winter),\n * then the leaves take over: fresh green, summer green, orange and red, bare in winter.\n * Drop the blossom with `extendDefinition(broadleaf, { season: { blossom: [{ t: 0, value: 0 }] } })`.\n */\nconst blossoming: SeasonProfileDefinition = {\n leafColor: [\n { t: 0, value: '#a5d65a' },\n { t: 0.2, value: '#55a83c' },\n { t: 0.5, value: '#55a83c' },\n { t: 0.58, value: '#f0a530' },\n { t: 0.68, value: '#d9502e' },\n { t: 0.97, value: '#d9502e' },\n { t: 1, value: '#a5d65a' },\n ],\n leafCoverage: SEASON_PROFILES.deciduous.leafCoverage,\n blossom: [\n { t: 0, value: 0.75 },\n { t: 0.08, value: 0.75 },\n { t: 0.15, value: 0 },\n { t: 0.95, value: 0 },\n { t: 1, value: 0.75 },\n ],\n blossomColor: '#ffb3d1',\n};\n\n/** Evergreen in toon colours: full all year, a little darker in winter. */\nconst evergreen: SeasonProfileDefinition = {\n leafColor: [\n { t: 0, value: '#4f9a4a' },\n { t: 0.25, value: '#3c8a45' },\n { t: 0.55, value: '#3c8a45' },\n { t: 0.75, value: '#2e6b40' },\n { t: 0.92, value: '#2e6b40' },\n { t: 1, value: '#4f9a4a' },\n ],\n leafCoverage: [{ t: 0, value: 1 }],\n blossom: [{ t: 0, value: 0 }],\n blossomColor: '#ffb3d1',\n};\n\n/**\n * Stylized broadleaf: a curvy trunk with a round crown of big, soft foliage clumps.\n * Flowers pink in early spring, then follows the deciduous year.\n */\nexport const broadleaf: TreeDefinition = {\n schemaVersion: CURRENT_SCHEMA_VERSION,\n name: 'Stylized broadleaf',\n trunk: { length: 3.2, radius: 0.24, taper: 0.55, sides: 10, sections: 8, lengthVariation: 0.15, bend: 0.25, flareSections: 3 },\n branches: [\n { count: 6, start: 0.45, end: 0.9, angle: 48, angleVariation: 0.2, spiral: 137.5, length: 0.5, lengthVariation: 0.2, radius: 0.55, taper: 0.5, sides: 8, sections: 5, bend: 0.25, gravity: 0.05 },\n { count: 3, start: 0.4, end: 1, angle: 40, angleVariation: 0.25, spiral: 120, length: 0.5, lengthVariation: 0.25, radius: 0.6, taper: 0.45, sides: 6, sections: 3, bend: 0.2, gravity: 0 },\n ],\n leaves: { count: 2, shape: 'puff', size: 1.1, sizeVariation: 0.3, start: 0.6, angle: 30 },\n materials: {\n shading: 'toon',\n bark: { color: '#8a5a3b', roughness: 1, map: null, normalMap: null },\n leaf: { roughness: 1, map: null, alphaTest: 0.5 },\n },\n season: blossoming,\n wind: { trunk: 0.15, branches: 0.45, leaves: 0.6, frequency: 1 },\n variation: { color: 0.1, growth: 0.1, season: 0.05 },\n sculpts: [],\n};\n\n/**\n * Stylized conifer: a straight trunk with soft, upturned whorls that shrink towards the top\n * (a cone Crown Shape), each carrying a few rounded clumps, so the tree reads as a stack of puffs.\n * Evergreen: it only darkens a little in winter.\n */\nexport const conifer: TreeDefinition = {\n schemaVersion: CURRENT_SCHEMA_VERSION,\n name: 'Stylized conifer',\n trunk: { length: 5, radius: 0.2, taper: 0.2, sides: 8, sections: 6, lengthVariation: 0.15, bend: 0.05, flareSections: 3 },\n branches: [\n { count: 18, start: 0.15, end: 0.97, angle: 85, angleVariation: 0.1, spiral: 137.5, length: 0.5, lengthVariation: 0.1, radius: 0.4, taper: 0.35, sides: 5, sections: 3, bend: 0.1, gravity: 0.05,\n // Crown Shape: a cone, full length at the lowest whorl, a tenth of it at the top.\n lengthProfile: coneCurve(0.15) },\n ],\n leaves: { count: 4, shape: 'puff', size: 0.6, sizeVariation: 0.2, start: 0.1, angle: 20 },\n materials: {\n shading: 'toon',\n bark: { color: '#6e4a35', roughness: 1, map: null, normalMap: null },\n leaf: { roughness: 1, map: null, alphaTest: 0.5 },\n },\n season: evergreen,\n wind: { trunk: 0.1, branches: 0.3, leaves: 0.4, frequency: 0.8 },\n variation: { color: 0.08, growth: 0.1, season: 0.05 },\n sculpts: [],\n};\n\n/** The stylized Style. */\nconst stylized: TreeStyle = { name: 'stylized', broadleaf, conifer, apply: (source, overrides) => applyStyle('stylized', source, overrides) };\nexport default stylized;\n"],"mappings":";;;;;;;;;;AAcA,IAAM,aAAsC;CAC1C,WAAW;EACT;GAAE,GAAG;GAAG,OAAO;EAAU;EACzB;GAAE,GAAG;GAAK,OAAO;EAAU;EAC3B;GAAE,GAAG;GAAK,OAAO;EAAU;EAC3B;GAAE,GAAG;GAAM,OAAO;EAAU;EAC5B;GAAE,GAAG;GAAM,OAAO;EAAU;EAC5B;GAAE,GAAG;GAAM,OAAO;EAAU;EAC5B;GAAE,GAAG;GAAG,OAAO;EAAU;CAC3B;CACA,cAAc,gBAAgB,UAAU;CACxC,SAAS;EACP;GAAE,GAAG;GAAG,OAAO;EAAK;EACpB;GAAE,GAAG;GAAM,OAAO;EAAK;EACvB;GAAE,GAAG;GAAM,OAAO;EAAE;EACpB;GAAE,GAAG;GAAM,OAAO;EAAE;EACpB;GAAE,GAAG;GAAG,OAAO;EAAK;CACtB;CACA,cAAc;AAChB;;AAGA,IAAM,YAAqC;CACzC,WAAW;EACT;GAAE,GAAG;GAAG,OAAO;EAAU;EACzB;GAAE,GAAG;GAAM,OAAO;EAAU;EAC5B;GAAE,GAAG;GAAM,OAAO;EAAU;EAC5B;GAAE,GAAG;GAAM,OAAO;EAAU;EAC5B;GAAE,GAAG;GAAM,OAAO;EAAU;EAC5B;GAAE,GAAG;GAAG,OAAO;EAAU;CAC3B;CACA,cAAc,CAAC;EAAE,GAAG;EAAG,OAAO;CAAE,CAAC;CACjC,SAAS,CAAC;EAAE,GAAG;EAAG,OAAO;CAAE,CAAC;CAC5B,cAAc;AAChB;;;;;AAMA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AAiB;EAAK,QAAQ;EAAK,OAAO;EAAM,OAAO;EAAG,UAAU;EAAG,MAAM;EAAK,SAAS;EAE1L,eAAe,UAAU,GAAI;CAAE,CACnC;CACA,QAAQ;EAAE,OAAO;EAAG,OAAO;EAAQ,MAAM;EAAK,eAAe;EAAK,OAAO;EAAK,OAAO;CAAG;CACxF,WAAW;EACT,SAAS;EACT,MAAM;GAAE,OAAO;GAAW,WAAW;GAAG,KAAK;GAAM,WAAW;EAAK;EACnE,MAAM;GAAE,WAAW;GAAG,KAAK;GAAM,WAAW;EAAI;CAClD;CACA,QAAQ;CACR,MAAM;EAAE,OAAO;EAAK,UAAU;EAAK,QAAQ;EAAK,WAAW;CAAI;CAC/D,WAAW;EAAE,OAAO;EAAM,QAAQ;EAAK,QAAQ;CAAK;CACpD,SAAS,CAAC;AACZ;;AAGA,IAAM,WAAsB;CAAE,MAAM;CAAY;CAAW;CAAS,QAAQ,QAAQ,cAAc,WAAW,YAAY,QAAQ,SAAS;AAAE"}
@@ -1,6 +1,8 @@
1
- import type { TreeDefinition } from '../definition';
1
+ import type { DefinitionPatch, TreeDefinition } from '../definition';
2
+ import type { StyleSource } from './apply';
2
3
  /**
3
- * A Style: a visual look shipped with the library, as one ready-made Tree Definition per Form.
4
+ * A Style: a visual look shipped with the library. It turns any Species into a Tree Definition
5
+ * (`apply`, ADR 0005), and has one ready-made generic Tree Definition per Form.
4
6
  * Each built-in Style is its own subpath (`@casmo/tree.js/styles/<name>`), loaded with a dynamic
5
7
  * `import()`, whose default export is the Style and whose named exports are its Definitions.
6
8
  */
@@ -8,5 +10,17 @@ export interface TreeStyle {
8
10
  name: string;
9
11
  broadleaf: TreeDefinition;
10
12
  conifer: TreeDefinition;
13
+ /**
14
+ * Draws a Species in this Style: returns a complete, validated Tree Definition with this Style's
15
+ * shading, polygon detail, leaf shape / count / size / texture (from the Leaf Type and density)
16
+ * and bark (from the Bark Type and colour). Given a Tree Definition instead, it re-applies only
17
+ * the look and keeps every shape field (trunk, branches, Crown Shape, Season, Wind, Sculpts).
18
+ * `overrides` are merged on top like `extendDefinition`. Pure.
19
+ *
20
+ * ```ts
21
+ * createTree(lowPoly.apply(oak, { trunk: { length: 8 } }), { seed: 42 });
22
+ * ```
23
+ */
24
+ apply(source: StyleSource, overrides?: DefinitionPatch): TreeDefinition;
11
25
  }
12
26
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/styles/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,cAAc,CAAC;IAC1B,OAAO,EAAE,cAAc,CAAC;CACzB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/styles/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,cAAc,CAAC;IAC1B,OAAO,EAAE,cAAc,CAAC;IACxB;;;;;;;;;;OAUG;IACH,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,eAAe,GAAG,cAAc,CAAC;CACzE"}
@@ -1,5 +1,5 @@
1
1
  import { BufferGeometry, Group, Mesh, type Material, type MeshStandardNodeMaterial, type UniformNode } from 'three/webgpu';
2
- import type { TreeDefinition } from '../definition';
2
+ import type { MaterialFeatures, TranslucencyDefinition, TreeDefinition } from '../definition';
3
3
  import { type TreeData } from '../generator';
4
4
  import { type SeasonUniform } from '../season';
5
5
  import { type TextureOptions } from '../textures';
@@ -32,19 +32,48 @@ export declare class Tree extends Group {
32
32
  readonly wood: Mesh<BufferGeometry, Material>;
33
33
  /** Leaf cards (empty geometry for a bare tree). */
34
34
  readonly leaves: Mesh<BufferGeometry, MeshStandardNodeMaterial>;
35
- /** This tree's Growth uniform (read by the wood and leaf materials' `positionNode`). */
35
+ /** Fruit (empty geometry when the Definition has no Fruit). */
36
+ readonly fruit: Mesh<BufferGeometry, MeshStandardNodeMaterial>;
37
+ /** This tree's Growth uniform (read by the wood, leaf and Fruit materials' `positionNode`). */
36
38
  readonly growthUniform: UniformNode<'float', number>;
37
- /** The Season uniform the leaf material reads (shared nodes may reference it). */
39
+ /** The Season uniform the leaf and Fruit materials read (shared nodes may reference it). */
38
40
  readonly seasonUniform: SeasonUniform;
39
41
  /** This tree's response to the Wind, from `definition.wind`; `windResponse.set(...)` changes it live. */
40
42
  readonly windResponse: WindResponse;
41
43
  private readonly windBinding;
44
+ private readonly features;
42
45
  /**
43
46
  * Resolves once every texture of this tree has loaded (at once for a tree without textures);
44
47
  * rejects if one fails. Await it before a first render that must show the textures.
45
48
  */
46
49
  readonly ready: Promise<void>;
47
50
  constructor(definition: TreeDefinition, data: TreeData, options?: TreeOptions);
51
+ /**
52
+ * Crown Normals amount (0..1), from the Definition's `materials.leaf.crownNormals`; null when it is off.
53
+ * Setting it (clamped to 0..1) only writes a uniform: no regeneration, no recompile. Throws on a
54
+ * tree without Crown Normals (switching the feature on needs a new tree).
55
+ */
56
+ get crownNormals(): number | null;
57
+ set crownNormals(value: number);
58
+ /**
59
+ * Leaf Translucency settings (a copy), from the Definition's `materials.leaf.translucency`; null when it
60
+ * is off. Setting any of them (each clamped to 0..1, the others kept) only writes uniforms: no
61
+ * regeneration, no recompile. Throws on a tree without Leaf Translucency.
62
+ */
63
+ get translucency(): TranslucencyDefinition | null;
64
+ set translucency(value: Partial<TranslucencyDefinition>);
65
+ /**
66
+ * The Material Features this tree shows, with their current (possibly live-tuned) values: the
67
+ * Definition's (see `materialFeaturesOf`), except that Crown Normals at 0 count as off.
68
+ */
69
+ get materialFeatures(): MaterialFeatures;
70
+ /**
71
+ * Structural Occlusion strength (0..1), from the Definition's `materials.occlusion`; null when it has none.
72
+ * Setting it (clamped to 0..1) only writes a uniform: no regeneration, no recompile. Throws on a tree
73
+ * without Structural Occlusion (there is no baked occlusion to show).
74
+ */
75
+ get occlusionStrength(): number | null;
76
+ set occlusionStrength(value: number);
48
77
  /**
49
78
  * The Wind this tree sways with (shared with every other tree using it). Assigning another
50
79
  * Wind only rebinds uniforms: no regeneration, no recompile.
@@ -52,8 +81,8 @@ export declare class Tree extends Group {
52
81
  get wind(): Wind;
53
82
  set wind(value: Wind);
54
83
  /**
55
- * Season: 0 (first day of spring) .. 1 (last day of winter); sets leaf colour, leaf coverage
56
- * and blossom from the Definition's Season Profile. Values outside 0..1 wrap around the year.
84
+ * Season: 0 (first day of spring) .. 1 (last day of winter); sets leaf colour, leaf coverage,
85
+ * blossom and Fruit (amount, size, colour) from the Definition's Season Profile. Values outside 0..1 wrap around the year.
57
86
  * Only updates a uniform, so it is cheap to animate.
58
87
  */
59
88
  get season(): number;