@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.mjs 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
  import * as THREE from 'three';
@@ -8873,6 +8873,7 @@ var MaterialRenderType;
8873
8873
  var _this;
8874
8874
  _this = EffectsObject.call(this, engine) || this;
8875
8875
  _this.stringTags = {};
8876
+ _this.enabledMacros = {};
8876
8877
  _this.destroyed = false;
8877
8878
  _this.initialized = false;
8878
8879
  if (props) {
@@ -18718,9 +18719,9 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
18718
18719
  var localTime = time - this.start;
18719
18720
  var duration = this.duration;
18720
18721
  if (localTime - duration > 0.001) {
18721
- if (this.endBehaviour === ItemEndBehavior.loop) {
18722
+ if (this.endBehavior === ItemEndBehavior.loop) {
18722
18723
  localTime = localTime % duration;
18723
- } else if (this.endBehaviour === ItemEndBehavior.freeze) {
18724
+ } else if (this.endBehavior === ItemEndBehavior.freeze) {
18724
18725
  localTime = Math.min(duration, localTime);
18725
18726
  }
18726
18727
  }
@@ -18845,9 +18846,9 @@ var RuntimeClip = /*#__PURE__*/ function() {
18845
18846
  var weight = 1.0;
18846
18847
  var ended = false;
18847
18848
  var started = false;
18848
- var boundItem = this.track.binding;
18849
- if (localTime > clip.start + clip.duration + 0.001 && clip.endBehaviour === ItemEndBehavior.destroy) {
18850
- if (VFXItem.isParticle(boundItem) && this.particleSystem && !this.particleSystem.destroyed) {
18849
+ var boundObject = this.track.binding;
18850
+ if (localTime > clip.start + clip.duration + 0.001 && clip.endBehavior === ItemEndBehavior.destroy) {
18851
+ if (_instanceof1(boundObject, VFXItem) && VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
18851
18852
  weight = 1.0;
18852
18853
  } else {
18853
18854
  weight = 0.0;
@@ -18864,25 +18865,22 @@ var RuntimeClip = /*#__PURE__*/ function() {
18864
18865
  }
18865
18866
  this.parentMixer.setInputWeight(this.playable, weight);
18866
18867
  // 判断动画是否结束
18867
- if (ended && !boundItem.ended) {
18868
- boundItem.ended = true;
18869
- boundItem.onEnd();
18870
- }
18871
- if (ended && this.playable.getPlayState() === PlayState.Playing) {
18872
- this.playable.pause();
18873
- this.onClipEnd();
18868
+ if (ended) {
18869
+ if (_instanceof1(boundObject, VFXItem) && !boundObject.ended) {
18870
+ boundObject.ended = true;
18871
+ boundObject.onEnd();
18872
+ if (!boundObject.compositionReusable && !boundObject.reusable) {
18873
+ boundObject.dispose();
18874
+ this.playable.dispose();
18875
+ }
18876
+ }
18877
+ if (this.playable.getPlayState() === PlayState.Playing) {
18878
+ this.playable.pause();
18879
+ }
18874
18880
  }
18875
18881
  var clipTime = clip.toLocalTime(localTime);
18876
18882
  this.playable.setTime(clipTime);
18877
18883
  };
18878
- _proto.onClipEnd = function onClipEnd() {
18879
- var boundItem = this.track.binding;
18880
- if (!boundItem.compositionReusable && !boundItem.reusable) {
18881
- boundItem.dispose();
18882
- this.playable.dispose();
18883
- return;
18884
- }
18885
- };
18886
18884
  _create_class(RuntimeClip, [
18887
18885
  {
18888
18886
  key: "enable",
@@ -18914,7 +18912,7 @@ var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
18914
18912
  var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
18915
18913
  particleClip.start = boundItem.start;
18916
18914
  particleClip.duration = boundItem.duration;
18917
- particleClip.endBehaviour = boundItem.endBehavior;
18915
+ particleClip.endBehavior = boundItem.endBehavior;
18918
18916
  }
18919
18917
  };
18920
18918
  return ObjectBindingTrack;
@@ -19215,7 +19213,7 @@ function compareTracks(a, b) {
19215
19213
  if (!props) {
19216
19214
  throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
19217
19215
  }
19218
- // endBehaviour 类型需优化
19216
+ // endBehavior 类型需优化
19219
19217
  props.content = itemData.content;
19220
19218
  item = assetLoader.loadGUID(itemData.id);
19221
19219
  item.composition = this.item.composition;
@@ -22227,7 +22225,7 @@ function getStandardCameraContent(model) {
22227
22225
  */ function version30Migration(json) {
22228
22226
  var _loop = function() {
22229
22227
  var composition = _step1.value;
22230
- // composition 的 endbehaviour 兼容
22228
+ // composition 的 endBehavior 兼容
22231
22229
  if (composition.endBehavior === CompositionEndBehavior.pause_destroy || composition.endBehavior === CompositionEndBehavior.pause) {
22232
22230
  composition.endBehavior = END_BEHAVIOR_FREEZE;
22233
22231
  }
@@ -22613,7 +22611,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22613
22611
  {
22614
22612
  start: item.delay,
22615
22613
  duration: item.duration,
22616
- endBehaviour: item.endBehavior,
22614
+ endBehavior: item.endBehavior,
22617
22615
  asset: {
22618
22616
  id: newActivationPlayableAsset.id
22619
22617
  }
@@ -22644,7 +22642,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22644
22642
  {
22645
22643
  start: item.delay,
22646
22644
  duration: item.duration,
22647
- endBehaviour: item.endBehavior,
22645
+ endBehavior: item.endBehavior,
22648
22646
  asset: {
22649
22647
  id: newTransformPlayableAssetData.id
22650
22648
  }
@@ -22672,7 +22670,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22672
22670
  {
22673
22671
  start: item.delay,
22674
22672
  duration: item.duration,
22675
- endBehaviour: item.endBehavior,
22673
+ endBehavior: item.endBehavior,
22676
22674
  asset: {
22677
22675
  id: newSpriteColorPlayableAssetData.id
22678
22676
  }
@@ -22698,7 +22696,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22698
22696
  {
22699
22697
  start: item.delay,
22700
22698
  duration: item.duration,
22701
- endBehaviour: item.endBehavior,
22699
+ endBehavior: item.endBehavior,
22702
22700
  asset: {
22703
22701
  id: newSubCompositionPlayableAssetData.id
22704
22702
  }
@@ -24040,7 +24038,7 @@ var tmpScale = new Vector3(1, 1, 1);
24040
24038
  function Camera(name, options) {
24041
24039
  if (options === void 0) options = {};
24042
24040
  this.name = name;
24043
- this.fovScaleRatio = 1.0;
24041
+ this.viewportMatrix = Matrix4.fromIdentity();
24044
24042
  this.viewMatrix = Matrix4.fromIdentity();
24045
24043
  this.projectionMatrix = Matrix4.fromIdentity();
24046
24044
  this.viewProjectionMatrix = Matrix4.fromIdentity();
@@ -24068,12 +24066,12 @@ var tmpScale = new Vector3(1, 1, 1);
24068
24066
  this.updateMatrix();
24069
24067
  }
24070
24068
  var _proto = Camera.prototype;
24071
- _proto.setFovScaleRatio = function setFovScaleRatio(value) {
24072
- this.fovScaleRatio = value;
24069
+ _proto.setViewportMatrix = function setViewportMatrix(matrix) {
24070
+ this.viewportMatrix = matrix.clone();
24073
24071
  this.dirty = true;
24074
24072
  };
24075
- _proto.getFovScaleRatio = function getFovScaleRatio() {
24076
- return this.fovScaleRatio;
24073
+ _proto.getViewportMatrix = function getViewportMatrix() {
24074
+ return this.viewportMatrix;
24077
24075
  };
24078
24076
  /**
24079
24077
  * 获取相机的视图变换矩阵
@@ -24195,7 +24193,8 @@ var tmpScale = new Vector3(1, 1, 1);
24195
24193
  */ _proto.updateMatrix = function updateMatrix() {
24196
24194
  if (this.dirty) {
24197
24195
  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;
24198
- this.projectionMatrix.perspective(fov * DEG2RAD * this.fovScaleRatio, aspect, near, far, clipMode === CameraClipMode.portrait);
24196
+ this.projectionMatrix.perspective(fov * DEG2RAD, aspect, near, far, clipMode === CameraClipMode.portrait);
24197
+ this.projectionMatrix.premultiply(this.viewportMatrix);
24199
24198
  this.inverseViewMatrix.compose(position, this.getQuat(), tmpScale);
24200
24199
  this.viewMatrix.copyFrom(this.inverseViewMatrix).invert();
24201
24200
  this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix, this.viewMatrix);
@@ -25310,12 +25309,12 @@ var listOrder = 0;
25310
25309
  }
25311
25310
  },
25312
25311
  {
25313
- key: "editorScaleRatio",
25312
+ key: "viewportMatrix",
25314
25313
  get: function get() {
25315
- return this.camera.getFovScaleRatio();
25314
+ return this.camera.getViewportMatrix();
25316
25315
  },
25317
- set: function set(value) {
25318
- this.camera.setFovScaleRatio(value);
25316
+ set: function set(matrix) {
25317
+ this.camera.setViewportMatrix(matrix);
25319
25318
  }
25320
25319
  }
25321
25320
  ]);
@@ -25714,7 +25713,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
25714
25713
  registerPlugin("particle", ParticleLoader, VFXItem, true);
25715
25714
  registerPlugin("cal", CalculateLoader, VFXItem, true);
25716
25715
  registerPlugin("interact", InteractLoader, VFXItem, true);
25717
- var version$1 = "2.0.0-alpha.24";
25716
+ var version$1 = "2.0.0-alpha.25";
25718
25717
  logger.info("Core version: " + version$1 + ".");
25719
25718
 
25720
25719
  var _obj;
@@ -27347,7 +27346,7 @@ setMaxSpriteMeshItemCount(8);
27347
27346
  */ Mesh.create = function(engine, props) {
27348
27347
  return new ThreeMesh(engine, props);
27349
27348
  };
27350
- var version = "2.0.0-alpha.24";
27349
+ var version = "2.0.0-alpha.25";
27351
27350
  logger.info("THREEJS plugin version: " + version + ".");
27352
27351
 
27353
27352
  export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, 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, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, 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, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };