@holtjs/stage 0.12.0 → 0.13.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 +9 -0
- package/dist/{anims-BYBzSNXO.d.ts → anims-n8aqhzxu.d.ts} +26 -5
- package/dist/anims.d.ts +1 -1
- package/dist/{display-CuyQc8oE.js → display-CVjvA8ZO.js} +12 -1
- package/dist/{game-CT_WCPjJ.d.ts → game-C8bz7tay.d.ts} +3 -1
- package/dist/{game-DZoRjZNH.js → game-CziLa7dv.js} +110 -46
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/joystick.d.ts +1 -1
- package/dist/kernel.d.ts +1 -1
- package/dist/lighting.d.ts +1 -1
- package/dist/lighting.js +5 -2
- package/dist/projection.d.ts +1 -1
- package/dist/{renderer-webgpu-B8vktrUk.js → renderer-webgpu-LDnrpYa0.js} +10 -7
- 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/dist/world.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,15 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.13.0] - 2026-12-05
|
|
10
|
+
|
|
11
|
+
### Added & Fixed
|
|
12
|
+
- **Transparent Multi-Page Texture Atlases Across WebGPU, WebGL2 & Canvas2D (`TextureManager.addAtlas`, `Texture.addSource`, `Texture.pageCount`)**:
|
|
13
|
+
- `Texture` constructor, `TextureManager.addImage`, and `TextureManager.addAtlas` now accept `TextureImageSource | readonly TextureImageSource[]`, allowing a single logical atlas key (`'nightfall'`, `'world'`) to span any number of `<= 4096x4096` GPU texture pages with zero game-code changes (`SpriteObject`, `ImageObject`, `TileSpriteObject`, `DrawStreamObject`, `AnimationManager.createFromAtlas`, `bindEquipment`).
|
|
14
|
+
- Supports per-frame `page` / `sourceIndex` metadata in flat `@holtjs/craft` & Aseprite atlases, TexturePacker / Phaser 3 multi-atlas `textures: [{ frames }, ...]` manifests, `@holtjs/craft` `pages: [...]` manifests, and dynamic runtime page streaming via `texture.addSource(image)`.
|
|
15
|
+
- Fixed empty-placeholder probing in `addAtlas` (`detectEmptyRect`) to inspect `tex.source[pageIdx].image` rather than `source[0]`.
|
|
16
|
+
- Upgraded `InstancedBatchObject` in both `RendererWebGpu` and `RendererWebGL` (WebGL2 `drawElementsInstanced` order-preserving sub-run flushing + WebGL1 fallback), `TileSpriteObject.setTexture`/`setFrame` repeat flags, and `Lighting2DSystem` normal-map page binding (`${key}_normal`) to switch `TextureSource` pages per frame automatically.
|
|
17
|
+
|
|
9
18
|
## [0.12.0] - 2026-12-04
|
|
10
19
|
|
|
11
20
|
### Added & Fixed
|
|
@@ -138,17 +138,31 @@ interface FrameExtraMeta {
|
|
|
138
138
|
loop?: boolean;
|
|
139
139
|
/** True when this frame is an all-transparent occlusion placeholder (`1x1` cell, `2x2` transparent placeholder, or explicit `empty: true`). */
|
|
140
140
|
empty?: boolean;
|
|
141
|
+
/** Optional 0-based texture page index (`sourceIndex`) for multi-page atlases (`@holtjs/stage@>=0.13.0`). */
|
|
142
|
+
page?: number;
|
|
143
|
+
sourceIndex?: number;
|
|
144
|
+
}
|
|
145
|
+
interface AtlasTexturePageLike {
|
|
146
|
+
readonly image?: string;
|
|
147
|
+
readonly scale?: number;
|
|
148
|
+
readonly frames?: Record<string, any> | ReadonlyArray<any>;
|
|
141
149
|
}
|
|
142
150
|
interface AtlasJsonLike {
|
|
143
151
|
readonly yaw?: number;
|
|
144
152
|
readonly pitch?: number;
|
|
145
153
|
readonly scale?: number;
|
|
146
154
|
readonly frames?: Record<string, any> | ReadonlyArray<any>;
|
|
155
|
+
/** TexturePacker / Phaser multi-atlas page list (`textures[p]` maps to `source[p]`). */
|
|
156
|
+
readonly textures?: ReadonlyArray<AtlasTexturePageLike>;
|
|
157
|
+
/** `@holtjs/craft` multi-page atlas metadata (`pages[p]` maps to `source[p]`). */
|
|
158
|
+
readonly pages?: ReadonlyArray<AtlasTexturePageLike>;
|
|
147
159
|
readonly json?: {
|
|
148
160
|
readonly yaw?: number;
|
|
149
161
|
readonly pitch?: number;
|
|
150
162
|
readonly scale?: number;
|
|
151
163
|
readonly frames?: Record<string, any> | ReadonlyArray<any>;
|
|
164
|
+
readonly textures?: ReadonlyArray<AtlasTexturePageLike>;
|
|
165
|
+
readonly pages?: ReadonlyArray<AtlasTexturePageLike>;
|
|
152
166
|
};
|
|
153
167
|
}
|
|
154
168
|
interface TextureImageOptions {
|
|
@@ -249,7 +263,13 @@ declare class Texture {
|
|
|
249
263
|
atlasYaw: number | null;
|
|
250
264
|
atlasPitch: number | null;
|
|
251
265
|
atlasScale: number | null;
|
|
252
|
-
|
|
266
|
+
private readonly hostRef;
|
|
267
|
+
private readonly defaultPremultiply;
|
|
268
|
+
constructor(manager: TextureManager, key: string, image: TextureImageSource | readonly TextureImageSource[], filterMode: FilterModeValue, host: GlTextureHost | null, premultiplyAlpha?: boolean, isRenderTarget?: boolean);
|
|
269
|
+
/** Number of backing `TextureSource` pages attached to this logical texture (`1` for single-page atlases). */
|
|
270
|
+
get pageCount(): number;
|
|
271
|
+
/** Append an additional `TextureSource` page dynamically (returns the new `TextureSource` at `source.length - 1`). */
|
|
272
|
+
addSource(image: TextureImageSource, filterMode?: FilterModeValue, premultiplyAlpha?: boolean): TextureSource;
|
|
253
273
|
add(name: string | number, sourceIndex: number, x: number, y: number, width: number, height: number, meta?: FrameExtraMeta): Frame;
|
|
254
274
|
/**
|
|
255
275
|
* Resolve a stable negative integer frame handle (`-1 - frame.index`) usable directly in
|
|
@@ -280,15 +300,16 @@ declare class TextureManager {
|
|
|
280
300
|
private initBuiltins;
|
|
281
301
|
exists(key: string): boolean;
|
|
282
302
|
get(key: string): Texture;
|
|
283
|
-
addImage(key: string, source: TextureImageSource, options?: TextureImageOptions): Texture | null;
|
|
303
|
+
addImage(key: string, source: TextureImageSource | readonly TextureImageSource[], options?: TextureImageOptions): Texture | null;
|
|
284
304
|
addCanvas(key: string, canvas: HTMLCanvasElement): CanvasTexture | null;
|
|
285
305
|
createCanvas(key: string, width: number, height: number): CanvasTexture | null;
|
|
286
306
|
addSpriteSheet(key: string, source: TextureImageSource, config: SpriteSheetConfig): Texture | null;
|
|
287
307
|
/**
|
|
288
|
-
* Register a
|
|
289
|
-
* preserving per-frame trimmed pivots (`ax/ay` or `pivot`), named sockets (`anchors`), `emissiveCenter`,
|
|
308
|
+
* Register a single-page or multi-page sprite atlas (`@holtjs/craft/three`, `@holtjs/craft/atlas`, or TexturePacker / Aseprite JSON)
|
|
309
|
+
* preserving per-frame trimmed pivots (`ax/ay` or `pivot`), named sockets (`anchors`), `emissiveCenter`, `atlasYaw`,
|
|
310
|
+
* and per-frame `page` / `sourceIndex` across multiple `<= 4096x4096` GPU texture pages!
|
|
290
311
|
*/
|
|
291
|
-
addAtlas(key: string, source: TextureImageSource, atlasData: AtlasJsonLike, options?: TextureImageOptions): Texture | null;
|
|
312
|
+
addAtlas(key: string, source: TextureImageSource | readonly TextureImageSource[], atlasData: AtlasJsonLike, options?: TextureImageOptions): Texture | null;
|
|
292
313
|
remove(key: string): boolean;
|
|
293
314
|
invalidateAllGl(): void;
|
|
294
315
|
destroy(): void;
|
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-n8aqhzxu.js";
|
|
2
2
|
export { AnimationConfig, AnimationFrameInput, AnimationManager, AtlasAutoAnimOptions, AtlasClipRule, CompiledAnimationFrame, DirectionalAnimGroup, GenerateFrameNamesConfig, GenerateFrameNumbersConfig, StageAnimation };
|
|
@@ -1100,7 +1100,18 @@ var TileSpriteObject = class extends DisplayObject {
|
|
|
1100
1100
|
this.height = Math.max(0, height);
|
|
1101
1101
|
this.texture = scene.textures.get(key);
|
|
1102
1102
|
this.frame = this.texture.get(frame);
|
|
1103
|
-
this.
|
|
1103
|
+
if (this.frame?.source) this.frame.source.repeat = true;
|
|
1104
|
+
}
|
|
1105
|
+
setTexture(key, frame) {
|
|
1106
|
+
this.texture = this.scene.textures.get(key);
|
|
1107
|
+
this.frame = this.texture.get(frame);
|
|
1108
|
+
if (this.frame?.source) this.frame.source.repeat = true;
|
|
1109
|
+
return this;
|
|
1110
|
+
}
|
|
1111
|
+
setFrame(frame) {
|
|
1112
|
+
this.frame = this.texture.get(frame);
|
|
1113
|
+
if (this.frame?.source) this.frame.source.repeat = true;
|
|
1114
|
+
return this;
|
|
1104
1115
|
}
|
|
1105
1116
|
setTint(color) {
|
|
1106
1117
|
this.tint = color & HEX_MASK;
|
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-n8aqhzxu.js";
|
|
2
2
|
import { c as TweenManager, u as TweenStats } from "./tween-BiF1FUvc.js";
|
|
3
3
|
import { a as ScriptOptions, i as ScriptHandle, o as ScriptScheduler, r as ScriptContext, s as ScriptStats, t as CoroutineGenerator } from "./coroutine-DLgJumtD.js";
|
|
4
4
|
interface CameraFollowOptions {
|
|
@@ -504,6 +504,8 @@ declare class TileSpriteObject extends DisplayObject {
|
|
|
504
504
|
tint: number;
|
|
505
505
|
isTinted: boolean;
|
|
506
506
|
constructor(scene: SceneHostLike, x: number, y: number, width: number, height: number, key: string, frame?: string | number);
|
|
507
|
+
setTexture(key: string, frame?: string | number): this;
|
|
508
|
+
setFrame(frame?: string | number): this;
|
|
507
509
|
setTint(color: number): this;
|
|
508
510
|
clearTint(): this;
|
|
509
511
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { o as Renderer2D, s as Camera, t as RendererWebGpu } from "./renderer-webgpu-
|
|
4
|
-
import { _ as TileSpriteObject, c as ImageObject, d as NineSliceObject, f as PanelObject, g as TextObject, h as SpriteObject, i as DisplayList, l as InstancedBatchObject, m as ShapeBatchObject, n as Container, o as DrawStreamObject, p as RectangleObject, r as CustomPassObject, s as Graphics, t as BlitterObject, u as MsdfIconObject } from "./display-
|
|
3
|
+
import { o as Renderer2D, s as Camera, t as RendererWebGpu } from "./renderer-webgpu-LDnrpYa0.js";
|
|
4
|
+
import { _ as TileSpriteObject, c as ImageObject, d as NineSliceObject, f as PanelObject, g as TextObject, h as SpriteObject, i as DisplayList, l as InstancedBatchObject, m as ShapeBatchObject, n as Container, o as DrawStreamObject, p as RectangleObject, r as CustomPassObject, s as Graphics, t as BlitterObject, u as MsdfIconObject } from "./display-CVjvA8ZO.js";
|
|
5
5
|
import { TweenManager } from "./tween.js";
|
|
6
6
|
import { ScriptScheduler } from "./coroutine.js";
|
|
7
7
|
import { StageKernel } from "./kernel.js";
|
|
@@ -218,12 +218,36 @@ var Texture = class {
|
|
|
218
218
|
atlasYaw = null;
|
|
219
219
|
atlasPitch = null;
|
|
220
220
|
atlasScale = null;
|
|
221
|
+
hostRef;
|
|
222
|
+
defaultPremultiply;
|
|
221
223
|
constructor(manager, key, image, filterMode, host, premultiplyAlpha = true, isRenderTarget = false) {
|
|
222
224
|
this.manager = manager;
|
|
223
225
|
this.key = key;
|
|
224
|
-
|
|
225
|
-
this.
|
|
226
|
-
|
|
226
|
+
this.hostRef = host;
|
|
227
|
+
this.defaultPremultiply = premultiplyAlpha;
|
|
228
|
+
const images = Array.isArray(image) ? image : [image];
|
|
229
|
+
this.source = images.map((img, i) => new TextureSource(this, img, filterMode, host, premultiplyAlpha, i === 0 ? isRenderTarget : false));
|
|
230
|
+
const src0 = this.source[0];
|
|
231
|
+
if (src0) this.add("__BASE", 0, 0, 0, src0.width, src0.height);
|
|
232
|
+
if (this.source.length > 1) for (let i = 0; i < this.source.length; i++) {
|
|
233
|
+
const s = this.source[i];
|
|
234
|
+
this.add(`__PAGE_${i}`, i, 0, 0, s.width, s.height);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/** Number of backing `TextureSource` pages attached to this logical texture (`1` for single-page atlases). */
|
|
238
|
+
get pageCount() {
|
|
239
|
+
return this.source.length;
|
|
240
|
+
}
|
|
241
|
+
/** Append an additional `TextureSource` page dynamically (returns the new `TextureSource` at `source.length - 1`). */
|
|
242
|
+
addSource(image, filterMode, premultiplyAlpha) {
|
|
243
|
+
const idx = this.source.length;
|
|
244
|
+
const filter = filterMode ?? this.source[0]?.filterMode ?? FilterMode.LINEAR;
|
|
245
|
+
const premul = premultiplyAlpha ?? this.defaultPremultiply;
|
|
246
|
+
const src = new TextureSource(this, image, filter, this.hostRef, premul, false);
|
|
247
|
+
this.source.push(src);
|
|
248
|
+
if (idx === 1 && this.source[0] && !this.has("__PAGE_0")) this.add("__PAGE_0", 0, 0, 0, this.source[0].width, this.source[0].height);
|
|
249
|
+
this.add(`__PAGE_${idx}`, idx, 0, 0, src.width, src.height);
|
|
250
|
+
return src;
|
|
227
251
|
}
|
|
228
252
|
add(name, sourceIndex, x, y, width, height, meta) {
|
|
229
253
|
const frame = new Frame(this, name, sourceIndex, x, y, width, height, meta);
|
|
@@ -339,7 +363,7 @@ var TextureManager = class {
|
|
|
339
363
|
return this.list[key] ?? this.list["__DEFAULT"];
|
|
340
364
|
}
|
|
341
365
|
addImage(key, source, options) {
|
|
342
|
-
if (!source) return null;
|
|
366
|
+
if (!source || Array.isArray(source) && source.length === 0) return null;
|
|
343
367
|
if (this.exists(key)) this.remove(key);
|
|
344
368
|
const filter = options?.filterMode ?? this.defaultFilter;
|
|
345
369
|
const premultiply = options?.premultiplyAlpha ?? true;
|
|
@@ -379,8 +403,9 @@ var TextureManager = class {
|
|
|
379
403
|
return tex;
|
|
380
404
|
}
|
|
381
405
|
/**
|
|
382
|
-
* Register a
|
|
383
|
-
* preserving per-frame trimmed pivots (`ax/ay` or `pivot`), named sockets (`anchors`), `emissiveCenter`,
|
|
406
|
+
* Register a single-page or multi-page sprite atlas (`@holtjs/craft/three`, `@holtjs/craft/atlas`, or TexturePacker / Aseprite JSON)
|
|
407
|
+
* preserving per-frame trimmed pivots (`ax/ay` or `pivot`), named sockets (`anchors`), `emissiveCenter`, `atlasYaw`,
|
|
408
|
+
* and per-frame `page` / `sourceIndex` across multiple `<= 4096x4096` GPU texture pages!
|
|
384
409
|
*/
|
|
385
410
|
addAtlas(key, source, atlasData, options) {
|
|
386
411
|
const tex = this.addImage(key, source, options);
|
|
@@ -389,16 +414,19 @@ var TextureManager = class {
|
|
|
389
414
|
if (typeof root.yaw === "number" && Number.isFinite(root.yaw)) tex.atlasYaw = root.yaw;
|
|
390
415
|
if (typeof root.pitch === "number" && Number.isFinite(root.pitch)) tex.atlasPitch = root.pitch;
|
|
391
416
|
if (typeof root.scale === "number" && Number.isFinite(root.scale)) tex.atlasScale = root.scale;
|
|
392
|
-
const
|
|
393
|
-
|
|
417
|
+
const maxPage = Math.max(0, tex.source.length - 1);
|
|
418
|
+
const resolvePage = (rawPage, defaultPage) => {
|
|
419
|
+
const n = typeof rawPage === "number" && Number.isFinite(rawPage) ? Math.floor(rawPage) : defaultPage;
|
|
420
|
+
return n < 0 ? 0 : n > maxPage ? maxPage : n;
|
|
421
|
+
};
|
|
394
422
|
let probeCanvas = null;
|
|
395
423
|
let probeCtx = null;
|
|
396
424
|
const emptyRectCache = /* @__PURE__ */ new Map();
|
|
397
|
-
const detectEmptyRect = (fx, fy, fw, fh, explicitEmpty) => {
|
|
425
|
+
const detectEmptyRect = (pageIdx, fx, fy, fw, fh, explicitEmpty) => {
|
|
398
426
|
if (typeof explicitEmpty === "boolean") return explicitEmpty;
|
|
399
427
|
if (fw <= 1 && fh <= 1) return true;
|
|
400
428
|
if (fw > 64 || fh > 64) return false;
|
|
401
|
-
const rectKey = `${fx},${fy},${fw},${fh}`;
|
|
429
|
+
const rectKey = `${pageIdx}:${fx},${fy},${fw},${fh}`;
|
|
402
430
|
const cached = emptyRectCache.get(rectKey);
|
|
403
431
|
if (cached !== void 0) return cached;
|
|
404
432
|
let isEmpty = false;
|
|
@@ -411,9 +439,10 @@ var TextureManager = class {
|
|
|
411
439
|
probeCtx = probeCanvas.getContext("2d", { willReadFrequently: true }) ?? false;
|
|
412
440
|
} else probeCtx = false;
|
|
413
441
|
}
|
|
414
|
-
|
|
442
|
+
const pageImg = tex.source[pageIdx]?.image;
|
|
443
|
+
if (probeCtx && pageImg) {
|
|
415
444
|
probeCtx.clearRect(0, 0, fw, fh);
|
|
416
|
-
probeCtx.drawImage(
|
|
445
|
+
probeCtx.drawImage(pageImg, fx, fy, fw, fh, 0, 0, fw, fh);
|
|
417
446
|
const data = probeCtx.getImageData(0, 0, fw, fh).data;
|
|
418
447
|
let allZero = true;
|
|
419
448
|
for (let i = 3; i < data.length; i += 4) if (data[i] !== 0) {
|
|
@@ -428,8 +457,9 @@ var TextureManager = class {
|
|
|
428
457
|
emptyRectCache.set(rectKey, isEmpty);
|
|
429
458
|
return isEmpty;
|
|
430
459
|
};
|
|
431
|
-
const addEntry = (frameName, entry) => {
|
|
460
|
+
const addEntry = (frameName, entry, defaultPage) => {
|
|
432
461
|
if (!entry || typeof entry !== "object") return;
|
|
462
|
+
const pageIdx = resolvePage(entry.page ?? entry.sourceIndex, defaultPage);
|
|
433
463
|
if (entry.frame && typeof entry.frame === "object" && typeof entry.frame.w === "number") {
|
|
434
464
|
const fr = entry.frame;
|
|
435
465
|
const fx = Number(fr.x) || 0;
|
|
@@ -439,7 +469,7 @@ var TextureManager = class {
|
|
|
439
469
|
const meta = {
|
|
440
470
|
baseChar: entry.baseChar,
|
|
441
471
|
baseActor: entry.baseActor,
|
|
442
|
-
empty: detectEmptyRect(fx, fy, fw, fh, entry.empty)
|
|
472
|
+
empty: detectEmptyRect(pageIdx, fx, fy, fw, fh, entry.empty)
|
|
443
473
|
};
|
|
444
474
|
if (entry.pivot && typeof entry.pivot.x === "number" && typeof entry.pivot.y === "number") {
|
|
445
475
|
const px = Number(entry.pivot.x);
|
|
@@ -453,14 +483,14 @@ var TextureManager = class {
|
|
|
453
483
|
}
|
|
454
484
|
}
|
|
455
485
|
if (entry.anchors) meta.anchors = entry.anchors;
|
|
456
|
-
tex.add(frameName,
|
|
486
|
+
tex.add(frameName, pageIdx, fx, fy, fw, fh, meta);
|
|
457
487
|
return;
|
|
458
488
|
}
|
|
459
489
|
const fx = Number(entry.x) || 0;
|
|
460
490
|
const fy = Number(entry.y) || 0;
|
|
461
491
|
const fw = Number(entry.w ?? entry.width) || 0;
|
|
462
492
|
const fh = Number(entry.h ?? entry.height) || 0;
|
|
463
|
-
tex.add(frameName,
|
|
493
|
+
tex.add(frameName, pageIdx, fx, fy, fw, fh, {
|
|
464
494
|
ax: typeof entry.ax === "number" ? entry.ax : void 0,
|
|
465
495
|
ay: typeof entry.ay === "number" ? entry.ay : void 0,
|
|
466
496
|
pivotX: typeof entry.pivotX === "number" ? entry.pivotX : void 0,
|
|
@@ -477,14 +507,25 @@ var TextureManager = class {
|
|
|
477
507
|
frame: typeof entry.frame === "number" ? entry.frame : void 0,
|
|
478
508
|
frames: entry.frames,
|
|
479
509
|
loop: entry.loop,
|
|
480
|
-
empty: detectEmptyRect(fx, fy, fw, fh, entry.empty)
|
|
510
|
+
empty: detectEmptyRect(pageIdx, fx, fy, fw, fh, entry.empty)
|
|
481
511
|
});
|
|
482
512
|
};
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
513
|
+
const ingestFrames = (framesNode, defaultPage) => {
|
|
514
|
+
if (!framesNode) return;
|
|
515
|
+
if (Array.isArray(framesNode)) for (let i = 0; i < framesNode.length; i++) {
|
|
516
|
+
const item = framesNode[i];
|
|
517
|
+
const name = String(item?.filename ?? item?.name ?? item?.key ?? i);
|
|
518
|
+
addEntry(name, item, defaultPage);
|
|
519
|
+
}
|
|
520
|
+
else if (typeof framesNode === "object") for (const [name, item] of Object.entries(framesNode)) addEntry(name, item, defaultPage);
|
|
521
|
+
};
|
|
522
|
+
const multiPages = Array.isArray(root.textures) ? root.textures : Array.isArray(atlasData.textures) ? atlasData.textures : Array.isArray(root.pages) ? root.pages : Array.isArray(atlasData.pages) ? atlasData.pages : null;
|
|
523
|
+
if (multiPages) for (let p = 0; p < multiPages.length; p++) {
|
|
524
|
+
const pageObj = multiPages[p];
|
|
525
|
+
if (pageObj && typeof pageObj === "object" && pageObj.frames) ingestFrames(pageObj.frames, p);
|
|
486
526
|
}
|
|
487
|
-
|
|
527
|
+
const rawFrames = root.frames ?? atlasData.frames;
|
|
528
|
+
if (rawFrames) ingestFrames(rawFrames, 0);
|
|
488
529
|
return tex;
|
|
489
530
|
}
|
|
490
531
|
remove(key) {
|
|
@@ -3785,7 +3826,7 @@ var RendererGl = class extends EventEmitter {
|
|
|
3785
3826
|
const outlineAlpha = icon.outlineAlpha * alpha;
|
|
3786
3827
|
const outlineW = icon.outlineWidth;
|
|
3787
3828
|
if (fillAlpha <= 0 && (outlineW <= 0 || outlineAlpha <= 0)) return;
|
|
3788
|
-
const src = icon.texture?.source?.[0];
|
|
3829
|
+
const src = icon.frame?.source ?? icon.texture?.source?.[0];
|
|
3789
3830
|
if (!src || src.width <= 1 || src.height <= 1) return;
|
|
3790
3831
|
const ox = icon.displayOriginX;
|
|
3791
3832
|
const oy = icon.displayOriginY;
|
|
@@ -3876,19 +3917,23 @@ var RendererGl = class extends EventEmitter {
|
|
|
3876
3917
|
}
|
|
3877
3918
|
renderInstancedBatch(batch, m, alpha) {
|
|
3878
3919
|
const cols = batch.columns;
|
|
3879
|
-
if (!cols || cols.count <= 0) return;
|
|
3880
|
-
const src = batch.texture?.source?.[0];
|
|
3881
|
-
if (!src) return;
|
|
3882
|
-
const glTex = this.ensureGlTexture(src);
|
|
3883
|
-
if (!glTex) return;
|
|
3920
|
+
if (!cols || cols.count <= 0 || !batch.texture) return;
|
|
3884
3921
|
this.setBlend(batch.blendMode);
|
|
3885
3922
|
const n = Math.min(cols.count, batch.maxCount, cols.x.length, cols.y.length);
|
|
3886
3923
|
if (n <= 0) return;
|
|
3887
3924
|
if (!this.ensureInstancedResources()) {
|
|
3888
|
-
|
|
3925
|
+
let lastSrc = null;
|
|
3926
|
+
let lastGlTex = null;
|
|
3889
3927
|
for (let i = 0; i < n; i++) {
|
|
3890
3928
|
const s = cols.order ? cols.order[i] : i;
|
|
3891
3929
|
const fr = cols.frameIndex ? batch.texture.get(cols.frameIndex[s]) : batch.defaultFrame;
|
|
3930
|
+
if (!fr || fr.empty || fr.width <= 0 || fr.height <= 0) continue;
|
|
3931
|
+
if (fr.source !== lastSrc) {
|
|
3932
|
+
lastSrc = fr.source;
|
|
3933
|
+
lastGlTex = this.ensureGlTexture(lastSrc);
|
|
3934
|
+
}
|
|
3935
|
+
if (!lastGlTex) continue;
|
|
3936
|
+
const unit = this.assignTextureUnit(lastGlTex);
|
|
3892
3937
|
const sx = cols.scaleX ? cols.scaleX[s] : 1;
|
|
3893
3938
|
const sy = cols.scaleY ? cols.scaleY[s] : sx;
|
|
3894
3939
|
const a = alpha * (cols.alpha ? cols.alpha[s] : 1);
|
|
@@ -3916,12 +3961,42 @@ var RendererGl = class extends EventEmitter {
|
|
|
3916
3961
|
const ma = m.a, mb = m.b, mc = m.c, md = m.d, mtx = m.tx, mty = m.ty;
|
|
3917
3962
|
const oxRatio = batch.originX;
|
|
3918
3963
|
const oyRatio = batch.originY;
|
|
3964
|
+
const gl2 = this.gl;
|
|
3919
3965
|
let vis = 0;
|
|
3966
|
+
let curSrc = null;
|
|
3967
|
+
let curGlTex = null;
|
|
3968
|
+
let boundProg = false;
|
|
3969
|
+
const flushSubRun = () => {
|
|
3970
|
+
if (vis === 0 || !curGlTex) return;
|
|
3971
|
+
if (!boundProg) {
|
|
3972
|
+
gl2.useProgram(this.instProgram);
|
|
3973
|
+
if (this.instUres) gl2.uniform2f(this.instUres, this.width, this.height);
|
|
3974
|
+
applyGlBlendMode(gl2, this.curBlend);
|
|
3975
|
+
gl2.bindVertexArray(this.instVao);
|
|
3976
|
+
gl2.bindBuffer(gl2.ARRAY_BUFFER, this.instDataVbo);
|
|
3977
|
+
boundProg = true;
|
|
3978
|
+
}
|
|
3979
|
+
this.bindTextureAt(0, curGlTex);
|
|
3980
|
+
gl2.bufferData(gl2.ARRAY_BUFFER, f32.subarray(0, vis * INST_FLOATS), gl2.STREAM_DRAW);
|
|
3981
|
+
gl2.drawElementsInstanced(gl2.TRIANGLES, 6, gl2.UNSIGNED_SHORT, 0, vis);
|
|
3982
|
+
this.curDrawCalls++;
|
|
3983
|
+
this.curFlushes++;
|
|
3984
|
+
this.curQuads += vis;
|
|
3985
|
+
this.curTris += vis * 2;
|
|
3986
|
+
vis = 0;
|
|
3987
|
+
};
|
|
3920
3988
|
for (let i = 0; i < n; i++) {
|
|
3921
3989
|
const s = cols.order ? cols.order[i] : i;
|
|
3922
3990
|
const instA = alpha * (cols.alpha ? cols.alpha[s] : 1);
|
|
3923
3991
|
if (instA <= 0) continue;
|
|
3924
3992
|
const fr = cols.frameIndex ? batch.texture.get(cols.frameIndex[s]) : batch.defaultFrame;
|
|
3993
|
+
if (!fr || fr.empty || fr.width <= 0 || fr.height <= 0) continue;
|
|
3994
|
+
if (fr.source !== curSrc) {
|
|
3995
|
+
flushSubRun();
|
|
3996
|
+
curSrc = fr.source;
|
|
3997
|
+
curGlTex = this.ensureGlTexture(curSrc);
|
|
3998
|
+
}
|
|
3999
|
+
if (!curGlTex) continue;
|
|
3925
4000
|
const sx = (cols.scaleX ? cols.scaleX[s] : 1) * fr.width;
|
|
3926
4001
|
const sy = (cols.scaleY ? cols.scaleY[s] : cols.scaleX ? cols.scaleX[s] : 1) * fr.height;
|
|
3927
4002
|
const rot = cols.rotation ? cols.rotation[s] : 0;
|
|
@@ -3963,22 +4038,11 @@ var RendererGl = class extends EventEmitter {
|
|
|
3963
4038
|
u32[base + 10] = packColorAbgr(rgb, instA);
|
|
3964
4039
|
vis++;
|
|
3965
4040
|
}
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
this.bindTextureAt(0, glTex);
|
|
3972
|
-
gl2.bindVertexArray(this.instVao);
|
|
3973
|
-
gl2.bindBuffer(gl2.ARRAY_BUFFER, this.instDataVbo);
|
|
3974
|
-
gl2.bufferData(gl2.ARRAY_BUFFER, f32.subarray(0, vis * INST_FLOATS), gl2.STREAM_DRAW);
|
|
3975
|
-
gl2.drawElementsInstanced(gl2.TRIANGLES, 6, gl2.UNSIGNED_SHORT, 0, vis);
|
|
3976
|
-
gl2.bindVertexArray(null);
|
|
3977
|
-
this.curDrawCalls++;
|
|
3978
|
-
this.curFlushes++;
|
|
3979
|
-
this.curQuads += vis;
|
|
3980
|
-
this.curTris += vis * 2;
|
|
3981
|
-
this.invalidateProgramState();
|
|
4041
|
+
flushSubRun();
|
|
4042
|
+
if (boundProg) {
|
|
4043
|
+
gl2.bindVertexArray(null);
|
|
4044
|
+
this.invalidateProgramState();
|
|
4045
|
+
}
|
|
3982
4046
|
}
|
|
3983
4047
|
/** Create an offscreen WebGL framebuffer target backed by a registered Stage `Texture` (`key`). */
|
|
3984
4048
|
createRenderTarget(key, width, height, textures, filterMode = FilterMode.LINEAR) {
|
package/dist/headless.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as OpenWgpuNativeFfiOptions, E as StagePlugin, Qt as OpenDawnWebGpuOptions, Tt as SceneDigest, Xt as HeadlessWebGpuHandle, Yt as HeadlessWebGpuBackend, Zt as HeadlessWebGpuOptions, en as openDawnWebGpu, f as SceneInput, kt as SceneDigestOptions, n as EngineClockSnapshot, nn as requestHeadlessWebGpu, qt as WebGpuDeviceLike, r as Game, tn as openWgpuNativeFfi, u as Scene } from "./game-
|
|
1
|
+
import { $t as OpenWgpuNativeFfiOptions, E as StagePlugin, Qt as OpenDawnWebGpuOptions, Tt as SceneDigest, Xt as HeadlessWebGpuHandle, Yt as HeadlessWebGpuBackend, Zt as HeadlessWebGpuOptions, en as openDawnWebGpu, f as SceneInput, kt as SceneDigestOptions, n as EngineClockSnapshot, nn as requestHeadlessWebGpu, qt as WebGpuDeviceLike, r as Game, tn as openWgpuNativeFfi, u as Scene } from "./game-C8bz7tay.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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./types-CXsCvp1p.js";
|
|
2
|
-
import { n as Game } from "./game-
|
|
3
|
-
import { a as requestHeadlessWebGpu, i as openWgpuNativeFfi, r as openDawnWebGpu } from "./renderer-webgpu-
|
|
2
|
+
import { n as Game } from "./game-CziLa7dv.js";
|
|
3
|
+
import { a as requestHeadlessWebGpu, i as openWgpuNativeFfi, r as openDawnWebGpu } from "./renderer-webgpu-LDnrpYa0.js";
|
|
4
4
|
import { buildSceneDigest } from "./trace.js";
|
|
5
5
|
// src/headless.ts
|
|
6
6
|
function createVirtualDomHost(createCanvas, width, height) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $n as HiDpiConfigureOptions, $t as OpenWgpuNativeFfiOptions, A as createInputRecorder, An as InstancedBatchObject, At as SceneDigestOverlayStats, Bn as SceneHostLike, Bt as Pointer, C as RecordedInputEntry, Cn as DrawStreamBulkView, D as TimelineClickOptions, Dn as EquipmentBinding, Dt as SceneDigestEngineSandbox, E as StagePlugin, En as DrawStreamSpriteOptions, Et as SceneDigestActiveFocus, Fn as PanelObject, Ft as buildSceneDigest, Gn as SpriteObject, Gt as WebGpuBootstrapResult, Hn as ShapeBatchObject, Ht as RendererWebGpu, In as PanelOpenSide, It as sanitizeTrackToken, Jn as TextObject, Jt as requestWebGpuDevice, Kn as SpritePlayOptions, Kt as WebGpuCanvasContextLike, Ln as PanelStyleConfig, Lt as InputConfig, M as createInputTimeline, Mn as MsdfIconConfig, Mt as SceneDigestSurfaceEntry, Nn as MsdfIconObject, Nt as SceneDigestSurfaceSource, O as TimelineDragOptions, On as Graphics, Ot as SceneDigestNode, Pn as NineSliceObject, Pt as SceneDigestSurfaces, Qn as CameraFollowOptions, Qt as OpenDawnWebGpuOptions, Rn as RectClipMask, Rt as InputPlugin, S as InputTimelinePlugin, Sn as DisplaySemantics, T as StageKernel, Tn as DrawStreamOptions, Tt as SceneDigest, Un as ShapeBatchStyleDefaults, Ut as RendererWebGpuOptions, Vn as ShapeBatchColumns, Vt as PointerSample, Wn as SpriteAnimEventListener, Wt as RequestWebGpuOptions, Xn as TileSpriteObject, Xt as HeadlessWebGpuHandle, Yn as TextStyleConfig, Yt as HeadlessWebGpuBackend, Zn as Camera, Zt as HeadlessWebGpuOptions, _ as ActionMap, _n as CustomPassOptions, a as GameLoop, an as RendererGlOptions, b as InputTargetSpec, bn as DisplayObject, c as LoaderPlugin, cn as StageRenderTarget, d as SceneCtor, dn as BlitterObject, en as openDawnWebGpu, er as HiDpiScaleLike, f as SceneInput, fn as Bob$1, g as ViewportFitResult, gn as CustomPassObject, h as StageRenderer, hn as CustomPassCallback, i as GameConfig$1, in as RendererGl, j as createInputReplay, jn as InstancedColumns, jt as SceneDigestSandbox, k as TimelineKeyOptions, kn as ImageObject, kt as SceneDigestOptions, l as ScaleManager, ln as AnchorPose2D, m as SceneManager, mn as ContainerFiltersShim, n as EngineClockSnapshot, nn as requestHeadlessWebGpu, o as GameObjectFactory, on as RendererStats, p as SceneLifecycleStats, pn as Container, qn as SyncAttachmentOptions, qt as WebGpuDeviceLike, r as Game, rn as Renderer2D, s as JsonCache, sn as Stage2DCustomImageHandler, t as EngineClock, tn as openWgpuNativeFfi, u as Scene, un as BindEquipmentOptions, v as InputProvider, vn as DirectionalPlayOptions, w as StageInputEvent, wn as DrawStreamObject, x as InputTimelineOptions, xn as DisplayObjectType, y as InputRecorderPlugin, yn as DisplayList, zn as RectangleObject, zt as KeyboardPlugin } from "./game-
|
|
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-
|
|
1
|
+
import { $n as HiDpiConfigureOptions, $t as OpenWgpuNativeFfiOptions, A as createInputRecorder, An as InstancedBatchObject, At as SceneDigestOverlayStats, Bn as SceneHostLike, Bt as Pointer, C as RecordedInputEntry, Cn as DrawStreamBulkView, D as TimelineClickOptions, Dn as EquipmentBinding, Dt as SceneDigestEngineSandbox, E as StagePlugin, En as DrawStreamSpriteOptions, Et as SceneDigestActiveFocus, Fn as PanelObject, Ft as buildSceneDigest, Gn as SpriteObject, Gt as WebGpuBootstrapResult, Hn as ShapeBatchObject, Ht as RendererWebGpu, In as PanelOpenSide, It as sanitizeTrackToken, Jn as TextObject, Jt as requestWebGpuDevice, Kn as SpritePlayOptions, Kt as WebGpuCanvasContextLike, Ln as PanelStyleConfig, Lt as InputConfig, M as createInputTimeline, Mn as MsdfIconConfig, Mt as SceneDigestSurfaceEntry, Nn as MsdfIconObject, Nt as SceneDigestSurfaceSource, O as TimelineDragOptions, On as Graphics, Ot as SceneDigestNode, Pn as NineSliceObject, Pt as SceneDigestSurfaces, Qn as CameraFollowOptions, Qt as OpenDawnWebGpuOptions, Rn as RectClipMask, Rt as InputPlugin, S as InputTimelinePlugin, Sn as DisplaySemantics, T as StageKernel, Tn as DrawStreamOptions, Tt as SceneDigest, Un as ShapeBatchStyleDefaults, Ut as RendererWebGpuOptions, Vn as ShapeBatchColumns, Vt as PointerSample, Wn as SpriteAnimEventListener, Wt as RequestWebGpuOptions, Xn as TileSpriteObject, Xt as HeadlessWebGpuHandle, Yn as TextStyleConfig, Yt as HeadlessWebGpuBackend, Zn as Camera, Zt as HeadlessWebGpuOptions, _ as ActionMap, _n as CustomPassOptions, a as GameLoop, an as RendererGlOptions, b as InputTargetSpec, bn as DisplayObject, c as LoaderPlugin, cn as StageRenderTarget, d as SceneCtor, dn as BlitterObject, en as openDawnWebGpu, er as HiDpiScaleLike, f as SceneInput, fn as Bob$1, g as ViewportFitResult, gn as CustomPassObject, h as StageRenderer, hn as CustomPassCallback, i as GameConfig$1, in as RendererGl, j as createInputReplay, jn as InstancedColumns, jt as SceneDigestSandbox, k as TimelineKeyOptions, kn as ImageObject, kt as SceneDigestOptions, l as ScaleManager, ln as AnchorPose2D, m as SceneManager, mn as ContainerFiltersShim, n as EngineClockSnapshot, nn as requestHeadlessWebGpu, o as GameObjectFactory, on as RendererStats, p as SceneLifecycleStats, pn as Container, qn as SyncAttachmentOptions, qt as WebGpuDeviceLike, r as Game, rn as Renderer2D, s as JsonCache, sn as Stage2DCustomImageHandler, t as EngineClock, tn as openWgpuNativeFfi, u as Scene, un as BindEquipmentOptions, v as InputProvider, vn as DirectionalPlayOptions, w as StageInputEvent, wn as DrawStreamObject, x as InputTimelineOptions, xn as DisplayObjectType, y as InputRecorderPlugin, yn as DisplayList, zn as RectangleObject, zt as KeyboardPlugin } from "./game-C8bz7tay.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-n8aqhzxu.js";
|
|
3
3
|
import { FlattenedFlexNode, FlattenedFlexTree, FlexAlign, FlexContainerSpec, FlexDir, FlexIconSpec, FlexItemRect, FlexItemSpec, FlexJustify, FlexNodeSpec, FlexPadding, FlexPanelStyle, FlexResult, FlexTextSpec, MountFlexUiOptions, MountedFlexUi, WrapContainerSpec, WrapItemRect, WrapItemSpec, WrapJustify, WrapResult, computeFlexLayout, computeWrapLayout, flattenFlexTree, mountFlexUi, 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 { a as ScriptOptions, i as ScriptHandle, o as ScriptScheduler, r as ScriptContext, s as ScriptStats, t as CoroutineGenerator } from "./coroutine-DLgJumtD.js";
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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-CziLa7dv.js";
|
|
3
3
|
import { AnimationManager } from "./anims.js";
|
|
4
|
-
import { a as requestHeadlessWebGpu, i as openWgpuNativeFfi, n as requestWebGpuDevice, o as Renderer2D, r as openDawnWebGpu, s as Camera, t as RendererWebGpu } from "./renderer-webgpu-
|
|
5
|
-
import { _ as TileSpriteObject, a as DisplayObject, c as ImageObject, d as NineSliceObject, f as PanelObject, g as TextObject, h as SpriteObject, i as DisplayList, l as InstancedBatchObject, m as ShapeBatchObject, n as Container, o as DrawStreamObject, p as RectangleObject, r as CustomPassObject, s as Graphics, t as BlitterObject, u as MsdfIconObject } from "./display-
|
|
4
|
+
import { a as requestHeadlessWebGpu, i as openWgpuNativeFfi, n as requestWebGpuDevice, o as Renderer2D, r as openDawnWebGpu, s as Camera, t as RendererWebGpu } from "./renderer-webgpu-LDnrpYa0.js";
|
|
5
|
+
import { _ as TileSpriteObject, a as DisplayObject, c as ImageObject, d as NineSliceObject, f as PanelObject, g as TextObject, h as SpriteObject, i as DisplayList, l as InstancedBatchObject, m as ShapeBatchObject, n as Container, o as DrawStreamObject, p as RectangleObject, r as CustomPassObject, s as Graphics, t as BlitterObject, u as MsdfIconObject } from "./display-CVjvA8ZO.js";
|
|
6
6
|
import { ActionMap, StageKernel, createInputRecorder, createInputReplay, createInputTimeline } from "./kernel.js";
|
|
7
7
|
import { buildSceneDigest, sanitizeTrackToken } from "./trace.js";
|
|
8
8
|
import { computeFlexLayout, computeWrapLayout, flattenFlexTree, mountFlexUi, resolvePadding } from "./flex.js";
|
package/dist/joystick.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bt as Pointer, Fn as PanelObject, pn as Container, u as Scene } from "./game-
|
|
1
|
+
import { Bt as Pointer, Fn as PanelObject, pn as Container, u as Scene } from "./game-C8bz7tay.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,3 +1,3 @@
|
|
|
1
1
|
import { a as ScriptOptions, i as ScriptHandle, o as ScriptScheduler, r as ScriptContext, s as ScriptStats, t as CoroutineGenerator } from "./coroutine-DLgJumtD.js";
|
|
2
|
-
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-
|
|
2
|
+
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-C8bz7tay.js";
|
|
3
3
|
export { ActionMap, type CoroutineGenerator, InputProvider, InputRecorderPlugin, InputTargetSpec, InputTimelineOptions, InputTimelinePlugin, RecordedInputEntry, type ScriptContext, type ScriptHandle, type ScriptOptions, ScriptScheduler, type ScriptStats, StageInputEvent, StageKernel, StagePlugin, TimelineClickOptions, TimelineDragOptions, TimelineKeyOptions, createInputRecorder, createInputReplay, createInputTimeline };
|
package/dist/lighting.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bn as SceneHostLike, bn as DisplayObject, gn as CustomPassObject, kn as ImageObject, pn as Container } from "./game-
|
|
1
|
+
import { Bn as SceneHostLike, bn as DisplayObject, gn as CustomPassObject, kn as ImageObject, pn as Container } from "./game-C8bz7tay.js";
|
|
2
2
|
export type DayPhase = 'day' | 'dusk' | 'night';
|
|
3
3
|
export interface DayNightConfig {
|
|
4
4
|
dayLengthMs?: number;
|
package/dist/lighting.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { m as createMatrix2D, o as FilterMode, r as BlendModes } from "./types-CXsCvp1p.js";
|
|
2
|
-
import { l as InstancedBatchObject } from "./display-
|
|
2
|
+
import { l as InstancedBatchObject } from "./display-CVjvA8ZO.js";
|
|
3
3
|
// src/lighting.ts
|
|
4
4
|
function lerpChannel(a, b, t) {
|
|
5
5
|
return Math.round(a + (b - a) * t) & 255;
|
|
@@ -984,7 +984,10 @@ function createSceneNormalLitPass(scene, opts) {
|
|
|
984
984
|
if (!scene.textures.exists(normKey)) return;
|
|
985
985
|
const normTex = scene.textures.get(normKey);
|
|
986
986
|
const diffGl = glRenderer.ensureGlTexture(fr.source);
|
|
987
|
-
const
|
|
987
|
+
const normFrame = normTex.has(fr.name) ? normTex.get(fr.name) : null;
|
|
988
|
+
const normSrc = normFrame ? normFrame.source : normTex.source[fr.sourceIndex] ?? normTex.source[0];
|
|
989
|
+
if (!normSrc) return;
|
|
990
|
+
const normGl = glRenderer.ensureGlTexture(normSrc);
|
|
988
991
|
if (!diffGl || !normGl) return;
|
|
989
992
|
if (diffGl !== curDiffGl || normGl !== curNormGl) {
|
|
990
993
|
flushBatch();
|
package/dist/projection.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bn as SceneHostLike, bn as DisplayObject, pn as Container } from "./game-
|
|
1
|
+
import { Bn as SceneHostLike, bn as DisplayObject, pn as Container } from "./game-C8bz7tay.js";
|
|
2
2
|
export interface Camera25DConfig {
|
|
3
3
|
viewportWidth: number;
|
|
4
4
|
viewportHeight: number;
|
|
@@ -4272,18 +4272,21 @@ var RendererWebGpu = class extends EventEmitter {
|
|
|
4272
4272
|
case "InstancedBatch": {
|
|
4273
4273
|
const batch = obj;
|
|
4274
4274
|
const cols = batch.columns;
|
|
4275
|
-
if (!cols || cols.count <= 0) break;
|
|
4276
|
-
const src = batch.texture?.source?.[0];
|
|
4277
|
-
if (!src) break;
|
|
4278
|
-
const bg = this.ensureSourceBindGroup(src);
|
|
4279
|
-
if (!bg) break;
|
|
4275
|
+
if (!cols || cols.count <= 0 || !batch.texture) break;
|
|
4280
4276
|
const n = Math.min(cols.count, batch.maxCount, cols.x.length, cols.y.length);
|
|
4277
|
+
let lastSrc = null;
|
|
4278
|
+
let lastBg = null;
|
|
4281
4279
|
for (let i = 0; i < n; i++) {
|
|
4282
4280
|
const s = cols.order ? cols.order[i] : i;
|
|
4283
4281
|
const a = effAlpha * (cols.alpha ? cols.alpha[s] : 1);
|
|
4284
4282
|
if (a <= 0) continue;
|
|
4285
4283
|
const fr = cols.frameIndex ? batch.texture.get(cols.frameIndex[s]) : batch.defaultFrame;
|
|
4286
4284
|
if (!fr || fr.empty || fr.width <= 0 || fr.height <= 0) continue;
|
|
4285
|
+
if (fr.source !== lastSrc) {
|
|
4286
|
+
lastSrc = fr.source;
|
|
4287
|
+
lastBg = this.ensureSourceBindGroup(lastSrc);
|
|
4288
|
+
}
|
|
4289
|
+
if (!lastBg) continue;
|
|
4287
4290
|
const sx = cols.scaleX ? cols.scaleX[s] : 1;
|
|
4288
4291
|
const sy = cols.scaleY ? cols.scaleY[s] : sx;
|
|
4289
4292
|
const rot = cols.rotation ? cols.rotation[s] : 0;
|
|
@@ -4291,7 +4294,7 @@ var RendererWebGpu = class extends EventEmitter {
|
|
|
4291
4294
|
multiplyMat(m, cols.x[s], cols.y[s], sx, sy, rot, im);
|
|
4292
4295
|
const ox = fr.width * batch.originX, oy = fr.height * batch.originY;
|
|
4293
4296
|
const rgb = cols.tint ? cols.tint[s] : WHITE_RGB;
|
|
4294
|
-
this.pushQuad(im, -ox, -oy, fr.width - ox, fr.height - oy, fr.u0, fr.v0, fr.u1, fr.v1, packColorAbgr(rgb, a), 0, batch.blendMode,
|
|
4297
|
+
this.pushQuad(im, -ox, -oy, fr.width - ox, fr.height - oy, fr.u0, fr.v0, fr.u1, fr.v1, packColorAbgr(rgb, a), 0, batch.blendMode, lastBg);
|
|
4295
4298
|
}
|
|
4296
4299
|
break;
|
|
4297
4300
|
}
|
|
@@ -4563,7 +4566,7 @@ var RendererWebGpu = class extends EventEmitter {
|
|
|
4563
4566
|
rtCanvas.height = h;
|
|
4564
4567
|
const tex = textures.addCanvas(key, rtCanvas);
|
|
4565
4568
|
if (!tex) throw new Error("Stage: failed to register WebGPU RenderTarget texture");
|
|
4566
|
-
tex.
|
|
4569
|
+
tex.setFilter(filterMode);
|
|
4567
4570
|
const rtCamera = new Camera(w, h, true);
|
|
4568
4571
|
const rtRenderer = new Renderer2D(rtCanvas, w, h);
|
|
4569
4572
|
return {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $t as OpenWgpuNativeFfiOptions, Gt as WebGpuBootstrapResult, Ht as RendererWebGpu, Jt as requestWebGpuDevice, Kt as WebGpuCanvasContextLike, Qt as OpenDawnWebGpuOptions, Ut as RendererWebGpuOptions, Wt as RequestWebGpuOptions, Xt as HeadlessWebGpuHandle, Yt as HeadlessWebGpuBackend, Zt as HeadlessWebGpuOptions, en as openDawnWebGpu, nn as requestHeadlessWebGpu, qt as WebGpuDeviceLike, tn as openWgpuNativeFfi } from "./game-
|
|
1
|
+
import { $t as OpenWgpuNativeFfiOptions, Gt as WebGpuBootstrapResult, Ht as RendererWebGpu, Jt as requestWebGpuDevice, Kt as WebGpuCanvasContextLike, Qt as OpenDawnWebGpuOptions, Ut as RendererWebGpuOptions, Wt as RequestWebGpuOptions, Xt as HeadlessWebGpuHandle, Yt as HeadlessWebGpuBackend, Zt as HeadlessWebGpuOptions, en as openDawnWebGpu, nn as requestHeadlessWebGpu, qt as WebGpuDeviceLike, tn as openWgpuNativeFfi } from "./game-C8bz7tay.js";
|
|
2
2
|
export { type HeadlessWebGpuBackend, type HeadlessWebGpuHandle, type HeadlessWebGpuOptions, type OpenDawnWebGpuOptions, type OpenWgpuNativeFfiOptions, RendererWebGpu, RendererWebGpuOptions, RequestWebGpuOptions, WebGpuBootstrapResult, WebGpuCanvasContextLike, WebGpuDeviceLike, openDawnWebGpu, openWgpuNativeFfi, requestHeadlessWebGpu, requestWebGpuDevice };
|
package/dist/renderer-webgpu.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as RendererWebGpu, r as openDawnWebGpu, i as openWgpuNativeFfi, a as requestHeadlessWebGpu, n as requestWebGpuDevice } from "./renderer-webgpu-
|
|
1
|
+
export { t as RendererWebGpu, r as openDawnWebGpu, i as openWgpuNativeFfi, a as requestHeadlessWebGpu, n as requestWebGpuDevice } from "./renderer-webgpu-LDnrpYa0.js";
|
package/dist/rig2d.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as BlendMode } from "./anims-
|
|
2
|
-
import { Bn as SceneHostLike, On as Graphics, kn as ImageObject, pn as Container } from "./game-
|
|
1
|
+
import { T as BlendMode } from "./anims-n8aqhzxu.js";
|
|
2
|
+
import { Bn as SceneHostLike, On as Graphics, kn as ImageObject, pn as Container } from "./game-C8bz7tay.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,2 +1,2 @@
|
|
|
1
|
-
import { Ct as unpackChunkY, St as unpackChunkX, _t as floorDiv, at as ChunkedTilemapOptions, bt as packChunkKey, ct as MountedChunkedTilemap, dt as TileChunk, ft as bakeDualGridTileset, gt as fbm2D, ht as createIslandBiomeGenerator, it as ChunkedTilemap, lt as SurvivalBiomes, mt as computeDualGridMask, nt as BakedDualGridAtlas, ot as DualGridLayerSpec, pt as computeBlob47Index, rt as ChunkGeneratorFn, st as IslandBiomeConfig, ut as TileCellFlags, vt as hash2D, wt as valueNoise2D, xt as positiveMod, yt as mountChunkedTilemap } from "./game-
|
|
1
|
+
import { Ct as unpackChunkY, St as unpackChunkX, _t as floorDiv, at as ChunkedTilemapOptions, bt as packChunkKey, ct as MountedChunkedTilemap, dt as TileChunk, ft as bakeDualGridTileset, gt as fbm2D, ht as createIslandBiomeGenerator, it as ChunkedTilemap, lt as SurvivalBiomes, mt as computeDualGridMask, nt as BakedDualGridAtlas, ot as DualGridLayerSpec, pt as computeBlob47Index, rt as ChunkGeneratorFn, st as IslandBiomeConfig, ut as TileCellFlags, vt as hash2D, wt as valueNoise2D, xt as positiveMod, yt as mountChunkedTilemap } from "./game-C8bz7tay.js";
|
|
2
2
|
export { BakedDualGridAtlas, ChunkGeneratorFn, ChunkedTilemap, ChunkedTilemapOptions, DualGridLayerSpec, IslandBiomeConfig, MountedChunkedTilemap, SurvivalBiomes, TileCellFlags, TileChunk, bakeDualGridTileset, computeBlob47Index, computeDualGridMask, createIslandBiomeGenerator, fbm2D, floorDiv, hash2D, mountChunkedTilemap, packChunkKey, positiveMod, unpackChunkX, unpackChunkY, valueNoise2D };
|
package/dist/trace.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { At as SceneDigestOverlayStats, Dt as SceneDigestEngineSandbox, Et as SceneDigestActiveFocus, Ft as buildSceneDigest, It as sanitizeTrackToken, Mt as SceneDigestSurfaceEntry, Nt as SceneDigestSurfaceSource, Ot as SceneDigestNode, Pt as SceneDigestSurfaces, Tt as SceneDigest, jt as SceneDigestSandbox, kt as SceneDigestOptions } from "./game-
|
|
1
|
+
import { At as SceneDigestOverlayStats, Dt as SceneDigestEngineSandbox, Et as SceneDigestActiveFocus, Ft as buildSceneDigest, It as sanitizeTrackToken, Mt as SceneDigestSurfaceEntry, Nt as SceneDigestSurfaceSource, Ot as SceneDigestNode, Pt as SceneDigestSurfaces, Tt as SceneDigest, jt as SceneDigestSandbox, kt as SceneDigestOptions } from "./game-C8bz7tay.js";
|
|
2
2
|
export { SceneDigest, SceneDigestActiveFocus, SceneDigestEngineSandbox, SceneDigestNode, SceneDigestOptions, SceneDigestOverlayStats, SceneDigestSandbox, SceneDigestSurfaceEntry, SceneDigestSurfaceSource, SceneDigestSurfaces, buildSceneDigest, sanitizeTrackToken };
|
package/dist/world.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as decodeWorldDeltaBytes, B as RecipeRegistry, F as InventoryContainer, G as WorkstationSnapshot, H as WorkstationInstance, I as ItemDef, J as WorldDeltaSnapshot, K as WorldCatalogRuntime, L as ItemRegistry, N as CatalogReloadDiff, P as FrozenWorldCatalog, Q as createWorldCatalogRuntime, R as ItemStack, U as WorkstationJob, V as TileCellDelta, W as WorkstationScheduler, X as applyWorldDelta, Y as WorldEntityRecord, Z as captureWorldDelta, et as defineWorldCatalog, q as WorldCatalogSpec, tt as encodeWorldDeltaBytes, z as RecipeDef } from "./game-
|
|
1
|
+
import { $ as decodeWorldDeltaBytes, B as RecipeRegistry, F as InventoryContainer, G as WorkstationSnapshot, H as WorkstationInstance, I as ItemDef, J as WorldDeltaSnapshot, K as WorldCatalogRuntime, L as ItemRegistry, N as CatalogReloadDiff, P as FrozenWorldCatalog, Q as createWorldCatalogRuntime, R as ItemStack, U as WorkstationJob, V as TileCellDelta, W as WorkstationScheduler, X as applyWorldDelta, Y as WorldEntityRecord, Z as captureWorldDelta, et as defineWorldCatalog, q as WorldCatalogSpec, tt as encodeWorldDeltaBytes, z as RecipeDef } from "./game-C8bz7tay.js";
|
|
2
2
|
export { CatalogReloadDiff, FrozenWorldCatalog, InventoryContainer, ItemDef, ItemRegistry, ItemStack, RecipeDef, RecipeRegistry, TileCellDelta, WorkstationInstance, WorkstationJob, WorkstationScheduler, WorkstationSnapshot, WorldCatalogRuntime, WorldCatalogSpec, WorldDeltaSnapshot, WorldEntityRecord, applyWorldDelta, captureWorldDelta, createWorldCatalogRuntime, decodeWorldDeltaBytes, defineWorldCatalog, encodeWorldDeltaBytes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holtjs/stage",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.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.",
|