@doki-land/live2d-renderer 0.0.18 → 0.0.19

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/dist/index.d.ts CHANGED
@@ -34,7 +34,7 @@ interface TextureData {
34
34
  }
35
35
  interface ModelDrawPass {
36
36
  setTextures(textures: TextureData[]): void;
37
- draw(drawables: DrawableMesh[], modelMatrix: Float32Array): void;
37
+ draw(drawables: readonly DrawableMesh[], modelMatrix: Float32Array): void;
38
38
  destroy(): void;
39
39
  }
40
40
  /** Top-level renderer bound to a canvas. */
@@ -177,7 +177,7 @@ declare function parseCpuProgram(bytes: ArrayBuffer): ModelProgram;
177
177
  /** Create a runtime instance with default parameter values. */
178
178
  declare function createModelInstance(program: ModelProgram): ModelInstance;
179
179
  declare function setParameterValue(instance: ModelInstance, parameterId: string, value: number): void;
180
- /** CPU deform 鈫?FrameSnapshot. */
180
+ /** CPU deform FrameSnapshot. */
181
181
  declare function evaluateFrame(instance: ModelInstance): FrameSnapshot;
182
182
  /** Stable fingerprint for golden tests (positions + topology). */
183
183
  declare function fingerprintSnapshot(snapshot: FrameSnapshot): string;
@@ -279,6 +279,11 @@ interface ModelBackend {
279
279
  setParameter?(model: InternalModel, id: string, value: number): void;
280
280
  /** Optional PartOpacity override (moc3 parts / pose / motion). */
281
281
  setPartOpacity?(model: InternalModel, id: string, value: number): void;
282
+ /**
283
+ * Resolve parameter id → index (O(1) after load).
284
+ * Used by motion blend / hosts instead of `listParameters().find`.
285
+ */
286
+ resolveParameter?(model: InternalModel, id: string): number | undefined;
282
287
  listParameters?(model: InternalModel): readonly ParameterBinding[];
283
288
  }
284
289
  declare function selectModelBackend(backends: ModelBackend[], json: unknown): ModelBackend;
@@ -292,9 +297,12 @@ declare class Moc2Backend implements ModelBackend {
292
297
  getDrawables(model: InternalModel): DrawableMesh[];
293
298
  captureFrame(model: InternalModel): FrameSnapshot | null;
294
299
  setParameter(model: InternalModel, id: string, value: number): void;
300
+ resolveParameter(model: InternalModel, id: string): number | undefined;
295
301
  listParameters(model: InternalModel): readonly ParameterBinding[];
296
302
  hitTest(_model: InternalModel, _x: number, _y: number): string | null;
297
303
  destroyModel(model: InternalModel): void;
304
+ /** Test/harness: stable program + instance refs. */
305
+ getResidentInstance(model: InternalModel): ModelInstance | null;
298
306
  }
299
307
  declare function createMoc2Backend(): Moc2Backend;
300
308
 
@@ -308,9 +316,11 @@ declare class Moc3Backend implements ModelBackend {
308
316
  captureFrame(model: InternalModel): FrameSnapshot | null;
309
317
  setParameter(model: InternalModel, id: string, value: number): void;
310
318
  setPartOpacity(model: InternalModel, id: string, value: number): void;
319
+ resolveParameter(model: InternalModel, id: string): number | undefined;
311
320
  listParameters(model: InternalModel): readonly ParameterBinding[];
312
321
  hitTest(_model: InternalModel, _x: number, _y: number): string | null;
313
322
  destroyModel(model: InternalModel): void;
323
+ getResidentInstance(model: InternalModel): ModelInstance | null;
314
324
  }
315
325
  declare function createMoc3Backend(): Moc3Backend;
316
326