@galacean/effects-core 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/index.mjs 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.23
6
+ * Version: v2.0.0-alpha.25
7
7
  */
8
8
 
9
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -8871,6 +8871,7 @@ var MaterialRenderType;
8871
8871
  var _this;
8872
8872
  _this = EffectsObject.call(this, engine) || this;
8873
8873
  _this.stringTags = {};
8874
+ _this.enabledMacros = {};
8874
8875
  _this.destroyed = false;
8875
8876
  _this.initialized = false;
8876
8877
  if (props) {
@@ -16387,6 +16388,9 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
16387
16388
  return _this;
16388
16389
  }
16389
16390
  var _proto = ParticleSystem.prototype;
16391
+ _proto.isFrozen = function isFrozen() {
16392
+ return this.frozen;
16393
+ };
16390
16394
  _proto.initEmitterTransform = function initEmitterTransform() {
16391
16395
  var position = this.item.transform.position.clone();
16392
16396
  var rotation = this.item.transform.rotation.clone();
@@ -16520,6 +16524,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
16520
16524
  return b.reset();
16521
16525
  });
16522
16526
  this.frozen = false;
16527
+ this.ended = false;
16523
16528
  };
16524
16529
  _proto.onUpdate = function onUpdate(delta) {
16525
16530
  var _this = this;
@@ -17303,10 +17308,7 @@ function randomArrItem(arr, keepArr) {
17303
17308
  */ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
17304
17309
  _inherits(ParticleBehaviourPlayable, Playable);
17305
17310
  function ParticleBehaviourPlayable() {
17306
- var _this;
17307
- _this = Playable.apply(this, arguments) || this;
17308
- _this.lastTime = 0;
17309
- return _this;
17311
+ return Playable.apply(this, arguments);
17310
17312
  }
17311
17313
  var _proto = ParticleBehaviourPlayable.prototype;
17312
17314
  _proto.start = function start(context) {
@@ -17331,13 +17333,11 @@ function randomArrItem(arr, keepArr) {
17331
17333
  // particleSystem.setParentTransform(parentItem.transform);
17332
17334
  particleSystem.setVisible(true);
17333
17335
  var deltaTime = context.deltaTime;
17334
- // 直接用 this.lastTime - this.time 获取 deltaTime 会有精度问题
17335
- if (this.lastTime === this.time) {
17336
- deltaTime = 0;
17336
+ if (this.time < particleSystem.item.duration && particleSystem.isFrozen()) {
17337
+ particleSystem.reset();
17337
17338
  }
17338
17339
  particleSystem.onUpdate(deltaTime);
17339
17340
  }
17340
- this.lastTime = this.time;
17341
17341
  };
17342
17342
  return ParticleBehaviourPlayable;
17343
17343
  }(Playable);
@@ -18717,9 +18717,9 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
18717
18717
  var localTime = time - this.start;
18718
18718
  var duration = this.duration;
18719
18719
  if (localTime - duration > 0.001) {
18720
- if (this.endBehaviour === ItemEndBehavior.loop) {
18720
+ if (this.endBehavior === ItemEndBehavior.loop) {
18721
18721
  localTime = localTime % duration;
18722
- } else if (this.endBehaviour === ItemEndBehavior.freeze) {
18722
+ } else if (this.endBehavior === ItemEndBehavior.freeze) {
18723
18723
  localTime = Math.min(duration, localTime);
18724
18724
  }
18725
18725
  }
@@ -18844,9 +18844,9 @@ var RuntimeClip = /*#__PURE__*/ function() {
18844
18844
  var weight = 1.0;
18845
18845
  var ended = false;
18846
18846
  var started = false;
18847
- var boundItem = this.track.binding;
18848
- if (localTime > clip.start + clip.duration + 0.001 && clip.endBehaviour === ItemEndBehavior.destroy) {
18849
- if (VFXItem.isParticle(boundItem) && this.particleSystem && !this.particleSystem.destroyed) {
18847
+ var boundObject = this.track.binding;
18848
+ if (localTime > clip.start + clip.duration + 0.001 && clip.endBehavior === ItemEndBehavior.destroy) {
18849
+ if (_instanceof1(boundObject, VFXItem) && VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
18850
18850
  weight = 1.0;
18851
18851
  } else {
18852
18852
  weight = 0.0;
@@ -18863,25 +18863,22 @@ var RuntimeClip = /*#__PURE__*/ function() {
18863
18863
  }
18864
18864
  this.parentMixer.setInputWeight(this.playable, weight);
18865
18865
  // 判断动画是否结束
18866
- if (ended && !boundItem.ended) {
18867
- boundItem.ended = true;
18868
- boundItem.onEnd();
18869
- }
18870
- if (ended && this.playable.getPlayState() === PlayState.Playing) {
18871
- this.playable.pause();
18872
- this.onClipEnd();
18866
+ if (ended) {
18867
+ if (_instanceof1(boundObject, VFXItem) && !boundObject.ended) {
18868
+ boundObject.ended = true;
18869
+ boundObject.onEnd();
18870
+ if (!boundObject.compositionReusable && !boundObject.reusable) {
18871
+ boundObject.dispose();
18872
+ this.playable.dispose();
18873
+ }
18874
+ }
18875
+ if (this.playable.getPlayState() === PlayState.Playing) {
18876
+ this.playable.pause();
18877
+ }
18873
18878
  }
18874
18879
  var clipTime = clip.toLocalTime(localTime);
18875
18880
  this.playable.setTime(clipTime);
18876
18881
  };
18877
- _proto.onClipEnd = function onClipEnd() {
18878
- var boundItem = this.track.binding;
18879
- if (!boundItem.compositionReusable && !boundItem.reusable) {
18880
- boundItem.dispose();
18881
- this.playable.dispose();
18882
- return;
18883
- }
18884
- };
18885
18882
  _create_class(RuntimeClip, [
18886
18883
  {
18887
18884
  key: "enable",
@@ -18913,7 +18910,7 @@ var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
18913
18910
  var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
18914
18911
  particleClip.start = boundItem.start;
18915
18912
  particleClip.duration = boundItem.duration;
18916
- particleClip.endBehaviour = boundItem.endBehavior;
18913
+ particleClip.endBehavior = boundItem.endBehavior;
18917
18914
  }
18918
18915
  };
18919
18916
  return ObjectBindingTrack;
@@ -19214,7 +19211,7 @@ function compareTracks(a, b) {
19214
19211
  if (!props) {
19215
19212
  throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
19216
19213
  }
19217
- // endBehaviour 类型需优化
19214
+ // endBehavior 类型需优化
19218
19215
  props.content = itemData.content;
19219
19216
  item = assetLoader.loadGUID(itemData.id);
19220
19217
  item.composition = this.item.composition;
@@ -22226,7 +22223,7 @@ function getStandardCameraContent(model) {
22226
22223
  */ function version30Migration(json) {
22227
22224
  var _loop = function() {
22228
22225
  var composition = _step1.value;
22229
- // composition 的 endbehaviour 兼容
22226
+ // composition 的 endBehavior 兼容
22230
22227
  if (composition.endBehavior === CompositionEndBehavior.pause_destroy || composition.endBehavior === CompositionEndBehavior.pause) {
22231
22228
  composition.endBehavior = END_BEHAVIOR_FREEZE;
22232
22229
  }
@@ -22612,7 +22609,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22612
22609
  {
22613
22610
  start: item.delay,
22614
22611
  duration: item.duration,
22615
- endBehaviour: item.endBehavior,
22612
+ endBehavior: item.endBehavior,
22616
22613
  asset: {
22617
22614
  id: newActivationPlayableAsset.id
22618
22615
  }
@@ -22643,7 +22640,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22643
22640
  {
22644
22641
  start: item.delay,
22645
22642
  duration: item.duration,
22646
- endBehaviour: item.endBehavior,
22643
+ endBehavior: item.endBehavior,
22647
22644
  asset: {
22648
22645
  id: newTransformPlayableAssetData.id
22649
22646
  }
@@ -22671,7 +22668,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22671
22668
  {
22672
22669
  start: item.delay,
22673
22670
  duration: item.duration,
22674
- endBehaviour: item.endBehavior,
22671
+ endBehavior: item.endBehavior,
22675
22672
  asset: {
22676
22673
  id: newSpriteColorPlayableAssetData.id
22677
22674
  }
@@ -22697,7 +22694,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22697
22694
  {
22698
22695
  start: item.delay,
22699
22696
  duration: item.duration,
22700
- endBehaviour: item.endBehavior,
22697
+ endBehavior: item.endBehavior,
22701
22698
  asset: {
22702
22699
  id: newSubCompositionPlayableAssetData.id
22703
22700
  }
@@ -24039,7 +24036,7 @@ var tmpScale = new Vector3(1, 1, 1);
24039
24036
  function Camera(name, options) {
24040
24037
  if (options === void 0) options = {};
24041
24038
  this.name = name;
24042
- this.fovScaleRatio = 1.0;
24039
+ this.viewportMatrix = Matrix4.fromIdentity();
24043
24040
  this.viewMatrix = Matrix4.fromIdentity();
24044
24041
  this.projectionMatrix = Matrix4.fromIdentity();
24045
24042
  this.viewProjectionMatrix = Matrix4.fromIdentity();
@@ -24067,12 +24064,12 @@ var tmpScale = new Vector3(1, 1, 1);
24067
24064
  this.updateMatrix();
24068
24065
  }
24069
24066
  var _proto = Camera.prototype;
24070
- _proto.setFovScaleRatio = function setFovScaleRatio(value) {
24071
- this.fovScaleRatio = value;
24067
+ _proto.setViewportMatrix = function setViewportMatrix(matrix) {
24068
+ this.viewportMatrix = matrix.clone();
24072
24069
  this.dirty = true;
24073
24070
  };
24074
- _proto.getFovScaleRatio = function getFovScaleRatio() {
24075
- return this.fovScaleRatio;
24071
+ _proto.getViewportMatrix = function getViewportMatrix() {
24072
+ return this.viewportMatrix;
24076
24073
  };
24077
24074
  /**
24078
24075
  * 获取相机的视图变换矩阵
@@ -24194,7 +24191,8 @@ var tmpScale = new Vector3(1, 1, 1);
24194
24191
  */ _proto.updateMatrix = function updateMatrix() {
24195
24192
  if (this.dirty) {
24196
24193
  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;
24197
- this.projectionMatrix.perspective(fov * DEG2RAD * this.fovScaleRatio, aspect, near, far, clipMode === CameraClipMode.portrait);
24194
+ this.projectionMatrix.perspective(fov * DEG2RAD, aspect, near, far, clipMode === CameraClipMode.portrait);
24195
+ this.projectionMatrix.premultiply(this.viewportMatrix);
24198
24196
  this.inverseViewMatrix.compose(position, this.getQuat(), tmpScale);
24199
24197
  this.viewMatrix.copyFrom(this.inverseViewMatrix).invert();
24200
24198
  this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix, this.viewMatrix);
@@ -25309,12 +25307,12 @@ var listOrder = 0;
25309
25307
  }
25310
25308
  },
25311
25309
  {
25312
- key: "editorScaleRatio",
25310
+ key: "viewportMatrix",
25313
25311
  get: function get() {
25314
- return this.camera.getFovScaleRatio();
25312
+ return this.camera.getViewportMatrix();
25315
25313
  },
25316
- set: function set(value) {
25317
- this.camera.setFovScaleRatio(value);
25314
+ set: function set(matrix) {
25315
+ this.camera.setViewportMatrix(matrix);
25318
25316
  }
25319
25317
  }
25320
25318
  ]);
@@ -25713,7 +25711,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
25713
25711
  registerPlugin("particle", ParticleLoader, VFXItem, true);
25714
25712
  registerPlugin("cal", CalculateLoader, VFXItem, true);
25715
25713
  registerPlugin("interact", InteractLoader, VFXItem, true);
25716
- var version = "2.0.0-alpha.23";
25714
+ var version = "2.0.0-alpha.25";
25717
25715
  logger.info("Core version: " + version + ".");
25718
25716
 
25719
25717
  export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMacros, createShape, createVFXItem, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, pointOnLine, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };