untitled-pixi-live2d-engine 1.3.3 → 1.3.5
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/cubism-legacy.es.js +41 -6
- package/dist/cubism-legacy.js +41 -6
- package/dist/cubism-legacy.min.js +1 -1
- package/dist/cubism.es.js +41 -6
- package/dist/cubism.js +41 -6
- package/dist/cubism.min.js +1 -1
- package/dist/index.es.js +41 -6
- package/dist/index.js +41 -6
- package/dist/index.min.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +15 -1
package/dist/cubism.js
CHANGED
|
@@ -2762,7 +2762,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
2762
2762
|
preserveExpressionOnMotion: true,
|
|
2763
2763
|
cubism: CubismFrameworkConfig
|
|
2764
2764
|
};
|
|
2765
|
-
const VERSION = "1.3.
|
|
2765
|
+
const VERSION = "1.3.5";
|
|
2766
2766
|
const logger = {
|
|
2767
2767
|
log(tag, ...messages) {
|
|
2768
2768
|
if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
|
|
@@ -5511,13 +5511,29 @@ var __async = (__this, __arguments, generator) => {
|
|
|
5511
5511
|
constructor(renderer) {
|
|
5512
5512
|
this.renderer = renderer;
|
|
5513
5513
|
}
|
|
5514
|
+
addPrepare(prepare, instructionSet) {
|
|
5515
|
+
var _a, _b;
|
|
5516
|
+
const renderPipes = this.renderer.renderPipes;
|
|
5517
|
+
(_b = (_a = renderPipes.batch) == null ? void 0 : _a.break) == null ? void 0 : _b.call(_a, instructionSet);
|
|
5518
|
+
instructionSet.add({
|
|
5519
|
+
renderPipeId: "live2d",
|
|
5520
|
+
action: "prepare",
|
|
5521
|
+
canBundle: false,
|
|
5522
|
+
prepare
|
|
5523
|
+
});
|
|
5524
|
+
}
|
|
5514
5525
|
addRenderable(model, instructionSet) {
|
|
5515
5526
|
var _a, _b;
|
|
5516
5527
|
const renderPipes = this.renderer.renderPipes;
|
|
5517
5528
|
(_b = (_a = renderPipes.batch) == null ? void 0 : _a.break) == null ? void 0 : _b.call(_a, instructionSet);
|
|
5518
5529
|
instructionSet.add(model);
|
|
5519
5530
|
}
|
|
5520
|
-
execute(
|
|
5531
|
+
execute(instruction) {
|
|
5532
|
+
if (!(instruction instanceof Live2DModel)) {
|
|
5533
|
+
instruction.prepare();
|
|
5534
|
+
return;
|
|
5535
|
+
}
|
|
5536
|
+
const model = instruction;
|
|
5521
5537
|
if (!model.visible || model.alpha <= 0) {
|
|
5522
5538
|
return;
|
|
5523
5539
|
}
|
|
@@ -5730,7 +5746,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
5730
5746
|
this.internalModel.updateTransform(internalTransform);
|
|
5731
5747
|
this.internalModel.draw(renderer.gl);
|
|
5732
5748
|
if (this._boundsRetryAfterDraw) {
|
|
5733
|
-
this.updateDrawableBounds();
|
|
5749
|
+
this.updateDrawableBounds(true);
|
|
5734
5750
|
}
|
|
5735
5751
|
renderer.state.resetState();
|
|
5736
5752
|
renderer.texture.resetState();
|
|
@@ -5832,7 +5848,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
5832
5848
|
}
|
|
5833
5849
|
return this._bounds;
|
|
5834
5850
|
}
|
|
5835
|
-
updateDrawableBounds() {
|
|
5851
|
+
updateDrawableBounds(applyAnchor = false) {
|
|
5836
5852
|
if (!this.internalModel) {
|
|
5837
5853
|
this._bounds.set(0, 0, 0, 0);
|
|
5838
5854
|
this._boundsDirty = false;
|
|
@@ -5876,10 +5892,26 @@ var __async = (__this, __arguments, generator) => {
|
|
|
5876
5892
|
}
|
|
5877
5893
|
this._boundsDirty = false;
|
|
5878
5894
|
this._didViewChangeTick++;
|
|
5879
|
-
if (this.anchorMode === "drawable") {
|
|
5895
|
+
if (applyAnchor && this.anchorMode === "drawable") {
|
|
5880
5896
|
this.onAnchorChange();
|
|
5881
5897
|
}
|
|
5882
5898
|
}
|
|
5899
|
+
/**
|
|
5900
|
+
* Updates the model and its drawable bounds before Pixi calculates filter areas.
|
|
5901
|
+
* Filter pipes collect their framebuffer bounds before the Live2D render pipe runs,
|
|
5902
|
+
* so waiting until `renderLive2D()` is too late for animated vertices.
|
|
5903
|
+
*/
|
|
5904
|
+
prepareForRender() {
|
|
5905
|
+
if (!this.internalModel) {
|
|
5906
|
+
return;
|
|
5907
|
+
}
|
|
5908
|
+
const frameDelta = this.deltaTime;
|
|
5909
|
+
this.deltaTime = 0;
|
|
5910
|
+
if (frameDelta) {
|
|
5911
|
+
this.internalModel.update(frameDelta, this.elapsedTime);
|
|
5912
|
+
}
|
|
5913
|
+
this.updateDrawableBounds();
|
|
5914
|
+
}
|
|
5883
5915
|
generateUID() {
|
|
5884
5916
|
return ++this.currentGlId;
|
|
5885
5917
|
}
|
|
@@ -5914,6 +5946,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
5914
5946
|
};
|
|
5915
5947
|
const effects = this.effects;
|
|
5916
5948
|
if (effects) {
|
|
5949
|
+
if (effects.length) {
|
|
5950
|
+
renderPipes.live2d.addPrepare(() => this.prepareForRender(), instructionSet);
|
|
5951
|
+
}
|
|
5917
5952
|
for (let i = 0; i < effects.length; i++) {
|
|
5918
5953
|
const effect = effects[i];
|
|
5919
5954
|
const filters = effect.filters;
|
|
@@ -5944,7 +5979,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
5944
5979
|
*/
|
|
5945
5980
|
initializeOnModelLoad(_options) {
|
|
5946
5981
|
this.tag = `Live2DModel(${this.internalModel.settings.name})`;
|
|
5947
|
-
this.updateDrawableBounds();
|
|
5982
|
+
this.updateDrawableBounds(true);
|
|
5948
5983
|
if (this.anchorMode === "canvas") {
|
|
5949
5984
|
this.onAnchorChange();
|
|
5950
5985
|
}
|