@galacean/effects-threejs 2.4.7 → 2.4.8

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.4.7
6
+ * Version: v2.4.8
7
7
  */
8
8
 
9
9
  import * as THREE from 'three';
@@ -20137,7 +20137,7 @@ var RuntimeClip = /*#__PURE__*/ function() {
20137
20137
  this.playable.play();
20138
20138
  }
20139
20139
  this.parentMixer.setClipWeight(this.playable, weight);
20140
- var clipTime = parseFloat(clip.toLocalTime(localTime).toFixed(3));
20140
+ var clipTime = clip.toLocalTime(localTime);
20141
20141
  this.playable.setTime(clipTime);
20142
20142
  // 判断动画是否结束
20143
20143
  if (ended) {
@@ -21326,11 +21326,12 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
21326
21326
  * 前进合成到指定时间
21327
21327
  * @param time - 相对0时刻的时间
21328
21328
  */ _proto.forwardTime = function forwardTime(time) {
21329
- var deltaTime = time * 1000 - this.rootComposition.time * 1000;
21329
+ var deltaTime = time * 1000 - this.time * 1000;
21330
21330
  var reverse = deltaTime < 0;
21331
21331
  var step = 15;
21332
21332
  var t = Math.abs(deltaTime);
21333
21333
  var ss = reverse ? -step : step;
21334
+ // FIXME Update 中可能会修改合成时间,这边需要优化更新逻辑
21334
21335
  for(t; t > step; t -= step){
21335
21336
  this.update(ss);
21336
21337
  }
@@ -21370,13 +21371,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
21370
21371
  this.callAwake(this.rootItem);
21371
21372
  this.rootItem.beginPlay();
21372
21373
  }
21373
- var dt = parseFloat(this.getUpdateTime(deltaTime * this.speed).toFixed(0));
21374
- this.updateRootComposition(dt / 1000);
21374
+ var previousCompositionTime = this.time;
21375
+ this.updateCompositionTime(deltaTime * this.speed / 1000);
21376
+ var deltaTimeInMs = (this.time - previousCompositionTime) * 1000;
21375
21377
  this.updateVideo();
21376
21378
  // 更新 model-tree-plugin
21377
- this.updatePluginLoaders(deltaTime);
21378
- this.sceneTicking.update.tick(dt);
21379
- this.sceneTicking.lateUpdate.tick(dt);
21379
+ this.updatePluginLoaders(deltaTimeInMs);
21380
+ this.sceneTicking.update.tick(deltaTimeInMs);
21381
+ this.sceneTicking.lateUpdate.tick(deltaTimeInMs);
21380
21382
  this.updateCamera();
21381
21383
  this.prepareRender();
21382
21384
  if (this.isEnded && !this.isEndCalled) {
@@ -21392,14 +21394,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
21392
21394
  _proto.shouldDispose = function shouldDispose() {
21393
21395
  return this.isEnded && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
21394
21396
  };
21395
- _proto.getUpdateTime = function getUpdateTime(t) {
21396
- var startTimeInMs = this.startTime * 1000;
21397
- var now = this.rootComposition.time * 1000;
21398
- if (t < 0 && now + t < startTimeInMs) {
21399
- return startTimeInMs - now;
21400
- }
21401
- return t;
21402
- };
21403
21397
  _proto.callAwake = function callAwake(item) {
21404
21398
  for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
21405
21399
  var component = _step.value;
@@ -21444,14 +21438,18 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
21444
21438
  };
21445
21439
  /**
21446
21440
  * 更新主合成组件
21447
- */ _proto.updateRootComposition = function updateRootComposition(deltaTime) {
21441
+ */ _proto.updateCompositionTime = function updateCompositionTime(deltaTime) {
21448
21442
  if (this.rootComposition.state === PlayState.Paused || !this.rootComposition.isActiveAndEnabled) {
21449
21443
  return;
21450
21444
  }
21451
- var localTime = parseFloat((this.time + deltaTime - this.rootItem.start).toFixed(3));
21452
- var isEnded = false;
21445
+ // 相对于合成开始时间的时间
21446
+ var localTime = this.time + deltaTime - this.startTime;
21447
+ if (deltaTime < 0 && localTime < 0) {
21448
+ localTime = 0;
21449
+ }
21453
21450
  var duration = this.rootItem.duration;
21454
21451
  var endBehavior = this.rootItem.endBehavior;
21452
+ var isEnded = false;
21455
21453
  if (localTime - duration > 0.001) {
21456
21454
  isEnded = true;
21457
21455
  switch(endBehavior){
@@ -21476,7 +21474,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
21476
21474
  }
21477
21475
  }
21478
21476
  }
21479
- this.rootComposition.time = localTime;
21477
+ this.rootComposition.time = localTime + this.startTime;
21480
21478
  // end state changed, handle onEnd flags
21481
21479
  if (this.isEnded !== isEnded) {
21482
21480
  if (isEnded) {
@@ -31626,7 +31624,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem);
31626
31624
  registerPlugin("particle", ParticleLoader, VFXItem);
31627
31625
  registerPlugin("cal", CalculateLoader, VFXItem);
31628
31626
  registerPlugin("interact", InteractLoader, VFXItem);
31629
- var version$1 = "2.4.7";
31627
+ var version$1 = "2.4.8";
31630
31628
  logger.info("Core version: " + version$1 + ".");
31631
31629
 
31632
31630
  var _obj;
@@ -33228,7 +33226,7 @@ setMaxSpriteMeshItemCount(8);
33228
33226
  */ Mesh.create = function(engine, props) {
33229
33227
  return new ThreeMesh(engine, props);
33230
33228
  };
33231
- var version = "2.4.7";
33229
+ var version = "2.4.8";
33232
33230
  logger.info("THREEJS plugin version: " + version + ".");
33233
33231
 
33234
33232
  export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, BaseRenderComponent, 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, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, Composition, CompositionComponent, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Ellipse, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, GraphicsPath, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, MaskMode, MaskProcessor, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PluginSystem, PolyStar, Polygon, PostProcessVolume, PropertyTrack, 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, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapePath, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StarType, 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, Vector2Curve, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, buildLine, calculateTranslation, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, curveEps, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, 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, isIOSByUA, isMiniProgram, isObject, isOpenHarmony, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrame_frag as itemFrameFrag, itemVert, loadAVIFOptional, 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, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index$1 as spec, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };