@galacean/effects-plugin-model 2.0.0-alpha.23 → 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/alipay.js CHANGED
@@ -1890,6 +1890,9 @@ var deg2rad = Math.PI / 180;
1890
1890
  * Y 轴上视角
1891
1891
  */ _this.fov = 45;
1892
1892
  /**
1893
+ * 视图矩阵
1894
+ */ _this.viewportMatrix = Matrix4.fromIdentity();
1895
+ /**
1893
1896
  * 纵横比
1894
1897
  */ _this.aspect = 1.0;
1895
1898
  /**
@@ -1930,6 +1933,7 @@ var deg2rad = Math.PI / 180;
1930
1933
  }
1931
1934
  var reverse = this.clipMode === EFFECTS.spec.CameraClipMode.portrait;
1932
1935
  this.projectionMatrix.perspective(this.fov * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse);
1936
+ this.projectionMatrix.premultiply(this.viewportMatrix);
1933
1937
  this.viewMatrix = this.matrix.invert();
1934
1938
  };
1935
1939
  /**
@@ -1938,7 +1942,7 @@ var deg2rad = Math.PI / 180;
1938
1942
  * @returns 投影矩阵
1939
1943
  */ _proto.getNewProjectionMatrix = function getNewProjectionMatrix(fov) {
1940
1944
  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);
1945
+ return new Matrix4().perspective(Math.min(fov * 1.25, 140) * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse).premultiply(this.viewportMatrix);
1942
1946
  };
1943
1947
  /**
1944
1948
  * 计算视角中的包围盒大小
@@ -2075,15 +2079,17 @@ var deg2rad = Math.PI / 180;
2075
2079
  };
2076
2080
  /**
2077
2081
  * 更新默认相机状态,并计算新的透视和相机矩阵
2078
- * @param fovy - 视角
2082
+ * @param fov - 视角
2083
+ * @param viewportMatrix - 视图矩阵
2079
2084
  * @param aspect - 纵横比
2080
2085
  * @param nearPlane - 近裁剪平面
2081
2086
  * @param farPlane - 远裁剪平面
2082
2087
  * @param position - 位置
2083
2088
  * @param rotation - 旋转
2084
2089
  * @param clipMode - 剪裁模式
2085
- */ _proto.updateDefaultCamera = function updateDefaultCamera(fovy, aspect, nearPlane, farPlane, position, rotation, clipMode) {
2086
- this.defaultCamera.fov = fovy;
2090
+ */ _proto.updateDefaultCamera = function updateDefaultCamera(fov, viewportMatrix, aspect, nearPlane, farPlane, position, rotation, clipMode) {
2091
+ this.defaultCamera.fov = fov;
2092
+ this.defaultCamera.viewportMatrix = viewportMatrix.clone();
2087
2093
  this.defaultCamera.aspect = aspect;
2088
2094
  this.defaultCamera.nearPlane = nearPlane;
2089
2095
  this.defaultCamera.farPlane = farPlane;
@@ -3751,12 +3757,12 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3751
3757
  /**
3752
3758
  * 更新默认相机状态,根据传入的相机参数
3753
3759
  * @param camera - 相机参数
3754
- */ _proto.updateDefaultCamera = function updateDefaultCamera(camera) {
3760
+ */ _proto.updateDefaultCamera = function updateDefaultCamera(camera, viewportMatrix) {
3755
3761
  var effectsTransfrom = new EFFECTS.Transform(_extends({}, camera, {
3756
3762
  valid: true
3757
3763
  }));
3758
3764
  var newTransform = new PTransform().fromEffectsTransform(effectsTransfrom);
3759
- this.cameraManager.updateDefaultCamera(camera.fov, 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);
3760
3766
  };
3761
3767
  /**
3762
3768
  * 更新插件场景,需要更新内部的相关的插件对象,特别是 Mesh 对象的骨骼动画
@@ -9898,7 +9904,7 @@ exports.ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
9898
9904
  * @param composition - 当前合成对象
9899
9905
  * @param sceneManager - 当前合成对象绑定的 SceneManager
9900
9906
  */ _proto.updateSceneCamera = function updateSceneCamera(composition) {
9901
- this.scene.updateDefaultCamera(composition.camera.getOptions());
9907
+ this.scene.updateDefaultCamera(composition.camera.getOptions(), composition.camera.getViewportMatrix());
9902
9908
  };
9903
9909
  _proto.getLightItemCount = function getLightItemCount() {
9904
9910
  var _this_item_composition;
@@ -10653,10 +10659,10 @@ var LoaderHelper = /*#__PURE__*/ function() {
10653
10659
  }();
10654
10660
 
10655
10661
  var JSONConverter = /*#__PURE__*/ function() {
10656
- function JSONConverter(player) {
10662
+ function JSONConverter(renderer) {
10663
+ this.renderer = renderer;
10657
10664
  this.treeInfo = new TreeInfo();
10658
- this.engine = player.renderer.engine;
10659
- this.renderer = player.renderer;
10665
+ this.engine = renderer.engine;
10660
10666
  this.downloader = new EFFECTS.Downloader();
10661
10667
  }
10662
10668
  var _proto = JSONConverter.prototype;
@@ -13774,7 +13780,7 @@ var GLTFHelper = /*#__PURE__*/ function() {
13774
13780
 
13775
13781
  EFFECTS.registerPlugin("tree", ModelTreePlugin, EFFECTS.VFXItem, true);
13776
13782
  EFFECTS.registerPlugin("model", ModelPlugin, EFFECTS.VFXItem);
13777
- var version = "2.0.0-alpha.23";
13783
+ var version = "2.0.0-alpha.25";
13778
13784
  EFFECTS.logger.info("Plugin model version: " + version + ".");
13779
13785
  if (version !== EFFECTS__namespace.version) {
13780
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!");