rig-play 0.8.0 → 1.1.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.
Files changed (44) hide show
  1. package/NOTICE.md +50 -23
  2. package/README.md +511 -456
  3. package/dist/CanvasRenderer.d.ts +139 -0
  4. package/dist/CanvasRenderer.d.ts.map +1 -0
  5. package/dist/{SpineHtmlRenderer.d.ts → DomRenderer.d.ts} +70 -65
  6. package/dist/DomRenderer.d.ts.map +1 -0
  7. package/dist/DomTexture.d.ts +34 -14
  8. package/dist/DomTexture.d.ts.map +1 -1
  9. package/dist/MeshGlBlitter.d.ts +67 -1
  10. package/dist/MeshGlBlitter.d.ts.map +1 -1
  11. package/dist/index.d.ts +6 -4
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +7470 -5
  14. package/dist/index.js.map +1 -1
  15. package/dist/loadModel.d.ts +92 -0
  16. package/dist/loadModel.d.ts.map +1 -0
  17. package/dist/player.d.ts +198 -0
  18. package/dist/player.d.ts.map +1 -0
  19. package/dist/posedFrame.d.ts +99 -0
  20. package/dist/posedFrame.d.ts.map +1 -0
  21. package/package.json +13 -19
  22. package/dist/DomTexture.js +0 -520
  23. package/dist/DomTexture.js.map +0 -1
  24. package/dist/MeshGlBlitter.js +0 -365
  25. package/dist/MeshGlBlitter.js.map +0 -1
  26. package/dist/SpineHtmlRenderer.d.ts.map +0 -1
  27. package/dist/SpineHtmlRenderer.js +0 -1107
  28. package/dist/SpineHtmlRenderer.js.map +0 -1
  29. package/dist/binary.d.ts +0 -48
  30. package/dist/binary.d.ts.map +0 -1
  31. package/dist/binary.js +0 -29
  32. package/dist/binary.js.map +0 -1
  33. package/dist/coreCompat.d.ts +0 -153
  34. package/dist/coreCompat.d.ts.map +0 -1
  35. package/dist/coreCompat.js +0 -136
  36. package/dist/coreCompat.js.map +0 -1
  37. package/dist/loadAtlasAssets.d.ts +0 -73
  38. package/dist/loadAtlasAssets.d.ts.map +0 -1
  39. package/dist/loadAtlasAssets.js +0 -75
  40. package/dist/loadAtlasAssets.js.map +0 -1
  41. package/dist/loadSkeletonAssets.d.ts +0 -88
  42. package/dist/loadSkeletonAssets.d.ts.map +0 -1
  43. package/dist/loadSkeletonAssets.js +0 -79
  44. package/dist/loadSkeletonAssets.js.map +0 -1
