@holtjs/stage 0.7.0 → 0.9.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/CHANGELOG.md CHANGED
@@ -6,6 +6,33 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.9.0] - 2026-12-04
10
+
11
+ ### Added
12
+ - **Complete 6-DOF 2D Affine Scene-Graph Transforms (`skewX` / `skewY`, `src/display.ts`, `src/renderer-gl.ts`, `src/renderer-webgpu.ts`, `src/renderer-2d.ts`)**:
13
+ - Added `skewX`, `skewY`, and `setSkew(sx, sy?)` on `DisplayObject`, completing the full 6-degree-of-freedom 2D affine group across `getWorldTransformMatrix()`, `ImageObject.getAnchor()`, `ImageObject.getAnchorPose()`, `RendererGl`, `RendererWebGpu`, and `Renderer2D` (unified onto direct `ctx.setTransform(m.a, m.b, m.c, m.d, m.tx, m.ty)` with zero cumulative drift).
14
+ - **True Oblique Sun-Cast Silhouette Shadows in `mountStage25D` (`@holtjs/stage/projection`)**:
15
+ - Added `Stage25DRig.shadowLayer` (`zIndex = 5`: strictly above `groundWorld` tiles and below `billboardLayer` sprites), `MountStage25DOptions.shadows` (`Shadow25DConfig`), `setSunShadow(cfg)`, and `syncDayNight(state)`.
16
+ - Automatically projects crisp ground-pinned silhouette shadows for both `ImageObject`/`SpriteObject` billboards and multi-part `Container` billboards (e.g. character + `syncAttachment` weapon), detaches along the sun ray when jumping (`wz > 0`), fades smoothly to zero at night (`0` shadow draw calls in darkness), and auto-disposes shadow clones via `onDispose()`.
17
+ - **Zero-Banding Analytical Radial Glow, Self-Lit `bindEmissive` Layer & Batched `flipX`/Rotation-Aware Normal-Lit Pass (`@holtjs/stage/lighting`)**:
18
+ - Upgraded `Lighting2DSystem` point lights from 5-ring stepped `Graphics` circles to a shared `128x128` smooth $C^1$ analytical radial falloff texture (`__stage_radial_glow`) rendered via `InstancedBatchObject` (`5x` fewer quads, zero Mach banding across WebGPU, WebGL2 & Canvas2D).
19
+ - Added `Lighting2DSystem.emissiveLayer` and `Lighting2DSystem.bindEmissive(sprite, opts?)` natively consuming `@holtjs/craft` `Frame.emissiveCenter`, `Frame.emissivePower`, and `${key}_emissive` self-lit atlases so campfires, torches, and glowing eyes shine brightly above the night `MULTIPLY` overlay across WebGPU, WebGL2, and Canvas2D.
20
+ - Upgraded `createNormalLitSpritePass` to single-draw batching with `flipX`/`flipY`/`rotation` tangent-basis transformation (`aBasis`), and added scene-graph native `createSceneNormalLitPass(scene, opts)` (`mode: 'rim' | 'replace'`) traversing `Container`s in painter's order.
21
+
22
+ ### Fixed
23
+ - **WebGL2 `CustomPass` VAO State Isolation (`src/renderer-gl.ts`)**:
24
+ - `RendererGl.invalidateProgramState()` now explicitly unbinds any bound WebGL2 VAO via `gl.bindVertexArray(null)` before entering `CustomPass.onRender` and during `restoreState()`, preventing custom `gl.vertexAttribPointer` calls from mutating `RendererGl`'s internal `quadVao` / `polyVao`.
25
+
26
+ ## [0.8.0] - 2026-12-04
27
+
28
+ ### Added
29
+ - **Oriented 3D->2D Socket Poses (`[x, y, angleRad, zBias]`) & One-Call Weapon Sync (`getAnchorPose` & `syncAttachment`, `src/texture.ts`, `src/display.ts`)**:
30
+ - Extended `Frame` sockets to accept oriented 4-tuples `[x, y, angleRad, zBias]` (projected from 3D bone matrices via `@holtjs/craft/three` `charKit.handSocket`) alongside 2-tuples `[x, y]`.
31
+ - Added `ImageObject.getAnchorPose(name, space?)` transforming the 2D grip tangent vector through the exact `flip -> scale -> rotate -> parentContainer` Jacobian.
32
+ - Added `ImageObject.syncAttachment(child, anchorName, opts?)` aligning position, shaft rotation (`restAngle`), `O(2)` single-blade mirroring (`mirrorBlade: true` so axes/scythes never strike backwards when turning left), and front/back body occlusion (`zBias` via `setZIndex`).
33
+ - **Reactive `DisplayObject.zIndex` Setter (`src/display.ts`)**:
34
+ - Converted `DisplayObject.zIndex` into a reactive getter/setter that automatically marks `parentContainer._markZDirty(true)` on direct property assignment (`node.zIndex = ...`), ensuring dynamic 2.5D depth sorting in `mountStage25D` and custom `Container`s stays strictly ordered every frame.
35
+
9
36
  ## [0.7.0] - 2026-12-04
