@casmo/tree.js 0.1.0 → 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 (190) hide show
  1. package/README.md +106 -16
  2. package/dist/apply-CcodnAbs.js +250 -0
  3. package/dist/apply-CcodnAbs.js.map +1 -0
  4. package/dist/bake/index.d.ts +2 -2
  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 +7 -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 +95 -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 +10 -1
  22. package/dist/forest/Forest.d.ts.map +1 -1
  23. package/dist/forest/nodes.d.ts +4 -1
  24. package/dist/forest/nodes.d.ts.map +1 -1
  25. package/dist/{forest-OX9WvAwh.js → forest-DTrD8puH.js} +695 -546
  26. package/dist/forest-DTrD8puH.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/fruit.d.ts +28 -0
  30. package/dist/generator/fruit.d.ts.map +1 -0
  31. package/dist/generator/growth.d.ts +1 -1
  32. package/dist/generator/growth.d.ts.map +1 -1
  33. package/dist/generator/index.d.ts +4 -4
  34. package/dist/generator/index.d.ts.map +1 -1
  35. package/dist/generator/leaf-shapes.d.ts +33 -1
  36. package/dist/generator/leaf-shapes.d.ts.map +1 -1
  37. package/dist/generator/trunk.d.ts +8 -2
  38. package/dist/generator/trunk.d.ts.map +1 -1
  39. package/dist/generator/types.d.ts +34 -5
  40. package/dist/generator/types.d.ts.map +1 -1
  41. package/dist/index.d.ts +4 -2
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +48 -4
  44. package/dist/index.js.map +1 -1
  45. package/dist/materials/index.d.ts +6 -0
  46. package/dist/materials/index.d.ts.map +1 -1
  47. package/dist/names-C6-wuJ29.js +589 -0
  48. package/dist/names-C6-wuJ29.js.map +1 -0
  49. package/dist/react/Tree.d.ts +5 -2
  50. package/dist/react/Tree.d.ts.map +1 -1
  51. package/dist/react.js +10 -6
  52. package/dist/react.js.map +1 -1
  53. package/dist/season/nodes.d.ts +16 -0
  54. package/dist/season/nodes.d.ts.map +1 -1
  55. package/dist/season/profile.d.ts +26 -0
  56. package/dist/season/profile.d.ts.map +1 -1
  57. package/dist/species/almond.js +213 -0
  58. package/dist/species/almond.js.map +1 -0
  59. package/dist/species/almond.json +201 -0
  60. package/dist/species/apple.js +220 -0
  61. package/dist/species/apple.js.map +1 -0
  62. package/dist/species/apple.json +211 -0
  63. package/dist/species/ash.js +177 -0
  64. package/dist/species/ash.js.map +1 -0
  65. package/dist/species/ash.json +168 -0
  66. package/dist/species/beech.js +164 -0
  67. package/dist/species/beech.js.map +1 -0
  68. package/dist/species/beech.json +158 -0
  69. package/dist/species/birch.js +160 -0
  70. package/dist/species/birch.js.map +1 -0
  71. package/dist/species/birch.json +154 -0
  72. package/dist/species/catalog.d.ts +61 -0
  73. package/dist/species/catalog.d.ts.map +1 -0
  74. package/dist/species/cedar.js +159 -0
  75. package/dist/species/cedar.js.map +1 -0
  76. package/dist/species/cedar.json +159 -0
  77. package/dist/species/cherry.js +227 -0
  78. package/dist/species/cherry.js.map +1 -0
  79. package/dist/species/cherry.json +215 -0
  80. package/dist/species/chestnut.js +220 -0
  81. package/dist/species/chestnut.js.map +1 -0
  82. package/dist/species/chestnut.json +211 -0
  83. package/dist/species/douglas-fir.js +164 -0
  84. package/dist/species/douglas-fir.js.map +1 -0
  85. package/dist/species/douglas-fir.json +161 -0
  86. package/dist/species/elm.js +163 -0
  87. package/dist/species/elm.js.map +1 -0
  88. package/dist/species/elm.json +154 -0
  89. package/dist/species/hemlock.js +165 -0
  90. package/dist/species/hemlock.js.map +1 -0
  91. package/dist/species/hemlock.json +162 -0
  92. package/dist/species/hickory.js +190 -0
  93. package/dist/species/hickory.js.map +1 -0
  94. package/dist/species/hickory.json +183 -0
  95. package/dist/species/index.d.ts +10 -0
  96. package/dist/species/index.d.ts.map +1 -0
  97. package/dist/species/juniper.js +148 -0
  98. package/dist/species/juniper.js.map +1 -0
  99. package/dist/species/juniper.json +145 -0
  100. package/dist/species/loaders.d.ts +7 -0
  101. package/dist/species/loaders.d.ts.map +1 -0
  102. package/dist/species/mahogany.js +191 -0
  103. package/dist/species/mahogany.js.map +1 -0
  104. package/dist/species/mahogany.json +187 -0
  105. package/dist/species/maple.js +167 -0
  106. package/dist/species/maple.js.map +1 -0
  107. package/dist/species/maple.json +162 -0
  108. package/dist/species/oak.js +210 -0
  109. package/dist/species/oak.js.map +1 -0
  110. package/dist/species/oak.json +203 -0
  111. package/dist/species/olive.js +179 -0
  112. package/dist/species/olive.js.map +1 -0
  113. package/dist/species/olive.json +172 -0
  114. package/dist/species/peach.js +213 -0
  115. package/dist/species/peach.js.map +1 -0
  116. package/dist/species/peach.json +201 -0
  117. package/dist/species/pear.js +203 -0
  118. package/dist/species/pear.js.map +1 -0
  119. package/dist/species/pear.json +191 -0
  120. package/dist/species/pine.js +153 -0
  121. package/dist/species/pine.js.map +1 -0
  122. package/dist/species/pine.json +153 -0
  123. package/dist/species/plum.js +227 -0
  124. package/dist/species/plum.js.map +1 -0
  125. package/dist/species/plum.json +215 -0
  126. package/dist/species/red-oak.js +210 -0
  127. package/dist/species/red-oak.js.map +1 -0
  128. package/dist/species/red-oak.json +203 -0
  129. package/dist/species/redwood.js +164 -0
  130. package/dist/species/redwood.js.map +1 -0
  131. package/dist/species/redwood.json +161 -0
  132. package/dist/species/sequoia.js +157 -0
  133. package/dist/species/sequoia.js.map +1 -0
  134. package/dist/species/sequoia.json +157 -0
  135. package/dist/species/spruce.js +160 -0
  136. package/dist/species/spruce.js.map +1 -0
  137. package/dist/species/spruce.json +157 -0
  138. package/dist/species/teak.js +156 -0
  139. package/dist/species/teak.js.map +1 -0
  140. package/dist/species/teak.json +148 -0
  141. package/dist/species/types.d.ts +61 -0
  142. package/dist/species/types.d.ts.map +1 -0
  143. package/dist/species/walnut.js +210 -0
  144. package/dist/species/walnut.js.map +1 -0
  145. package/dist/species/walnut.json +203 -0
  146. package/dist/species/white-oak.js +203 -0
  147. package/dist/species/white-oak.js.map +1 -0
  148. package/dist/species/white-oak.json +199 -0
  149. package/dist/species.js +160 -0
  150. package/dist/species.js.map +1 -0
  151. package/dist/styles/apply.d.ts +12 -0
  152. package/dist/styles/apply.d.ts.map +1 -0
  153. package/dist/styles/low-poly/index.d.ts +1 -1
  154. package/dist/styles/low-poly/index.d.ts.map +1 -1
  155. package/dist/styles/low-poly.js +9 -8
  156. package/dist/styles/low-poly.js.map +1 -1
  157. package/dist/styles/names.d.ts +28 -0
  158. package/dist/styles/names.d.ts.map +1 -0
  159. package/dist/styles/realistic/index.d.ts +3 -8
  160. package/dist/styles/realistic/index.d.ts.map +1 -1
  161. package/dist/styles/realistic/textures.d.ts +20 -0
  162. package/dist/styles/realistic/textures.d.ts.map +1 -0
  163. package/dist/styles/realistic.js +10 -16
  164. package/dist/styles/realistic.js.map +1 -1
  165. package/dist/styles/registry.d.ts +2 -13
  166. package/dist/styles/registry.d.ts.map +1 -1
  167. package/dist/styles/stylized/index.d.ts +1 -1
  168. package/dist/styles/stylized/index.d.ts.map +1 -1
  169. package/dist/styles/stylized.js +9 -8
  170. package/dist/styles/stylized.js.map +1 -1
  171. package/dist/styles/types.d.ts +16 -2
  172. package/dist/styles/types.d.ts.map +1 -1
  173. package/dist/textures/realistic/bark-fibrous-normal.png +0 -0
  174. package/dist/textures/realistic/bark-fibrous.png +0 -0
  175. package/dist/textures/realistic/bark-papery-normal.png +0 -0
  176. package/dist/textures/realistic/bark-papery.png +0 -0
  177. package/dist/textures/realistic/bark-plated-normal.png +0 -0
  178. package/dist/textures/realistic/bark-plated.png +0 -0
  179. package/dist/textures/realistic/bark-smooth-normal.png +0 -0
  180. package/dist/textures/realistic/bark-smooth.png +0 -0
  181. package/dist/textures/realistic/leaf-compound.png +0 -0
  182. package/dist/textures/realistic/leaf-lobed.png +0 -0
  183. package/dist/textures/realistic/leaf-palmate.png +0 -0
  184. package/dist/textures/realistic/scale.png +0 -0
  185. package/dist/tree/Tree.d.ts +6 -4
  186. package/dist/tree/Tree.d.ts.map +1 -1
  187. package/package.json +9 -2
  188. package/dist/forest-OX9WvAwh.js.map +0 -1
  189. package/dist/types-BZjHhNz7.js +0 -20
  190. package/dist/types-BZjHhNz7.js.map +0 -1
