spine-html 1.24.0 → 1.25.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.
@@ -1,5 +1,6 @@
1
1
  import type { LiveFrame } from './liveFrame.js';
2
2
  import { type MeshSourceRect } from './DomRenderer.js';
3
+ import { type WebGLFallbackReason } from './MeshGlBlitter.js';
3
4
  import type { PosedFrame } from './posedFrame.js';
4
5
  /** What actually drew the last frame of a `CanvasRenderer`. */
5
6
  export type CanvasBackend = 'webgl' | 'canvas2d';
@@ -75,6 +76,8 @@ export declare class CanvasRenderer {
75
76
  meshSourceRect: MeshSourceRect;
76
77
  /** What drew the last frame (or would have, had it not been reused). */
77
78
  backendActive: CanvasBackend;
79
+ /** Why the last render selected canvas2d. Null before rendering or when WebGL was selected. */
80
+ backendFallbackReason: WebGLFallbackReason | null;
78
81
  /** The visible canvas — the renderer's one element in the root. */
79
82
  readonly canvas: HTMLCanvasElement;
80
83
  /** Draw calls issued last frame — one per run of one page under one blend. */
@@ -1 +1 @@
1
- {"version":3,"file":"CanvasRenderer.d.ts","sourceRoot":"","sources":["../src/CanvasRenderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAA+C,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGpG,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;IAuEvB,OAAO,CA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+B;IACvD,yGAAyG;IACzG,OAAO,CAAC,GAAG,CAAyB;IACpC,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,QAAQ,CAAiB;IAEjC;;;;;;OAMG;gBAEgB,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAgB/D,uGAAuG;IACvG;;;;;;;;OAQG;IACH,cAAc,IAAI,MAAM;IAKxB,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI;IAIlC,uBAAuB;IACvB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,IAAI;IA4D3C,+GAA+G;IAC/G,OAAO,IAAI,IAAI;IAYf,OAAO,CAAC,MAAM;IAkBd,OAAO,CAAC,OAAO;IAUf,oFAAoF;IACpF,OAAO,CAAC,WAAW;IAkBnB,uGAAuG;IACvG,OAAO,CAAC,gBAAgB;IAqExB,iFAAiF;IACjF,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,MAAM,CAAa;IAE3B;;;OAGG;IACH,OAAO,CAAC,QAAQ;IA4BhB,+CAA+C;IAC/C,OAAO,CAAC,aAAa;IAoErB,OAAO,CAAC,MAAM;CAoEf"}
@@ -1,5 +1,6 @@
1
1
  import type { LiveFrame } from './liveFrame.js';
2
2
  import { type AtlasRegion, type RegionImage } from './DomTexture.js';
3
+ import { type WebGLFallbackReason } from './MeshGlBlitter.js';
3
4
  import type { PosedFrame } from './posedFrame.js';
4
5
  /** Rasterizer used for the mesh (deform) tier. */
5
6
  export type MeshBackend = 'canvas2d' | 'webgl';
@@ -130,6 +131,8 @@ export declare class DomRenderer {
130
131
  meshBackend: MeshBackend;
131
132
  /** Backend that actually rasterized the mesh tier during the last render(). */
132
133
  meshBackendActive: MeshBackend;
134
+ /** Why the last render selected canvas2d for meshes. Null before rendering or when WebGL was selected. */
135
+ meshBackendFallbackReason: WebGLFallbackReason | null;
133
136
  private readonly views;
134
137
  /** Counts render() calls: the stamp a view drawn this frame carries (`SlotView.drawnIn`). */
135
138
  private frameNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"DomRenderer.d.ts","sourceRoot":"","sources":["../src/DomRenderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,KAAK,WAAW,EAAoC,KAAK,WAAW,EAAuB,MAAM,iBAAiB,CAAC;AAE5H,OAAO,KAAK,EAAwB,UAAU,EAAqC,MAAM,iBAAiB,CAAC;AAE3G,kDAAkD;AAClD,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;AAE/C;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,MAAM,CAAC;AAyMjD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,WAAW;IA+IpB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAjJ/B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,UAAQ;IAChB,8EAA8E;IAC9E,SAAS,SAAK;IACd,gFAAgF;IAChF,gBAAgB,SAAK;IACrB;;;;;OAKG;IACH,aAAa,SAAK;IAClB;;;;OAIG;IACH,cAAc,SAAK;IACnB,2CAA2C;IAC3C,SAAS,SAAK;IACd,kEAAkE;IAClE,cAAc,SAAK;IACnB;;;;OAIG;IACH,kBAAkB,SAAK;IACvB,uCAAuC;IACvC,aAAa,SAAK;IAClB;;;;;OAKG;IACH,cAAc,SAAO;IACrB;;;;OAIG;IACH,cAAc,EAAE,cAAc,CAA2B;IACzD;;;;;;OAMG;IACH,UAAU,SAA+D;IACzE;;;;;;;;;;;;;;OAcG;IACH,WAAW,EAA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edFrame.js';
55
+ /** Why a renderer selected Canvas2D for its last render. */
56
+ export type WebGLFallbackReason = 'creation-failed' | 'context-lost' | 'over-grant' | 'not-requested';
57
+ type FlushFallback = 'context-lost' | 'over-grant';
55
58
  export interface MeshBlitJob {
56
59
  /** Destination per-part canvas; the blit clears its full backing first. */
57
60
  canvas: HTMLCanvasElement;
@@ -156,9 +159,8 @@ declare class MeshGlBlitter {
156
159
  private packY;
157
160
  constructor();
158
161
  /**
159
- * Rasterizes every job and blits it onto its per-part canvas. Returns false
160
- * only when the context is lost, so that the caller draws the batch on its
161
- * canvas2d path; a batch's size never sends it there.
162
+ * Rasterizes every job and blits it onto its per-part canvas. Returns null
163
+ * on success, or the reason the caller needs to draw on its canvas2d path.
162
164
  *
163
165
  * A batch that fits one buffer is one pass, shelf-packed as it always was.
164
166
  * One that does not — a zoomed-in stage asks for more than the browser
@@ -175,7 +177,8 @@ declare class MeshGlBlitter {
175
177
  * matching sub-rect of the part canvas — so a pixel does not depend on how
176
178
  * its job was packed, which pass drew it, or how it was tiled.
177
179
  */
178
- flush(jobs: MeshBlitJob[]): boolean;
180
+ flush(jobs: MeshBlitJob[]): FlushFallback | null;
181
+ private bufferFallback;
179
182
  /**
180
183
  * Sets the viewport, the two uniforms and the scissor for one piece. The
181
184
  * viewport is the job's own rect — or, for a job wider or taller than
@@ -225,13 +228,12 @@ declare class MeshGlBlitter {
225
228
  private acquire;
226
229
  /**
227
230
  * Draws one player's frame (the canvas render mode) and blits it onto
228
- * `job.canvas`, whose full backing is cleared first. Returns false only when
229
- * the context is lost, so the caller draws the frame on its canvas2d
230
- * fallback. The frame is one job: drawn into one rect when the buffer holds
231
- * it, otherwise tiled through passes exactly as flush() tiles a mesh, every
232
- * tile re-issuing the frame's runs under its own scissor.
231
+ * `job.canvas`, whose full backing is cleared first. Returns null on success
232
+ * or a canvas2d fallback reason. The frame is one job, drawn into one rect
233
+ * if it fits, otherwise tiled through passes exactly as flush() tiles a mesh.
234
+ * Every tile re-issues the frame's runs under its own scissor.
233
235
  */
234
- flushFrame(job: FrameJob): boolean;
236
+ flushFrame(job: FrameJob): FlushFallback | null;
235
237
  /** The mesh tier's layout, [x, y, u, v], and its premultiplied source-over. */
236
238
  private bindMesh;
237
239
  /** The frame layout: [x, y, u, v, r, g, b, a], and [dr, dg, db] at stride 11. */
@@ -281,5 +283,7 @@ declare class MeshGlBlitter {
281
283
  * canvas2d path.
282
284
  */
283
285
  export declare function getMeshGlBlitter(): MeshGlBlitter | null;
286
+ /** The reason for a null result from getMeshGlBlitter(). */
287
+ export declare function meshGlUnavailableReason(): 'creation-failed' | 'context-lost';
284
288
  export {};
285
289
  //# sourceMappingURL=MeshGlBlitter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MeshGlBlitter.d.ts","sourceRoot":"","sources":["../src/MeshGlBlitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAgBjD,MAAM,WAAW,WAAW;IAC1B,2EAA2E;IAC3E,MAAM,EAAE,iBAAiB,CAAC;IAC1B,+EAA+E;IAC/E,IAAI,EAAE,gBAAgB,CAAC;IACvB;;;;;OAKG;IACH,GAAG,EAAE,OAAO,CAAC;IACb,mFAAmF;IACnF,QAAQ,EAAE,YAAY,CAAC;IACvB,mDAAmD;IACnD,GAAG,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACvB,gDAAgD;IAChD,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC7B,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,gBAAgB,CAAC;IACvB,sCAAsC;IACtC,GAAG,EAAE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AAE,GAAG,aAAa,GAAG,IAAI;IA+GhD,OAAO,CAAC,cAAc;IAItB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,UAAU;IAelB;;;;;;;;OAQG;IACH,OAAO,CAAC,IAAI;IA8BZ,gFAAgF;IAChF,OAAO,KAAK,MAAM,GAEjB;IAED,OAAO,KAAK,MAAM,GAEjB;IAED;;;;;;;;OAQG;IACH,OAAO,CAAC,OAAO;IA+Bf;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO;IA2Cf;;;;;;OAMG;IACH,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,aAAa,GAAG,IAAI;IA2E/C,+EAA+E;IAC/E,OAAO,CAAC,QAAQ;IAgBhB,iFAAiF;IACjF,OAAO,CAAC,SAAS;IAsBjB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,IAAI;IAaZ;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAMpC;;;;;;OAMG;IACH,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAarC;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,OAAO;IAYf;;;;;;;;;;OAUG;IACH,OAAO,CAAC,UAAU;CAuCnB;AAID;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,GAAG,IAAI,CASvD;AAED,4DAA4D;AAC5D,wBAAgB,uBAAuB,IAAI,iBAAiB,GAAG,cAAc,CAE5E"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  export { type CanvasBackend, CanvasRenderer, type CanvasViewport } from './CanvasRenderer.js';
2
2
  export { DomRenderer, type MeshBackend, type MeshSourceRect } from './DomRenderer.js';
3
+ export type { WebGLFallbackReason } from './MeshGlBlitter.js';
3
4
  export { type AtlasRegion, createAtlasRegions, type PageLayout, type PageRegion, type RegionEncoding, type RegionImage, revokeRegions, type UnpackRegionsOptions, unpackRegions } from './DomTexture.js';
4
5
  export { type LoadModelOptions, loadModel, type ModelAssets, type ModelDocument, readSetupMesh, type RegionLoading, type RigSet, type SetupMesh, type SetupMeshTarget } from './loadModel.js';
5
- export { type AdjustableBones, type BoneAdjust, type BoneAdjustContext, type BoneLocals, type BoneWorld, type PhysicsMotion, type PhysicsMotionScope, type PhysicsParameters, type PhysicsParameterPatch, type PhysicsParameterRead, type PlayOptions, type PoseBounds, type QueueOptions, type RenderMode, type RigComplete, type RigEnvironment, type RigEvent, RigPlayer, type RigPlayerOptions, type SetActivationOptions, type SlotFilter, type SlotIdentity, type SlotIdentityReason, type SlotIdentitySnapshot, type TrackEntry } from './player.js';
6
+ export { type AdjustableBones, type BoneAdjust, type BoneAdjustContext, type BoneLocals, type BoneWorld, type PhysicsMotion, type PhysicsMotionScope, type PhysicsParameters, type PhysicsParameterPatch, type PhysicsParameterRead, type PlayOptions, type PoseBounds, type QueueOptions, type RenderMode, type RigComplete, type RigEnvironment, type RigEnvironmentSchedule, type RigEvent, RigPlayer, type RigPlayerOptions, type SetActivationOptions, type SlotFilter, type SlotIdentity, type SlotIdentityReason, type SlotIdentitySnapshot, type TrackEntry } from './player.js';
6
7
  export type { BlendMode, PosedClip, PosedFrame, PosedMesh, PosedRegion, PosedSlot, } from './posedFrame.js';
7
8
  export type { LiveFrame, LiveNumbers, LiveAttachment, LiveClip } from './liveFrame.js';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,KAAK,WAAW,EAAE,kBAAkB,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE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;
7119
7119
  }
7120
7120
  /**
7121
- * Rasterizes every job and blits it onto its per-part canvas. Returns false
7122
- * only when the context is lost, so that the caller draws the batch on its
7123
- * canvas2d path; a batch's size never sends it there.
7121
+ * Rasterizes every job and blits it onto its per-part canvas. Returns null
7122
+ * on success, or the reason the caller needs to draw on its canvas2d path.
7124
7123
  *
7125
7124
  * A batch that fits one buffer is one pass, shelf-packed as it always was.
7126
7125
  * One that does not — a zoomed-in stage asks for more than the browser
@@ -7140,15 +7139,15 @@ class MeshGlBlitter {
7140
7139
  flush(jobs) {
7141
7140
  const gl = this.gl;
7142
7141
  this.stats = { jobs: jobs.length, passes: 0, pieces: 0, tiledJobs: 0 };
7143
- if (this.lost || gl.isContextLost()) return false;
7142
+ if (this.lost || gl.isContextLost()) return "context-lost";
7144
7143
  let width = Math.max(512, this.canvas.width);
7145
7144
  for (const job of jobs) width = Math.max(width, job.width + GUTTER * 2);
7146
7145
  let pieces = jobs.map((job, i) => ({ job: i, tx: 0, ty: 0, tw: job.width, th: job.height, bx: 0, by: 0, pass: 0 }));
7147
7146
  const height = shelfPack(pieces, width, Number.POSITIVE_INFINITY);
7148
7147
  if (!this.reserve(width, height)) {
7149
- if (!this.acquire(width, height)) return false;
7148
+ if (!this.acquire(width, height)) return this.bufferFallback();
7150
7149
  const planned = this.plan(jobs, this.canvas.width, this.canvas.height);
7151
- if (!planned) return false;
7150
+ if (!planned) return this.bufferFallback();
7152
7151
  pieces = planned;
7153
7152
  }
7154
7153
  const packX = this.packX = new Array(jobs.length);
@@ -7200,7 +7199,7 @@ class MeshGlBlitter {
7200
7199
  }
7201
7200
  if (gl.isContextLost()) {
7202
7201
  this.markLost();
7203
- return false;
7202
+ return "context-lost";
7204
7203
  }
7205
7204
  for (let k = start; k < end; k++) {
7206
7205
  const piece = pieces[k];
@@ -7227,7 +7226,10 @@ class MeshGlBlitter {
7227
7226
  ctx.setTransform(1, 0, 0, 1, 0, 0);
7228
7227
  ctx.clearRect(0, 0, jobs[i].canvas.width, jobs[i].canvas.height);
7229
7228
  }
7230
- return true;
7229
+ return null;
7230
+ }
7231
+ bufferFallback() {
7232
+ return this.gl.isContextLost() ? "context-lost" : "over-grant";
7231
7233
  }
7232
7234
  /**
7233
7235
  * Sets the viewport, the two uniforms and the scissor for one piece. The
@@ -7387,23 +7389,22 @@ class MeshGlBlitter {
7387
7389
  }
7388
7390
  /**
7389
7391
  * Draws one player's frame (the canvas render mode) and blits it onto
7390
- * `job.canvas`, whose full backing is cleared first. Returns false only when
7391
- * the context is lost, so the caller draws the frame on its canvas2d
7392
- * fallback. The frame is one job: drawn into one rect when the buffer holds
7393
- * it, otherwise tiled through passes exactly as flush() tiles a mesh, every
7394
- * tile re-issuing the frame's runs under its own scissor.
7392
+ * `job.canvas`, whose full backing is cleared first. Returns null on success
7393
+ * or a canvas2d fallback reason. The frame is one job, drawn into one rect
7394
+ * if it fits, otherwise tiled through passes exactly as flush() tiles a mesh.
7395
+ * Every tile re-issues the frame's runs under its own scissor.
7395
7396
  */
7396
7397
  flushFrame(job) {
7397
7398
  const gl = this.gl;
7398
7399
  this.stats = { jobs: 1, passes: 0, pieces: 0, tiledJobs: 0 };
7399
- if (this.lost || gl.isContextLost()) return false;
7400
+ if (this.lost || gl.isContextLost()) return "context-lost";
7400
7401
  let pieces;
7401
7402
  if (this.reserve(job.width + GUTTER * 2, job.height + GUTTER * 2)) {
7402
7403
  pieces = [{ job: 0, tx: 0, ty: 0, tw: job.width, th: job.height, bx: GUTTER, by: GUTTER, pass: 0 }];
7403
7404
  } else {
7404
- if (!this.acquire(job.width + GUTTER * 2, job.height + GUTTER * 2)) return false;
7405
+ if (!this.acquire(job.width + GUTTER * 2, job.height + GUTTER * 2)) return this.bufferFallback();
7405
7406
  const planned = this.plan([job], this.canvas.width, this.canvas.height);
7406
- if (!planned) return false;
7407
+ if (!planned) return this.bufferFallback();
7407
7408
  pieces = planned;
7408
7409
  }
7409
7410
  const bufH = this.canvas.height;
@@ -7443,7 +7444,7 @@ class MeshGlBlitter {
7443
7444
  }
7444
7445
  if (gl.isContextLost()) {
7445
7446
  this.markLost();
7446
- return false;
7447
+ return "context-lost";
7447
7448
  }
7448
7449
  if (ctx) {
7449
7450
  if (!cleared) {
@@ -7462,7 +7463,7 @@ class MeshGlBlitter {
7462
7463
  }
7463
7464
  this.stats.pieces = pieces.length;
7464
7465
  if (ctx && !cleared) ctx.clearRect(0, 0, job.canvas.width, job.canvas.height);
7465
- return true;
7466
+ return null;
7466
7467
  }
7467
7468
  /** The mesh tier's layout, [x, y, u, v], and its premultiplied source-over. */
7468
7469
  bindMesh() {
@@ -7617,6 +7618,9 @@ function getMeshGlBlitter() {
7617
7618
  }
7618
7619
  return shared && !shared.lost ? shared : null;
7619
7620
  }
7621
+ function meshGlUnavailableReason() {
7622
+ return shared?.lost ? "context-lost" : "creation-failed";
7623
+ }
7620
7624
  function defaultMeshSourceRect(userAgent = typeof navigator === "object" ? navigator.userAgent : "") {
7621
7625
  const linuxWebKit = /AppleWebKit/.test(userAgent) && /Linux|X11/.test(userAgent) && !/Android|Chrome|Chromium|CriOS|Edg/.test(userAgent);
7622
7626
  return linuxWebKit ? "triangle" : "page";
@@ -7792,6 +7796,8 @@ class DomRenderer {
7792
7796
  meshBackend = "webgl";
7793
7797
  /** Backend that actually rasterized the mesh tier during the last render(). */
7794
7798
  meshBackendActive = "webgl";
7799
+ /** Why the last render selected canvas2d for meshes. Null before rendering or when WebGL was selected. */
7800
+ meshBackendFallbackReason = null;
7795
7801
  views = /* @__PURE__ */ new Map();
7796
7802
  /** Counts render() calls: the stamp a view drawn this frame carries (`SlotView.drawnIn`). */
7797
7803
  frameNumber = 0;
@@ -7911,6 +7917,7 @@ class DomRenderer {
7911
7917
  const stamp = ++this.frameNumber;
7912
7918
  const blitter = this.meshBackend === "webgl" ? getMeshGlBlitter() : null;
7913
7919
  this.meshBackendActive = blitter ? "webgl" : "canvas2d";
7920
+ this.meshBackendFallbackReason = blitter ? null : this.meshBackend === "webgl" ? meshGlUnavailableReason() : "not-requested";
7914
7921
  const order = frame2.order;
7915
7922
  const first = order.length > 0 ? order[0].clip : void 0;
7916
7923
  if (first && !first.inverse && this.clipping && first.polygon.length >= 6) {
@@ -7931,8 +7938,10 @@ class DomRenderer {
7931
7938
  for (const view of this.views.values()) if (view.drawnIn !== stamp) this.hide(view);
7932
7939
  if (!this.clipOnRoot) this.releaseRootClip();
7933
7940
  if (this.pendingJobs.length) {
7934
- if (!blitter || !blitter.flush(this.pendingJobs)) {
7941
+ const reason = blitter ? blitter.flush(this.pendingJobs) : this.meshBackendFallbackReason;
7942
+ if (reason !== null) {
7935
7943
  this.meshBackendActive = "canvas2d";
7944
+ this.meshBackendFallbackReason = reason;
7936
7945
  for (let i = 0; i < this.pendingJobs.length; i++) {
7937
7946
  const job = this.pendingJobs[i];
7938
7947
  this.pendingViews[i].meshBackendDrawn = "canvas2d";
@@ -8607,6 +8616,8 @@ class CanvasRenderer {
8607
8616
  meshSourceRect = defaultMeshSourceRect();
8608
8617
  /** What drew the last frame (or would have, had it not been reused). */
8609
8618
  backendActive = "webgl";
8619
+ /** Why the last render selected canvas2d. Null before rendering or when WebGL was selected. */
8620
+ backendFallbackReason = null;
8610
8621
  /** The visible canvas — the renderer's one element in the root. */
8611
8622
  canvas;
8612
8623
  /** Draw calls issued last frame — one per run of one page under one blend. */
@@ -8675,6 +8686,7 @@ class CanvasRenderer {
8675
8686
  this.clipSkipCount = 0;
8676
8687
  const blitter = this.backend === "webgl" ? getMeshGlBlitter() : null;
8677
8688
  this.backendActive = blitter ? "webgl" : "canvas2d";
8689
+ this.backendFallbackReason = blitter ? null : this.backend === "webgl" ? meshGlUnavailableReason() : "not-requested";
8678
8690
  const order = frame2.order;
8679
8691
  const view = this.viewport;
8680
8692
  if (view) {
@@ -8704,11 +8716,13 @@ class CanvasRenderer {
8704
8716
  if (this.backingW === 0 || this.backingH === 0) return;
8705
8717
  if (blitter) {
8706
8718
  this.buildVertices(order);
8707
- if (blitter.flushFrame({ canvas: this.canvas, width: this.backingW, height: this.backingH, data: this.data, stride: this.stride, runs: this.runs })) {
8719
+ const reason = blitter.flushFrame({ canvas: this.canvas, width: this.backingW, height: this.backingH, data: this.data, stride: this.stride, runs: this.runs });
8720
+ if (reason === null) {
8708
8721
  this.blits = 1;
8709
8722
  return;
8710
8723
  }
8711
8724
  this.backendActive = "canvas2d";
8725
+ this.backendFallbackReason = reason;
8712
8726
  this.sigLength = -1;
8713
8727
  }
8714
8728
  this.draw2d(order);
@@ -13196,12 +13210,13 @@ class RigPlayer {
13196
13210
  slotFilter = null;
13197
13211
  /** `slotFilter` as a predicate; every slot when null. */
13198
13212
  draws = () => true;
13199
- /** Handed to every track the player opens; reads the current `adjust` so setting it later needs no reopen. */
13200
- adjustHook = (locals, ctx) => {
13201
- if (this.easing !== null) this.applyEase(this.easing, locals);
13213
+ /** Reads the current `adjust` and set ease during live evaluation. */
13214
+ adjustHook = (locals, ctx) => this.adjustLocals(locals, ctx, this.easing);
13215
+ adjustLocals(locals, ctx, easing) {
13216
+ if (easing !== null) this.applyEase(easing, locals);
13202
13217
  else if (this.drawnPose !== null) for (const [bone2, rotation] of this.drawnPose) locals.bone(bone2).rotation = rotation;
13203
13218
  if (this.adjustFn !== null) this.adjustFn(locals, ctx);
13204
- };
13219
+ }
13205
13220
  listeners = {
13206
13221
  event: /* @__PURE__ */ new Set(),
13207
13222
  complete: /* @__PURE__ */ new Set()
@@ -13422,11 +13437,11 @@ class RigPlayer {
13422
13437
  return tracks;
13423
13438
  }
13424
13439
  /** Stores `raw` and applies the shown set (`activeSet`, or before an ease's swap the composition it eases from). Zero work when none. */
13425
- setRawPose(raw) {
13440
+ setRawPose(raw, set = this.shownSet()) {
13441
+ const pose = set === null ? raw : applySetToPose(this.view, raw, set);
13426
13442
  this.rawPose = raw;
13427
13443
  this.heldParameters = null;
13428
- const set = this.shownSet();
13429
- this.pose = set === null ? raw : applySetToPose(this.view, raw, set);
13444
+ this.pose = pose;
13430
13445
  this.poseGeneration++;
13431
13446
  this.cachedIdentity = null;
13432
13447
  }
@@ -13483,9 +13498,9 @@ class RigPlayer {
13483
13498
  * standing value, `null` returns both to the start values, and the call
13484
13499
  * applies from the next step on, at any time, with no ramp of the player's
13485
13500
  * own — the springs are the smoothing. It is the player's, not a track's:
13486
- * every track and layer answers the same world, and a `seek` or a replay
13487
- * poses under the environment as it stands (no history is kept). Returns the
13488
- * environment now standing.
13501
+ * every track and layer answers the same world, and ordinary replays use the
13502
+ * environment as it stands (no history is kept). `seek` accepts a schedule
13503
+ * for that replay alone. Returns the environment now standing.
13489
13504
  */
13490
13505
  environment(environment) {
13491
13506
  if (environment === null) {
@@ -13637,15 +13652,20 @@ class RigPlayer {
13637
13652
  this.setRawPose(raw);
13638
13653
  }
13639
13654
  /**
13640
- * Moves a single animation on track 0 to `time`: snapshot-backed deterministic
13641
- * seek (#141) that produces the exact pose and physics state of reopening at 0
13642
- * and stepping forward in `seekStep` increments (the last one shorter) until
13643
- * `time` is reached. Events and completes crossed on the way are not fired.
13655
+ * Moves a single animation on track 0 to `time` with the pose and physics
13656
+ * state of reopening at 0 and stepping in `seekStep` increments (the last
13657
+ * one can be shorter). Ordinary seeks reuse snapshots (#141). Events and
13658
+ * completes crossed on the way are not fired.
13644
13659
  * It has a meaning for one animation on one track only — the player cannot
13645
13660
  * replay when a mix, a second track or a queue was asked for — so after any
13646
13661
  * of those it refuses by name; step the player forward instead.
13662
+ * On the oracle, `environmentAt` runs an uncached replay and supplies wind
13663
+ * and gravity at the start of each positive step, including a shorter last
13664
+ * step. On success the resulting physics state continues under the standing
13665
+ * environment. A failed replay leaves the held state in place. The runtime
13666
+ * poser seeks as usual and does not call `environmentAt`.
13647
13667
  */
13648
- seek(time) {
13668
+ seek(time, environmentAt) {
13649
13669
  if (this.animation === null) throw new Error("seek before play: no animation is open");
13650
13670
  if (!(time >= 0) || !Number.isFinite(time)) throw new Error(`seek time must be a finite time at or above 0, got ${String(time)}`);
13651
13671
  if (this.beyondBase) throw new Error("seek is defined for a single animation on track 0; after a mix, another track, a queue or a clear the player cannot replay to a time — step it forward with frame/advance instead");
@@ -13659,6 +13679,10 @@ class RigPlayer {
13659
13679
  this.applyRuntimeTime();
13660
13680
  return;
13661
13681
  }
13682
+ if (environmentAt !== void 0) {
13683
+ this.seekWithEnvironment(time, environmentAt);
13684
+ return;
13685
+ }
13662
13686
  this.easing = null;
13663
13687
  const cache = this.ensureSeekCache();
13664
13688
  const stepper = this.tracks ?? this.track;
@@ -13718,6 +13742,22 @@ class RigPlayer {
13718
13742
  });
13719
13743
  }
13720
13744
  }
13745
+ seekWithEnvironment(time, environmentAt) {
13746
+ let replaying = true;
13747
+ const { stepper, firstPose } = this.openReplay((locals, ctx) => this.adjustLocals(locals, ctx, replaying ? null : this.easing));
13748
+ const standing = stepper.environment;
13749
+ let rawPose = firstPose;
13750
+ this.replaySteps(stepper, time, (dt) => {
13751
+ stepper.setEnvironment(environmentAt(stepper.trackTime));
13752
+ rawPose = stepper.step(dt);
13753
+ });
13754
+ stepper.setEnvironment(standing);
13755
+ this.setRawPose(rawPose, this.activeSet);
13756
+ this.easing = null;
13757
+ replaying = false;
13758
+ if ("first" in stepper) this.track = stepper;
13759
+ else this.tracks = stepper;
13760
+ }
13721
13761
  clearSeekCache() {
13722
13762
  this.seekCache = null;
13723
13763
  }
@@ -13729,21 +13769,7 @@ class RigPlayer {
13729
13769
  if (this.tracks === null && this.track === null) {
13730
13770
  this.reopen();
13731
13771
  }
13732
- let frontier;
13733
- let firstPose;
13734
- if (mode === "tracks") {
13735
- const tracks = openTracks(this.view, { reset: "animation", adjust: this.adjustHook, clock: this.clockHook });
13736
- tracks.setAnimation(0, this.animation, { loop: this.loop, mixDuration: 0 });
13737
- firstPose = tracks.start();
13738
- this.applyPhysicsParameters(tracks);
13739
- this.applyEnvironment(tracks);
13740
- frontier = tracks;
13741
- } else {
13742
- const track = openTrack(this.view, this.animation, { loop: this.loop, reset: "animation", adjust: this.adjustHook, clock: this.clockHook });
13743
- firstPose = this.initializeSingle(track);
13744
- this.applyEnvironment(track);
13745
- frontier = track;
13746
- }
13772
+ const { stepper: frontier, firstPose } = this.openReplay();
13747
13773
  const grid = /* @__PURE__ */ new Map();
13748
13774
  grid.set(0, { state: captureStepperState(frontier), rawPose: firstPose, parameters: this.readParameters(frontier) });
13749
13775
  this.seekCache = {
@@ -13755,6 +13781,21 @@ class RigPlayer {
13755
13781
  };
13756
13782
  return this.seekCache;
13757
13783
  }
13784
+ /** Opens a separate stepper at pose 0 for a seek, without publishing it. */
13785
+ openReplay(adjust = this.adjustHook) {
13786
+ if (this.tracks !== null) {
13787
+ const tracks = openTracks(this.view, { reset: "animation", adjust, clock: this.clockHook });
13788
+ tracks.setAnimation(0, this.animation, { loop: this.loop, mixDuration: 0 });
13789
+ const firstPose2 = tracks.start();
13790
+ this.applyPhysicsParameters(tracks);
13791
+ this.applyEnvironment(tracks);
13792
+ return { stepper: tracks, firstPose: firstPose2 };
13793
+ }
13794
+ const track = openTrack(this.view, this.animation, { loop: this.loop, reset: "animation", adjust, clock: this.clockHook });
13795
+ const firstPose = this.initializeSingle(track);
13796
+ this.applyEnvironment(track);
13797
+ return { stepper: track, firstPose };
13798
+ }
13758
13799
  /** Whatever is open, opened again with track 0's animation as `play` last set it, at pose 0: the single track, or the tracks under `tracks: true`. */
13759
13800
  reopen() {
13760
13801
  if (this.tracks !== null) {
@@ -13783,11 +13824,16 @@ class RigPlayer {
13783
13824
  /** Steps whatever is open forward to `time` in `seekStep` increments, the last one shorter. */
13784
13825
  stepTo(time) {
13785
13826
  const stepper = this.tracks ?? this.track;
13827
+ this.replaySteps(stepper, time, (dt) => {
13828
+ this.rawPose = stepper.step(dt);
13829
+ });
13830
+ if (this.rawPose !== null) this.setRawPose(this.rawPose);
13831
+ }
13832
+ replaySteps(stepper, time, step) {
13786
13833
  const steps = Math.floor(time / this.seekStep);
13787
- for (let i = 0; i < steps; i++) this.rawPose = stepper.step(this.seekStep);
13834
+ for (let i = 0; i < steps; i++) step(this.seekStep);
13788
13835
  const rest = time - stepper.trackTime;
13789
- if (rest > 0) this.rawPose = stepper.step(rest);
13790
- if (this.rawPose !== null) this.setRawPose(this.rawPose);
13836
+ if (rest > 0) step(rest);
13791
13837
  }
13792
13838
  on(type, listener) {
13793
13839
  const set = this.listeners[type];