10
37
 
11
38
  ### Added
@@ -98,6 +98,8 @@ interface SpriteSheetConfig {
98
98
  margin?: number;
99
99
  spacing?: number;
100
100
  }
101
+ /** Frame-space socket tuple: `[x, y]` or oriented `[x, y, angleRad, zBias]` (`zBias = +1` front, `-1` behind). */
102
+ type FrameAnchorTuple = readonly [number, number] | readonly [number, number, number, number];
101
103
  interface FrameExtraMeta {
102
104
  /** Exact pixel pivot X from trimmed frame top-left `(0, 0)` (takes precedence over `pivotX` to avoid float drift). */
103
105
  ax?: number;
@@ -107,8 +109,8 @@ interface FrameExtraMeta {
107
109
  pivotX?: number;
108
110
  /** Normalized vertical pivot `[0..1]` relative to `height`. */
109
111
  pivotY?: number;
110
- /** Named frame-local pixel sockets relative to trimmed frame top-left `(0, 0)`, e.g. `{ hand: [28, 34] }`. */
111
- anchors?: Readonly<Record<string, readonly [number, number]>>;
112
+ /** Named frame-local pixel sockets relative to trimmed top-left `(0, 0)`: `[x, y]` or oriented `[x, y, angleRad, zBias]`. */
113
+ anchors?: Readonly<Record<string, FrameAnchorTuple>>;
112
114
  /** Self-lit emissive centroid `[x, y]` in frame-local pixels (from `@holtjs/craft/three`). */
113
115
  emissiveCenter?: readonly [number, number];
114
116
  /** Normalized emissive coverage/intensity `[0..1]`. */
@@ -200,8 +202,8 @@ declare class Frame {
200
202
  pivotY: number;
201
203
  pixelPivotX: number;
202
204
  pixelPivotY: number;
203
- /** Named frame-space pixel sockets relative to trimmed `(0, 0)`, e.g. `{ hand: [28, 34] }`. */
204
- anchors: Record<string, readonly [number, number]> | null;
205
+ /** Named frame-space pixel sockets relative to trimmed `(0, 0)`: `[x, y]` or oriented `[x, y, angleRad, zBias]`. */
206
+ anchors: Record<string, FrameAnchorTuple> | null;
205
207
  emissiveCenter: readonly [number, number] | null;
206
208
  emissivePower: number;
207
209
  actor: string | null;
@@ -215,10 +217,10 @@ declare class Frame {
215
217
  setPivot(pivotX: number, pivotY: number): this;
216
218
  /** Set exact pixel pivot `(ax, ay)` from trimmed frame top-left `(0, 0)` (avoids float rounding drift). */
217
219
  setPixelPivot(ax: number, ay: number): this;
218
- /** Attach or update a named pixel socket `(x, y)` relative to trimmed frame top-left `(0, 0)`. */
219
- setAnchor(name: string, x: number, y: number): this;
220
- /** Read a named pixel socket `[x, y]` (falls back to `emissiveCenter` when `name === 'emissive'`). */
221
- getAnchor(name: string): readonly [number, number] | null;
220
+ /** Attach or update a named pixel socket `(x, y)` (with optional projected `angleRad` & front/back `zBias`). */
221
+ setAnchor(name: string, x: number, y: number, angleRad?: number, zBias?: number): this;
222
+ /** Read a named pixel socket `[x, y]` or `[x, y, angleRad, zBias]` (falls back to `emissiveCenter` when `name === 'emissive'`). */
223
+ getAnchor(name: string): FrameAnchorTuple | null;
222
224
  applyMeta(meta: FrameExtraMeta): this;
223
225
  updateUVs(): void;
224
226
  }
@@ -386,4 +388,4 @@ declare class AnimationManager {
386
388
  */
387
389
  createFromAtlas(textureKey: string, options?: AtlasAutoAnimOptions): StageAnimation[];
388
390
  }
389
- export { HEX_MASK as A, WEBGPU as B, BLACK_RGB as C, EventEmitter as D, CANVAS as E, ScaleMode as F, parseColor as G, WorldView2D as H, Scenes as I, rgbToCss as K, TintMode as L, Rect2D as M, RgbaColor as N, FilterMode as O, Scale as P, TintModes as R, AUTO as S, BlendModes as T, createMatrix2D as U, WHITE_RGB as V, packColorAbgr as W, Texture as _, AtlasClipRule as a, TextureManager as b, GenerateFrameNamesConfig as c, AtlasJsonLike as d, CanvasTexture as f, SpriteSheetConfig as g, GlTextureHost as h, AtlasAutoAnimOptions as i, Matrix2D as j, FilterModeValue as k, GenerateFrameNumbersConfig as l, FrameExtraMeta as m, AnimationFrameInput as n, CompiledAnimationFrame as o, Frame as p, AnimationManager as r, DirectionalAnimGroup as s, AnimationConfig as t, StageAnimation as u, TextureImageOptions as v, BlendMode as w, TextureSource as x, TextureImageSource as y, WEBGL as z };
391
+ export { FilterModeValue as A, WEBGL as B, AUTO as C, CANVAS as D, BlendModes as E, Scale as F, packColorAbgr as G, WHITE_RGB as H, ScaleMode as I, parseColor as K, Scenes as L, Matrix2D as M, Rect2D as N, EventEmitter as O, RgbaColor as P, TintMode as R, TextureSource as S, BlendMode as T, WorldView2D as U, WEBGPU as V, createMatrix2D as W, SpriteSheetConfig as _, AtlasClipRule as a, TextureImageSource as b, GenerateFrameNamesConfig as c, AtlasJsonLike as d, CanvasTexture as f, GlTextureHost as g, FrameExtraMeta as h, AtlasAutoAnimOptions as i, HEX_MASK as j, FilterMode as k, GenerateFrameNumbersConfig as l, FrameAnchorTuple as m, AnimationFrameInput as n, CompiledAnimationFrame as o, Frame as p, rgbToCss as q, AnimationManager as r, DirectionalAnimGroup as s, AnimationConfig as t, StageAnimation as u, Texture as v, BLACK_RGB as w, TextureManager as x, TextureImageOptions as y, TintModes as z };
package/dist/anims.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as AtlasClipRule, c as GenerateFrameNamesConfig, i as AtlasAutoAnimOptions, l as GenerateFrameNumbersConfig, n as AnimationFrameInput, o as CompiledAnimationFrame, r as AnimationManager, s as DirectionalAnimGroup, t as AnimationConfig, u as StageAnimation } from "./anims-CS0rfUIz.js";
1
+ import { a as AtlasClipRule, c as GenerateFrameNamesConfig, i as AtlasAutoAnimOptions, l as GenerateFrameNumbersConfig, n as AnimationFrameInput, o as CompiledAnimationFrame, r as AnimationManager, s as DirectionalAnimGroup, t as AnimationConfig, u as StageAnimation } from "./anims-ClNi6zZQ.js";
2
2
  export { AnimationConfig, AnimationFrameInput, AnimationManager, AtlasAutoAnimOptions, AtlasClipRule, CompiledAnimationFrame, DirectionalAnimGroup, GenerateFrameNamesConfig, GenerateFrameNumbersConfig, StageAnimation };