@@ -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;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AG,OAAO;EAAQ,MAAM;EAAK,eAAe;EAAK,OAAO;EAAG,OAAO;CAAG;CACtF,WAAW;EACT,SAAS;EACT,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 },\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 },\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;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,QAAQ;GAAK,QAAQ;GAAK,iBAAiB;GAAK,QAAQ;GAAK,OAAO;GAAK,OAAO;GAAG,U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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;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 { m as coneCurve } from "../names-C6-wuJ29.js";
2
2
  import { t as SEASON_PROFILES } from "../profiles-BAiyeFlh.js";
3
+ import { t as applyStyle } from "../apply-CcodnAbs.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,
@@ -187,13 +187,12 @@ var broadleaf = {
187
187
  };
188
188
  /**
189
189
  * 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.
190
+ * (a cone Crown Shape), each carrying a few rounded clumps, so the tree reads as a stack of puffs.
191
191
  * Evergreen: it only darkens a little in winter.
192
192
  */
193
193
  var conifer = {
194
- schemaVersion: 2,
194
+ schemaVersion: 3,
195
195
  name: "Stylized conifer",
196
- form: "conifer",
197
196
  trunk: {
198
197
  length: 5,
199
198
  radius: .2,
@@ -217,7 +216,8 @@ var conifer = {
217
216
  sides: 5,
218
217
  sections: 3,
219
218
  bend: .1,
220
- gravity: .05
219
+ gravity: .05,
220
+ lengthProfile: coneCurve(.15)
221
221
  }],
222
222
  leaves: {
223
223
  count: 4,
@@ -259,7 +259,8 @@ var conifer = {
259
259
  var stylized = {
260
260
  name: "stylized",
261
261
  broadleaf,
262
- conifer
262
+ conifer,
263
+ apply: (source, overrides) => applyStyle("stylized", source, overrides)
263
264
  };
264
265
  export { broadleaf, conifer, stylized as default };
265
266
 
@@ -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;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,OAA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,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 },\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 },\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 st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ACnE,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"}
@@ -32,9 +32,11 @@ 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;
@@ -52,8 +54,8 @@ export declare class Tree extends Group {
52
54
  get wind(): Wind;
53
55
  set wind(value: Wind);
54
56
  /**
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.
57
+ * Season: 0 (first day of spring) .. 1 (last day of winter); sets leaf colour, leaf coverage,
58
+ * blossom and Fruit (amount, size, colour) from the Definition's Season Profile. Values outside 0..1 wrap around the year.
57
59
  * Only updates a uniform, so it is cheap to animate.
58
60
  */
59
61
  get season(): number;
@@ -1 +1 @@
1
- {"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["../../src/tree/Tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,KAAK,EAGL,IAAI,EACJ,KAAK,QAAQ,EACb,KAAK,wBAAwB,EAE7B,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAqC,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAIhF,OAAO,EAAgD,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAE7F,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,EAAoC,IAAI,EAAe,YAAY,EAAE,MAAM,SAAS,CAAC;AAiD5F,yCAAyC;AACzC,MAAM,WAAW,WAAW;IAC1B,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED;;;GAGG;AACH,qBAAa,IAAK,SAAQ,KAAK;IAC7B,QAAQ,CAAC,MAAM,QAAQ;IACvB,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,IAAI,EA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AAQ,CAAC,WAAW,CAAc;IAE1C;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;gBAElB,UAAU,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,GAAE,WAAgB;IAyCjF;;;OAGG;IACH,IAAI,IAAI,IAAI,IAAI,CAEf;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,IAAI,EAEnB;IAED;;;;OAIG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAEvB;IAED;;;OAGG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAEvB;IAED,sGAAsG;IAC7F,OAAO,IAAI,IAAI;CAWzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casmo/tree.js",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Procedural trees for three.js (WebGPURenderer, TSL node materials).",
5
5
  "keywords": [
6
6
  "three",
@@ -55,6 +55,11 @@
55
55
  "types": "./dist/effects/index.d.ts",
56
56
  "import": "./dist/effects.js"
57
57
  },
58
+ "./species": {
59
+ "types": "./dist/species/index.d.ts",
60
+ "import": "./dist/species.js"
61
+ },
62
+ "./species/*.json": "./dist/species/*.json",
58
63
  "./package.json": "./package.json"
59
64
  },
60
65
  "scripts": {
@@ -69,7 +74,9 @@
69
74
  "test:watch": "vitest",
70
75
  "test:e2e": "playwright test",
71
76
  "readme-media": "node scripts/readme-media/capture.mjs",
72
- "prepublishOnly": "npm run lint && npm run typecheck && npm test && npm run build"
77
+ "prepublishOnly": "npm run lint && npm run typecheck && npm test && npm run build",
78
+ "species": "node scripts/generate-species.mjs",
79
+ "gallery": "node scripts/render-gallery.mjs"
73
80
  },
74
81
  "peerDependencies": {
75
82
  "@react-three/fiber": ">=9.0.0",