@@ -0,0 +1,139 @@
1
+ import type { PosedFrame } from './posedFrame.js';
2
+ /** What actually drew the last frame of a `CanvasRenderer`. */
3
+ export type CanvasBackend = 'webgl' | 'canvas2d';
4
+ /** A rectangle of world space, Y up: `x`, `y` is its bottom-left corner. */
5
+ export interface CanvasViewport {
6
+ x: number;
7
+ y: number;
8
+ width: number;
9
+ height: number;
10
+ }
11
+ /**
12
+ * Renders a posed frame (`PosedFrame`) into **one `<canvas>`** — the canvas
13
+ * render mode, beside the DOM tier (`DomRenderer`) and with the same
14
+ * `render(frame)` interface.
15
+ *
16
+ * Every slot is drawn as textured triangles straight from its atlas page — a
17
+ * region as two triangles over its four corners and its page UVs, a mesh as its
18
+ * own triangles — through the **shared module-level WebGL context** of the mesh
19
+ * blitter (`MeshGlBlitter.ts`), into one rect of its offscreen buffer, and the
20
+ * rect is copied onto this renderer's visible canvas with one `drawImage`. No
21
+ * context is created per renderer, so any number of players draw under the
22
+ * browser's ~16-context cap, and the page textures are shared and
23
+ * reference-counted with every other renderer on the page.
24
+ *
25
+ * - **Tint** (slot × attachment × the player's colour) is a vertex colour,
26
+ * premultiplied by its alpha; the **dark** (two-colour) tint is a second
27
+ * vertex colour, carried only when some slot of the frame has one.
28
+ * - **Blend** is batch state: a run of triangles ends wherever the page or the
29
+ * blend mode changes (`drawCalls`, and `blendFlushes` for the blend changes).
30
+ * The blends are composed inside this canvas's own rect, which starts
31
+ * transparent — an additive or multiply slot meets the slots under it, not
32
+ * the page behind the canvas.
33
+ * - **Clipping** is the core's cut: every triangle a clip covers goes through
34
+ * `clipThrough` from `rig-c/core` (convex polygons by the runtime's measured
35
+ * rule, concave ones into convex pieces, inverse clips as the hull's
36
+ * outside). No stencil, no `clip-path`.
37
+ * - **Projection**: the canvas covers a rect of the root's own coordinates
38
+ * (world x, world −y — the DOM tier's frame), so a world point lands at
39
+ * `((x − left) · pixelRatio, (−y − top) · pixelRatio)` device px. That rect
40
+ * is the caller's `viewport` when set, and otherwise grows to cover what the
41
+ * frames draw (grow-only, so steady animation reallocates nothing).
42
+ * - **Dirty-skip**: a frame whose record equals the last one drawn — vertex
43
+ * arrays, tints, order, clips, pages — draws nothing (`framesReused`).
44
+ *
45
+ * When WebGL is unavailable or the shared context is lost, the frame is drawn
46
+ * on the same visible canvas with canvas2d: regions by `drawImage` under their
47
+ * affine, meshes and clipped pieces by the DOM tier's per-triangle mapping.
48
+ * That fallback multiplies **alpha only** — RGB and dark tints are not drawn
49
+ * there (`ctx.filter` is not available on Safari) — and it is a safety net,
50
+ * not the measured path.
51
+ */
52
+ export declare class CanvasRenderer {
53
+ private readonly root;
54
+ private readonly pages;
55
+ /** Backing-store pixels per root CSS pixel; defaults to the device pixel ratio. Fold a root scale in, as for the DOM tier. */
56
+ pixelRatio: number;
57
+ /** Apply the clips the frame carries (default). False draws every slot unclipped and counts the clips in `clipSkipCount`. */
58
+ clipping: boolean;
59
+ /**
60
+ * The world rect the canvas covers. Null (default) sizes it from the frames
61
+ * themselves: it grows to cover everything drawn and never shrinks. Set it to
62
+ * pin the canvas to a stage box; what falls outside is not drawn.
63
+ */
64
+ viewport: CanvasViewport | null;
65
+ /** The backend to draw with: 'webgl' (default) through the shared context, or 'canvas2d' to force the fallback. */
66
+ backend: CanvasBackend;
67
+ /** What drew the last frame (or would have, had it not been reused). */
68
+ backendActive: CanvasBackend;
69
+ /** The visible canvas — the renderer's one element in the root. */
70
+ readonly canvas: HTMLCanvasElement;
71
+ /** Draw calls issued last frame — one per run of one page under one blend. */
72
+ drawCalls: number;
73
+ /** Of those runs, how many began because the blend mode changed. */
74
+ blendFlushes: number;
75
+ /** Triangles drawn last frame, clipped pieces counted as cut. */
76
+ trianglesDrawn: number;
77
+ /** 1 when the last render() found the record unchanged and drew nothing, else 0. */
78
+ framesReused: number;
79
+ /** Blits onto the visible canvas last frame (0 or 1). */
80
+ blits: number;
81
+ /** Visible-canvas backing reallocations last frame; settles at zero. */
82
+ canvasReallocCount: number;
83
+ /** Distinct clips applied last frame. */
84
+ clipCount: number;
85
+ /** Clips in the frame not applied last frame: `clipping` off, fewer than three points, or a polygon the core refuses to cut. */
86
+ clipSkipCount: number;
87
+ private readonly ctx;
88
+ /** The rect in root units the canvas covers: left, top, right, bottom (Y down). Empty until the first frame. */
89
+ private left;
90
+ private top;
91
+ private right;
92
+ private bottom;
93
+ private hasRect;
94
+ private backingW;
95
+ private backingH;
96
+ private backingRatio;
97
+ private data;
98
+ private readonly runs;
99
+ /** Pages retained from the shared blitter, one retain each, released by dispose(). */
100
+ private readonly glPages;
101
+ /** The dirty signature of the last frame drawn: its numbers, and the objects it compares by identity. */
102
+ private sig;
103
+ private sigLength;
104
+ private sigRefs;
105
+ private nextSig;
106
+ private nextRefs;
107
+ /**
108
+ * @param root Positioned element that becomes the skeleton origin, exactly as
109
+ * for `DomRenderer`: the canvas is appended to it and placed in its own
110
+ * coordinates; layout and scaling of the root belong to the caller.
111
+ * @param pages Page images keyed by page name — `PosedRegion.page` and
112
+ * `PosedMesh.page`. Read on every draw.
113
+ */
114
+ constructor(root: HTMLElement, pages: ReadonlyMap<string, HTMLImageElement>);
115
+ /** Grows the automatic viewport to cover `box` (world units, Y up) ahead of the frames reaching it. */
116
+ reserve(box: CanvasViewport): void;
117
+ /** Draws one frame. */
118
+ render(frame: PosedFrame): void;
119
+ /** Removes the canvas from the root and hands the pages it uploaded back to the shared blitter. Idempotent. */
120
+ dispose(): void;
121
+ private growTo;
122
+ private setRect;
123
+ /** The backing store at `rect × pixelRatio`; reallocated only when that changes. */
124
+ private sizeBacking;
125
+ /** Writes this frame's signature and compares it with the last one drawn; keeps it when it differs. */
126
+ private signatureChanged;
127
+ /** The clip counters for a reused frame — what drawing it would have counted. */
128
+ private countClips;
129
+ private stride;
130
+ /**
131
+ * The slot's triangles in world space with their page UVs — cut by the clip
132
+ * over it when one applies — or null when the slot draws nothing.
133
+ */
134
+ private piecesOf;
135
+ /** Fills `data` and `runs` for the GL path. */
136
+ private buildVertices;
137
+ private draw2d;
138
+ }
139
+ //# sourceMappingURL=CanvasRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CanvasRenderer.d.ts","sourceRoot":"","sources":["../src/CanvasRenderer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAwB,UAAU,EAAa,MAAM,iBAAiB,CAAC;AAEnF,+DAA+D;AAC/D,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,UAAU,CAAC;AAEjD,4EAA4E;AAC5E,MAAM,WAAW,cAAc;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAYD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,qBAAa,cAAc;IAgEvB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAhExB,8HAA8H;IAC9H,UAAU,SAA+D;IACzE,6HAA6H;IAC7H,QAAQ,UAAQ;IAChB;;;;OAIG;IACH,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAQ;IACvC,mHAAmH;IACnH,OAAO,EAAE,aAAa,CAAW;IACjC,wEAAwE;IACxE,aAAa,EAAE,aAAa,CAAW;IACvC,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAEnC,8EAA8E;IAC9E,SAAS,SAAK;IACd,oEAAoE;IACpE,YAAY,SAAK;IACjB,iEAAiE;IACjE,cAAc,SAAK;IACnB,oFAAoF;IACpF,YAAY,SAAK;IACjB,yDAAyD;IACzD,KAAK,SAAK;IACV,wEAAw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,OAAO,CAAC,aAAa;IAmErB,OAAO,CAAC,MAAM;CAmEf"}
@@ -1,14 +1,14 @@
1
- import { type Skeleton } from '@esotericsoftware/spine-core';
2
1
  import { type RegionImage } from './DomTexture.js';
