@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
package/dist/bake/index.d.ts
CHANGED
|
@@ -1,23 +1,62 @@
|
|
|
1
1
|
import { Group } from 'three/webgpu';
|
|
2
|
+
import type { TranslucencyDefinition } from '../definition';
|
|
3
|
+
import { type CrownVolume } from '../generator';
|
|
2
4
|
import type { Tree } from '../tree';
|
|
3
5
|
/**
|
|
4
6
|
* Baked Tree: one tree frozen at a Seed, Growth and Season as plain static geometry with
|
|
5
|
-
* standard PBR materials (`MeshStandardMaterial`, no node materials,
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* standard PBR materials (`MeshStandardMaterial`, no node materials), for glTF export and other tools.
|
|
8
|
+
* Growth and Season are evaluated on the CPU with the same models the shaders run (`growPositions`,
|
|
9
|
+
* `leafSeason`, `fruitSeason`); Wind is left out (a Baked Tree stands still).
|
|
10
|
+
*
|
|
11
|
+
* Material Features (ADR 0008) are baked into standard glTF channels: Crown Normals blended into the normals,
|
|
12
|
+
* Structural Occlusion as a `_occlusion` attribute (glTF `_OCCLUSION`, strength already applied; optionally also in the vertex
|
|
13
|
+
* colours), Leaf Translucency as `KHR_materials_diffuse_transmission` (written by `exportBakedTree`),
|
|
14
|
+
* and the settings with the Crown Volume in `userData.treejs` of the leaf and bark materials (glTF
|
|
15
|
+
* `extras`). With no Material Feature set, the result is exactly as without them.
|
|
8
16
|
*/
|
|
9
17
|
/** Growth and Season to bake at; each defaults to the tree's current value. */
|
|
10
18
|
export interface BakeOptions {
|
|
11
19
|
growth?: number;
|
|
12
20
|
season?: number;
|
|
21
|
+
/**
|
|
22
|
+
* With Structural Occlusion (`materials.occlusion`): also multiply the occlusion into the vertex
|
|
23
|
+
* colours (`COLOR_0`), for engines that only read vertex colours. It then darkens direct light too.
|
|
24
|
+
* Default false: `COLOR_0` is as without the feature, and the occlusion is only in `_OCCLUSION`.
|
|
25
|
+
*/
|
|
26
|
+
occlusionInVertexColors?: boolean;
|
|
13
27
|
}
|
|
14
28
|
/**
|
|
15
29
|
* Freezes a tree at a Growth and Season (default: the tree's own) into a static `Group` of
|
|
16
30
|
* meshes `wood`, `leaves` and `fruit` (a mesh with nothing to show is left out) with standard PBR
|
|
17
|
-
* materials: no node materials, no Growth/Season/Wind attributes, no animation.
|
|
31
|
+
* materials: no node materials, no Growth/Season/Wind attributes, no animation. Material Features
|
|
32
|
+
* are baked in (see the top of this module). The result is
|
|
18
33
|
* independent of `tree`; call `disposeBakedTree` when done with it.
|
|
19
34
|
*/
|
|
20
35
|
export declare function bakeTree(tree: Tree, options?: BakeOptions): Group;
|
|
36
|
+
/**
|
|
37
|
+
* The `treejs` object in the extras of the baked leaf and bark materials: the Material Feature
|
|
38
|
+
* settings and the Crown Volume, for engines that rebuild the effects in their own shaders. The Crown
|
|
39
|
+
* Volume is in the Baked Tree's space (scaled by its Growth, like the geometry). Null when the tree has
|
|
40
|
+
* no Material Feature, so its glTF is as without them.
|
|
41
|
+
*/
|
|
42
|
+
export interface MaterialFeatureExtras {
|
|
43
|
+
/** Crown Normals amount; the baked `NORMAL` already has them blended in. */
|
|
44
|
+
crownNormals?: number;
|
|
45
|
+
/** Leaf Translucency settings (also written as `KHR_materials_diffuse_transmission`). */
|
|
46
|
+
translucency?: TranslucencyDefinition;
|
|
47
|
+
occlusion?: {
|
|
48
|
+
/** The Structural Occlusion strength the tree had. */
|
|
49
|
+
strength: number;
|
|
50
|
+
/**
|
|
51
|
+
* Always true: the baked `_OCCLUSION` is final, `mix(1, aOcclusion, strength)`, with the strength
|
|
52
|
+
* already applied. Use it as AO as it is; do not apply `strength` again.
|
|
53
|
+
*/
|
|
54
|
+
strengthApplied: true;
|
|
55
|
+
/** Whether `COLOR_0` is also multiplied by `_OCCLUSION` (`occlusionInVertexColors`). */
|
|
56
|
+
inVertexColors: boolean;
|
|
57
|
+
};
|
|
58
|
+
crown: CrownVolume;
|
|
59
|
+
}
|
|
21
60
|
/** Frees the geometries, materials and texture copies of a baked tree. */
|
|
22
61
|
export declare function disposeBakedTree(baked: Group): void;
|
|
23
62
|
export interface ExportBakedTreeOptions extends BakeOptions {
|
package/dist/bake/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bake/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bake/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,EAKN,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAoB,sBAAsB,EAAkB,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAe,KAAK,WAAW,EAAwB,MAAM,cAAc,CAAC;AAMnF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC;;;;;;;;;;;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AE,sBAAsB,GAAG,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import { type BranchLevelDefinition, type FruitDefinition, type HexColor, type Keyframe, type TreeDefinition } from './types';
|
|
1
|
+
import { type BranchLevelDefinition, type FruitDefinition, type GroundTintDefinition, type HexColor, type Keyframe, type OcclusionDefinition, type RootsDefinition, type TranslucencyDefinition, type TreeDefinition } from './types';
|
|
2
2
|
/** Defaults for one branching level; fills fields missing from a partial `branches[i]`. */
|
|
3
3
|
export declare const DEFAULT_BRANCH_LEVEL: BranchLevelDefinition;
|
|
4
4
|
/** Defaults for the fields of a `fruit` block (a Definition has no Fruit unless it has the block). */
|
|
5
5
|
export declare const DEFAULT_FRUIT: FruitDefinition;
|
|
6
|
+
/** Defaults for the fields of a `roots` block (a Definition has no Roots unless it has the block). */
|
|
7
|
+
export declare const DEFAULT_ROOTS: RootsDefinition;
|
|
8
|
+
/** Defaults for the fields of a `materials.bark.groundTint` block (no Ground Tint unless it has the block). */
|
|
9
|
+
export declare const DEFAULT_GROUND_TINT: GroundTintDefinition;
|
|
10
|
+
/** Defaults for the fields of a partial `materials.leaf.translucency` block (no Leaf Translucency unless it has the block). */
|
|
11
|
+
export declare const DEFAULT_TRANSLUCENCY: TranslucencyDefinition;
|
|
12
|
+
/** Defaults for the fields of a partial `materials.occlusion` block (no Structural Occlusion unless it has the block). */
|
|
13
|
+
export declare const DEFAULT_OCCLUSION: OcclusionDefinition;
|
|
6
14
|
/** Fruit amount when the Season Profile has no `fruit` track: all Fruit at full size all year. */
|
|
7
15
|
export declare const DEFAULT_FRUIT_AMOUNT: Keyframe<number>[];
|
|
8
16
|
/** Fruit colour when the Season Profile has no `fruitColor` track. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/definition/defaults.ts"],"names":[],"mappings":"AAAA,OA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AAsE;AACtE,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAAiC,CAAC;AAEtF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,cAoDhC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { BARK_TYPES, CURRENT_SCHEMA_VERSION, FRUIT_TYPES, LEAF_TYPES, MAX_BRANCH_LEVELS } from './types';
|
|
2
|
-
export type { TreeDefinition, TreeDefinitionInput, DeepPartial, HexColor, Vec3Tuple, TreeForm, TrunkDefinition, BranchLevelDefinition, LeafShape, LeafType, BarkType, LeavesDefinition, FruitType, FruitDefinition, Shading, MaterialsDefinition, BarkMaterialDefinition, LeafMaterialDefinition, Keyframe, SeasonProfileDefinition, WindResponseDefinition, VariationDefinition, Sculpt, DeleteSculpt, MoveSculpt, LeavesSculpt, } from './types';
|
|
2
|
+
export type { TreeDefinition, TreeDefinitionInput, DeepPartial, HexColor, Vec3Tuple, TreeForm, TrunkDefinition, BranchLevelDefinition, LeafShape, LeafType, BarkType, LeavesDefinition, FruitType, FruitDefinition, RootsDefinition, Shading, MaterialsDefinition, BarkMaterialDefinition, GroundTintDefinition, LeafMaterialDefinition, MaterialFeatures, TranslucencyDefinition, OcclusionDefinition, Keyframe, SeasonProfileDefinition, WindResponseDefinition, VariationDefinition, Sculpt, DeleteSculpt, MoveSculpt, LeavesSculpt, } from './types';
|
|
3
3
|
export { coneCurve } from './crown-shape';
|
|
4
|
-
export { DEFAULT_DEFINITION, DEFAULT_BRANCH_LEVEL, DEFAULT_FRUIT, DEFAULT_FRUIT_AMOUNT, DEFAULT_FRUIT_COLOR } from './defaults';
|
|
4
|
+
export { DEFAULT_DEFINITION, DEFAULT_BRANCH_LEVEL, DEFAULT_FRUIT, DEFAULT_GROUND_TINT, DEFAULT_OCCLUSION, DEFAULT_ROOTS, DEFAULT_TRANSLUCENCY, DEFAULT_FRUIT_AMOUNT, DEFAULT_FRUIT_COLOR } from './defaults';
|
|
5
5
|
export { parseDefinition, extendDefinition, fetchDefinition, TreeDefinitionError, type DefinitionPatch, } from './parse';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACzG,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,eAAe,EACf,qBAAqB,EACrB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,OAAO,EACP,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,QAAQ,EACR,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,MAAM,EACN,YAAY,EACZ,UAAU,EACV,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACzG,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,eAAe,EACf,qBAAqB,EACrB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,eAAe,EACf,OAAO,EACP,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,QAAQ,EACR,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,MAAM,EACN,YAAY,EACZ,UAAU,EACV,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,aAAa,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,aAAa,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC7M,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,KAAK,eAAe,GACrB,MAAM,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/definition/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/definition/schema.ts"],"names":[],"mappings":"AASA,OAAO,EAsBL,KAAK,cAAc,EAEpB,MAAM,SAAS,CAAC;AAEjB,6GAA6G;AAC7G,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBACX,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK3C;AAYD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEjE;AAuOD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,cAAc,CAE/E"}
|
|
@@ -53,6 +53,17 @@ export interface TrunkDefinition {
|
|
|
53
53
|
* drooping tip), + pulls a leaning Stem back up. The lower trunk is never bent. Absent = 0 (none).
|
|
54
54
|
*/
|
|
55
55
|
gravity?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Root Flare (0..1): how much each Stem widens towards the ground over the bottom of its length.
|
|
58
|
+
* 1 makes the base ring 1.8 × the trunk radius. Geometry only (ADR 0007): branches, leaves, Fruit,
|
|
59
|
+
* Growth, Wind and Sculpts never move. Absent = 0 (none).
|
|
60
|
+
*/
|
|
61
|
+
flare?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Number of extra sections the trunk sweep puts in the Root Flare (integer >= 1), set by the Style
|
|
64
|
+
* like `sides` and `sections`: 2 in low-poly, 3 in the others. Unused without flare. Absent = 3.
|
|
65
|
+
*/
|
|
66
|
+
flareSections?: number;
|
|
56
67
|
}
|
|
57
68
|
/**
|
|
58
69
|
* One level of branching. `branches[0]` grows from the trunk, `branches[1]` from the
|
|
@@ -166,6 +177,30 @@ export interface FruitDefinition {
|
|
|
166
177
|
*/
|
|
167
178
|
sides?: number;
|
|
168
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Roots (ADR 0007): their own tree part, grown after the Sculpt pass from the Root Flare of every
|
|
182
|
+
* remaining Stem, each from its own random stream, and drawn in the wood mesh after the branches.
|
|
183
|
+
* They run outward and down, taper to a point below the ground, grow with the trunk and never sway.
|
|
184
|
+
* They are not Sculptable. Absent = no Roots.
|
|
185
|
+
*/
|
|
186
|
+
export interface RootsDefinition {
|
|
187
|
+
/** Roots per Stem (integer 0..12). */
|
|
188
|
+
count: number;
|
|
189
|
+
/** Root length as a fraction of its Stem's length (after Seed variation and Sculpts), 0..1. */
|
|
190
|
+
length: number;
|
|
191
|
+
/** Seed range: ± this fraction of `length` (0..1). */
|
|
192
|
+
lengthVariation: number;
|
|
193
|
+
/** Base radius as a fraction of the trunk's base radius (0..1). */
|
|
194
|
+
radius: number;
|
|
195
|
+
/** How steeply a Root dives, degrees below horizontal (0..60). Every Root still ends below the ground. */
|
|
196
|
+
angle: number;
|
|
197
|
+
/** Seed range: sideways wander per section (0..1). */
|
|
198
|
+
bend: number;
|
|
199
|
+
/** Polygon detail, set by the Style: sides around each Root (integer 3..16). Absent = derived from `trunk.sides`. */
|
|
200
|
+
sides?: number;
|
|
201
|
+
/** Polygon detail, set by the Style: sections along each Root (integer >= 1). Absent = 4. */
|
|
202
|
+
sections?: number;
|
|
203
|
+
}
|
|
169
204
|
/** Material shading model. Low-poly uses `flat`, stylized `toon`, realistic `standard`. */
|
|
170
205
|
export type Shading = 'standard' | 'flat' | 'toon';
|
|
171
206
|
export interface BarkMaterialDefinition {
|
|
@@ -179,6 +214,20 @@ export interface BarkMaterialDefinition {
|
|
|
179
214
|
map: string | null;
|
|
180
215
|
/** Normal map URL, or null for none. */
|
|
181
216
|
normalMap: string | null;
|
|
217
|
+
/** Ground Tint: a darker or mossy bark colour near the ground. Optional; absent = none. */
|
|
218
|
+
groundTint?: GroundTintDefinition;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Ground Tint: at and below the ground (tree-space height <= 0, measured on the grown tree) the
|
|
222
|
+
* bark colour blends towards `color` by `strength`; the blend fades smoothly to nothing at `height`.
|
|
223
|
+
*/
|
|
224
|
+
export interface GroundTintDefinition {
|
|
225
|
+
/** The colour the bark blends towards near the ground. */
|
|
226
|
+
color: HexColor;
|
|
227
|
+
/** Metres above the ground where the tint has faded out (> 0). */
|
|
228
|
+
height: number;
|
|
229
|
+
/** How far the bark blends towards `color` at the ground (0..1). */
|
|
230
|
+
strength: number;
|
|
182
231
|
}
|
|
183
232
|
export interface LeafMaterialDefinition {
|
|
184
233
|
/** PBR roughness (0..1). Leaf colour comes from the Season Profile. */
|
|
@@ -187,11 +236,46 @@ export interface LeafMaterialDefinition {
|
|
|
187
236
|
map: string | null;
|
|
188
237
|
/** Alpha cut-off for `map` (0..1). */
|
|
189
238
|
alphaTest: number;
|
|
239
|
+
/**
|
|
240
|
+
* Crown Normals (a Material Feature, ADR 0008): how far each leaf's normal bends towards the
|
|
241
|
+
* Crown Volume's normal, 0 (each leaf lit on its own) .. 1 (the crown lit as one shape). Absent or 0 = off.
|
|
242
|
+
*/
|
|
243
|
+
crownNormals?: number;
|
|
244
|
+
/** Leaf Translucency (a Material Feature, ADR 0008). Absent = off. */
|
|
245
|
+
translucency?: TranslucencyDefinition;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Leaf Translucency: light shining through the leaves towards the viewer makes them glow in their
|
|
249
|
+
* own (Season) colour, more at the thin edge of the crown. All plain numbers, 0..1.
|
|
250
|
+
*/
|
|
251
|
+
export interface TranslucencyDefinition {
|
|
252
|
+
/** How strongly leaves with a direct light behind them glow (0..1). */
|
|
253
|
+
strength: number;
|
|
254
|
+
/** Extra glow at the thin edge of the Crown Volume (0 = the same everywhere .. 1 = only at the edge). */
|
|
255
|
+
edge: number;
|
|
256
|
+
/** The indirect (sky) part shining through the canopy, dimmed by occlusion (0..1). */
|
|
257
|
+
ambient: number;
|
|
258
|
+
}
|
|
259
|
+
/** Structural Occlusion: ambient light darkened where the tree hides itself (wood, leaves and Fruit). */
|
|
260
|
+
export interface OcclusionDefinition {
|
|
261
|
+
/** How far the baked occlusion darkens ambient and indirect light (0 = none .. 1 = fully). */
|
|
262
|
+
strength: number;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* The three Material Features (GLOSSARY, ADR 0008), with the same shapes as in a Definition
|
|
266
|
+
* (`materials.leaf.crownNormals`, `materials.leaf.translucency`, `materials.occlusion`). Absent = off.
|
|
267
|
+
*/
|
|
268
|
+
export interface MaterialFeatures {
|
|
269
|
+
crownNormals?: number;
|
|
270
|
+
translucency?: TranslucencyDefinition;
|
|
271
|
+
occlusion?: OcclusionDefinition;
|
|
190
272
|
}
|
|
191
273
|
export interface MaterialsDefinition {
|
|
192
274
|
shading: Shading;
|
|
193
275
|
bark: BarkMaterialDefinition;
|
|
194
276
|
leaf: LeafMaterialDefinition;
|
|
277
|
+
/** Structural Occlusion (a Material Feature, ADR 0008). Absent = off. */
|
|
278
|
+
occlusion?: OcclusionDefinition;
|
|
195
279
|
}
|
|
196
280
|
/**
|
|
197
281
|
* One keyframe of a track. In a Season Profile `t` is the Season (0 = first day of spring .. 1 = last
|
|
@@ -281,6 +365,8 @@ export interface TreeDefinition {
|
|
|
281
365
|
leaves: LeavesDefinition;
|
|
282
366
|
/** Fruit on the outermost twigs; absent = none. */
|
|
283
367
|
fruit?: FruitDefinition;
|
|
368
|
+
/** Roots on every Stem; absent = none. */
|
|
369
|
+
roots?: RootsDefinition;
|
|
284
370
|
materials: MaterialsDefinition;
|
|
285
371
|
season: SeasonProfileDefinition;
|
|
286
372
|
wind: WindResponseDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/definition/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,+BAA+B;AAC/B,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,gBAAgB;AAChB,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjD;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;AAE/C,yCAAyC;AACzC,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,eAAe,EAAE,MAAM,CAAC;IACxB,kGAAkG;IAClG,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;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AAG,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,GAC7D,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACtC,CAAC,CAAC;AAER;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { RenderPipeline, type Camera, type Node, type Object3D, type Renderer, type Scene } from 'three/webgpu';
|
|
2
2
|
import type { StyleName } from '../styles/registry';
|
|
3
|
-
import {
|
|
3
|
+
import type { TreeEffectInput } from './mask';
|
|
4
|
+
import { type TreeEffectsPass } from './pass';
|
|
4
5
|
import { type TreeEffectsSettings } from './suggested';
|
|
6
|
+
import type { ForestTree } from '../forest';
|
|
7
|
+
import type { Tree } from '../tree';
|
|
5
8
|
/**
|
|
6
9
|
* Applies a combination of Tree Effects to `input` and returns the resulting colour node, for use in
|
|
7
10
|
* your own post-processing pipeline (`pipeline.outputNode = applyTreeEffects(...)`, or feed it into
|
|
8
|
-
* more effects). Order: colour grade, leaf glow, outline
|
|
11
|
+
* more effects). Order: colour grade, leaf glow, inner lines, outline, highlight (always on top).
|
|
12
|
+
* Empty settings return `input.color`. `highlighted`: the trees the Highlight marks (mutable, read every frame).
|
|
9
13
|
*/
|
|
10
|
-
export declare function applyTreeEffects(input: TreeEffectInput, settings: TreeEffectsSettings): Node<'vec4'>;
|
|
14
|
+
export declare function applyTreeEffects(input: TreeEffectInput, settings: TreeEffectsSettings, highlighted?: readonly (Tree | ForestTree)[]): Node<'vec4'>;
|
|
11
15
|
/** The suggested combination of a built-in Style, or the settings themselves; `null` = no effects. */
|
|
12
16
|
export type TreeEffectsChoice = StyleName | TreeEffectsSettings | null;
|
|
13
17
|
export interface TreeEffectsOptions {
|
|
@@ -18,6 +22,19 @@ export interface TreeEffectsOptions {
|
|
|
18
22
|
* Default: every tree in the scene.
|
|
19
23
|
*/
|
|
20
24
|
selection?: Object3D[];
|
|
25
|
+
/**
|
|
26
|
+
* Keeps the Tree ID channel on even when no effect needs it, for {@link TreeEffects.pick}.
|
|
27
|
+
* Default: false (the channel is only rendered when an effect needs it). Whenever the Tree ID
|
|
28
|
+
* channel is on (this option, `outline.betweenTrees`, `highlight`, or the low-poly suggestion),
|
|
29
|
+
* the scene pass renders without MSAA: an integer target cannot be multisampled.
|
|
30
|
+
*/
|
|
31
|
+
treeId?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The trees the Highlight marks (`effects: { highlight: {...} }`): Trees and Forest trees, at most
|
|
34
|
+
* 64; mutable, read every frame, so hover and selection changes never recompile. Default: none
|
|
35
|
+
* (a new empty list, see {@link TreeEffects.highlighted}).
|
|
36
|
+
*/
|
|
37
|
+
highlighted?: (Tree | ForestTree)[];
|
|
21
38
|
}
|
|
22
39
|
/**
|
|
23
40
|
* A ready-made post-processing pipeline (`RenderPipeline`) with the Tree Effects: render with
|
|
@@ -26,16 +43,44 @@ export interface TreeEffectsOptions {
|
|
|
26
43
|
* and {@link applyTreeEffects} instead.
|
|
27
44
|
*/
|
|
28
45
|
export declare class TreeEffects {
|
|
46
|
+
private readonly renderer;
|
|
47
|
+
private readonly scene;
|
|
48
|
+
private readonly camera;
|
|
49
|
+
private readonly options;
|
|
29
50
|
readonly pipeline: RenderPipeline;
|
|
30
|
-
/** The
|
|
31
|
-
readonly
|
|
51
|
+
/** The trees the Highlight marks (the `highlighted` option, or an empty list): change it in place. */
|
|
52
|
+
readonly highlighted: (Tree | ForestTree)[];
|
|
32
53
|
private nodes;
|
|
33
54
|
private current;
|
|
55
|
+
private graph;
|
|
56
|
+
private input;
|
|
34
57
|
constructor(renderer: Renderer, scene: Scene, camera: Camera, options?: TreeEffectsOptions);
|
|
58
|
+
/**
|
|
59
|
+
* The scene pass (colour + tree mask, plus the channels the settings need, such as the Tree ID).
|
|
60
|
+
*
|
|
61
|
+
* It is replaced by a new one (a new object, the old one disposed) when {@link set} needs another
|
|
62
|
+
* set of channels, and only then; read it again after such a `set()` rather than keeping it.
|
|
63
|
+
* Swapping only the MRT of one PassNode is not feasible with three: a PassNode can add targets
|
|
64
|
+
* (`getTexture`) but has no way to remove one, and its sample count is fixed per target, so
|
|
65
|
+
* turning a channel off (or the Tree ID off, which brings MSAA back) needs a new pass. Either way
|
|
66
|
+
* the scene's materials recompile, because the MRT changes; settings that need the same channels
|
|
67
|
+
* keep this pass and its MRT.
|
|
68
|
+
*/
|
|
69
|
+
get scenePass(): TreeEffectsPass;
|
|
35
70
|
/** The active combination (`{}` = none). */
|
|
36
71
|
get settings(): TreeEffectsSettings;
|
|
37
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Switches to a Style's suggested combination, custom settings, or none (`null`). With the same
|
|
74
|
+
* effects on (and the same glow radius) only the colours and numbers change, without a recompile;
|
|
75
|
+
* otherwise a new graph is built and the old one freed.
|
|
76
|
+
*/
|
|
38
77
|
set(effects: TreeEffectsChoice): void;
|
|
78
|
+
/**
|
|
79
|
+
* GPU picking: the Tree or Forest tree under a point of the canvas (CSS pixels from its top left
|
|
80
|
+
* corner, as `event.offsetX/offsetY`) in the last render, or `undefined` where no tree is drawn.
|
|
81
|
+
* Needs the Tree ID channel: throws when it is off (create the effects with `treeId: true`).
|
|
82
|
+
*/
|
|
83
|
+
pick(x: number, y: number): Promise<Tree | ForestTree | undefined>;
|
|
39
84
|
/** Renders the scene with the effects (call instead of `renderer.render(scene, camera)`). */
|
|
40
85
|
render(): void;
|
|
41
86
|
dispose(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effects.d.ts","sourceRoot":"","sources":["../../src/effects/effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,MAAM,EAAE,KAAK,IAAI,EAAE,KAA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|
|
2
|
+
import type { LiveTreeEffect } from './live';
|
|
2
3
|
import type { TreeEffectInput } from './mask';
|
|
3
4
|
/** Leaf glow settings. */
|
|
4
5
|
export interface LeafGlowOptions {
|
|
@@ -11,9 +12,13 @@ export interface LeafGlowOptions {
|
|
|
11
12
|
/** Blur radius (Gaussian sigma, in pixels at half resolution; default 6). */
|
|
12
13
|
radius?: number;
|
|
13
14
|
}
|
|
15
|
+
/** The blur radius of leaf glow settings (part of a Tree Effects graph's shape). */
|
|
16
|
+
export declare function glowRadius(options: LeafGlowOptions): number;
|
|
14
17
|
/**
|
|
15
18
|
* Tree Effect: a soft glow of the leaves. The bright (sunlit) leaf pixels are blurred and added
|
|
16
19
|
* back onto the tree pixels (leaves and the wood between them), never onto the rest of the scene.
|
|
17
20
|
*/
|
|
18
21
|
export declare function leafGlow(input: TreeEffectInput, options?: LeafGlowOptions): Node<'vec4'>;
|
|
22
|
+
/** {@link leafGlow} with its settings as uniforms; `radius` is fixed when built. */
|
|
23
|
+
export declare function liveLeafGlow(input: TreeEffectInput, options?: LeafGlowOptions): LiveTreeEffect<LeafGlowOptions>;
|
|
19
24
|
//# sourceMappingURL=glow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glow.d.ts","sourceRoot":"","sources":["../../src/effects/glow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,mBAAmB,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAG1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,0BAA0B;AAC1B,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,eAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"glow.d.ts","sourceRoot":"","sources":["../../src/effects/glow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,mBAAmB,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAG1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,0BAA0B;AAC1B,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAE3D;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,eAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,CAE5F;AAED,oFAAoF;AACpF,wBAAgB,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,eAAoB,GAAG,cAAc,CAAC,eAAe,CAAC,CAmBnH"}
|
package/dist/effects/grade.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ColorRepresentation, type Node } from 'three/webgpu';
|
|
2
|
+
import type { LiveTreeEffect } from './live';
|
|
2
3
|
import type { TreeEffectInput } from './mask';
|
|
3
4
|
/** Tree colour grading settings (all optional; the defaults change nothing). */
|
|
4
5
|
export interface TreeColorGradeOptions {
|
|
@@ -16,4 +17,6 @@ export interface TreeColorGradeOptions {
|
|
|
16
17
|
* Returns the graded colour where the tree mask is set and `input.color` unchanged elsewhere.
|
|
17
18
|
*/
|
|
18
19
|
export declare function treeColorGrade(input: TreeEffectInput, options?: TreeColorGradeOptions): Node<'vec4'>;
|
|
20
|
+
/** {@link treeColorGrade} with its settings as uniforms. */
|
|
21
|
+
export declare function liveTreeColorGrade(input: TreeEffectInput, options?: TreeColorGradeOptions): LiveTreeEffect<TreeColorGradeOptions>;
|
|
19
22
|
//# sourceMappingURL=grade.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grade.d.ts","sourceRoot":"","sources":["../../src/effects/grade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,mBAAmB,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,gFAAgF;AAChF,MAAM,WAAW,qBAAqB;IACpC,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC5B;AAID;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,qBAA0B,GAAG,IAAI,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"grade.d.ts","sourceRoot":"","sources":["../../src/effects/grade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,mBAAmB,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,gFAAgF;AAChF,MAAM,WAAW,qBAAqB;IACpC,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC5B;AAID;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,qBAA0B,GAAG,IAAI,CAAC,MAAM,CAAC,CAExG;AAED,4DAA4D;AAC5D,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,qBAA0B,GAAG,cAAc,CAAC,qBAAqB,CAAC,CAkBrI"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ColorRepresentation, type Node } from 'three/webgpu';
|
|
2
|
+
import type { ForestTree } from '../forest';
|
|
3
|
+
import type { Tree } from '../tree';
|
|
4
|
+
import type { LiveTreeEffect } from './live';
|
|
5
|
+
import type { TreeEffectInput } from './mask';
|
|
6
|
+
/** Highlight settings. */
|
|
7
|
+
export interface TreeHighlightOptions {
|
|
8
|
+
/** Colour the highlighted trees are tinted towards (default a warm yellow, '#ffe066'). */
|
|
9
|
+
color?: ColorRepresentation;
|
|
10
|
+
/** How far the trees are tinted towards `color`, 0..1 (default 0.25). */
|
|
11
|
+
tint?: number;
|
|
12
|
+
/** Brightness multiplier of the highlighted trees (default 1.25). */
|
|
13
|
+
brightness?: number;
|
|
14
|
+
/** Colour of the ring just outside the highlighted trees (default '#ffd23f'). */
|
|
15
|
+
outlineColor?: ColorRepresentation;
|
|
16
|
+
/** Width of the ring in pixels (default 2). */
|
|
17
|
+
thickness?: number;
|
|
18
|
+
/** Opacity of the whole Highlight, 0..1 (default 1). */
|
|
19
|
+
strength?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Pulse frequency in Hz: tint and brightness swing between their value and half of it (half the
|
|
22
|
+
* brightening); the ring stays solid. Default 0 = no pulse.
|
|
23
|
+
*/
|
|
24
|
+
pulse?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Tree Effect: marks the trees in `highlighted` (Trees and Forest trees; mutable, read every frame)
|
|
28
|
+
* by brightening and tinting their pixels and drawing a ring just outside them, the one Tree Effect
|
|
29
|
+
* that also changes pixels next to a tree. At most 64 trees (the rest is ignored with one warning); removed, disposed
|
|
30
|
+
* and undrawn trees are skipped. Needs the Tree ID input (`treeEffectsPass` with `{ treeId: true }`).
|
|
31
|
+
*/
|
|
32
|
+
export declare function treeHighlight(input: TreeEffectInput, highlighted: readonly (Tree | ForestTree)[], options?: TreeHighlightOptions): Node<'vec4'>;
|
|
33
|
+
/** {@link treeHighlight} with its settings as uniforms. */
|
|
34
|
+
export declare function liveTreeHighlight(input: TreeEffectInput, highlighted: readonly (Tree | ForestTree)[], options?: TreeHighlightOptions): LiveTreeEffect<TreeHighlightOptions>;
|
|
35
|
+
//# sourceMappingURL=highlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../src/effects/highlight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,mBAAmB,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAI9C,0BAA0B;AAC1B,MAAM,WAAW,oBAAoB;IACnC,0FAA0F;IAC1F,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAgBD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,CAAC,IAAI,GAAG,UAAU,CAAC,EAAE,EAAE,OAAO,GAAE,oBAAyB,GAAG,IAAI,CAAC,MAAM,CAAC,CAEnJ;AAED,2DAA2D;AAC3D,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,eAAe,EACtB,WAAW,EAAE,SAAS,CAAC,IAAI,GAAG,UAAU,CAAC,EAAE,EAC3C,OAAO,GAAE,oBAAyB,GACjC,cAAc,CAAC,oBAAoB,CAAC,CAoFtC"}
|
package/dist/effects/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
export { TREE_MASK, createTreeMask, treeMaskMRT,
|
|
1
|
+
export { TREE_MASK, createTreeMask, treeMaskMRT, treePartOf, type TreeEffectInput, type TreePart } from './mask';
|
|
2
|
+
export { treeEffectsPass, type TreeEffectsChannels, type TreeEffectsPass } from './pass';
|
|
2
3
|
export { treeOutline, type TreeOutlineOptions } from './outline';
|
|
4
|
+
export { innerLines, TREE_NORMAL, treeNormalMRT, type InnerLinesOptions } from './inner-lines';
|
|
3
5
|
export { leafGlow, type LeafGlowOptions } from './glow';
|
|
4
6
|
export { treeColorGrade, type TreeColorGradeOptions } from './grade';
|
|
7
|
+
export { treeHighlight, type TreeHighlightOptions } from './highlight';
|
|
8
|
+
export { TREE_ID, readTreeId, treeFromId, treeIdMRT, treeIdOf, treeIdTexture } from './tree-id';
|
|
5
9
|
export { SUGGESTED_TREE_EFFECTS, type TreeEffectsSettings } from './suggested';
|
|
6
10
|
export { applyTreeEffects, createTreeEffects, TreeEffects, type TreeEffectsChoice, type TreeEffectsOptions, } from './effects';
|
|
7
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/effects/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/effects/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACjH,OAAO,EAAE,eAAe,EAAE,KAAK,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAChG,OAAO,EAAE,sBAAsB,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACxB,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ColorRepresentation, type MRTNode, type Node } from 'three/webgpu';
|
|
2
|
+
import type { LiveTreeEffect } from './live';
|
|
3
|
+
import type { TreeEffectInput } from './mask';
|
|
4
|
+
/** Name of the view normal output in a pass's MRT (`scenePass.getTextureNode('normal')`), see {@link treeNormalMRT}. */
|
|
5
|
+
export declare const TREE_NORMAL = "normal";
|
|
6
|
+
/**
|
|
7
|
+
* The MRT output that renders view normals in the `'color'` encoding (`packNormalToRGB(normalView)`,
|
|
8
|
+
* the same as `directionToColor`) to a target named `normal`, for Inner Lines. Merge it into the MRT
|
|
9
|
+
* of your own scene pass and make the target RGBA8:
|
|
10
|
+
* `scenePass.setMRT(mrt({ output }).merge(treeMaskMRT()).merge(treeNormalMRT())); scenePass.getTexture('normal').type = UnsignedByteType;`.
|
|
11
|
+
* If your pipeline already renders normals (GTAO, SSR), pass that texture as the `normal` input instead.
|
|
12
|
+
*/
|
|
13
|
+
export declare function treeNormalMRT(): MRTNode;
|
|
14
|
+
/** Inner Lines settings. */
|
|
15
|
+
export interface InnerLinesOptions {
|
|
16
|
+
/** Line colour (default a dark green-brown). */
|
|
17
|
+
color?: ColorRepresentation;
|
|
18
|
+
/** How far apart (in pixels) the compared pixels are, which sets the line width (default 1). */
|
|
19
|
+
thickness?: number;
|
|
20
|
+
/** Opacity of the lines, 0..1 (default 1). */
|
|
21
|
+
strength?: number;
|
|
22
|
+
/** A line where the normals of neighbouring pixels differ by more than this, as 1 − dot (default 0.4). */
|
|
23
|
+
normalThreshold?: number;
|
|
24
|
+
/** A line where neighbouring pixels step away by more than this, as relative depth |Δz| / z (default 0.02). */
|
|
25
|
+
depthThreshold?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Tree Effect: ink lines inside the trees where the surface folds (normal edges) or steps away
|
|
29
|
+
* from the viewer (depth edges), such as around each leaf clump. Only drawn on tree pixels (of
|
|
30
|
+
* every tree, regardless of the outline's `selection`), and only from neighbours that are tree
|
|
31
|
+
* pixels too: the silhouette is left to the outline. Needs the `depth`, `camera` and `normal` inputs
|
|
32
|
+
* (`treeEffectsPass(scene, camera, null, { normal: true })` has them) and throws without them.
|
|
33
|
+
* Works with a standard, reversed (`reversedDepthBuffer`) or logarithmic (`logarithmicDepthBuffer`)
|
|
34
|
+
* depth buffer, and with perspective and orthographic cameras.
|
|
35
|
+
*/
|
|
36
|
+
export declare function innerLines(input: TreeEffectInput, options?: InnerLinesOptions): Node<'vec4'>;
|
|
37
|
+
/** {@link innerLines} with its settings as uniforms; the normal encoding is fixed when built. */
|
|
38
|
+
export declare function liveInnerLines(input: TreeEffectInput, options?: InnerLinesOptions): LiveTreeEffect<InnerLinesOptions>;
|
|
39
|
+
//# sourceMappingURL=inner-lines.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inner-lines.d.ts","sourceRoot":"","sources":["../../src/effects/inner-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,mBAAmB,EAAE,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAExF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAG9C,wHAAwH;AACxH,eAAO,MAAM,WAAW,WAAW,CAAC;AAEpC;;;;;;GAMG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED,4BAA4B;AAC5B,MAAM,WAAW,iBAAiB;IAChC,gDAAgD;IAChD,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,gGAAgG;IAChG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0GAA0G;IAC1G,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+GAA+G;IAC/G,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,iBAAsB,GAAG,IAAI,CAAC,MAAM,CAAC,CAEhG;AAED,iGAAiG;AACjG,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,iBAAsB,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAkDzH"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Node } from 'three/webgpu';
|
|
2
|
+
/**
|
|
3
|
+
* A built Tree Effect whose colours and numbers are uniforms: `update()` changes them in place
|
|
4
|
+
* (no new graph, no recompile). Settings that change the graph itself (its shape) need a new build.
|
|
5
|
+
*/
|
|
6
|
+
export interface LiveTreeEffect<Options> {
|
|
7
|
+
/** The resulting colour node. */
|
|
8
|
+
node: Node<'vec4'>;
|
|
9
|
+
/** Sets the uniforms to `options` (the shape-defining settings are ignored). */
|
|
10
|
+
update(options: Options): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=live.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../../src/effects/live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC;;;GAGG;AACH,MAAM,WAAW,cAAc,CAAC,OAAO;IACrC,iCAAiC;IACjC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACnB,gFAAgF;IAChF,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAChC"}
|
package/dist/effects/mask.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Camera, type Material, type MRTNode, type Node, type Object3D, type
|
|
1
|
+
import { type Camera, type Material, type MRTNode, type Node, type Object3D, type TextureNode } from 'three/webgpu';
|
|
2
2
|
/** Name of the tree mask output in a pass's MRT (`scenePass.getTextureNode(TREE_MASK)`). */
|
|
3
3
|
export declare const TREE_MASK = "treeMask";
|
|
4
4
|
/** The part of a tree a material draws. */
|
|
@@ -30,15 +30,27 @@ export interface TreeEffectInput {
|
|
|
30
30
|
color: Node<'vec4'>;
|
|
31
31
|
/** Tree mask texture (see {@link createTreeMask}), e.g. `scenePass.getTextureNode(TREE_MASK)`. */
|
|
32
32
|
mask: TextureNode;
|
|
33
|
+
/**
|
|
34
|
+
* Tree ID texture (`r32uint`, see `treeIdMRT`), e.g. `scenePass.getTextureNode(TREE_ID)`; only
|
|
35
|
+
* needed by effects that tell trees apart. Read it with exact texel loads, never filtered.
|
|
36
|
+
*/
|
|
37
|
+
treeId?: TextureNode;
|
|
38
|
+
/**
|
|
39
|
+
* Scene depth texture, e.g. `scenePass.getTextureNode('depth')`; only needed by effects that
|
|
40
|
+
* compare distances (the outline's `betweenTrees`, and Inner Lines with `camera`).
|
|
41
|
+
*/
|
|
42
|
+
depth?: TextureNode;
|
|
43
|
+
/** The camera the scene pass renders with (its near and far turn `depth` into view Z). */
|
|
44
|
+
camera?: Camera;
|
|
45
|
+
/**
|
|
46
|
+
* View-space normal texture, e.g. `scenePass.getTextureNode('normal')` (see `treeNormalMRT`, or
|
|
47
|
+
* your own normal MRT); only needed by Inner Lines. Encoded as `normalEncoding` says.
|
|
48
|
+
*/
|
|
49
|
+
normal?: TextureNode;
|
|
50
|
+
/**
|
|
51
|
+
* How `normal` stores the view normal: `'color'` (default) = `directionToColor(normalView)`, as in
|
|
52
|
+
* an RGBA8 target; `'direction'` = the normal itself, as in a float target.
|
|
53
|
+
*/
|
|
54
|
+
normalEncoding?: 'color' | 'direction';
|
|
33
55
|
}
|
|
34
|
-
/** A scene pass that renders the colour and the tree mask, ready for the Tree Effects. */
|
|
35
|
-
export interface TreeEffectsPass extends TreeEffectInput {
|
|
36
|
-
pass: PassNode;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Creates `pass(scene, camera)` with MRT `{ output, treeMask }` and returns it with its colour and
|
|
40
|
-
* mask texture nodes. `selection`: the trees to outline (default `null` = all trees), see
|
|
41
|
-
* {@link createTreeMask}. If your pipeline already has a scene pass, merge {@link treeMaskMRT} into it instead.
|
|
42
|
-
*/
|
|
43
|
-
export declare function treeEffectsPass(scene: Scene, camera: Camera, selection?: readonly Object3D[] | null): TreeEffectsPass;
|
|
44
56
|
//# sourceMappingURL=mask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../../src/effects/mask.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../../src/effects/mask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAG7H,4FAA4F;AAC5F,eAAO,MAAM,SAAS,aAAa,CAAC;AAEpC,2CAA2C;AAC3C,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,IAAI,CAGjF;AAOD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,SAAS,GAAE,SAAS,QAAQ,EAAE,GAAG,IAAW,GAAG,IAAI,CAAC,MAAM,CAAC,CAOzF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,SAAS,GAAE,SAAS,QAAQ,EAAE,GAAG,IAAW,GAAG,OAAO,CAIjF;AAED,6FAA6F;AAC7F,MAAM,WAAW,eAAe;IAC9B,6FAA6F;IAC7F,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACpB,kGAAkG;IAClG,IAAI,EAAE,WAAW,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,0FAA0F;IAC1F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;CACxC"}
|