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

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.js CHANGED
@@ -1890,6 +1890,9 @@ var deg2rad = Math.PI / 180;
1890
1890
  * Y 轴上视角
1891
1891
  */ _this.fov = 45;
1892
1892
  /**
1893
+ * fov 缩放大小
1894
+ */ _this.fovScaleRatio = 1;
1895
+ /**
1893
1896
  * 纵横比
1894
1897
  */ _this.aspect = 1.0;
1895
1898
  /**
@@ -1929,7 +1932,7 @@ var deg2rad = Math.PI / 180;
1929
1932
  this.transform.fromEffectsTransform(this.owner.transform);
1930
1933
  }
1931
1934
  var reverse = this.clipMode === EFFECTS.spec.CameraClipMode.portrait;
1932
- this.projectionMatrix.perspective(this.fov * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse);
1935
+ this.projectionMatrix.perspective(this.fov * deg2rad * this.fovScaleRatio, this.aspect, this.nearPlane, this.farPlane, reverse);
1933
1936
  this.viewMatrix = this.matrix.invert();
1934
1937
  };
1935
1938
  /**
@@ -1938,14 +1941,14 @@ var deg2rad = Math.PI / 180;
1938
1941
  * @returns 投影矩阵
1939
1942
  */ _proto.getNewProjectionMatrix = function getNewProjectionMatrix(fov) {
1940
1943
  var reverse = this.clipMode === EFFECTS.spec.CameraClipMode.portrait;
1941
- return new Matrix4().perspective(Math.min(fov * 1.25, 140) * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse);
1944
+ return new Matrix4().perspective(Math.min(fov * 1.25, 140) * deg2rad * this.fovScaleRatio, this.aspect, this.nearPlane, this.farPlane, reverse);
1942
1945
  };
1943
1946
  /**
1944
1947
  * 计算视角中的包围盒大小
1945
1948
  * @param box - 包围盒
1946
1949
  * @returns 视角中的包围盒
1947
1950
  */ _proto.computeViewAABB = function computeViewAABB(box) {
1948
- var tanTheta = Math.tan(this.fov * deg2rad * 0.5);
1951
+ var tanTheta = Math.tan(this.fov * deg2rad * this.fovScaleRatio * 0.5);
1949
1952
  var aspect = this.aspect;
1950
1953
  var yFarCoord = 0;
1951
1954
  var yNearCoord = 0;
@@ -2075,15 +2078,17 @@ var deg2rad = Math.PI / 180;
2075
2078
  };
2076
2079
  /**
2077
2080
  * 更新默认相机状态,并计算新的透视和相机矩阵
2078
- * @param fovy - 视角
2081
+ * @param fov - 视角
2082
+ * @param fovScaleRatio - 视角缩放比例
2079
2083
  * @param aspect - 纵横比
2080
2084
  * @param nearPlane - 近裁剪平面
2081
2085
  * @param farPlane - 远裁剪平面
2082
2086
  * @param position - 位置
2083
2087
  * @param rotation - 旋转
2084
2088
  * @param clipMode - 剪裁模式
2085
- */ _proto.updateDefaultCamera = function updateDefaultCamera(fovy, aspect, nearPlane, farPlane, position, rotation, clipMode) {
2086
- this.defaultCamera.fov = fovy;
2089
+ */ _proto.updateDefaultCamera = function updateDefaultCamera(fov, fovScaleRatio, aspect, nearPlane, farPlane, position, rotation, clipMode) {
2090
+ this.defaultCamera.fov = fov;
2091
+ this.defaultCamera.fovScaleRatio = fovScaleRatio;
2087
2092
  this.defaultCamera.aspect = aspect;
2088
2093
  this.defaultCamera.nearPlane = nearPlane;
2089
2094
  this.defaultCamera.farPlane = farPlane;
@@ -3751,12 +3756,12 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3751
3756
  /**
3752
3757
  * 更新默认相机状态,根据传入的相机参数
3753
3758
  * @param camera - 相机参数
3754
- */ _proto.updateDefaultCamera = function updateDefaultCamera(camera) {
3759
+ */ _proto.updateDefaultCamera = function updateDefaultCamera(camera, fovScaleRatio) {
3755
3760
  var effectsTransfrom = new EFFECTS.Transform(_extends({}, camera, {
3756
3761
  valid: true
3757
3762
  }));
3758
3763
  var newTransform = new PTransform().fromEffectsTransform(effectsTransfrom);
3759
- this.cameraManager.updateDefaultCamera(camera.fov, camera.aspect, camera.near, camera.far, newTransform.getPosition(), newTransform.getRotation(), camera.clipMode);
3764
+ this.cameraManager.updateDefaultCamera(camera.fov, fovScaleRatio, camera.aspect, camera.near, camera.far, newTransform.getPosition(), newTransform.getRotation(), camera.clipMode);
3760
3765
  };
3761
3766
  /**
3762
3767
  * 更新插件场景,需要更新内部的相关的插件对象,特别是 Mesh 对象的骨骼动画
@@ -9898,7 +9903,7 @@ exports.ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
9898
9903
  * @param composition - 当前合成对象
9899
9904
  * @param sceneManager - 当前合成对象绑定的 SceneManager
9900
9905
  */ _proto.updateSceneCamera = function updateSceneCamera(composition) {
9901
- this.scene.updateDefaultCamera(composition.camera.getOptions());
9906
+ this.scene.updateDefaultCamera(composition.camera.getOptions(), composition.camera.getFovScaleRatio());
9902
9907
  };
9903
9908
  _proto.getLightItemCount = function getLightItemCount() {
9904
9909
  var _this_item_composition;
@@ -13774,7 +13779,7 @@ var GLTFHelper = /*#__PURE__*/ function() {
13774
13779
 
13775
13780
  EFFECTS.registerPlugin("tree", ModelTreePlugin, EFFECTS.VFXItem, true);
13776
13781
  EFFECTS.registerPlugin("model", ModelPlugin, EFFECTS.VFXItem);
13777
- var version = "2.0.0-alpha.23";
13782
+ var version = "2.0.0-alpha.24";
13778
13783
  EFFECTS.logger.info("Plugin model version: " + version + ".");
13779
13784
  if (version !== EFFECTS__namespace.version) {
13780
13785
  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!");