untitled-pixi-live2d-engine 1.3.1 → 1.3.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/dist/index.es.js CHANGED
@@ -105,7 +105,7 @@ const config = {
105
105
  preserveExpressionOnMotion: true,
106
106
  cubism: CubismFrameworkConfig
107
107
  };
108
- const VERSION = "1.3.1";
108
+ const VERSION = "1.3.2";
109
109
  const logger = {
110
110
  log(tag, ...messages) {
111
111
  if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
@@ -3215,6 +3215,8 @@ class Live2DModel extends Container {
3215
3215
  this._boundsRetryAfterDraw = true;
3216
3216
  }
3217
3217
  this._boundsDirty = false;
3218
+ this._didViewChangeTick++;
3219
+ this.onAnchorChange();
3218
3220
  }
3219
3221
  generateUID() {
3220
3222
  return ++this.currentGlId;
@@ -3280,7 +3282,6 @@ class Live2DModel extends Container {
3280
3282
  */
3281
3283
  initializeOnModelLoad(_options) {
3282
3284
  this.tag = `Live2DModel(${this.internalModel.settings.name})`;
3283
- this.onAnchorChange();
3284
3285
  this.updateDrawableBounds();
3285
3286
  }
3286
3287
  /**
@@ -3291,9 +3292,10 @@ class Live2DModel extends Container {
3291
3292
  if (!this.internalModel || !this.pivot) {
3292
3293
  return;
3293
3294
  }
3295
+ const bounds = this.bounds;
3294
3296
  this.pivot.set(
3295
- this.anchor.x * this.internalModel.width,
3296
- this.anchor.y * this.internalModel.height
3297
+ bounds.minX + this.anchor.x * bounds.width,
3298
+ bounds.minY + this.anchor.y * bounds.height
3297
3299
  );
3298
3300
  }
3299
3301
  /**
@@ -3526,9 +3528,14 @@ class Live2DModel extends Container {
3526
3528
  this.getBounds().set(0, 0, 0, 0);
3527
3529
  return;
3528
3530
  }
3529
- const width = this.internalModel.width;
3530
- const height = this.internalModel.height;
3531
- this.getBounds().addFrame(0, 0, width, height, this.transform.matrix);
3531
+ const bounds = this.bounds;
3532
+ this.getBounds().addFrame(
3533
+ bounds.minX,
3534
+ bounds.minY,
3535
+ bounds.maxX,
3536
+ bounds.maxY,
3537
+ this.transform.matrix
3538
+ );
3532
3539
  }
3533
3540
  /**
3534
3541
  * Updates the model. Note this method just updates the timer,
@@ -12726,8 +12733,15 @@ class CubismInternalModel extends InternalModel {
12726
12733
  array[13] = matrix.ty;
12727
12734
  this.renderer.setMvpMatrix(tempMatrix);
12728
12735
  const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);
12736
+ const previousCullFaceMode = gl.getParameter(gl.CULL_FACE_MODE);
12737
+ const determinant = array[0] * array[5] - array[1] * array[4];
12738
+ gl.cullFace(determinant < 0 ? gl.FRONT : gl.BACK);
12729
12739
  this.renderer.setRenderState(framebuffer, this.viewport);
12730
- this.renderer.drawModel();
12740
+ try {
12741
+ this.renderer.drawModel();
12742
+ } finally {
12743
+ gl.cullFace(previousCullFaceMode);
12744
+ }
12731
12745
  }
12732
12746
  extendParallelMotionManager(managerCount) {
12733
12747
  while (this.parallelMotionManager.length < managerCount) {
package/dist/index.js CHANGED
@@ -108,7 +108,7 @@ var __async = (__this, __arguments, generator) => {
108
108
  preserveExpressionOnMotion: true,
109
109
  cubism: CubismFrameworkConfig
110
110
  };
111
- const VERSION = "1.3.1";
111
+ const VERSION = "1.3.2";
112
112
  const logger = {
113
113
  log(tag, ...messages) {
114
114
  if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
@@ -3218,6 +3218,8 @@ var __async = (__this, __arguments, generator) => {
3218
3218
  this._boundsRetryAfterDraw = true;
3219
3219
  }
3220
3220
  this._boundsDirty = false;
3221
+ this._didViewChangeTick++;
3222
+ this.onAnchorChange();
3221
3223
  }
3222
3224
  generateUID() {
3223
3225
  return ++this.currentGlId;
@@ -3283,7 +3285,6 @@ var __async = (__this, __arguments, generator) => {
3283
3285
  */
3284
3286
  initializeOnModelLoad(_options) {
3285
3287
  this.tag = `Live2DModel(${this.internalModel.settings.name})`;
3286
- this.onAnchorChange();
3287
3288
  this.updateDrawableBounds();
3288
3289
  }
3289
3290
  /**
@@ -3294,9 +3295,10 @@ var __async = (__this, __arguments, generator) => {
3294
3295
  if (!this.internalModel || !this.pivot) {
3295
3296
  return;
3296
3297
  }
3298
+ const bounds = this.bounds;
3297
3299
  this.pivot.set(
3298
- this.anchor.x * this.internalModel.width,
3299
- this.anchor.y * this.internalModel.height
3300
+ bounds.minX + this.anchor.x * bounds.width,
3301
+ bounds.minY + this.anchor.y * bounds.height
3300
3302
  );
3301
3303
  }
3302
3304
  /**
@@ -3529,9 +3531,14 @@ var __async = (__this, __arguments, generator) => {
3529
3531
  this.getBounds().set(0, 0, 0, 0);
3530
3532
  return;
3531
3533
  }
3532
- const width = this.internalModel.width;
3533
- const height = this.internalModel.height;
3534
- this.getBounds().addFrame(0, 0, width, height, this.transform.matrix);
3534
+ const bounds = this.bounds;
3535
+ this.getBounds().addFrame(
3536
+ bounds.minX,
3537
+ bounds.minY,
3538
+ bounds.maxX,
3539
+ bounds.maxY,
3540
+ this.transform.matrix
3541
+ );
3535
3542
  }
3536
3543
  /**
3537
3544
  * Updates the model. Note this method just updates the timer,
@@ -12729,8 +12736,15 @@ var __async = (__this, __arguments, generator) => {
12729
12736
  array[13] = matrix.ty;
12730
12737
  this.renderer.setMvpMatrix(tempMatrix);
12731
12738
  const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);
12739
+ const previousCullFaceMode = gl.getParameter(gl.CULL_FACE_MODE);
12740
+ const determinant = array[0] * array[5] - array[1] * array[4];
12741
+ gl.cullFace(determinant < 0 ? gl.FRONT : gl.BACK);
12732
12742
  this.renderer.setRenderState(framebuffer, this.viewport);
12733
- this.renderer.drawModel();
12743
+ try {
12744
+ this.renderer.drawModel();
12745
+ } finally {
12746
+ gl.cullFace(previousCullFaceMode);
12747
+ }
12734
12748
  }
12735
12749
  extendParallelMotionManager(managerCount) {
12736
12750
  while (this.parallelMotionManager.length < managerCount) {