incanto 0.21.0 → 0.22.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 CHANGED
@@ -1,7 +1,7 @@
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-Ct86zczq.js";
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-Djwckzgx.js";
4
- import { n as enablePhysics2D, t as Physics2D } from "./physics-2d-BiIdl51r.js";
2
+ import { a as AssetStore2D, i as syncTree2D, r as Renderer2D, t as createGame2D } from "./create-game-B-M1zune.js";
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
+ import { n as enablePhysics2D, t as Physics2D } from "./physics-2d-DiVFFlH3.js";
5
5
  //#region src/2d/library-sprite.ts
6
6
  /**
7
7
  * Turn a library sprite-animation JSON into a scene-ready spritesheet asset
package/dist/3d.d.ts CHANGED
@@ -532,6 +532,15 @@ interface CausticsConfig {
532
532
  /** Animation speed multiplier. */
533
533
  speed: number;
534
534
  }
535
+ /**
536
+ * God rays: the shafts of sunlight the surface's own ripples focus into the
537
+ * water column. Caustics light what the beams LAND on; this is the beam itself.
538
+ */
539
+ interface LightShaftConfig {
540
+ enabled: boolean;
541
+ /** Brightness of the accumulated shafts. */
542
+ strength: number;
543
+ }
535
544
  /** Resolved underwater look: fog color, view distance, and the caustics layer. */
