@holtjs/stage 0.7.0 → 0.8.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 +10 -0
- package/dist/{anims-CS0rfUIz.d.ts → anims-ClNi6zZQ.d.ts} +11 -9
- package/dist/anims.d.ts +1 -1
- package/dist/{game-3L9wS-Bv.d.ts → game-CEa0m4eX.d.ts} +44 -3
- package/dist/{game-BnSWR44q.js → game-D46nY-B2.js} +15 -7
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/joystick.d.ts +1 -1
- package/dist/kernel.d.ts +1 -1
- package/dist/lighting.d.ts +1 -1
- package/dist/projection.d.ts +1 -1
- package/dist/{renderer-webgpu-alSDj9RR.js → renderer-webgpu-BXU-ZDIp.js} +97 -3
- package/dist/renderer-webgpu.d.ts +1 -1
- package/dist/renderer-webgpu.js +1 -1
- package/dist/rig2d.d.ts +2 -2
- package/dist/tilemap.d.ts +1 -1
- package/dist/trace.d.ts +1 -1
- package/package.json +1 -1
- package/skills/stage/SKILL.md +3 -2
- package/skills/stage/references/subpaths.md +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,16 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.8.0] - 2026-12-04
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **Oriented 3D->2D Socket Poses (`[x, y, angleRad, zBias]`) & One-Call Weapon Sync (`getAnchorPose` & `syncAttachment`, `src/texture.ts`, `src/display.ts`)**:
|
|
13
|
+
- 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]`.
|
|
14
|
+
- Added `ImageObject.getAnchorPose(name, space?)` transforming the 2D grip tangent vector through the exact `flip -> scale -> rotate -> parentContainer` Jacobian.
|
|
15
|
+
- 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`).
|
|
16
|
+
- **Reactive `DisplayObject.zIndex` Setter (`src/display.ts`)**:
|
|
17
|
+
- 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.
|
|
18
|
+
|
|
9
19
|
## [0.7.0] - 2026-12-04
|
|
10
20
|
|
|
11
21
|
### 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
|
|
111
|
-
anchors?: Readonly<Record<string,
|
|
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)
|
|
204
|
-
anchors: Record<string,
|
|
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)`
|
|
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):
|
|
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 {
|
|
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-
|
|
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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I as ScaleMode, M as Matrix2D, N as Rect2D, O as EventEmitter, P as RgbaColor, R as TintMode, S as TextureSource, T as BlendMode, U as WorldView2D, _ as SpriteSheetConfig, d as AtlasJsonLike, g as GlTextureHost, p as Frame, r as AnimationManager, u as StageAnimation, v as Texture, x as TextureManager, y as TextureImageOptions } from "./anims-ClNi6zZQ.js";
|
|
2
2
|
import { c as TweenManager, u as TweenStats } from "./tween-BiF1FUvc.js";
|
|
3
3
|
interface CameraFollowOptions {
|
|
4
4
|
/** Horizontal smoothing factor in `(0, 1]` (`1` = instant lock; default `1`). */
|
|
@@ -195,7 +195,7 @@ declare abstract class DisplayObject extends EventEmitter {
|
|
|
195
195
|
rotation: number;
|
|
196
196
|
alpha: number;
|
|
197
197
|
depth: number;
|
|
198
|
-
|
|
198
|
+
private _zIndex;
|
|
199
199
|
trackId: string | null;
|
|
200
200
|
alt: string | null;
|
|
201
201
|
role: string | null;
|
|
@@ -233,6 +233,8 @@ declare abstract class DisplayObject extends EventEmitter {
|
|
|
233
233
|
setAngle(deg: number): this;
|
|
234
234
|
setAlpha(a: number): this;
|
|
235
235
|
setDepth(d: number): this;
|
|
236
|
+
get zIndex(): number;
|
|
237
|
+
set zIndex(z: number);
|
|
236
238
|
/** Native container-local stacking order (0 by default; sorted stably when any sibling has non-zero zIndex). */
|
|
237
239
|
setZIndex(z: number): this;
|
|
238
240
|
/** Attach a stable, privacy-safe telemetry/automation identifier (never user text or PII). */
|
|
@@ -294,12 +296,51 @@ declare class ImageObject extends DisplayObject {
|
|
|
294
296
|
x: number;
|
|
295
297
|
y: number;
|
|
296
298
|
} | null;
|
|
299
|
+
/**
|
|
300
|
+
* Read the full transformed 2D pose (`x`, `y`, `rotation`, `zBias`, `hasAngle`) of an oriented socket
|
|
301
|
+
* (`[x, y, angleRad, zBias]` from `@holtjs/craft/three` `charKit.handSocket`), transforming the 2D grip
|
|
302
|
+
* tangent vector through the exact `flip -> scale -> rotate -> parentContainer` Jacobian!
|
|
303
|
+
*/
|
|
304
|
+
getAnchorPose(name: string, space?: 'local' | 'parent' | 'world', out?: AnchorPose2D): AnchorPose2D | null;
|
|
305
|
+
/**
|
|
306
|
+
* Align an equipped weapon/tool `DisplayObject` (`axe`, `spear`, `torch`, `shield`) to a named socket (`'hand'`) in one call:
|
|
307
|
+
* - Sets `child.x` & `child.y` to the transformed socket position
|
|
308
|
+
* - Rotates `child.rotation` so `restAngle` (default `-Math.PI / 2` = upright sprite) aligns with the socket's projected 2D shaft angle
|
|
309
|
+
* - Mirrors asymmetric blades (`mirrorBlade: true`) across the shaft axis via `O(2)` reflection when aiming left (`cos < 0`) so single-bladed axes never strike backwards!
|
|
310
|
+
* - Applies `zBias` (`+1` in front of body, `-1` behind body) via `child.setZIndex(baseZIndex + zBias)`
|
|
311
|
+
*/
|
|
312
|
+
syncAttachment(child: DisplayObject, anchorName: string, opts?: SyncAttachmentOptions): boolean;
|
|
297
313
|
setTint(color: number): this;
|
|
298
314
|
setTintMode(mode: TintMode): this;
|
|
299
315
|
clearTint(): this;
|
|
300
316
|
setPixelAA(on?: boolean): this;
|
|
301
317
|
setCrop(x?: number, y?: number, w?: number, h?: number): this;
|
|
302
318
|
}
|
|
319
|
+
interface AnchorPose2D {
|
|
320
|
+
x: number;
|
|
321
|
+
y: number;
|
|
322
|
+
/** Transformed 2D aim/shaft angle in radians (`[-PI, PI]`), accounting for `flipX`, `flipY`, `rotation`, and ancestor `Container`s. */
|
|
323
|
+
rotation: number;
|
|
324
|
+
/** Front/back occlusion hint (`+1` in front of body, `-1` behind body). */
|
|
325
|
+
zBias: number;
|
|
326
|
+
/** True when the baked frame socket included an explicit 3D->2D projected angle (`[x, y, angleRad, zBias]`). */
|
|
327
|
+
hasAngle: boolean;
|
|
328
|
+
}
|
|
329
|
+
interface SyncAttachmentOptions {
|
|
330
|
+
/**
|
|
331
|
+
* Screen-space angle (in radians) at which the attachment sprite's shaft points in its own unrotated frame.
|
|
332
|
+
* Default `-Math.PI / 2` (pointing straight UP `-Y`, matching upright weapons/tools baked along `+Y` in `@holtjs/craft/three`).
|
|
333
|
+
*/
|
|
334
|
+
readonly restAngle?: number;
|
|
335
|
+
/** Additional additive angle offset in radians (automatically negated when `mirrorBlade` mirrors leftward aims). */
|
|
336
|
+
readonly angleOffset?: number;
|
|
337
|
+
/** Mirror asymmetric blades (axes, scythes, pistols) across their shaft axis when aiming left (`cos < 0`). Default `true`. */
|
|
338
|
+
readonly mirrorBlade?: boolean;
|
|
339
|
+
/** Coordinate space used to align `child` (`'local' | 'parent' | 'world'`; default `'parent'`). */
|
|
340
|
+
readonly space?: 'local' | 'parent' | 'world';
|
|
341
|
+
/** Base `zIndex` around which `pose.zBias` (`+1` front / `-1` behind) is applied (`default = this.zIndex`; `false` skips `zIndex`). */
|
|
342
|
+
readonly baseZIndex?: number | false;
|
|
343
|
+
}
|
|
303
344
|
interface SpritePlayOptions {
|
|
304
345
|
/** Keep current animation running untouched when already playing the requested key (default `false`, or pass boolean shorthand `sprite.play(key, true)`). */
|
|
305
346
|
readonly ignoreIfPlaying?: boolean;
|
|
@@ -1890,4 +1931,4 @@ declare class Game {
|
|
|
1890
1931
|
step(time: number, delta: number): void;
|
|
1891
1932
|
destroy(removeCanvas?: boolean): void;
|
|
1892
1933
|
}
|
|
1893
|
-
export { WebGpuBootstrapResult as $, createInputRecorder as A,
|
|
1934
|
+
export { WebGpuBootstrapResult as $, createInputRecorder as A, PanelOpenSide as At, SceneDigestSurfaceEntry as B, SpritePlayOptions as Bt, RecordedInputEntry as C, ImageObject as Ct, TimelineClickOptions as D, MsdfIconObject as Dt, StagePlugin as E, MsdfIconConfig as Et, SceneDigestEngineSandbox as F, ShapeBatchColumns as Ft, InputConfig as G, Camera as Gt, SceneDigestSurfaces as H, TextObject as Ht, SceneDigestNode as I, ShapeBatchObject as It, Pointer as J, HiDpiScaleLike as Jt, InputPlugin as K, CameraFollowOptions as Kt, SceneDigestOptions as L, ShapeBatchStyleDefaults as Lt, createInputTimeline as M, RectClipMask as Mt, SceneDigest as N, RectangleObject as Nt, TimelineDragOptions as O, NineSliceObject as Ot, SceneDigestActiveFocus as P, SceneHostLike as Pt, RequestWebGpuOptions as Q, SceneDigestOverlayStats as R, SpriteAnimEventListener as Rt, InputTimelinePlugin as S, Graphics as St, StageKernel as T, InstancedColumns as Tt, buildSceneDigest as U, TextStyleConfig as Ut, SceneDigestSurfaceSource as V, SyncAttachmentOptions as Vt, sanitizeTrackToken as W, TileSpriteObject as Wt, RendererWebGpu as X, PointerSample as Y, RendererWebGpuOptions as Z, ActionMap as _, DirectionalPlayOptions as _t, GameLoop as a, RendererGlOptions as at, InputTargetSpec as b, DisplayObjectType as bt, LoaderPlugin as c, StageRenderTarget as ct, SceneCtor as d, Bob as dt, WebGpuCanvasContextLike as et, SceneInput as f, Container as ft, ViewportFitResult as g, CustomPassOptions as gt, StageRenderer as h, CustomPassObject as ht, GameConfig as i, RendererGl as it, createInputReplay as j, PanelStyleConfig as jt, TimelineKeyOptions as k, PanelObject as kt, ScaleManager as l, AnchorPose2D as lt, SceneManager as m, CustomPassCallback as mt, EngineClockSnapshot as n, requestWebGpuDevice as nt, GameObjectFactory as o, RendererStats as ot, SceneLifecycleStats as p, ContainerFiltersShim as pt, KeyboardPlugin as q, HiDpiConfigureOptions as qt, Game as r, Renderer2D as rt, JsonCache as s, Stage2DCustomImageHandler as st, EngineClock as t, WebGpuDeviceLike as tt, Scene as u, BlitterObject as ut, InputProvider as v, DisplayList as vt, StageInputEvent as w, InstancedBatchObject as wt, InputTimelineOptions as x, DisplaySemantics as xt, InputRecorderPlugin as y, DisplayObject as yt, SceneDigestSandbox as z, SpriteObject as zt };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as rgbToCss, a as EventEmitter, c as Scale, h as packColorAbgr, l as Scenes, m as createMatrix2D, o as FilterMode, p as WHITE_RGB, r as BlendModes, u as TintModes } from "./types-CXsCvp1p.js";
|
|
2
2
|
import { AnimationManager } from "./anims.js";
|
|
3
|
-
import { _ as SpriteObject, a as Container, b as Camera, d as InstancedBatchObject, f as MsdfIconObject, g as ShapeBatchObject, h as RectangleObject, i as BlitterObject, l as Graphics, m as PanelObject, o as CustomPassObject, p as NineSliceObject, r as Renderer2D, s as DisplayList, t as RendererWebGpu, u as ImageObject, v as TextObject, y as TileSpriteObject } from "./renderer-webgpu-
|
|
3
|
+
import { _ as SpriteObject, a as Container, b as Camera, d as InstancedBatchObject, f as MsdfIconObject, g as ShapeBatchObject, h as RectangleObject, i as BlitterObject, l as Graphics, m as PanelObject, o as CustomPassObject, p as NineSliceObject, r as Renderer2D, s as DisplayList, t as RendererWebGpu, u as ImageObject, v as TextObject, y as TileSpriteObject } from "./renderer-webgpu-BXU-ZDIp.js";
|
|
4
4
|
import { TweenManager } from "./tween.js";
|
|
5
5
|
import { StageKernel } from "./kernel.js";
|
|
6
6
|
// src/texture.ts
|
|
@@ -92,7 +92,7 @@ var Frame = class {
|
|
|
92
92
|
pivotY = .5;
|
|
93
93
|
pixelPivotX = 0;
|
|
94
94
|
pixelPivotY = 0;
|
|
95
|
-
/** Named frame-space pixel sockets relative to trimmed `(0, 0)
|
|
95
|
+
/** Named frame-space pixel sockets relative to trimmed `(0, 0)`: `[x, y]` or oriented `[x, y, angleRad, zBias]`. */
|
|
96
96
|
anchors = null;
|
|
97
97
|
emissiveCenter = null;
|
|
98
98
|
emissivePower = 0;
|
|
@@ -141,13 +141,21 @@ var Frame = class {
|
|
|
141
141
|
this.pivotY = this.height > 0 ? ay / this.height : .5;
|
|
142
142
|
return this;
|
|
143
143
|
}
|
|
144
|
-
/** Attach or update a named pixel socket `(x, y)`
|
|
145
|
-
setAnchor(name, x, y) {
|
|
144
|
+
/** Attach or update a named pixel socket `(x, y)` (with optional projected `angleRad` & front/back `zBias`). */
|
|
145
|
+
setAnchor(name, x, y, angleRad, zBias) {
|
|
146
146
|
if (!this.anchors) this.anchors = Object.create(null);
|
|
147
|
-
|
|
147
|
+
if (typeof angleRad === "number" && Number.isFinite(angleRad)) {
|
|
148
|
+
const zb = typeof zBias === "number" && Number.isFinite(zBias) ? zBias >= 0 ? 1 : -1 : 1;
|
|
149
|
+
this.anchors[name] = [
|
|
150
|
+
x,
|
|
151
|
+
y,
|
|
152
|
+
angleRad,
|
|
153
|
+
zb
|
|
154
|
+
];
|
|
155
|
+
} else this.anchors[name] = [x, y];
|
|
148
156
|
return this;
|
|
149
157
|
}
|
|
150
|
-
/** Read a named pixel socket `[x, y]` (falls back to `emissiveCenter` when `name === 'emissive'`). */
|
|
158
|
+
/** Read a named pixel socket `[x, y]` or `[x, y, angleRad, zBias]` (falls back to `emissiveCenter` when `name === 'emissive'`). */
|
|
151
159
|
getAnchor(name) {
|
|
152
160
|
if (this.anchors && Object.prototype.hasOwnProperty.call(this.anchors, name)) return this.anchors[name];
|
|
153
161
|
if (name === "emissive" && this.emissiveCenter) return this.emissiveCenter;
|
|
@@ -157,7 +165,7 @@ var Frame = class {
|
|
|
157
165
|
if (typeof meta.ax === "number" && typeof meta.ay === "number") this.setPixelPivot(meta.ax, meta.ay);
|
|
158
166
|
else if (typeof meta.pivotX === "number" || typeof meta.pivotY === "number") this.setPivot(meta.pivotX ?? .5, meta.pivotY ?? .5);
|
|
159
167
|
if (meta.anchors) {
|
|
160
|
-
for (const [k, pt] of Object.entries(meta.anchors)) if (Array.isArray(pt) && pt.length >= 2) this.setAnchor(k, Number(pt[0]) || 0, Number(pt[1]) || 0);
|
|
168
|
+
for (const [k, pt] of Object.entries(meta.anchors)) if (Array.isArray(pt) && pt.length >= 2) this.setAnchor(k, Number(pt[0]) || 0, Number(pt[1]) || 0, pt.length >= 3 && typeof pt[2] === "number" ? Number(pt[2]) : void 0, pt.length >= 4 && typeof pt[3] === "number" ? Number(pt[3]) : void 0);
|
|
161
169
|
}
|
|
162
170
|
if (Array.isArray(meta.emissiveCenter) && meta.emissiveCenter.length >= 2) this.emissiveCenter = [Number(meta.emissiveCenter[0]) || 0, Number(meta.emissiveCenter[1]) || 0];
|
|
163
171
|
if (typeof meta.emissivePower === "number") this.emissivePower = meta.emissivePower;
|
package/dist/headless.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as StagePlugin, L as SceneDigestOptions, N as SceneDigest, f as SceneInput, n as EngineClockSnapshot, r as Game, u as Scene } from "./game-
|
|
1
|
+
import { E as StagePlugin, L as SceneDigestOptions, N as SceneDigest, f as SceneInput, n as EngineClockSnapshot, r as Game, u as Scene } from "./game-CEa0m4eX.js";
|
|
2
2
|
/** Minimal Canvas2D surface compatible with `@napi-rs/canvas`, `node-canvas`, and browser `<canvas>`. */
|
|
3
3
|
export interface HeadlessCanvasLike {
|
|
4
4
|
width: number;
|
package/dist/headless.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as WebGpuBootstrapResult, A as createInputRecorder, At as
|
|
2
|
-
import { A as
|
|
1
|
+
import { $ as WebGpuBootstrapResult, A as createInputRecorder, At as PanelOpenSide, B as SceneDigestSurfaceEntry, Bt as SpritePlayOptions, C as RecordedInputEntry, Ct as ImageObject, D as TimelineClickOptions, Dt as MsdfIconObject, E as StagePlugin, Et as MsdfIconConfig, F as SceneDigestEngineSandbox, Ft as ShapeBatchColumns, G as InputConfig, Gt as Camera, H as SceneDigestSurfaces, Ht as TextObject, I as SceneDigestNode, It as ShapeBatchObject, J as Pointer, Jt as HiDpiScaleLike, K as InputPlugin, Kt as CameraFollowOptions, L as SceneDigestOptions, Lt as ShapeBatchStyleDefaults, M as createInputTimeline, Mt as RectClipMask, N as SceneDigest, Nt as RectangleObject, O as TimelineDragOptions, Ot as NineSliceObject, P as SceneDigestActiveFocus, Pt as SceneHostLike, Q as RequestWebGpuOptions, R as SceneDigestOverlayStats, Rt as SpriteAnimEventListener, S as InputTimelinePlugin, St as Graphics, T as StageKernel, Tt as InstancedColumns, U as buildSceneDigest, Ut as TextStyleConfig, V as SceneDigestSurfaceSource, Vt as SyncAttachmentOptions, W as sanitizeTrackToken, Wt as TileSpriteObject, X as RendererWebGpu, Y as PointerSample, Z as RendererWebGpuOptions, _ as ActionMap, _t as DirectionalPlayOptions, a as GameLoop, at as RendererGlOptions, b as InputTargetSpec, bt as DisplayObjectType, c as LoaderPlugin, ct as StageRenderTarget, d as SceneCtor, dt as Bob$1, et as WebGpuCanvasContextLike, f as SceneInput, ft as Container, g as ViewportFitResult, gt as CustomPassOptions, h as StageRenderer, ht as CustomPassObject, i as GameConfig$1, it as RendererGl, j as createInputReplay, jt as PanelStyleConfig, k as TimelineKeyOptions, kt as PanelObject, l as ScaleManager, lt as AnchorPose2D, m as SceneManager, mt as CustomPassCallback, n as EngineClockSnapshot, nt as requestWebGpuDevice, o as GameObjectFactory, ot as RendererStats, p as SceneLifecycleStats, pt as ContainerFiltersShim, q as KeyboardPlugin, qt as HiDpiConfigureOptions, r as Game, rt as Renderer2D, s as JsonCache, st as Stage2DCustomImageHandler, t as EngineClock, tt as WebGpuDeviceLike, u as Scene, ut as BlitterObject, v as InputProvider, vt as DisplayList, w as StageInputEvent, wt as InstancedBatchObject, x as InputTimelineOptions, xt as DisplaySemantics, y as InputRecorderPlugin, yt as DisplayObject, z as SceneDigestSandbox, zt as SpriteObject } from "./game-CEa0m4eX.js";
|
|
2
|
+
import { A as FilterModeValue, B as WEBGL, C as AUTO, D as CANVAS, E as BlendModes, F as Scale, G as packColorAbgr, H as WHITE_RGB, I as ScaleMode, K as parseColor, L as Scenes, M as Matrix2D, N as Rect2D, O as EventEmitter, P as RgbaColor, R as TintMode, S as TextureSource, T as BlendMode, U as WorldView2D, V as WEBGPU, W as createMatrix2D, _ as SpriteSheetConfig, a as AtlasClipRule, b as TextureImageSource, c as GenerateFrameNamesConfig, d as AtlasJsonLike, f as CanvasTexture, g as GlTextureHost, h as FrameExtraMeta, i as AtlasAutoAnimOptions, j as HEX_MASK, k as FilterMode, l as GenerateFrameNumbersConfig, m as FrameAnchorTuple, n as AnimationFrameInput, o as CompiledAnimationFrame, p as Frame, q as rgbToCss, r as AnimationManager, s as DirectionalAnimGroup, t as AnimationConfig, u as StageAnimation, v as Texture, w as BLACK_RGB, x as TextureManager, y as TextureImageOptions, z as TintModes } from "./anims-ClNi6zZQ.js";
|
|
3
3
|
import { FlexAlign, FlexContainerSpec, FlexDir, FlexItemRect, FlexItemSpec, FlexJustify, FlexPadding, FlexResult, WrapContainerSpec, WrapItemRect, WrapItemSpec, WrapJustify, WrapResult, computeFlexLayout, computeWrapLayout, resolvePadding } from "./flex.js";
|
|
4
4
|
import { a as SpringHandle, c as TweenManager, i as Easings, l as TweenOptions, n as EasingFn, o as SpringOptions, r as EasingName, s as TweenHandle, t as DisposableOwner, u as TweenStats } from "./tween-BiF1FUvc.js";
|
|
5
5
|
import { JoystickDpad, JoystickDpadOptions, JoystickState, JoystickVector, JoystickViewport, JoystickZone, JoystickZonePredicate, JoystickZoneRect, VirtualJoystick, VirtualJoystickMode, VirtualJoystickOptions, VirtualJoystickStyle, clampJoystickOrigin, computeJoystickVector, isInJoystickZone, pullJoystickOrigin, quantizeJoystickDpad } from "./joystick.js";
|
|
@@ -331,4 +331,4 @@ export declare const Stage: {
|
|
|
331
331
|
};
|
|
332
332
|
};
|
|
333
333
|
};
|
|
334
|
-
export { AUTO, ActionMap, type AnimationConfig, type AnimationFrameInput, AnimationManager, type AtlasAutoAnimOptions, type AtlasClipRule, type AtlasJsonLike, BLACK_RGB, type BlendMode, BlendModes, BlitterObject, type Bob$1 as Bob, CANVAS, Camera, type CameraFollowOptions, CanvasTexture, type CompiledAnimationFrame, Container, type ContainerFiltersShim, type CustomPassCallback, CustomPassObject, type CustomPassOptions, type DirectionalAnimGroup, type DirectionalPlayOptions, DisplayList, DisplayObject, type DisplayObjectType, type DisplaySemantics, type DisposableOwner, type EasingFn, type EasingName, Easings, EngineClock, type EngineClockSnapshot, EventEmitter, FilterMode, type FilterModeValue, type FlexAlign, type FlexContainerSpec, type FlexDir, type FlexItemRect, type FlexItemSpec, type FlexJustify, type FlexPadding, type FlexResult, Frame, type FrameExtraMeta, Game, type GameConfig$1 as GameConfig, GameLoop, GameObjectFactory, type GenerateFrameNamesConfig, type GenerateFrameNumbersConfig, type GlTextureHost, Graphics, HEX_MASK, type HiDpiConfigureOptions, type HiDpiScaleLike, ImageObject, type InputConfig, InputPlugin, type InputProvider, type InputRecorderPlugin, type InputTargetSpec, type InputTimelineOptions, type InputTimelinePlugin, InstancedBatchObject, type InstancedColumns, type JoystickDpad, type JoystickDpadOptions, type JoystickState, type JoystickVector, type JoystickViewport, type JoystickZone, type JoystickZonePredicate, type JoystickZoneRect, JsonCache, KeyboardPlugin, LoaderPlugin, type Matrix2D, type MsdfIconConfig, MsdfIconObject, NineSliceObject, PanelObject, type PanelOpenSide, type PanelStyleConfig, Pointer, type PointerSample, type RecordedInputEntry, type Rect2D, type RectClipMask, RectangleObject, Renderer2D, RendererGl, type RendererGlOptions, type RendererStats, RendererWebGpu, type RendererWebGpuOptions, type RequestWebGpuOptions, type RgbaColor, SURFACE_BAND, Scale, ScaleManager, type ScaleMode, Scene, type SceneCtor, type SceneDigest, type SceneDigestActiveFocus, type SceneDigestEngineSandbox, type SceneDigestNode, type SceneDigestOptions, type SceneDigestOverlayStats, type SceneDigestSandbox, type SceneDigestSurfaceEntry, type SceneDigestSurfaceSource, type SceneDigestSurfaces, type SceneHostLike, type SceneInput, type SceneLifecycleStats, SceneManager, Scenes, type ShapeBatchColumns, ShapeBatchObject, type ShapeBatchStyleDefaults, type SpringHandle, type SpringOptions, type SpriteAnimEventListener, SpriteObject, type SpritePlayOptions, type SpriteSheetConfig, Stage as default, type Stage2DCustomImageHandler, type StageAnimation, type StageInputEvent, StageKernel, type StagePlugin, type StageRenderTarget, type StageRenderer, type SurfaceBand, type SurfaceBandName, type SurfaceBarrier, type SurfaceCancelContext, type SurfaceCancelDispatchResult, type SurfaceCancelResult, type SurfaceDomEntry, type SurfaceFocusContext, type SurfaceFocusDispatchResult, type SurfaceFocusResult, type SurfaceKeyContext, type SurfaceKeyDispatchResult, type SurfaceKeyResult, type SurfaceNodeInfo, type SurfaceNodeInput, type SurfaceScope, type SurfaceTree, TextObject, type TextStyleConfig, Texture, type TextureImageOptions, type TextureImageSource, TextureManager, TextureSource, TileSpriteObject, type TimelineClickOptions, type TimelineDragOptions, type TimelineKeyOptions, type TintMode, TintModes, type TweenHandle, TweenManager, type TweenOptions, type TweenStats, type ViewportFitResult, VirtualJoystick, type VirtualJoystickMode, type VirtualJoystickOptions, type VirtualJoystickStyle, WEBGL, WEBGPU, WHITE_RGB, type WebGpuBootstrapResult, type WebGpuCanvasContextLike, type WebGpuDeviceLike, type WorldView2D, type WrapContainerSpec, type WrapItemRect, type WrapItemSpec, type WrapJustify, type WrapResult, buildSceneDigest, clampJoystickOrigin, computeFlexLayout, computeJoystickVector, computeSurfaceDomZ, computeWrapLayout, createInputRecorder, createInputReplay, createInputTimeline, createMatrix2D, createSurfaceTree, isInJoystickZone, packColorAbgr, parseColor, pullJoystickOrigin, quantizeJoystickDpad, requestWebGpuDevice, resolvePadding, resolveSurfacePriority, rgbToCss, sanitizeTrackToken, surfacePriorityToDomZ };
|
|
334
|
+
export { AUTO, ActionMap, type AnchorPose2D, type AnimationConfig, type AnimationFrameInput, AnimationManager, type AtlasAutoAnimOptions, type AtlasClipRule, type AtlasJsonLike, BLACK_RGB, type BlendMode, BlendModes, BlitterObject, type Bob$1 as Bob, CANVAS, Camera, type CameraFollowOptions, CanvasTexture, type CompiledAnimationFrame, Container, type ContainerFiltersShim, type CustomPassCallback, CustomPassObject, type CustomPassOptions, type DirectionalAnimGroup, type DirectionalPlayOptions, DisplayList, DisplayObject, type DisplayObjectType, type DisplaySemantics, type DisposableOwner, type EasingFn, type EasingName, Easings, EngineClock, type EngineClockSnapshot, EventEmitter, FilterMode, type FilterModeValue, type FlexAlign, type FlexContainerSpec, type FlexDir, type FlexItemRect, type FlexItemSpec, type FlexJustify, type FlexPadding, type FlexResult, Frame, type FrameAnchorTuple, type FrameExtraMeta, Game, type GameConfig$1 as GameConfig, GameLoop, GameObjectFactory, type GenerateFrameNamesConfig, type GenerateFrameNumbersConfig, type GlTextureHost, Graphics, HEX_MASK, type HiDpiConfigureOptions, type HiDpiScaleLike, ImageObject, type InputConfig, InputPlugin, type InputProvider, type InputRecorderPlugin, type InputTargetSpec, type InputTimelineOptions, type InputTimelinePlugin, InstancedBatchObject, type InstancedColumns, type JoystickDpad, type JoystickDpadOptions, type JoystickState, type JoystickVector, type JoystickViewport, type JoystickZone, type JoystickZonePredicate, type JoystickZoneRect, JsonCache, KeyboardPlugin, LoaderPlugin, type Matrix2D, type MsdfIconConfig, MsdfIconObject, NineSliceObject, PanelObject, type PanelOpenSide, type PanelStyleConfig, Pointer, type PointerSample, type RecordedInputEntry, type Rect2D, type RectClipMask, RectangleObject, Renderer2D, RendererGl, type RendererGlOptions, type RendererStats, RendererWebGpu, type RendererWebGpuOptions, type RequestWebGpuOptions, type RgbaColor, SURFACE_BAND, Scale, ScaleManager, type ScaleMode, Scene, type SceneCtor, type SceneDigest, type SceneDigestActiveFocus, type SceneDigestEngineSandbox, type SceneDigestNode, type SceneDigestOptions, type SceneDigestOverlayStats, type SceneDigestSandbox, type SceneDigestSurfaceEntry, type SceneDigestSurfaceSource, type SceneDigestSurfaces, type SceneHostLike, type SceneInput, type SceneLifecycleStats, SceneManager, Scenes, type ShapeBatchColumns, ShapeBatchObject, type ShapeBatchStyleDefaults, type SpringHandle, type SpringOptions, type SpriteAnimEventListener, SpriteObject, type SpritePlayOptions, type SpriteSheetConfig, Stage as default, type Stage2DCustomImageHandler, type StageAnimation, type StageInputEvent, StageKernel, type StagePlugin, type StageRenderTarget, type StageRenderer, type SurfaceBand, type SurfaceBandName, type SurfaceBarrier, type SurfaceCancelContext, type SurfaceCancelDispatchResult, type SurfaceCancelResult, type SurfaceDomEntry, type SurfaceFocusContext, type SurfaceFocusDispatchResult, type SurfaceFocusResult, type SurfaceKeyContext, type SurfaceKeyDispatchResult, type SurfaceKeyResult, type SurfaceNodeInfo, type SurfaceNodeInput, type SurfaceScope, type SurfaceTree, type SyncAttachmentOptions, TextObject, type TextStyleConfig, Texture, type TextureImageOptions, type TextureImageSource, TextureManager, TextureSource, TileSpriteObject, type TimelineClickOptions, type TimelineDragOptions, type TimelineKeyOptions, type TintMode, TintModes, type TweenHandle, TweenManager, type TweenOptions, type TweenStats, type ViewportFitResult, VirtualJoystick, type VirtualJoystickMode, type VirtualJoystickOptions, type VirtualJoystickStyle, WEBGL, WEBGPU, WHITE_RGB, type WebGpuBootstrapResult, type WebGpuCanvasContextLike, type WebGpuDeviceLike, type WorldView2D, type WrapContainerSpec, type WrapItemRect, type WrapItemSpec, type WrapJustify, type WrapResult, buildSceneDigest, clampJoystickOrigin, computeFlexLayout, computeJoystickVector, computeSurfaceDomZ, computeWrapLayout, createInputRecorder, createInputReplay, createInputTimeline, createMatrix2D, createSurfaceTree, isInJoystickZone, packColorAbgr, parseColor, pullJoystickOrigin, quantizeJoystickDpad, requestWebGpuDevice, resolvePadding, resolveSurfacePriority, rgbToCss, sanitizeTrackToken, surfacePriorityToDomZ };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as rgbToCss, a as EventEmitter, c as Scale, d as WEBGL, f as WEBGPU, g as parseColor, h as packColorAbgr, i as CANVAS, l as Scenes, m as createMatrix2D, n as BLACK_RGB, o as FilterMode, p as WHITE_RGB, r as BlendModes, s as HEX_MASK, t as AUTO, u as TintModes } from "./types-CXsCvp1p.js";
|
|
2
|
-
import { _ as CanvasTexture, a as JsonCache, b as TextureManager, c as Scene, d as KeyboardPlugin, f as Pointer, g as SdfPanelBatcher, h as MsdfIconBatcher, i as GameObjectFactory, l as SceneManager, m as PixelAaBatcher, n as Game, o as LoaderPlugin, p as RendererGl, r as GameLoop, s as ScaleManager, t as EngineClock, u as InputPlugin, v as Frame, x as TextureSource, y as Texture } from "./game-
|
|
2
|
+
import { _ as CanvasTexture, a as JsonCache, b as TextureManager, c as Scene, d as KeyboardPlugin, f as Pointer, g as SdfPanelBatcher, h as MsdfIconBatcher, i as GameObjectFactory, l as SceneManager, m as PixelAaBatcher, n as Game, o as LoaderPlugin, p as RendererGl, r as GameLoop, s as ScaleManager, t as EngineClock, u as InputPlugin, v as Frame, x as TextureSource, y as Texture } from "./game-D46nY-B2.js";
|
|
3
3
|
import { AnimationManager } from "./anims.js";
|
|
4
|
-
import { _ as SpriteObject, a as Container, b as Camera, c as DisplayObject, d as InstancedBatchObject, f as MsdfIconObject, g as ShapeBatchObject, h as RectangleObject, i as BlitterObject, l as Graphics, m as PanelObject, n as requestWebGpuDevice, o as CustomPassObject, p as NineSliceObject, r as Renderer2D, s as DisplayList, t as RendererWebGpu, u as ImageObject, v as TextObject, y as TileSpriteObject } from "./renderer-webgpu-
|
|
4
|
+
import { _ as SpriteObject, a as Container, b as Camera, c as DisplayObject, d as InstancedBatchObject, f as MsdfIconObject, g as ShapeBatchObject, h as RectangleObject, i as BlitterObject, l as Graphics, m as PanelObject, n as requestWebGpuDevice, o as CustomPassObject, p as NineSliceObject, r as Renderer2D, s as DisplayList, t as RendererWebGpu, u as ImageObject, v as TextObject, y as TileSpriteObject } from "./renderer-webgpu-BXU-ZDIp.js";
|
|
5
5
|
import { ActionMap, StageKernel, createInputRecorder, createInputReplay, createInputTimeline } from "./kernel.js";
|
|
6
6
|
import { buildSceneDigest, sanitizeTrackToken } from "./trace.js";
|
|
7
7
|
import { computeFlexLayout, computeWrapLayout, resolvePadding } from "./flex.js";
|
package/dist/joystick.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as Pointer,
|
|
1
|
+
import { J as Pointer, ft as Container, kt as PanelObject, u as Scene } from "./game-CEa0m4eX.js";
|
|
2
2
|
export type VirtualJoystickMode = 'floating' | 'fixed';
|
|
3
3
|
export interface JoystickVector {
|
|
4
4
|
/** Normalized X axis in [-1, 1] after deadzone remapping. */
|
package/dist/kernel.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as createInputRecorder, C as RecordedInputEntry, D as TimelineClickOptions, E as StagePlugin, M as createInputTimeline, O as TimelineDragOptions, S as InputTimelinePlugin, T as StageKernel, _ as ActionMap, b as InputTargetSpec, j as createInputReplay, k as TimelineKeyOptions, v as InputProvider, w as StageInputEvent, x as InputTimelineOptions, y as InputRecorderPlugin } from "./game-
|
|
1
|
+
import { A as createInputRecorder, C as RecordedInputEntry, D as TimelineClickOptions, E as StagePlugin, M as createInputTimeline, O as TimelineDragOptions, S as InputTimelinePlugin, T as StageKernel, _ as ActionMap, b as InputTargetSpec, j as createInputReplay, k as TimelineKeyOptions, v as InputProvider, w as StageInputEvent, x as InputTimelineOptions, y as InputRecorderPlugin } from "./game-CEa0m4eX.js";
|
|
2
2
|
export { ActionMap, InputProvider, InputRecorderPlugin, InputTargetSpec, InputTimelineOptions, InputTimelinePlugin, RecordedInputEntry, StageInputEvent, StageKernel, StagePlugin, TimelineClickOptions, TimelineDragOptions, TimelineKeyOptions, createInputRecorder, createInputReplay, createInputTimeline };
|
package/dist/lighting.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ct as ImageObject, Pt as SceneHostLike, ht as CustomPassObject } from "./game-CEa0m4eX.js";
|
|
2
2
|
export type DayPhase = 'day' | 'dusk' | 'night';
|
|
3
3
|
export interface DayNightConfig {
|
|
4
4
|
dayLengthMs?: number;
|
package/dist/projection.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Pt as SceneHostLike, ft as Container, yt as DisplayObject } from "./game-CEa0m4eX.js";
|
|
2
2
|
export interface Camera25DConfig {
|
|
3
3
|
viewportWidth: number;
|
|
4
4
|
viewportHeight: number;
|
|
@@ -349,7 +349,7 @@ var DisplayObject = class extends EventEmitter {
|
|
|
349
349
|
rotation = 0;
|
|
350
350
|
alpha = 1;
|
|
351
351
|
depth = 0;
|
|
352
|
-
|
|
352
|
+
_zIndex = 0;
|
|
353
353
|
trackId = null;
|
|
354
354
|
alt = null;
|
|
355
355
|
role = null;
|
|
@@ -441,10 +441,19 @@ var DisplayObject = class extends EventEmitter {
|
|
|
441
441
|
}
|
|
442
442
|
return this;
|
|
443
443
|
}
|
|
444
|
+
get zIndex() {
|
|
445
|
+
return this._zIndex;
|
|
446
|
+
}
|
|
447
|
+
set zIndex(z) {
|
|
448
|
+
if (this._zIndex !== z) {
|
|
449
|
+
this._zIndex = z;
|
|
450
|
+
if (this.parentContainer) this.parentContainer._markZDirty(z !== 0);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
444
453
|
/** Native container-local stacking order (0 by default; sorted stably when any sibling has non-zero zIndex). */
|
|
445
454
|
setZIndex(z) {
|
|
446
|
-
if (this.
|
|
447
|
-
this.
|
|
455
|
+
if (this._zIndex !== z) {
|
|
456
|
+
this._zIndex = z;
|
|
448
457
|
if (this.parentContainer) this.parentContainer._markZDirty(z !== 0);
|
|
449
458
|
else this.setDepth(z);
|
|
450
459
|
}
|
|
@@ -742,6 +751,91 @@ var ImageObject = class extends DisplayObject {
|
|
|
742
751
|
out.y = py;
|
|
743
752
|
return out;
|
|
744
753
|
}
|
|
754
|
+
/**
|
|
755
|
+
* Read the full transformed 2D pose (`x`, `y`, `rotation`, `zBias`, `hasAngle`) of an oriented socket
|
|
756
|
+
* (`[x, y, angleRad, zBias]` from `@holtjs/craft/three` `charKit.handSocket`), transforming the 2D grip
|
|
757
|
+
* tangent vector through the exact `flip -> scale -> rotate -> parentContainer` Jacobian!
|
|
758
|
+
*/
|
|
759
|
+
getAnchorPose(name, space = "parent", out = {
|
|
760
|
+
x: 0,
|
|
761
|
+
y: 0,
|
|
762
|
+
rotation: 0,
|
|
763
|
+
zBias: 1,
|
|
764
|
+
hasAngle: false
|
|
765
|
+
}) {
|
|
766
|
+
const raw = this.frame?.getAnchor(name);
|
|
767
|
+
if (!raw) return null;
|
|
768
|
+
this.getAnchor(name, space, out);
|
|
769
|
+
const hasAngle = raw.length >= 3 && typeof raw[2] === "number" && Number.isFinite(raw[2]);
|
|
770
|
+
const rawAngle = hasAngle ? raw[2] : 0;
|
|
771
|
+
const zBias = raw.length >= 4 && typeof raw[3] === "number" ? raw[3] >= 0 ? 1 : -1 : 1;
|
|
772
|
+
let dx = Math.cos(rawAngle);
|
|
773
|
+
let dy = Math.sin(rawAngle);
|
|
774
|
+
if (this.flipX) dx = -dx;
|
|
775
|
+
if (this.flipY) dy = -dy;
|
|
776
|
+
if (space !== "local") {
|
|
777
|
+
dx *= this.scaleX;
|
|
778
|
+
dy *= this.scaleY;
|
|
779
|
+
if (this.rotation !== 0) {
|
|
780
|
+
const c = Math.cos(this.rotation);
|
|
781
|
+
const s = Math.sin(this.rotation);
|
|
782
|
+
const rx = dx * c - dy * s;
|
|
783
|
+
const ry = dx * s + dy * c;
|
|
784
|
+
dx = rx;
|
|
785
|
+
dy = ry;
|
|
786
|
+
}
|
|
787
|
+
if (space === "world") {
|
|
788
|
+
let cur = this.parentContainer;
|
|
789
|
+
while (cur) {
|
|
790
|
+
dx *= cur.scaleX;
|
|
791
|
+
dy *= cur.scaleY;
|
|
792
|
+
if (cur.rotation !== 0) {
|
|
793
|
+
const cc = Math.cos(cur.rotation);
|
|
794
|
+
const cs = Math.sin(cur.rotation);
|
|
795
|
+
const rx = dx * cc - dy * cs;
|
|
796
|
+
const ry = dx * cs + dy * cc;
|
|
797
|
+
dx = rx;
|
|
798
|
+
dy = ry;
|
|
799
|
+
}
|
|
800
|
+
cur = cur.parentContainer;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
out.rotation = Math.atan2(dy, dx);
|
|
805
|
+
out.zBias = zBias;
|
|
806
|
+
out.hasAngle = hasAngle;
|
|
807
|
+
return out;
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Align an equipped weapon/tool `DisplayObject` (`axe`, `spear`, `torch`, `shield`) to a named socket (`'hand'`) in one call:
|
|
811
|
+
* - Sets `child.x` & `child.y` to the transformed socket position
|
|
812
|
+
* - Rotates `child.rotation` so `restAngle` (default `-Math.PI / 2` = upright sprite) aligns with the socket's projected 2D shaft angle
|
|
813
|
+
* - Mirrors asymmetric blades (`mirrorBlade: true`) across the shaft axis via `O(2)` reflection when aiming left (`cos < 0`) so single-bladed axes never strike backwards!
|
|
814
|
+
* - Applies `zBias` (`+1` in front of body, `-1` behind body) via `child.setZIndex(baseZIndex + zBias)`
|
|
815
|
+
*/
|
|
816
|
+
syncAttachment(child, anchorName, opts = {}) {
|
|
817
|
+
const space = opts.space ?? "parent";
|
|
818
|
+
const pose = this.getAnchorPose(anchorName, space);
|
|
819
|
+
if (!pose) return false;
|
|
820
|
+
child.x = pose.x;
|
|
821
|
+
child.y = pose.y;
|
|
822
|
+
if (pose.hasAngle || opts.restAngle !== void 0 || opts.angleOffset !== void 0) {
|
|
823
|
+
const rest = opts.restAngle ?? -Math.PI * .5;
|
|
824
|
+
const mirror = opts.mirrorBlade !== false;
|
|
825
|
+
const aimLeft = Math.cos(pose.rotation) < -1e-4;
|
|
826
|
+
if (mirror) {
|
|
827
|
+
if (Math.abs(Math.sin(rest)) >= Math.abs(Math.cos(rest))) child.flipX = aimLeft;
|
|
828
|
+
else child.flipY = aimLeft;
|
|
829
|
+
}
|
|
830
|
+
const offset = opts.angleOffset ?? 0;
|
|
831
|
+
child.rotation = pose.rotation - rest + (mirror && aimLeft ? -offset : offset);
|
|
832
|
+
}
|
|
833
|
+
if (opts.baseZIndex !== false) {
|
|
834
|
+
const baseZ = opts.baseZIndex ?? this.zIndex;
|
|
835
|
+
child.setZIndex(baseZ + pose.zBias);
|
|
836
|
+
}
|
|
837
|
+
return true;
|
|
838
|
+
}
|
|
745
839
|
setTint(color) {
|
|
746
840
|
this.tint = color & HEX_MASK;
|
|
747
841
|
this.isTinted = true;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as WebGpuBootstrapResult, Q as RequestWebGpuOptions, X as RendererWebGpu, Z as RendererWebGpuOptions, et as WebGpuCanvasContextLike, nt as requestWebGpuDevice, tt as WebGpuDeviceLike } from "./game-
|
|
1
|
+
import { $ as WebGpuBootstrapResult, Q as RequestWebGpuOptions, X as RendererWebGpu, Z as RendererWebGpuOptions, et as WebGpuCanvasContextLike, nt as requestWebGpuDevice, tt as WebGpuDeviceLike } from "./game-CEa0m4eX.js";
|
|
2
2
|
export { RendererWebGpu, RendererWebGpuOptions, RequestWebGpuOptions, WebGpuBootstrapResult, WebGpuCanvasContextLike, WebGpuDeviceLike, requestWebGpuDevice };
|
package/dist/renderer-webgpu.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as RendererWebGpu, n as requestWebGpuDevice } from "./renderer-webgpu-
|
|
1
|
+
export { t as RendererWebGpu, n as requestWebGpuDevice } from "./renderer-webgpu-BXU-ZDIp.js";
|
package/dist/rig2d.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { T as BlendMode } from "./anims-ClNi6zZQ.js";
|
|
2
|
+
import { Ct as ImageObject, Pt as SceneHostLike, St as Graphics, ft as Container } from "./game-CEa0m4eX.js";
|
|
3
3
|
export type RigCurveKind = 'linear' | 'step' | 'smoothstep' | 'outBack';
|
|
4
4
|
export interface RigBoneDef {
|
|
5
5
|
name: string;
|
package/dist/tilemap.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Pt as SceneHostLike, ft as Container, ut as BlitterObject } from "./game-CEa0m4eX.js";
|
|
2
2
|
/** Pack signed 16-bit chunk coordinates `[-32768..32767]` into a single 32-bit integer Map key (zero string allocation). */
|
|
3
3
|
export declare function packChunkKey(cx: number, cy: number): number;
|
|
4
4
|
export declare function unpackChunkX(key: number): number;
|
package/dist/trace.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { B as SceneDigestSurfaceEntry, F as SceneDigestEngineSandbox, H as SceneDigestSurfaces, I as SceneDigestNode, L as SceneDigestOptions, N as SceneDigest, P as SceneDigestActiveFocus, R as SceneDigestOverlayStats, U as buildSceneDigest, V as SceneDigestSurfaceSource, W as sanitizeTrackToken, z as SceneDigestSandbox } from "./game-
|
|
1
|
+
import { B as SceneDigestSurfaceEntry, F as SceneDigestEngineSandbox, H as SceneDigestSurfaces, I as SceneDigestNode, L as SceneDigestOptions, N as SceneDigest, P as SceneDigestActiveFocus, R as SceneDigestOverlayStats, U as buildSceneDigest, V as SceneDigestSurfaceSource, W as sanitizeTrackToken, z as SceneDigestSandbox } from "./game-CEa0m4eX.js";
|
|
2
2
|
export { SceneDigest, SceneDigestActiveFocus, SceneDigestEngineSandbox, SceneDigestNode, SceneDigestOptions, SceneDigestOverlayStats, SceneDigestSandbox, SceneDigestSurfaceEntry, SceneDigestSurfaceSource, SceneDigestSurfaces, buildSceneDigest, sanitizeTrackToken };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holtjs/stage",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Zero-dependency TypeScript stage engine for 2D WebGPU/WebGL2/Canvas2D games, GPU SDF UI, procedural audio, StageKernel plugins, tracing-native observability, and deterministic 60 FPS headless image & video rendering.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Botiverse, Inc.",
|
package/skills/stage/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: Build zero-dependency WebGPU/WebGL2/Canvas2D 2D & 2.5D games, GPU S
|
|
|
5
5
|
|
|
6
6
|
# Building 2D/2.5D Games, WebGPU UI & 60 FPS Video with `@holtjs/stage`
|
|
7
7
|
|
|
8
|
-
Use this skill whenever creating or modifying a browser 2D/2.5D game, WebGPU/WebGL2 canvas UI, survival sandbox, automated `InputTimeline` test, or pure-Node headless image/storyboard/60 FPS video pipeline built on `@holtjs/stage` (`v0.
|
|
8
|
+
Use this skill whenever creating or modifying a browser 2D/2.5D game, WebGPU/WebGL2 canvas UI, survival sandbox, automated `InputTimeline` test, or pure-Node headless image/storyboard/60 FPS video pipeline built on `@holtjs/stage` (`v0.8.0`, 21 subpaths).
|
|
9
9
|
|
|
10
10
|
For the exhaustive exported symbol list across all 21 subpaths, see [references/subpaths.md](references/subpaths.md).
|
|
11
11
|
|
|
@@ -164,7 +164,8 @@ survivor.trackId = 'actor.survivor';
|
|
|
164
164
|
survivor.onAnimEvent((ev) => { if (ev === 'footstep') playStepSfx(); });
|
|
165
165
|
stage25.registerBillboard(survivor, 0, 0);
|
|
166
166
|
// Inside update(): survivor.playDirectional('survivor/walk', Math.atan2(vy, vx), { cameraYaw: cam25.yaw });
|
|
167
|
-
// Attach held weapon
|
|
167
|
+
// Attach held weapon with exact 3D->2D projected shaft angle, O(2) blade mirroring & front/back zIndex occlusion:
|
|
168
|
+
// survivor.syncAttachment(axeSprite, 'hand', { restAngle: -Math.PI / 2, mirrorBlade: true });
|
|
168
169
|
|
|
169
170
|
// 3B. Or 2D Cutout Skeletal Rig: O(1) equipment swap + 2-layer bone-masked overlay animation
|
|
170
171
|
const rig = new Rig2DInstance(heroSkeleton);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# `@holtjs/stage` Subpath API Quick Reference
|
|
2
2
|
|
|
3
|
-
All symbols verified against `src/*.ts` (`@holtjs/stage@0.
|
|
3
|
+
All symbols verified against `src/*.ts` (`@holtjs/stage@0.8.0`, 21 subpaths).
|
|
4
4
|
|
|
5
5
|
## `@holtjs/stage` (~68.0 kB gz · Core Engine Barrel)
|
|
6
6
|
- **Bootstrap & Lifecycle**: `Stage` / `Stage2D` (namespaces), `AUTO`, `WEBGPU`, `WEBGL`, `CANVAS`, `Scale` (`NONE`, `FIT`, `RESIZE`), `Scenes`, `Game` (`.stepSimOnly()`, `.kernel`, `.anims`), `Scene` (`.update()` simulation + `.preRender()` presentation, `.anims`), `SceneManager`, `ScaleManager` (`.fitToContainer()`), `GameLoop`, `EngineClock`, `LoaderPlugin` (`.atlas()`), `JsonCache`, `GameObjectFactory` (`scene.add.sprite`, `shapeBatch`, `instancedBatch`, `customPass`, `panel`, `blitter`, etc.), `AnimationManager` (`.create()`, `.createFromAtlas()`, `.generateFrameNames()`, `.generateFrameNumbers()`)
|
|
7
|
-
- **Display Graph**: `DisplayList`, `DisplayObject
|
|
7
|
+
- **Display Graph**: `DisplayList`, `DisplayObject` (reactive `.zIndex`), `Container`, `ImageObject` (`.useFramePivot()`, `.getAnchor(name, space?)`, `.getAnchorPose(name, space?)`, `.syncAttachment(child, name, opts?)`), `SpriteObject` (`.play()`, `.playDirectional()`, `.onAnimEvent()`, `.pause()`, `.resume()`, `.stop()`), `NineSliceObject`, `TileSpriteObject`, `RectangleObject`, `PanelObject`, `MsdfIconObject`, `TextObject`, `Graphics` (GPU SDF fast-path + Canvas2D `Path2D` cache), `BlitterObject`, `InstancedBatchObject`, `ShapeBatchObject` (zero-texture SoA analytical SDF shapes), `CustomPassObject` (`restoreState: true` default)
|
|
8
8
|
- **Renderers & GPU Batchers**: `RendererWebGpu`, `requestWebGpuDevice`, `RendererGl` (`.createRenderTarget()`, `.renderToTarget(rt, content, cam?)`, `.restoreState()`), `StageRenderTarget` (`.camera`, `.readPixels()`), `Renderer2D` (4-corner frustum culling + sprite tint LRU cache), `SdfPanelBatcher`, `MsdfIconBatcher`, `PixelAaBatcher`, `Camera` (`.configureHiDpi()`, `.setBounds()`, `.clearBounds()`, `.startFollow()`, `.stopFollow()`, `.screenToWorld()`, `.worldToScreen()`, `.logicalToWorld()`, `.worldToLogical()`, `.clientToWorld()`), `Texture` (`.atlasYaw`), `CanvasTexture`, `TextureSource`, `Frame` (`.setPivot()`, `.setPixelPivot()`, `.setAnchor()`, `.getAnchor()`), `TextureManager` (`.exists()`, `.addAtlas()`, `.addCanvas()`, `.get()`)
|
|
9
9
|
- **Kernel & Input**: `StageKernel`, `ActionMap`, `createInputTimeline`, `createInputRecorder`, `createInputReplay`, `EventEmitter`, `Pointer`, `KeyboardPlugin` (`.isDown()`, `.justPressed()`, `.justReleased()`, `.injectKey()`), `InputPlugin`
|
|
10
10
|
- **Math & Color**: `BlendModes` (`NORMAL`, `ADD`, `MULTIPLY`, `SCREEN`), `TintModes`, `FilterMode`, `WHITE_RGB`, `BLACK_RGB`, `HEX_MASK`, `createMatrix2D`, `parseColor`, `rgbToCss`, `packColorAbgr`
|