@casmo/tree.js 0.2.0 → 0.4.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 +392 -1
- package/dist/{apply-CcodnAbs.js → apply-Cio2t7CZ.js} +51 -16
- package/dist/apply-Cio2t7CZ.js.map +1 -0
- package/dist/bake/index.d.ts +43 -4
- package/dist/bake/index.d.ts.map +1 -1
- package/dist/definition/defaults.d.ts +9 -1
- package/dist/definition/defaults.d.ts.map +1 -1
- package/dist/definition/index.d.ts +2 -2
- package/dist/definition/index.d.ts.map +1 -1
- package/dist/definition/schema.d.ts.map +1 -1
- package/dist/definition/types.d.ts +86 -0
- package/dist/definition/types.d.ts.map +1 -1
- package/dist/effects/effects.d.ts +51 -6
- package/dist/effects/effects.d.ts.map +1 -1
- package/dist/effects/glow.d.ts +5 -0
- package/dist/effects/glow.d.ts.map +1 -1
- package/dist/effects/grade.d.ts +3 -0
- package/dist/effects/grade.d.ts.map +1 -1
- package/dist/effects/highlight.d.ts +35 -0
- package/dist/effects/highlight.d.ts.map +1 -0
- package/dist/effects/index.d.ts +5 -1
- package/dist/effects/index.d.ts.map +1 -1
- package/dist/effects/inner-lines.d.ts +39 -0
- package/dist/effects/inner-lines.d.ts.map +1 -0
- package/dist/effects/live.d.ts +12 -0
- package/dist/effects/live.d.ts.map +1 -0
- package/dist/effects/mask.d.ts +23 -11
- package/dist/effects/mask.d.ts.map +1 -1
- package/dist/effects/outline.d.ts +12 -0
- package/dist/effects/outline.d.ts.map +1 -1
- package/dist/effects/pass.d.ts +27 -0
- package/dist/effects/pass.d.ts.map +1 -0
- package/dist/effects/screen.d.ts +31 -0
- package/dist/effects/screen.d.ts.map +1 -0
- package/dist/effects/suggested.d.ts +5 -0
- package/dist/effects/suggested.d.ts.map +1 -1
- package/dist/effects/tree-id.d.ts +50 -0
- package/dist/effects/tree-id.d.ts.map +1 -0
- package/dist/effects.js +772 -57
- package/dist/effects.js.map +1 -1
- package/dist/forest/Forest.d.ts +29 -1
- package/dist/forest/Forest.d.ts.map +1 -1
- package/dist/forest/nodes.d.ts +2 -0
- package/dist/forest/nodes.d.ts.map +1 -1
- package/dist/{forest-DTrD8puH.js → forest-lg61rhKM.js} +1125 -191
- package/dist/forest-lg61rhKM.js.map +1 -0
- package/dist/generator/crown.d.ts +28 -0
- package/dist/generator/crown.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 +2 -1
- package/dist/generator/index.d.ts.map +1 -1
- package/dist/generator/mesh.d.ts +10 -2
- package/dist/generator/mesh.d.ts.map +1 -1
- package/dist/generator/occlusion.d.ts +8 -0
- package/dist/generator/occlusion.d.ts.map +1 -0
- package/dist/generator/roots.d.ts +16 -0
- package/dist/generator/roots.d.ts.map +1 -0
- package/dist/generator/trunk.d.ts +8 -0
- package/dist/generator/trunk.d.ts.map +1 -1
- package/dist/generator/types.d.ts +27 -1
- package/dist/generator/types.d.ts.map +1 -1
- package/dist/growth/index.d.ts +1 -1
- package/dist/growth/index.d.ts.map +1 -1
- package/dist/growth/tsl.d.ts +2 -0
- package/dist/growth/tsl.d.ts.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +234 -28
- package/dist/index.js.map +1 -1
- package/dist/materials/crown-nodes.d.ts +20 -0
- package/dist/materials/crown-nodes.d.ts.map +1 -0
- package/dist/materials/crown-normals.d.ts +17 -0
- package/dist/materials/crown-normals.d.ts.map +1 -0
- package/dist/materials/ground-tint.d.ts +13 -0
- package/dist/materials/ground-tint.d.ts.map +1 -0
- package/dist/materials/index.d.ts +7 -1
- package/dist/materials/index.d.ts.map +1 -1
- package/dist/materials/leaf-translucency-model.d.ts +14 -0
- package/dist/materials/leaf-translucency-model.d.ts.map +1 -0
- package/dist/materials/leaf-translucency.d.ts +73 -0
- package/dist/materials/leaf-translucency.d.ts.map +1 -0
- package/dist/materials/material-features.d.ts +43 -0
- package/dist/materials/material-features.d.ts.map +1 -0
- package/dist/materials/occlusion.d.ts +10 -0
- package/dist/materials/occlusion.d.ts.map +1 -0
- package/dist/materials/toon.d.ts +18 -1
- package/dist/materials/toon.d.ts.map +1 -1
- package/dist/{names-C6-wuJ29.js → names-BE9he6CS.js} +133 -9
- package/dist/names-BE9he6CS.js.map +1 -0
- package/dist/react.js +1 -1
- package/dist/species/almond.js +12 -2
- package/dist/species/almond.json +10 -1
- package/dist/species/apple.js +12 -2
- package/dist/species/apple.json +10 -1
- package/dist/species/ash.js +12 -2
- package/dist/species/ash.json +10 -1
- package/dist/species/beech.js +12 -2
- package/dist/species/beech.json +10 -1
- package/dist/species/birch.js +12 -2
- package/dist/species/birch.json +10 -1
- package/dist/species/cedar.js +12 -2
- package/dist/species/cedar.json +10 -1
- package/dist/species/cherry.js +12 -2
- package/dist/species/cherry.json +10 -1
- package/dist/species/chestnut.js +12 -2
- package/dist/species/chestnut.json +10 -1
- package/dist/species/douglas-fir.js +12 -2
- package/dist/species/douglas-fir.json +10 -1
- package/dist/species/elm.js +12 -2
- package/dist/species/elm.json +10 -1
- package/dist/species/hemlock.js +12 -2
- package/dist/species/hemlock.json +10 -1
- package/dist/species/hickory.js +12 -2
- package/dist/species/hickory.json +10 -1
- package/dist/species/juniper.js +12 -2
- package/dist/species/juniper.json +10 -1
- package/dist/species/mahogany.js +12 -2
- package/dist/species/mahogany.json +10 -1
- package/dist/species/maple.js +12 -2
- package/dist/species/maple.json +10 -1
- package/dist/species/oak.js +12 -2
- package/dist/species/oak.json +10 -1
- package/dist/species/olive.js +12 -2
- package/dist/species/olive.json +10 -1
- package/dist/species/peach.js +12 -2
- package/dist/species/peach.json +10 -1
- package/dist/species/pear.js +12 -2
- package/dist/species/pear.json +10 -1
- package/dist/species/pine.js +12 -2
- package/dist/species/pine.json +10 -1
- package/dist/species/plum.js +12 -2
- package/dist/species/plum.json +10 -1
- package/dist/species/red-oak.js +12 -2
- package/dist/species/red-oak.json +10 -1
- package/dist/species/redwood.js +12 -2
- package/dist/species/redwood.json +10 -1
- package/dist/species/sequoia.js +12 -2
- package/dist/species/sequoia.json +10 -1
- package/dist/species/spruce.js +12 -2
- package/dist/species/spruce.json +10 -1
- package/dist/species/teak.js +12 -2
- package/dist/species/teak.json +10 -1
- package/dist/species/types.d.ts +7 -3
- package/dist/species/types.d.ts.map +1 -1
- package/dist/species/walnut.js +12 -2
- package/dist/species/walnut.json +10 -1
- package/dist/species/white-oak.js +12 -2
- package/dist/species/white-oak.json +10 -1
- package/dist/styles/apply.d.ts.map +1 -1
- package/dist/styles/low-poly.js +6 -4
- package/dist/styles/low-poly.js.map +1 -1
- package/dist/styles/material-features.d.ts +27 -0
- package/dist/styles/material-features.d.ts.map +1 -0
- package/dist/styles/realistic.js +6 -4
- package/dist/styles/realistic.js.map +1 -1
- package/dist/styles/stylized.js +6 -4
- package/dist/styles/stylized.js.map +1 -1
- package/dist/tree/Tree.d.ts +28 -1
- package/dist/tree/Tree.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/apply-CcodnAbs.js.map +0 -1
- package/dist/forest-DTrD8puH.js.map +0 -1
- package/dist/names-C6-wuJ29.js.map +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { LightingModelDirectInput, Node, NodeBuilder } from 'three/webgpu';
|
|
2
|
+
import type { CrownVolume } from '../generator';
|
|
3
|
+
/** The diffuse parts of the reflected light a lighting model adds to (RGB). */
|
|
4
|
+
export interface DiffuseLight {
|
|
5
|
+
directDiffuse: Node<'vec3'>;
|
|
6
|
+
indirectDiffuse: Node<'vec3'>;
|
|
7
|
+
}
|
|
8
|
+
/** The part of three's lighting context (`builder.context` in a lighting model) the terms read and write. */
|
|
9
|
+
export interface LightingContext {
|
|
10
|
+
irradiance: Node<'vec3'>;
|
|
11
|
+
ambientOcclusion: Node<'float'>;
|
|
12
|
+
reflectedLight: DiffuseLight;
|
|
13
|
+
}
|
|
14
|
+
/** One direct light as a lighting model's `direct` gets it: view-space direction, colour (with shadow). */
|
|
15
|
+
export interface DirectLight {
|
|
16
|
+
lightDirection: Node<'vec3'>;
|
|
17
|
+
lightColor: Node<'vec3'>;
|
|
18
|
+
reflectedLight: DiffuseLight;
|
|
19
|
+
}
|
|
20
|
+
/** The lighting context of a lighting model's builder, typed (see {@link LightingContext}). */
|
|
21
|
+
export declare const lightingContext: (builder: NodeBuilder) => LightingContext;
|
|
22
|
+
/** A lighting model's `direct` input, typed (see {@link DirectLight}). */
|
|
23
|
+
export declare const directLight: (input: LightingModelDirectInput) => DirectLight;
|
|
24
|
+
/**
|
|
25
|
+
* Leaf Translucency (GLOSSARY) as one shared TSL term, used by both leaf lighting models: the physical
|
|
26
|
+
* one (`TranslucentLightingModel`, flat and standard shading) and `SoftToonLightingModel` (toon).
|
|
27
|
+
* Build it with {@link leafTranslucencyTerm}; the values are uniforms, so changing them needs no recompile.
|
|
28
|
+
*/
|
|
29
|
+
export interface LeafTranslucencyTerm extends LeafTranslucencyValues {
|
|
30
|
+
/** How thin the crown is at this fragment: 1 on (or outside) the Crown Volume's shell, towards 0 at its centre. */
|
|
31
|
+
readonly thinness: Node<'float'>;
|
|
32
|
+
}
|
|
33
|
+
/** The settings of `materials.leaf.translucency` as nodes (uniforms, shared by every leaf material of a Tree or Forest). */
|
|
34
|
+
export interface LeafTranslucencyValues {
|
|
35
|
+
/** Direct glow per light (0..1). */
|
|
36
|
+
readonly strength: Node<'float'>;
|
|
37
|
+
/** Indirect (sky) glow (0..1). */
|
|
38
|
+
readonly ambient: Node<'float'>;
|
|
39
|
+
/** Extra glow at the thin edge of the Crown Volume (0..1). */
|
|
40
|
+
readonly edge: Node<'float'>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The term for a leaf material: `values` the settings of `materials.leaf.translucency`, `crown` the tree's
|
|
44
|
+
* Crown Volume (`TreeData.crown`, tree space, fully grown) and `growth` the Growth node the material
|
|
45
|
+
* grows with (the Tree's uniform, or a Forest's per-instance Growth).
|
|
46
|
+
*
|
|
47
|
+
* Thinness is the Crown Volume distance (`crownNodes`): measured in the tree's own space on the grown
|
|
48
|
+
* position before Wind (so Wind doesn't make it flicker), against the Volume scaled by the same Growth scale
|
|
49
|
+
* the vertices get. Being in tree space, it is the same for every Forest instance whatever its rotation and
|
|
50
|
+
* scale. It needs no vertex attribute.
|
|
51
|
+
*/
|
|
52
|
+
export declare function leafTranslucencyTerm(values: LeafTranslucencyValues, crown: CrownVolume, growth: Node<'float'>): LeafTranslucencyTerm;
|
|
53
|
+
/**
|
|
54
|
+
* Direct light shining through the leaf towards the viewer, for one light (add it to `directDiffuse`):
|
|
55
|
+
* `lightColor × leaf diffuse × strength × back × edgeBoost`, where `back` is a smooth power of
|
|
56
|
+
* dot(view direction, -light direction). `lightColor` already carries the light's shadow, so shadowed
|
|
57
|
+
* leaves don't glow. The leaf diffuse is its Season colour (Season Profile x the Seed's tint x leaf map).
|
|
58
|
+
* Unlike the lit side it has no Lambert 1/pi: like a real leaf against the sun, a strongly translucent leaf
|
|
59
|
+
* glows brighter than one lit from the front.
|
|
60
|
+
*/
|
|
61
|
+
export declare function translucencyDirect(term: LeafTranslucencyTerm, lightDirection: Node<'vec3'>, lightColor: Node<'vec3'>): Node<'vec3'>;
|
|
62
|
+
/**
|
|
63
|
+
* Indirect light shining through the leaf (add it to `indirectDiffuse` after the model's own AO step):
|
|
64
|
+
* `irradiance × leaf diffuse × ambient × edgeBoost × ambient occlusion`, the leaf diffuse through the
|
|
65
|
+
* Lambert BRDF like the rest of the indirect light.
|
|
66
|
+
*
|
|
67
|
+
* The irradiance from behind would be the irradiance sampled along the flipped normal; three's public
|
|
68
|
+
* lighting-model API only exposes the irradiance already gathered along the normal (`context.irradiance`),
|
|
69
|
+
* so that stands in for it. It is exact for ambient light and light probes' constant part; under a
|
|
70
|
+
* hemisphere light it reads the side facing the viewer.
|
|
71
|
+
*/
|
|
72
|
+
export declare function translucencyIndirect(term: LeafTranslucencyTerm, builder: NodeBuilder): Node<'vec3'>;
|
|
73
|
+
//# sourceMappingURL=leaf-translucency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leaf-translucency.d.ts","sourceRoot":"","sources":["../../src/materials/leaf-translucency.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAShD,+EAA+E;AAC/E,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,6GAA6G;AAC7G,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACzB,gBAAgB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,cAAc,EAAE,YAAY,CAAC;CAC9B;AAED,2GAA2G;AAC3G,MAAM,WAAW,WAAW;IAC1B,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7B,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACzB,cAAc,EAAE,YAAY,CAAC;CAC9B;AAED,+FAA+F;AAC/F,eAAO,MAAM,eAAe,GAAI,SAAS,WAAW,KAAG,eAAqD,CAAC;AAE7G,0EAA0E;AAC1E,eAAO,MAAM,WAAW,GAAI,OAAO,wBAAwB,KAAG,WAA8C,CAAC;AAQ7G;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB;IAClE,mHAAmH;IACnH,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;CAClC;AAED,4HAA4H;AAC5H,MAAM,WAAW,sBAAsB;IACrC,oCAAoC;IACpC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,kCAAkC;IAClC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;CAC9B;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,sBAAsB,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,oBAAoB,CAOpI;AAKD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,oBAAoB,EAAE,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAOnI;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,CAQnG"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { MeshStandardNodeMaterial, Node, NodeMaterial } from 'three/webgpu';
|
|
2
|
+
import type { MaterialFeatures, TranslucencyDefinition, TreeDefinition } from '../definition';
|
|
3
|
+
import type { CrownVolume } from '../generator';
|
|
4
|
+
/** One tree's materials to give the Material Features (a Tree's, or one Forest Variant's). */
|
|
5
|
+
export interface MaterialFeatureTarget {
|
|
6
|
+
/** The leaf material (Crown Normals, Leaf Translucency). */
|
|
7
|
+
leaf: MeshStandardNodeMaterial;
|
|
8
|
+
/** Every material of the tree: bark, leaf and Fruit (Structural Occlusion). */
|
|
9
|
+
materials: readonly (NodeMaterial | null)[];
|
|
10
|
+
/** The tree's Crown Volume (`TreeData.crown`). */
|
|
11
|
+
crown: CrownVolume;
|
|
12
|
+
/** The Growth node the materials' `positionNode` grows with. */
|
|
13
|
+
growth: Node<'float'>;
|
|
14
|
+
/** Turns a tree-space normal into the mesh's own space (a Forest rotates it by the instance). Default: as is. */
|
|
15
|
+
toObject?: (normal: Node<'vec3'>) => Node<'vec3'>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The Material Features (GLOSSARY, ADR 0008) of a Tree or Forest: applies those the Definition sets to
|
|
19
|
+
* the materials of each target and owns their values as uniforms, shared by all targets, so a feature
|
|
20
|
+
* that is on can be tuned live (no regeneration, no recompile). A feature that is off leaves the
|
|
21
|
+
* materials exactly as they are and cannot be tuned (switching one on needs a new Tree or Forest).
|
|
22
|
+
*/
|
|
23
|
+
export declare class LiveMaterialFeatures {
|
|
24
|
+
private readonly crown;
|
|
25
|
+
private readonly translucencyValues;
|
|
26
|
+
private readonly occlusion;
|
|
27
|
+
constructor(definition: TreeDefinition, targets: readonly MaterialFeatureTarget[]);
|
|
28
|
+
/** The features that are on, with their current values (same shape as `materialFeaturesOf`). */
|
|
29
|
+
get values(): MaterialFeatures;
|
|
30
|
+
/** Crown Normals amount, null when off. */
|
|
31
|
+
get crownNormals(): number | null;
|
|
32
|
+
/** Sets the Crown Normals amount (clamped to 0..1); throws when the feature is off. */
|
|
33
|
+
set crownNormals(value: number);
|
|
34
|
+
/** Leaf Translucency settings (a copy), null when off. */
|
|
35
|
+
get translucency(): TranslucencyDefinition | null;
|
|
36
|
+
/** Sets any of the Leaf Translucency settings (each clamped to 0..1; the others kept); throws when the feature is off. */
|
|
37
|
+
set translucency(value: Partial<TranslucencyDefinition>);
|
|
38
|
+
/** Structural Occlusion strength, null when off. */
|
|
39
|
+
get occlusionStrength(): number | null;
|
|
40
|
+
/** Sets the Structural Occlusion strength (clamped to 0..1); throws when the feature is off. */
|
|
41
|
+
set occlusionStrength(value: number);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=material-features.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"material-features.d.ts","sourceRoot":"","sources":["../../src/materials/material-features.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,E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,gGAAgG;IAChG,IAAI,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAKlC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Node, NodeMaterial } from 'three/webgpu';
|
|
2
|
+
/**
|
|
3
|
+
* Structural Occlusion (GLOSSARY, ADR 0008) on a tree's own materials: each material's `aoNode` becomes
|
|
4
|
+
* `mix(1, aOcclusion, strength)`, from the Generator's baked `aOcclusion` (only generated when
|
|
5
|
+
* `materials.occlusion` is set). three applies it as it does the material's built-in AO (multiplied with an
|
|
6
|
+
* app's SSAO/GTAO through `context.getAO`), so it only darkens ambient and indirect light; the toon model's
|
|
7
|
+
* indirect light multiplies by it too. `strength` is a uniform, so tuning it needs no recompile.
|
|
8
|
+
*/
|
|
9
|
+
export declare function applyStructuralOcclusion(materials: readonly (NodeMaterial | null)[], strength: Node<'float'>): void;
|
|
10
|
+
//# sourceMappingURL=occlusion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"occlusion.d.ts","sourceRoot":"","sources":["../../src/materials/occlusion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEvD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAGnH"}
|
package/dist/materials/toon.d.ts
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
import { MeshStandardNodeMaterial, type PhysicalLightingModel } from 'three/webgpu';
|
|
1
|
+
import { LightingModel, MeshStandardNodeMaterial, type LightingModelDirectInput, type NodeBuilder, type PhysicalLightingModel } from 'three/webgpu';
|
|
2
|
+
import { type LeafTranslucencyTerm } from './leaf-translucency';
|
|
3
|
+
/**
|
|
4
|
+
* Soft toon lighting: two tones (lit and shaded) per light with a smooth band in between,
|
|
5
|
+
* plus plain diffuse ambient/hemisphere light. No specular or environment reflections. Built
|
|
6
|
+
* in TSL from the light direction only, so it needs no gradient texture (no image files).
|
|
7
|
+
*
|
|
8
|
+
* With a Leaf Translucency term (leaf material only, `applyLeafTranslucency`), leaves with light behind them also glow:
|
|
9
|
+
* the same shared term the physical leaf model adds.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SoftToonLightingModel extends LightingModel {
|
|
12
|
+
private readonly translucency;
|
|
13
|
+
constructor(translucency?: LeafTranslucencyTerm | null);
|
|
14
|
+
/** Whether this model adds Leaf Translucency. */
|
|
15
|
+
get isLeafTranslucencyModel(): boolean;
|
|
16
|
+
direct({ lightDirection, lightColor, reflectedLight }: LightingModelDirectInput): void;
|
|
17
|
+
indirect(builder: NodeBuilder): void;
|
|
18
|
+
}
|
|
2
19
|
/**
|
|
3
20
|
* The stylized Style's material (`materials.shading: 'toon'`): a `MeshStandardNodeMaterial`
|
|
4
21
|
* lit by the soft toon model. Staying a standard material keeps every part node (Season
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toon.d.ts","sourceRoot":"","sources":["../../src/materials/toon.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"toon.d.ts","sourceRoot":"","sources":["../../src/materials/toon.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAA4C,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAY1G;;;;;;;GAOG;AACH,qBAAa,qBAAsB,SAAQ,aAAa;IAC1C,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAAZ,YAAY,GAAE,oBAAoB,GAAG,IAAW;IAI7E,iDAAiD;IACjD,IAAI,uBAAuB,IAAI,OAAO,CAErC;IAEQ,MAAM,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,wBAAwB,GAAG,IAAI;IAQtF,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;CAM9C;AAED;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,wBAAwB;IAChE,QAAQ,CAAC,kBAAkB,QAAQ;IAE1B,kBAAkB,IAAI,qBAAqB;CAIrD"}
|
|
@@ -91,6 +91,29 @@ var DEFAULT_FRUIT = {
|
|
|
91
91
|
sizeVariation: .2,
|
|
92
92
|
hang: .7
|
|
93
93
|
};
|
|
94
|
+
/** Defaults for the fields of a `roots` block (a Definition has no Roots unless it has the block). */
|
|
95
|
+
var DEFAULT_ROOTS = {
|
|
96
|
+
count: 5,
|
|
97
|
+
length: .25,
|
|
98
|
+
lengthVariation: .3,
|
|
99
|
+
radius: .35,
|
|
100
|
+
angle: 12,
|
|
101
|
+
bend: .3
|
|
102
|
+
};
|
|
103
|
+
/** Defaults for the fields of a `materials.bark.groundTint` block (no Ground Tint unless it has the block). */
|
|
104
|
+
var DEFAULT_GROUND_TINT = {
|
|
105
|
+
color: "#3f4a2a",
|
|
106
|
+
height: .5,
|
|
107
|
+
strength: .6
|
|
108
|
+
};
|
|
109
|
+
/** Defaults for the fields of a partial `materials.leaf.translucency` block (no Leaf Translucency unless it has the block). */
|
|
110
|
+
var DEFAULT_TRANSLUCENCY = {
|
|
111
|
+
strength: .5,
|
|
112
|
+
edge: .5,
|
|
113
|
+
ambient: .3
|
|
114
|
+
};
|
|
115
|
+
/** Defaults for the fields of a partial `materials.occlusion` block (no Structural Occlusion unless it has the block). */
|
|
116
|
+
var DEFAULT_OCCLUSION = { strength: .7 };
|
|
94
117
|
/** Fruit amount when the Season Profile has no `fruit` track: all Fruit at full size all year. */
|
|
95
118
|
var DEFAULT_FRUIT_AMOUNT = [{
|
|
96
119
|
t: 0,
|
|
@@ -301,8 +324,9 @@ var nonNegative = leaf("a number >= 0", (v) => isNum(v) && v >= 0);
|
|
|
301
324
|
var positive = leaf("a number > 0", (v) => isNum(v) && v > 0);
|
|
302
325
|
var finite = leaf("a finite number", isNum);
|
|
303
326
|
var intAtLeast = (min) => leaf(`an integer >= ${min}`, (v) => Number.isInteger(v) && v >= min);
|
|
304
|
-
|
|
305
|
-
|
|
327
|
+
var intRange = (min, max) => leaf(`an integer from ${min} to ${max}`, (v) => Number.isInteger(v) && v >= min && v <= max);
|
|
328
|
+
/** Faces around a Fruit or a Root (its polygon detail). */
|
|
329
|
+
var partSides = intRange(3, 16);
|
|
306
330
|
var hexColor = leaf("a colour like \"#6b4a2b\"", (v) => typeof v === "string" && /^#[0-9a-f]{6}$/i.test(v));
|
|
307
331
|
var text = leaf("a string", (v) => typeof v === "string");
|
|
308
332
|
var url = leaf("a URL string or null", (v) => v === null || typeof v === "string" && v.length > 0);
|
|
@@ -429,7 +453,9 @@ var treeDefinition = obj({
|
|
|
429
453
|
bend: unit,
|
|
430
454
|
stems: optional(intAtLeast(1)),
|
|
431
455
|
spread: optional(range(0, 90)),
|
|
432
|
-
gravity: optional(range(-1, 1))
|
|
456
|
+
gravity: optional(range(-1, 1)),
|
|
457
|
+
flare: optional(unit),
|
|
458
|
+
flareSections: optional(intAtLeast(1))
|
|
433
459
|
}),
|
|
434
460
|
branches: arr(branchLevel, {
|
|
435
461
|
max: 4,
|
|
@@ -450,8 +476,18 @@ var treeDefinition = obj({
|
|
|
450
476
|
size: positive,
|
|
451
477
|
sizeVariation: unit,
|
|
452
478
|
hang: unit,
|
|
453
|
-
sides: optional(
|
|
479
|
+
sides: optional(partSides)
|
|
454
480
|
}), DEFAULT_FRUIT),
|
|
481
|
+
roots: optionalBlock(obj({
|
|
482
|
+
count: intRange(0, 12),
|
|
483
|
+
length: unit,
|
|
484
|
+
lengthVariation: unit,
|
|
485
|
+
radius: unit,
|
|
486
|
+
angle: range(0, 60),
|
|
487
|
+
bend: unit,
|
|
488
|
+
sides: optional(partSides),
|
|
489
|
+
sections: optional(intAtLeast(1))
|
|
490
|
+
}), DEFAULT_ROOTS),
|
|
455
491
|
materials: obj({
|
|
456
492
|
shading: oneOf("standard", "flat", "toon"),
|
|
457
493
|
bark: obj({
|
|
@@ -459,13 +495,25 @@ var treeDefinition = obj({
|
|
|
459
495
|
color: hexColor,
|
|
460
496
|
roughness: unit,
|
|
461
497
|
map: url,
|
|
462
|
-
normalMap: url
|
|
498
|
+
normalMap: url,
|
|
499
|
+
groundTint: optionalBlock(obj({
|
|
500
|
+
color: hexColor,
|
|
501
|
+
height: positive,
|
|
502
|
+
strength: unit
|
|
503
|
+
}), DEFAULT_GROUND_TINT)
|
|
463
504
|
}),
|
|
464
505
|
leaf: obj({
|
|
465
506
|
roughness: unit,
|
|
466
507
|
map: url,
|
|
467
|
-
alphaTest: unit
|
|
468
|
-
|
|
508
|
+
alphaTest: unit,
|
|
509
|
+
crownNormals: optional(unit),
|
|
510
|
+
translucency: optionalBlock(obj({
|
|
511
|
+
strength: unit,
|
|
512
|
+
edge: unit,
|
|
513
|
+
ambient: unit
|
|
514
|
+
}), DEFAULT_TRANSLUCENCY)
|
|
515
|
+
}),
|
|
516
|
+
occlusion: optionalBlock(obj({ strength: unit }), DEFAULT_OCCLUSION)
|
|
469
517
|
}),
|
|
470
518
|
season: obj({
|
|
471
519
|
leafColor: track(hexColor),
|
|
@@ -554,6 +602,82 @@ async function fetchDefinition(url, init) {
|
|
|
554
602
|
if (!response.ok) throw new Error(`Could not load Tree Definition from ${String(url)}: HTTP ${response.status}`);
|
|
555
603
|
return parseDefinition(await response.text());
|
|
556
604
|
}
|
|
605
|
+
// src/styles/material-features.ts
|
|
606
|
+
/**
|
|
607
|
+
* Suggested Material Features for each built-in Style (like `SUGGESTED_TREE_EFFECTS`). Nothing uses
|
|
608
|
+
* them by default; pass one to {@link withMaterialFeatures} to opt a Definition in.
|
|
609
|
+
*
|
|
610
|
+
* Tuned against the e2e screenshots (e2e/material-features.spec.ts). Structural Occlusion only darkens
|
|
611
|
+
* ambient light, so it is set high; translucency stays low enough that a crown against the sun keeps its shape.
|
|
612
|
+
*/
|
|
613
|
+
var SUGGESTED_MATERIAL_FEATURES = {
|
|
614
|
+
"low-poly": {
|
|
615
|
+
crownNormals: .5,
|
|
616
|
+
occlusion: { strength: .8 }
|
|
617
|
+
},
|
|
618
|
+
stylized: {
|
|
619
|
+
crownNormals: 1,
|
|
620
|
+
translucency: {
|
|
621
|
+
strength: .3,
|
|
622
|
+
edge: .8,
|
|
623
|
+
ambient: .2
|
|
624
|
+
},
|
|
625
|
+
occlusion: { strength: .9 }
|
|
626
|
+
},
|
|
627
|
+
realistic: {
|
|
628
|
+
crownNormals: .6,
|
|
629
|
+
translucency: {
|
|
630
|
+
strength: .45,
|
|
631
|
+
edge: .7,
|
|
632
|
+
ambient: .25
|
|
633
|
+
},
|
|
634
|
+
occlusion: { strength: .9 }
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
/**
|
|
638
|
+
* The Material Features a Tree Definition has (`materials.leaf.crownNormals`, `materials.leaf.translucency`,
|
|
639
|
+
* `materials.occlusion`), in the shape {@link withMaterialFeatures} takes. A feature that is absent is left
|
|
640
|
+
* out; the values are the Definition's own (not copies).
|
|
641
|
+
*/
|
|
642
|
+
function materialFeaturesOf(definition) {
|
|
643
|
+
const { crownNormals, translucency } = definition.materials.leaf;
|
|
644
|
+
const { occlusion } = definition.materials;
|
|
645
|
+
return {
|
|
646
|
+
...crownNormals === void 0 ? {} : { crownNormals },
|
|
647
|
+
...translucency === void 0 ? {} : { translucency },
|
|
648
|
+
...occlusion === void 0 ? {} : { occlusion }
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Returns a new Tree Definition whose Material Features are exactly `features`: each feature given is
|
|
653
|
+
* set, each feature left out is switched off (`{}` switches them all off). Everything else is kept. The
|
|
654
|
+
* input is not changed. Throws a TreeDefinitionError for an out-of-range value.
|
|
655
|
+
*
|
|
656
|
+
* ```ts
|
|
657
|
+
* const tree = createTree(withMaterialFeatures(stylized.broadleaf, SUGGESTED_MATERIAL_FEATURES.stylized));
|
|
658
|
+
* ```
|
|
659
|
+
*/
|
|
660
|
+
function withMaterialFeatures(definition, features) {
|
|
661
|
+
const parsed = parseDefinition(definition);
|
|
662
|
+
const leaf = { ...parsed.materials.leaf };
|
|
663
|
+
delete leaf.crownNormals;
|
|
664
|
+
delete leaf.translucency;
|
|
665
|
+
const materials = { ...parsed.materials };
|
|
666
|
+
delete materials.occlusion;
|
|
667
|
+
const { crownNormals, translucency, occlusion } = features;
|
|
668
|
+
return parseDefinition({
|
|
669
|
+
...parsed,
|
|
670
|
+
materials: {
|
|
671
|
+
...materials,
|
|
672
|
+
leaf: {
|
|
673
|
+
...leaf,
|
|
674
|
+
...crownNormals === void 0 ? {} : { crownNormals },
|
|
675
|
+
...translucency === void 0 ? {} : { translucency: { ...translucency } }
|
|
676
|
+
},
|
|
677
|
+
...occlusion === void 0 ? {} : { occlusion: { ...occlusion } }
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
}
|
|
557
681
|
// src/styles/names.ts
|
|
558
682
|
/** Every built-in Style: its display label and the shading its Definitions use (one shading per Style). */
|
|
559
683
|
var STYLES = {
|
|
@@ -584,6 +708,6 @@ function styleShading(name) {
|
|
|
584
708
|
function styleOfShading(shading) {
|
|
585
709
|
return STYLE_NAMES.find((name) => STYLES[name].shading === shading);
|
|
586
710
|
}
|
|
587
|
-
export {
|
|
711
|
+
export { CURRENT_SCHEMA_VERSION as C, MAX_BRANCH_LEVELS as E, BARK_TYPES as S, LEAF_TYPES as T, DEFAULT_GROUND_TINT as _, SUGGESTED_MATERIAL_FEATURES as a, DEFAULT_TRANSLUCENCY as b, extendDefinition as c, TreeDefinitionError as d, DEFAULT_BRANCH_LEVEL as f, DEFAULT_FRUIT_COLOR as g, DEFAULT_FRUIT_AMOUNT as h, styleShading as i, fetchDefinition as l, DEFAULT_FRUIT as m, styleLabel as n, materialFeaturesOf as o, DEFAULT_DEFINITION as p, styleOfShading as r, withMaterialFeatures as s, STYLE_NAMES as t, parseDefinition as u, DEFAULT_OCCLUSION as v, FRUIT_TYPES as w, coneCurve as x, DEFAULT_ROOTS as y };
|
|
588
712
|
|
|
589
|
-
//# sourceMappingURL=names-
|
|
713
|
+
//# sourceMappingURL=names-BE9he6CS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names-BE9he6CS.js","names":[],"sources":["../src/definition/types.ts","../src/definition/crown-shape.ts","../src/definition/defaults.ts","../src/definition/migrations.ts","../src/definition/schema.ts","../src/definition/parse.ts","../src/styles/material-features.ts","../src/styles/names.ts"],"sourcesContent":["/**\n * Tree Definition schema (see GLOSSARY.md). Plain JSON: it is what the Tree Editor exports\n * and what `createTree` consumes. Every field is documented with its unit and allowed range;\n * the runtime rules live in `schema.ts` and the defaults in `defaults.ts`.\n *\n * Conventions: lengths in metres (scene units), angles in degrees, colours as `#rrggbb`,\n * \"fraction\" fields are 0..1. Fields named `*Variation` are Seed ranges: the Seed picks a\n * value within ± that fraction of the base value.\n */\n\n/**\n * Current Tree Definition schema version. Bump it, and add a migration in `migrations.ts`,\n * whenever the format changes or a generator change would alter existing trees (ADR 0003).\n */\nexport const CURRENT_SCHEMA_VERSION = 3;\n\n/** `#rrggbb` colour string. */\nexport type HexColor = string;\n\n/** [x, y, z] */\nexport type Vec3Tuple = [number, number, number];\n\n/**\n * Form: a label that groups trees (a Style's `broadleaf` / `conifer` Definition). It never\n * changes geometry and is not part of the Tree Definition; a crown's shape comes from its\n * Crown Shape curves (ADR 0004).\n */\nexport type TreeForm = 'broadleaf' | 'conifer';\n\n/** Trunk parameters (branch level 0). */\nexport interface TrunkDefinition {\n /** Trunk length at full Growth, metres (> 0). */\n length: number;\n /** Radius at the base, metres (> 0). */\n radius: number;\n /** Tip radius as a fraction of the base radius (0 = point, 1 = cylinder). */\n taper: number;\n /** Number of sides around the trunk (integer >= 3). */\n sides: number;\n /** Number of sections along the trunk (integer >= 1). */\n sections: number;\n /** Seed range: the Seed scales length by up to ± this fraction (0..1). */\n lengthVariation: number;\n /** Seed range: maximum sideways drift per section, as a fraction of the section length (0..1). */\n bend: number;\n /**\n * Number of Stems growing from the ground (integer >= 1). Each Stem is a full trunk with these\n * parameters and the full branch structure; Stem paths are \"0\", \"1\", \"2\", ... Absent = 1 (a single trunk).\n */\n stems?: number;\n /**\n * How far each Stem leans out from vertical, degrees (0..90). The Seed varies it per Stem\n * (± 30 %) and turns the ring of Stems. Absent = 0 (upright).\n */\n spread?: number;\n /**\n * Pull on the leader, the upper third of each Stem (−1..1): − makes it nod over (a hemlock's\n * drooping tip), + pulls a leaning Stem back up. The lower trunk is never bent. Absent = 0 (none).\n */\n gravity?: number;\n /**\n * Root Flare (0..1): how much each Stem widens towards the ground over the bottom of its length.\n * 1 makes the base ring 1.8 × the trunk radius. Geometry only (ADR 0007): branches, leaves, Fruit,\n * Growth, Wind and Sculpts never move. Absent = 0 (none).\n */\n flare?: number;\n /**\n * Number of extra sections the trunk sweep puts in the Root Flare (integer >= 1), set by the Style\n * like `sides` and `sections`: 2 in low-poly, 3 in the others. Unused without flare. Absent = 3.\n */\n flareSections?: number;\n}\n\n/**\n * One level of branching. `branches[0]` grows from the trunk, `branches[1]` from the\n * level-1 branches, and so on (at most {@link MAX_BRANCH_LEVELS} levels).\n */\nexport interface BranchLevelDefinition {\n /** Child branches per parent branch (integer >= 0). */\n count: number;\n /** Where along the parent children start, as a fraction of the parent length (0..1). */\n start: number;\n /** Where along the parent children stop, as a fraction of the parent length (0..1, >= start). */\n end: number;\n /** Angle between parent and child direction, degrees (0..180). */\n angle: number;\n /** Seed range: ± this fraction of `angle` (0..1). */\n angleVariation: number;\n /** Rotation around the parent between successive children, degrees (0..360; 137.5 = golden angle). */\n spiral: number;\n /** Child length as a fraction of the parent's length (> 0). */\n length: number;\n /** Seed range: ± this fraction of `length` (0..1). */\n lengthVariation: number;\n /** Child base radius as a fraction of the parent's radius where it attaches (0..1). */\n radius: number;\n /** Tip radius as a fraction of the base radius (0..1). */\n taper: number;\n /** Number of sides around each branch (integer >= 3). */\n sides: number;\n /** Number of sections along each branch (integer >= 1). */\n sections: number;\n /** Seed range: maximum sideways drift per section, as a fraction of the section length (0..1). */\n bend: number;\n /** Upward (+) or downward (−) pull on the branch tip (−1..1). */\n gravity: number;\n /**\n * Crown Shape: multiplies `length` by the attach position on the parent (`t` 0 = base .. 1 = tip),\n * values >= 0. Linear between keyframes, holding the first/last value outside them. Absent = flat (1).\n * E.g. a cone: `[{ t: start, value: 1 }, { t: 1, value: 0.1 }]`.\n */\n lengthProfile?: Keyframe<number>[];\n /** Crown Shape: multiplies `angle` by the attach position on the parent, like `lengthProfile` (values >= 0; the angle stays <= 180). */\n angleProfile?: Keyframe<number>[];\n}\n\n/** Maximum number of branching levels below the trunk. */\nexport const MAX_BRANCH_LEVELS = 4;\n\n/**\n * How a leaf is drawn: a flat card, a faceted clump of foliage, a needle cluster, or a puff\n * (a smooth round ball of foliage, for toon shading).\n */\nexport type LeafShape = 'card' | 'clump' | 'needle' | 'puff';\n\n/**\n * Leaf Type: the kind of leaf a Species has. Each Style decides how to draw it (leaf shape,\n * count, size, texture); in a Tree Definition it is a label that never changes geometry by itself.\n */\nexport type LeafType = 'broad' | 'lobed' | 'palmate' | 'compound' | 'needle' | 'scale';\n/** All Leaf Types. */\nexport const LEAF_TYPES: readonly LeafType[] = ['broad', 'lobed', 'palmate', 'compound', 'needle', 'scale'];\n\n/**\n * Bark Type: the kind of bark surface a Species has. Each Style decides how to draw it (colour\n * only, or a texture); in a Tree Definition it is a label that never changes geometry by itself.\n */\nexport type BarkType = 'furrowed' | 'smooth' | 'papery' | 'fibrous' | 'plated';\n/** All Bark Types. */\nexport const BARK_TYPES: readonly BarkType[] = ['furrowed', 'smooth', 'papery', 'fibrous', 'plated'];\n\n/** Leaves, placed on the last branching level (or the trunk if there are no branches). */\nexport interface LeavesDefinition {\n /** Leaf Type the leaves were drawn from (set by `Style.apply`), so a Style can be re-applied. Optional. */\n type?: LeafType;\n /** Leaves per terminal branch (integer >= 0; 0 = no leaves). */\n count: number;\n /** Leaf shape. */\n shape: LeafShape;\n /** Leaf size (width and length of a card / clump diameter), metres (> 0). */\n size: number;\n /** Seed range: ± this fraction of `size` (0..1). */\n sizeVariation: number;\n /** Where along the terminal branch leaves start, as a fraction of its length (0..1). */\n start: number;\n /** Angle between branch and leaf, degrees (0..180). */\n angle: number;\n}\n\n/**\n * Fruit Type: the kind of Fruit a tree bears. `round` (apple, cherry, plum), `pear`, `nut` (a\n * spiky husk, e.g. chestnut), `cone` (conifer cones) or `berry` (small, e.g. juniper).\n */\nexport type FruitType = 'round' | 'pear' | 'nut' | 'cone' | 'berry';\n\n/** Every Fruit Type. */\nexport const FRUIT_TYPES: readonly FruitType[] = ['round', 'pear', 'nut', 'cone', 'berry'];\n\n/**\n * Fruit (ADR 0006): its own tree part, grown on the outermost twigs (the trunk if there are no\n * branch levels) from its own random stream, drawn as small solid shapes in the `fruit` mesh.\n * Absent = no Fruit. Season comes from the Season Profile's `fruit` and `fruitColor` tracks.\n */\nexport interface FruitDefinition {\n /** Fruit Type (shape). */\n type: FruitType;\n /**\n * Fruit per outermost twig (>= 0). A fraction is a chance: 0.3 = one Fruit on about 30% of the\n * twigs, 1.5 = one on every twig and a second on about half (which twigs comes from the Seed).\n */\n count: number;\n /** Fruit length (and about its diameter), metres (> 0). */\n size: number;\n /** Seed range: ± this fraction of `size` (0..1). */\n sizeVariation: number;\n /** How far the Fruit dangles below its twig (0 = sits on the twig pointing outward .. 1 = hangs straight down). */\n hang: number;\n /**\n * Polygon detail, set by the Style: faces around each Fruit (3..16). 5 or fewer also gives a coarse\n * profile (a few flat facets, low-poly). Absent = the Fruit Type's own smooth template.\n */\n sides?: number;\n}\n\n/**\n * Roots (ADR 0007): their own tree part, grown after the Sculpt pass from the Root Flare of every\n * remaining Stem, each from its own random stream, and drawn in the wood mesh after the branches.\n * They run outward and down, taper to a point below the ground, grow with the trunk and never sway.\n * They are not Sculptable. Absent = no Roots.\n */\nexport interface RootsDefinition {\n /** Roots per Stem (integer 0..12). */\n count: number;\n /** Root length as a fraction of its Stem's length (after Seed variation and Sculpts), 0..1. */\n length: number;\n /** Seed range: ± this fraction of `length` (0..1). */\n lengthVariation: number;\n /** Base radius as a fraction of the trunk's base radius (0..1). */\n radius: number;\n /** How steeply a Root dives, degrees below horizontal (0..60). Every Root still ends below the ground. */\n angle: number;\n /** Seed range: sideways wander per section (0..1). */\n bend: number;\n /** Polygon detail, set by the Style: sides around each Root (integer 3..16). Absent = derived from `trunk.sides`. */\n sides?: number;\n /** Polygon detail, set by the Style: sections along each Root (integer >= 1). Absent = 4. */\n sections?: number;\n}\n\n/** Material shading model. Low-poly uses `flat`, stylized `toon`, realistic `standard`. */\nexport type Shading = 'standard' | 'flat' | 'toon';\n\nexport interface BarkMaterialDefinition {\n /** Bark Type the bark was drawn from (set by `Style.apply`), so a Style can be re-applied. Optional. */\n type?: BarkType;\n /** Base bark colour. */\n color: HexColor;\n /** PBR roughness (0..1). */\n roughness: number;\n /** Colour texture URL (resolved against the app's texture base path), or null for none. */\n map: string | null;\n /** Normal map URL, or null for none. */\n normalMap: string | null;\n /** Ground Tint: a darker or mossy bark colour near the ground. Optional; absent = none. */\n groundTint?: GroundTintDefinition;\n}\n\n/**\n * Ground Tint: at and below the ground (tree-space height <= 0, measured on the grown tree) the\n * bark colour blends towards `color` by `strength`; the blend fades smoothly to nothing at `height`.\n */\nexport interface GroundTintDefinition {\n /** The colour the bark blends towards near the ground. */\n color: HexColor;\n /** Metres above the ground where the tint has faded out (> 0). */\n height: number;\n /** How far the bark blends towards `color` at the ground (0..1). */\n strength: number;\n}\n\nexport interface LeafMaterialDefinition {\n /** PBR roughness (0..1). Leaf colour comes from the Season Profile. */\n roughness: number;\n /** Leaf card texture URL (alpha cut-out), or null for none. */\n map: string | null;\n /** Alpha cut-off for `map` (0..1). */\n alphaTest: number;\n /**\n * Crown Normals (a Material Feature, ADR 0008): how far each leaf's normal bends towards the\n * Crown Volume's normal, 0 (each leaf lit on its own) .. 1 (the crown lit as one shape). Absent or 0 = off.\n */\n crownNormals?: number;\n /** Leaf Translucency (a Material Feature, ADR 0008). Absent = off. */\n translucency?: TranslucencyDefinition;\n}\n\n/**\n * Leaf Translucency: light shining through the leaves towards the viewer makes them glow in their\n * own (Season) colour, more at the thin edge of the crown. All plain numbers, 0..1.\n */\nexport interface TranslucencyDefinition {\n /** How strongly leaves with a direct light behind them glow (0..1). */\n strength: number;\n /** Extra glow at the thin edge of the Crown Volume (0 = the same everywhere .. 1 = only at the edge). */\n edge: number;\n /** The indirect (sky) part shining through the canopy, dimmed by occlusion (0..1). */\n ambient: number;\n}\n\n/** Structural Occlusion: ambient light darkened where the tree hides itself (wood, leaves and Fruit). */\nexport interface OcclusionDefinition {\n /** How far the baked occlusion darkens ambient and indirect light (0 = none .. 1 = fully). */\n strength: number;\n}\n\n/**\n * The three Material Features (GLOSSARY, ADR 0008), with the same shapes as in a Definition\n * (`materials.leaf.crownNormals`, `materials.leaf.translucency`, `materials.occlusion`). Absent = off.\n */\nexport interface MaterialFeatures {\n crownNormals?: number;\n translucency?: TranslucencyDefinition;\n occlusion?: OcclusionDefinition;\n}\n\nexport interface MaterialsDefinition {\n shading: Shading;\n bark: BarkMaterialDefinition;\n leaf: LeafMaterialDefinition;\n /** Structural Occlusion (a Material Feature, ADR 0008). Absent = off. */\n occlusion?: OcclusionDefinition;\n}\n\n/**\n * One keyframe of a track. In a Season Profile `t` is the Season (0 = first day of spring .. 1 = last\n * day of winter); in a Crown Shape curve it is the attach position on the parent branch (0 = base .. 1 = tip).\n */\nexport interface Keyframe<V> {\n t: number;\n value: V;\n}\n\n/**\n * How leaf colour, leaf coverage and blossom change across Season. Each track needs\n * at least one keyframe; keyframes are sorted by `t` (non-decreasing).\n */\nexport interface SeasonProfileDefinition {\n /** Leaf colour keyframes. */\n leafColor: Keyframe<HexColor>[];\n /** Leaf coverage keyframes (0 = bare .. 1 = full). */\n leafCoverage: Keyframe<number>[];\n /** Blossom amount keyframes (0 = none .. 1 = full bloom). */\n blossom: Keyframe<number>[];\n /** Blossom colour. */\n blossomColor: HexColor;\n /**\n * Fruit amount keyframes (0 = none .. 1 = all Fruit at full size); each Fruit shows while the amount\n * is above its own rank and swells with the amount. Absent = 1 all year. Only used with `fruit`.\n */\n fruit?: Keyframe<number>[];\n /** Fruit colour keyframes (ripening). Absent = a red (`DEFAULT_FRUIT_COLOR`) all year. Only used with `fruit`. */\n fruitColor?: Keyframe<HexColor>[];\n}\n\n/** Per-tree response to the scene-wide Wind. All 0 (stiff) .. 1 (very flexible). */\nexport interface WindResponseDefinition {\n /** Sway of the trunk. */\n trunk: number;\n /** Sway of the branches. */\n branches: number;\n /** Flutter of the leaves. */\n leaves: number;\n /** Sway speed multiplier (> 0; 1 = default). */\n frequency: number;\n}\n\n/** Seed ranges that are not tied to one tree part. All 0 (none) .. 1. */\nexport interface VariationDefinition {\n /** How much the Seed shifts bark and leaf colours. */\n color: number;\n /** How much the Seed shifts the timing of Growth (fraction of the 0..1 range). */\n growth: number;\n /** How much the Seed shifts the timing of Season (fraction of the 0..1 range). */\n season: number;\n}\n\ninterface SculptBase {\n /** The Seed the Sculpt was made on; every other Seed ignores it (ADR 0003). */\n seed: number;\n /** Branch path, e.g. \"0\" (trunk / first Stem), \"1\" (second Stem) or \"0.3.1\". */\n path: string;\n}\n/** Removes a branch and everything growing from it. */\nexport interface DeleteSculpt extends SculptBase {\n action: 'delete';\n}\n/** Rotates (Euler XYZ, radians) and scales a branch around its base. */\nexport interface MoveSculpt extends SculptBase {\n action: 'move';\n rotation: Vec3Tuple;\n /** Length scale (> 0). */\n scale: number;\n}\n/** Sets the leaf coverage (0..1) of a branch and everything growing from it. */\nexport interface LeavesSculpt extends SculptBase {\n action: 'leaves';\n coverage: number;\n}\n/** A hand edit made in the Tree Editor, tied to one Seed. */\nexport type Sculpt = DeleteSculpt | MoveSculpt | LeavesSculpt;\n\n/**\n * The full parameter set that describes how a tree is generated, independent of any Seed.\n */\nexport interface TreeDefinition {\n schemaVersion: typeof CURRENT_SCHEMA_VERSION;\n /** Optional human-readable name. */\n name: string;\n /** Id of the Species this Definition was made from by `Style.apply` (e.g. `'oak'`). Optional; never changes geometry. */\n species?: string;\n trunk: TrunkDefinition;\n /** Branching levels below the trunk (0..{@link MAX_BRANCH_LEVELS} entries). */\n branches: BranchLevelDefinition[];\n leaves: LeavesDefinition;\n /** Fruit on the outermost twigs; absent = none. */\n fruit?: FruitDefinition;\n /** Roots on every Stem; absent = none. */\n roots?: RootsDefinition;\n materials: MaterialsDefinition;\n season: SeasonProfileDefinition;\n wind: WindResponseDefinition;\n variation: VariationDefinition;\n sculpts: Sculpt[];\n}\n\n/**\n * Deep partial for Definition input. Objects may omit fields (they get defaults); arrays\n * replace the default array as a whole. Branch levels may be partial (missing fields come\n * from {@link DEFAULT_BRANCH_LEVEL}); keyframes and Sculpts must be complete.\n */\nexport type DeepPartial<T> = T extends (infer U)[]\n ? (U extends Keyframe<unknown> | Sculpt ? U : DeepPartial<U>)[]\n : T extends object\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : T;\n\n/**\n * What callers may pass: `schemaVersion` plus any subset of the fields; the rest is defaulted.\n * Older `schemaVersion`s are accepted and migrated.\n */\nexport type TreeDefinitionInput = { schemaVersion: number } & DeepPartial<Omit<TreeDefinition, 'schemaVersion'>>;\n","// Crown Shape helpers (ADR 0004): ready-made branch-level curves.\nimport type { Keyframe } from './types';\n\n/** The cone's shortest branches, as a fraction of the level's declared length. */\nconst MIN_CONE = 0.1;\n\n/**\n * The conifer cone as a Crown Shape length curve for a branch level starting at `start`: full length\n * at `start`, shrinking linearly to a tenth of it near the trunk tip, never below a tenth (the v2\n * generator's `max(0.1, (1 - t) / (1 - start))`). Written by the v2 -> v3 migration and used by every\n * Style's own conifer.\n */\nexport function coneCurve(start: number): Keyframe<number>[] {\n return [\n { t: start, value: 1 },\n // = 1 - MIN_CONE * (1 - start), written so round starts give round knees (0.18 -> 0.918).\n { t: 1 - MIN_CONE + MIN_CONE * start, value: MIN_CONE },\n { t: 1, value: MIN_CONE },\n ];\n}\n","import {\n CURRENT_SCHEMA_VERSION,\n type BranchLevelDefinition,\n type FruitDefinition,\n type GroundTintDefinition,\n type HexColor,\n type Keyframe,\n type OcclusionDefinition,\n type RootsDefinition,\n type TranslucencyDefinition,\n type TreeDefinition,\n} from './types';\n\n/** Defaults for one branching level; fills fields missing from a partial `branches[i]`. */\nexport const DEFAULT_BRANCH_LEVEL: BranchLevelDefinition = {\n count: 6,\n start: 0.35,\n end: 0.95,\n angle: 45,\n angleVariation: 0.2,\n spiral: 137.5,\n length: 0.5,\n lengthVariation: 0.2,\n radius: 0.6,\n taper: 0.3,\n sides: 6,\n sections: 5,\n bend: 0.1,\n gravity: 0.1,\n};\n\n/** Defaults for the fields of a `fruit` block (a Definition has no Fruit unless it has the block). */\nexport const DEFAULT_FRUIT: FruitDefinition = {\n type: 'round',\n count: 2,\n size: 0.12,\n sizeVariation: 0.2,\n hang: 0.7,\n};\n\n/** Defaults for the fields of a `roots` block (a Definition has no Roots unless it has the block). */\nexport const DEFAULT_ROOTS: RootsDefinition = {\n count: 5,\n length: 0.25,\n lengthVariation: 0.3,\n radius: 0.35,\n angle: 12,\n bend: 0.3,\n};\n\n/** Defaults for the fields of a `materials.bark.groundTint` block (no Ground Tint unless it has the block). */\nexport const DEFAULT_GROUND_TINT: GroundTintDefinition = {\n color: '#3f4a2a',\n height: 0.5,\n strength: 0.6,\n};\n\n/** Defaults for the fields of a partial `materials.leaf.translucency` block (no Leaf Translucency unless it has the block). */\nexport const DEFAULT_TRANSLUCENCY: TranslucencyDefinition = {\n strength: 0.5,\n edge: 0.5,\n ambient: 0.3,\n};\n\n/** Defaults for the fields of a partial `materials.occlusion` block (no Structural Occlusion unless it has the block). */\nexport const DEFAULT_OCCLUSION: OcclusionDefinition = {\n strength: 0.7,\n};\n\n/** Fruit amount when the Season Profile has no `fruit` track: all Fruit at full size all year. */\nexport const DEFAULT_FRUIT_AMOUNT: Keyframe<number>[] = [{ t: 0, value: 1 }];\n\n/** Fruit colour when the Season Profile has no `fruitColor` track. */\nexport const DEFAULT_FRUIT_COLOR: Keyframe<HexColor>[] = [{ t: 0, value: '#b8322a' }];\n\n/**\n * The documented defaults: a small broadleaf tree with two branching levels.\n * Anything a Definition leaves out is taken from here.\n */\nexport const DEFAULT_DEFINITION: TreeDefinition = {\n schemaVersion: CURRENT_SCHEMA_VERSION,\n name: '',\n trunk: {\n length: 4,\n radius: 0.25,\n taper: 0.4,\n sides: 8,\n sections: 8,\n lengthVariation: 0.15,\n bend: 0.08,\n },\n branches: [\n { ...DEFAULT_BRANCH_LEVEL },\n { ...DEFAULT_BRANCH_LEVEL, count: 4, start: 0.2, angle: 40, length: 0.45, sides: 4, sections: 3 },\n ],\n leaves: {\n count: 8,\n shape: 'card',\n size: 0.25,\n sizeVariation: 0.2,\n start: 0.3,\n angle: 40,\n },\n materials: {\n shading: 'standard',\n bark: { color: '#6b4a2b', roughness: 0.9, map: null, normalMap: null },\n leaf: { roughness: 0.7, map: null, alphaTest: 0.5 },\n },\n season: {\n // Deciduous: fresh green in spring, deep green in summer, autumn colours, bare in winter.\n leafColor: [\n { t: 0, value: '#8bc34a' },\n { t: 0.25, value: '#3e7d2b' },\n { t: 0.5, value: '#3e7d2b' },\n { t: 0.62, value: '#d8892b' },\n { t: 0.72, value: '#a0401f' },\n ],\n leafCoverage: [\n { t: 0, value: 0.3 },\n { t: 0.1, value: 1 },\n { t: 0.62, value: 1 },\n { t: 0.75, value: 0 },\n { t: 0.97, value: 0 },\n { t: 1, value: 0.3 },\n ],\n blossom: [{ t: 0, value: 0 }],\n blossomColor: '#f7c6d9',\n },\n wind: { trunk: 0.2, branches: 0.5, leaves: 0.8, frequency: 1 },\n variation: { color: 0.1, growth: 0.1, season: 0.05 },\n sculpts: [],\n};\n","/**\n * Schema migrations. `MIGRATIONS[n]` turns a raw (unvalidated) schemaVersion `n` object into\n * a raw schemaVersion `n + 1` object. Migrations run in order before defaults and validation,\n * so they only need to move/rename what changed; missing fields are defaulted afterwards.\n *\n * To change the format: bump CURRENT_SCHEMA_VERSION, add `MIGRATIONS[old]`, and add a\n * fixture in test/fixtures/definition-v<old>.json with a test.\n */\nimport { coneCurve } from './crown-shape';\nimport { DEFAULT_BRANCH_LEVEL, DEFAULT_DEFINITION } from './defaults';\n\ntype Raw = Record<string, unknown>;\n\nexport const MIGRATIONS: Record<number, (input: Raw) => Raw> = {\n /**\n * v1 -> v2: `bark` moved into `materials.bark`; branches, leaves, Season Profile, Wind,\n * variation and sculpts were added. A v1 tree was a bare trunk, so it keeps no branches\n * and no leaves (same tree as before).\n */\n 1: (input) => {\n const { bark, ...rest } = input;\n return {\n ...rest,\n schemaVersion: 2,\n branches: [],\n leaves: { count: 0 },\n ...(bark === undefined ? {} : { materials: { bark } }),\n };\n },\n /**\n * v2 -> v3: `form` is removed (ADR 0004). A conifer's cone becomes a Crown Shape length curve on\n * the first branch level (identical tree); a broadleaf just drops `form`. Unknown `form` values are\n * kept so validation reports them.\n */\n 2: (input) => {\n const { form, ...rest } = input;\n const out: Raw = { ...rest, schemaVersion: 3 };\n if (form !== undefined && form !== 'broadleaf' && form !== 'conifer') out.form = form;\n if (form !== 'conifer') return out;\n // A v2 Definition without `branches` grew the default levels; make them explicit to curve the first.\n const branches = Array.isArray(rest.branches) ? rest.branches : DEFAULT_DEFINITION.branches.map((b) => ({ ...b }));\n if (branches.length === 0) return out;\n const [first, ...deeper] = branches as unknown[];\n if (typeof first !== 'object' || first === null || Array.isArray(first)) return out; // validation reports it\n const level = first as Raw;\n const start = typeof level.start === 'number' ? level.start : DEFAULT_BRANCH_LEVEL.start;\n return { ...out, branches: [{ ...level, lengthProfile: coneCurve(start) }, ...deeper] };\n },\n};\n","import {\n DEFAULT_BRANCH_LEVEL,\n DEFAULT_DEFINITION,\n DEFAULT_FRUIT,\n DEFAULT_GROUND_TINT,\n DEFAULT_OCCLUSION,\n DEFAULT_ROOTS,\n DEFAULT_TRANSLUCENCY,\n} from './defaults';\nimport {\n BARK_TYPES,\n FRUIT_TYPES,\n CURRENT_SCHEMA_VERSION,\n LEAF_TYPES,\n MAX_BRANCH_LEVELS,\n type BarkMaterialDefinition,\n type BranchLevelDefinition,\n type DeleteSculpt,\n type FruitDefinition,\n type GroundTintDefinition,\n type LeafMaterialDefinition,\n type MaterialsDefinition,\n type OcclusionDefinition,\n type RootsDefinition,\n type TranslucencyDefinition,\n type SeasonProfileDefinition,\n type Keyframe,\n type LeavesDefinition,\n type LeavesSculpt,\n type MoveSculpt,\n type Sculpt,\n type TreeDefinition,\n type TrunkDefinition,\n} from './types';\n\n/** Thrown for an invalid Tree Definition; `field` is the path of the bad field, e.g. `branches[1].angle`. */\nexport class TreeDefinitionError extends Error {\n readonly field: string;\n constructor(field: string, message: string) {\n super(`Invalid Tree Definition: ${field} ${message}`);\n this.name = 'TreeDefinitionError';\n this.field = field;\n }\n}\n\n/**\n * A schema node: validates `value` at `path`, filling it from `fallback` (the default)\n * when it is undefined, and returns a fresh, complete value. Throws TreeDefinitionError.\n */\ntype Schema<T> = (value: unknown, fallback: T | undefined, path: string) => T;\n\nconst ROOT = '(root)';\nconst join = (path: string, key: string) => (path === ROOT ? key : `${path}.${key}`);\nconst show = (v: unknown) => (v === undefined ? 'undefined' : JSON.stringify(v));\n\nexport function isObject(v: unknown): v is Record<string, unknown> {\n return typeof v === 'object' && v !== null && !Array.isArray(v);\n}\n\n/** Leaf schema from a predicate; `undefined` takes the fallback, or is reported missing. */\nfunction leaf<T>(expected: string, ok: (v: unknown) => boolean): Schema<T> {\n return (value, fallback, path) => {\n const v = value === undefined ? fallback : value;\n if (v === undefined) throw new TreeDefinitionError(path, 'is missing');\n if (!ok(v)) throw new TreeDefinitionError(path, `must be ${expected}, got ${show(v)}`);\n return (Array.isArray(v) ? [...v] : v) as T;\n };\n}\n\nconst isNum = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v);\nconst range = (min: number, max: number) => leaf<number>(`a number from ${min} to ${max}`, (v) => isNum(v) && v >= min && v <= max);\nconst unit = range(0, 1);\nconst nonNegative = leaf<number>('a number >= 0', (v) => isNum(v) && v >= 0);\nconst positive = leaf<number>('a number > 0', (v) => isNum(v) && v > 0);\nconst finite = leaf<number>('a finite number', isNum);\nconst intAtLeast = (min: number) => leaf<number>(`an integer >= ${min}`, (v) => Number.isInteger(v) && (v as number) >= min);\nconst intRange = (min: number, max: number) =>\n leaf<number>(`an integer from ${min} to ${max}`, (v) => Number.isInteger(v) && (v as number) >= min && (v as number) <= max);\n/** Faces around a Fruit or a Root (its polygon detail). */\nconst partSides = intRange(3, 16);\nconst hexColor = leaf<string>('a colour like \"#6b4a2b\"', (v) => typeof v === 'string' && /^#[0-9a-f]{6}$/i.test(v));\nconst text = leaf<string>('a string', (v) => typeof v === 'string');\nconst url = leaf<string | null>('a URL string or null', (v) => v === null || (typeof v === 'string' && v.length > 0));\nconst vec3 = leaf<[number, number, number]>('[x, y, z] numbers', (v) => Array.isArray(v) && v.length === 3 && v.every(isNum));\nconst oneOf = <T extends string>(...values: T[]) =>\n leaf<T>(`one of ${values.map((x) => `\"${x}\"`).join(', ')}`, (v) => values.includes(v as T));\nconst literal = <T>(expected: T) => leaf<T>(String(expected), (v) => v === expected);\n\n/** An optional field: absent (undefined) stays absent, anything else must match `schema`. */\nfunction optional<T>(schema: Schema<T>): Schema<T | undefined> {\n return (value, fallback, path) => (value === undefined && fallback === undefined ? undefined : schema(value, fallback, path));\n}\n\n/** An optional block: absent stays absent; a given (possibly partial) block is filled from `defaults`. */\nfunction optionalBlock<T>(schema: Schema<T>, defaults: T): Schema<T | undefined> {\n return (value, fallback, path) => (value === undefined && fallback === undefined ? undefined : schema(value, fallback ?? defaults, path));\n}\n\n/** Object with exactly these fields; unknown fields are rejected (catches typos). */\nfunction obj<T>(fields: { [K in keyof T]-?: Schema<T[K]> }): Schema<T> {\n return (value, fallback, path) => {\n if (value === undefined && fallback === undefined) throw new TreeDefinitionError(path, 'is missing');\n const given = value === undefined ? {} : value;\n if (!isObject(given)) throw new TreeDefinitionError(path, `must be an object, got ${show(given)}`);\n for (const key of Object.keys(given)) {\n if (!(key in fields)) throw new TreeDefinitionError(join(path, key), 'is not a known field');\n }\n const out: Record<string, unknown> = {};\n for (const key of Object.keys(fields) as (keyof T & string)[]) {\n const field = fields[key](given[key], fallback?.[key], join(path, key));\n // Optional fields (see `optional`) that are absent stay absent.\n if (field !== undefined) out[key] = field;\n }\n return out as T;\n };\n}\n\n/** Array; a missing array takes the fallback array, each item is filled from `itemFallback`. */\nfunction arr<T>(item: Schema<T>, opts: { min?: number; max?: number; itemFallback?: T } = {}): Schema<T[]> {\n const { min = 0, max = Infinity, itemFallback } = opts;\n return (value, fallback, path) => {\n const v = value === undefined ? fallback : value;\n if (v === undefined) throw new TreeDefinitionError(path, 'is missing');\n if (!Array.isArray(v)) throw new TreeDefinitionError(path, `must be an array, got ${show(v)}`);\n if (v.length < min) throw new TreeDefinitionError(path, `must have at least ${min} entries`);\n if (v.length > max) throw new TreeDefinitionError(path, `must have at most ${max} entries`);\n return v.map((x, i) => item(x, itemFallback, `${path}[${i}]`));\n };\n}\n\n/** Adds a cross-field check; `check` returns [field, problem] or null. */\nfunction refine<T>(schema: Schema<T>, check: (v: T) => [string, string] | null): Schema<T> {\n return (value, fallback, path) => {\n const v = schema(value, fallback, path);\n const problem = check(v);\n if (problem) throw new TreeDefinitionError(join(path, problem[0]), problem[1]);\n return v;\n };\n}\n\n/** Union discriminated by `key`. */\nfunction tagged<T>(key: string, variants: Record<string, Schema<T>>): Schema<T> {\n const names = Object.keys(variants);\n return (value, fallback, path) => {\n if (!isObject(value)) throw new TreeDefinitionError(path, `must be an object, got ${show(value)}`);\n const variant = variants[value[key] as string];\n if (!variant) {\n throw new TreeDefinitionError(join(path, key), `must be one of ${names.map((n) => `\"${n}\"`).join(', ')}, got ${show(value[key])}`);\n }\n return variant(value, fallback, path);\n };\n}\n\n/** Keyframe track: at least one key, `t` in 0..1 and non-decreasing. */\nfunction track<V>(value: Schema<V>): Schema<Keyframe<V>[]> {\n const keys = arr(obj<Keyframe<V>>({ t: unit, value }), { min: 1 });\n return (v, fallback, path) => {\n const out = keys(v, fallback, path);\n for (let i = 1; i < out.length; i++) {\n if (out[i]!.t < out[i - 1]!.t) {\n throw new TreeDefinitionError(`${path}[${i}].t`, `must be >= the previous keyframe's t (${out[i - 1]!.t}), got ${out[i]!.t}`);\n }\n }\n return out;\n };\n}\n\nconst branchLevel = refine(\n obj<BranchLevelDefinition>({\n count: intAtLeast(0),\n start: unit,\n end: unit,\n angle: range(0, 180),\n angleVariation: unit,\n spiral: range(0, 360),\n length: positive,\n lengthVariation: unit,\n radius: unit,\n taper: unit,\n sides: intAtLeast(3),\n sections: intAtLeast(1),\n bend: unit,\n gravity: range(-1, 1),\n lengthProfile: optional(track(nonNegative)),\n angleProfile: optional(track(nonNegative)),\n }),\n (b) => (b.end < b.start ? ['end', `must be >= start (${b.start}), got ${b.end}`] : null),\n);\n\nconst branchPath = leaf<string>('a branch path like \"0\", \"1\" or \"0.3.1\"', (v) => typeof v === 'string' && /^\\d+(\\.\\d+)*$/.test(v));\nconst sculpt = tagged<Sculpt>('action', {\n delete: obj<DeleteSculpt>({ action: literal('delete'), seed: finite, path: branchPath }) as Schema<Sculpt>,\n move: obj<MoveSculpt>({ action: literal('move'), seed: finite, path: branchPath, rotation: vec3, scale: positive }) as Schema<Sculpt>,\n leaves: obj<LeavesSculpt>({ action: literal('leaves'), seed: finite, path: branchPath, coverage: unit }) as Schema<Sculpt>,\n});\n\n/** The whole Tree Definition schema (current version). Mirrors the interfaces in types.ts. */\nconst treeDefinition = obj<TreeDefinition>({\n schemaVersion: literal(CURRENT_SCHEMA_VERSION),\n name: text,\n species: optional(text),\n trunk: obj<TrunkDefinition>({\n length: positive,\n radius: positive,\n taper: unit,\n sides: intAtLeast(3),\n sections: intAtLeast(1),\n lengthVariation: unit,\n bend: unit,\n stems: optional(intAtLeast(1)),\n spread: optional(range(0, 90)),\n gravity: optional(range(-1, 1)),\n flare: optional(unit),\n flareSections: optional(intAtLeast(1)),\n }),\n branches: arr(branchLevel, { max: MAX_BRANCH_LEVELS, itemFallback: DEFAULT_BRANCH_LEVEL }),\n leaves: obj<LeavesDefinition>({\n type: optional(oneOf(...LEAF_TYPES)),\n count: intAtLeast(0),\n shape: oneOf('card', 'clump', 'needle', 'puff'),\n size: positive,\n sizeVariation: unit,\n start: unit,\n angle: range(0, 180),\n }),\n fruit: optionalBlock<FruitDefinition>(\n obj<FruitDefinition>({\n type: oneOf(...FRUIT_TYPES),\n count: nonNegative,\n size: positive,\n sizeVariation: unit,\n hang: unit,\n sides: optional(partSides),\n }),\n DEFAULT_FRUIT,\n ),\n roots: optionalBlock<RootsDefinition>(\n obj<RootsDefinition>({\n count: intRange(0, 12),\n length: unit,\n lengthVariation: unit,\n radius: unit,\n angle: range(0, 60),\n bend: unit,\n sides: optional(partSides),\n sections: optional(intAtLeast(1)),\n }),\n DEFAULT_ROOTS,\n ),\n materials: obj<MaterialsDefinition>({\n shading: oneOf('standard', 'flat', 'toon'),\n bark: obj<BarkMaterialDefinition>({\n type: optional(oneOf(...BARK_TYPES)),\n color: hexColor,\n roughness: unit,\n map: url,\n normalMap: url,\n groundTint: optionalBlock<GroundTintDefinition>(\n obj<GroundTintDefinition>({ color: hexColor, height: positive, strength: unit }),\n DEFAULT_GROUND_TINT,\n ),\n }),\n leaf: obj<LeafMaterialDefinition>({\n roughness: unit,\n map: url,\n alphaTest: unit,\n // Material Features (ADR 0008): optional, absent = off.\n crownNormals: optional(unit),\n translucency: optionalBlock<TranslucencyDefinition>(\n obj<TranslucencyDefinition>({ strength: unit, edge: unit, ambient: unit }),\n DEFAULT_TRANSLUCENCY,\n ),\n }),\n occlusion: optionalBlock<OcclusionDefinition>(obj<OcclusionDefinition>({ strength: unit }), DEFAULT_OCCLUSION),\n }),\n season: obj<SeasonProfileDefinition>({\n leafColor: track(hexColor),\n leafCoverage: track(unit),\n blossom: track(unit),\n blossomColor: hexColor,\n fruit: optional(track(unit)),\n fruitColor: optional(track(hexColor)),\n }),\n wind: obj({ trunk: unit, branches: unit, leaves: unit, frequency: positive }),\n variation: obj({ color: unit, growth: unit, season: unit }),\n sculpts: arr(sculpt),\n});\n\n/**\n * Validates a raw current-version Definition and fills every missing field from\n * {@link DEFAULT_DEFINITION}. Returns a fresh object (never aliases input or defaults).\n */\nexport function validateDefinition(raw: Record<string, unknown>): TreeDefinition {\n return treeDefinition(raw, DEFAULT_DEFINITION, ROOT);\n}\n","import { MIGRATIONS } from './migrations';\nimport { isObject, TreeDefinitionError, validateDefinition } from './schema';\nimport { CURRENT_SCHEMA_VERSION, type DeepPartial, type TreeDefinition, type TreeDefinitionInput } from './types';\n\nexport { TreeDefinitionError } from './schema';\n\n/**\n * Turns untrusted input into a complete, valid Tree Definition:\n * - `input` is a Definition object (e.g. parsed JSON) or a JSON string;\n * - older `schemaVersion`s are migrated to {@link CURRENT_SCHEMA_VERSION};\n * - missing fields are filled from {@link DEFAULT_DEFINITION} (missing fields of a\n * `branches[i]` entry from {@link DEFAULT_BRANCH_LEVEL});\n * - every field is validated; unknown fields are rejected.\n * Throws {@link TreeDefinitionError} naming the first bad field (`field`, e.g. `branches[1].angle`).\n * Never mutates `input`.\n */\nexport function parseDefinition(input: unknown): TreeDefinition {\n let raw = input;\n if (typeof raw === 'string') {\n try {\n raw = JSON.parse(raw);\n } catch (e) {\n throw new TreeDefinitionError('(root)', `is not valid JSON: ${(e as Error).message}`);\n }\n }\n if (!isObject(raw)) throw new TreeDefinitionError('(root)', 'must be an object');\n const version = raw.schemaVersion;\n if (version === undefined) throw new TreeDefinitionError('schemaVersion', 'is missing');\n if (!Number.isInteger(version) || (version as number) < 1) {\n throw new TreeDefinitionError('schemaVersion', `must be an integer >= 1, got ${JSON.stringify(version)}`);\n }\n if ((version as number) > CURRENT_SCHEMA_VERSION) {\n throw new TreeDefinitionError(\n 'schemaVersion',\n `is ${version}, newer than this version of @casmo/tree.js supports (${CURRENT_SCHEMA_VERSION}); upgrade the library`,\n );\n }\n for (let v = version as number; v < CURRENT_SCHEMA_VERSION; v++) raw = MIGRATIONS[v]!(raw as Record<string, unknown>);\n return validateDefinition(raw as Record<string, unknown>);\n}\n\n/** Changes to apply on top of a Definition: any subset of its fields (arrays replace as a whole). */\nexport type DefinitionPatch = DeepPartial<Omit<TreeDefinition, 'schemaVersion'>>;\n\n/**\n * Starts from a Definition (e.g. a built-in Style) and changes a few parameters:\n * objects are merged deeply, arrays and values replace. Returns a new, validated Definition.\n *\n * ```ts\n * const tall = extendDefinition(broadleaf, { trunk: { length: 7 }, wind: { leaves: 1 } });\n * ```\n */\nexport function extendDefinition(base: TreeDefinition | TreeDefinitionInput, patch: DefinitionPatch): TreeDefinition {\n const parsed = parseDefinition(base);\n if (!isObject(patch)) throw new TreeDefinitionError('(root)', 'patch must be an object');\n return parseDefinition({ ...merge(parsed as unknown as Record<string, unknown>, patch), schemaVersion: CURRENT_SCHEMA_VERSION });\n}\n\nfunction merge(base: Record<string, unknown>, patch: Record<string, unknown>): Record<string, unknown> {\n const out: Record<string, unknown> = { ...base };\n for (const [key, value] of Object.entries(patch)) {\n if (value === undefined) continue;\n out[key] = isObject(value) && isObject(base[key]) ? merge(base[key], value) : value;\n }\n return out;\n}\n\n/**\n * Fetches a Tree Definition JSON file (e.g. a Tree Editor export) and parses it with\n * {@link parseDefinition}. Rejects with an Error for an HTTP error, or a TreeDefinitionError.\n */\nexport async function fetchDefinition(url: string | URL, init?: RequestInit): Promise<TreeDefinition> {\n const response = await fetch(url, init);\n if (!response.ok) throw new Error(`Could not load Tree Definition from ${String(url)}: HTTP ${response.status}`);\n return parseDefinition(await response.text());\n}\n","// Suggested Material Features per Style and the helper that opts a Definition in (ADR 0008).\n// Built-in Styles and Species never set Material Features: the app applies them explicitly.\nimport { parseDefinition } from '../definition/parse';\nimport type { MaterialFeatures, TreeDefinition, TreeDefinitionInput } from '../definition/types';\nimport type { StyleName } from './names';\n\n/**\n * Suggested Material Features for each built-in Style (like `SUGGESTED_TREE_EFFECTS`). Nothing uses\n * them by default; pass one to {@link withMaterialFeatures} to opt a Definition in.\n *\n * Tuned against the e2e screenshots (e2e/material-features.spec.ts). Structural Occlusion only darkens\n * ambient light, so it is set high; translucency stays low enough that a crown against the sun keeps its shape.\n */\nexport const SUGGESTED_MATERIAL_FEATURES: Record<StyleName, MaterialFeatures> = {\n // Facets stay visible (half-way crown normals); no translucency, which would soften the flat look.\n 'low-poly': {\n crownNormals: 0.5,\n occlusion: { strength: 0.8 },\n },\n // The crown lit as one soft shape, with a glow mostly at its thin edge against the sun.\n stylized: {\n crownNormals: 1,\n translucency: { strength: 0.3, edge: 0.8, ambient: 0.2 },\n occlusion: { strength: 0.9 },\n },\n // Some per-card detail stays; a natural glow, strongest at the thin edge of the crown.\n realistic: {\n crownNormals: 0.6,\n translucency: { strength: 0.45, edge: 0.7, ambient: 0.25 },\n occlusion: { strength: 0.9 },\n },\n};\n\n/**\n * The Material Features a Tree Definition has (`materials.leaf.crownNormals`, `materials.leaf.translucency`,\n * `materials.occlusion`), in the shape {@link withMaterialFeatures} takes. A feature that is absent is left\n * out; the values are the Definition's own (not copies).\n */\nexport function materialFeaturesOf(definition: TreeDefinition): MaterialFeatures {\n const { crownNormals, translucency } = definition.materials.leaf;\n const { occlusion } = definition.materials;\n return {\n ...(crownNormals === undefined ? {} : { crownNormals }),\n ...(translucency === undefined ? {} : { translucency }),\n ...(occlusion === undefined ? {} : { occlusion }),\n };\n}\n\n/**\n * Returns a new Tree Definition whose Material Features are exactly `features`: each feature given is\n * set, each feature left out is switched off (`{}` switches them all off). Everything else is kept. The\n * input is not changed. Throws a TreeDefinitionError for an out-of-range value.\n *\n * ```ts\n * const tree = createTree(withMaterialFeatures(stylized.broadleaf, SUGGESTED_MATERIAL_FEATURES.stylized));\n * ```\n */\nexport function withMaterialFeatures(definition: TreeDefinition | TreeDefinitionInput, features: MaterialFeatures): TreeDefinition {\n const parsed = parseDefinition(definition);\n // parseDefinition returns fresh objects, so the copies can drop the old features.\n const leaf = { ...parsed.materials.leaf };\n delete leaf.crownNormals;\n delete leaf.translucency;\n const materials = { ...parsed.materials };\n delete materials.occlusion;\n const { crownNormals, translucency, occlusion } = features;\n return parseDefinition({\n ...parsed,\n materials: {\n ...materials,\n leaf: {\n ...leaf,\n ...(crownNormals === undefined ? {} : { crownNormals }),\n ...(translucency === undefined ? {} : { translucency: { ...translucency } }),\n },\n ...(occlusion === undefined ? {} : { occlusion: { ...occlusion } }),\n },\n });\n}\n","// The built-in Styles: their names, display labels and shading. Kept apart from the loaders\n// (registry.ts) so Style.apply, the editor and the scripts can use them without pulling in a Style.\nimport type { Shading } from '../definition/types';\n\n/** Every built-in Style: its display label and the shading its Definitions use (one shading per Style). */\nconst STYLES = {\n 'low-poly': { label: 'Low-poly', shading: 'flat' },\n stylized: { label: 'Stylized', shading: 'toon' },\n realistic: { label: 'Realistic', shading: 'standard' },\n} as const satisfies Record<string, { label: string; shading: Shading }>;\n\n/** Name of a built-in Style, e.g. 'low-poly'. */\nexport type StyleName = keyof typeof STYLES;\n\n/** Names of all built-in Styles. */\nexport const STYLE_NAMES = Object.keys(STYLES) as StyleName[];\n\n/** Display label of a built-in Style, e.g. 'Low-poly'. */\nexport function styleLabel(name: StyleName): string {\n return STYLES[name].label;\n}\n\n/** The shading a built-in Style draws with. */\nexport function styleShading(name: StyleName): Shading {\n return STYLES[name].shading;\n}\n\n/** The built-in Style a Definition was drawn in, recognised by its `materials.shading`. */\nexport function styleOfShading(shading: Shading): StyleName {\n return STYLE_NAMES.find((name) => STYLES[name].shading === shading)!;\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,IAAa,yBAAyB;;AAuGtC,IAAa,oBAAoB;;AAcjC,IAAa,aAAkC;CAAC;CAAS;CAAS;CAAW;CAAY;CAAU;AAAO;;AAQ1G,IAAa,aAAkC;CAAC;CAAY;CAAU;CAAU;CAAW;AAAQ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OAAO;AACpE"}
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as clampGrowth, Y as wrapSeason, a as forestTreeKey, d as sceneWind, o as loadStyle, s as createTree, t as createForest } from "./forest-lg61rhKM.js";
|
|
2
2
|
import { use, useEffect, useLayoutEffect, useMemo, useState } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
// src/react/useTreeStyle.ts
|
package/dist/species/almond.js
CHANGED
|
@@ -7,7 +7,8 @@ var trunk = {
|
|
|
7
7
|
"radius": .2,
|
|
8
8
|
"taper": .4,
|
|
9
9
|
"lengthVariation": .12,
|
|
10
|
-
"bend": .22
|
|
10
|
+
"bend": .22,
|
|
11
|
+
"flare": .4
|
|
11
12
|
};
|
|
12
13
|
var branches = [
|
|
13
14
|
{
|
|
@@ -79,6 +80,14 @@ var fruit = {
|
|
|
79
80
|
"sizeVariation": .15,
|
|
80
81
|
"hang": .5
|
|
81
82
|
};
|
|
83
|
+
var roots = {
|
|
84
|
+
"count": 5,
|
|
85
|
+
"length": .2,
|
|
86
|
+
"lengthVariation": .3,
|
|
87
|
+
"radius": .3,
|
|
88
|
+
"angle": 14,
|
|
89
|
+
"bend": .3
|
|
90
|
+
};
|
|
82
91
|
var season = {
|
|
83
92
|
"leafColor": [
|
|
84
93
|
{
|
|
@@ -204,10 +213,11 @@ var almond_default = {
|
|
|
204
213
|
foliage,
|
|
205
214
|
bark,
|
|
206
215
|
fruit,
|
|
216
|
+
roots,
|
|
207
217
|
season,
|
|
208
218
|
wind,
|
|
209
219
|
variation
|
|
210
220
|
};
|
|
211
|
-
export { bark, branches, almond_default as default, foliage, form, fruit, id, name, season, trunk, variation, wind };
|
|
221
|
+
export { bark, branches, almond_default as default, foliage, form, fruit, id, name, roots, season, trunk, variation, wind };
|
|
212
222
|
|
|
213
223
|
//# sourceMappingURL=almond.js.map
|
package/dist/species/almond.json
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
"radius": 0.2,
|
|
8
8
|
"taper": 0.4,
|
|
9
9
|
"lengthVariation": 0.12,
|
|
10
|
-
"bend": 0.22
|
|
10
|
+
"bend": 0.22,
|
|
11
|
+
"flare": 0.4
|
|
11
12
|
},
|
|
12
13
|
"branches": [
|
|
13
14
|
{
|
|
@@ -82,6 +83,14 @@
|
|
|
82
83
|
"sizeVariation": 0.15,
|
|
83
84
|
"hang": 0.5
|
|
84
85
|
},
|
|
86
|
+
"roots": {
|
|
87
|
+
"count": 5,
|
|
88
|
+
"length": 0.2,
|
|
89
|
+
"lengthVariation": 0.3,
|
|
90
|
+
"radius": 0.3,
|
|
91
|
+
"angle": 14,
|
|
92
|
+
"bend": 0.3
|
|
93
|
+
},
|
|
85
94
|
"season": {
|
|
86
95
|
"leafColor": [
|
|
87
96
|
{
|
package/dist/species/apple.js
CHANGED
|
@@ -7,7 +7,8 @@ var trunk = {
|
|
|
7
7
|
"radius": .26,
|
|
8
8
|
"taper": .45,
|
|
9
9
|
"lengthVariation": .12,
|
|
10
|
-
"bend": .28
|
|
10
|
+
"bend": .28,
|
|
11
|
+
"flare": .4
|
|
11
12
|
};
|
|
12
13
|
var branches = [
|
|
13
14
|
{
|
|
@@ -86,6 +87,14 @@ var fruit = {
|
|
|
86
87
|
"sizeVariation": .15,
|
|
87
88
|
"hang": .95
|
|
88
89
|
};
|
|
90
|
+
var roots = {
|
|
91
|
+
"count": 5,
|
|
92
|
+
"length": .2,
|
|
93
|
+
"lengthVariation": .3,
|
|
94
|
+
"radius": .3,
|
|
95
|
+
"angle": 14,
|
|
96
|
+
"bend": .3
|
|
97
|
+
};
|
|
89
98
|
var season = {
|
|
90
99
|
"leafColor": [
|
|
91
100
|
{
|
|
@@ -211,10 +220,11 @@ var apple_default = {
|
|
|
211
220
|
foliage,
|
|
212
221
|
bark,
|
|
213
222
|
fruit,
|
|
223
|
+
roots,
|
|
214
224
|
season,
|
|
215
225
|
wind,
|
|
216
226
|
variation
|
|
217
227
|
};
|
|
218
|
-
export { bark, branches, apple_default as default, foliage, form, fruit, id, name, season, trunk, variation, wind };
|
|
228
|
+
export { bark, branches, apple_default as default, foliage, form, fruit, id, name, roots, season, trunk, variation, wind };
|
|
219
229
|
|
|
220
230
|
//# sourceMappingURL=apple.js.map
|
package/dist/species/apple.json
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
"radius": 0.26,
|
|
8
8
|
"taper": 0.45,
|
|
9
9
|
"lengthVariation": 0.12,
|
|
10
|
-
"bend": 0.28
|
|
10
|
+
"bend": 0.28,
|
|
11
|
+
"flare": 0.4
|
|
11
12
|
},
|
|
12
13
|
"branches": [
|
|
13
14
|
{
|
|
@@ -92,6 +93,14 @@
|
|
|
92
93
|
"sizeVariation": 0.15,
|
|
93
94
|
"hang": 0.95
|
|
94
95
|
},
|
|
96
|
+
"roots": {
|
|
97
|
+
"count": 5,
|
|
98
|
+
"length": 0.2,
|
|
99
|
+
"lengthVariation": 0.3,
|
|
100
|
+
"radius": 0.3,
|
|
101
|
+
"angle": 14,
|
|
102
|
+
"bend": 0.3
|
|
103
|
+
},
|
|
95
104
|
"season": {
|
|
96
105
|
"leafColor": [
|
|
97
106
|
{
|