536
545
  interface UnderwaterConfig {
537
546
  enabled: boolean;
@@ -541,6 +550,8 @@ interface UnderwaterConfig {
541
550
  visibility: number;
542
551
  /** Caustics projected onto submerged surfaces (the floor especially). */
543
552
  caustics: CausticsConfig;
553
+ /** Sunlight shafts hanging in the water column. */
554
+ rays: LightShaftConfig;
544
555
  }
545
556
  //#endregion
546
557
  //#region src/3d/environment-3d.d.ts
@@ -2418,6 +2429,14 @@ declare class Water3D extends Node3D implements RenderHook3D, SunConsumer3D {
2418
2429
  private resolvePalette;
2419
2430
  private syncSimple;
2420
2431
  private stepInteraction;
2432
+ /**
2433
+ * Surface height at WORLD (x, z) — the CPU twin of the shader's own waves,
2434
+ * so gameplay can float a raft, bob a buoy or place a jetty on the sea state
2435
+ * the player is actually looking at. Interaction ripples are excluded (a
2436
+ * splash must not re-trigger itself); outside the footprint it still answers
2437
+ * the still-water level, which is what a caller comparing heights wants.
2438
+ */
2439
+ heightAt(x: number, z: number): number;
2421
2440
  /** Base wave height at world (x, z) — the CPU twin of the active shader.
2422
2441
  * Ripples are excluded on purpose: a splash must not re-trigger itself. */
2423
2442
  private waveOffsetAt;
package/dist/3d.js CHANGED
@@ -1,8 +1,9 @@
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-xbxZRFwR.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-BC55Ez6I.js";
2
+ import { A as Water3D, F as StaticBody3D, I as Node3D, M as CharacterBody3D, N as PhysicsBody3D, P as RigidBody3D, j as Area3D, z as WATER_MAX_RIPPLES } from "./gameplay-Dib5mNFD.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-C3uiw80V.js";
4
+ import { A as QUARTER_PITCH, C as BoneAttachment3D, D as TERRAIN_THEMES, E as DEFAULT_TERRAIN_TEXTURE_BASE, M as keyboardIntensity, N as movementState, O as terrainThemeLayers, P as rigPose, S as BoneLookAt3D, T as Terrain3D, _ as Flowers3D, a as Trail3D, b as CharacterController3D, c as Particles3D, d as DirectionalLight3D, f as OmniLight3D, g as DENSITY_PRESETS, h as Foliage3D, i as Tree3D, j as cameraRelative, k as Joint3D, l as ModelInstance3D, m as MeshInstance3D, n as VOXEL_PALETTE, o as River3D, p as InstancedMesh3D, r as VoxelGrid3D, s as traceDownhillPath, t as registerNodes3D, u as LoftMesh3D, v as resolveFlowerDensity, w as Billboard3D, x as Camera3D, y as FLOWER_VARIETIES } from "./register-CHgVdSbp.js";
4
5
  import { n as splatWeights, t as buildHeightmap } from "./heightmap-CRK0M4jT.js";
5
- import { n as enablePhysics3D, t as Physics3D } from "./physics-3d-DHTZUrr0.js";
6
+ import { n as enablePhysics3D, t as Physics3D } from "./physics-3d-DLPPRNu4.js";
6
7
  //#region src/3d/environment-runtime.ts
7
8
  /**
8
9
  * Live environment editing — the renderer re-applies `scene.environment`
@@ -3,10 +3,10 @@ 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-sSqrUcnz.js";
7
- import { g as PhysicsBody2D, n as UILayer, t as registerNodes2D, u as Camera2D, y as Node2D } from "./register-Djwckzgx.js";
6
+ import { n as registerGameplayBehaviors } from "./gameplay-Dib5mNFD.js";
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
- import { n as enablePhysics2D } from "./physics-2d-BiIdl51r.js";
9
+ import { n as enablePhysics2D } from "./physics-2d-DiVFFlH3.js";
10
10
  import { Box3, BufferAttribute, BufferGeometry, Color, LineBasicMaterial, LineSegments, LinearFilter, NearestFilter, OrthographicCamera, Raycaster, SRGBColorSpace, Scene, TextureLoader, Vector2, Vector3, WebGLRenderer } from "three";
11
11
  //#region src/2d/assets.ts
12
12
  /**
@@ -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 { n as registerGameplayBehaviors } from "./gameplay-sSqrUcnz.js";
6
+ import { I as Node3D, N as PhysicsBody3D, R as createCausticsQuad, n as registerGameplayBehaviors } from "./gameplay-Dib5mNFD.js";
7
7
  import { t as debugSources } from "./debug-draw-CZmOYjL2.js";
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-BC55Ez6I.js";
9
- import { n as enablePhysics3D } from "./physics-3d-DHTZUrr0.js";
8
+ import { d as DirectionalLight3D, l as ModelInstance3D, t as registerNodes3D, x as Camera3D } from "./register-CHgVdSbp.js";
9
+ import { n as enablePhysics3D } from "./physics-3d-DLPPRNu4.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";
@@ -1762,6 +1762,9 @@ var Renderer3D = class {
1762
1762
  u.uCausticIntensity.value = underwater.caustics.intensity;
1763
1763
  u.uCausticScale.value = underwater.caustics.scale;
1764
1764
  u.uMaxDist.value = underwater.visibility;
1765
+ const sunDir = this.environment.sunDirection;
1766
+ if (sunDir) u.uSunDirection.value.set(sunDir[0], sunDir[1], sunDir[2]);
1767
+ u.uRayStrength.value = underwater.rays.enabled ? underwater.rays.strength : 0;
1765
1768
  this.webgl.render(this.causticsScene, camera);
1766
1769
  }
1767
1770
  /**
@@ -1,4 +1,18 @@
1
1
  import { i as serializeNode, t as buildNodeJson } from "./loader-BZqOKfI2.js";
2
+ //#region src/core/order-groups.ts
3
+ const ORDER_GROUP_BASE = {
4
+ background: -2e3,
5
+ terrain: -1e3,
6
+ default: 0,
7
+ characters: 1e3,
8
+ effects: 2e3,
9
+ overlay: 3e3
10
+ };
11
+ /** base + fine offset (unknown group names fall back to `default`). */
12
+ function effectiveOrder(group, renderOrder) {
13
+ return (ORDER_GROUP_BASE[group] ?? 0) + renderOrder;
14
+ }
15
+ //#endregion
2
16
  //#region src/core/scene/duplicate.ts
3
17
  function stripUids(json) {
4
18
  const { uid: _uid, ...rest } = json;
@@ -19,4 +33,4 @@ function duplicateNode(node) {
19
33
  return buildNodeJson(stripUids(serializeNode(node)));
20
34
  }
21
35
  //#endregion
22
- export { duplicateNode as t };
36
+ export { ORDER_GROUP_BASE as n, effectiveOrder as r, duplicateNode as t };