incanto 0.18.0 → 0.20.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/3d.d.ts +214 -2
- package/dist/3d.js +5 -5
- package/dist/{create-game-BiT-ZLi6.js → create-game-pNf3sI-Q.js} +2 -2
- package/dist/env.js +1 -1
- package/dist/{heightmap-CroQPEER.js → heightmap-CRK0M4jT.js} +40 -2
- package/dist/index.js +1 -1
- package/dist/{physics-3d-CfeZOpyK.js → physics-3d-DxFDfUey.js} +1 -1
- package/dist/react.js +1 -1
- package/dist/{register-BWGwa7H7.js → register-BWFgsGra.js} +1299 -130
- package/dist/test.js +3 -3
- package/editor/assets/{agent8-DcEoi33s.js → agent8-BZX7dF4f.js} +1 -1
- package/editor/assets/index-CXdpxO_B.js +7928 -0
- package/editor/index.html +1 -1
- package/package.json +1 -1
- package/schemas/scene.schema.json +171 -0
- package/skills/incanto-environment.md +143 -2
- package/skills/incanto-node-reference.md +29 -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/editor/assets/index-L774mpvF.js +0 -7635
package/dist/3d.d.ts
CHANGED
|
@@ -1541,6 +1541,188 @@ declare class Particles3D extends Node3D {
|
|
|
1541
1541
|
private syncParticles;
|
|
1542
1542
|
}
|
|
1543
1543
|
//#endregion
|
|
1544
|
+
//#region src/3d/water/river.d.ts
|
|
1545
|
+
/**
|
|
1546
|
+
* River centerline math — the CPU half of {@link River3D}.
|
|
1547
|
+
*
|
|
1548
|
+
* Everything here works in the river node's LOCAL frame (the caller hands in a
|
|
1549
|
+
* `bedAt(x, z)` sampler that has already been shifted into it), so this module
|
|
1550
|
+
* imports nothing from three and stays testable in plain node.
|
|
1551
|
+
*
|
|
1552
|
+
* The shape of a river is NOT authored: it is derived. A path of control
|
|
1553
|
+
* points and a width profile is all a scene declares; the ground underneath
|
|
1554
|
+
* decides the rest —
|
|
1555
|
+
*
|
|
1556
|
+
* - the **surface profile** follows the bed's descending envelope, so the water
|
|
1557
|
+
* runs downhill and never climbs (a rising bed dams it into a still pool);
|
|
1558
|
+
* - the **visible width** is whatever the terrain lets the water occupy: every
|
|
1559
|
+
* vertex carries its own water column (`surfaceY − bed`), the shader fades to
|
|
1560
|
+
* nothing where that reaches zero, so banks, gravel bars and half-drowned
|
|
1561
|
+
* boulders carve the ribbon instead of a hand-authored outline;
|
|
1562
|
+
* - the **current** obeys continuity (narrow = fast) and grade (steep = fast),
|
|
1563
|
+
* which is what makes rapids sit where a channel pinches or tips.
|
|
1564
|
+
*/
|
|
1565
|
+
/** Terrain height under a LOCAL-frame point, in the same frame's meters. */
|
|
1566
|
+
type BedSampler = (x: number, z: number) => number;
|
|
1567
|
+
/** One arc-length sample of the smoothed centerline. */
|
|
1568
|
+
interface PathSample {
|
|
1569
|
+
x: number;
|
|
1570
|
+
z: number;
|
|
1571
|
+
/** Unit tangent, pointing downstream. */
|
|
1572
|
+
tx: number;
|
|
1573
|
+
tz: number;
|
|
1574
|
+
/** Meters from the source. */
|
|
1575
|
+
along: number;
|
|
1576
|
+
}
|
|
1577
|
+
/** A cross-section station: where the water is, how wide, how fast. */
|
|
1578
|
+
interface RiverRing extends PathSample {
|
|
1579
|
+
halfWidth: number;
|
|
1580
|
+
/** Water surface height (local Y). */
|
|
1581
|
+
surfaceY: number;
|
|
1582
|
+
/** Downhill grade of the surface (dimensionless, ≥ 0). */
|
|
1583
|
+
slope: number;
|
|
1584
|
+
/** Surface current in m/s. */
|
|
1585
|
+
speed: number;
|
|
1586
|
+
}
|
|
1587
|
+
interface RiverHit {
|
|
1588
|
+
/** In the channel: inside the banks AND between source and mouth. */
|
|
1589
|
+
inside: boolean;
|
|
1590
|
+
/** Signed offset from the centerline in half-widths (±1 = the banks). */
|
|
1591
|
+
across: number;
|
|
1592
|
+
/** Meters downstream from the source. */
|
|
1593
|
+
along: number;
|
|
1594
|
+
surfaceY: number;
|
|
1595
|
+
/** Unit downstream direction at the projection. */
|
|
1596
|
+
dirX: number;
|
|
1597
|
+
dirZ: number;
|
|
1598
|
+
speed: number;
|
|
1599
|
+
halfWidth: number;
|
|
1600
|
+
}
|
|
1601
|
+
interface DownhillTraceOptions {
|
|
1602
|
+
/** Where the water starts (local frame, same as the sampler). */
|
|
1603
|
+
x: number;
|
|
1604
|
+
z: number;
|
|
1605
|
+
/** Meters per step — also the gradient probe radius. */
|
|
1606
|
+
step: number;
|
|
1607
|
+
/** Stop after this many points (default 200). */
|
|
1608
|
+
maxPoints?: number;
|
|
1609
|
+
/** Half-extent of a square play area to stay inside (default: unbounded). */
|
|
1610
|
+
bounds?: number;
|
|
1611
|
+
/** Drop per step below which the water is judged to have pooled (default 1 %
|
|
1612
|
+
* of the step — a genuinely flat basin, not a gentle reach). */
|
|
1613
|
+
minDrop?: number;
|
|
1614
|
+
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Trace where water would actually run from a point: repeated steepest descent
|
|
1617
|
+
* with momentum, so the line follows a valley floor instead of rattling between
|
|
1618
|
+
* its walls. Ends when the ground goes flat (a pool), the trace leaves the play
|
|
1619
|
+
* area, or `maxPoints` is reached.
|
|
1620
|
+
*
|
|
1621
|
+
* Feed the result straight into a {@link River3D} `path` — the terrain then
|
|
1622
|
+
* picks its own river, which is how a generated map gets water that belongs.
|
|
1623
|
+
*/
|
|
1624
|
+
declare function traceDownhillPath(bedAt: BedSampler, opts: DownhillTraceOptions): number[][];
|
|
1625
|
+
//#endregion
|
|
1626
|
+
//#region src/3d/nodes/river-3d.d.ts
|
|
1627
|
+
/**
|
|
1628
|
+
* A river: running water that finds its own shape.
|
|
1629
|
+
*
|
|
1630
|
+
* A scene declares a centerline `path`, a `width` (constant or a profile) and a
|
|
1631
|
+
* `depth`; the node samples the Terrain3D underneath and derives everything
|
|
1632
|
+
* else — a surface that descends with the ground and never climbs, a current
|
|
1633
|
+
* that speeds up where the channel pinches or tips, whitewater wherever those
|
|
1634
|
+
* two make it, and banks cut by the ground itself (each vertex carries its own
|
|
1635
|
+
* water column, and the shader stops drawing where that runs out).
|
|
1636
|
+
*
|
|
1637
|
+
* Unlike {@link Water3D} it costs no extra render passes — a river is a ribbon
|
|
1638
|
+
* with one draw call, so a map can carry a dozen of them.
|
|
1639
|
+
*
|
|
1640
|
+
* ```json
|
|
1641
|
+
* { "type": "River3D", "props": {
|
|
1642
|
+
* "path": [[-80, -30], [-20, 5], [30, 10], [90, -10]],
|
|
1643
|
+
* "widths": [3, 6, 11], "depth": 0.9, "flowSpeed": 1.8 } }
|
|
1644
|
+
* ```
|
|
1645
|
+
*/
|
|
1646
|
+
declare class River3D extends Node3D implements SunConsumer3D {
|
|
1647
|
+
static override readonly typeName: string;
|
|
1648
|
+
static override readonly props: PropSchema;
|
|
1649
|
+
/** Centerline control points `[[x, z], …]` in the node's local frame. */
|
|
1650
|
+
path: number[][];
|
|
1651
|
+
/** Channel width in meters (constant unless `widths` overrides it). */
|
|
1652
|
+
width: number;
|
|
1653
|
+
/** Width profile lerped source→mouth, e.g. `[2, 5, 9]` for a stream growing
|
|
1654
|
+
* into a river. Empty = the constant `width`. */
|
|
1655
|
+
widths: number[];
|
|
1656
|
+
/** Water column at the centerline, in meters. */
|
|
1657
|
+
depth: number;
|
|
1658
|
+
/** Reference current in m/s (the mean; reaches speed up and slow down). */
|
|
1659
|
+
flowSpeed: number;
|
|
1660
|
+
/** `{ shallow, deep, sky, horizon, bank }` — the body ramp plus what the
|
|
1661
|
+
* surface mirrors (a grazing river mostly mirrors its BANK, not the sky). */
|
|
1662
|
+
colors: JsonObject;
|
|
1663
|
+
/** Beer's-law density: how fast the water hides its bed. */
|
|
1664
|
+
absorption: number;
|
|
1665
|
+
/** Upper bound on the body's opacity (1 = the deep reach goes solid). */
|
|
1666
|
+
opacity: number;
|
|
1667
|
+
/** Whitewater dial: 0 = a glassy canal, 1 = default, 2 = raging. */
|
|
1668
|
+
foam: number;
|
|
1669
|
+
/** Surface-detail dial: ripple relief and glitter. */
|
|
1670
|
+
ripples: number;
|
|
1671
|
+
/** Glint direction (the sky's sun overrides while this is at its default). */
|
|
1672
|
+
sunDirection: number[];
|
|
1673
|
+
sunColor: string;
|
|
1674
|
+
sunIntensity: number;
|
|
1675
|
+
/** Drape target path; empty = auto-find the first Terrain3D in the tree. */
|
|
1676
|
+
terrain: string;
|
|
1677
|
+
/** How hard the current sweeps bodies downstream (0 = visual only). */
|
|
1678
|
+
flowForce: number;
|
|
1679
|
+
override renderOrder: number;
|
|
1680
|
+
private time;
|
|
1681
|
+
private rings;
|
|
1682
|
+
private courseKey;
|
|
1683
|
+
private bedAt;
|
|
1684
|
+
private world;
|
|
1685
|
+
private readonly _bodies;
|
|
1686
|
+
/** Loader hook: a malformed river fails at LOAD, not as an invisible ribbon. */
|
|
1687
|
+
static validateJson(node: Node): void;
|
|
1688
|
+
protected override _createObject3D(): Object3D;
|
|
1689
|
+
override update(dt: number): void;
|
|
1690
|
+
override _syncObject3D(): void;
|
|
1691
|
+
/**
|
|
1692
|
+
* Where a WORLD point sits in the channel — the query gameplay scripts run
|
|
1693
|
+
* (steer a raft, drown a torch, decide a ford is too fast to cross). `null`
|
|
1694
|
+
* until the river has been built.
|
|
1695
|
+
*/
|
|
1696
|
+
sampleAt(x: number, z: number): (RiverHit & {
|
|
1697
|
+
surfaceY: number;
|
|
1698
|
+
}) | null;
|
|
1699
|
+
/** @internal The derived centerline stations (surface, grade, current). */
|
|
1700
|
+
_rings(): readonly RiverRing[];
|
|
1701
|
+
/**
|
|
1702
|
+
* @internal Environment-sky sun hand-off (see {@link SunConsumer3D}): only
|
|
1703
|
+
* while `sunDirection` sits at its schema default — an authored glint wins.
|
|
1704
|
+
*/
|
|
1705
|
+
_applySunDirection(dir: readonly [number, number, number]): void;
|
|
1706
|
+
override free(): void;
|
|
1707
|
+
private widthProfile;
|
|
1708
|
+
/** Resolve the drape terrain; an explicit path that misses is a hard error. */
|
|
1709
|
+
private resolveTerrain;
|
|
1710
|
+
/**
|
|
1711
|
+
* Derive the course (stations + water column) when a shaping prop changed.
|
|
1712
|
+
* Pure CPU work — no three objects — so gameplay can call it any time.
|
|
1713
|
+
*/
|
|
1714
|
+
private ensureCourse;
|
|
1715
|
+
private rebuildIfNeeded;
|
|
1716
|
+
private buildMaterial;
|
|
1717
|
+
private syncUniforms;
|
|
1718
|
+
/**
|
|
1719
|
+
* Drag every body floating in the channel toward the water's own velocity.
|
|
1720
|
+
* Drag rather than thrust: a raft accelerates until it matches the current
|
|
1721
|
+
* and then coasts, and a swimmer can still fight across a slow ford.
|
|
1722
|
+
*/
|
|
1723
|
+
private sweepBodies;
|
|
1724
|
+
}
|
|
1725
|
+
//#endregion
|
|
1544
1726
|
//#region src/3d/terrain/heightmap.d.ts
|
|
1545
1727
|
/**
|
|
1546
1728
|
* A smooth radial depression carved into the terrain — a lake/pond bowl. x/z
|
|
@@ -1552,7 +1734,19 @@ interface BasinSpec {
|
|
|
1552
1734
|
x: number;
|
|
1553
1735
|
z: number;
|
|
1554
1736
|
radius: number;
|
|
1737
|
+
/** > 0 carves a bowl; < 0 RAISES a smooth dome mound of that height. */
|
|
1738
|
+
depth: number;
|
|
1739
|
+
}
|
|
1740
|
+
/**
|
|
1741
|
+
* A river/road trench carved along a polyline: the line version of a basin.
|
|
1742
|
+
* `width` is the flat bed, `taper` the bank blend beyond it (default: the bed
|
|
1743
|
+
* width again, which is what makes a walkable V instead of a slot).
|
|
1744
|
+
*/
|
|
1745
|
+
interface ChannelSpec {
|
|
1746
|
+
path: readonly (readonly number[])[];
|
|
1747
|
+
width: number;
|
|
1555
1748
|
depth: number;
|
|
1749
|
+
taper?: number;
|
|
1556
1750
|
}
|
|
1557
1751
|
interface HeightmapOptions {
|
|
1558
1752
|
/** Terrain extent in meters along x. */
|
|
@@ -1583,6 +1777,8 @@ interface HeightmapOptions {
|
|
|
1583
1777
|
edgeCornerSmoothness?: number;
|
|
1584
1778
|
/** Smooth radial lake/pond bowls carved into the surface (interior basins). */
|
|
1585
1779
|
basins?: BasinSpec[];
|
|
1780
|
+
/** River/road trenches carved along polylines (see {@link ChannelSpec}). */
|
|
1781
|
+
channels?: ChannelSpec[];
|
|
1586
1782
|
}
|
|
1587
1783
|
interface Heightmap {
|
|
1588
1784
|
readonly width: number;
|
|
@@ -1705,8 +1901,13 @@ declare class Terrain3D extends Node3D {
|
|
|
1705
1901
|
/** CDN base for theme textures: `<base>/<name>.png` (+`_normal`). */
|
|
1706
1902
|
textureBase: string;
|
|
1707
1903
|
/** Lake/pond bowls carved into the surface — smooth radial depressions the
|
|
1708
|
-
* collider + heightAt + dressing all see (place a Water3D in each).
|
|
1904
|
+
* collider + heightAt + dressing all see (place a Water3D in each).
|
|
1905
|
+
* NEGATIVE depth raises a smooth dome MOUND instead (a hill, an islet). */
|
|
1709
1906
|
basins: BasinSpec[];
|
|
1907
|
+
/** River/road trenches carved along polylines — `[{ path, width, depth,
|
|
1908
|
+
* taper? }]`. The line counterpart of `basins`: what gives running water a
|
|
1909
|
+
* bed to sit in, and the collider/heightAt/drape all see it. */
|
|
1910
|
+
channels: ChannelSpec[];
|
|
1710
1911
|
/**
|
|
1711
1912
|
* WET SAND band: `{ y, band? }` darkens + glosses the splat in a noisy,
|
|
1712
1913
|
* breathing band just above height `y` (a waterline) — the trace of the
|
|
@@ -2023,6 +2224,14 @@ declare class Water3D extends Node3D implements RenderHook3D, SunConsumer3D {
|
|
|
2023
2224
|
colors: JsonObject;
|
|
2024
2225
|
/** CubeCamera reflections (fancy only; needs a live renderer). */
|
|
2025
2226
|
reflection: boolean;
|
|
2227
|
+
/**
|
|
2228
|
+
* TRUE planar reflection: the scene re-rendered from the camera mirrored
|
|
2229
|
+
* across this surface, sampled per fragment. A cube map can only carry
|
|
2230
|
+
* distant content — the shoreline trees, the moored boat, the player at the
|
|
2231
|
+
* water's edge only appear in the water with this on. Costs one extra scene
|
|
2232
|
+
* render per frame, so it is off by default; a still lake earns it.
|
|
2233
|
+
*/
|
|
2234
|
+
mirror: boolean;
|
|
2026
2235
|
/** ms between reflection (and foam depth) re-renders. */
|
|
2027
2236
|
reflectionInterval: number;
|
|
2028
2237
|
/** Depth-texture shoreline foam — rides the always-on fancy scene pass. */
|
|
@@ -2116,6 +2325,9 @@ declare class Water3D extends Node3D implements RenderHook3D, SunConsumer3D {
|
|
|
2116
2325
|
private lastReflectionAt;
|
|
2117
2326
|
/** Per-frame scene pre-pass: depth (absorption/foam) + color grab (refraction). */
|
|
2118
2327
|
private scenePassTarget;
|
|
2328
|
+
private mirrorTarget;
|
|
2329
|
+
private readonly mirrorCamera;
|
|
2330
|
+
private readonly mirrorMatrix;
|
|
2119
2331
|
protected override _createObject3D(): Object3D;
|
|
2120
2332
|
override update(dt: number): void;
|
|
2121
2333
|
override _syncObject3D(): void;
|
|
@@ -2449,4 +2661,4 @@ declare function createNavDebugNode(nav: TerrainNav, opts?: {
|
|
|
2449
2661
|
name?: string;
|
|
2450
2662
|
}): InstancedMesh3D;
|
|
2451
2663
|
//#endregion
|
|
2452
|
-
export { Area3D, AssetStore3D, Billboard3D, type BillboardGroupMode, BoneAttachment3D, BoneLookAt3D, Camera3D, CharacterBody3D, CharacterController3D, type CreateGame3DOptions, DEFAULT_TERRAIN_TEXTURE_BASE, DirectionalLight3D, 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, 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_MAX_RIPPLES, Water3D, buildHeightmap, buildTerrainNav, cameraRelative, createGame3D, createNavDebugNode, enablePhysics3D, horizonColorFromSky, keyboardIntensity, movementState, parseEnvironment3D, registerNodes3D, resolveFlowerDensity, rigPose, setEnvironment3D, splatWeights, sunDirectionFromElevationAzimuth, sunDirectionFromSky, syncTree, terrainThemeLayers };
|
|
2664
|
+
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_MAX_RIPPLES, Water3D, buildHeightmap, buildTerrainNav, cameraRelative, createGame3D, createNavDebugNode, enablePhysics3D, horizonColorFromSky, keyboardIntensity, movementState, parseEnvironment3D, registerNodes3D, resolveFlowerDensity, rigPose, setEnvironment3D, splatWeights, sunDirectionFromElevationAzimuth, sunDirectionFromSky, syncTree, terrainThemeLayers, traceDownhillPath };
|
package/dist/3d.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as IncantoError } from "./errors-BpWbnbb_.js";
|
|
2
|
-
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-
|
|
3
|
-
import { A as
|
|
4
|
-
import { n as splatWeights, t as buildHeightmap } from "./heightmap-
|
|
5
|
-
import { n as enablePhysics3D, t as Physics3D } from "./physics-3d-
|
|
2
|
+
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-pNf3sI-Q.js";
|
|
3
|
+
import { A as TERRAIN_THEMES, B as QUARTER_PITCH, C as CharacterController3D, D as Billboard3D, E as BoneAttachment3D, F as PhysicsBody3D, H as keyboardIntensity, I as RigidBody3D, L as StaticBody3D, M as Joint3D, N as Area3D, O as Terrain3D, P as CharacterBody3D, R as Node3D, S as FLOWER_VARIETIES, T as BoneLookAt3D, U as movementState, V as cameraRelative, W as rigPose, _ as MeshInstance3D, a as VoxelGrid3D, b as Flowers3D, c as River3D, d as Particles3D, f as ModelInstance3D, g as InstancedMesh3D, h as OmniLight3D, i as VOXEL_PALETTE, j as terrainThemeLayers, k as DEFAULT_TERRAIN_TEXTURE_BASE, l as traceDownhillPath, m as DirectionalLight3D, n as Water3D, o as Tree3D, p as LoftMesh3D, s as Trail3D, t as registerNodes3D, u as WATER_MAX_RIPPLES, v as Foliage3D, w as Camera3D, x as resolveFlowerDensity, y as DENSITY_PRESETS } from "./register-BWFgsGra.js";
|
|
4
|
+
import { n as splatWeights, t as buildHeightmap } from "./heightmap-CRK0M4jT.js";
|
|
5
|
+
import { n as enablePhysics3D, t as Physics3D } from "./physics-3d-DxFDfUey.js";
|
|
6
6
|
//#region src/3d/environment-runtime.ts
|
|
7
7
|
/**
|
|
8
8
|
* Live environment editing — the renderer re-applies `scene.environment`
|
|
@@ -141,4 +141,4 @@ function createNavDebugNode(nav, opts) {
|
|
|
141
141
|
return node;
|
|
142
142
|
}
|
|
143
143
|
//#endregion
|
|
144
|
-
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, StaticBody3D, TERRAIN_THEMES, Terrain3D, Trail3D, Tree3D, VOXEL_PALETTE, VoxelGrid3D, WATER_MAX_RIPPLES, Water3D, buildHeightmap, buildTerrainNav, cameraRelative, createGame3D, createNavDebugNode, enablePhysics3D, horizonColorFromSky, keyboardIntensity, movementState, parseEnvironment3D, registerNodes3D, resolveFlowerDensity, rigPose, setEnvironment3D, splatWeights, sunDirectionFromElevationAzimuth, sunDirectionFromSky, syncTree, terrainThemeLayers };
|
|
144
|
+
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_MAX_RIPPLES, Water3D, buildHeightmap, buildTerrainNav, cameraRelative, createGame3D, createNavDebugNode, enablePhysics3D, horizonColorFromSky, keyboardIntensity, movementState, parseEnvironment3D, registerNodes3D, resolveFlowerDensity, rigPose, setEnvironment3D, splatWeights, sunDirectionFromElevationAzimuth, sunDirectionFromSky, syncTree, terrainThemeLayers, traceDownhillPath };
|
|
@@ -5,8 +5,8 @@ import { t as IncantoError } from "./errors-BpWbnbb_.js";
|
|
|
5
5
|
import { i as resolveRendering, n as attachTouchControls } from "./touch-031PxtCR.js";
|
|
6
6
|
import { n as registerGameplayBehaviors } from "./gameplay-sSqrUcnz.js";
|
|
7
7
|
import { t as debugSources } from "./debug-draw-CZmOYjL2.js";
|
|
8
|
-
import {
|
|
9
|
-
import { n as enablePhysics3D } from "./physics-3d-
|
|
8
|
+
import { F as PhysicsBody3D, R as Node3D, f as ModelInstance3D, m as DirectionalLight3D, r as createCausticsQuad, t as registerNodes3D, w as Camera3D } from "./register-BWFgsGra.js";
|
|
9
|
+
import { n as enablePhysics3D } from "./physics-3d-DxFDfUey.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.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as IncantoError } from "./errors-BpWbnbb_.js";
|
|
2
2
|
import { t as Rng } from "./rng-DP-SR7eg.js";
|
|
3
3
|
import { t as createNoise2D } from "./noise-CGUMx44x.js";
|
|
4
|
-
import { t as buildHeightmap } from "./heightmap-
|
|
4
|
+
import { t as buildHeightmap } from "./heightmap-CRK0M4jT.js";
|
|
5
5
|
//#region src/env/round.ts
|
|
6
6
|
/** 2-decimal rounding — keeps generated JSON readable without hurting determinism. */
|
|
7
7
|
function round2(value) {
|
|
@@ -34,6 +34,20 @@ function buildHeightmap(opts) {
|
|
|
34
34
|
radius: b.radius,
|
|
35
35
|
depth: b.depth
|
|
36
36
|
}));
|
|
37
|
+
const channels = (opts.channels ?? []).map((c) => ({
|
|
38
|
+
half: Math.max(c.width, 0) / 2,
|
|
39
|
+
taper: Math.max(c.taper ?? c.width, .001),
|
|
40
|
+
depth: c.depth,
|
|
41
|
+
segs: c.path.map((p) => ({
|
|
42
|
+
x: (p[0] ?? 0) + width / 2,
|
|
43
|
+
z: (p[1] ?? 0) + depth / 2
|
|
44
|
+
})).flatMap((p, i, all) => i === 0 ? [] : [{
|
|
45
|
+
ax: all[i - 1].x,
|
|
46
|
+
az: all[i - 1].z,
|
|
47
|
+
bx: p.x,
|
|
48
|
+
bz: p.z
|
|
49
|
+
}])
|
|
50
|
+
})).filter((c) => c.segs.length > 0 && c.depth !== 0);
|
|
37
51
|
const simplex = createNoise2D(seed);
|
|
38
52
|
/** Ported: noise remapped from [-1,1] to [0,1]. */
|
|
39
53
|
const noise01 = (x, y) => (simplex(x, y) + 1) * .5;
|
|
@@ -64,14 +78,38 @@ function buildHeightmap(opts) {
|
|
|
64
78
|
if (Math.abs(final - flatHeight) < FLAT_RANGE) final = flatHeight;
|
|
65
79
|
if (basins.length > 0) {
|
|
66
80
|
let carve = 0;
|
|
81
|
+
let lift = 0;
|
|
67
82
|
for (const b of basins) {
|
|
68
83
|
const d = Math.hypot(x - b.cx, z - b.cz);
|
|
69
84
|
if (d < b.radius) {
|
|
70
85
|
const t = d / b.radius;
|
|
71
|
-
|
|
86
|
+
const s = 1 - t * t * (3 - 2 * t);
|
|
87
|
+
if (b.depth >= 0) carve = Math.max(carve, b.depth * s);
|
|
88
|
+
else lift = Math.max(lift, -b.depth * s);
|
|
72
89
|
}
|
|
73
90
|
}
|
|
74
|
-
final
|
|
91
|
+
final += lift - carve;
|
|
92
|
+
}
|
|
93
|
+
if (channels.length > 0) {
|
|
94
|
+
let cut = 0;
|
|
95
|
+
for (const c of channels) {
|
|
96
|
+
let best = Number.POSITIVE_INFINITY;
|
|
97
|
+
for (const s of c.segs) {
|
|
98
|
+
const dx = s.bx - s.ax;
|
|
99
|
+
const dz = s.bz - s.az;
|
|
100
|
+
const len2 = dx * dx + dz * dz;
|
|
101
|
+
const t = len2 > 1e-9 ? Math.min(1, Math.max(0, ((x - s.ax) * dx + (z - s.az) * dz) / len2)) : 0;
|
|
102
|
+
const px = s.ax + dx * t;
|
|
103
|
+
const pz = s.az + dz * t;
|
|
104
|
+
const d = Math.hypot(x - px, z - pz);
|
|
105
|
+
if (d < best) best = d;
|
|
106
|
+
if (best <= c.half) break;
|
|
107
|
+
}
|
|
108
|
+
if (best >= c.half + c.taper) continue;
|
|
109
|
+
const t = Math.min(1, Math.max(0, (best - c.half) / c.taper));
|
|
110
|
+
cut = Math.max(cut, c.depth * (1 - t * t * (3 - 2 * t)));
|
|
111
|
+
}
|
|
112
|
+
final -= cut;
|
|
75
113
|
}
|
|
76
114
|
return final;
|
|
77
115
|
};
|
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.20.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 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { t as IncantoError } from "./errors-BpWbnbb_.js";
|
|
3
3
|
import { n as registerDebugSource } from "./debug-draw-CZmOYjL2.js";
|
|
4
|
-
import {
|
|
4
|
+
import { F as PhysicsBody3D, I as RigidBody3D, M as Joint3D, N as Area3D, O as Terrain3D, P as CharacterBody3D, R as Node3D, z as validateCollider3D } from "./register-BWFgsGra.js";
|
|
5
5
|
import { Euler, Quaternion } from "three";
|
|
6
6
|
//#region src/3d/physics/physics-3d.ts
|
|
7
7
|
var physics_3d_exports = /* @__PURE__ */ __exportAll({
|
package/dist/react.js
CHANGED
|
@@ -156,7 +156,7 @@ function IncantoCanvas(props) {
|
|
|
156
156
|
pointer: latest.pointer,
|
|
157
157
|
...keyboard !== void 0 ? { keyboard } : {}
|
|
158
158
|
};
|
|
159
|
-
const next = await (_gameFactory ?? (mode === "3d" ? async (o) => (await import("./create-game-
|
|
159
|
+
const next = await (_gameFactory ?? (mode === "3d" ? async (o) => (await import("./create-game-pNf3sI-Q.js").then((n) => n.n)).createGame3D(o) : async (o) => (await import("./create-game-Ct86zczq.js").then((n) => n.n)).createGame2D(o)))(opts);
|
|
160
160
|
if (disposed) {
|
|
161
161
|
next.dispose();
|
|
162
162
|
return;
|