@galacean/effects-threejs 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.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin 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';
@@ -8897,6 +8897,7 @@ exports.MaterialRenderType = void 0;
8897
8897
  var _this;
8898
8898
  _this = EffectsObject.call(this, engine) || this;
8899
8899
  _this.stringTags = {};
8900
+ _this.enabledMacros = {};
8900
8901
  _this.destroyed = false;
8901
8902
  _this.initialized = false;
8902
8903
  if (props) {
@@ -18742,9 +18743,9 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
18742
18743
  var localTime = time - this.start;
18743
18744
  var duration = this.duration;
18744
18745
  if (localTime - duration > 0.001) {
18745
- if (this.endBehaviour === ItemEndBehavior.loop) {
18746
+ if (this.endBehavior === ItemEndBehavior.loop) {
18746
18747
  localTime = localTime % duration;
18747
- } else if (this.endBehaviour === ItemEndBehavior.freeze) {
18748
+ } else if (this.endBehavior === ItemEndBehavior.freeze) {
18748
18749
  localTime = Math.min(duration, localTime);
18749
18750
  }
18750
18751
  }
@@ -18869,9 +18870,9 @@ var RuntimeClip = /*#__PURE__*/ function() {
18869
18870
  var weight = 1.0;
18870
18871
  var ended = false;
18871
18872
  var started = false;
18872
- var boundItem = this.track.binding;
18873
- if (localTime > clip.start + clip.duration + 0.001 && clip.endBehaviour === ItemEndBehavior.destroy) {
18874
- if (exports.VFXItem.isParticle(boundItem) && this.particleSystem && !this.particleSystem.destroyed) {
18873
+ var boundObject = this.track.binding;
18874
+ if (localTime > clip.start + clip.duration + 0.001 && clip.endBehavior === ItemEndBehavior.destroy) {
18875
+ if (_instanceof1(boundObject, exports.VFXItem) && exports.VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
18875
18876
  weight = 1.0;
18876
18877
  } else {
18877
18878
  weight = 0.0;
@@ -18888,25 +18889,22 @@ var RuntimeClip = /*#__PURE__*/ function() {
18888
18889
  }
18889
18890
  this.parentMixer.setInputWeight(this.playable, weight);
18890
18891
  // 判断动画是否结束
18891
- if (ended && !boundItem.ended) {
18892
- boundItem.ended = true;
18893
- boundItem.onEnd();
18894
- }
18895
- if (ended && this.playable.getPlayState() === PlayState.Playing) {
18896
- this.playable.pause();
18897
- this.onClipEnd();
18892
+ if (ended) {
18893
+ if (_instanceof1(boundObject, exports.VFXItem) && !boundObject.ended) {
18894
+ boundObject.ended = true;
18895
+ boundObject.onEnd();
18896
+ if (!boundObject.compositionReusable && !boundObject.reusable) {
18897
+ boundObject.dispose();
18898
+ this.playable.dispose();
18899
+ }
18900
+ }
18901
+ if (this.playable.getPlayState() === PlayState.Playing) {
18902
+ this.playable.pause();
18903
+ }
18898
18904
  }
18899
18905
  var clipTime = clip.toLocalTime(localTime);
18900
18906
  this.playable.setTime(clipTime);
18901
18907
  };
18902
- _proto.onClipEnd = function onClipEnd() {
18903
- var boundItem = this.track.binding;
18904
- if (!boundItem.compositionReusable && !boundItem.reusable) {
18905
- boundItem.dispose();
18906
- this.playable.dispose();
18907
- return;
18908
- }
18909
- };
18910
18908
  _create_class(RuntimeClip, [
18911
18909
  {
18912
18910
  key: "enable",
@@ -18938,7 +18936,7 @@ exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
18938
18936
  var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
18939
18937
  particleClip.start = boundItem.start;
18940
18938
  particleClip.duration = boundItem.duration;
18941
- particleClip.endBehaviour = boundItem.endBehavior;
18939
+ particleClip.endBehavior = boundItem.endBehavior;
18942
18940
  }
18943
18941
  };
18944
18942
  return ObjectBindingTrack;
@@ -19239,7 +19237,7 @@ function compareTracks(a, b) {
19239
19237
  if (!props) {
19240
19238
  throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
19241
19239
  }
19242
- // endBehaviour 类型需优化
19240
+ // endBehavior 类型需优化
19243
19241
  props.content = itemData.content;
19244
19242
  item = assetLoader.loadGUID(itemData.id);
19245
19243
  item.composition = this.item.composition;
@@ -22251,7 +22249,7 @@ function getStandardCameraContent(model) {
22251
22249
  */ function version30Migration(json) {
22252
22250
  var _loop = function() {
22253
22251
  var composition = _step1.value;
22254
- // composition 的 endbehaviour 兼容
22252
+ // composition 的 endBehavior 兼容
22255
22253
  if (composition.endBehavior === CompositionEndBehavior.pause_destroy || composition.endBehavior === CompositionEndBehavior.pause) {
22256
22254
  composition.endBehavior = END_BEHAVIOR_FREEZE;
22257
22255
  }
@@ -22637,7 +22635,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22637
22635
  {
22638
22636
  start: item.delay,
22639
22637
  duration: item.duration,
22640
- endBehaviour: item.endBehavior,
22638
+ endBehavior: item.endBehavior,
22641
22639
  asset: {
22642
22640
  id: newActivationPlayableAsset.id
22643
22641
  }
@@ -22668,7 +22666,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22668
22666
  {
22669
22667
  start: item.delay,
22670
22668
  duration: item.duration,
22671
- endBehaviour: item.endBehavior,
22669
+ endBehavior: item.endBehavior,
22672
22670
  asset: {
22673
22671
  id: newTransformPlayableAssetData.id
22674
22672
  }
@@ -22696,7 +22694,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22696
22694
  {
22697
22695
  start: item.delay,
22698
22696
  duration: item.duration,
22699
- endBehaviour: item.endBehavior,
22697
+ endBehavior: item.endBehavior,
22700
22698
  asset: {
22701
22699
  id: newSpriteColorPlayableAssetData.id
22702
22700
  }
@@ -22722,7 +22720,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22722
22720
  {
22723
22721
  start: item.delay,
22724
22722
  duration: item.duration,
22725
- endBehaviour: item.endBehavior,
22723
+ endBehavior: item.endBehavior,
22726
22724
  asset: {
22727
22725
  id: newSubCompositionPlayableAssetData.id
22728
22726
  }
@@ -24064,7 +24062,7 @@ var tmpScale = new Vector3(1, 1, 1);
24064
24062
  function Camera(name, options) {
24065
24063
  if (options === void 0) options = {};
24066
24064
  this.name = name;
24067
- this.fovScaleRatio = 1.0;
24065
+ this.viewportMatrix = Matrix4.fromIdentity();
24068
24066
  this.viewMatrix = Matrix4.fromIdentity();
24069
24067
  this.projectionMatrix = Matrix4.fromIdentity();
24070
24068
  this.viewProjectionMatrix = Matrix4.fromIdentity();
@@ -24092,12 +24090,12 @@ var tmpScale = new Vector3(1, 1, 1);
24092
24090
  this.updateMatrix();
24093
24091
  }
24094
24092
  var _proto = Camera.prototype;
24095
- _proto.setFovScaleRatio = function setFovScaleRatio(value) {
24096
- this.fovScaleRatio = value;
24093
+ _proto.setViewportMatrix = function setViewportMatrix(matrix) {
24094
+ this.viewportMatrix = matrix.clone();
24097
24095
  this.dirty = true;
24098
24096
  };
24099
- _proto.getFovScaleRatio = function getFovScaleRatio() {
24100
- return this.fovScaleRatio;
24097
+ _proto.getViewportMatrix = function getViewportMatrix() {
24098
+ return this.viewportMatrix;
24101
24099
  };
24102
24100
  /**
24103
24101
  * 获取相机的视图变换矩阵
@@ -24219,7 +24217,8 @@ var tmpScale = new Vector3(1, 1, 1);
24219
24217
  */ _proto.updateMatrix = function updateMatrix() {
24220
24218
  if (this.dirty) {
24221
24219
  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;
24222
- this.projectionMatrix.perspective(fov * DEG2RAD * this.fovScaleRatio, aspect, near, far, clipMode === CameraClipMode.portrait);
24220
+ this.projectionMatrix.perspective(fov * DEG2RAD, aspect, near, far, clipMode === CameraClipMode.portrait);
24221
+ this.projectionMatrix.premultiply(this.viewportMatrix);
24223
24222
  this.inverseViewMatrix.compose(position, this.getQuat(), tmpScale);
24224
24223
  this.viewMatrix.copyFrom(this.inverseViewMatrix).invert();
24225
24224
  this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix, this.viewMatrix);
@@ -25334,12 +25333,12 @@ var listOrder = 0;
25334
25333
  }
25335
25334
  },
25336
25335
  {
25337
- key: "editorScaleRatio",
25336
+ key: "viewportMatrix",
25338
25337
  get: function get() {
25339
- return this.camera.getFovScaleRatio();
25338
+ return this.camera.getViewportMatrix();
25340
25339
  },
25341
- set: function set(value) {
25342
- this.camera.setFovScaleRatio(value);
25340
+ set: function set(matrix) {
25341
+ this.camera.setViewportMatrix(matrix);
25343
25342
  }
25344
25343
  }
25345
25344
  ]);
@@ -25738,7 +25737,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
25738
25737
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
25739
25738
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
25740
25739
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
25741
- var version$1 = "2.0.0-alpha.24";
25740
+ var version$1 = "2.0.0-alpha.25";
25742
25741
  logger.info("Core version: " + version$1 + ".");
25743
25742
 
25744
25743
  var _obj;
@@ -27371,7 +27370,7 @@ setMaxSpriteMeshItemCount(8);
27371
27370
  */ Mesh.create = function(engine, props) {
27372
27371
  return new ThreeMesh(engine, props);
27373
27372
  };
27374
- var version = "2.0.0-alpha.24";
27373
+ var version = "2.0.0-alpha.25";
27375
27374
  logger.info("THREEJS plugin version: " + version + ".");
27376
27375
 
27377
27376
  exports.AbstractPlugin = AbstractPlugin;