2
+ import type { PosedFrame } from './posedFrame.js';
3
3
  /** Rasterizer used for the mesh (deform) tier. */
4
4
  export type MeshBackend = 'canvas2d' | 'webgl';
5
5
  /**
6
- * Renders a spine-core Skeleton as DOM, split by slot type:
6
+ * Renders a posed frame (`PosedFrame`) as DOM, split by slot kind:
7
7
  *
8
- * - Region attachments (rigid parts) become one absolutely-positioned <img>
8
+ * - Region slots (rigid parts) become one absolutely-positioned <img>
9
9
  * posed with a single CSS matrix() write per frame — exact, since bone
10
10
  * transforms are affine.
11
- * - Mesh attachments (deform parts) each get a small per-part <canvas> sized
11
+ * - Mesh slots (deform parts) each get a small per-part <canvas> sized
12
12
  * to the mesh's world bounding box, redrawn per frame — either with the
13
13
  * standard per-triangle clip+transform+drawImage mapping (default), or via
14
14
  * a shared offscreen WebGL canvas that rect-blits into the same per-part
@@ -17,48 +17,50 @@ export type MeshBackend = 'canvas2d' | 'webgl';
17
17
  *
18
18
  * Both element kinds share one stacking context, so draw order interleaves
19
19
  * freely via z-index (rear hair canvas < torso img < front hair canvas).
20
- * RGB tint (skeleton × slot × attachment color) is applied per element with
21
- * an SVG feColorMatrix reference filter — exact channel multiply, works the
22
- * same on <img> and <canvas>. Dark (two-color) tint is not expressible that
23
- * way and is unsupported. Clipping attachments become a CSS clip-path per
24
- * element, in that element's own local frame, on spine-core's semantics — one
25
- * active clip at a time, ending at the end slot inclusive (see `clipping`).
20
+ * The RGB tint the frame carries (slot × attachment × the player's colour) is
21
+ * applied per element with an SVG feColorMatrix reference filter — exact
22
+ * channel multiply, works the same on <img> and <canvas>. Dark (two-color)
23
+ * tint is not expressible that way and is unsupported. A clip the frame
24
+ * carries becomes a CSS clip-path per element, in that element's own local
25
+ * frame (see `clipping`) — which slots a clip covers is decided by the poser's
26
+ * adapter (`frameOf`), not here.
26
27
  *
27
- * Coordinate mapping: Spine is Y-up, CSS is Y-down — world Y is negated.
28
- * spine-core computes everything (bones, constraints, physics, deformed
29
- * vertices) on the CPU; this class only draws.
28
+ * Coordinate mapping: the frame is world space, Y-up; CSS is Y-down — world Y
29
+ * is negated. The poser computes everything (bones, constraints, physics,
30
+ * deformed vertices) on the CPU; this class only draws.
30
31
  */
