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