@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/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.24
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) {
@@ -18716,9 +18717,9 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
18716
18717
  var localTime = time - this.start;
18717
18718
  var duration = this.duration;
18718
18719
  if (localTime - duration > 0.001) {
18719
- if (this.endBehaviour === ItemEndBehavior.loop) {
18720
+ if (this.endBehavior === ItemEndBehavior.loop) {
18720
18721
  localTime = localTime % duration;
18721
- } else if (this.endBehaviour === ItemEndBehavior.freeze) {
18722
+ } else if (this.endBehavior === ItemEndBehavior.freeze) {
18722
18723
  localTime = Math.min(duration, localTime);
18723
18724
  }
18724
18725
  }
@@ -18843,9 +18844,9 @@ var RuntimeClip = /*#__PURE__*/ function() {
18843
18844
  var weight = 1.0;
18844
18845
  var ended = false;
18845
18846
  var started = false;
18846
- var boundItem = this.track.binding;
18847
- if (localTime > clip.start + clip.duration + 0.001 && clip.endBehaviour === ItemEndBehavior.destroy) {
18848
- 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) {
18849
18850
  weight = 1.0;
18850
18851
  } else {
18851
18852
  weight = 0.0;
@@ -18862,25 +18863,22 @@ var RuntimeClip = /*#__PURE__*/ function() {
18862
18863
  }
18863
18864
  this.parentMixer.setInputWeight(this.playable, weight);
18864
18865
  // 判断动画是否结束
18865
- if (ended && !boundItem.ended) {
18866
- boundItem.ended = true;
18867
- boundItem.onEnd();
18868
- }
18869
- if (ended && this.playable.getPlayState() === PlayState.Playing) {
18870
- this.playable.pause();
18871
- 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
+ }
18872
18878
  }
18873
18879
  var clipTime = clip.toLocalTime(localTime);
18874
18880
  this.playable.setTime(clipTime);
18875
18881
  };
18876
- _proto.onClipEnd = function onClipEnd() {
18877
- var boundItem = this.track.binding;
18878
- if (!boundItem.compositionReusable && !boundItem.reusable) {
18879
- boundItem.dispose();
18880
- this.playable.dispose();
18881
- return;
18882
- }
18883
- };
18884
18882
  _create_class(RuntimeClip, [
18885
18883
  {
18886
18884
  key: "enable",
@@ -18912,7 +18910,7 @@ var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
18912
18910
  var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
18913
18911
  particleClip.start = boundItem.start;
18914
18912
  particleClip.duration = boundItem.duration;
18915
- particleClip.endBehaviour = boundItem.endBehavior;
18913
+ particleClip.endBehavior = boundItem.endBehavior;
18916
18914
  }
18917
18915
  };
18918
18916
  return ObjectBindingTrack;
@@ -19213,7 +19211,7 @@ function compareTracks(a, b) {
19213
19211
  if (!props) {
19214
19212
  throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
19215
19213
  }
19216
- // endBehaviour 类型需优化
19214
+ // endBehavior 类型需优化
19217
19215
  props.content = itemData.content;
19218
19216
  item = assetLoader.loadGUID(itemData.id);
19219
19217
  item.composition = this.item.composition;
@@ -22225,7 +22223,7 @@ function getStandardCameraContent(model) {
22225
22223
  */ function version30Migration(json) {
22226
22224
  var _loop = function() {
22227
22225
  var composition = _step1.value;
22228
- // composition 的 endbehaviour 兼容
22226
+ // composition 的 endBehavior 兼容
22229
22227
  if (composition.endBehavior === CompositionEndBehavior.pause_destroy || composition.endBehavior === CompositionEndBehavior.pause) {
22230
22228
  composition.endBehavior = END_BEHAVIOR_FREEZE;
22231
22229
  }
@@ -22611,7 +22609,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22611
22609
  {
22612
22610
  start: item.delay,
22613
22611
  duration: item.duration,
22614
- endBehaviour: item.endBehavior,
22612
+ endBehavior: item.endBehavior,
22615
22613
  asset: {
22616
22614
  id: newActivationPlayableAsset.id
22617
22615
  }
@@ -22642,7 +22640,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22642
22640
  {
22643
22641
  start: item.delay,
22644
22642
  duration: item.duration,
22645
- endBehaviour: item.endBehavior,
22643
+ endBehavior: item.endBehavior,
22646
22644
  asset: {
22647
22645
  id: newTransformPlayableAssetData.id
22648
22646
  }
@@ -22670,7 +22668,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22670
22668
  {
22671
22669
  start: item.delay,
22672
22670
  duration: item.duration,
22673
- endBehaviour: item.endBehavior,
22671
+ endBehavior: item.endBehavior,
22674
22672
  asset: {
22675
22673
  id: newSpriteColorPlayableAssetData.id
22676
22674
  }
@@ -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: newSubCompositionPlayableAssetData.id
22702
22700
  }
@@ -24038,7 +24036,7 @@ var tmpScale = new Vector3(1, 1, 1);
24038
24036
  function Camera(name, options) {
24039
24037
  if (options === void 0) options = {};
24040
24038
  this.name = name;
24041
- this.fovScaleRatio = 1.0;
24039
+ this.viewportMatrix = Matrix4.fromIdentity();
24042
24040
  this.viewMatrix = Matrix4.fromIdentity();
24043
24041
  this.projectionMatrix = Matrix4.fromIdentity();
24044
24042
  this.viewProjectionMatrix = Matrix4.fromIdentity();
@@ -24066,12 +24064,12 @@ var tmpScale = new Vector3(1, 1, 1);
24066
24064
  this.updateMatrix();
24067
24065
  }
24068
24066
  var _proto = Camera.prototype;
24069
- _proto.setFovScaleRatio = function setFovScaleRatio(value) {
24070
- this.fovScaleRatio = value;
24067
+ _proto.setViewportMatrix = function setViewportMatrix(matrix) {
24068
+ this.viewportMatrix = matrix.clone();
24071
24069
  this.dirty = true;
24072
24070
  };
24073
- _proto.getFovScaleRatio = function getFovScaleRatio() {
24074
- return this.fovScaleRatio;
24071
+ _proto.getViewportMatrix = function getViewportMatrix() {
24072
+ return this.viewportMatrix;
24075
24073
  };
24076
24074
  /**
24077
24075
  * 获取相机的视图变换矩阵
@@ -24193,7 +24191,8 @@ var tmpScale = new Vector3(1, 1, 1);
24193
24191
  */ _proto.updateMatrix = function updateMatrix() {
24194
24192
  if (this.dirty) {
24195
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;
24196
- 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);
24197
24196
  this.inverseViewMatrix.compose(position, this.getQuat(), tmpScale);
24198
24197
  this.viewMatrix.copyFrom(this.inverseViewMatrix).invert();
24199
24198
  this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix, this.viewMatrix);
@@ -25308,12 +25307,12 @@ var listOrder = 0;
25308
25307
  }
25309
25308
  },
25310
25309
  {
25311
- key: "editorScaleRatio",
25310
+ key: "viewportMatrix",
25312
25311
  get: function get() {
25313
- return this.camera.getFovScaleRatio();
25312
+ return this.camera.getViewportMatrix();
25314
25313
  },
25315
- set: function set(value) {
25316
- this.camera.setFovScaleRatio(value);
25314
+ set: function set(matrix) {
25315
+ this.camera.setViewportMatrix(matrix);
25317
25316
  }
25318
25317
  }
25319
25318
  ]);
@@ -25712,7 +25711,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
25712
25711
  registerPlugin("particle", ParticleLoader, VFXItem, true);
25713
25712
  registerPlugin("cal", CalculateLoader, VFXItem, true);
25714
25713
  registerPlugin("interact", InteractLoader, VFXItem, true);
25715
- var version = "2.0.0-alpha.24";
25714
+ var version = "2.0.0-alpha.25";
25716
25715
  logger.info("Core version: " + version + ".");
25717
25716
 
25718
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 };