31
- export declare class SpineHtmlRenderer {
32
+ export declare class DomRenderer {
32
33
  private readonly root;
33
34
  private readonly regionImages;
35
+ private readonly pages;
34
36
  /**
35
- * Apply clipping attachments (default). Each element drawn inside an active
37
+ * Apply the clips the frame carries (default). Each element drawn inside a
36
38
  * clip gets a CSS `clip-path` in its own local frame — an element-level
37
39
  * feature, so both mesh backends see exactly the same thing and neither
38
40
  * raster path knows clipping exists.
39
41
  *
40
- * spine-core's semantics, not an approximation of them: one clip is active
41
- * at a time (a second clipping attachment met while one is active is
42
- * ignored, as SkeletonClipping.clipStart does), a clip applies to the slots
43
- * drawn after its own slot through its end slot inclusive, and an end slot
44
- * that is the clip's own slot — or one already passed — never ends it, so
45
- * the clip runs to the end of the draw order. That last case is the
46
- * whole-skeleton clip, and it takes a fast path: one `clip-path` on the root
47
- * instead of one per element. The root is the caller's element, so its
48
- * inline `clip-path` is borrowed — saved on the first write and restored
49
- * when the clip stops covering the frame, when `clipping` goes false, and by
50
- * `dispose()`.
42
+ * Which slots a clip covers is the frame's, decided by the adapter on the
43
+ * runtime's semantics (`clipCover` in posedFrame.ts: one clip in force at a
44
+ * time, a second one met while one is in force ignored, a clip covering the
45
+ * slots after its own through its end slot inclusive, an end slot that is
46
+ * the clip's own slot — or one already passed — never ending it). A clip
47
+ * that covers every slot of the frame is the whole-skeleton clip, and it
48
+ * takes a fast path: one `clip-path` on the root instead of one per element.
49
+ * The root is the caller's element, so its inline `clip-path` is borrowed —
50
+ * saved on the first write and restored when the clip stops covering the
51
+ * frame, when `clipping` goes false, and by `dispose()`.
51
52
  *
52
53
  * False restores the pre-0.6 behaviour: clips are counted in clipSkipCount
53
54
  * and nothing is clipped, with any clip-path this renderer wrote removed.
54
55
  */
55
56
  clipping: boolean;
56
- /** Clipping attachments applied last frame. */
57
+ /** Clips applied last frame — distinct clip polygons over the drawn slots. */
57
58
  clipCount: number;
58
59
  /**
59
- * Clipping attachments NOT applied last frame: `clipping` is false, another
60
- * clip was already active (spine-core ignores the second one), the slot's
61
- * bone is inactive, or the polygon has fewer than three points.
60
+ * Clips in the frame NOT applied last frame: `clipping` is false, or the
61
+ * polygon has fewer than three points. A clip the runtime itself ignores (a
62
+ * second one met while one is in force, one on an inactive bone) never
63
+ * reaches the frame, so it is not counted here.
62
64
  */
63
65
  clipSkipCount: number;
64
66
  /**
@@ -110,14 +112,9 @@ export declare class SpineHtmlRenderer {
110
112
  meshBackend: MeshBackend;
111
113
  /** Backend that actually rasterized the mesh tier during the last render(). */
112
114
  meshBackendActive: MeshBackend;
113
- /**
114
- * How this renderer reaches spine-core, picked from the first skeleton it is
115
- * handed and then reused — see coreCompat.ts. Null until then, because the
116
- * constructor has no skeleton to look at and the installed core is not
117
- * knowable from the root element.
118
- */
119
- private core;
120
115
  private readonly views;
116
+ /** Counts render() calls: the stamp a view drawn this frame carries (`SlotView.drawnIn`). */
117
+ private frameNumber;
121
118
  private readonly pendingJobs;
122
119
  private readonly pendingViews;
123
120
  /**
@@ -126,16 +123,22 @@ export declare class SpineHtmlRenderer {
126
123
  * that never leaves canvas2d holds nothing and gives nothing back.
127
124
  */
128
125
  private glPages;
126
+ /**
127
+ * World vertices copied out of the frame. Float32, as the rigid and mesh
128
+ * paths have always read them: the raster, the dirty signature and the
129
+ * clip-path quantization below are calibrated on single-precision
130
+ * coordinates, and the frame's doubles are rounded here once rather than
131
+ * changing what those paths see.
132
+ */
129
133
  private scratchVertices;
130
134
  private tintDefs;
131
- /** The clip in force at the current point of the draw order, if any. */
132
- private clipAttachment;
133
- private clipEndSlot;
135
+ /** The clip whose polygon is loaded in `clipPolygon`, if any. */
136
+ private clipActive;
137
+ /** The clips counted so far this frame, applied or skipped — one count each. */
138
+ private readonly clipsSeen;
134
139
  private clipInverse;
135
140
  /** True while the active clip is served by one clip-path on the root. */
136
141
  private clipOnRoot;
137
- /** Whether any element has been drawn yet this frame (the fast-path test). */
138
- private drewAnything;
139
142
  /** The active clip polygon in CSS space (Y already negated), flat x,y. */
140
143
  private clipPolygon;
141
144
  private clipPolygonLength;
@@ -151,9 +154,13 @@ export declare class SpineHtmlRenderer {
151
154
  * @param root Positioned element (e.g. position:absolute) that becomes the
152
155
  * skeleton origin. The renderer only appends slot elements to it — layout
153
156
  * and scaling of the root belong to the caller.
154
- * @param regionImages Unpacked per-region bitmaps (for the rigid tier).
157
+ * @param regionImages Unpacked per-region bitmaps (for the rigid tier),
158
+ * keyed by region name — `PosedRegion.region`.
159
+ * @param pages Page images (for the mesh tier), keyed by page name —
160
+ * `PosedMesh.page`. Read on every mesh draw, so a caller may fill it after
161
+ * construction.
155
162
  */
156
- constructor(root: HTMLElement, regionImages: Map<string, RegionImage>);
163
+ constructor(root: HTMLElement, regionImages: ReadonlyMap<string, RegionImage>, pages?: ReadonlyMap<string, HTMLImageElement>);
157
164
  /**
158
165
  * Backing-store pixels currently allocated across the mesh canvases
159
166
  * (Σ width × height). Computed on demand from the views — nothing is
@@ -204,7 +211,12 @@ export declare class SpineHtmlRenderer {
204
211
  * @returns the pixel ratio now in effect (the current one if nothing moved).
205
212
  */
206
213
  syncPixelRatio(): number;
207
- render(skeleton: Skeleton): void;
214
+ /**
215
+ * Draws one frame. Slots the frame does not carry — no attachment, a
216
+ * clipping attachment, an inactive bone, a kind the DOM tier does not draw —
217
+ * are hidden, their elements kept for when they draw again.
218
+ */
219
+ render(frame: PosedFrame): void;
208
220
  /**
209
221
  * Removes every element this renderer added to the root (slot elements and
210
222
  * the tint filter defs), restores the root's own inline `clip-path` if the
@@ -297,27 +309,20 @@ export declare class SpineHtmlRenderer {
297
309
  */
298
310
  private drawTriangle;
299
311
  /**
300
- * Begins a clip, mirroring SkeletonClipping.clipStart — whose first line is
301
- * `if (this.clipAttachment) return`, so a second clipping attachment met
302
- * while one is active is ignored rather than nested.
303
- *
304
- * The polygon is spine-core's: computeWorldVertices gives it in world space
305
- * each frame, and the only thing done to it here is the Y negation the rest
306
- * of the renderer already applies. It is NOT convexified or triangulated the
307
- * way the CPU clipper does — CSS `polygon()` takes a concave polygon
308
- * directly, so the decomposition that exists to feed a triangle rasterizer
309
- * has no job here.
310
- */
311
- private clipStart;
312
- /**
313
- * Ends the active clip if this slot is its end slot, called after the slot
314
- * has been drawn so that the end slot is itself clipped. Every other slot is
315
- * ignored, exactly as SkeletonClipping.clipEnd ignores it.
312
+ * Makes `clip` the clip in force for the slot about to be drawn, loading its
313
+ * polygon when it is not the one already loaded. Each clip object is counted
314
+ * once per frame — in clipCount when applied, in clipSkipCount when
315
+ * `clipping` is off or the polygon has fewer than three points (no clip is
316
+ * in force then, so the slot draws unclipped, as the runtime would).
316
317
  *
317
- * This cannot fire for a clip on the root fast path: that path is only taken
318
- * when no slot ahead of the clip carries its end slot.
318
+ * The polygon is the poser's world-space one, and the only things done to it
319
+ * here are the single-precision read the vertex paths share and the Y
320
+ * negation the rest of the renderer already applies. It is NOT convexified
321
+ * or triangulated the way the CPU clipper does — CSS `polygon()` takes a
322
+ * concave polygon directly, so the decomposition that exists to feed a
323
+ * triangle rasterizer has no job here.
319
324
  */
320
- private clipEnd;
325
+ private useClip;
321
326
  /**
322
327
  * Writes (or clears) this element's clip-path. `a…f` is the element's own
323
328
  * CSS transform, and the world polygon is carried through its INVERSE:
@@ -341,4 +346,4 @@ export declare class SpineHtmlRenderer {
341
346
  private view;
342
347
  private hide;
343
348
  }
344
- //# sourceMappingURL=SpineHtmlRenderer.d.ts.map
349
+ //# sourceMappingURL=DomRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DomRenderer.d.ts","sourceRoot":"","sources":["../src/DomRenderer.ts"],"names":[],"mappings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,CAAC,IAAI;IAmDZ,OAAO,CAAC,IAAI;CAWb"}
@@ -1,13 +1,29 @@
1
- import { Texture, TextureAtlas, type TextureFilter, type TextureWrap } from '@esotericsoftware/spine-core';
2
1
  /**
3
- * Minimal Texture implementation for the DOM renderer. spine-core only needs
4
- * it as a handle attached to atlas pages; filtering/wrapping are GPU concepts
5
- * with no DOM equivalent, so they are no-ops.
2
+ * Where one region sits on its page — the fields of a model document's
3
+ * `pages[].regions[]` entry (`ModelPageRegion` in rig-c) that a cut reads.
4
+ * `width` and `height` are the artwork's own, unrotated: a region packed at
5
+ * `degrees: 90` occupies a `height × width` rect on the page.
6
6
  */
7
- export declare class DomTexture extends Texture {
8
- setFilters(_minFilter: TextureFilter, _magFilter: TextureFilter): void;
9
- setWraps(_uWrap: TextureWrap, _vWrap: TextureWrap): void;
10
- dispose(): void;
7
+ export interface PageRegion {
8
+ name: string;
9
+ x: number;
10
+ y: number;
11
+ width: number;
12
+ height: number;
13
+ degrees: number;
14
+ }
15
+ /**
16
+ * One page of the layout `unpackRegions` cuts from — a model document's
17
+ * `pages[]` entry. `width`/`height` are the page's *declared* size (the atlas
18
+ * `size:` line the build wrote), not necessarily the image's.
19
+ */
20
+ export interface PageLayout {
21
+ name: string;
22
+ width: number;
23
+ height: number;
24
+ /** Whether the page's texels are premultiplied by their alpha (absent: false). */
25
+ pma?: boolean;
26
+ regions: readonly PageRegion[];
11
27
  }
12
28
  export interface RegionImage {
13
29
  /**
@@ -75,9 +91,12 @@ export declare function straightAlphaDerivations(): number;
75
91
  */
76
92
  export declare function straightAlphaSource(page: HTMLImageElement, pma: boolean): PageSource;
77
93
  /**
78
- * Cuts every atlas region out of the page image into its own bitmap once at
79
- * load time, restoring 90° packing rotation, so the per-frame path never
80
- * touches a canvas. Returns image URLs keyed by region name.
94
+ * Cuts every region of a page layout — a model document's `pages` section —
95
+ * out of its page image into its own bitmap once at load time, restoring 90°
96
+ * packing rotation, so the per-frame path never touches a canvas. Returns
97
+ * image URLs keyed by region name. `pageImages` is keyed by page name.
98
+ * `loadModel` calls this; it is exported for callers whose page images do not
99
+ * come from a URL.
81
100
  *
82
101
  * This is a loading-pipeline step, not a rendering step: after this runs,
83
102
  * rendering is pure DOM (one <img> per slot, one CSS matrix write per frame).
@@ -111,8 +130,9 @@ export declare function straightAlphaSource(page: HTMLImageElement, pma: boolean
111
130
  *
112
131
  * Concurrency changes nothing a caller can observe:
113
132
  *
114
- * - **Order.** The returned map is keyed in `atlas.regions` order whatever
115
- * order the blobs arrive in — the map is built after the cuts settle, from
133
+ * - **Order.** The returned map is keyed in layout order — pages in order,
134
+ * each page's regions in order, which is the atlas's own order — whatever
135
+ * order the blobs arrive in: the map is built after the cuts settle, from
116
136
  * the region list, not from the arrivals.
117
137
  * - **Duplicate names.** The last region of a given name in atlas order wins,
118
138
  * and the shadowed URL is revoked (and dropped from the ledger) rather than
@@ -131,7 +151,7 @@ export declare function straightAlphaSource(page: HTMLImageElement, pma: boolean
131
151
  * unpackRegions() with a revokeRegions(); a caller that loads once for the
132
152
  * page lifetime can ignore it.
133
153
  */
134
- export declare function unpackRegions(atlas: TextureAtlas, pageImages: Map<string, HTMLImageElement>): Promise<Map<string, RegionImage>>;
154
+ export declare function unpackRegions(pages: readonly PageLayout[], pageImages: ReadonlyMap<string, HTMLImageElement>): Promise<Map<string, RegionImage>>;
135
155
  /**
136
156
  * Frees the blob URLs unpackRegions minted for `images` — the counterpart of
137
157
  * unpackRegions, to call once the skeletons using them are gone (after
@@ -1 +1 @@
1
- {"version":3,"file":"DomTexture.d.ts","sourceRoot":"","sources":["../src/DomTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,YAAY,EAEZ,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AAEtC;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,OAAO;IACrC,UAAU,CAAC,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,GAAG,IAAI;IACtE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,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;CAChC;AAQD,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;;OASG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;CAChB;AAkBD;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAqC9D;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,GAAG,UAAU,CAcpF;AAgSD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAChD,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CA0EnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,IAAI,CAEpE"}
@@ -29,7 +29,16 @@
29
29
  * release deletes the GL texture (a later job re-uploads it). The cache is
30
30
  * keyed weakly by the page image, so a consumer that never disposes still
31
31
  * loses nothing but GPU memory — this object never pins the caller's image.
32
+ *
33
+ * The canvas render mode (`CanvasRenderer`) draws through the same context: a
34
+ * `FrameJob` is a whole player's frame — every region and mesh as textured,
35
+ * vertex-coloured triangles in draw order, with the blend mode as batch state —
36
+ * into one rect, blitted onto that player's one visible canvas. It has its own
37
+ * program (colour and optional dark attributes) so the mesh tier's program and
38
+ * its output stay exactly what they were; both share the page textures and
39
+ * their reference counts.
32
40
  */
41
+ import type { BlendMode } from './posedFrame.js';
33
42
  export interface MeshBlitJob {
34
43
  /** Destination per-part canvas; the blit clears its full backing first. */
35
44
  canvas: HTMLCanvasElement;
@@ -54,6 +63,38 @@ export interface MeshBlitJob {
54
63
  width: number;
55
64
  height: number;
56
65
  }
66
+ /**
67
+ * One run of a frame job's triangles: a stretch of the vertex data that samples
68
+ * one page under one blend mode — one draw call.
69
+ */
70
+ export interface FrameRun {
71
+ page: HTMLImageElement;
72
+ /** `page.pma`, as for MeshBlitJob. */
73
+ pma: boolean;
74
+ blend: BlendMode;
75
+ /** First vertex of the run (not float) in `FrameJob.data`. */
76
+ first: number;
77
+ /** Vertices in the run — three per triangle. */
78
+ count: number;
79
+ }
80
+ /**
81
+ * A whole frame of one player (the canvas render mode): unindexed triangles,
82
+ * interleaved per vertex as
83
+ * `x, y, u, v, r, g, b, a` (stride 8) or `x, y, u, v, r, g, b, a, dr, dg, db`
84
+ * (stride 11, the two-colour form, only when the frame carries a dark colour).
85
+ * Positions are device px relative to the job's rect, top-left origin; the
86
+ * colour is premultiplied by its alpha and so is the dark colour. Drawn into
87
+ * one rect of the offscreen buffer, then blitted onto `canvas` in one
88
+ * `drawImage`.
89
+ */
90
+ export interface FrameJob {
91
+ canvas: HTMLCanvasElement;
92
+ width: number;
93
+ height: number;
94
+ data: Float32Array;
95
+ stride: 8 | 11;
96
+ runs: FrameRun[];
97
+ }
57
98
  declare class MeshGlBlitter {
58
99
  lost: boolean;
59
100
  /**
@@ -65,6 +106,18 @@ declare class MeshGlBlitter {
65
106
  private readonly canvas;
66
107
  private readonly gl;
67
108
  private readonly uResolution;
109
+ private readonly meshProgram;
110
+ private readonly meshPos;
111
+ private readonly meshUV;
112
+ private readonly frameProgram;
113
+ private readonly frameResolution;
114
+ private readonly frameOrigin;
115
+ private readonly framePos;
116
+ private readonly frameUV;
117
+ private readonly frameColor;
118
+ private readonly frameDark;
119
+ /** Which program's attribute layout is bound — each flush binds its own. */
120
+ private bound;
68
121
  /**
69
122
  * Weak by the page image on purpose: a consumer that forgets dispose()
70
123
  * leaks its texture until context loss, but dropping the image still lets
@@ -84,12 +137,25 @@ declare class MeshGlBlitter {
84
137
  * cannot fit) so the caller can rasterize the batch on the canvas2d path.
85
138
  */
86
139
  flush(jobs: MeshBlitJob[]): boolean;
140
+ /**
141
+ * Draws one player's frame (the canvas render mode) into a rect of the
142
+ * offscreen buffer and blits it onto `job.canvas`, whose full backing is
143
+ * cleared first. Returns false when the context is lost or the rect cannot
144
+ * fit, so the caller can draw the frame on its canvas2d fallback instead.
145
+ */
146
+ flushFrame(job: FrameJob): boolean;
147
+ /** The mesh tier's layout, [x, y, u, v], and its premultiplied source-over. */
148
+ private bindMesh;
149
+ /** The frame layout: [x, y, u, v, r, g, b, a], and [dr, dg, db] at stride 11. */
150
+ private bindFrame;
151
+ private disableAttributes;
152
+ private link;
87
153
  /**
88
154
  * Declares one more user of `page`. The upload itself stays lazy (the first
89
155
  * flush that binds the page does it) — this only counts, so that the last
90
156
  * release() can free the texture instead of the module holding it forever.
91
157
  * Callers retain once per page and hand the same page back exactly once;
92
- * SpineHtmlRenderer keeps that ledger and settles it in dispose().
158
+ * DomRenderer and CanvasRenderer each keep that ledger and settle it in dispose().
93
159
  */
94
160
  retain(page: HTMLImageElement): void;
95
161
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"MeshGlBlitter.d.ts","sourceRoot":"","sources":["../src/MeshGlBlitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,MAAM,WAAW,WAAW;IAC1B,2EAA2E;IAC3E,MAAM,EAAE,iBAAiB,CAAC;IAC1B,+EAA+E;IAC/E,IAAI,EAAE,gBAAgB,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;OAUG;IACH,OAAO,CAAC,UAAU;CAuCnB;AAID;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,GAAG,IAAI,CASvD"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- export { SpineHtmlRenderer, type MeshBackend } from './SpineHtmlRenderer.js';
2
- export { DomTexture, revokeRegions, unpackRegions, type RegionImage } from './DomTexture.js';
3
- export { type AtlasAssets, loadAtlasAssets, type LoadAtlasAssetsOptions, } from './loadAtlasAssets.js';
4
- export { loadSkeletonAssets, type LoadSkeletonAssetsOptions, loadSkeletonJson, type LoadSkeletonJsonOptions, type SkeletonAssets, } from './loadSkeletonAssets.js';
1
+ export { type CanvasBackend, CanvasRenderer, type CanvasViewport } from './CanvasRenderer.js';
2
+ export { DomRenderer, type MeshBackend } from './DomRenderer.js';
3
+ export { type PageLayout, type PageRegion, type RegionImage, revokeRegions, unpackRegions } from './DomTexture.js';
4
+ export { type LoadModelOptions, loadModel, type ModelAssets, type ModelDocument } from './loadModel.js';
5
+ export { type BoneWorld, type PoseBounds, type RenderMode, type RigEvent, RigPlayer, type RigPlayerOptions } from './player.js';
6
+ export type { BlendMode, PosedClip, PosedFrame, PosedMesh, PosedRegion, PosedSlot, } from './posedFrame.js';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EACL,KAAK,WAAW,EAChB,eAAe,EACf,KAAK,sBAAsB,GAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,cAAc,GACpB,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnH,OAAO,EAAE,KAAK,gBAAgB,EAAE,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACxG,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAChI,YAAY,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,GACV,MAAM,iBAAiB,CAAC"}