@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/alipay.mjs CHANGED
@@ -1867,8 +1867,8 @@ var deg2rad = Math.PI / 180;
1867
1867
  * Y 轴上视角
1868
1868
  */ _this.fov = 45;
1869
1869
  /**
1870
- * fov 缩放大小
1871
- */ _this.fovScaleRatio = 1;
1870
+ * 视图矩阵
1871
+ */ _this.viewportMatrix = Matrix4.fromIdentity();
1872
1872
  /**
1873
1873
  * 纵横比
1874
1874
  */ _this.aspect = 1.0;
@@ -1909,7 +1909,8 @@ var deg2rad = Math.PI / 180;
1909
1909
  this.transform.fromEffectsTransform(this.owner.transform);
1910
1910
  }
1911
1911
  var reverse = this.clipMode === spec.CameraClipMode.portrait;
1912
- this.projectionMatrix.perspective(this.fov * deg2rad * this.fovScaleRatio, this.aspect, this.nearPlane, this.farPlane, reverse);
1912
+ this.projectionMatrix.perspective(this.fov * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse);
1913
+ this.projectionMatrix.premultiply(this.viewportMatrix);
1913
1914
  this.viewMatrix = this.matrix.invert();
1914
1915
  };
1915
1916
  /**
@@ -1918,14 +1919,14 @@ var deg2rad = Math.PI / 180;
1918
1919
  * @returns 投影矩阵
1919
1920
  */ _proto.getNewProjectionMatrix = function getNewProjectionMatrix(fov) {
1920
1921
  var reverse = this.clipMode === spec.CameraClipMode.portrait;
1921
- return new Matrix4().perspective(Math.min(fov * 1.25, 140) * deg2rad * this.fovScaleRatio, this.aspect, this.nearPlane, this.farPlane, reverse);
1922
+ return new Matrix4().perspective(Math.min(fov * 1.25, 140) * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse).premultiply(this.viewportMatrix);
1922
1923
  };
1923
1924
  /**
1924
1925
  * 计算视角中的包围盒大小
1925
1926
  * @param box - 包围盒
1926
1927
  * @returns 视角中的包围盒
1927
1928
  */ _proto.computeViewAABB = function computeViewAABB(box) {
1928
- var tanTheta = Math.tan(this.fov * deg2rad * this.fovScaleRatio * 0.5);
1929
+ var tanTheta = Math.tan(this.fov * deg2rad * 0.5);
1929
1930
  var aspect = this.aspect;
1930
1931
  var yFarCoord = 0;
1931
1932
  var yNearCoord = 0;
@@ -2056,16 +2057,16 @@ var deg2rad = Math.PI / 180;
2056
2057
  /**
2057
2058
  * 更新默认相机状态,并计算新的透视和相机矩阵
2058
2059
  * @param fov - 视角
2059
- * @param fovScaleRatio - 视角缩放比例
2060
+ * @param viewportMatrix - 视图矩阵
2060
2061
  * @param aspect - 纵横比
2061
2062
  * @param nearPlane - 近裁剪平面
2062
2063
  * @param farPlane - 远裁剪平面
2063
2064
  * @param position - 位置
2064
2065
  * @param rotation - 旋转
2065
2066
  * @param clipMode - 剪裁模式
2066
- */ _proto.updateDefaultCamera = function updateDefaultCamera(fov, fovScaleRatio, aspect, nearPlane, farPlane, position, rotation, clipMode) {
2067
+ */ _proto.updateDefaultCamera = function updateDefaultCamera(fov, viewportMatrix, aspect, nearPlane, farPlane, position, rotation, clipMode) {
2067
2068
  this.defaultCamera.fov = fov;
2068
- this.defaultCamera.fovScaleRatio = fovScaleRatio;
2069
+ this.defaultCamera.viewportMatrix = viewportMatrix.clone();
2069
2070
  this.defaultCamera.aspect = aspect;
2070
2071
  this.defaultCamera.nearPlane = nearPlane;
2071
2072
  this.defaultCamera.farPlane = farPlane;
@@ -3733,12 +3734,12 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3733
3734
  /**
3734
3735
  * 更新默认相机状态,根据传入的相机参数
3735
3736
  * @param camera - 相机参数
3736
- */ _proto.updateDefaultCamera = function updateDefaultCamera(camera, fovScaleRatio) {
3737
+ */ _proto.updateDefaultCamera = function updateDefaultCamera(camera, viewportMatrix) {
3737
3738
  var effectsTransfrom = new Transform(_extends({}, camera, {
3738
3739
  valid: true
3739
3740
  }));
3740
3741
  var newTransform = new PTransform().fromEffectsTransform(effectsTransfrom);
3741
- this.cameraManager.updateDefaultCamera(camera.fov, fovScaleRatio, camera.aspect, camera.near, camera.far, newTransform.getPosition(), newTransform.getRotation(), camera.clipMode);
3742
+ this.cameraManager.updateDefaultCamera(camera.fov, viewportMatrix, camera.aspect, camera.near, camera.far, newTransform.getPosition(), newTransform.getRotation(), camera.clipMode);
3742
3743
  };
3743
3744
  /**
3744
3745
  * 更新插件场景,需要更新内部的相关的插件对象,特别是 Mesh 对象的骨骼动画
@@ -9880,7 +9881,7 @@ var ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
9880
9881
  * @param composition - 当前合成对象
9881
9882
  * @param sceneManager - 当前合成对象绑定的 SceneManager
9882
9883
  */ _proto.updateSceneCamera = function updateSceneCamera(composition) {
9883
- this.scene.updateDefaultCamera(composition.camera.getOptions(), composition.camera.getFovScaleRatio());
9884
+ this.scene.updateDefaultCamera(composition.camera.getOptions(), composition.camera.getViewportMatrix());
9884
9885
  };
9885
9886
  _proto.getLightItemCount = function getLightItemCount() {
9886
9887
  var _this_item_composition;
@@ -10635,10 +10636,10 @@ var LoaderHelper = /*#__PURE__*/ function() {
10635
10636
  }();
10636
10637
 
10637
10638
  var JSONConverter = /*#__PURE__*/ function() {
10638
- function JSONConverter(player) {
10639
+ function JSONConverter(renderer) {
10640
+ this.renderer = renderer;
10639
10641
  this.treeInfo = new TreeInfo();
10640
- this.engine = player.renderer.engine;
10641
- this.renderer = player.renderer;
10642
+ this.engine = renderer.engine;
10642
10643
  this.downloader = new Downloader();
10643
10644
  }
10644
10645
  var _proto = JSONConverter.prototype;
@@ -13756,7 +13757,7 @@ var GLTFHelper = /*#__PURE__*/ function() {
13756
13757
 
13757
13758
  registerPlugin("tree", ModelTreePlugin, VFXItem, true);
13758
13759
  registerPlugin("model", ModelPlugin, VFXItem);
13759
- var version = "2.0.0-alpha.24";
13760
+ var version = "2.0.0-alpha.26";
13760
13761
  logger.info("Plugin model version: " + version + ".");
13761
13762
  if (version !== EFFECTS.version) {
13762
13763
  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!");