@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.
- package/README.md +106 -16
- package/dist/apply-CcodnAbs.js +250 -0
- package/dist/apply-CcodnAbs.js.map +1 -0
- package/dist/bake/index.d.ts +2 -2
- package/dist/bake/index.d.ts.map +1 -1
- package/dist/definition/crown-shape.d.ts +9 -0
- package/dist/definition/crown-shape.d.ts.map +1 -0
- package/dist/definition/defaults.d.ts +7 -1
- package/dist/definition/defaults.d.ts.map +1 -1
- package/dist/definition/index.d.ts +4 -3
- package/dist/definition/index.d.ts.map +1 -1
- package/dist/definition/migrations.d.ts +0 -8
- package/dist/definition/migrations.d.ts.map +1 -1
- package/dist/definition/schema.d.ts.map +1 -1
- package/dist/definition/types.d.ts +95 -6
- package/dist/definition/types.d.ts.map +1 -1
- package/dist/effects/mask.d.ts +3 -3
- package/dist/effects/mask.d.ts.map +1 -1
- package/dist/effects.js +3 -3
- package/dist/effects.js.map +1 -1
- package/dist/forest/Forest.d.ts +10 -1
- package/dist/forest/Forest.d.ts.map +1 -1
- package/dist/forest/nodes.d.ts +4 -1
- package/dist/forest/nodes.d.ts.map +1 -1
- package/dist/{forest-OX9WvAwh.js → forest-DTrD8puH.js} +695 -546
- package/dist/forest-DTrD8puH.js.map +1 -0
- package/dist/generator/branches.d.ts +2 -2
- package/dist/generator/branches.d.ts.map +1 -1
- package/dist/generator/fruit.d.ts +28 -0
- package/dist/generator/fruit.d.ts.map +1 -0
- package/dist/generator/growth.d.ts +1 -1
- package/dist/generator/growth.d.ts.map +1 -1
- package/dist/generator/index.d.ts +4 -4
- package/dist/generator/index.d.ts.map +1 -1
- package/dist/generator/leaf-shapes.d.ts +33 -1
- package/dist/generator/leaf-shapes.d.ts.map +1 -1
- package/dist/generator/trunk.d.ts +8 -2
- package/dist/generator/trunk.d.ts.map +1 -1
- package/dist/generator/types.d.ts +34 -5
- package/dist/generator/types.d.ts.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +48 -4
- package/dist/index.js.map +1 -1
- package/dist/materials/index.d.ts +6 -0
- package/dist/materials/index.d.ts.map +1 -1
- package/dist/names-C6-wuJ29.js +589 -0
- package/dist/names-C6-wuJ29.js.map +1 -0
- package/dist/react/Tree.d.ts +5 -2
- package/dist/react/Tree.d.ts.map +1 -1
- package/dist/react.js +10 -6
- package/dist/react.js.map +1 -1
- package/dist/season/nodes.d.ts +16 -0
- package/dist/season/nodes.d.ts.map +1 -1
- package/dist/season/profile.d.ts +26 -0
- package/dist/season/profile.d.ts.map +1 -1
- package/dist/species/almond.js +213 -0
- package/dist/species/almond.js.map +1 -0
- package/dist/species/almond.json +201 -0
- package/dist/species/apple.js +220 -0
- package/dist/species/apple.js.map +1 -0
- package/dist/species/apple.json +211 -0
- package/dist/species/ash.js +177 -0
- package/dist/species/ash.js.map +1 -0
- package/dist/species/ash.json +168 -0
- package/dist/species/beech.js +164 -0
- package/dist/species/beech.js.map +1 -0
- package/dist/species/beech.json +158 -0
- package/dist/species/birch.js +160 -0
- package/dist/species/birch.js.map +1 -0
- package/dist/species/birch.json +154 -0
- package/dist/species/catalog.d.ts +61 -0
- package/dist/species/catalog.d.ts.map +1 -0
- package/dist/species/cedar.js +159 -0
- package/dist/species/cedar.js.map +1 -0
- package/dist/species/cedar.json +159 -0
- package/dist/species/cherry.js +227 -0
- package/dist/species/cherry.js.map +1 -0
- package/dist/species/cherry.json +215 -0
- package/dist/species/chestnut.js +220 -0
- package/dist/species/chestnut.js.map +1 -0
- package/dist/species/chestnut.json +211 -0
- package/dist/species/douglas-fir.js +164 -0
- package/dist/species/douglas-fir.js.map +1 -0
- package/dist/species/douglas-fir.json +161 -0
- package/dist/species/elm.js +163 -0
- package/dist/species/elm.js.map +1 -0
- package/dist/species/elm.json +154 -0
- package/dist/species/hemlock.js +165 -0
- package/dist/species/hemlock.js.map +1 -0
- package/dist/species/hemlock.json +162 -0
- package/dist/species/hickory.js +190 -0
- package/dist/species/hickory.js.map +1 -0
- package/dist/species/hickory.json +183 -0
- package/dist/species/index.d.ts +10 -0
- package/dist/species/index.d.ts.map +1 -0
- package/dist/species/juniper.js +148 -0
- package/dist/species/juniper.js.map +1 -0
- package/dist/species/juniper.json +145 -0
- package/dist/species/loaders.d.ts +7 -0
- package/dist/species/loaders.d.ts.map +1 -0
- package/dist/species/mahogany.js +191 -0
- package/dist/species/mahogany.js.map +1 -0
- package/dist/species/mahogany.json +187 -0
- package/dist/species/maple.js +167 -0
- package/dist/species/maple.js.map +1 -0
- package/dist/species/maple.json +162 -0
- package/dist/species/oak.js +210 -0
- package/dist/species/oak.js.map +1 -0
- package/dist/species/oak.json +203 -0
- package/dist/species/olive.js +179 -0
- package/dist/species/olive.js.map +1 -0
- package/dist/species/olive.json +172 -0
- package/dist/species/peach.js +213 -0
- package/dist/species/peach.js.map +1 -0
- package/dist/species/peach.json +201 -0
- package/dist/species/pear.js +203 -0
- package/dist/species/pear.js.map +1 -0
- package/dist/species/pear.json +191 -0
- package/dist/species/pine.js +153 -0
- package/dist/species/pine.js.map +1 -0
- package/dist/species/pine.json +153 -0
- package/dist/species/plum.js +227 -0
- package/dist/species/plum.js.map +1 -0
- package/dist/species/plum.json +215 -0
- package/dist/species/red-oak.js +210 -0
- package/dist/species/red-oak.js.map +1 -0
- package/dist/species/red-oak.json +203 -0
- package/dist/species/redwood.js +164 -0
- package/dist/species/redwood.js.map +1 -0
- package/dist/species/redwood.json +161 -0
- package/dist/species/sequoia.js +157 -0
- package/dist/species/sequoia.js.map +1 -0
- package/dist/species/sequoia.json +157 -0
- package/dist/species/spruce.js +160 -0
- package/dist/species/spruce.js.map +1 -0
- package/dist/species/spruce.json +157 -0
- package/dist/species/teak.js +156 -0
- package/dist/species/teak.js.map +1 -0
- package/dist/species/teak.json +148 -0
- package/dist/species/types.d.ts +61 -0
- package/dist/species/types.d.ts.map +1 -0
- package/dist/species/walnut.js +210 -0
- package/dist/species/walnut.js.map +1 -0
- package/dist/species/walnut.json +203 -0
- package/dist/species/white-oak.js +203 -0
- package/dist/species/white-oak.js.map +1 -0
- package/dist/species/white-oak.json +199 -0
- package/dist/species.js +160 -0
- package/dist/species.js.map +1 -0
- package/dist/styles/apply.d.ts +12 -0
- package/dist/styles/apply.d.ts.map +1 -0
- package/dist/styles/low-poly/index.d.ts +1 -1
- package/dist/styles/low-poly/index.d.ts.map +1 -1
- package/dist/styles/low-poly.js +9 -8
- package/dist/styles/low-poly.js.map +1 -1
- package/dist/styles/names.d.ts +28 -0
- package/dist/styles/names.d.ts.map +1 -0
- package/dist/styles/realistic/index.d.ts +3 -8
- package/dist/styles/realistic/index.d.ts.map +1 -1
- package/dist/styles/realistic/textures.d.ts +20 -0
- package/dist/styles/realistic/textures.d.ts.map +1 -0
- package/dist/styles/realistic.js +10 -16
- package/dist/styles/realistic.js.map +1 -1
- package/dist/styles/registry.d.ts +2 -13
- package/dist/styles/registry.d.ts.map +1 -1
- package/dist/styles/stylized/index.d.ts +1 -1
- package/dist/styles/stylized/index.d.ts.map +1 -1
- package/dist/styles/stylized.js +9 -8
- package/dist/styles/stylized.js.map +1 -1
- package/dist/styles/types.d.ts +16 -2
- package/dist/styles/types.d.ts.map +1 -1
- package/dist/textures/realistic/bark-fibrous-normal.png +0 -0
- package/dist/textures/realistic/bark-fibrous.png +0 -0
- package/dist/textures/realistic/bark-papery-normal.png +0 -0
- package/dist/textures/realistic/bark-papery.png +0 -0
- package/dist/textures/realistic/bark-plated-normal.png +0 -0
- package/dist/textures/realistic/bark-plated.png +0 -0
- package/dist/textures/realistic/bark-smooth-normal.png +0 -0
- package/dist/textures/realistic/bark-smooth.png +0 -0
- package/dist/textures/realistic/leaf-compound.png +0 -0
- package/dist/textures/realistic/leaf-lobed.png +0 -0
- package/dist/textures/realistic/leaf-palmate.png +0 -0
- package/dist/textures/realistic/scale.png +0 -0
- package/dist/tree/Tree.d.ts +6 -4
- package/dist/tree/Tree.d.ts.map +1 -1
- package/package.json +9 -2
- package/dist/forest-OX9WvAwh.js.map +0 -1
- package/dist/types-BZjHhNz7.js +0 -20
- package/dist/types-BZjHhNz7.js.map +0 -1
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "white-oak",
|
|
3
|
+
"name": "White Oak",
|
|
4
|
+
"form": "broadleaf",
|
|
5
|
+
"trunk": {
|
|
6
|
+
"length": 2.8,
|
|
7
|
+
"radius": 0.55,
|
|
8
|
+
"taper": 0.35,
|
|
9
|
+
"lengthVariation": 0.12,
|
|
10
|
+
"bend": 0.18
|
|
11
|
+
},
|
|
12
|
+
"branches": [
|
|
13
|
+
{
|
|
14
|
+
"angleVariation": 0.1,
|
|
15
|
+
"spiral": 137.5,
|
|
16
|
+
"lengthVariation": 0.15,
|
|
17
|
+
"taper": 0.45,
|
|
18
|
+
"bend": 0.12,
|
|
19
|
+
"gravity": 0.12,
|
|
20
|
+
"lengthProfile": [
|
|
21
|
+
{
|
|
22
|
+
"t": 0.6,
|
|
23
|
+
"value": 1.0
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"t": 1.0,
|
|
27
|
+
"value": 0.8
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"angleProfile": [
|
|
31
|
+
{
|
|
32
|
+
"t": 0.6,
|
|
33
|
+
"value": 1.05
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"t": 1.0,
|
|
37
|
+
"value": 0.8
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"count": 5,
|
|
41
|
+
"start": 0.6,
|
|
42
|
+
"end": 0.98,
|
|
43
|
+
"angle": 84,
|
|
44
|
+
"length": 1.7,
|
|
45
|
+
"radius": 0.62
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"angleVariation": 0.15,
|
|
49
|
+
"spiral": 180,
|
|
50
|
+
"lengthVariation": 0.15,
|
|
51
|
+
"taper": 0.45,
|
|
52
|
+
"bend": 0.15,
|
|
53
|
+
"gravity": 0.3,
|
|
54
|
+
"count": 3,
|
|
55
|
+
"start": 0.3,
|
|
56
|
+
"end": 1,
|
|
57
|
+
"angle": 55,
|
|
58
|
+
"length": 0.45,
|
|
59
|
+
"radius": 0.6
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"angleVariation": 0.15,
|
|
63
|
+
"spiral": 137.5,
|
|
64
|
+
"lengthVariation": 0.15,
|
|
65
|
+
"taper": 0.45,
|
|
66
|
+
"bend": 0.15,
|
|
67
|
+
"gravity": 0.3,
|
|
68
|
+
"count": 3,
|
|
69
|
+
"start": 0.35,
|
|
70
|
+
"end": 1,
|
|
71
|
+
"angle": 45,
|
|
72
|
+
"length": 0.5,
|
|
73
|
+
"radius": 0.6
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"foliage": {
|
|
77
|
+
"type": "lobed",
|
|
78
|
+
"density": 0.45,
|
|
79
|
+
"size": 0.6,
|
|
80
|
+
"sizeVariation": 0.25,
|
|
81
|
+
"start": 0.05,
|
|
82
|
+
"angle": 50
|
|
83
|
+
},
|
|
84
|
+
"bark": {
|
|
85
|
+
"type": "furrowed",
|
|
86
|
+
"color": "#a8a196"
|
|
87
|
+
},
|
|
88
|
+
"fruit": {
|
|
89
|
+
"type": "nut",
|
|
90
|
+
"count": 0.3,
|
|
91
|
+
"size": 0.09,
|
|
92
|
+
"sizeVariation": 0.2,
|
|
93
|
+
"hang": 0.3
|
|
94
|
+
},
|
|
95
|
+
"season": {
|
|
96
|
+
"leafColor": [
|
|
97
|
+
{
|
|
98
|
+
"t": 0,
|
|
99
|
+
"value": "#a5c45a"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"t": 0.2,
|
|
103
|
+
"value": "#5e8048"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"t": 0.52,
|
|
107
|
+
"value": "#5e8048"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"t": 0.6,
|
|
111
|
+
"value": "#9a6a3a"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"t": 0.7,
|
|
115
|
+
"value": "#7a5232"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"t": 0.97,
|
|
119
|
+
"value": "#7a5232"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"t": 1,
|
|
123
|
+
"value": "#a5c45a"
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"leafCoverage": [
|
|
127
|
+
{
|
|
128
|
+
"t": 0,
|
|
129
|
+
"value": 0.3
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"t": 0.1,
|
|
133
|
+
"value": 1
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"t": 0.72,
|
|
137
|
+
"value": 1
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"t": 0.9,
|
|
141
|
+
"value": 0
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"t": 0.96,
|
|
145
|
+
"value": 0
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"t": 1,
|
|
149
|
+
"value": 0.3
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"blossom": [
|
|
153
|
+
{
|
|
154
|
+
"t": 0,
|
|
155
|
+
"value": 0
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"blossomColor": "#d8d48a",
|
|
159
|
+
"fruit": [
|
|
160
|
+
{
|
|
161
|
+
"t": 0.25,
|
|
162
|
+
"value": 0
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"t": 0.4,
|
|
166
|
+
"value": 1
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"t": 0.62,
|
|
170
|
+
"value": 1
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"t": 0.7,
|
|
174
|
+
"value": 0
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"fruitColor": [
|
|
178
|
+
{
|
|
179
|
+
"t": 0.35,
|
|
180
|
+
"value": "#7d9a3a"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"t": 0.55,
|
|
184
|
+
"value": "#8a5a2b"
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
"wind": {
|
|
189
|
+
"trunk": 0.08,
|
|
190
|
+
"branches": 0.3,
|
|
191
|
+
"leaves": 0.6,
|
|
192
|
+
"frequency": 0.9
|
|
193
|
+
},
|
|
194
|
+
"variation": {
|
|
195
|
+
"color": 0.1,
|
|
196
|
+
"growth": 0.1,
|
|
197
|
+
"season": 0.05
|
|
198
|
+
}
|
|
199
|
+
}
|
package/dist/species.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import almond_default from "./species/almond.js";
|
|
2
|
+
import apple_default from "./species/apple.js";
|
|
3
|
+
import ash_default from "./species/ash.js";
|
|
4
|
+
import beech_default from "./species/beech.js";
|
|
5
|
+
import birch_default from "./species/birch.js";
|
|
6
|
+
import cedar_default from "./species/cedar.js";
|
|
7
|
+
import cherry_default from "./species/cherry.js";
|
|
8
|
+
import chestnut_default from "./species/chestnut.js";
|
|
9
|
+
import douglas_fir_default from "./species/douglas-fir.js";
|
|
10
|
+
import elm_default from "./species/elm.js";
|
|
11
|
+
import hemlock_default from "./species/hemlock.js";
|
|
12
|
+
import hickory_default from "./species/hickory.js";
|
|
13
|
+
import juniper_default from "./species/juniper.js";
|
|
14
|
+
import mahogany_default from "./species/mahogany.js";
|
|
15
|
+
import maple_default from "./species/maple.js";
|
|
16
|
+
import oak_default from "./species/oak.js";
|
|
17
|
+
import olive_default from "./species/olive.js";
|
|
18
|
+
import peach_default from "./species/peach.js";
|
|
19
|
+
import pear_default from "./species/pear.js";
|
|
20
|
+
import pine_default from "./species/pine.js";
|
|
21
|
+
import plum_default from "./species/plum.js";
|
|
22
|
+
import red_oak_default from "./species/red-oak.js";
|
|
23
|
+
import redwood_default from "./species/redwood.js";
|
|
24
|
+
import sequoia_default from "./species/sequoia.js";
|
|
25
|
+
import spruce_default from "./species/spruce.js";
|
|
26
|
+
import teak_default from "./species/teak.js";
|
|
27
|
+
import walnut_default from "./species/walnut.js";
|
|
28
|
+
import white_oak_default from "./species/white-oak.js";
|
|
29
|
+
// src/species/loaders.ts
|
|
30
|
+
/** Dynamic import of each Species (its own chunk in the build), by id. */
|
|
31
|
+
var SPECIES_LOADERS = {
|
|
32
|
+
"almond": () => import("./species/almond.js"),
|
|
33
|
+
"apple": () => import("./species/apple.js"),
|
|
34
|
+
"ash": () => import("./species/ash.js"),
|
|
35
|
+
"beech": () => import("./species/beech.js"),
|
|
36
|
+
"birch": () => import("./species/birch.js"),
|
|
37
|
+
"cedar": () => import("./species/cedar.js"),
|
|
38
|
+
"cherry": () => import("./species/cherry.js"),
|
|
39
|
+
"chestnut": () => import("./species/chestnut.js"),
|
|
40
|
+
"douglas-fir": () => import("./species/douglas-fir.js"),
|
|
41
|
+
"elm": () => import("./species/elm.js"),
|
|
42
|
+
"hemlock": () => import("./species/hemlock.js"),
|
|
43
|
+
"hickory": () => import("./species/hickory.js"),
|
|
44
|
+
"juniper": () => import("./species/juniper.js"),
|
|
45
|
+
"mahogany": () => import("./species/mahogany.js"),
|
|
46
|
+
"maple": () => import("./species/maple.js"),
|
|
47
|
+
"oak": () => import("./species/oak.js"),
|
|
48
|
+
"olive": () => import("./species/olive.js"),
|
|
49
|
+
"peach": () => import("./species/peach.js"),
|
|
50
|
+
"pear": () => import("./species/pear.js"),
|
|
51
|
+
"pine": () => import("./species/pine.js"),
|
|
52
|
+
"plum": () => import("./species/plum.js"),
|
|
53
|
+
"red-oak": () => import("./species/red-oak.js"),
|
|
54
|
+
"redwood": () => import("./species/redwood.js"),
|
|
55
|
+
"sequoia": () => import("./species/sequoia.js"),
|
|
56
|
+
"spruce": () => import("./species/spruce.js"),
|
|
57
|
+
"teak": () => import("./species/teak.js"),
|
|
58
|
+
"walnut": () => import("./species/walnut.js"),
|
|
59
|
+
"white-oak": () => import("./species/white-oak.js")
|
|
60
|
+
};
|
|
61
|
+
// src/species/catalog.ts
|
|
62
|
+
/** Almond (broadleaf). */
|
|
63
|
+
var almond = almond_default;
|
|
64
|
+
/** Apple (broadleaf). */
|
|
65
|
+
var apple = apple_default;
|
|
66
|
+
/** Ash (broadleaf). */
|
|
67
|
+
var ash = ash_default;
|
|
68
|
+
/** Beech (broadleaf). */
|
|
69
|
+
var beech = beech_default;
|
|
70
|
+
/** Birch (broadleaf). */
|
|
71
|
+
var birch = birch_default;
|
|
72
|
+
/** Cedar (conifer). */
|
|
73
|
+
var cedar = cedar_default;
|
|
74
|
+
/** Cherry (broadleaf). */
|
|
75
|
+
var cherry = cherry_default;
|
|
76
|
+
/** Chestnut (broadleaf). */
|
|
77
|
+
var chestnut = chestnut_default;
|
|
78
|
+
/** Douglas Fir (conifer). */
|
|
79
|
+
var douglasFir = douglas_fir_default;
|
|
80
|
+
/** Elm (broadleaf). */
|
|
81
|
+
var elm = elm_default;
|
|
82
|
+
/** Hemlock (conifer). */
|
|
83
|
+
var hemlock = hemlock_default;
|
|
84
|
+
/** Hickory (broadleaf). */
|
|
85
|
+
var hickory = hickory_default;
|
|
86
|
+
/** Juniper (conifer). */
|
|
87
|
+
var juniper = juniper_default;
|
|
88
|
+
/** Mahogany (broadleaf). */
|
|
89
|
+
var mahogany = mahogany_default;
|
|
90
|
+
/** Maple (broadleaf). */
|
|
91
|
+
var maple = maple_default;
|
|
92
|
+
/** Oak (broadleaf). */
|
|
93
|
+
var oak = oak_default;
|
|
94
|
+
/** Olive (broadleaf). */
|
|
95
|
+
var olive = olive_default;
|
|
96
|
+
/** Peach (broadleaf). */
|
|
97
|
+
var peach = peach_default;
|
|
98
|
+
/** Pear (broadleaf). */
|
|
99
|
+
var pear = pear_default;
|
|
100
|
+
/** Pine (conifer). */
|
|
101
|
+
var pine = pine_default;
|
|
102
|
+
/** Plum (broadleaf). */
|
|
103
|
+
var plum = plum_default;
|
|
104
|
+
/** Red Oak (broadleaf). */
|
|
105
|
+
var redOak = red_oak_default;
|
|
106
|
+
/** Redwood (conifer). */
|
|
107
|
+
var redwood = redwood_default;
|
|
108
|
+
/** Sequoia (conifer). */
|
|
109
|
+
var sequoia = sequoia_default;
|
|
110
|
+
/** Spruce (conifer). */
|
|
111
|
+
var spruce = spruce_default;
|
|
112
|
+
/** Teak (broadleaf). */
|
|
113
|
+
var teak = teak_default;
|
|
114
|
+
/** Walnut (broadleaf). */
|
|
115
|
+
var walnut = walnut_default;
|
|
116
|
+
/** White Oak (broadleaf). */
|
|
117
|
+
var whiteOak = white_oak_default;
|
|
118
|
+
/** Every Species by id (for pickers that list them all; importing one Species by name bundles only that one). */
|
|
119
|
+
var SPECIES_BY_NAME = {
|
|
120
|
+
"almond": almond,
|
|
121
|
+
"apple": apple,
|
|
122
|
+
"ash": ash,
|
|
123
|
+
"beech": beech,
|
|
124
|
+
"birch": birch,
|
|
125
|
+
"cedar": cedar,
|
|
126
|
+
"cherry": cherry,
|
|
127
|
+
"chestnut": chestnut,
|
|
128
|
+
"douglas-fir": douglasFir,
|
|
129
|
+
"elm": elm,
|
|
130
|
+
"hemlock": hemlock,
|
|
131
|
+
"hickory": hickory,
|
|
132
|
+
"juniper": juniper,
|
|
133
|
+
"mahogany": mahogany,
|
|
134
|
+
"maple": maple,
|
|
135
|
+
"oak": oak,
|
|
136
|
+
"olive": olive,
|
|
137
|
+
"peach": peach,
|
|
138
|
+
"pear": pear,
|
|
139
|
+
"pine": pine,
|
|
140
|
+
"plum": plum,
|
|
141
|
+
"red-oak": redOak,
|
|
142
|
+
"redwood": redwood,
|
|
143
|
+
"sequoia": sequoia,
|
|
144
|
+
"spruce": spruce,
|
|
145
|
+
"teak": teak,
|
|
146
|
+
"walnut": walnut,
|
|
147
|
+
"white-oak": whiteOak
|
|
148
|
+
};
|
|
149
|
+
// src/species/index.ts
|
|
150
|
+
/** Ids of all Species in the collection (kebab-case), sorted. Pure, so an app importing one Species drops the loaders. */
|
|
151
|
+
var SPECIES_NAMES = /* @__PURE__ */ Object.keys(SPECIES_LOADERS);
|
|
152
|
+
/** Downloads a Species (dynamic import) and resolves to it. Rejects for an unknown id. */
|
|
153
|
+
async function loadSpecies(id) {
|
|
154
|
+
const load = Object.hasOwn(SPECIES_LOADERS, id) ? SPECIES_LOADERS[id] : void 0;
|
|
155
|
+
if (!load) throw new Error(`Unknown tree.js Species "${id}". Species: ${SPECIES_NAMES.join(", ")}.`);
|
|
156
|
+
return (await load()).default;
|
|
157
|
+
}
|
|
158
|
+
export { SPECIES_BY_NAME, SPECIES_NAMES, almond, apple, ash, beech, birch, cedar, cherry, chestnut, douglasFir, elm, hemlock, hickory, juniper, loadSpecies, mahogany, maple, oak, olive, peach, pear, pine, plum, redOak, redwood, sequoia, spruce, teak, walnut, whiteOak };
|
|
159
|
+
|
|
160
|
+
//# sourceMappingURL=species.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"species.js","names":["almondData","appleData","ashData","beechData","birchData","cedarData","cherryData","chestnutData","douglasFirData","elmData","hemlockData","hickoryData","juniperData","mahoganyData","mapleData","oakData","oliveData","peachData","pearData","pineData","plumData","redOakData","redwoodData","sequoiaData","spruceData","teakData","walnutData","whiteOakData"],"sources":["../src/species/loaders.ts","../src/species/catalog.ts","../src/species/index.ts"],"sourcesContent":["// GENERATED by scripts/generate-species.mjs from src/species/data/*.json; do not edit, run `npm run species`.\n\n/** Id of a Species in the collection (kebab-case), e.g. `'oak'`. */\nexport type SpeciesName =\n | 'almond'\n | 'apple'\n | 'ash'\n | 'beech'\n | 'birch'\n | 'cedar'\n | 'cherry'\n | 'chestnut'\n | 'douglas-fir'\n | 'elm'\n | 'hemlock'\n | 'hickory'\n | 'juniper'\n | 'mahogany'\n | 'maple'\n | 'oak'\n | 'olive'\n | 'peach'\n | 'pear'\n | 'pine'\n | 'plum'\n | 'red-oak'\n | 'redwood'\n | 'sequoia'\n | 'spruce'\n | 'teak'\n | 'walnut'\n | 'white-oak';\n\n/** Dynamic import of each Species (its own chunk in the build), by id. */\nexport const SPECIES_LOADERS: Record<SpeciesName, () => Promise<{ default: unknown }>> = {\n 'almond': () => import('./data/almond.json'),\n 'apple': () => import('./data/apple.json'),\n 'ash': () => import('./data/ash.json'),\n 'beech': () => import('./data/beech.json'),\n 'birch': () => import('./data/birch.json'),\n 'cedar': () => import('./data/cedar.json'),\n 'cherry': () => import('./data/cherry.json'),\n 'chestnut': () => import('./data/chestnut.json'),\n 'douglas-fir': () => import('./data/douglas-fir.json'),\n 'elm': () => import('./data/elm.json'),\n 'hemlock': () => import('./data/hemlock.json'),\n 'hickory': () => import('./data/hickory.json'),\n 'juniper': () => import('./data/juniper.json'),\n 'mahogany': () => import('./data/mahogany.json'),\n 'maple': () => import('./data/maple.json'),\n 'oak': () => import('./data/oak.json'),\n 'olive': () => import('./data/olive.json'),\n 'peach': () => import('./data/peach.json'),\n 'pear': () => import('./data/pear.json'),\n 'pine': () => import('./data/pine.json'),\n 'plum': () => import('./data/plum.json'),\n 'red-oak': () => import('./data/red-oak.json'),\n 'redwood': () => import('./data/redwood.json'),\n 'sequoia': () => import('./data/sequoia.json'),\n 'spruce': () => import('./data/spruce.json'),\n 'teak': () => import('./data/teak.json'),\n 'walnut': () => import('./data/walnut.json'),\n 'white-oak': () => import('./data/white-oak.json'),\n};\n","// GENERATED by scripts/generate-species.mjs from src/species/data/*.json; do not edit, run `npm run species`.\n// One named export per Species, each its own module (tree-shakeable).\nimport type { SpeciesName } from './loaders';\nimport type { SpeciesDefinition } from './types';\nimport almondData from './data/almond.json';\nimport appleData from './data/apple.json';\nimport ashData from './data/ash.json';\nimport beechData from './data/beech.json';\nimport birchData from './data/birch.json';\nimport cedarData from './data/cedar.json';\nimport cherryData from './data/cherry.json';\nimport chestnutData from './data/chestnut.json';\nimport douglasFirData from './data/douglas-fir.json';\nimport elmData from './data/elm.json';\nimport hemlockData from './data/hemlock.json';\nimport hickoryData from './data/hickory.json';\nimport juniperData from './data/juniper.json';\nimport mahoganyData from './data/mahogany.json';\nimport mapleData from './data/maple.json';\nimport oakData from './data/oak.json';\nimport oliveData from './data/olive.json';\nimport peachData from './data/peach.json';\nimport pearData from './data/pear.json';\nimport pineData from './data/pine.json';\nimport plumData from './data/plum.json';\nimport redOakData from './data/red-oak.json';\nimport redwoodData from './data/redwood.json';\nimport sequoiaData from './data/sequoia.json';\nimport spruceData from './data/spruce.json';\nimport teakData from './data/teak.json';\nimport walnutData from './data/walnut.json';\nimport whiteOakData from './data/white-oak.json';\n\n/** Almond (broadleaf). */\nexport const almond = almondData as SpeciesDefinition;\n\n/** Apple (broadleaf). */\nexport const apple = appleData as SpeciesDefinition;\n\n/** Ash (broadleaf). */\nexport const ash = ashData as SpeciesDefinition;\n\n/** Beech (broadleaf). */\nexport const beech = beechData as SpeciesDefinition;\n\n/** Birch (broadleaf). */\nexport const birch = birchData as SpeciesDefinition;\n\n/** Cedar (conifer). */\nexport const cedar = cedarData as SpeciesDefinition;\n\n/** Cherry (broadleaf). */\nexport const cherry = cherryData as SpeciesDefinition;\n\n/** Chestnut (broadleaf). */\nexport const chestnut = chestnutData as SpeciesDefinition;\n\n/** Douglas Fir (conifer). */\nexport const douglasFir = douglasFirData as SpeciesDefinition;\n\n/** Elm (broadleaf). */\nexport const elm = elmData as SpeciesDefinition;\n\n/** Hemlock (conifer). */\nexport const hemlock = hemlockData as SpeciesDefinition;\n\n/** Hickory (broadleaf). */\nexport const hickory = hickoryData as SpeciesDefinition;\n\n/** Juniper (conifer). */\nexport const juniper = juniperData as SpeciesDefinition;\n\n/** Mahogany (broadleaf). */\nexport const mahogany = mahoganyData as SpeciesDefinition;\n\n/** Maple (broadleaf). */\nexport const maple = mapleData as SpeciesDefinition;\n\n/** Oak (broadleaf). */\nexport const oak = oakData as SpeciesDefinition;\n\n/** Olive (broadleaf). */\nexport const olive = oliveData as SpeciesDefinition;\n\n/** Peach (broadleaf). */\nexport const peach = peachData as SpeciesDefinition;\n\n/** Pear (broadleaf). */\nexport const pear = pearData as SpeciesDefinition;\n\n/** Pine (conifer). */\nexport const pine = pineData as SpeciesDefinition;\n\n/** Plum (broadleaf). */\nexport const plum = plumData as SpeciesDefinition;\n\n/** Red Oak (broadleaf). */\nexport const redOak = redOakData as SpeciesDefinition;\n\n/** Redwood (conifer). */\nexport const redwood = redwoodData as SpeciesDefinition;\n\n/** Sequoia (conifer). */\nexport const sequoia = sequoiaData as SpeciesDefinition;\n\n/** Spruce (conifer). */\nexport const spruce = spruceData as SpeciesDefinition;\n\n/** Teak (broadleaf). */\nexport const teak = teakData as SpeciesDefinition;\n\n/** Walnut (broadleaf). */\nexport const walnut = walnutData as SpeciesDefinition;\n\n/** White Oak (broadleaf). */\nexport const whiteOak = whiteOakData as SpeciesDefinition;\n\n/** Every Species by id (for pickers that list them all; importing one Species by name bundles only that one). */\nexport const SPECIES_BY_NAME: Readonly<Record<SpeciesName, SpeciesDefinition>> = {\n 'almond': almond,\n 'apple': apple,\n 'ash': ash,\n 'beech': beech,\n 'birch': birch,\n 'cedar': cedar,\n 'cherry': cherry,\n 'chestnut': chestnut,\n 'douglas-fir': douglasFir,\n 'elm': elm,\n 'hemlock': hemlock,\n 'hickory': hickory,\n 'juniper': juniper,\n 'mahogany': mahogany,\n 'maple': maple,\n 'oak': oak,\n 'olive': olive,\n 'peach': peach,\n 'pear': pear,\n 'pine': pine,\n 'plum': plum,\n 'red-oak': redOak,\n 'redwood': redwood,\n 'sequoia': sequoia,\n 'spruce': spruce,\n 'teak': teak,\n 'walnut': walnut,\n 'white-oak': whiteOak,\n};\n","// @casmo/tree.js/species: the Species collection (ADR 0005). One named camelCase export per Species\n// (tree-shakeable: each Species is its own module), `loadSpecies(id)` for picking one at runtime, and\n// `SPECIES_NAMES`. Every Species is also shipped as plain JSON: `@casmo/tree.js/species/<id>.json`.\n// import { oak } from '@casmo/tree.js/species';\n// createTree(lowPoly.apply(oak), { seed: 42 });\n// The data lives in src/species/data/<id>.json; catalog.ts and loaders.ts are generated from it\n// (`npm run species`).\nimport { SPECIES_LOADERS, type SpeciesName } from './loaders';\nimport type { SpeciesDefinition } from './types';\n\nexport * from './catalog';\nexport type { SpeciesName };\nexport type * from './types';\n\n/** Ids of all Species in the collection (kebab-case), sorted. Pure, so an app importing one Species drops the loaders. */\nexport const SPECIES_NAMES = /* @__PURE__ */ Object.keys(SPECIES_LOADERS) as SpeciesName[];\n\n/** Downloads a Species (dynamic import) and resolves to it. Rejects for an unknown id. */\nexport async function loadSpecies(id: SpeciesName): Promise<SpeciesDefinition> {\n const load = Object.hasOwn(SPECIES_LOADERS, id) ? SPECIES_LOADERS[id] : undefined;\n if (!load) throw new Error(`Unknown tree.js Species \"${id}\". Species: ${SPECIES_NAMES.join(', ')}.`);\n return (await load()).default as SpeciesDefinition;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAa,kBAA4E;CACvF,gBAAgB,OAAO;CACvB,eAAe,OAAO;CACtB,aAAa,OAAO;CACpB,eAAe,OAAO;CACtB,eAAe,OAAO;CACtB,eAAe,OAAO;CACtB,gBAAgB,OAAO;CACvB,kBAAkB,OAAO;CACzB,qBAAqB,OAAO;CAC5B,aAAa,OAAO;CACpB,iBAAiB,OAAO;CACxB,iBAAiB,OAAO;CACxB,iBAAiB,OAAO;CACxB,kBAAkB,OAAO;CACzB,eAAe,OAAO;CACtB,aAAa,OAAO;CACpB,eAAe,OAAO;CACtB,eAAe,OAAO;CACtB,cAAc,OAAO;CACrB,cAAc,OAAO;CACrB,cAAc,OAAO;CACrB,iBAAiB,OAAO;CACxB,iBAAiB,OAAO;CACxB,iBAAiB,OAAO;CACxB,gBAAgB,OAAO;CACvB,cAAc,OAAO;CACrB,gBAAgB,OAAO;CACvB,mBAAmB,OAAO;AAC5B;;;AC7BA,IAAa,SAASA;;AAGtB,IAAa,QAAQC;;AAGrB,IAAa,MAAMC;;AAGnB,IAAa,QAAQC;;AAGrB,IAAa,QAAQC;;AAGrB,IAAa,QAAQC;;AAGrB,IAAa,SAASC;;AAGtB,IAAa,WAAWC;;AAGxB,IAAa,aAAaC;;AAG1B,IAAa,MAAMC;;AAGnB,IAAa,UAAUC;;AAGvB,IAAa,UAAUC;;AAGvB,IAAa,UAAUC;;AAGvB,IAAa,WAAWC;;AAGxB,IAAa,QAAQC;;AAGrB,IAAa,MAAMC;;AAGnB,IAAa,QAAQC;;AAGrB,IAAa,QAAQC;;AAGrB,IAAa,OAAOC;;AAGpB,IAAa,OAAOC;;AAGpB,IAAa,OAAOC;;AAGpB,IAAa,SAASC;;AAGtB,IAAa,UAAUC;;AAGvB,IAAa,UAAUC;;AAGvB,IAAa,SAASC;;AAGtB,IAAa,OAAOC;;AAGpB,IAAa,SAASC;;AAGtB,IAAa,WAAWC;;AAGxB,IAAa,kBAAoE;CAC/E,UAAU;CACV,SAAS;CACT,OAAO;CACP,SAAS;CACT,SAAS;CACT,SAAS;CACT,UAAU;CACV,YAAY;CACZ,eAAe;CACf,OAAO;CACP,WAAW;CACX,WAAW;CACX,WAAW;CACX,YAAY;CACZ,SAAS;CACT,OAAO;CACP,SAAS;CACT,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,WAAW;CACX,WAAW;CACX,UAAU;CACV,QAAQ;CACR,UAAU;CACV,aAAa;AACf;;;ACpIA,IAAa,gBAAgC,uBAAO,KAAK,eAAe;;AAGxE,eAAsB,YAAY,IAA6C;CAC7E,MAAM,OAAO,OAAO,OAAO,iBAAiB,EAAE,IAAI,gBAAgB,MAAM,KAAA;CACxE,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,4BAA4B,GAAG,cAAc,cAAc,KAAK,IAAI,EAAE,EAAE;CACnG,QAAQ,MAAM,KAAK,EAAA,CAAG;AACxB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type DefinitionPatch } from '../definition/parse';
|
|
2
|
+
import { type TreeDefinition, type TreeDefinitionInput } from '../definition/types';
|
|
3
|
+
import type { SpeciesDefinition } from '../species/types';
|
|
4
|
+
import { type StyleName } from './names';
|
|
5
|
+
/** What `Style.apply` accepts: a Species, or a Tree Definition to re-style. */
|
|
6
|
+
export type StyleSource = SpeciesDefinition | TreeDefinition | TreeDefinitionInput;
|
|
7
|
+
/**
|
|
8
|
+
* Applies a built-in Style's look to a Species or a Tree Definition (see `TreeStyle.apply`).
|
|
9
|
+
* Pure: never mutates its inputs.
|
|
10
|
+
*/
|
|
11
|
+
export declare function applyStyle(name: StyleName, source: StyleSource, overrides?: DefinitionPatch): TreeDefinition;
|
|
12
|
+
//# sourceMappingURL=apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/styles/apply.ts"],"names":[],"mappings":"AAGA,OAAO,EAAqC,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAOL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAyB,iBAAiB,EAA4B,MAAM,kBAAkB,CAAC;AAC3G,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AA0EvE,+EAA+E;AAC/E,MAAM,MAAM,WAAW,GAAG,iBAAiB,GAAG,cAAc,GAAG,mBAAmB,CAAC;AA4EnF;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,eAAe,GAAG,cAAc,CAI5G"}
|
|
@@ -7,7 +7,7 @@ import type { TreeStyle } from '../types';
|
|
|
7
7
|
export declare const broadleaf: TreeDefinition;
|
|
8
8
|
/**
|
|
9
9
|
* Low-poly conifer: a straight trunk with drooping whorls that shrink towards the top
|
|
10
|
-
* (
|
|
10
|
+
* (a cone Crown Shape), covered in faceted needle tufts. Evergreen Season Profile: it only darkens a little in winter.
|
|
11
11
|
*/
|
|
12
12
|
export declare const conifer: TreeDefinition;
|
|
13
13
|
/** The low-poly Style. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/styles/low-poly/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/styles/low-poly/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,cAkBvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,cAmBrB,CAAC;AAEF,0BAA0B;AAC1B,QAAA,MAAM,OAAO,EAAE,SAA6H,CAAC;AAC7I,eAAe,OAAO,CAAC"}
|
package/dist/styles/low-poly.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import "../
|
|
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/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:
|
|
10
|
+
schemaVersion: 3,
|
|
10
11
|
name: "Low-poly broadleaf",
|
|
11
|
-
form: "broadleaf",
|
|
12
12
|
trunk: {
|
|
13
13
|
length: 3,
|
|
14
14
|
radius: .22,
|
|
@@ -87,12 +87,11 @@ var broadleaf = {
|
|
|
87
87
|
};
|
|
88
88
|
/**
|
|
89
89
|
* Low-poly conifer: a straight trunk with drooping whorls that shrink towards the top
|
|
90
|
-
* (
|
|
90
|
+
* (a cone Crown Shape), covered in faceted needle tufts. Evergreen Season Profile: it only darkens a little in winter.
|
|
91
91
|
*/
|
|
92
92
|
var conifer = {
|
|
93
|
-
schemaVersion:
|
|
93
|
+
schemaVersion: 3,
|
|
94
94
|
name: "Low-poly conifer",
|
|
95
|
-
form: "conifer",
|
|
96
95
|
trunk: {
|
|
97
96
|
length: 5,
|
|
98
97
|
radius: .2,
|
|
@@ -116,7 +115,8 @@ var conifer = {
|
|
|
116
115
|
sides: 3,
|
|
117
116
|
sections: 2,
|
|
118
117
|
bend: .05,
|
|
119
|
-
gravity: -.08
|
|
118
|
+
gravity: -.08,
|
|
119
|
+
lengthProfile: coneCurve(.18)
|
|
120
120
|
}],
|
|
121
121
|
leaves: {
|
|
122
122
|
count: 7,
|
|
@@ -158,7 +158,8 @@ var conifer = {
|
|
|
158
158
|
var lowPoly = {
|
|
159
159
|
name: "low-poly",
|
|
160
160
|
broadleaf,
|
|
161
|
-
conifer
|
|
161
|
+
conifer,
|
|
162
|
+
apply: (source, overrides) => applyStyle("low-poly", source, overrides)
|
|
162
163
|
};
|
|
163
164
|
export { broadleaf, conifer, lowPoly as default };
|
|
164
165
|
|
|
@@ -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 (
|
|
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 },\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 },\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-poly', broadleaf, conifer, apply: (source, overrides) => applyStyle('low-poly', source, overrides) };\nexport default lowPoly;\n"],"mappings":";;;;;;;;AAYA,IAAa,YAA4B;CACvC,eAAA;CACA,MAAM;CACN,OAAO;EAAE,QAAQ;EAAG,QAAQ;EAAM,OAAO;EAAK,OAAO;EAAG,UAAU;EAAG,iBAAiB;EAAM,MAAM;CAAK;CACvG,UAAU,CACR;EAAE,OAAO;EAAG,OAAO;EAAK,KAAK;EAAM,OAAO;EAAI,gBAAgB;EAAK,QAAQ;EAAO,QAAQ;EAAK,iBAAiB;EAAK,QAAQ;EAAM,OAAO;EAAM,OAAO;EAAG,UAAU;EAAG,MAAM;EAAM,SAAS;CAAK,GACjM;EAAE,OAAO;EAAG,OAAO;EAAM,KAAK;EAAG,OAAO;EAAI,gBAAgB;EAAM,QAAQ;EAAK,QAAQ;EAAM,iBAAiB;EAAM,QAAQ;EAAK,OAAO;EAAK,OAAO;EAAG,UAAU;EAAG,MAAM;EAAK,SAAS;CAAI,CAC9L;CACA,QAAQ;EAAE,OAAO;EAAG,OAAO;EAAS,MAAM;EAAG,eAAe;EAAM,OAAO;EAAM,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;EAAM,UAAU;EAAK,QAAQ;EAAK,WAAW;CAAE;CAC9D,WAAW;EAAE,OAAO;EAAM,QAAQ;EAAK,QAAQ;CAAK;CACpD,SAAS,CAAC;AACZ;;;;;AAMA,IAAa,UAA0B;CACrC,eAAA;CACA,MAAM;CACN,OAAO;EAAE,QAAQ;EAAG,QAAQ;EAAK,OAAO;EAAM,OAAO;EAAG,UAAU;EAAG,iBAAiB;EAAM,MAAM;CAAK;CACvG,UAAU,CACR;EAAE,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,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
|
-
|
|
4
|
-
export
|
|
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
|
-
* (
|
|
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":"
|
|
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"}
|
package/dist/styles/realistic.js
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import "../
|
|
1
|
+
import { m as coneCurve } from "../names-C6-wuJ29.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-CcodnAbs.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:
|
|
10
|
+
schemaVersion: 3,
|
|
17
11
|
name: "Realistic broadleaf",
|
|
18
|
-
form: "broadleaf",
|
|
19
12
|
trunk: {
|
|
20
13
|
length: 5,
|
|
21
14
|
radius: .28,
|
|
@@ -113,12 +106,11 @@ var broadleaf = {
|
|
|
113
106
|
};
|
|
114
107
|
/**
|
|
115
108
|
* Realistic conifer: a straight trunk with dense, drooping whorls that shrink towards the top
|
|
116
|
-
* (
|
|
109
|
+
* (a cone Crown Shape), covered in needle-spray cards. Evergreen Season Profile.
|
|
117
110
|
*/
|
|
118
111
|
var conifer = {
|
|
119
|
-
schemaVersion:
|
|
112
|
+
schemaVersion: 3,
|
|
120
113
|
name: "Realistic conifer",
|
|
121
|
-
form: "conifer",
|
|
122
114
|
trunk: {
|
|
123
115
|
length: 7,
|
|
124
116
|
radius: .24,
|
|
@@ -142,7 +134,8 @@ var conifer = {
|
|
|
142
134
|
sides: 5,
|
|
143
135
|
sections: 4,
|
|
144
136
|
bend: .08,
|
|
145
|
-
gravity: .12
|
|
137
|
+
gravity: .12,
|
|
138
|
+
lengthProfile: coneCurve(.12)
|
|
146
139
|
}, {
|
|
147
140
|
count: 6,
|
|
148
141
|
start: .15,
|
|
@@ -199,8 +192,9 @@ var conifer = {
|
|
|
199
192
|
var realistic = {
|
|
200
193
|
name: "realistic",
|
|
201
194
|
broadleaf,
|
|
202
|
-
conifer
|
|
195
|
+
conifer,
|
|
196
|
+
apply: (source, overrides) => applyStyle("realistic", source, overrides)
|
|
203
197
|
};
|
|
204
|
-
export { TEXTURES, broadleaf, conifer, realistic as default };
|
|
198
|
+
export { BARK_TEXTURES, LEAF_TEXTURES, TEXTURES, broadleaf, conifer, realistic as default };
|
|
205
199
|
|
|
206
200
|
//# sourceMappingURL=realistic.js.map
|