untitled-pixi-live2d-engine 1.0.0 → 1.0.2
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/README.md +1 -1
- package/dist/cubism-legacy.es.js +40 -9
- package/dist/cubism-legacy.js +40 -9
- package/dist/cubism-legacy.min.js +1 -1
- package/dist/cubism.es.js +62 -8
- package/dist/cubism.js +62 -8
- package/dist/cubism.min.js +1 -1
- package/dist/index.es.js +72 -15
- package/dist/index.js +72 -15
- package/dist/index.min.js +1 -1
- package/package.json +4 -4
- package/types/index.d.ts +10 -0
package/dist/cubism.js
CHANGED
|
@@ -2759,7 +2759,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
2759
2759
|
preserveExpressionOnMotion: true,
|
|
2760
2760
|
cubism: CubismFrameworkConfig
|
|
2761
2761
|
};
|
|
2762
|
-
const VERSION = "1.0.
|
|
2762
|
+
const VERSION = "1.0.2";
|
|
2763
2763
|
const logger = {
|
|
2764
2764
|
log(tag, ...messages) {
|
|
2765
2765
|
if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
|
|
@@ -4626,7 +4626,35 @@ var __async = (__this, __arguments, generator) => {
|
|
|
4626
4626
|
return next();
|
|
4627
4627
|
}
|
|
4628
4628
|
}
|
|
4629
|
-
|
|
4629
|
+
const url = context.source && typeof context.source.url === "string" ? context.source.url : void 0;
|
|
4630
|
+
const runtimeVersions = Live2DFactory.runtimes.map((r) => r.version).join(", ");
|
|
4631
|
+
if (Live2DFactory.runtimes.length === 0) {
|
|
4632
|
+
throw new TypeError(
|
|
4633
|
+
[
|
|
4634
|
+
"Unknown settings format: no Live2D runtimes registered.",
|
|
4635
|
+
'Import a published runtime entry before loading models (e.g. "<package>/cubism" for Cubism 3/4/5, "<package>/cubism-legacy" for Cubism 2).',
|
|
4636
|
+
url ? `Settings URL: ${url}` : void 0
|
|
4637
|
+
].filter(Boolean).join("\n")
|
|
4638
|
+
);
|
|
4639
|
+
}
|
|
4640
|
+
const topLevelKeys = (() => {
|
|
4641
|
+
try {
|
|
4642
|
+
if (!context.source || typeof context.source !== "object" || Array.isArray(context.source)) {
|
|
4643
|
+
return void 0;
|
|
4644
|
+
}
|
|
4645
|
+
return Object.keys(context.source).slice(0, 30).join(", ");
|
|
4646
|
+
} catch (e) {
|
|
4647
|
+
return void 0;
|
|
4648
|
+
}
|
|
4649
|
+
})();
|
|
4650
|
+
throw new TypeError(
|
|
4651
|
+
[
|
|
4652
|
+
"Unknown settings format: no matching runtime found for the loaded settings JSON.",
|
|
4653
|
+
runtimeVersions ? `Registered runtimes (versions): ${runtimeVersions}` : void 0,
|
|
4654
|
+
topLevelKeys ? `Settings JSON keys: ${topLevelKeys}` : void 0,
|
|
4655
|
+
url ? `Settings URL: ${url}` : void 0
|
|
4656
|
+
].filter(Boolean).join("\n")
|
|
4657
|
+
);
|
|
4630
4658
|
});
|
|
4631
4659
|
const waitUntilReady = (context, next) => {
|
|
4632
4660
|
if (context.settings) {
|
|
@@ -11205,6 +11233,30 @@ var __async = (__this, __arguments, generator) => {
|
|
|
11205
11233
|
Live2DCubismFramework2.CubismRenderer_WebGL = CubismRenderer_WebGL;
|
|
11206
11234
|
})(Live2DCubismFramework$8 || (Live2DCubismFramework$8 = {}));
|
|
11207
11235
|
const tempMatrix = new CubismMatrix44();
|
|
11236
|
+
const DEFAULT_MASKS_PER_RENDER_TEXTURE = 36;
|
|
11237
|
+
const MASKS_PER_RENDER_TEXTURE = 32;
|
|
11238
|
+
function getRequiredMaskRenderTextureCount(model) {
|
|
11239
|
+
var _a;
|
|
11240
|
+
if (!model.isUsingMasking()) {
|
|
11241
|
+
return 1;
|
|
11242
|
+
}
|
|
11243
|
+
const maskCounts = model.getDrawableMaskCounts();
|
|
11244
|
+
const masks = model.getDrawableMasks();
|
|
11245
|
+
const uniqueMaskSets = /* @__PURE__ */ new Set();
|
|
11246
|
+
for (let i = 0; i < model.getDrawableCount(); i++) {
|
|
11247
|
+
const maskCount = maskCounts[i];
|
|
11248
|
+
if (!maskCount || maskCount <= 0) {
|
|
11249
|
+
continue;
|
|
11250
|
+
}
|
|
11251
|
+
const maskSet = Array.from((_a = masks[i]) != null ? _a : []).slice(0, maskCount).sort((a, b) => a - b).join(",");
|
|
11252
|
+
uniqueMaskSets.add(maskSet);
|
|
11253
|
+
}
|
|
11254
|
+
const clippingContextCount = uniqueMaskSets.size;
|
|
11255
|
+
if (clippingContextCount <= DEFAULT_MASKS_PER_RENDER_TEXTURE) {
|
|
11256
|
+
return 1;
|
|
11257
|
+
}
|
|
11258
|
+
return Math.ceil(clippingContextCount / MASKS_PER_RENDER_TEXTURE);
|
|
11259
|
+
}
|
|
11208
11260
|
class CubismInternalModel extends InternalModel {
|
|
11209
11261
|
constructor(coreModel, settings, options) {
|
|
11210
11262
|
super();
|
|
@@ -11236,7 +11288,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
11236
11288
|
__publicField(this, "modelTransform", new pixi_js.Matrix());
|
|
11237
11289
|
this.coreModel = coreModel;
|
|
11238
11290
|
this.settings = settings;
|
|
11239
|
-
this.options = Object.assign(
|
|
11291
|
+
this.options = Object.assign(
|
|
11292
|
+
{},
|
|
11293
|
+
{ breathDepth: 1, lipSyncGain: 1.5, lipSyncWeight: 0.4 },
|
|
11294
|
+
options
|
|
11295
|
+
);
|
|
11240
11296
|
this.idManager = CubismFramework.getIdManager();
|
|
11241
11297
|
this.idParamAngleX = this.getIdSafe(CubismDefaultParameterId.ParamAngleX);
|
|
11242
11298
|
this.idParamAngleY = this.getIdSafe(CubismDefaultParameterId.ParamAngleY);
|
|
@@ -11300,7 +11356,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
11300
11356
|
);
|
|
11301
11357
|
breathParams.pushBack(new BreathParameterData(this.idParamBreath, 0, 0.5, 3.2345, 0.5));
|
|
11302
11358
|
this.breath.setParameters(breathParams);
|
|
11303
|
-
this.renderer.initialize(this.coreModel);
|
|
11359
|
+
this.renderer.initialize(this.coreModel, getRequiredMaskRenderTextureCount(this.coreModel));
|
|
11304
11360
|
this.renderer.setIsPremultipliedAlpha(true);
|
|
11305
11361
|
}
|
|
11306
11362
|
getIdSafe(id) {
|
|
@@ -11395,15 +11451,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
11395
11451
|
this.updateFocus();
|
|
11396
11452
|
this.updateNaturalMovements(dt * 1e3, now * 1e3);
|
|
11397
11453
|
if (this.lipSync && this.motionManager.currentAudio) {
|
|
11398
|
-
|
|
11399
|
-
const smoothing = 0.4;
|
|
11400
|
-
let value = this.motionManager.mouthSync() * lipSyncGain;
|
|
11454
|
+
let value = this.motionManager.mouthSync() * this.options.lipSyncGain;
|
|
11401
11455
|
value = Math.pow(value, 1.15);
|
|
11402
11456
|
const min_ = value > 0 ? 0.1 : 0;
|
|
11403
11457
|
const max_ = 1;
|
|
11404
11458
|
value = clamp(value, min_, max_);
|
|
11405
11459
|
this.motionManager.lipSyncIds.forEach((lipSyncId) => {
|
|
11406
|
-
model.addParameterValueById(this.getIdSafe(lipSyncId), value,
|
|
11460
|
+
model.addParameterValueById(this.getIdSafe(lipSyncId), value, this.options.lipSyncWeight);
|
|
11407
11461
|
});
|
|
11408
11462
|
}
|
|
11409
11463
|
(_d = this.physics) == null ? void 0 : _d.evaluate(model, dt);
|