@casmo/tree.js 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +485 -2
- package/dist/bake/index.d.ts +39 -0
- package/dist/bake/index.d.ts.map +1 -0
- package/dist/definition/defaults.d.ts +9 -0
- package/dist/definition/defaults.d.ts.map +1 -0
- package/dist/definition/index.d.ts +5 -0
- package/dist/definition/index.d.ts.map +1 -0
- package/dist/definition/migrations.d.ts +12 -0
- package/dist/definition/migrations.d.ts.map +1 -0
- package/dist/definition/parse.d.ts +30 -0
- package/dist/definition/parse.d.ts.map +1 -0
- package/dist/definition/schema.d.ts +13 -0
- package/dist/definition/schema.d.ts.map +1 -0
- package/dist/definition/types.d.ts +217 -0
- package/dist/definition/types.d.ts.map +1 -0
- package/dist/effects/effects.d.ts +46 -0
- package/dist/effects/effects.d.ts.map +1 -0
- package/dist/effects/glow.d.ts +19 -0
- package/dist/effects/glow.d.ts.map +1 -0
- package/dist/effects/grade.d.ts +19 -0
- package/dist/effects/grade.d.ts.map +1 -0
- package/dist/effects/index.d.ts +7 -0
- package/dist/effects/index.d.ts.map +1 -0
- package/dist/effects/mask.d.ts +44 -0
- package/dist/effects/mask.d.ts.map +1 -0
- package/dist/effects/outline.d.ts +18 -0
- package/dist/effects/outline.d.ts.map +1 -0
- package/dist/effects/suggested.d.ts +13 -0
- package/dist/effects/suggested.d.ts.map +1 -0
- package/dist/effects.js +249 -0
- package/dist/effects.js.map +1 -0
- package/dist/forest/Forest.d.ts +156 -0
- package/dist/forest/Forest.d.ts.map +1 -0
- package/dist/forest/index.d.ts +14 -0
- package/dist/forest/index.d.ts.map +1 -0
- package/dist/forest/nodes.d.ts +31 -0
- package/dist/forest/nodes.d.ts.map +1 -0
- package/dist/forest/placement.d.ts +52 -0
- package/dist/forest/placement.d.ts.map +1 -0
- package/dist/forest-OX9WvAwh.js +3057 -0
- package/dist/forest-OX9WvAwh.js.map +1 -0
- package/dist/generator/attributes.d.ts +20 -0
- package/dist/generator/attributes.d.ts.map +1 -0
- package/dist/generator/branches.d.ts +12 -0
- package/dist/generator/branches.d.ts.map +1 -0
- package/dist/generator/frames.d.ts +21 -0
- package/dist/generator/frames.d.ts.map +1 -0
- package/dist/generator/growth.d.ts +15 -0
- package/dist/generator/growth.d.ts.map +1 -0
- package/dist/generator/index.d.ts +22 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/leaf-shapes.d.ts +10 -0
- package/dist/generator/leaf-shapes.d.ts.map +1 -0
- package/dist/generator/leaves.d.ts +14 -0
- package/dist/generator/leaves.d.ts.map +1 -0
- package/dist/generator/mesh.d.ts +11 -0
- package/dist/generator/mesh.d.ts.map +1 -0
- package/dist/generator/sculpt.d.ts +28 -0
- package/dist/generator/sculpt.d.ts.map +1 -0
- package/dist/generator/trunk.d.ts +6 -0
- package/dist/generator/trunk.d.ts.map +1 -0
- package/dist/generator/types.d.ts +126 -0
- package/dist/generator/types.d.ts.map +1 -0
- package/dist/generator/vec.d.ts +12 -0
- package/dist/generator/vec.d.ts.map +1 -0
- package/dist/generator/wind.d.ts +27 -0
- package/dist/generator/wind.d.ts.map +1 -0
- package/dist/growth/evaluate.d.ts +32 -0
- package/dist/growth/evaluate.d.ts.map +1 -0
- package/dist/growth/index.d.ts +3 -0
- package/dist/growth/index.d.ts.map +1 -0
- package/dist/growth/tsl.d.ts +12 -0
- package/dist/growth/tsl.d.ts.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +198 -0
- package/dist/index.js.map +1 -0
- package/dist/materials/index.d.ts +18 -0
- package/dist/materials/index.d.ts.map +1 -0
- package/dist/materials/maps.d.ts +23 -0
- package/dist/materials/maps.d.ts.map +1 -0
- package/dist/materials/shading.d.ts +18 -0
- package/dist/materials/shading.d.ts.map +1 -0
- package/dist/materials/toon.d.ts +12 -0
- package/dist/materials/toon.d.ts.map +1 -0
- package/dist/math/index.d.ts +23 -0
- package/dist/math/index.d.ts.map +1 -0
- package/dist/profiles-BAiyeFlh.js +113 -0
- package/dist/profiles-BAiyeFlh.js.map +1 -0
- package/dist/random/index.d.ts +37 -0
- package/dist/random/index.d.ts.map +1 -0
- package/dist/react/Forest.d.ts +54 -0
- package/dist/react/Forest.d.ts.map +1 -0
- package/dist/react/Tree.d.ts +41 -0
- package/dist/react/Tree.d.ts.map +1 -0
- package/dist/react/Wind.d.ts +17 -0
- package/dist/react/Wind.d.ts.map +1 -0
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/useTreeStyle.d.ts +15 -0
- package/dist/react/useTreeStyle.d.ts.map +1 -0
- package/dist/react.js +239 -0
- package/dist/react.js.map +1 -0
- package/dist/renderer/index.d.ts +7 -0
- package/dist/renderer/index.d.ts.map +1 -0
- package/dist/season/check.d.ts +3 -0
- package/dist/season/check.d.ts.map +1 -0
- package/dist/season/index.d.ts +4 -0
- package/dist/season/index.d.ts.map +1 -0
- package/dist/season/nodes.d.ts +32 -0
- package/dist/season/nodes.d.ts.map +1 -0
- package/dist/season/profile.d.ts +78 -0
- package/dist/season/profile.d.ts.map +1 -0
- package/dist/season/profiles.d.ts +40 -0
- package/dist/season/profiles.d.ts.map +1 -0
- package/dist/styles/low-poly/index.d.ts +16 -0
- package/dist/styles/low-poly/index.d.ts.map +1 -0
- package/dist/styles/low-poly.js +165 -0
- package/dist/styles/low-poly.js.map +1 -0
- package/dist/styles/realistic/index.d.ts +23 -0
- package/dist/styles/realistic/index.d.ts.map +1 -0
- package/dist/styles/realistic.js +206 -0
- package/dist/styles/realistic.js.map +1 -0
- package/dist/styles/registry.d.ts +17 -0
- package/dist/styles/registry.d.ts.map +1 -0
- package/dist/styles/stylized/index.d.ts +17 -0
- package/dist/styles/stylized/index.d.ts.map +1 -0
- package/dist/styles/stylized.js +266 -0
- package/dist/styles/stylized.js.map +1 -0
- package/dist/styles/types.d.ts +12 -0
- package/dist/styles/types.d.ts.map +1 -0
- package/dist/textures/index.d.ts +44 -0
- package/dist/textures/index.d.ts.map +1 -0
- package/dist/textures/realistic/bark-normal.png +0 -0
- package/dist/textures/realistic/bark.png +0 -0
- package/dist/textures/realistic/leaf.png +0 -0
- package/dist/textures/realistic/needles.png +0 -0
- package/dist/tree/Tree.d.ts +70 -0
- package/dist/tree/Tree.d.ts.map +1 -0
- package/dist/tree/index.d.ts +14 -0
- package/dist/tree/index.d.ts.map +1 -0
- package/dist/types-BZjHhNz7.js +20 -0
- package/dist/types-BZjHhNz7.js.map +1 -0
- package/dist/wind/Wind.d.ts +54 -0
- package/dist/wind/Wind.d.ts.map +1 -0
- package/dist/wind/index.d.ts +4 -0
- package/dist/wind/index.d.ts.map +1 -0
- package/dist/wind/node.d.ts +38 -0
- package/dist/wind/node.d.ts.map +1 -0
- package/dist/wind/response.d.ts +27 -0
- package/dist/wind/response.d.ts.map +1 -0
- package/package.json +107 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type MeshStandardNodeMaterial } from 'three/webgpu';
|
|
2
|
+
import type { TreeDefinition } from '../definition';
|
|
3
|
+
import type { TextureOptions } from '../textures';
|
|
4
|
+
export { createShadedMaterial } from './shading';
|
|
5
|
+
/**
|
|
6
|
+
* Bark material: a TSL node material (ADR 0002). Growth/Season/Wind uniforms and
|
|
7
|
+
* per-Style variants hook in here in later tickets (#5-#10). `materials.bark.map` / `.normalMap`
|
|
8
|
+
* load through `textures` (base path / URL overrides, see `TextureOptions`).
|
|
9
|
+
*/
|
|
10
|
+
export declare function createBarkMaterial(definition: TreeDefinition, textures?: TextureOptions): MeshStandardNodeMaterial;
|
|
11
|
+
/**
|
|
12
|
+
* Leaf material: a TSL node material lit from both sides. `.color` is the Season Profile's
|
|
13
|
+
* leaf colour at Season 0 (what exporters see); `Tree` adds the Season nodes
|
|
14
|
+
* (`applySeasonToLeafMaterial`), whose colour is multiplied by the per-leaf vertex colours (the Seed's tint)
|
|
15
|
+
* and by the leaf card texture (`materials.leaf.map`, alpha cut at `alphaTest`), if any.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createLeafMaterial(definition: TreeDefinition, textures?: TextureOptions): MeshStandardNodeMaterial;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/materials/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,cAAc,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,wBAAwB,CAalH;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,cAAc,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,wBAAwB,CAWlH"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { MeshStandardNodeMaterial } from 'three/webgpu';
|
|
2
|
+
import type { BarkMaterialDefinition, LeafMaterialDefinition } from '../definition';
|
|
3
|
+
import { type TextureOptions } from '../textures';
|
|
4
|
+
type Node = any;
|
|
5
|
+
/**
|
|
6
|
+
* How often the bark texture repeats around (u) and along (v) a branch. Bark UVs run 0..1
|
|
7
|
+
* around and 0..1 along each branch, so this keeps the bark from stretching along long parts.
|
|
8
|
+
*/
|
|
9
|
+
export declare const BARK_REPEAT: readonly [number, number];
|
|
10
|
+
/**
|
|
11
|
+
* Textured bark: `color × map` (the glTF base colour convention) and a tangent-space normal map,
|
|
12
|
+
* both tiled by `BARK_REPEAT`. Returns the colour node to use, or `base` when there is no map.
|
|
13
|
+
* `.map` / `.normalMap` are also set, for exporters and so `tree.ready` can wait for them.
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyBarkMaps(material: MeshStandardNodeMaterial, bark: BarkMaterialDefinition, base: Node, textures?: TextureOptions): Node;
|
|
16
|
+
/**
|
|
17
|
+
* Alpha-cut leaf cards: `colorNode` = the card texture (rgba, card UVs), cut at `alphaTest`.
|
|
18
|
+
* The Season colour is multiplied in later (`applySeasonToLeafMaterial`). `.map` is set too, so
|
|
19
|
+
* the shadow pass cuts the same shape out of the leaf shadows.
|
|
20
|
+
*/
|
|
21
|
+
export declare function applyLeafMap(material: MeshStandardNodeMaterial, leaf: LeafMaterialDefinition, textures?: TextureOptions): void;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=maps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maps.d.ts","sourceRoot":"","sources":["../../src/materials/maps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAW,MAAM,cAAc,CAAC;AAEtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAkC,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlF,KAAK,IAAI,GAAG,GAAG,CAAC;AAEhB;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAU,CAAC;AAE7D;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,wBAAwB,EAClC,IAAI,EAAE,sBAAsB,EAC5B,IAAI,EAAE,IAAI,EACV,QAAQ,CAAC,EAAE,cAAc,GACxB,IAAI,CASN;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,wBAAwB,EAAE,IAAI,EAAE,sBAAsB,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAK9H"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MeshStandardNodeMaterial } from 'three/webgpu';
|
|
2
|
+
import type { Shading } from '../definition';
|
|
3
|
+
/**
|
|
4
|
+
* The Style layer of the tree materials: the base node material for a Definition's
|
|
5
|
+
* `materials.shading`. `createBarkMaterial` / `createLeafMaterial` start from it and then set
|
|
6
|
+
* their part-specific nodes (bark colour, Season colour, Growth/Wind `positionNode`), so those
|
|
7
|
+
* shared nodes work the same in every Style.
|
|
8
|
+
*
|
|
9
|
+
* - `flat` (low-poly): faceted lighting from the screen-space face normal (`flatShading`), so
|
|
10
|
+
* facets stay correct when Growth or Wind move vertices in `positionNode`. Rough, no gloss.
|
|
11
|
+
* - `standard` (realistic): smooth PBR shading.
|
|
12
|
+
* - `toon` (stylized): soft two-tone toon lighting (`SoftToonNodeMaterial`, still a standard
|
|
13
|
+
* node material underneath), smooth normals so leaf clumps read as rounded.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createShadedMaterial(shading: Shading): MeshStandardNodeMaterial;
|
|
16
|
+
/** Whether a shading model wants solid (flat) colours rather than smooth colour gradients. */
|
|
17
|
+
export declare const isFlatShading: (shading: Shading) => boolean;
|
|
18
|
+
//# sourceMappingURL=shading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shading.d.ts","sourceRoot":"","sources":["../../src/materials/shading.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,wBAAwB,CAI/E;AAED,8FAA8F;AAC9F,eAAO,MAAM,aAAa,GAAI,SAAS,OAAO,KAAG,OAA6B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MeshStandardNodeMaterial, type PhysicalLightingModel } from 'three/webgpu';
|
|
2
|
+
/**
|
|
3
|
+
* The stylized Style's material (`materials.shading: 'toon'`): a `MeshStandardNodeMaterial`
|
|
4
|
+
* lit by the soft toon model. Staying a standard material keeps every part node (Season
|
|
5
|
+
* colour, Growth/Wind `positionNode`) and exporters (they see a plain PBR material) working
|
|
6
|
+
* the same as for the other Styles.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SoftToonNodeMaterial extends MeshStandardNodeMaterial {
|
|
9
|
+
readonly isSoftToonMaterial = true;
|
|
10
|
+
setupLightingModel(): PhysicalLightingModel;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=toon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toon.d.ts","sourceRoot":"","sources":["../../src/materials/toon.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,wBAAwB,EAGxB,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAC;AAiCtB;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,wBAAwB;IAChE,QAAQ,CAAC,kBAAkB,QAAQ;IAE1B,kBAAkB,IAAI,qBAAqB;CAIrD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic maths: the same bits on every machine and JavaScript engine.
|
|
3
|
+
*
|
|
4
|
+
* ECMAScript leaves `Math.sin`, `Math.cos`, `Math.exp`, `Math.log`, `Math.pow`, `Math.hypot`, `**`
|
|
5
|
+
* and friends "implementation-approximated", so engines (and engine versions) may differ in the
|
|
6
|
+
* last bit, which would change a Seed's tree. Everything here is built from `+ - * /`,
|
|
7
|
+
* `Math.sqrt`, `Math.round`/`Math.floor` and exact bit manipulation, which IEEE 754 and the spec
|
|
8
|
+
* pin down exactly. The algorithms are those of fdlibm (sun.com, 1993), accurate to about 1 ulp.
|
|
9
|
+
* ESLint forbids the platform functions in the code that feeds generated geometry and hashes.
|
|
10
|
+
*/
|
|
11
|
+
/** Deterministic `Math.sin`. */
|
|
12
|
+
export declare function sin(x: number): number;
|
|
13
|
+
/** Deterministic `Math.cos`. */
|
|
14
|
+
export declare function cos(x: number): number;
|
|
15
|
+
/** Deterministic `Math.exp`. */
|
|
16
|
+
export declare function exp(x: number): number;
|
|
17
|
+
/** Deterministic `Math.log` (natural logarithm). */
|
|
18
|
+
export declare function log(x: number): number;
|
|
19
|
+
/** Deterministic `Math.pow` (`x ** y`), for the finite values the library uses. */
|
|
20
|
+
export declare function pow(x: number, y: number): number;
|
|
21
|
+
/** Deterministic `Math.hypot` of a 3-vector. */
|
|
22
|
+
export declare function hypot3(x: number, y: number, z: number): number;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/math/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAuDH,gCAAgC;AAChC,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAKrC;AAED,gCAAgC;AAChC,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAIrC;AAWD,gCAAgC;AAChC,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAcrC;AAWD,oDAAoD;AACpD,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAwBrC;AAED,mFAAmF;AACnF,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAWhD;AAED,gDAAgD;AAChD,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE9D"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// src/season/profiles.ts
|
|
2
|
+
/**
|
|
3
|
+
* Ready-made Season Profiles for the Styles (Season: 0 spring, 0.25 summer, 0.5 autumn,
|
|
4
|
+
* 0.75 winter, 1 last day of winter).
|
|
5
|
+
* - `deciduous`: broadleaf; fresh green in spring, deep green in summer, orange and red in
|
|
6
|
+
* autumn while the leaves fall, bare in winter, buds return at the very end of winter.
|
|
7
|
+
* - `evergreen`: conifer; full all year, only darkens a little in winter.
|
|
8
|
+
*/
|
|
9
|
+
var SEASON_PROFILES = {
|
|
10
|
+
deciduous: {
|
|
11
|
+
leafColor: [
|
|
12
|
+
{
|
|
13
|
+
t: 0,
|
|
14
|
+
value: "#8bc34a"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
t: .2,
|
|
18
|
+
value: "#3e7d2b"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
t: .5,
|
|
22
|
+
value: "#3e7d2b"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
t: .58,
|
|
26
|
+
value: "#d8892b"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
t: .68,
|
|
30
|
+
value: "#a0401f"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
t: .97,
|
|
34
|
+
value: "#a0401f"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
t: 1,
|
|
38
|
+
value: "#8bc34a"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
leafCoverage: [
|
|
42
|
+
{
|
|
43
|
+
t: 0,
|
|
44
|
+
value: .4
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
t: .08,
|
|
48
|
+
value: 1
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
t: .6,
|
|
52
|
+
value: 1
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
t: .74,
|
|
56
|
+
value: 0
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
t: .96,
|
|
60
|
+
value: 0
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
t: 1,
|
|
64
|
+
value: .4
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
blossom: [{
|
|
68
|
+
t: 0,
|
|
69
|
+
value: 0
|
|
70
|
+
}],
|
|
71
|
+
blossomColor: "#f7c6d9"
|
|
72
|
+
},
|
|
73
|
+
evergreen: {
|
|
74
|
+
leafColor: [
|
|
75
|
+
{
|
|
76
|
+
t: 0,
|
|
77
|
+
value: "#3f7a35"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
t: .25,
|
|
81
|
+
value: "#2f6a2e"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
t: .55,
|
|
85
|
+
value: "#2f6a2e"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
t: .75,
|
|
89
|
+
value: "#26502b"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
t: .92,
|
|
93
|
+
value: "#26502b"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
t: 1,
|
|
97
|
+
value: "#3f7a35"
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
leafCoverage: [{
|
|
101
|
+
t: 0,
|
|
102
|
+
value: 1
|
|
103
|
+
}],
|
|
104
|
+
blossom: [{
|
|
105
|
+
t: 0,
|
|
106
|
+
value: 0
|
|
107
|
+
}],
|
|
108
|
+
blossomColor: "#f7c6d9"
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
export { SEASON_PROFILES as t };
|
|
112
|
+
|
|
113
|
+
//# sourceMappingURL=profiles-BAiyeFlh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles-BAiyeFlh.js","names":[],"sources":["../src/season/profiles.ts"],"sourcesContent":["import type { SeasonProfileDefinition } from '../definition';\n\n/**\n * Ready-made Season Profiles for the Styles (Season: 0 spring, 0.25 summer, 0.5 autumn,\n * 0.75 winter, 1 last day of winter).\n * - `deciduous`: broadleaf; fresh green in spring, deep green in summer, orange and red in\n * autumn while the leaves fall, bare in winter, buds return at the very end of winter.\n * - `evergreen`: conifer; full all year, only darkens a little in winter.\n */\nexport const SEASON_PROFILES = {\n deciduous: {\n leafColor: [\n { t: 0, value: '#8bc34a' },\n { t: 0.2, value: '#3e7d2b' },\n { t: 0.5, value: '#3e7d2b' },\n { t: 0.58, value: '#d8892b' },\n { t: 0.68, value: '#a0401f' },\n { t: 0.97, value: '#a0401f' },\n { t: 1, value: '#8bc34a' },\n ],\n leafCoverage: [\n { t: 0, value: 0.4 },\n { t: 0.08, value: 1 },\n { t: 0.6, value: 1 },\n { t: 0.74, value: 0 },\n { t: 0.96, value: 0 },\n { t: 1, value: 0.4 },\n ],\n blossom: [{ t: 0, value: 0 }],\n blossomColor: '#f7c6d9',\n },\n evergreen: {\n leafColor: [\n { t: 0, value: '#3f7a35' },\n { t: 0.25, value: '#2f6a2e' },\n { t: 0.55, value: '#2f6a2e' },\n { t: 0.75, value: '#26502b' },\n { t: 0.92, value: '#26502b' },\n { t: 1, value: '#3f7a35' },\n ],\n leafCoverage: [{ t: 0, value: 1 }],\n blossom: [{ t: 0, value: 0 }],\n blossomColor: '#f7c6d9',\n },\n} satisfies Record<string, SeasonProfileDefinition>;\n"],"mappings":";;;;;;;;AASA,IAAa,kBAAkB;CAC7B,WAAW;EACT,WAAW;GACT;IAAE,GAAG;IAAG,OAAO;GAAU;GACzB;IAAE,GAAG;IAAK,OAAO;GAAU;GAC3B;IAAE,GAAG;IAAK,OAAO;GAAU;GAC3B;IAAE,GAAG;IAAM,OAAO;GAAU;GAC5B;IAAE,GAAG;IAAM,OAAO;GAAU;GAC5B;IAAE,GAAG;IAAM,OAAO;GAAU;GAC5B;IAAE,GAAG;IAAG,OAAO;GAAU;EAC3B;EACA,cAAc;GACZ;IAAE,GAAG;IAAG,OAAO;GAAI;GACnB;IAAE,GAAG;IAAM,OAAO;GAAE;GACpB;IAAE,GAAG;IAAK,OAAO;GAAE;GACnB;IAAE,GAAG;IAAM,OAAO;GAAE;GACpB;IAAE,GAAG;IAAM,OAAO;GAAE;GACpB;IAAE,GAAG;IAAG,OAAO;GAAI;EACrB;EACA,SAAS,CAAC;GAAE,GAAG;GAAG,OAAO;EAAE,CAAC;EAC5B,cAAc;CAChB;CACA,WAAW;EACT,WAAW;GACT;IAAE,GAAG;IAAG,OAAO;GAAU;GACzB;IAAE,GAAG;IAAM,OAAO;GAAU;GAC5B;IAAE,GAAG;IAAM,OAAO;GAAU;GAC5B;IAAE,GAAG;IAAM,OAAO;GAAU;GAC5B;IAAE,GAAG;IAAM,OAAO;GAAU;GAC5B;IAAE,GAAG;IAAG,OAAO;GAAU;EAC3B;EACA,cAAc,CAAC;GAAE,GAAG;GAAG,OAAO;EAAE,CAAC;EACjC,SAAS,CAAC;GAAE,GAAG;GAAG,OAAO;EAAE,CAAC;EAC5B,cAAc;CAChB;AACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Random: the only source of randomness in tree.js.
|
|
3
|
+
*
|
|
4
|
+
* Determinism contract: the same Seed gives the same numbers on every machine
|
|
5
|
+
* and across releases within a major version. `Math.random` is never used
|
|
6
|
+
* (enforced by ESLint). Everything here is plain 32-bit integer math.
|
|
7
|
+
*/
|
|
8
|
+
/** FNV-1a 32-bit hash of a string (UTF-16 code units, low byte then high byte). */
|
|
9
|
+
export declare function hashString(input: string): number;
|
|
10
|
+
/** FNV-1a 32-bit hash over raw bytes; `h` continues a previous hash. */
|
|
11
|
+
export declare function hashBytes(bytes: Uint8Array, h?: number): number;
|
|
12
|
+
/** Mixes any number of 32-bit values into one well-distributed 32-bit hash. */
|
|
13
|
+
export declare function hashCombine(...values: number[]): number;
|
|
14
|
+
/** Converts any finite number (including fractions and negatives) to a 32-bit seed. */
|
|
15
|
+
export declare function seedToUint32(seed: number): number;
|
|
16
|
+
export interface Random {
|
|
17
|
+
/** Uniform float in [0, 1). */
|
|
18
|
+
next(): number;
|
|
19
|
+
/** Uniform float in [min, max). */
|
|
20
|
+
range(min: number, max: number): number;
|
|
21
|
+
/** Uniform integer in [min, max] (inclusive). */
|
|
22
|
+
int(min: number, max: number): number;
|
|
23
|
+
/**
|
|
24
|
+
* An independent stream derived from this stream's seed and `key`.
|
|
25
|
+
* It does not depend on how many numbers this stream has produced, so
|
|
26
|
+
* adding a draw in one part of the generator never shifts another part.
|
|
27
|
+
*/
|
|
28
|
+
fork(key: string | number): Random;
|
|
29
|
+
}
|
|
30
|
+
/** Seeded PRNG (mulberry32). */
|
|
31
|
+
export declare function createRandom(seed: number): Random;
|
|
32
|
+
/**
|
|
33
|
+
* A stable 0..1 (exclusive) number from a Seed and a key (a branch path, leaf id, purpose...).
|
|
34
|
+
* It makes no stream draws (ADR 0003), so it never shifts or is shifted by other random numbers.
|
|
35
|
+
*/
|
|
36
|
+
export declare function seedRandom(seed: number, key: string): number;
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/random/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAYhD;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,GAAE,MAAmB,GAAG,MAAM,CAM3E;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAOvD;AAED,uFAAuF;AACvF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKjD;AAWD,MAAM,WAAW,MAAM;IACrB,+BAA+B;IAC/B,IAAI,IAAI,MAAM,CAAC;IACf,mCAAmC;IACnC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IACxC,iDAAiD;IACjD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC;;;;OAIG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CACpC;AAED,gCAAgC;AAChC,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAoBD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5D"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Ref } from 'react';
|
|
2
|
+
import type { ThreeElements } from '@react-three/fiber';
|
|
3
|
+
import type { TreeDefinition, TreeDefinitionInput, TreeForm } from '../definition';
|
|
4
|
+
import type { TreeStyle } from '../styles/types';
|
|
5
|
+
import type { StyleName } from '../styles/registry';
|
|
6
|
+
import { type Forest as ForestObject } from '../forest';
|
|
7
|
+
import { type ForestPlacement } from '../forest/placement';
|
|
8
|
+
import { type Wind as WindObject } from '../wind';
|
|
9
|
+
type GroupProps = Omit<ThreeElements['group'], 'args' | 'object' | 'children' | 'ref' | 'castShadow' | 'receiveShadow' | 'dispose'>;
|
|
10
|
+
/** Where one tree of a `<Forest>` stands, optionally with its own Growth and Season. */
|
|
11
|
+
export interface ForestTreePlacement extends ForestPlacement {
|
|
12
|
+
/** This tree's Growth, 0..1. Default: the forest's `growth`. */
|
|
13
|
+
growth?: number;
|
|
14
|
+
/** This tree's Season, 0..1 (wraps). Default: the forest's `season`. */
|
|
15
|
+
season?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface ForestProps extends GroupProps {
|
|
18
|
+
/** The Tree Definition every tree is grown from (plain object or parsed JSON). Takes precedence over `style`. */
|
|
19
|
+
definition?: TreeDefinitionInput | TreeDefinition;
|
|
20
|
+
/** A Style (object from {@link useTreeStyle}, or a built-in Style name, loaded on demand: suspends). */
|
|
21
|
+
style?: TreeStyle | StyleName;
|
|
22
|
+
/** Which of the Style's Forms to grow. Default 'broadleaf'. */
|
|
23
|
+
form?: TreeForm;
|
|
24
|
+
/** How many Variants (distinct trees, each drawn instanced). Default 4. Changing it rebuilds the forest. */
|
|
25
|
+
variants?: number;
|
|
26
|
+
/** The forest seed. Default 0. Changing it rebuilds the forest. */
|
|
27
|
+
seed?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The trees. Trees are matched by key (their `id`, or their position without one), so adding or
|
|
30
|
+
* removing placements only plants or cuts those trees; the others keep their look and instance data.
|
|
31
|
+
*/
|
|
32
|
+
placements: readonly ForestTreePlacement[];
|
|
33
|
+
/** Growth of every tree without its own `growth`, 0..1. Default 1. Only rewrites instance data. */
|
|
34
|
+
growth?: number;
|
|
35
|
+
/** Season of every tree without its own `season`, 0..1 (wraps). Default 0. Only rewrites instance data. */
|
|
36
|
+
season?: number;
|
|
37
|
+
/** The Wind the forest sways with. Default: the scene-wide `sceneWind` (what `<Wind>` sets). */
|
|
38
|
+
wind?: WindObject;
|
|
39
|
+
/** Whether the trees cast shadows. Default true. */
|
|
40
|
+
castShadow?: boolean;
|
|
41
|
+
/** Whether the trees receive shadows. Default true. */
|
|
42
|
+
receiveShadow?: boolean;
|
|
43
|
+
/** Receives the tree.js `Forest` object (a three.js Group). */
|
|
44
|
+
ref?: Ref<ForestObject>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Many trees of one Definition, drawn instanced (a `Forest`). Changing `placements` plants or cuts
|
|
48
|
+
* only the affected trees; Growth, Season, Wind and shadow props only update instance data, uniforms
|
|
49
|
+
* and meshes. A new `definition` (by value), `style`/`form`, `variants` or `seed` rebuilds the forest.
|
|
50
|
+
* The forest is disposed of on unmount.
|
|
51
|
+
*/
|
|
52
|
+
export declare function Forest({ definition, style, form, variants, seed, placements, growth, season, wind, castShadow, receiveShadow, ref, ...groupProps }: ForestProps): import("react").JSX.Element;
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=Forest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Forest.d.ts","sourceRoot":"","sources":["../../src/react/Forest.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAgB,KAAK,MAAM,IAAI,YAAY,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG1E,OAAO,EAAa,KAAK,IAAI,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAG7D,KAAK,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,KAAK,GAAG,YAAY,GAAG,eAAe,GAAG,SAAS,CAAC,CAAC;AAEpI,wFAAwF;AACxF,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,iHAAiH;IACjH,UAAU,CAAC,EAAE,mBAAmB,GAAG,cAAc,CAAC;IAClD,wGAAwG;IACxG,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,+DAA+D;IAC/D,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,4GAA4G;IAC5G,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,UAAU,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC3C,mGAAmG;IACnG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2GAA2G;IAC3G,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gGAAgG;IAChG,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,oDAAoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uDAAuD;IACvD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,+DAA+D;IAC/D,GAAG,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;CACzB;AA+CD;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,EACrB,UAAU,EACV,KAAK,EACL,IAAkB,EAClB,QAAY,EACZ,IAAQ,EACR,UAAU,EACV,MAAU,EACV,MAAU,EACV,IAAI,EACJ,UAAiB,EACjB,aAAoB,EACpB,GAAG,EACH,GAAG,UAAU,EACd,EAAE,WAAW,+BAuCb"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Ref } from 'react';
|
|
2
|
+
import type { ThreeElements } from '@react-three/fiber';
|
|
3
|
+
import type { TreeDefinition, TreeDefinitionInput, TreeForm } from '../definition';
|
|
4
|
+
import type { TreeStyle } from '../styles/types';
|
|
5
|
+
import type { StyleName } from '../styles/registry';
|
|
6
|
+
import { type Tree as TreeObject } from '../tree';
|
|
7
|
+
import { type Wind as WindObject } from '../wind';
|
|
8
|
+
type GroupProps = Omit<ThreeElements['group'], 'args' | 'object' | 'children' | 'ref' | 'castShadow' | 'receiveShadow' | 'dispose'>;
|
|
9
|
+
export interface TreeProps extends GroupProps {
|
|
10
|
+
/** The Tree Definition to grow (plain object or parsed JSON). Takes precedence over `style`. */
|
|
11
|
+
definition?: TreeDefinitionInput | TreeDefinition;
|
|
12
|
+
/**
|
|
13
|
+
* A Style: its Definition for `form` is grown. Pass the object from {@link useTreeStyle}, or a
|
|
14
|
+
* built-in Style name, which is loaded on demand (the component suspends until it is there).
|
|
15
|
+
*/
|
|
16
|
+
style?: TreeStyle | StyleName;
|
|
17
|
+
/** Which of the Style's Forms to grow. Default 'broadleaf'. */
|
|
18
|
+
form?: TreeForm;
|
|
19
|
+
/** Picks one individual tree within the Definition's ranges. Default 0. Changing it regenerates the tree. */
|
|
20
|
+
seed?: number;
|
|
21
|
+
/** Growth 0 (sapling) .. 1 (default). Only updates a uniform. */
|
|
22
|
+
growth?: number;
|
|
23
|
+
/** Season 0 .. 1 (wraps). Only updates a uniform. */
|
|
24
|
+
season?: number;
|
|
25
|
+
/** The Wind this tree sways with. Default: the scene-wide `sceneWind` (what `<Wind>` sets). */
|
|
26
|
+
wind?: WindObject;
|
|
27
|
+
/** Whether the tree casts shadows. Default true. */
|
|
28
|
+
castShadow?: boolean;
|
|
29
|
+
/** Whether the tree receives shadows. Default true. */
|
|
30
|
+
receiveShadow?: boolean;
|
|
31
|
+
/** Receives the tree.js `Tree` object (a three.js Group). */
|
|
32
|
+
ref?: Ref<TreeObject>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A procedural tree. Growth, Season, Wind and shadow props only update the existing tree; a new
|
|
36
|
+
* `seed`, `definition` (by value) or `style`/`form` regenerates it. The tree is disposed
|
|
37
|
+
* of on unmount.
|
|
38
|
+
*/
|
|
39
|
+
export declare function Tree({ definition, style, form, seed, growth, season, wind, castShadow, receiveShadow, ref, ...groupProps }: TreeProps): import("react").JSX.Element;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=Tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["../../src/react/Tree.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAc,KAAK,IAAI,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAa,KAAK,IAAI,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAG7D,KAAK,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,KAAK,GAAG,YAAY,GAAG,eAAe,GAAG,SAAS,CAAC,CAAC;AAEpI,MAAM,WAAW,SAAU,SAAQ,UAAU;IAC3C,gGAAgG;IAChG,UAAU,CAAC,EAAE,mBAAmB,GAAG,cAAc,CAAC;IAClD;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,+DAA+D;IAC/D,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,6GAA6G;IAC7G,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+FAA+F;IAC/F,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,oDAAoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uDAAuD;IACvD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,6DAA6D;IAC7D,GAAG,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;CACvB;AAKD;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,EACnB,UAAU,EACV,KAAK,EACL,IAAkB,EAClB,IAAQ,EACR,MAAU,EACV,MAAU,EACV,IAAI,EACJ,UAAiB,EACjB,aAAoB,EACpB,GAAG,EACH,GAAG,UAAU,EACd,EAAE,SAAS,+BA4CX"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Wind as WindObject, type WindDirection } from '../wind';
|
|
2
|
+
export interface WindProps {
|
|
3
|
+
/** World-space direction the wind blows towards (any non-zero length). Unset: leave as is (default +X). */
|
|
4
|
+
direction?: WindDirection;
|
|
5
|
+
/** 0 = calm, 1 = strong wind, more for storms. Unset: leave as is (default 0). */
|
|
6
|
+
strength?: number;
|
|
7
|
+
/** Pins the Wind clock to this many seconds (pause, screenshots). Unset: the renderer clock. */
|
|
8
|
+
time?: number | null;
|
|
9
|
+
/** The Wind to drive. Default: the scene-wide `sceneWind` every `<Tree>` sways with. */
|
|
10
|
+
wind?: WindObject;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Declares the Wind. Renders nothing; it writes the Wind's uniforms (no recompile), and puts back the
|
|
14
|
+
* direction, strength and clock it found when it unmounts.
|
|
15
|
+
*/
|
|
16
|
+
export declare function Wind({ direction, strength, time, wind }: WindProps): null;
|
|
17
|
+
//# sourceMappingURL=Wind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Wind.d.ts","sourceRoot":"","sources":["../../src/react/Wind.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,IAAI,IAAI,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAEjF,MAAM,WAAW,SAAS;IACxB,2GAA2G;IAC3G,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gGAAgG;IAChG,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,wFAAwF;IACxF,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAW,EAAE,IAAgB,EAAE,EAAE,SAAS,GAAG,IAAI,CAyB5F"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Tree, type TreeProps } from './Tree';
|
|
2
|
+
export { Wind, type WindProps } from './Wind';
|
|
3
|
+
export { useTreeStyle, preloadTreeStyle } from './useTreeStyle';
|
|
4
|
+
export type { StyleName } from '../styles/registry';
|
|
5
|
+
export { Forest, type ForestProps, type ForestTreePlacement } from './Forest';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAChE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type StyleName } from '../styles/registry';
|
|
2
|
+
import type { TreeStyle } from '../styles/types';
|
|
3
|
+
/**
|
|
4
|
+
* Loads a built-in Style with a dynamic import and returns it. Suspends (React Suspense) while
|
|
5
|
+
* it downloads, so wrap the component in `<Suspense>`. Unknown names throw to the nearest error boundary.
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const lowPoly = useTreeStyle('low-poly');
|
|
9
|
+
* return <Tree style={lowPoly} form="conifer" seed={7} />;
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function useTreeStyle(name: StyleName): TreeStyle;
|
|
13
|
+
/** Starts loading a Style ahead of time (e.g. on hover), without suspending. */
|
|
14
|
+
export declare function preloadTreeStyle(name: StyleName): void;
|
|
15
|
+
//# sourceMappingURL=useTreeStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTreeStyle.d.ts","sourceRoot":"","sources":["../../src/react/useTreeStyle.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAgBjD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAEvD;AAED,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAEtD"}
|