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

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.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.25
7
7
  */
8
8
 
9
9
  import * as EFFECTS from '@galacean/effects';
@@ -1875,8 +1875,8 @@ var deg2rad = Math.PI / 180;
1875
1875
  * Y 轴上视角
1876
1876
  */ _this.fov = 45;
1877
1877
  /**
1878
- * fov 缩放大小
1879
- */ _this.fovScaleRatio = 1;
1878
+ * 视图矩阵
1879
+ */ _this.viewportMatrix = Matrix4.fromIdentity();
1880
1880
  /**
1881
1881
  * 纵横比
1882
1882
  */ _this.aspect = 1.0;
@@ -1917,7 +1917,8 @@ var deg2rad = Math.PI / 180;
1917
1917
  this.transform.fromEffectsTransform(this.owner.transform);
1918
1918
  }
1919
1919
  var reverse = this.clipMode === spec.CameraClipMode.portrait;
1920
- this.projectionMatrix.perspective(this.fov * deg2rad * this.fovScaleRatio, this.aspect, this.nearPlane, this.farPlane, reverse);
1920
+ this.projectionMatrix.perspective(this.fov * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse);
1921
+ this.projectionMatrix.premultiply(this.viewportMatrix);
1921
1922
  this.viewMatrix = this.matrix.invert();
1922
1923
  };
1923
1924
  /**
@@ -1926,14 +1927,14 @@ var deg2rad = Math.PI / 180;
1926
1927
  * @returns 投影矩阵
1927
1928
  */ _proto.getNewProjectionMatrix = function getNewProjectionMatrix(fov) {
1928
1929
  var reverse = this.clipMode === spec.CameraClipMode.portrait;
1929
- return new Matrix4().perspective(Math.min(fov * 1.25, 140) * deg2rad * this.fovScaleRatio, this.aspect, this.nearPlane, this.farPlane, reverse);
1930
+ return new Matrix4().perspective(Math.min(fov * 1.25, 140) * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse).premultiply(this.viewportMatrix);
1930
1931
  };
1931
1932
  /**
1932
1933
  * 计算视角中的包围盒大小
1933
1934
  * @param box - 包围盒
1934
1935
  * @returns 视角中的包围盒
1935
1936
  */ _proto.computeViewAABB = function computeViewAABB(box) {
1936
- var tanTheta = Math.tan(this.fov * deg2rad * this.fovScaleRatio * 0.5);
1937
+ var tanTheta = Math.tan(this.fov * deg2rad * 0.5);
1937
1938
  var aspect = this.aspect;
1938
1939
  var yFarCoord = 0;
1939
1940
  var yNearCoord = 0;
@@ -2064,16 +2065,16 @@ var deg2rad = Math.PI / 180;
2064
2065
  /**
2065
2066
  * 更新默认相机状态,并计算新的透视和相机矩阵
2066
2067
  * @param fov - 视角
2067
- * @param fovScaleRatio - 视角缩放比例
2068
+ * @param viewportMatrix - 视图矩阵
2068
2069
  * @param aspect - 纵横比
2069
2070
  * @param nearPlane - 近裁剪平面
2070
2071
  * @param farPlane - 远裁剪平面
2071
2072
  * @param position - 位置
2072
2073
  * @param rotation - 旋转
2073
2074
  * @param clipMode - 剪裁模式
2074
- */ _proto.updateDefaultCamera = function updateDefaultCamera(fov, fovScaleRatio, aspect, nearPlane, farPlane, position, rotation, clipMode) {
2075
+ */ _proto.updateDefaultCamera = function updateDefaultCamera(fov, viewportMatrix, aspect, nearPlane, farPlane, position, rotation, clipMode) {
2075
2076
  this.defaultCamera.fov = fov;
2076
- this.defaultCamera.fovScaleRatio = fovScaleRatio;
2077
+ this.defaultCamera.viewportMatrix = viewportMatrix.clone();
2077
2078
  this.defaultCamera.aspect = aspect;
2078
2079
  this.defaultCamera.nearPlane = nearPlane;
2079
2080
  this.defaultCamera.farPlane = farPlane;
@@ -3741,12 +3742,12 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3741
3742
  /**
3742
3743
  * 更新默认相机状态,根据传入的相机参数
3743
3744
  * @param camera - 相机参数
3744
- */ _proto.updateDefaultCamera = function updateDefaultCamera(camera, fovScaleRatio) {
3745
+ */ _proto.updateDefaultCamera = function updateDefaultCamera(camera, viewportMatrix) {
3745
3746
  var effectsTransfrom = new Transform(_extends({}, camera, {
3746
3747
  valid: true
3747
3748
  }));
3748
3749
  var newTransform = new PTransform().fromEffectsTransform(effectsTransfrom);
3749
- this.cameraManager.updateDefaultCamera(camera.fov, fovScaleRatio, camera.aspect, camera.near, camera.far, newTransform.getPosition(), newTransform.getRotation(), camera.clipMode);
3750
+ this.cameraManager.updateDefaultCamera(camera.fov, viewportMatrix, camera.aspect, camera.near, camera.far, newTransform.getPosition(), newTransform.getRotation(), camera.clipMode);
3750
3751
  };
3751
3752
  /**
3752
3753
  * 更新插件场景,需要更新内部的相关的插件对象,特别是 Mesh 对象的骨骼动画
@@ -9888,7 +9889,7 @@ var ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
9888
9889
  * @param composition - 当前合成对象
9889
9890
  * @param sceneManager - 当前合成对象绑定的 SceneManager
9890
9891
  */ _proto.updateSceneCamera = function updateSceneCamera(composition) {
9891
- this.scene.updateDefaultCamera(composition.camera.getOptions(), composition.camera.getFovScaleRatio());
9892
+ this.scene.updateDefaultCamera(composition.camera.getOptions(), composition.camera.getViewportMatrix());
9892
9893
  };
9893
9894
  _proto.getLightItemCount = function getLightItemCount() {
9894
9895
  var _this_item_composition;
@@ -10643,10 +10644,10 @@ var LoaderHelper = /*#__PURE__*/ function() {
10643
10644
  }();
10644
10645
 
10645
10646
  var JSONConverter = /*#__PURE__*/ function() {
10646
- function JSONConverter(player) {
10647
+ function JSONConverter(renderer) {
10648
+ this.renderer = renderer;
10647
10649
  this.treeInfo = new TreeInfo();
10648
- this.engine = player.renderer.engine;
10649
- this.renderer = player.renderer;
10650
+ this.engine = renderer.engine;
10650
10651
  this.downloader = new Downloader();
10651
10652
  }
10652
10653
  var _proto = JSONConverter.prototype;
@@ -13764,7 +13765,7 @@ var GLTFHelper = /*#__PURE__*/ function() {
13764
13765
 
13765
13766
  registerPlugin("tree", ModelTreePlugin, VFXItem, true);
13766
13767
  registerPlugin("model", ModelPlugin, VFXItem);
13767
- var version = "2.0.0-alpha.24";
13768
+ var version = "2.0.0-alpha.25";
13768
13769
  logger.info("Plugin model version: " + version + ".");
13769
13770
  if (version !== EFFECTS.version) {
13770
13771
  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!");