incanto 0.26.0 → 0.28.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/dist/2d.js +1 -1
- package/dist/3d.d.ts +248 -135
- package/dist/3d.js +5 -5
- package/dist/{create-game-C0bPoURs.js → create-game-71TJjW1T.js} +1 -1
- package/dist/{create-game-B_qBR65J.js → create-game-BRgWpNsa.js} +3 -3
- package/dist/env.d.ts +6 -0
- package/dist/env.js +8 -5
- package/dist/{gameplay-Ddk13pQ6.js → gameplay-DEG-TP7D.js} +13 -0
- package/dist/gameplay.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{physics-3d-Cd7Jl8w1.js → physics-3d--y5clE2j.js} +2 -2
- package/dist/react.js +1 -1
- package/dist/{register-CeWtdiCw.js → register-6R75AC7-.js} +544 -27
- package/dist/test.js +4 -4
- package/editor/assets/{agent8-DW6yTjTv.js → agent8-CojUfCXN.js} +1 -1
- package/editor/assets/{index-D4_I76v2.js → index-D6RQgROR.js} +119 -52
- package/editor/index.html +1 -1
- package/package.json +1 -1
- package/schemas/scene.schema.json +12 -0
- package/skills/incanto-environment.md +73 -9
- package/skills/incanto-node-reference.md +3 -0
- package/templates-app/beacon-isle-3d/package.json +1 -1
- package/templates-app/tps-3d/package.json +1 -1
- package/templates-app/village-quest-3d/package.json +1 -1
package/dist/2d.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as IncantoError } from "./errors-BpWbnbb_.js";
|
|
2
|
-
import { a as AssetStore2D, i as syncTree2D, r as Renderer2D, t as createGame2D } from "./create-game-
|
|
2
|
+
import { a as AssetStore2D, i as syncTree2D, r as Renderer2D, t as createGame2D } from "./create-game-71TJjW1T.js";
|
|
3
3
|
import { _ as RigidBody2D, a as parseCells, c as ColorRect2D, d as AnimatedSprite2D, f as Sprite2D, g as PhysicsBody2D, h as CharacterBody2D, i as mergeSolidRects, l as CharacterController2D, m as Area2D, n as UILayer, o as Particles2D, p as Joint2D, r as TileMap2D, s as Label, t as registerNodes2D, u as Camera2D, v as StaticBody2D, y as Node2D } from "./register-CvpSUU3O.js";
|
|
4
4
|
import { n as enablePhysics2D, t as Physics2D } from "./physics-2d-DiVFFlH3.js";
|
|
5
5
|
//#region src/2d/library-sprite.ts
|
package/dist/3d.d.ts
CHANGED
|
@@ -909,6 +909,12 @@ declare class Flowers3D extends Node3D {
|
|
|
909
909
|
* draping entirely.
|
|
910
910
|
*/
|
|
911
911
|
drape: boolean | null;
|
|
912
|
+
/**
|
|
913
|
+
* Keep plants out of standing and running water (default true) — a meadow a
|
|
914
|
+
* stream runs through has a bank of flowers, not flowers in the current.
|
|
915
|
+
* Set false for water lilies and marsh planting.
|
|
916
|
+
*/
|
|
917
|
+
avoidWater: boolean;
|
|
912
918
|
/** Drape target: a node path to the Terrain3D. Empty = auto-find the first
|
|
913
919
|
* Terrain3D in the tree (the zero-config default when `drape` is on). */
|
|
914
920
|
terrain: string;
|
|
@@ -1051,6 +1057,14 @@ declare class Foliage3D extends Node3D implements SunConsumer3D {
|
|
|
1051
1057
|
* a terrain appears), false disables draping entirely.
|
|
1052
1058
|
*/
|
|
1053
1059
|
drape: boolean | null;
|
|
1060
|
+
/**
|
|
1061
|
+
* Keep blades out of standing and running water (default true). Grass does
|
|
1062
|
+
* not grow in a stream: any instance whose ground sits under a `Water3D` or
|
|
1063
|
+
* `River3D` surface is dropped, which is what stops a creek that cut its bed
|
|
1064
|
+
* through a meadow from filling with waving blades. Set false for reeds and
|
|
1065
|
+
* paddy fields, where the plant IS in the water.
|
|
1066
|
+
*/
|
|
1067
|
+
avoidWater: boolean;
|
|
1054
1068
|
/** Drape target: a node path to the Terrain3D. Empty = auto-find the first
|
|
1055
1069
|
* Terrain3D in the tree (the zero-config default when `drape` is on). */
|
|
1056
1070
|
terrain: string;
|
|
@@ -1119,6 +1133,14 @@ declare class Foliage3D extends Node3D implements SunConsumer3D {
|
|
|
1119
1133
|
* fraction of instances into a SECOND InstancedMesh of 5-vertex flower
|
|
1120
1134
|
* heads (white/yellow/violet per instance).
|
|
1121
1135
|
*/
|
|
1136
|
+
/**
|
|
1137
|
+
* Drop the instances standing in water. The ground each blade drapes onto is
|
|
1138
|
+
* already known here, so the test is one question per candidate — and only
|
|
1139
|
+
* the ones a water surface actually covers pay for it.
|
|
1140
|
+
*/
|
|
1141
|
+
private dryOnly;
|
|
1142
|
+
/** This field's own world height (the bed sampler works in local Y). */
|
|
1143
|
+
private worldY;
|
|
1122
1144
|
private buildMeshField;
|
|
1123
1145
|
/**
|
|
1124
1146
|
* The meadow's flower sprinkle: ONE extra InstancedMesh of 5-vertex flower
|
|
@@ -1555,29 +1577,152 @@ declare class Particles3D extends Node3D {
|
|
|
1555
1577
|
private syncParticles;
|
|
1556
1578
|
}
|
|
1557
1579
|
//#endregion
|
|
1580
|
+
//#region src/3d/terrain/heightmap.d.ts
|
|
1581
|
+
/**
|
|
1582
|
+
* A smooth radial depression carved into the terrain — a lake/pond bowl. x/z
|
|
1583
|
+
* are terrain-LOCAL centered meters (the same space `heightAt`/`slopeAt` use);
|
|
1584
|
+
* `radius`/`depth` are meters. The carve is a smoothstep bowl (0 slope at the
|
|
1585
|
+
* rim), so banks blend into the surrounding ground with no cliff.
|
|
1586
|
+
*/
|
|
1587
|
+
interface BasinSpec {
|
|
1588
|
+
x: number;
|
|
1589
|
+
z: number;
|
|
1590
|
+
radius: number;
|
|
1591
|
+
/** > 0 carves a bowl; < 0 RAISES a smooth dome mound of that height. */
|
|
1592
|
+
depth: number;
|
|
1593
|
+
}
|
|
1594
|
+
/**
|
|
1595
|
+
* A river/road trench carved along a polyline: the line version of a basin.
|
|
1596
|
+
* `width` is the flat bed, `taper` the bank blend beyond it (default: the bed
|
|
1597
|
+
* width again, which is what makes a walkable V instead of a slot).
|
|
1598
|
+
*/
|
|
1599
|
+
interface ChannelSpec {
|
|
1600
|
+
path: readonly (readonly number[])[];
|
|
1601
|
+
width: number;
|
|
1602
|
+
depth: number;
|
|
1603
|
+
taper?: number;
|
|
1604
|
+
}
|
|
1605
|
+
interface HeightmapOptions {
|
|
1606
|
+
/** Terrain extent in meters along x. */
|
|
1607
|
+
width: number;
|
|
1608
|
+
/** Terrain extent in meters along z. */
|
|
1609
|
+
depth: number;
|
|
1610
|
+
/** Grid segments along x (vertices = segsX+1). */
|
|
1611
|
+
segsX: number;
|
|
1612
|
+
/** Grid segments along z (vertices = segsZ+1). */
|
|
1613
|
+
segsZ: number;
|
|
1614
|
+
/** Height scale — realized heights land at roughly 3.5–8× this value. */
|
|
1615
|
+
maxHeight: number;
|
|
1616
|
+
/** Integer seed — same seed, same terrain, every machine. */
|
|
1617
|
+
seed: number;
|
|
1618
|
+
/** Detail persistence (amplitude falloff per detail octave). */
|
|
1619
|
+
roughness?: number;
|
|
1620
|
+
/** Detail octave count. */
|
|
1621
|
+
detail?: number;
|
|
1622
|
+
/** Snap-flatten heights within ±0.6 m of maxHeight·flatThreshold. */
|
|
1623
|
+
flatThreshold?: number;
|
|
1624
|
+
/** Curl the border down a quarter circle and floor it at edgeBottom. */
|
|
1625
|
+
islandEdge?: boolean;
|
|
1626
|
+
/** Quarter-circle radius in meters (clamped to [0, 45]). */
|
|
1627
|
+
edgeWrapRadius?: number;
|
|
1628
|
+
/** Floor y at the outermost ring once the wrap completes. */
|
|
1629
|
+
edgeBottom?: number;
|
|
1630
|
+
/** 0..1 — 1 rounds island corners fully, 0 keeps them square-ish. */
|
|
1631
|
+
edgeCornerSmoothness?: number;
|
|
1632
|
+
/** Smooth radial lake/pond bowls carved into the surface (interior basins). */
|
|
1633
|
+
basins?: BasinSpec[];
|
|
1634
|
+
/** River/road trenches carved along polylines (see {@link ChannelSpec}). */
|
|
1635
|
+
channels?: ChannelSpec[];
|
|
1636
|
+
}
|
|
1637
|
+
interface Heightmap {
|
|
1638
|
+
readonly width: number;
|
|
1639
|
+
readonly depth: number;
|
|
1640
|
+
readonly segsX: number;
|
|
1641
|
+
readonly segsZ: number;
|
|
1642
|
+
/**
|
|
1643
|
+
* Vertex heights INCLUDING edge wrap, `(segsX+1)·(segsZ+1)` long, indexed
|
|
1644
|
+
* `iz·(segsX+1)+ix` with x = -width/2 + ix·cell and z = -depth/2 + iz·cell —
|
|
1645
|
+
* exactly a rotateX(-π/2) PlaneGeometry's vertex order.
|
|
1646
|
+
*/
|
|
1647
|
+
readonly heights: Float32Array;
|
|
1648
|
+
/** Realized height range EXCLUDING edge wrap — normalizes splat heights. */
|
|
1649
|
+
readonly minHeight: number;
|
|
1650
|
+
readonly maxHeight: number;
|
|
1651
|
+
/** Bilinear height lookup in terrain-local centered meters (clamps outside). */
|
|
1652
|
+
heightAt(x: number, z: number): number;
|
|
1653
|
+
/** Analytic pipeline height WITHOUT edge wrap (splat domain), same coords. */
|
|
1654
|
+
baseHeight(x: number, z: number): number;
|
|
1655
|
+
/** Splat slope at a point: atan(|∇ baseHeight|) via central differences. */
|
|
1656
|
+
slopeAt(x: number, z: number): number;
|
|
1657
|
+
}
|
|
1658
|
+
/** One splat layer: a texture plus the trapezoid ranges that place it. */
|
|
1659
|
+
interface TerrainLayer {
|
|
1660
|
+
/** Base color texture URL. */
|
|
1661
|
+
texture: string;
|
|
1662
|
+
/** Optional tangent-space normal map URL. */
|
|
1663
|
+
normalMap?: string;
|
|
1664
|
+
/** World-UV tiling factor (UV = worldXZ · repeat · 0.1). Default 2. */
|
|
1665
|
+
repeat?: number;
|
|
1666
|
+
/** Normalized [min, max] over the realized height span. Default [0, 1]. */
|
|
1667
|
+
heightRange?: [number, number];
|
|
1668
|
+
/** [min, max] slope in radians (atan of gradient). Default [0, π/2]. */
|
|
1669
|
+
slopeRange?: [number, number];
|
|
1670
|
+
/** Linear falloff width OUTSIDE heightRange (fraction of span). Default 0.1. */
|
|
1671
|
+
heightBlendRange?: number;
|
|
1672
|
+
/** Linear falloff width outside slopeRange (radians). Default 0.1. */
|
|
1673
|
+
slopeBlendRange?: number;
|
|
1674
|
+
/** PBR roughness scalar for this layer. Default 1. */
|
|
1675
|
+
roughness?: number;
|
|
1676
|
+
/** PBR metalness scalar for this layer. Default 0. */
|
|
1677
|
+
metalness?: number;
|
|
1678
|
+
/** Anti-tiling UV jitter strength. Default 0.15. */
|
|
1679
|
+
uvNoiseIntensity?: number;
|
|
1680
|
+
}
|
|
1681
|
+
/**
|
|
1682
|
+
* Build the deterministic heightfield. Heavy (one noise eval per vertex) —
|
|
1683
|
+
* call once and keep the result.
|
|
1684
|
+
*/
|
|
1685
|
+
declare function buildHeightmap(opts: HeightmapOptions): Heightmap;
|
|
1686
|
+
/**
|
|
1687
|
+
* Per-vertex splat weights for up to 4 layers. `height01` is the vertex
|
|
1688
|
+
* height normalized over the heightmap's realized (no-wrap) span, `slopeRad`
|
|
1689
|
+
* is `atan(|∇h|)`. Weight = heightTrapezoid · slopeTrapezoid, sharpened by
|
|
1690
|
+
* `pow(w, 1/blendingStrength)`, then normalized to sum 1 — when nothing
|
|
1691
|
+
* matches, layer 0 takes everything. Always returns exactly 4 entries
|
|
1692
|
+
* (missing layers weigh 0).
|
|
1693
|
+
*/
|
|
1694
|
+
declare function splatWeights(height01: number, slopeRad: number, layers: readonly TerrainLayer[], blendingStrength?: number): [number, number, number, number];
|
|
1695
|
+
//#endregion
|
|
1558
1696
|
//#region src/3d/water/river.d.ts
|
|
1697
|
+
/** Terrain height under a LOCAL-frame point, in the same frame's meters. */
|
|
1698
|
+
type BedSampler = (x: number, z: number) => number;
|
|
1699
|
+
interface RiverCarveOptions {
|
|
1700
|
+
/** Centreline in the TERRAIN'S local frame (that is where channels live). */
|
|
1701
|
+
path: readonly (readonly number[])[];
|
|
1702
|
+
/** Width profile source→mouth (one entry = constant). */
|
|
1703
|
+
widths: readonly number[];
|
|
1704
|
+
/** Water column at the centreline, meters. */
|
|
1705
|
+
depth: number;
|
|
1706
|
+
/** Terrain cell size in meters — a cut finer than this does not exist. */
|
|
1707
|
+
cell: number;
|
|
1708
|
+
/** Ground height BEFORE this river cut anything. */
|
|
1709
|
+
groundAt: BedSampler;
|
|
1710
|
+
}
|
|
1559
1711
|
/**
|
|
1560
|
-
*
|
|
1561
|
-
*
|
|
1562
|
-
* Everything here works in the river node's LOCAL frame (the caller hands in a
|
|
1563
|
-
* `bedAt(x, z)` sampler that has already been shifted into it), so this module
|
|
1564
|
-
* imports nothing from three and stays testable in plain node.
|
|
1712
|
+
* The trench a river digs for itself, as {@link ChannelSpec}s for Terrain3D.
|
|
1565
1713
|
*
|
|
1566
|
-
*
|
|
1567
|
-
*
|
|
1568
|
-
*
|
|
1714
|
+
* Shared on purpose: `River3D` cuts this at load, and anything that has to
|
|
1715
|
+
* PLACE things against the result — a scene generator putting a player, a
|
|
1716
|
+
* bridge and a boulder field on the ground — computes the identical cut
|
|
1717
|
+
* instead of approximating it. A generator that guesses differently spawns the
|
|
1718
|
+
* player inside a hill.
|
|
1569
1719
|
*
|
|
1570
|
-
*
|
|
1571
|
-
*
|
|
1572
|
-
*
|
|
1573
|
-
*
|
|
1574
|
-
* nothing where that reaches zero, so banks, gravel bars and half-drowned
|
|
1575
|
-
* boulders carve the ribbon instead of a hand-authored outline;
|
|
1576
|
-
* - the **current** obeys continuity (narrow = fast) and grade (steep = fast),
|
|
1577
|
-
* which is what makes rapids sit where a channel pinches or tips.
|
|
1720
|
+
* The floor only ever FALLS. Water does not climb, so a bed that climbs is a
|
|
1721
|
+
* river that stops and buries itself; carrying the running minimum downstream
|
|
1722
|
+
* digs through a rise instead, and the cap keeps that from turning a hill into
|
|
1723
|
+
* a canyon.
|
|
1578
1724
|
*/
|
|
1579
|
-
|
|
1580
|
-
type BedSampler = (x: number, z: number) => number;
|
|
1725
|
+
declare function riverCarveChannels(opts: RiverCarveOptions): ChannelSpec[];
|
|
1581
1726
|
/** One arc-length sample of the smoothed centerline. */
|
|
1582
1727
|
interface PathSample {
|
|
1583
1728
|
x: number;
|
|
@@ -1590,7 +1735,18 @@ interface PathSample {
|
|
|
1590
1735
|
}
|
|
1591
1736
|
/** A cross-section station: where the water is, how wide, how fast. */
|
|
1592
1737
|
interface RiverRing extends PathSample {
|
|
1738
|
+
/** The width the author ASKED for (half of it) — nominal, drives current. */
|
|
1593
1739
|
halfWidth: number;
|
|
1740
|
+
/** Wetted half-width to the left of the flow: where the ground rises to the
|
|
1741
|
+
* surface. This, not {@link halfWidth}, is where the water actually ends. */
|
|
1742
|
+
halfLeft: number;
|
|
1743
|
+
/** Wetted half-width to the right of the flow. */
|
|
1744
|
+
halfRight: number;
|
|
1745
|
+
/** No bank on that side: the ground never came up to the surface, so the
|
|
1746
|
+
* water is spilling out over it rather than being held. The ribbon thins to
|
|
1747
|
+
* a film there instead of ending in a wall of water standing on nothing. */
|
|
1748
|
+
spillLeft: boolean;
|
|
1749
|
+
spillRight: boolean;
|
|
1594
1750
|
/** Water surface height (local Y). */
|
|
1595
1751
|
surfaceY: number;
|
|
1596
1752
|
/** Downhill grade of the surface (dimensionless, ≥ 0). */
|
|
@@ -1706,6 +1862,18 @@ declare class River3D extends Node3D implements SunConsumer3D {
|
|
|
1706
1862
|
sunIntensity: number;
|
|
1707
1863
|
/** Drape target path; empty = auto-find the first Terrain3D in the tree. */
|
|
1708
1864
|
terrain: string;
|
|
1865
|
+
/**
|
|
1866
|
+
* Cut the bed. Real water arrives on a hillside and erodes itself a channel;
|
|
1867
|
+
* a ribbon laid on raw ground has nothing holding it and reads as a strip of
|
|
1868
|
+
* blue hovering over the grass. With this on, the river trenches its own
|
|
1869
|
+
* course into the terrain it drapes on — banks the player can walk into, a
|
|
1870
|
+
* collider and `heightAt` that agree with it, and splat that paints the cut.
|
|
1871
|
+
*
|
|
1872
|
+
* Off means you carve it yourself with `Terrain3D.channels` (or the reach is
|
|
1873
|
+
* genuinely a flat flood plain). Either way the surface is FITTED to
|
|
1874
|
+
* whatever ground it finds: it can never stand above its own banks.
|
|
1875
|
+
*/
|
|
1876
|
+
carve: boolean;
|
|
1709
1877
|
/** How hard the current sweeps bodies downstream (0 = visual only). */
|
|
1710
1878
|
flowForce: number;
|
|
1711
1879
|
/**
|
|
@@ -1721,13 +1889,28 @@ declare class River3D extends Node3D implements SunConsumer3D {
|
|
|
1721
1889
|
private sprayKey;
|
|
1722
1890
|
private courseKey;
|
|
1723
1891
|
private bedAt;
|
|
1892
|
+
/** Whether the last course was fitted to real ground (see buildRiverRings). */
|
|
1893
|
+
private fitted;
|
|
1894
|
+
/** Everything standing in the current, rescanned on a slow timer. */
|
|
1895
|
+
private rocks;
|
|
1896
|
+
private rockScanAt;
|
|
1724
1897
|
private world;
|
|
1725
1898
|
private readonly _bodies;
|
|
1726
1899
|
/** Loader hook: a malformed river fails at LOAD, not as an invisible ribbon. */
|
|
1727
1900
|
static validateJson(node: Node): void;
|
|
1728
1901
|
protected override _createObject3D(): Object3D;
|
|
1902
|
+
override onReady(): void;
|
|
1903
|
+
override onExitTree(): void;
|
|
1729
1904
|
override update(dt: number): void;
|
|
1730
1905
|
override _syncObject3D(): void;
|
|
1906
|
+
/** Rocks are picked per FRAME (nearest to the eye), scanned on a timer. */
|
|
1907
|
+
_onRender3D(ctx: RenderContext3D): void;
|
|
1908
|
+
/**
|
|
1909
|
+
* @internal Water surface height over a world point, or null where this
|
|
1910
|
+
* river does not run — the question scattered vegetation asks before it
|
|
1911
|
+
* plants a blade (see {@link WetSurface}).
|
|
1912
|
+
*/
|
|
1913
|
+
_waterYAt(x: number, z: number): number | null;
|
|
1731
1914
|
/**
|
|
1732
1915
|
* Where a WORLD point sits in the channel — the query gameplay scripts run
|
|
1733
1916
|
* (steer a raft, drown a torch, decide a ford is too fast to cross). `null`
|
|
@@ -1755,6 +1938,14 @@ declare class River3D extends Node3D implements SunConsumer3D {
|
|
|
1755
1938
|
_applySunDirection(dir: readonly [number, number, number]): void;
|
|
1756
1939
|
override free(): void;
|
|
1757
1940
|
private widthProfile;
|
|
1941
|
+
/**
|
|
1942
|
+
* Cut (or release) this river's trench in the terrain it drapes on.
|
|
1943
|
+
*
|
|
1944
|
+
* Runs at ready as well as on every course rebuild: the heightfield collider
|
|
1945
|
+
* is built before the first render sync, so a bed cut only at draw time
|
|
1946
|
+
* would leave the player walking on ground that is no longer there.
|
|
1947
|
+
*/
|
|
1948
|
+
private applyCarve;
|
|
1758
1949
|
/** Resolve the drape terrain; an explicit path that misses is a hard error. */
|
|
1759
1950
|
private resolveTerrain;
|
|
1760
1951
|
/**
|
|
@@ -1764,6 +1955,21 @@ declare class River3D extends Node3D implements SunConsumer3D {
|
|
|
1764
1955
|
private ensureCourse;
|
|
1765
1956
|
private rebuildIfNeeded;
|
|
1766
1957
|
private buildMaterial;
|
|
1958
|
+
/**
|
|
1959
|
+
* Find everything standing in the current.
|
|
1960
|
+
*
|
|
1961
|
+
* A boulder in a creek is not a physics problem — it is a thing the water
|
|
1962
|
+
* has to be TOLD about, or the stream runs through it as if it were painted
|
|
1963
|
+
* on. Any mesh whose footprint lands inside the wetted channel and whose top
|
|
1964
|
+
* reaches near the surface counts, `InstancedMesh3D` rows included (a rock
|
|
1965
|
+
* scatter is one node with fifty stones in it).
|
|
1966
|
+
*
|
|
1967
|
+
* Scanned on a slow timer rather than per frame: rocks do not move often,
|
|
1968
|
+
* and a river with a hundred of them still writes only the nearest few.
|
|
1969
|
+
*/
|
|
1970
|
+
private scanRocks;
|
|
1971
|
+
/** Write the nearest rocks into the shader, faded in by distance. */
|
|
1972
|
+
private syncRocks;
|
|
1767
1973
|
private syncUniforms;
|
|
1768
1974
|
/**
|
|
1769
1975
|
* Hang a mist plume on every fall. Runtime children (`__spray*`), rebuilt
|
|
@@ -1779,122 +1985,6 @@ declare class River3D extends Node3D implements SunConsumer3D {
|
|
|
1779
1985
|
private sweepBodies;
|
|
1780
1986
|
}
|
|
1781
1987
|
//#endregion
|
|
1782
|
-
//#region src/3d/terrain/heightmap.d.ts
|
|
1783
|
-
/**
|
|
1784
|
-
* A smooth radial depression carved into the terrain — a lake/pond bowl. x/z
|
|
1785
|
-
* are terrain-LOCAL centered meters (the same space `heightAt`/`slopeAt` use);
|
|
1786
|
-
* `radius`/`depth` are meters. The carve is a smoothstep bowl (0 slope at the
|
|
1787
|
-
* rim), so banks blend into the surrounding ground with no cliff.
|
|
1788
|
-
*/
|
|
1789
|
-
interface BasinSpec {
|
|
1790
|
-
x: number;
|
|
1791
|
-
z: number;
|
|
1792
|
-
radius: number;
|
|
1793
|
-
/** > 0 carves a bowl; < 0 RAISES a smooth dome mound of that height. */
|
|
1794
|
-
depth: number;
|
|
1795
|
-
}
|
|
1796
|
-
/**
|
|
1797
|
-
* A river/road trench carved along a polyline: the line version of a basin.
|
|
1798
|
-
* `width` is the flat bed, `taper` the bank blend beyond it (default: the bed
|
|
1799
|
-
* width again, which is what makes a walkable V instead of a slot).
|
|
1800
|
-
*/
|
|
1801
|
-
interface ChannelSpec {
|
|
1802
|
-
path: readonly (readonly number[])[];
|
|
1803
|
-
width: number;
|
|
1804
|
-
depth: number;
|
|
1805
|
-
taper?: number;
|
|
1806
|
-
}
|
|
1807
|
-
interface HeightmapOptions {
|
|
1808
|
-
/** Terrain extent in meters along x. */
|
|
1809
|
-
width: number;
|
|
1810
|
-
/** Terrain extent in meters along z. */
|
|
1811
|
-
depth: number;
|
|
1812
|
-
/** Grid segments along x (vertices = segsX+1). */
|
|
1813
|
-
segsX: number;
|
|
1814
|
-
/** Grid segments along z (vertices = segsZ+1). */
|
|
1815
|
-
segsZ: number;
|
|
1816
|
-
/** Height scale — realized heights land at roughly 3.5–8× this value. */
|
|
1817
|
-
maxHeight: number;
|
|
1818
|
-
/** Integer seed — same seed, same terrain, every machine. */
|
|
1819
|
-
seed: number;
|
|
1820
|
-
/** Detail persistence (amplitude falloff per detail octave). */
|
|
1821
|
-
roughness?: number;
|
|
1822
|
-
/** Detail octave count. */
|
|
1823
|
-
detail?: number;
|
|
1824
|
-
/** Snap-flatten heights within ±0.6 m of maxHeight·flatThreshold. */
|
|
1825
|
-
flatThreshold?: number;
|
|
1826
|
-
/** Curl the border down a quarter circle and floor it at edgeBottom. */
|
|
1827
|
-
islandEdge?: boolean;
|
|
1828
|
-
/** Quarter-circle radius in meters (clamped to [0, 45]). */
|
|
1829
|
-
edgeWrapRadius?: number;
|
|
1830
|
-
/** Floor y at the outermost ring once the wrap completes. */
|
|
1831
|
-
edgeBottom?: number;
|
|
1832
|
-
/** 0..1 — 1 rounds island corners fully, 0 keeps them square-ish. */
|
|
1833
|
-
edgeCornerSmoothness?: number;
|
|
1834
|
-
/** Smooth radial lake/pond bowls carved into the surface (interior basins). */
|
|
1835
|
-
basins?: BasinSpec[];
|
|
1836
|
-
/** River/road trenches carved along polylines (see {@link ChannelSpec}). */
|
|
1837
|
-
channels?: ChannelSpec[];
|
|
1838
|
-
}
|
|
1839
|
-
interface Heightmap {
|
|
1840
|
-
readonly width: number;
|
|
1841
|
-
readonly depth: number;
|
|
1842
|
-
readonly segsX: number;
|
|
1843
|
-
readonly segsZ: number;
|
|
1844
|
-
/**
|
|
1845
|
-
* Vertex heights INCLUDING edge wrap, `(segsX+1)·(segsZ+1)` long, indexed
|
|
1846
|
-
* `iz·(segsX+1)+ix` with x = -width/2 + ix·cell and z = -depth/2 + iz·cell —
|
|
1847
|
-
* exactly a rotateX(-π/2) PlaneGeometry's vertex order.
|
|
1848
|
-
*/
|
|
1849
|
-
readonly heights: Float32Array;
|
|
1850
|
-
/** Realized height range EXCLUDING edge wrap — normalizes splat heights. */
|
|
1851
|
-
readonly minHeight: number;
|
|
1852
|
-
readonly maxHeight: number;
|
|
1853
|
-
/** Bilinear height lookup in terrain-local centered meters (clamps outside). */
|
|
1854
|
-
heightAt(x: number, z: number): number;
|
|
1855
|
-
/** Analytic pipeline height WITHOUT edge wrap (splat domain), same coords. */
|
|
1856
|
-
baseHeight(x: number, z: number): number;
|
|
1857
|
-
/** Splat slope at a point: atan(|∇ baseHeight|) via central differences. */
|
|
1858
|
-
slopeAt(x: number, z: number): number;
|
|
1859
|
-
}
|
|
1860
|
-
/** One splat layer: a texture plus the trapezoid ranges that place it. */
|
|
1861
|
-
interface TerrainLayer {
|
|
1862
|
-
/** Base color texture URL. */
|
|
1863
|
-
texture: string;
|
|
1864
|
-
/** Optional tangent-space normal map URL. */
|
|
1865
|
-
normalMap?: string;
|
|
1866
|
-
/** World-UV tiling factor (UV = worldXZ · repeat · 0.1). Default 2. */
|
|
1867
|
-
repeat?: number;
|
|
1868
|
-
/** Normalized [min, max] over the realized height span. Default [0, 1]. */
|
|
1869
|
-
heightRange?: [number, number];
|
|
1870
|
-
/** [min, max] slope in radians (atan of gradient). Default [0, π/2]. */
|
|
1871
|
-
slopeRange?: [number, number];
|
|
1872
|
-
/** Linear falloff width OUTSIDE heightRange (fraction of span). Default 0.1. */
|
|
1873
|
-
heightBlendRange?: number;
|
|
1874
|
-
/** Linear falloff width outside slopeRange (radians). Default 0.1. */
|
|
1875
|
-
slopeBlendRange?: number;
|
|
1876
|
-
/** PBR roughness scalar for this layer. Default 1. */
|
|
1877
|
-
roughness?: number;
|
|
1878
|
-
/** PBR metalness scalar for this layer. Default 0. */
|
|
1879
|
-
metalness?: number;
|
|
1880
|
-
/** Anti-tiling UV jitter strength. Default 0.15. */
|
|
1881
|
-
uvNoiseIntensity?: number;
|
|
1882
|
-
}
|
|
1883
|
-
/**
|
|
1884
|
-
* Build the deterministic heightfield. Heavy (one noise eval per vertex) —
|
|
1885
|
-
* call once and keep the result.
|
|
1886
|
-
*/
|
|
1887
|
-
declare function buildHeightmap(opts: HeightmapOptions): Heightmap;
|
|
1888
|
-
/**
|
|
1889
|
-
* Per-vertex splat weights for up to 4 layers. `height01` is the vertex
|
|
1890
|
-
* height normalized over the heightmap's realized (no-wrap) span, `slopeRad`
|
|
1891
|
-
* is `atan(|∇h|)`. Weight = heightTrapezoid · slopeTrapezoid, sharpened by
|
|
1892
|
-
* `pow(w, 1/blendingStrength)`, then normalized to sum 1 — when nothing
|
|
1893
|
-
* matches, layer 0 takes everything. Always returns exactly 4 entries
|
|
1894
|
-
* (missing layers weigh 0).
|
|
1895
|
-
*/
|
|
1896
|
-
declare function splatWeights(height01: number, slopeRad: number, layers: readonly TerrainLayer[], blendingStrength?: number): [number, number, number, number];
|
|
1897
|
-
//#endregion
|
|
1898
1988
|
//#region src/3d/terrain/themes.d.ts
|
|
1899
1989
|
/** Valid `Terrain3D.theme` values — drives the prop options AND validateJson. */
|
|
1900
1990
|
declare const TERRAIN_THEMES: readonly ["island", "alpine", "plains", "desert", "grassland", "forest", "savanna", "snow", "wetland", "volcanic", "custom"];
|
|
@@ -1965,6 +2055,14 @@ declare class Terrain3D extends Node3D {
|
|
|
1965
2055
|
* bed to sit in, and the collider/heightAt/drape all see it. */
|
|
1966
2056
|
channels: ChannelSpec[];
|
|
1967
2057
|
/**
|
|
2058
|
+
* Trenches other NODES cut in this terrain — a `River3D` carving its own bed.
|
|
2059
|
+
* Keyed by the node that owns each, so a moving or re-pathed river replaces
|
|
2060
|
+
* its cut instead of stacking a new one. Runtime state, never serialized:
|
|
2061
|
+
* the scene file says "there is a river here", not "here is the ditch it
|
|
2062
|
+
* dug", and re-loading the scene digs it again.
|
|
2063
|
+
*/
|
|
2064
|
+
private readonly externalChannels;
|
|
2065
|
+
/**
|
|
1968
2066
|
* WET SAND band: `{ y, band? }` darkens + glosses the splat in a noisy,
|
|
1969
2067
|
* breathing band just above height `y` (a waterline) — the trace of the
|
|
1970
2068
|
* last swash runup. `band` is the max height above `y` that reads wet
|
|
@@ -1989,6 +2087,14 @@ declare class Terrain3D extends Node3D {
|
|
|
1989
2087
|
* physics bodies follow).
|
|
1990
2088
|
*/
|
|
1991
2089
|
heightAt(x: number, z: number): number;
|
|
2090
|
+
/**
|
|
2091
|
+
* @internal Cut (spec) or release (null) a trench another node owns. A
|
|
2092
|
+
* `River3D` calls this to dig its own bed; the heightmap, the collider,
|
|
2093
|
+
* `heightAt`, the drape and the mesh all pick it up on their next rebuild.
|
|
2094
|
+
*/
|
|
2095
|
+
_setExternalChannel(owner: Node, specs: ChannelSpec[] | null): void;
|
|
2096
|
+
/** Authored trenches plus the ones other nodes cut. */
|
|
2097
|
+
private allChannels;
|
|
1992
2098
|
/** @internal The pure heightfield (lazily built — physics pulls this). */
|
|
1993
2099
|
_heightmap(): Heightmap;
|
|
1994
2100
|
/** The splat layers in effect — theme preset, or `layers` for 'custom'. */
|
|
@@ -2463,6 +2569,13 @@ declare class Water3D extends Node3D implements RenderHook3D, SunConsumer3D {
|
|
|
2463
2569
|
* the still-water level, which is what a caller comparing heights wants.
|
|
2464
2570
|
*/
|
|
2465
2571
|
heightAt(x: number, z: number): number;
|
|
2572
|
+
/**
|
|
2573
|
+
* @internal Water surface height over a world point, or null outside this
|
|
2574
|
+
* surface's footprint — what scattered vegetation asks before it plants a
|
|
2575
|
+
* blade (see {@link WetSurface}). The STILL level, not the wave: grass does
|
|
2576
|
+
* not come and go with the swash.
|
|
2577
|
+
*/
|
|
2578
|
+
_waterYAt(x: number, z: number): number | null;
|
|
2466
2579
|
/** Base wave height at world (x, z) — the CPU twin of the active shader.
|
|
2467
2580
|
* Ripples are excluded on purpose: a splash must not re-trigger itself. */
|
|
2468
2581
|
private waveOffsetAt;
|
|
@@ -2828,4 +2941,4 @@ declare function createNavDebugNode(nav: TerrainNav, opts?: {
|
|
|
2828
2941
|
name?: string;
|
|
2829
2942
|
}): InstancedMesh3D;
|
|
2830
2943
|
//#endregion
|
|
2831
|
-
export { Area3D, AssetStore3D, type BedSampler, Billboard3D, type BillboardGroupMode, BoneAttachment3D, BoneLookAt3D, Camera3D, CharacterBody3D, CharacterController3D, type CreateGame3DOptions, DEFAULT_TERRAIN_TEXTURE_BASE, DirectionalLight3D, type DownhillTraceOptions, Environment3D, type Environment3DConfig, DENSITY_PRESETS as FLOWER_DENSITY_PRESETS, FLOWER_VARIETIES, type FlowerVariety, Flowers3D, type FogEnvironment, Foliage3D, type FoliageKind, type FoliageStyle, type Game3D, type HeightSampler, type Heightmap, type HeightmapOptions, InstancedMesh3D, Joint3D, type JointType3D, LoftMesh3D, type LoftSection, MeshInstance3D, type MeshKind, type MeshMaterialProps, type ModelEntry, ModelInstance3D, Node3D, OmniLight3D, Particles3D, Physics3D, type Physics3DOptions, PhysicsBody3D, QUARTER_PITCH, type RenderContext3D, type RenderHook3D, Renderer3D, type Renderer3DOptions, type RigView, RigidBody3D, type Ripple, River3D, type RiverHit, type RiverRing, type ShadowsEnvironment, type SkyEnvironment, StaticBody3D, type SunConsumer3D, type SyncOptions, type SyncResult, TERRAIN_THEMES, Terrain3D, type TerrainLayer, type TerrainNav, type TerrainNavOptions, type TerrainTheme, Trail3D, Tree3D, type TreeTier, type TreeType, VOXEL_PALETTE, type VoxelBlock, VoxelGrid3D, WATER_CUTOUT_MAX, WATER_MAX_RIPPLES, Water3D, WaterCutout3D, buildHeightmap, buildTerrainNav, cameraRelative, createGame3D, createNavDebugNode, enablePhysics3D, horizonColorFromSky, keyboardIntensity, movementState, parseEnvironment3D, registerNodes3D, resolveFlowerDensity, rigPose, setEnvironment3D, splatWeights, sunDirectionFromElevationAzimuth, sunDirectionFromSky, syncTree, terrainThemeLayers, traceDownhillPath };
|
|
2944
|
+
export { Area3D, AssetStore3D, type BedSampler, Billboard3D, type BillboardGroupMode, BoneAttachment3D, BoneLookAt3D, Camera3D, CharacterBody3D, CharacterController3D, type CreateGame3DOptions, DEFAULT_TERRAIN_TEXTURE_BASE, DirectionalLight3D, type DownhillTraceOptions, Environment3D, type Environment3DConfig, DENSITY_PRESETS as FLOWER_DENSITY_PRESETS, FLOWER_VARIETIES, type FlowerVariety, Flowers3D, type FogEnvironment, Foliage3D, type FoliageKind, type FoliageStyle, type Game3D, type HeightSampler, type Heightmap, type HeightmapOptions, InstancedMesh3D, Joint3D, type JointType3D, LoftMesh3D, type LoftSection, MeshInstance3D, type MeshKind, type MeshMaterialProps, type ModelEntry, ModelInstance3D, Node3D, OmniLight3D, Particles3D, Physics3D, type Physics3DOptions, PhysicsBody3D, QUARTER_PITCH, type RenderContext3D, type RenderHook3D, Renderer3D, type Renderer3DOptions, type RigView, RigidBody3D, type Ripple, River3D, type RiverCarveOptions, type RiverHit, type RiverRing, type ShadowsEnvironment, type SkyEnvironment, StaticBody3D, type SunConsumer3D, type SyncOptions, type SyncResult, TERRAIN_THEMES, Terrain3D, type TerrainLayer, type TerrainNav, type TerrainNavOptions, type TerrainTheme, Trail3D, Tree3D, type TreeTier, type TreeType, VOXEL_PALETTE, type VoxelBlock, VoxelGrid3D, WATER_CUTOUT_MAX, WATER_MAX_RIPPLES, Water3D, WaterCutout3D, buildHeightmap, buildTerrainNav, cameraRelative, createGame3D, createNavDebugNode, enablePhysics3D, horizonColorFromSky, keyboardIntensity, movementState, parseEnvironment3D, registerNodes3D, resolveFlowerDensity, rigPose, riverCarveChannels, setEnvironment3D, splatWeights, sunDirectionFromElevationAzimuth, sunDirectionFromSky, syncTree, terrainThemeLayers, traceDownhillPath };
|
package/dist/3d.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as IncantoError } from "./errors-BpWbnbb_.js";
|
|
2
|
-
import { A as Water3D, F as PhysicsBody3D, I as RigidBody3D, L as StaticBody3D, M as WaterCutout3D, N as Area3D, P as CharacterBody3D, R as Node3D, V as WATER_MAX_RIPPLES, j as WATER_CUTOUT_MAX } from "./gameplay-
|
|
3
|
-
import { a as Environment3D, c as sunDirectionFromElevationAzimuth, i as syncTree, l as sunDirectionFromSky, o as horizonColorFromSky, r as Renderer3D, s as parseEnvironment3D, t as createGame3D, u as AssetStore3D } from "./create-game-
|
|
4
|
-
import { A as
|
|
2
|
+
import { A as Water3D, F as PhysicsBody3D, I as RigidBody3D, L as StaticBody3D, M as WaterCutout3D, N as Area3D, P as CharacterBody3D, R as Node3D, V as WATER_MAX_RIPPLES, j as WATER_CUTOUT_MAX } from "./gameplay-DEG-TP7D.js";
|
|
3
|
+
import { a as Environment3D, c as sunDirectionFromElevationAzimuth, i as syncTree, l as sunDirectionFromSky, o as horizonColorFromSky, r as Renderer3D, s as parseEnvironment3D, t as createGame3D, u as AssetStore3D } from "./create-game-BRgWpNsa.js";
|
|
4
|
+
import { A as Joint3D, C as BoneLookAt3D, D as DEFAULT_TERRAIN_TEXTURE_BASE, E as Terrain3D, F as rigPose, M as cameraRelative, N as keyboardIntensity, O as TERRAIN_THEMES, P as movementState, S as Camera3D, T as Billboard3D, _ as DENSITY_PRESETS, a as Trail3D, b as FLOWER_VARIETIES, c as traceDownhillPath, d as LoftMesh3D, f as DirectionalLight3D, g as Foliage3D, h as MeshInstance3D, i as Tree3D, j as QUARTER_PITCH, k as terrainThemeLayers, l as Particles3D, m as InstancedMesh3D, n as VOXEL_PALETTE, o as River3D, p as OmniLight3D, r as VoxelGrid3D, s as riverCarveChannels, t as registerNodes3D, u as ModelInstance3D, v as Flowers3D, w as BoneAttachment3D, x as CharacterController3D, y as resolveFlowerDensity } from "./register-6R75AC7-.js";
|
|
5
5
|
import { n as splatWeights, t as buildHeightmap } from "./heightmap-CRK0M4jT.js";
|
|
6
|
-
import { n as enablePhysics3D, t as Physics3D } from "./physics-3d
|
|
6
|
+
import { n as enablePhysics3D, t as Physics3D } from "./physics-3d--y5clE2j.js";
|
|
7
7
|
//#region src/3d/environment-runtime.ts
|
|
8
8
|
/**
|
|
9
9
|
* Live environment editing — the renderer re-applies `scene.environment`
|
|
@@ -142,4 +142,4 @@ function createNavDebugNode(nav, opts) {
|
|
|
142
142
|
return node;
|
|
143
143
|
}
|
|
144
144
|
//#endregion
|
|
145
|
-
export { Area3D, AssetStore3D, Billboard3D, BoneAttachment3D, BoneLookAt3D, Camera3D, CharacterBody3D, CharacterController3D, DEFAULT_TERRAIN_TEXTURE_BASE, DirectionalLight3D, Environment3D, DENSITY_PRESETS as FLOWER_DENSITY_PRESETS, FLOWER_VARIETIES, Flowers3D, Foliage3D, InstancedMesh3D, Joint3D, LoftMesh3D, MeshInstance3D, ModelInstance3D, Node3D, OmniLight3D, Particles3D, Physics3D, PhysicsBody3D, QUARTER_PITCH, Renderer3D, RigidBody3D, River3D, StaticBody3D, TERRAIN_THEMES, Terrain3D, Trail3D, Tree3D, VOXEL_PALETTE, VoxelGrid3D, WATER_CUTOUT_MAX, WATER_MAX_RIPPLES, Water3D, WaterCutout3D, buildHeightmap, buildTerrainNav, cameraRelative, createGame3D, createNavDebugNode, enablePhysics3D, horizonColorFromSky, keyboardIntensity, movementState, parseEnvironment3D, registerNodes3D, resolveFlowerDensity, rigPose, setEnvironment3D, splatWeights, sunDirectionFromElevationAzimuth, sunDirectionFromSky, syncTree, terrainThemeLayers, traceDownhillPath };
|
|
145
|
+
export { Area3D, AssetStore3D, Billboard3D, BoneAttachment3D, BoneLookAt3D, Camera3D, CharacterBody3D, CharacterController3D, DEFAULT_TERRAIN_TEXTURE_BASE, DirectionalLight3D, Environment3D, DENSITY_PRESETS as FLOWER_DENSITY_PRESETS, FLOWER_VARIETIES, Flowers3D, Foliage3D, InstancedMesh3D, Joint3D, LoftMesh3D, MeshInstance3D, ModelInstance3D, Node3D, OmniLight3D, Particles3D, Physics3D, PhysicsBody3D, QUARTER_PITCH, Renderer3D, RigidBody3D, River3D, StaticBody3D, TERRAIN_THEMES, Terrain3D, Trail3D, Tree3D, VOXEL_PALETTE, VoxelGrid3D, WATER_CUTOUT_MAX, WATER_MAX_RIPPLES, Water3D, WaterCutout3D, buildHeightmap, buildTerrainNav, cameraRelative, createGame3D, createNavDebugNode, enablePhysics3D, horizonColorFromSky, keyboardIntensity, movementState, parseEnvironment3D, registerNodes3D, resolveFlowerDensity, rigPose, riverCarveChannels, setEnvironment3D, splatWeights, sunDirectionFromElevationAzimuth, sunDirectionFromSky, syncTree, terrainThemeLayers, traceDownhillPath };
|
|
@@ -3,7 +3,7 @@ import { _ as registerBehavior, n as loadScene, o as computeViewport, s as resol
|
|
|
3
3
|
import { l as AudioPlayer, u as Engine } from "./register-nObreUQR.js";
|
|
4
4
|
import { t as IncantoError } from "./errors-BpWbnbb_.js";
|
|
5
5
|
import { i as resolveRendering, n as attachTouchControls } from "./touch-031PxtCR.js";
|
|
6
|
-
import { n as registerGameplayBehaviors } from "./gameplay-
|
|
6
|
+
import { n as registerGameplayBehaviors } from "./gameplay-DEG-TP7D.js";
|
|
7
7
|
import { g as PhysicsBody2D, n as UILayer, t as registerNodes2D, u as Camera2D, y as Node2D } from "./register-CvpSUU3O.js";
|
|
8
8
|
import { t as debugSources } from "./debug-draw-CZmOYjL2.js";
|
|
9
9
|
import { n as enablePhysics2D } from "./physics-2d-DiVFFlH3.js";
|
|
@@ -3,10 +3,10 @@ import { _ as registerBehavior, n as loadScene } from "./loader-BZqOKfI2.js";
|
|
|
3
3
|
import { l as AudioPlayer, u as Engine } from "./register-nObreUQR.js";
|
|
4
4
|
import { t as IncantoError } from "./errors-BpWbnbb_.js";
|
|
5
5
|
import { i as resolveRendering, n as attachTouchControls } from "./touch-031PxtCR.js";
|
|
6
|
-
import { B as createCausticsQuad, F as PhysicsBody3D, R as Node3D, n as registerGameplayBehaviors } from "./gameplay-
|
|
6
|
+
import { B as createCausticsQuad, F as PhysicsBody3D, R as Node3D, n as registerGameplayBehaviors } from "./gameplay-DEG-TP7D.js";
|
|
7
7
|
import { t as debugSources } from "./debug-draw-CZmOYjL2.js";
|
|
8
|
-
import {
|
|
9
|
-
import { n as enablePhysics3D } from "./physics-3d
|
|
8
|
+
import { S as Camera3D, f as DirectionalLight3D, t as registerNodes3D, u as ModelInstance3D } from "./register-6R75AC7-.js";
|
|
9
|
+
import { n as enablePhysics3D } from "./physics-3d--y5clE2j.js";
|
|
10
10
|
import { ACESFilmicToneMapping, AmbientLight, Box3, BufferAttribute, BufferGeometry, Color, DepthTexture, EquirectangularReflectionMapping, FloatType, Fog, HalfFloatType, LineBasicMaterial, LineSegments, Matrix4, Mesh, PCFShadowMap, PMREMGenerator, PerspectiveCamera, PlaneGeometry, Quaternion, Raycaster, Scene, ShaderMaterial, Vector2, Vector3, WebGLRenderTarget, WebGLRenderer } from "three";
|
|
11
11
|
import { VRMLoaderPlugin, VRMUtils } from "@pixiv/three-vrm";
|
|
12
12
|
import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
|
package/dist/env.d.ts
CHANGED
|
@@ -376,6 +376,12 @@ interface TerrainOptions {
|
|
|
376
376
|
* theme ALWAYS ships its sea — without it the edge-wrap skirt is bare cliff.
|
|
377
377
|
*/
|
|
378
378
|
water?: boolean;
|
|
379
|
+
/**
|
|
380
|
+
* Grid segments per side (default 128). Raise it when the map carries
|
|
381
|
+
* features finer than a cell — a 2 m creek on a 260 m terrain has to be cut
|
|
382
|
+
* into ~1 m cells (256) or the trench smooths away to nothing.
|
|
383
|
+
*/
|
|
384
|
+
resolution?: number;
|
|
379
385
|
}
|
|
380
386
|
/**
|
|
381
387
|
* The environment header that matches a generator theme — sky, horizon fog
|
package/dist/env.js
CHANGED
|
@@ -1419,7 +1419,7 @@ const TERRAIN_GENERATOR_THEMES = [
|
|
|
1419
1419
|
"volcanic"
|
|
1420
1420
|
];
|
|
1421
1421
|
/** Terrain3D's default grid segments — the probe MUST match the runtime grid. */
|
|
1422
|
-
const
|
|
1422
|
+
const DEFAULT_TERRAIN_RESOLUTION = 128;
|
|
1423
1423
|
/** Terrain3D edge wrap: the rim drops this many meters before the −50 m skirt. */
|
|
1424
1424
|
const EDGE_WRAP_DROP = 20;
|
|
1425
1425
|
/** Sea margin above the highest rim cliff (> the ~0.52 m wave-trough dip). */
|
|
@@ -1676,6 +1676,7 @@ function generateTerrain(opts) {
|
|
|
1676
1676
|
prop: "theme",
|
|
1677
1677
|
validOptions: [...TERRAIN_GENERATOR_THEMES]
|
|
1678
1678
|
});
|
|
1679
|
+
const TERRAIN_RESOLUTION = Math.max(2, Math.round(opts.resolution ?? DEFAULT_TERRAIN_RESOLUTION));
|
|
1679
1680
|
let maxHeight = opts.maxHeight || spec.maxHeight;
|
|
1680
1681
|
const rng = new Rng(seed);
|
|
1681
1682
|
const isIsland = theme === "island";
|
|
@@ -1714,7 +1715,8 @@ function generateTerrain(opts) {
|
|
|
1714
1715
|
seed,
|
|
1715
1716
|
theme: spec.splat,
|
|
1716
1717
|
...spec.roughness !== void 0 ? { roughness: spec.roughness } : {},
|
|
1717
|
-
...spec.detail !== void 0 ? { detail: spec.detail } : {}
|
|
1718
|
+
...spec.detail !== void 0 ? { detail: spec.detail } : {},
|
|
1719
|
+
...TERRAIN_RESOLUTION !== DEFAULT_TERRAIN_RESOLUTION ? { resolution: TERRAIN_RESOLUTION } : {}
|
|
1718
1720
|
}
|
|
1719
1721
|
}]
|
|
1720
1722
|
}];
|
|
@@ -1799,9 +1801,10 @@ function borderMaxHeight(hm) {
|
|
|
1799
1801
|
let borderMax = Number.NEGATIVE_INFINITY;
|
|
1800
1802
|
const hw = hm.width / 2;
|
|
1801
1803
|
const hd = hm.depth / 2;
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
const
|
|
1804
|
+
const steps = hm.segsX;
|
|
1805
|
+
for (let i = 0; i <= steps; i++) {
|
|
1806
|
+
const x = -hw + i / steps * hm.width;
|
|
1807
|
+
const z = -hd + i / steps * hm.depth;
|
|
1805
1808
|
borderMax = Math.max(borderMax, hm.baseHeight(x, -hd), hm.baseHeight(x, hd), hm.baseHeight(-hw, z), hm.baseHeight(hw, z));
|
|
1806
1809
|
}
|
|
1807
1810
|
return borderMax;
|
|
@@ -3565,6 +3565,19 @@ var Water3D = class Water3D extends Node3D {
|
|
|
3565
3565
|
const center = worldTranslationOf(this, this._scratchA);
|
|
3566
3566
|
return center.y + this.waveOffsetAt(x, z, center);
|
|
3567
3567
|
}
|
|
3568
|
+
/**
|
|
3569
|
+
* @internal Water surface height over a world point, or null outside this
|
|
3570
|
+
* surface's footprint — what scattered vegetation asks before it plants a
|
|
3571
|
+
* blade (see {@link WetSurface}). The STILL level, not the wave: grass does
|
|
3572
|
+
* not come and go with the swash.
|
|
3573
|
+
*/
|
|
3574
|
+
_waterYAt(x, z) {
|
|
3575
|
+
const center = worldTranslationOf(this, this._scratchA);
|
|
3576
|
+
const halfX = (this.size[0] ?? 0) / 2;
|
|
3577
|
+
const halfZ = (this.size[1] ?? 0) / 2;
|
|
3578
|
+
if (Math.abs(x - center.x) > halfX || Math.abs(z - center.z) > halfZ) return null;
|
|
3579
|
+
return center.y;
|
|
3580
|
+
}
|
|
3568
3581
|
/** Base wave height at world (x, z) — the CPU twin of the active shader.
|
|
3569
3582
|
* Ripples are excluded on purpose: a splash must not re-trigger itself. */
|
|
3570
3583
|
waveOffsetAt(x, z, center) {
|
package/dist/gameplay.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as FollowCamera, D as Health, E as DamageOnContact, O as Collector, S as restartScene, T as phaseOf, _ as hitStop, a as Wander, b as GameFlow, c as Projectile, d as PathFollow, f as Oscillate, g as Cooldown, h as CameraShake, i as WaveSpawner, k as Chase, l as Pickup, m as Lifetime, n as registerGameplayBehaviors, o as Spawner, p as MoveTo, r as ZombieAI, s as ScoreKeeper, t as GAMEPLAY_BEHAVIORS, u as Patrol, v as screenFlash, w as DayNight, x as goToScene, y as Interactable } from "./gameplay-
|
|
1
|
+
import { C as FollowCamera, D as Health, E as DamageOnContact, O as Collector, S as restartScene, T as phaseOf, _ as hitStop, a as Wander, b as GameFlow, c as Projectile, d as PathFollow, f as Oscillate, g as Cooldown, h as CameraShake, i as WaveSpawner, k as Chase, l as Pickup, m as Lifetime, n as registerGameplayBehaviors, o as Spawner, p as MoveTo, r as ZombieAI, s as ScoreKeeper, t as GAMEPLAY_BEHAVIORS, u as Patrol, v as screenFlash, w as DayNight, x as goToScene, y as Interactable } from "./gameplay-DEG-TP7D.js";
|
|
2
2
|
export { CameraShake, Chase, Collector, Cooldown, DamageOnContact, DayNight, FollowCamera, GAMEPLAY_BEHAVIORS, GameFlow, Health, Interactable, Lifetime, MoveTo, Oscillate, PathFollow, Patrol, Pickup, Projectile, ScoreKeeper, Spawner, Wander, WaveSpawner, ZombieAI, goToScene, hitStop, phaseOf, registerGameplayBehaviors, restartScene, screenFlash };
|
package/dist/index.js
CHANGED
|
@@ -295,6 +295,6 @@ function newUid() {
|
|
|
295
295
|
//#endregion
|
|
296
296
|
//#region src/index.ts
|
|
297
297
|
/** Engine version. Kept in sync with package.json by the release pipeline. */
|
|
298
|
-
const VERSION = "0.
|
|
298
|
+
const VERSION = "0.28.0";
|
|
299
299
|
//#endregion
|
|
300
300
|
export { AudioBuses, AudioPlayer, Behavior, CONST_REF_KEY, Engine, HudLayer, IncantoError, InputMap, LogManager, MusicManager, Node, ORDER_GROUP_BASE, PARTICLE_PRESETS, PARTICLE_PRESET_NAMES, ParticleSim, ROLLOFF_MODELS, Rng, SCENE_FORMAT, SFX_PRESETS, SFX_PRESET_NAMES, Scene, SceneTree, SfxEngine, Signal, Timer, TouchControls, UiBanner, UiBar, UiButton, UiDialogue, UiText, VERSION, WebAudioMusicBackend, applyParticlePreset, assetUrls, attachTouchControls, auditScene, clearBehaviors, clearRegistry, computeViewport, createNode, createNoise2D, createSaveStore, crossfadeGains, duplicateNode, effectiveOrder, fadeGain, findPath, getBehavior, getNodeSchema, getNodeSignals, getNodeType, gridFromRows, isAudioContextAvailable, isConstRef, joystickVector, jsonClone, jsonEquals, jsonKind, loadScene, mergeStaticSignals, newUid, parseNodePath, preloadUrls, registerBehavior, registerCoreNodes, registerNode, registeredBehaviors, registeredTypes, replay, resolveConstants, resolveRendering, resolveViewport, serializeNode, spatialGain, spatialPan, startRecording, synthSfx };
|