@holtjs/stage 0.12.0 → 0.14.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 +20 -0
- package/dist/{anims-BYBzSNXO.d.ts → anims-BOvaKn6w.d.ts} +33 -6
- package/dist/anims.d.ts +1 -1
- package/dist/{display-CuyQc8oE.js → display-CVjvA8ZO.js} +12 -1
- package/dist/ecs.d.ts +3 -3
- package/dist/ecs.js +2 -2
- package/dist/{game-DZoRjZNH.js → game-BF1ZbJRC.js} +131 -53
- package/dist/{game-CT_WCPjJ.d.ts → game-rKghsNlA.d.ts} +33 -15
- package/dist/headless.d.ts +33 -3
- package/dist/headless.js +201 -9
- 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 +28 -20
- package/dist/projection.d.ts +1 -1
- package/dist/{renderer-webgpu-B8vktrUk.js → renderer-webgpu-CnIevdNP.js} +468 -174
- 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,26 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.14.0] - 2026-12-05
|
|
10
|
+
|
|
11
|
+
### Added, Optimized & Fixed
|
|
12
|
+
- **Turnkey `createHeadlessStageAsync` / `openHeadlessStage` & Zero-Canvas WebGPU Mode (`@holtjs/stage/headless`, `src/headless.ts`)**:
|
|
13
|
+
- Added one-step `await createHeadlessStageAsync({ renderer: 'auto' | 'webgpu' | 'canvas', ... })` (aliased as `openHeadlessStage`) across **Bun**, **Node.js**, and **Deno**: automatically acquires native Headless WebGPU (`wgpu-native` FFI -> Google Dawn `'webgpu'` -> `navigator.gpu`), auto-discovers `@napi-rs/canvas` when installed, owns and destroys the `GPUDevice` inside `stage.destroy()`, exposes `stage.backend`, and throws an explicit setup error when `renderer: 'webgpu'` has no GPU backend.
|
|
14
|
+
- Made `createCanvas` optional on `createHeadlessStage` when `gpuDevice` or `glContext` is supplied, adding a zero-dependency pure-TypeScript RGBA8888 PNG fallback encoder (`toPng()` / `toPngAsync()`) and `RawRgbaTextureSource` (`{ width, height, data }`) support across `TextureManager`, `Lighting2DSystem`, `RendererWebGpu`, and `RendererGl`.
|
|
15
|
+
- **Unbounded `Uint32Array` Batching, Screen-Space Frustum Culling & Native GPU `StageRenderTarget` in `RendererWebGpu` (`src/renderer-webgpu.ts`)**:
|
|
16
|
+
- Switched `RendererWebGpu` batch index buffers from fixed `65,536`-vertex `Uint16Array` (`'uint16'`) to dynamically growing `Uint32Array` (`'uint32'`) + auto-growing `vbo` / `ibo` / `sdfInstVbo`, eliminating vertex-count truncation on large survival worlds (e.g. Nightfall 96×96 Dual-Grid island + night lighting + HUD).
|
|
17
|
+
- Added screen-space frustum culling in `pushQuad`, `pushTri`, and `pushSdfInstance` (`stats().culled`), plus `NineSlice` 9-patch quad emission, `TileSprite` repeat samplers, and `TextObject` crop UVs.
|
|
18
|
+
- Upgraded `RendererWebGpu.createRenderTarget` and `renderToTarget` to execute native offscreen WebGPU render passes (`rgba8unorm` target pipeline cache + re-entrant `executePass`) with zero per-frame CPU Canvas2D rasterization or `writeTexture` re-uploads.
|
|
19
|
+
|
|
20
|
+
## [0.13.0] - 2026-12-05
|
|
21
|
+
|
|
22
|
+
### Added & Fixed
|
|
23
|
+
- **Transparent Multi-Page Texture Atlases Across WebGPU, WebGL2 & Canvas2D (`TextureManager.addAtlas`, `Texture.addSource`, `Texture.pageCount`)**:
|
|
24
|
+
- `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`).
|
|
25
|
+
- 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)`.
|
|
26
|
+
- Fixed empty-placeholder probing in `addAtlas` (`detectEmptyRect`) to inspect `tex.source[pageIdx].image` rather than `source[0]`.
|
|
27
|
+
- 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.
|
|
28
|
+
|
|
9
29
|
## [0.12.0] - 2026-12-04
|
|
10
30
|
|
|
11
31
|
### Added & Fixed
|
|
@@ -91,7 +91,13 @@ declare class EventEmitter {
|
|
|
91
91
|
emit(event: string, ...args: any[]): boolean;
|
|
92
92
|
removeAllListeners(event?: string): this;
|
|
93
93
|
}
|
|
94
|
-
|
|
94
|
+
/** Zero-DOM raw RGBA8888 pixel buffer accepted by `TextureManager.addImage` / `addAtlas` across WebGPU, WebGL, and Headless hosts. */
|
|
95
|
+
interface RawRgbaTextureSource {
|
|
96
|
+
readonly width: number;
|
|
97
|
+
readonly height: number;
|
|
98
|
+
readonly data?: Uint8Array | Uint8ClampedArray;
|
|
99
|
+
}
|
|
100
|
+
type TextureImageSource = HTMLImageElement | HTMLCanvasElement | ImageBitmap | RawRgbaTextureSource;
|
|
95
101
|
interface SpriteSheetConfig {
|
|
96
102
|
frameWidth: number;
|
|
97
103
|
frameHeight: number;
|
|
@@ -138,17 +144,31 @@ interface FrameExtraMeta {
|
|
|
138
144
|
loop?: boolean;
|
|
139
145
|
/** True when this frame is an all-transparent occlusion placeholder (`1x1` cell, `2x2` transparent placeholder, or explicit `empty: true`). */
|
|
140
146
|
empty?: boolean;
|
|
147
|
+
/** Optional 0-based texture page index (`sourceIndex`) for multi-page atlases (`@holtjs/stage@>=0.13.0`). */
|
|
148
|
+
page?: number;
|
|
149
|
+
sourceIndex?: number;
|
|
150
|
+
}
|
|
151
|
+
interface AtlasTexturePageLike {
|
|
152
|
+
readonly image?: string;
|
|
153
|
+
readonly scale?: number;
|
|
154
|
+
readonly frames?: Record<string, any> | ReadonlyArray<any>;
|
|
141
155
|
}
|
|
142
156
|
interface AtlasJsonLike {
|
|
143
157
|
readonly yaw?: number;
|
|
144
158
|
readonly pitch?: number;
|
|
145
159
|
readonly scale?: number;
|
|
146
160
|
readonly frames?: Record<string, any> | ReadonlyArray<any>;
|
|
161
|
+
/** TexturePacker / Phaser multi-atlas page list (`textures[p]` maps to `source[p]`). */
|
|
162
|
+
readonly textures?: ReadonlyArray<AtlasTexturePageLike>;
|
|
163
|
+
/** `@holtjs/craft` multi-page atlas metadata (`pages[p]` maps to `source[p]`). */
|
|
164
|
+
readonly pages?: ReadonlyArray<AtlasTexturePageLike>;
|
|
147
165
|
readonly json?: {
|
|
148
166
|
readonly yaw?: number;
|
|
149
167
|
readonly pitch?: number;
|
|
150
168
|
readonly scale?: number;
|
|
151
169
|
readonly frames?: Record<string, any> | ReadonlyArray<any>;
|
|
170
|
+
readonly textures?: ReadonlyArray<AtlasTexturePageLike>;
|
|
171
|
+
readonly pages?: ReadonlyArray<AtlasTexturePageLike>;
|
|
152
172
|
};
|
|
153
173
|
}
|
|
154
174
|
interface TextureImageOptions {
|
|
@@ -249,7 +269,13 @@ declare class Texture {
|
|
|
249
269
|
atlasYaw: number | null;
|
|
250
270
|
atlasPitch: number | null;
|
|
251
271
|
atlasScale: number | null;
|
|
252
|
-
|
|
272
|
+
private readonly hostRef;
|
|
273
|
+
private readonly defaultPremultiply;
|
|
274
|
+
constructor(manager: TextureManager, key: string, image: TextureImageSource | readonly TextureImageSource[], filterMode: FilterModeValue, host: GlTextureHost | null, premultiplyAlpha?: boolean, isRenderTarget?: boolean);
|
|
275
|
+
/** Number of backing `TextureSource` pages attached to this logical texture (`1` for single-page atlases). */
|
|
276
|
+
get pageCount(): number;
|
|
277
|
+
/** Append an additional `TextureSource` page dynamically (returns the new `TextureSource` at `source.length - 1`). */
|
|
278
|
+
addSource(image: TextureImageSource, filterMode?: FilterModeValue, premultiplyAlpha?: boolean): TextureSource;
|
|
253
279
|
add(name: string | number, sourceIndex: number, x: number, y: number, width: number, height: number, meta?: FrameExtraMeta): Frame;
|
|
254
280
|
/**
|
|
255
281
|
* Resolve a stable negative integer frame handle (`-1 - frame.index`) usable directly in
|
|
@@ -280,15 +306,16 @@ declare class TextureManager {
|
|
|
280
306
|
private initBuiltins;
|
|
281
307
|
exists(key: string): boolean;
|
|
282
308
|
get(key: string): Texture;
|
|
283
|
-
addImage(key: string, source: TextureImageSource, options?: TextureImageOptions): Texture | null;
|
|
309
|
+
addImage(key: string, source: TextureImageSource | readonly TextureImageSource[], options?: TextureImageOptions): Texture | null;
|
|
284
310
|
addCanvas(key: string, canvas: HTMLCanvasElement): CanvasTexture | null;
|
|
285
311
|
createCanvas(key: string, width: number, height: number): CanvasTexture | null;
|
|
286
312
|
addSpriteSheet(key: string, source: TextureImageSource, config: SpriteSheetConfig): Texture | null;
|
|
287
313
|
/**
|
|
288
|
-
* Register a
|
|
289
|
-
* preserving per-frame trimmed pivots (`ax/ay` or `pivot`), named sockets (`anchors`), `emissiveCenter`,
|
|
314
|
+
* Register a single-page or multi-page sprite atlas (`@holtjs/craft/three`, `@holtjs/craft/atlas`, or TexturePacker / Aseprite JSON)
|
|
315
|
+
* preserving per-frame trimmed pivots (`ax/ay` or `pivot`), named sockets (`anchors`), `emissiveCenter`, `atlasYaw`,
|
|
316
|
+
* and per-frame `page` / `sourceIndex` across multiple `<= 4096x4096` GPU texture pages!
|
|
290
317
|
*/
|
|
291
|
-
addAtlas(key: string, source: TextureImageSource, atlasData: AtlasJsonLike, options?: TextureImageOptions): Texture | null;
|
|
318
|
+
addAtlas(key: string, source: TextureImageSource | readonly TextureImageSource[], atlasData: AtlasJsonLike, options?: TextureImageOptions): Texture | null;
|
|
292
319
|
remove(key: string): boolean;
|
|
293
320
|
invalidateAllGl(): void;
|
|
294
321
|
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-BOvaKn6w.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;
|
package/dist/ecs.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export interface EventTable<S extends ComponentSchema = ComponentSchema> {
|
|
|
50
50
|
/** Reset `count = 0` in O(1) without freeing underlying TypedArray buffers. */
|
|
51
51
|
clear(): void;
|
|
52
52
|
}
|
|
53
|
-
/** Declarative
|
|
53
|
+
/** Declarative relational query descriptor (`world.select(...)` / `world.query({...})`). */
|
|
54
54
|
export interface RelationalQuerySpec<R extends readonly ComponentDef<any, any>[] = readonly [], W extends readonly ComponentDef<any, any>[] = readonly []> {
|
|
55
55
|
readonly read?: R;
|
|
56
56
|
readonly write?: W;
|
|
@@ -203,8 +203,8 @@ export declare class SoaWorld {
|
|
|
203
203
|
/** Clear all per-frame `EventTable`s in O(numEventTables) at the end of a simulation tick (zero GC). */
|
|
204
204
|
clearEvents(): void;
|
|
205
205
|
/**
|
|
206
|
-
* Compile a declarative
|
|
207
|
-
*Note: column references stay live even when `SoaWorld` grows capacity!
|
|
206
|
+
* Compile a declarative relational query (`read`, `write`, `with`, `without`).
|
|
207
|
+
* Note: column references stay live even when `SoaWorld` grows capacity!
|
|
208
208
|
*/
|
|
209
209
|
select<const R extends readonly ComponentDef<any, any>[] = readonly [], const W extends readonly ComponentDef<any, any>[] = readonly []>(spec: RelationalQuerySpec<R, W>): RelationalQuery<R, W>;
|
|
210
210
|
/**
|
package/dist/ecs.js
CHANGED
|
@@ -386,8 +386,8 @@ var SoaWorld = class {
|
|
|
386
386
|
for (let i = 0; i < this.eventTableList.length; i++) this.eventTableList[i].clear();
|
|
387
387
|
}
|
|
388
388
|
/**
|
|
389
|
-
* Compile a declarative
|
|
390
|
-
*Note: column references stay live even when `SoaWorld` grows capacity!
|
|
389
|
+
* Compile a declarative relational query (`read`, `write`, `with`, `without`).
|
|
390
|
+
* Note: column references stay live even when `SoaWorld` grows capacity!
|
|
391
391
|
*/
|
|
392
392
|
select(spec) {
|
|
393
393
|
const readDefs = spec.read ?? [];
|
|
@@ -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-CnIevdNP.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);
|
|
@@ -321,16 +345,25 @@ var TextureManager = class {
|
|
|
321
345
|
const defCanvas = this.doc.createElement("canvas");
|
|
322
346
|
defCanvas.width = 1;
|
|
323
347
|
defCanvas.height = 1;
|
|
324
|
-
this.addCanvas("__DEFAULT", defCanvas);
|
|
348
|
+
if (defCanvas.getContext?.("2d", { willReadFrequently: true }) ?? null) this.addCanvas("__DEFAULT", defCanvas);
|
|
349
|
+
else this.addImage("__DEFAULT", {
|
|
350
|
+
width: 1,
|
|
351
|
+
height: 1,
|
|
352
|
+
data: /* @__PURE__ */ new Uint8Array(4)
|
|
353
|
+
});
|
|
325
354
|
const whiteCanvas = this.doc.createElement("canvas");
|
|
326
355
|
whiteCanvas.width = 2;
|
|
327
356
|
whiteCanvas.height = 2;
|
|
328
|
-
const wg = whiteCanvas.getContext("2d", { willReadFrequently: true });
|
|
357
|
+
const wg = whiteCanvas.getContext?.("2d", { willReadFrequently: true }) ?? null;
|
|
329
358
|
if (wg) {
|
|
330
359
|
wg.fillStyle = rgbToCss(WHITE_RGB, 1);
|
|
331
360
|
wg.fillRect(0, 0, 2, 2);
|
|
332
|
-
|
|
333
|
-
this.
|
|
361
|
+
this.addCanvas("__WHITE", whiteCanvas);
|
|
362
|
+
} else this.addImage("__WHITE", {
|
|
363
|
+
width: 2,
|
|
364
|
+
height: 2,
|
|
365
|
+
data: (/* @__PURE__ */ new Uint8Array(16)).fill(255)
|
|
366
|
+
});
|
|
334
367
|
}
|
|
335
368
|
exists(key) {
|
|
336
369
|
return Object.prototype.hasOwnProperty.call(this.list, key);
|
|
@@ -339,7 +372,7 @@ var TextureManager = class {
|
|
|
339
372
|
return this.list[key] ?? this.list["__DEFAULT"];
|
|
340
373
|
}
|
|
341
374
|
addImage(key, source, options) {
|
|
342
|
-
if (!source) return null;
|
|
375
|
+
if (!source || Array.isArray(source) && source.length === 0) return null;
|
|
343
376
|
if (this.exists(key)) this.remove(key);
|
|
344
377
|
const filter = options?.filterMode ?? this.defaultFilter;
|
|
345
378
|
const premultiply = options?.premultiplyAlpha ?? true;
|
|
@@ -379,8 +412,9 @@ var TextureManager = class {
|
|
|
379
412
|
return tex;
|
|
380
413
|
}
|
|
381
414
|
/**
|
|
382
|
-
* Register a
|
|
383
|
-
* preserving per-frame trimmed pivots (`ax/ay` or `pivot`), named sockets (`anchors`), `emissiveCenter`,
|
|
415
|
+
* Register a single-page or multi-page sprite atlas (`@holtjs/craft/three`, `@holtjs/craft/atlas`, or TexturePacker / Aseprite JSON)
|
|
416
|
+
* preserving per-frame trimmed pivots (`ax/ay` or `pivot`), named sockets (`anchors`), `emissiveCenter`, `atlasYaw`,
|
|
417
|
+
* and per-frame `page` / `sourceIndex` across multiple `<= 4096x4096` GPU texture pages!
|
|
384
418
|
*/
|
|
385
419
|
addAtlas(key, source, atlasData, options) {
|
|
386
420
|
const tex = this.addImage(key, source, options);
|
|
@@ -389,16 +423,19 @@ var TextureManager = class {
|
|
|
389
423
|
if (typeof root.yaw === "number" && Number.isFinite(root.yaw)) tex.atlasYaw = root.yaw;
|
|
390
424
|
if (typeof root.pitch === "number" && Number.isFinite(root.pitch)) tex.atlasPitch = root.pitch;
|
|
391
425
|
if (typeof root.scale === "number" && Number.isFinite(root.scale)) tex.atlasScale = root.scale;
|
|
392
|
-
const
|
|
393
|
-
|
|
426
|
+
const maxPage = Math.max(0, tex.source.length - 1);
|
|
427
|
+
const resolvePage = (rawPage, defaultPage) => {
|
|
428
|
+
const n = typeof rawPage === "number" && Number.isFinite(rawPage) ? Math.floor(rawPage) : defaultPage;
|
|
429
|
+
return n < 0 ? 0 : n > maxPage ? maxPage : n;
|
|
430
|
+
};
|
|
394
431
|
let probeCanvas = null;
|
|
395
432
|
let probeCtx = null;
|
|
396
433
|
const emptyRectCache = /* @__PURE__ */ new Map();
|
|
397
|
-
const detectEmptyRect = (fx, fy, fw, fh, explicitEmpty) => {
|
|
434
|
+
const detectEmptyRect = (pageIdx, fx, fy, fw, fh, explicitEmpty) => {
|
|
398
435
|
if (typeof explicitEmpty === "boolean") return explicitEmpty;
|
|
399
436
|
if (fw <= 1 && fh <= 1) return true;
|
|
400
437
|
if (fw > 64 || fh > 64) return false;
|
|
401
|
-
const rectKey = `${fx},${fy},${fw},${fh}`;
|
|
438
|
+
const rectKey = `${pageIdx}:${fx},${fy},${fw},${fh}`;
|
|
402
439
|
const cached = emptyRectCache.get(rectKey);
|
|
403
440
|
if (cached !== void 0) return cached;
|
|
404
441
|
let isEmpty = false;
|
|
@@ -411,9 +448,10 @@ var TextureManager = class {
|
|
|
411
448
|
probeCtx = probeCanvas.getContext("2d", { willReadFrequently: true }) ?? false;
|
|
412
449
|
} else probeCtx = false;
|
|
413
450
|
}
|
|
414
|
-
|
|
451
|
+
const pageImg = tex.source[pageIdx]?.image;
|
|
452
|
+
if (probeCtx && pageImg) {
|
|
415
453
|
probeCtx.clearRect(0, 0, fw, fh);
|
|
416
|
-
probeCtx.drawImage(
|
|
454
|
+
probeCtx.drawImage(pageImg, fx, fy, fw, fh, 0, 0, fw, fh);
|
|
417
455
|
const data = probeCtx.getImageData(0, 0, fw, fh).data;
|
|
418
456
|
let allZero = true;
|
|
419
457
|
for (let i = 3; i < data.length; i += 4) if (data[i] !== 0) {
|
|
@@ -428,8 +466,9 @@ var TextureManager = class {
|
|
|
428
466
|
emptyRectCache.set(rectKey, isEmpty);
|
|
429
467
|
return isEmpty;
|
|
430
468
|
};
|
|
431
|
-
const addEntry = (frameName, entry) => {
|
|
469
|
+
const addEntry = (frameName, entry, defaultPage) => {
|
|
432
470
|
if (!entry || typeof entry !== "object") return;
|
|
471
|
+
const pageIdx = resolvePage(entry.page ?? entry.sourceIndex, defaultPage);
|
|
433
472
|
if (entry.frame && typeof entry.frame === "object" && typeof entry.frame.w === "number") {
|
|
434
473
|
const fr = entry.frame;
|
|
435
474
|
const fx = Number(fr.x) || 0;
|
|
@@ -439,7 +478,7 @@ var TextureManager = class {
|
|
|
439
478
|
const meta = {
|
|
440
479
|
baseChar: entry.baseChar,
|
|
441
480
|
baseActor: entry.baseActor,
|
|
442
|
-
empty: detectEmptyRect(fx, fy, fw, fh, entry.empty)
|
|
481
|
+
empty: detectEmptyRect(pageIdx, fx, fy, fw, fh, entry.empty)
|
|
443
482
|
};
|
|
444
483
|
if (entry.pivot && typeof entry.pivot.x === "number" && typeof entry.pivot.y === "number") {
|
|
445
484
|
const px = Number(entry.pivot.x);
|
|
@@ -453,14 +492,14 @@ var TextureManager = class {
|
|
|
453
492
|
}
|
|
454
493
|
}
|
|
455
494
|
if (entry.anchors) meta.anchors = entry.anchors;
|
|
456
|
-
tex.add(frameName,
|
|
495
|
+
tex.add(frameName, pageIdx, fx, fy, fw, fh, meta);
|
|
457
496
|
return;
|
|
458
497
|
}
|
|
459
498
|
const fx = Number(entry.x) || 0;
|
|
460
499
|
const fy = Number(entry.y) || 0;
|
|
461
500
|
const fw = Number(entry.w ?? entry.width) || 0;
|
|
462
501
|
const fh = Number(entry.h ?? entry.height) || 0;
|
|
463
|
-
tex.add(frameName,
|
|
502
|
+
tex.add(frameName, pageIdx, fx, fy, fw, fh, {
|
|
464
503
|
ax: typeof entry.ax === "number" ? entry.ax : void 0,
|
|
465
504
|
ay: typeof entry.ay === "number" ? entry.ay : void 0,
|
|
466
505
|
pivotX: typeof entry.pivotX === "number" ? entry.pivotX : void 0,
|
|
@@ -477,14 +516,25 @@ var TextureManager = class {
|
|
|
477
516
|
frame: typeof entry.frame === "number" ? entry.frame : void 0,
|
|
478
517
|
frames: entry.frames,
|
|
479
518
|
loop: entry.loop,
|
|
480
|
-
empty: detectEmptyRect(fx, fy, fw, fh, entry.empty)
|
|
519
|
+
empty: detectEmptyRect(pageIdx, fx, fy, fw, fh, entry.empty)
|
|
481
520
|
});
|
|
482
521
|
};
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
522
|
+
const ingestFrames = (framesNode, defaultPage) => {
|
|
523
|
+
if (!framesNode) return;
|
|
524
|
+
if (Array.isArray(framesNode)) for (let i = 0; i < framesNode.length; i++) {
|
|
525
|
+
const item = framesNode[i];
|
|
526
|
+
const name = String(item?.filename ?? item?.name ?? item?.key ?? i);
|
|
527
|
+
addEntry(name, item, defaultPage);
|
|
528
|
+
}
|
|
529
|
+
else if (typeof framesNode === "object") for (const [name, item] of Object.entries(framesNode)) addEntry(name, item, defaultPage);
|
|
530
|
+
};
|
|
531
|
+
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;
|
|
532
|
+
if (multiPages) for (let p = 0; p < multiPages.length; p++) {
|
|
533
|
+
const pageObj = multiPages[p];
|
|
534
|
+
if (pageObj && typeof pageObj === "object" && pageObj.frames) ingestFrames(pageObj.frames, p);
|
|
486
535
|
}
|
|
487
|
-
|
|
536
|
+
const rawFrames = root.frames ?? atlasData.frames;
|
|
537
|
+
if (rawFrames) ingestFrames(rawFrames, 0);
|
|
488
538
|
return tex;
|
|
489
539
|
}
|
|
490
540
|
remove(key) {
|
|
@@ -2737,15 +2787,20 @@ var RendererGl = class extends EventEmitter {
|
|
|
2737
2787
|
src.glRepeat = canRepeat;
|
|
2738
2788
|
src.glPremultiplyAlpha = src.premultiplyAlpha;
|
|
2739
2789
|
this.bindTextureAt(0, this.dummyTex);
|
|
2740
|
-
} else if (!isNew && src.glWidth === src.width && src.glHeight === src.height && src.glRepeat === canRepeat && src.glPremultiplyAlpha === src.premultiplyAlpha)
|
|
2741
|
-
|
|
2790
|
+
} else if (!isNew && src.glWidth === src.width && src.glHeight === src.height && src.glRepeat === canRepeat && src.glPremultiplyAlpha === src.premultiplyAlpha) {
|
|
2791
|
+
const rawBuf = src.image?.data;
|
|
2792
|
+
if (rawBuf instanceof Uint8Array || rawBuf instanceof Uint8ClampedArray) gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, src.width, src.height, gl.RGBA, gl.UNSIGNED_BYTE, rawBuf);
|
|
2793
|
+
else gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, src.image);
|
|
2794
|
+
} else {
|
|
2742
2795
|
const wrap = canRepeat ? gl.REPEAT : gl.CLAMP_TO_EDGE;
|
|
2743
2796
|
const filt = src.filterMode === FilterMode.NEAREST ? gl.NEAREST : gl.LINEAR;
|
|
2744
2797
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrap);
|
|
2745
2798
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrap);
|
|
2746
2799
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filt);
|
|
2747
2800
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filt);
|
|
2748
|
-
|
|
2801
|
+
const rawBuf = src.image?.data;
|
|
2802
|
+
if (rawBuf instanceof Uint8Array || rawBuf instanceof Uint8ClampedArray) gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, src.width, src.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, rawBuf);
|
|
2803
|
+
else gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, src.image);
|
|
2749
2804
|
src.glWidth = src.width;
|
|
2750
2805
|
src.glHeight = src.height;
|
|
2751
2806
|
src.glRepeat = canRepeat;
|
|
@@ -3785,7 +3840,7 @@ var RendererGl = class extends EventEmitter {
|
|
|
3785
3840
|
const outlineAlpha = icon.outlineAlpha * alpha;
|
|
3786
3841
|
const outlineW = icon.outlineWidth;
|
|
3787
3842
|
if (fillAlpha <= 0 && (outlineW <= 0 || outlineAlpha <= 0)) return;
|
|
3788
|
-
const src = icon.texture?.source?.[0];
|
|
3843
|
+
const src = icon.frame?.source ?? icon.texture?.source?.[0];
|
|
3789
3844
|
if (!src || src.width <= 1 || src.height <= 1) return;
|
|
3790
3845
|
const ox = icon.displayOriginX;
|
|
3791
3846
|
const oy = icon.displayOriginY;
|
|
@@ -3876,19 +3931,23 @@ var RendererGl = class extends EventEmitter {
|
|
|
3876
3931
|
}
|
|
3877
3932
|
renderInstancedBatch(batch, m, alpha) {
|
|
3878
3933
|
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;
|
|
3934
|
+
if (!cols || cols.count <= 0 || !batch.texture) return;
|
|
3884
3935
|
this.setBlend(batch.blendMode);
|
|
3885
3936
|
const n = Math.min(cols.count, batch.maxCount, cols.x.length, cols.y.length);
|
|
3886
3937
|
if (n <= 0) return;
|
|
3887
3938
|
if (!this.ensureInstancedResources()) {
|
|
3888
|
-
|
|
3939
|
+
let lastSrc = null;
|
|
3940
|
+
let lastGlTex = null;
|
|
3889
3941
|
for (let i = 0; i < n; i++) {
|
|
3890
3942
|
const s = cols.order ? cols.order[i] : i;
|
|
3891
3943
|
const fr = cols.frameIndex ? batch.texture.get(cols.frameIndex[s]) : batch.defaultFrame;
|
|
3944
|
+
if (!fr || fr.empty || fr.width <= 0 || fr.height <= 0) continue;
|
|
3945
|
+
if (fr.source !== lastSrc) {
|
|
3946
|
+
lastSrc = fr.source;
|
|
3947
|
+
lastGlTex = this.ensureGlTexture(lastSrc);
|
|
3948
|
+
}
|
|
3949
|
+
if (!lastGlTex) continue;
|
|
3950
|
+
const unit = this.assignTextureUnit(lastGlTex);
|
|
3892
3951
|
const sx = cols.scaleX ? cols.scaleX[s] : 1;
|
|
3893
3952
|
const sy = cols.scaleY ? cols.scaleY[s] : sx;
|
|
3894
3953
|
const a = alpha * (cols.alpha ? cols.alpha[s] : 1);
|
|
@@ -3916,12 +3975,42 @@ var RendererGl = class extends EventEmitter {
|
|
|
3916
3975
|
const ma = m.a, mb = m.b, mc = m.c, md = m.d, mtx = m.tx, mty = m.ty;
|
|
3917
3976
|
const oxRatio = batch.originX;
|
|
3918
3977
|
const oyRatio = batch.originY;
|
|
3978
|
+
const gl2 = this.gl;
|
|
3919
3979
|
let vis = 0;
|
|
3980
|
+
let curSrc = null;
|
|
3981
|
+
let curGlTex = null;
|
|
3982
|
+
let boundProg = false;
|
|
3983
|
+
const flushSubRun = () => {
|
|
3984
|
+
if (vis === 0 || !curGlTex) return;
|
|
3985
|
+
if (!boundProg) {
|
|
3986
|
+
gl2.useProgram(this.instProgram);
|
|
3987
|
+
if (this.instUres) gl2.uniform2f(this.instUres, this.width, this.height);
|
|
3988
|
+
applyGlBlendMode(gl2, this.curBlend);
|
|
3989
|
+
gl2.bindVertexArray(this.instVao);
|
|
3990
|
+
gl2.bindBuffer(gl2.ARRAY_BUFFER, this.instDataVbo);
|
|
3991
|
+
boundProg = true;
|
|
3992
|
+
}
|
|
3993
|
+
this.bindTextureAt(0, curGlTex);
|
|
3994
|
+
gl2.bufferData(gl2.ARRAY_BUFFER, f32.subarray(0, vis * INST_FLOATS), gl2.STREAM_DRAW);
|
|
3995
|
+
gl2.drawElementsInstanced(gl2.TRIANGLES, 6, gl2.UNSIGNED_SHORT, 0, vis);
|
|
3996
|
+
this.curDrawCalls++;
|
|
3997
|
+
this.curFlushes++;
|
|
3998
|
+
this.curQuads += vis;
|
|
3999
|
+
this.curTris += vis * 2;
|
|
4000
|
+
vis = 0;
|
|
4001
|
+
};
|
|
3920
4002
|
for (let i = 0; i < n; i++) {
|
|
3921
4003
|
const s = cols.order ? cols.order[i] : i;
|
|
3922
4004
|
const instA = alpha * (cols.alpha ? cols.alpha[s] : 1);
|
|
3923
4005
|
if (instA <= 0) continue;
|
|
3924
4006
|
const fr = cols.frameIndex ? batch.texture.get(cols.frameIndex[s]) : batch.defaultFrame;
|
|
4007
|
+
if (!fr || fr.empty || fr.width <= 0 || fr.height <= 0) continue;
|
|
4008
|
+
if (fr.source !== curSrc) {
|
|
4009
|
+
flushSubRun();
|
|
4010
|
+
curSrc = fr.source;
|
|
4011
|
+
curGlTex = this.ensureGlTexture(curSrc);
|
|
4012
|
+
}
|
|
4013
|
+
if (!curGlTex) continue;
|
|
3925
4014
|
const sx = (cols.scaleX ? cols.scaleX[s] : 1) * fr.width;
|
|
3926
4015
|
const sy = (cols.scaleY ? cols.scaleY[s] : cols.scaleX ? cols.scaleX[s] : 1) * fr.height;
|
|
3927
4016
|
const rot = cols.rotation ? cols.rotation[s] : 0;
|
|
@@ -3963,22 +4052,11 @@ var RendererGl = class extends EventEmitter {
|
|
|
3963
4052
|
u32[base + 10] = packColorAbgr(rgb, instA);
|
|
3964
4053
|
vis++;
|
|
3965
4054
|
}
|
|
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();
|
|
4055
|
+
flushSubRun();
|
|
4056
|
+
if (boundProg) {
|
|
4057
|
+
gl2.bindVertexArray(null);
|
|
4058
|
+
this.invalidateProgramState();
|
|
4059
|
+
}
|
|
3982
4060
|
}
|
|
3983
4061
|
/** Create an offscreen WebGL framebuffer target backed by a registered Stage `Texture` (`key`). */
|
|
3984
4062
|
createRenderTarget(key, width, height, textures, filterMode = FilterMode.LINEAR) {
|
|
@@ -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-BOvaKn6w.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
|
}
|
|
@@ -1405,41 +1407,56 @@ declare class RendererWebGpu extends EventEmitter {
|
|
|
1405
1407
|
private uploadScratchCanvas;
|
|
1406
1408
|
private uploadScratchCtx;
|
|
1407
1409
|
private readonly globalsBuf;
|
|
1408
|
-
private
|
|
1409
|
-
private
|
|
1410
|
+
private vbo;
|
|
1411
|
+
private ibo;
|
|
1410
1412
|
private readonly sdfCornerVbo;
|
|
1411
|
-
private
|
|
1413
|
+
private sdfInstVbo;
|
|
1412
1414
|
private readonly sdfQuadIbo;
|
|
1413
1415
|
private readonly samplerLinear;
|
|
1414
1416
|
private readonly samplerNearest;
|
|
1417
|
+
private readonly samplerLinearRepeat;
|
|
1418
|
+
private readonly samplerNearestRepeat;
|
|
1415
1419
|
private readonly batchBgl;
|
|
1416
1420
|
private readonly sdfBgl;
|
|
1417
1421
|
private readonly sdfBindGroup;
|
|
1422
|
+
private readonly batchMod;
|
|
1423
|
+
private readonly batchLayout;
|
|
1424
|
+
private readonly sdfMod;
|
|
1425
|
+
private readonly sdfLayout;
|
|
1418
1426
|
private readonly batchPipelines;
|
|
1419
1427
|
private readonly sdfPipelines;
|
|
1420
1428
|
private readonly texCache;
|
|
1421
1429
|
private dummyEntry;
|
|
1422
|
-
private
|
|
1423
|
-
private
|
|
1424
|
-
private
|
|
1425
|
-
private
|
|
1426
|
-
private
|
|
1427
|
-
private
|
|
1428
|
-
private
|
|
1430
|
+
private vertCap;
|
|
1431
|
+
private indexCap;
|
|
1432
|
+
private vertRaw;
|
|
1433
|
+
private f32;
|
|
1434
|
+
private u32;
|
|
1435
|
+
private indices;
|
|
1436
|
+
private sdfCap;
|
|
1437
|
+
private sdfRaw;
|
|
1438
|
+
private sdfF32;
|
|
1439
|
+
private sdfU32;
|
|
1429
1440
|
private vertCount;
|
|
1430
1441
|
private indexCount;
|
|
1431
1442
|
private cmdStartIndex;
|
|
1432
1443
|
private sdfCount;
|
|
1433
1444
|
private sdfCmdStart;
|
|
1445
|
+
private curTargetW;
|
|
1446
|
+
private curTargetH;
|
|
1434
1447
|
private curBlend;
|
|
1435
1448
|
private curBindGroup;
|
|
1436
|
-
private
|
|
1437
|
-
private
|
|
1449
|
+
private cmds;
|
|
1450
|
+
private scissorStack;
|
|
1438
1451
|
private readonly matPool;
|
|
1439
1452
|
private readonly sfMat;
|
|
1440
1453
|
private readonly maskWorldMat;
|
|
1441
1454
|
private lastStats;
|
|
1442
1455
|
constructor(canvas: HTMLCanvasElement, width: number, height: number, opts: RendererWebGpuOptions);
|
|
1456
|
+
private getBatchPipeline;
|
|
1457
|
+
private getSdfPipeline;
|
|
1458
|
+
private ensureBatchCapacity;
|
|
1459
|
+
private ensureSdfCapacity;
|
|
1443
1460
|
private makeBatchBindGroup;
|
|
1444
1461
|
stats(): RendererStats;
|
|
1445
1462
|
resize(width: number, height: number): void;
|
|
@@ -1458,6 +1475,7 @@ declare class RendererWebGpu extends EventEmitter {
|
|
|
1458
1475
|
private renderPanel;
|
|
1459
1476
|
private renderGraphics;
|
|
1460
1477
|
private renderNode;
|
|
1478
|
+
private executePass;
|
|
1461
1479
|
render(displayList: DisplayList, camera: Camera): void;
|
|
1462
1480
|
private encodeCopyToStaging;
|
|
1463
1481
|
private unpackStagingBytes;
|
|
@@ -1471,9 +1489,9 @@ declare class RendererWebGpu extends EventEmitter {
|
|
|
1471
1489
|
* (`wgpu-native` FFI, Google Dawn `webgpu`, Deno `navigator.gpu`, and Browser WebGPU).
|
|
1472
1490
|
*/
|
|
1473
1491
|
readPixelsAsync(out?: Uint8Array): Promise<Uint8Array>;
|
|
1474
|
-
/** Create an offscreen render target backed by a registered Stage `Texture` (`key`) for WebGPU passes (e.g. `Lighting2DSystem`). */
|
|
1492
|
+
/** Create an offscreen GPU render target backed by a registered Stage `Texture` (`key`) for WebGPU passes (e.g. `Lighting2DSystem`). */
|
|
1475
1493
|
createRenderTarget(key: string, width: number, height: number, textures: TextureManager, filterMode?: 0 | 1): StageRenderTarget;
|
|
1476
|
-
/** Render a `DisplayList`
|
|
1494
|
+
/** Render a `DisplayList` natively on the GPU into an offscreen `StageRenderTarget` (zero CPU Canvas2D copy!). */
|
|
1477
1495
|
renderToTarget(target: StageRenderTarget, content: DisplayList | ((renderer: Renderer2D, camera: Camera) => void), camera?: Camera): void;
|
|
1478
1496
|
destroy(): void;
|
|
1479
1497
|
}
|