@galacean/effects-plugin-model 2.0.0-alpha.24 → 2.0.0-alpha.26

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/loader.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects player model plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 飂兮
6
- * Version: v2.0.0-alpha.24
6
+ * Version: v2.0.0-alpha.26
7
7
  */
8
8
 
9
9
  import * as EFFECTS from '@galacean/effects';
@@ -3780,7 +3780,7 @@ var ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
3780
3780
  * @param composition - 当前合成对象
3781
3781
  * @param sceneManager - 当前合成对象绑定的 SceneManager
3782
3782
  */ _proto.updateSceneCamera = function updateSceneCamera(composition) {
3783
- this.scene.updateDefaultCamera(composition.camera.getOptions(), composition.camera.getFovScaleRatio());
3783
+ this.scene.updateDefaultCamera(composition.camera.getOptions(), composition.camera.getViewportMatrix());
3784
3784
  };
3785
3785
  _proto.getLightItemCount = function getLightItemCount() {
3786
3786
  var _this_item_composition;
@@ -4416,7 +4416,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
4416
4416
 
4417
4417
  registerPlugin("tree", ModelTreePlugin, VFXItem, true);
4418
4418
  registerPlugin("model", ModelPlugin, VFXItem);
4419
- var version = "2.0.0-alpha.24";
4419
+ var version = "2.0.0-alpha.26";
4420
4420
  logger.info("Plugin model version: " + version + ".");
4421
4421
  if (version !== EFFECTS.version) {
4422
4422
  console.error("注意:请统一 Model 插件与 Player 版本,不统一的版本混用会有不可预知的后果!", "\nAttention: Please ensure the Model plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");
@@ -8513,8 +8513,8 @@ var deg2rad = Math.PI / 180;
8513
8513
  * Y 轴上视角
8514
8514
  */ _this.fov = 45;
8515
8515
  /**
8516
- * fov 缩放大小
8517
- */ _this.fovScaleRatio = 1;
8516
+ * 视图矩阵
8517
+ */ _this.viewportMatrix = Matrix4.fromIdentity();
8518
8518
  /**
8519
8519
  * 纵横比
8520
8520
  */ _this.aspect = 1.0;
@@ -8555,7 +8555,8 @@ var deg2rad = Math.PI / 180;
8555
8555
  this.transform.fromEffectsTransform(this.owner.transform);
8556
8556
  }
8557
8557
  var reverse = this.clipMode === spec.CameraClipMode.portrait;
8558
- this.projectionMatrix.perspective(this.fov * deg2rad * this.fovScaleRatio, this.aspect, this.nearPlane, this.farPlane, reverse);
8558
+ this.projectionMatrix.perspective(this.fov * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse);
8559
+ this.projectionMatrix.premultiply(this.viewportMatrix);
8559
8560
  this.viewMatrix = this.matrix.invert();
8560
8561
  };
8561
8562
  /**
@@ -8564,14 +8565,14 @@ var deg2rad = Math.PI / 180;
8564
8565
  * @returns 投影矩阵
8565
8566
  */ _proto.getNewProjectionMatrix = function getNewProjectionMatrix(fov) {
8566
8567
  var reverse = this.clipMode === spec.CameraClipMode.portrait;
8567
- return new Matrix4().perspective(Math.min(fov * 1.25, 140) * deg2rad * this.fovScaleRatio, this.aspect, this.nearPlane, this.farPlane, reverse);
8568
+ return new Matrix4().perspective(Math.min(fov * 1.25, 140) * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse).premultiply(this.viewportMatrix);
8568
8569
  };
8569
8570
  /**
8570
8571
  * 计算视角中的包围盒大小
8571
8572
  * @param box - 包围盒
8572
8573
  * @returns 视角中的包围盒
8573
8574
  */ _proto.computeViewAABB = function computeViewAABB(box) {
8574
- var tanTheta = Math.tan(this.fov * deg2rad * this.fovScaleRatio * 0.5);
8575
+ var tanTheta = Math.tan(this.fov * deg2rad * 0.5);
8575
8576
  var aspect = this.aspect;
8576
8577
  var yFarCoord = 0;
8577
8578
  var yNearCoord = 0;
@@ -8702,16 +8703,16 @@ var deg2rad = Math.PI / 180;
8702
8703
  /**
8703
8704
  * 更新默认相机状态,并计算新的透视和相机矩阵
8704
8705
  * @param fov - 视角
8705
- * @param fovScaleRatio - 视角缩放比例
8706
+ * @param viewportMatrix - 视图矩阵
8706
8707
  * @param aspect - 纵横比
8707
8708
  * @param nearPlane - 近裁剪平面
8708
8709
  * @param farPlane - 远裁剪平面
8709
8710
  * @param position - 位置
8710
8711
  * @param rotation - 旋转
8711
8712
  * @param clipMode - 剪裁模式
8712
- */ _proto.updateDefaultCamera = function updateDefaultCamera(fov, fovScaleRatio, aspect, nearPlane, farPlane, position, rotation, clipMode) {
8713
+ */ _proto.updateDefaultCamera = function updateDefaultCamera(fov, viewportMatrix, aspect, nearPlane, farPlane, position, rotation, clipMode) {
8713
8714
  this.defaultCamera.fov = fov;
8714
- this.defaultCamera.fovScaleRatio = fovScaleRatio;
8715
+ this.defaultCamera.viewportMatrix = viewportMatrix.clone();
8715
8716
  this.defaultCamera.aspect = aspect;
8716
8717
  this.defaultCamera.nearPlane = nearPlane;
8717
8718
  this.defaultCamera.farPlane = farPlane;
@@ -10126,12 +10127,12 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
10126
10127
  /**
10127
10128
  * 更新默认相机状态,根据传入的相机参数
10128
10129
  * @param camera - 相机参数
10129
- */ _proto.updateDefaultCamera = function updateDefaultCamera(camera, fovScaleRatio) {
10130
+ */ _proto.updateDefaultCamera = function updateDefaultCamera(camera, viewportMatrix) {
10130
10131
  var effectsTransfrom = new Transform(_extends({}, camera, {
10131
10132
  valid: true
10132
10133
  }));
10133
10134
  var newTransform = new PTransform().fromEffectsTransform(effectsTransfrom);
10134
- this.cameraManager.updateDefaultCamera(camera.fov, fovScaleRatio, camera.aspect, camera.near, camera.far, newTransform.getPosition(), newTransform.getRotation(), camera.clipMode);
10135
+ this.cameraManager.updateDefaultCamera(camera.fov, viewportMatrix, camera.aspect, camera.near, camera.far, newTransform.getPosition(), newTransform.getRotation(), camera.clipMode);
10135
10136
  };
10136
10137
  /**
10137
10138
  * 更新插件场景,需要更新内部的相关的插件对象,特别是 Mesh 对象的骨骼动画
@@ -10311,10 +10312,10 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
10311
10312
  }();
10312
10313
 
10313
10314
  var JSONConverter = /*#__PURE__*/ function() {
10314
- function JSONConverter(player) {
10315
+ function JSONConverter(renderer) {
10316
+ this.renderer = renderer;
10315
10317
  this.treeInfo = new TreeInfo();
10316
- this.engine = player.renderer.engine;
10317
- this.renderer = player.renderer;
10318
+ this.engine = renderer.engine;
10318
10319
  this.downloader = new Downloader();
10319
10320
  }
10320
10321
  var _proto = JSONConverter.prototype;