@laplace.live/pixijs-live2d 0.6.0 → 0.6.1
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 +61 -1
- package/dist/index.js +12 -14
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -6046,6 +6046,64 @@ declare class PartData {
|
|
|
6046
6046
|
link: Array<PartData>;
|
|
6047
6047
|
}
|
|
6048
6048
|
//#endregion
|
|
6049
|
+
//#region vendor/cubism/src/model/cubismmoc.d.ts
|
|
6050
|
+
/**
|
|
6051
|
+
* Mocデータの管理
|
|
6052
|
+
*
|
|
6053
|
+
* Mocデータの管理を行うクラス。
|
|
6054
|
+
*/
|
|
6055
|
+
declare class CubismMoc {
|
|
6056
|
+
/**
|
|
6057
|
+
* Mocデータの作成
|
|
6058
|
+
*/
|
|
6059
|
+
static create(mocBytes: ArrayBuffer, shouldCheckMocConsistency: boolean): CubismMoc;
|
|
6060
|
+
/**
|
|
6061
|
+
* Mocデータを削除
|
|
6062
|
+
*
|
|
6063
|
+
* Mocデータを削除する
|
|
6064
|
+
*/
|
|
6065
|
+
static delete(moc: CubismMoc): void;
|
|
6066
|
+
/**
|
|
6067
|
+
* モデルを作成する
|
|
6068
|
+
*
|
|
6069
|
+
* @return Mocデータから作成されたモデル
|
|
6070
|
+
*/
|
|
6071
|
+
createModel(): CubismModel;
|
|
6072
|
+
/**
|
|
6073
|
+
* モデルを削除する
|
|
6074
|
+
*/
|
|
6075
|
+
deleteModel(model: CubismModel): void;
|
|
6076
|
+
/**
|
|
6077
|
+
* コンストラクタ
|
|
6078
|
+
*/
|
|
6079
|
+
private constructor();
|
|
6080
|
+
/**
|
|
6081
|
+
* デストラクタ相当の処理
|
|
6082
|
+
*/
|
|
6083
|
+
release(): void;
|
|
6084
|
+
/**
|
|
6085
|
+
* 最新の.moc3 Versionを取得
|
|
6086
|
+
*/
|
|
6087
|
+
getLatestMocVersion(): number;
|
|
6088
|
+
/**
|
|
6089
|
+
* 読み込んだモデルの.moc3 Versionを取得
|
|
6090
|
+
*/
|
|
6091
|
+
getMocVersion(): number;
|
|
6092
|
+
/**
|
|
6093
|
+
* Mocファイルのbufferから.moc3 Versionを取得
|
|
6094
|
+
* @param mocBytes Mocファイルのバイト配列
|
|
6095
|
+
* @returns .moc3 Version番号
|
|
6096
|
+
*/
|
|
6097
|
+
static getMocVersionFromBuffer(mocBytes: ArrayBuffer): number;
|
|
6098
|
+
/**
|
|
6099
|
+
* .moc3 の整合性を検証する
|
|
6100
|
+
*/
|
|
6101
|
+
static hasMocConsistency(mocBytes: ArrayBuffer): boolean;
|
|
6102
|
+
_moc: Live2DCubismCore.Moc;
|
|
6103
|
+
_modelCount: number;
|
|
6104
|
+
_mocVersion: number;
|
|
6105
|
+
}
|
|
6106
|
+
//#endregion
|
|
6049
6107
|
//#region vendor/cubism/src/math/cubismvector2.d.ts
|
|
6050
6108
|
/**
|
|
6051
6109
|
* Copyright(c) Live2D Inc. All rights reserved.
|
|
@@ -7065,6 +7123,8 @@ export declare class CubismInternalModel extends InternalModel {
|
|
|
7065
7123
|
pose?: CubismPose;
|
|
7066
7124
|
physics?: CubismPhysics;
|
|
7067
7125
|
renderer: CubismRenderer_WebGL;
|
|
7126
|
+
/** The moc {@link coreModel} was built from; it must outlive the model, so {@link destroy} releases it last. */
|
|
7127
|
+
private readonly moc;
|
|
7068
7128
|
private readonly idManager;
|
|
7069
7129
|
/** Context the renderer was last started up against; also the offscreen-pool refcount key. */
|
|
7070
7130
|
private renderContext?;
|
|
@@ -7084,7 +7144,7 @@ export declare class CubismInternalModel extends InternalModel {
|
|
|
7084
7144
|
* Matrix that scales by {@link pixelsPerUnit}, and moves the origin from top-left to center.
|
|
7085
7145
|
*/
|
|
7086
7146
|
protected modelTransform: Matrix;
|
|
7087
|
-
constructor(coreModel: CubismModel, settings: CubismModelSettings, options?: InternalModelOptions);
|
|
7147
|
+
constructor(coreModel: CubismModel, moc: CubismMoc, settings: CubismModelSettings, options?: InternalModelOptions);
|
|
7088
7148
|
protected init(): void;
|
|
7089
7149
|
protected getIdSafe(id: string | undefined): CubismIdHandle;
|
|
7090
7150
|
protected getSize(): [number, number];
|
package/dist/index.js
CHANGED
|
@@ -15433,6 +15433,8 @@ var CubismInternalModel = class extends InternalModel {
|
|
|
15433
15433
|
breathEnabled = true;
|
|
15434
15434
|
eyeBlink;
|
|
15435
15435
|
renderer = new CubismRenderer_WebGL(0, 0);
|
|
15436
|
+
/** The moc {@link coreModel} was built from; it must outlive the model, so {@link destroy} releases it last. */
|
|
15437
|
+
moc;
|
|
15436
15438
|
idManager;
|
|
15437
15439
|
/** Context the renderer was last started up against; also the offscreen-pool refcount key. */
|
|
15438
15440
|
renderContext;
|
|
@@ -15452,9 +15454,10 @@ var CubismInternalModel = class extends InternalModel {
|
|
|
15452
15454
|
* Matrix that scales by {@link pixelsPerUnit}, and moves the origin from top-left to center.
|
|
15453
15455
|
*/
|
|
15454
15456
|
modelTransform = new Matrix();
|
|
15455
|
-
constructor(coreModel, settings, options) {
|
|
15457
|
+
constructor(coreModel, moc, settings, options) {
|
|
15456
15458
|
super();
|
|
15457
15459
|
this.coreModel = coreModel;
|
|
15460
|
+
this.moc = moc;
|
|
15458
15461
|
this.settings = settings;
|
|
15459
15462
|
this.options = Object.assign({}, {
|
|
15460
15463
|
breathDepth: 1,
|
|
@@ -15658,7 +15661,8 @@ var CubismInternalModel = class extends InternalModel {
|
|
|
15658
15661
|
detachPooledRenderTargets(this.renderer);
|
|
15659
15662
|
this.renderer.release();
|
|
15660
15663
|
if (gl) releaseOffscreenPool(gl);
|
|
15661
|
-
this.
|
|
15664
|
+
this.moc.deleteModel(this.coreModel);
|
|
15665
|
+
this.moc.release();
|
|
15662
15666
|
this.renderer = void 0;
|
|
15663
15667
|
this.coreModel = void 0;
|
|
15664
15668
|
}
|
|
@@ -16327,6 +16331,8 @@ function reconfigureCubismSDK(config = {}) {
|
|
|
16327
16331
|
}
|
|
16328
16332
|
//#endregion
|
|
16329
16333
|
//#region src/cubism/factory.ts
|
|
16334
|
+
/** Each core model's moc, from createCoreModel to the internal model that takes ownership of both. */
|
|
16335
|
+
const mocs = /* @__PURE__ */ new WeakMap();
|
|
16330
16336
|
Live2DFactory.registerRuntime({
|
|
16331
16337
|
version: 4,
|
|
16332
16338
|
ready: cubismReady,
|
|
@@ -16345,7 +16351,7 @@ Live2DFactory.registerRuntime({
|
|
|
16345
16351
|
const moc = CubismMoc.create(data, !!options?.checkMocConsistency);
|
|
16346
16352
|
try {
|
|
16347
16353
|
const model = moc.createModel();
|
|
16348
|
-
model
|
|
16354
|
+
mocs.set(model, moc);
|
|
16349
16355
|
return model;
|
|
16350
16356
|
} catch (e) {
|
|
16351
16357
|
try {
|
|
@@ -16357,14 +16363,9 @@ Live2DFactory.registerRuntime({
|
|
|
16357
16363
|
}
|
|
16358
16364
|
},
|
|
16359
16365
|
createInternalModel(coreModel, settings, options) {
|
|
16360
|
-
const
|
|
16361
|
-
|
|
16362
|
-
|
|
16363
|
-
model.__moc = coreModelWithMoc.__moc;
|
|
16364
|
-
delete coreModelWithMoc.__moc;
|
|
16365
|
-
model.once("destroy", releaseMoc);
|
|
16366
|
-
}
|
|
16367
|
-
return model;
|
|
16366
|
+
const moc = mocs.get(coreModel);
|
|
16367
|
+
if (!moc) throw new TypeError("Cubism core model was not created by this runtime.");
|
|
16368
|
+
return new CubismInternalModel(coreModel, moc, settings, options);
|
|
16368
16369
|
},
|
|
16369
16370
|
createPhysics(_coreModel, data) {
|
|
16370
16371
|
if (!(data instanceof ArrayBuffer)) throw new TypeError("Cubism physics data must be an ArrayBuffer.");
|
|
@@ -16375,9 +16376,6 @@ Live2DFactory.registerRuntime({
|
|
|
16375
16376
|
return CubismPose.create(data, data.byteLength);
|
|
16376
16377
|
}
|
|
16377
16378
|
});
|
|
16378
|
-
function releaseMoc() {
|
|
16379
|
-
this.__moc?.release();
|
|
16380
|
-
}
|
|
16381
16379
|
//#endregion
|
|
16382
16380
|
export { Constant, CubismExpressionManager, CubismFramework, CubismInternalModel, CubismModelSettings, CubismMotionManager, CubismParallelMotionManager, ExpressionManager, FileLoader, FocusController, InternalModel, LOGICAL_HEIGHT, LOGICAL_WIDTH, Live2DFactory, Live2DLoader, Live2DModel, Live2DPlugin, Live2DTransform, LogLevel, MBToByte, ModelSettings, MotionManager, MotionPreloadStrategy, MotionPriority, MotionState, Option, SoundManager, VOLUME, XHRLoader, applyMixins, clamp, config, configureCubismSDK, copyArray, copyProperty, csmDelete, cubismReady, folderName, logger, normalizeHitAreaDefs, rand, reconfigureCubismSDK, remove, resolveURL, startUpCubism, strtod };
|
|
16383
16381
|
|