@galacean/effects-core 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/camera.d.ts CHANGED
@@ -61,7 +61,7 @@ export declare class Camera {
61
61
  /**
62
62
  * 编辑器用于缩放画布
63
63
  */
64
- private fovScaleRatio;
64
+ private viewportMatrix;
65
65
  private options;
66
66
  private viewMatrix;
67
67
  private projectionMatrix;
@@ -118,8 +118,8 @@ export declare class Camera {
118
118
  */
119
119
  set rotation(value: Euler);
120
120
  get rotation(): Euler;
121
- setFovScaleRatio(value: number): void;
122
- getFovScaleRatio(): number;
121
+ setViewportMatrix(matrix: Matrix4): void;
122
+ getViewportMatrix(): Matrix4;
123
123
  /**
124
124
  * 获取相机的视图变换矩阵
125
125
  * @return
@@ -13,6 +13,7 @@ import type { Texture } from './texture';
13
13
  import type { Disposable, LostHandler } from './utils';
14
14
  import type { VFXItemProps } from './vfx-item';
15
15
  import { VFXItem } from './vfx-item';
16
+ import { type Matrix4 } from '@galacean/effects-math/es/core';
16
17
  export interface CompositionStatistic {
17
18
  loadTime: number;
18
19
  loadStart: number;
@@ -225,8 +226,8 @@ export declare class Composition implements Disposable, LostHandler {
225
226
  * 获取销毁状态
226
227
  */
227
228
  get isDestroyed(): boolean;
228
- set editorScaleRatio(value: number);
229
- get editorScaleRatio(): number;
229
+ set viewportMatrix(matrix: Matrix4);
230
+ get viewportMatrix(): Matrix4;
230
231
  /**
231
232
  * 获取合成的时长
232
233
  */
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime core for the web
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
  'use strict';
@@ -8875,6 +8875,7 @@ exports.MaterialRenderType = void 0;
8875
8875
  var _this;
8876
8876
  _this = EffectsObject.call(this, engine) || this;
8877
8877
  _this.stringTags = {};
8878
+ _this.enabledMacros = {};
8878
8879
  _this.destroyed = false;
8879
8880
  _this.initialized = false;
8880
8881
  if (props) {
@@ -18720,9 +18721,9 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
18720
18721
  var localTime = time - this.start;
18721
18722
  var duration = this.duration;
18722
18723
  if (localTime - duration > 0.001) {
18723
- if (this.endBehaviour === ItemEndBehavior.loop) {
18724
+ if (this.endBehavior === ItemEndBehavior.loop) {
18724
18725
  localTime = localTime % duration;
18725
- } else if (this.endBehaviour === ItemEndBehavior.freeze) {
18726
+ } else if (this.endBehavior === ItemEndBehavior.freeze) {
18726
18727
  localTime = Math.min(duration, localTime);
18727
18728
  }
18728
18729
  }
@@ -18847,9 +18848,9 @@ var RuntimeClip = /*#__PURE__*/ function() {
18847
18848
  var weight = 1.0;
18848
18849
  var ended = false;
18849
18850
  var started = false;
18850
- var boundItem = this.track.binding;
18851
- if (localTime > clip.start + clip.duration + 0.001 && clip.endBehaviour === ItemEndBehavior.destroy) {
18852
- if (exports.VFXItem.isParticle(boundItem) && this.particleSystem && !this.particleSystem.destroyed) {
18851
+ var boundObject = this.track.binding;
18852
+ if (localTime > clip.start + clip.duration + 0.001 && clip.endBehavior === ItemEndBehavior.destroy) {
18853
+ if (_instanceof1(boundObject, exports.VFXItem) && exports.VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
18853
18854
  weight = 1.0;
18854
18855
  } else {
18855
18856
  weight = 0.0;
@@ -18866,25 +18867,22 @@ var RuntimeClip = /*#__PURE__*/ function() {
18866
18867
  }
18867
18868
  this.parentMixer.setInputWeight(this.playable, weight);
18868
18869
  // 判断动画是否结束
18869
- if (ended && !boundItem.ended) {
18870
- boundItem.ended = true;
18871
- boundItem.onEnd();
18872
- }
18873
- if (ended && this.playable.getPlayState() === PlayState.Playing) {
18874
- this.playable.pause();
18875
- this.onClipEnd();
18870
+ if (ended) {
18871
+ if (_instanceof1(boundObject, exports.VFXItem) && !boundObject.ended) {
18872
+ boundObject.ended = true;
18873
+ boundObject.onEnd();
18874
+ if (!boundObject.compositionReusable && !boundObject.reusable) {
18875
+ boundObject.dispose();
18876
+ this.playable.dispose();
18877
+ }
18878
+ }
18879
+ if (this.playable.getPlayState() === PlayState.Playing) {
18880
+ this.playable.pause();
18881
+ }
18876
18882
  }
18877
18883
  var clipTime = clip.toLocalTime(localTime);
18878
18884
  this.playable.setTime(clipTime);
18879
18885
  };
18880
- _proto.onClipEnd = function onClipEnd() {
18881
- var boundItem = this.track.binding;
18882
- if (!boundItem.compositionReusable && !boundItem.reusable) {
18883
- boundItem.dispose();
18884
- this.playable.dispose();
18885
- return;
18886
- }
18887
- };
18888
18886
  _create_class(RuntimeClip, [
18889
18887
  {
18890
18888
  key: "enable",
@@ -18916,7 +18914,7 @@ exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
18916
18914
  var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
18917
18915
  particleClip.start = boundItem.start;
18918
18916
  particleClip.duration = boundItem.duration;
18919
- particleClip.endBehaviour = boundItem.endBehavior;
18917
+ particleClip.endBehavior = boundItem.endBehavior;
18920
18918
  }
18921
18919
  };
18922
18920
  return ObjectBindingTrack;
@@ -19217,7 +19215,7 @@ function compareTracks(a, b) {
19217
19215
  if (!props) {
19218
19216
  throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
19219
19217
  }
19220
- // endBehaviour 类型需优化
19218
+ // endBehavior 类型需优化
19221
19219
  props.content = itemData.content;
19222
19220
  item = assetLoader.loadGUID(itemData.id);
19223
19221
  item.composition = this.item.composition;
@@ -22229,7 +22227,7 @@ function getStandardCameraContent(model) {
22229
22227
  */ function version30Migration(json) {
22230
22228
  var _loop = function() {
22231
22229
  var composition = _step1.value;
22232
- // composition 的 endbehaviour 兼容
22230
+ // composition 的 endBehavior 兼容
22233
22231
  if (composition.endBehavior === CompositionEndBehavior.pause_destroy || composition.endBehavior === CompositionEndBehavior.pause) {
22234
22232
  composition.endBehavior = END_BEHAVIOR_FREEZE;
22235
22233
  }
@@ -22615,7 +22613,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22615
22613
  {
22616
22614
  start: item.delay,
22617
22615
  duration: item.duration,
22618
- endBehaviour: item.endBehavior,
22616
+ endBehavior: item.endBehavior,
22619
22617
  asset: {
22620
22618
  id: newActivationPlayableAsset.id
22621
22619
  }
@@ -22646,7 +22644,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22646
22644
  {
22647
22645
  start: item.delay,
22648
22646
  duration: item.duration,
22649
- endBehaviour: item.endBehavior,
22647
+ endBehavior: item.endBehavior,
22650
22648
  asset: {
22651
22649
  id: newTransformPlayableAssetData.id
22652
22650
  }
@@ -22674,7 +22672,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22674
22672
  {
22675
22673
  start: item.delay,
22676
22674
  duration: item.duration,
22677
- endBehaviour: item.endBehavior,
22675
+ endBehavior: item.endBehavior,
22678
22676
  asset: {
22679
22677
  id: newSpriteColorPlayableAssetData.id
22680
22678
  }
@@ -22700,7 +22698,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22700
22698
  {
22701
22699
  start: item.delay,
22702
22700
  duration: item.duration,
22703
- endBehaviour: item.endBehavior,
22701
+ endBehavior: item.endBehavior,
22704
22702
  asset: {
22705
22703
  id: newSubCompositionPlayableAssetData.id
22706
22704
  }
@@ -24042,7 +24040,7 @@ var tmpScale = new Vector3(1, 1, 1);
24042
24040
  function Camera(name, options) {
24043
24041
  if (options === void 0) options = {};
24044
24042
  this.name = name;
24045
- this.fovScaleRatio = 1.0;
24043
+ this.viewportMatrix = Matrix4.fromIdentity();
24046
24044
  this.viewMatrix = Matrix4.fromIdentity();
24047
24045
  this.projectionMatrix = Matrix4.fromIdentity();
24048
24046
  this.viewProjectionMatrix = Matrix4.fromIdentity();
@@ -24070,12 +24068,12 @@ var tmpScale = new Vector3(1, 1, 1);
24070
24068
  this.updateMatrix();
24071
24069
  }
24072
24070
  var _proto = Camera.prototype;
24073
- _proto.setFovScaleRatio = function setFovScaleRatio(value) {
24074
- this.fovScaleRatio = value;
24071
+ _proto.setViewportMatrix = function setViewportMatrix(matrix) {
24072
+ this.viewportMatrix = matrix.clone();
24075
24073
  this.dirty = true;
24076
24074
  };
24077
- _proto.getFovScaleRatio = function getFovScaleRatio() {
24078
- return this.fovScaleRatio;
24075
+ _proto.getViewportMatrix = function getViewportMatrix() {
24076
+ return this.viewportMatrix;
24079
24077
  };
24080
24078
  /**
24081
24079
  * 获取相机的视图变换矩阵
@@ -24197,7 +24195,8 @@ var tmpScale = new Vector3(1, 1, 1);
24197
24195
  */ _proto.updateMatrix = function updateMatrix() {
24198
24196
  if (this.dirty) {
24199
24197
  var _this_options = this.options, fov = _this_options.fov, aspect = _this_options.aspect, near = _this_options.near, far = _this_options.far, clipMode = _this_options.clipMode, position = _this_options.position;
24200
- this.projectionMatrix.perspective(fov * DEG2RAD * this.fovScaleRatio, aspect, near, far, clipMode === CameraClipMode.portrait);
24198
+ this.projectionMatrix.perspective(fov * DEG2RAD, aspect, near, far, clipMode === CameraClipMode.portrait);
24199
+ this.projectionMatrix.premultiply(this.viewportMatrix);
24201
24200
  this.inverseViewMatrix.compose(position, this.getQuat(), tmpScale);
24202
24201
  this.viewMatrix.copyFrom(this.inverseViewMatrix).invert();
24203
24202
  this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix, this.viewMatrix);
@@ -25312,12 +25311,12 @@ var listOrder = 0;
25312
25311
  }
25313
25312
  },
25314
25313
  {
25315
- key: "editorScaleRatio",
25314
+ key: "viewportMatrix",
25316
25315
  get: function get() {
25317
- return this.camera.getFovScaleRatio();
25316
+ return this.camera.getViewportMatrix();
25318
25317
  },
25319
- set: function set(value) {
25320
- this.camera.setFovScaleRatio(value);
25318
+ set: function set(matrix) {
25319
+ this.camera.setViewportMatrix(matrix);
25321
25320
  }
25322
25321
  }
25323
25322
  ]);
@@ -25716,7 +25715,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
25716
25715
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
25717
25716
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
25718
25717
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
25719
- var version = "2.0.0-alpha.24";
25718
+ var version = "2.0.0-alpha.25";
25720
25719
  logger.info("Core version: " + version + ".");
25721
25720
 
25722
25721
  exports.AbstractPlugin = AbstractPlugin;