@galacean/effects-core 2.5.0-alpha.1 → 2.5.0-alpha.2

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.
@@ -357,7 +357,6 @@ export declare class Composition extends EventEmitter<CompositionEvent<Compositi
357
357
  */
358
358
  update(deltaTime: number): void;
359
359
  private shouldDispose;
360
- private getUpdateTime;
361
360
  private callAwake;
362
361
  /**
363
362
  * 更新视频数据到纹理
@@ -377,7 +376,7 @@ export declare class Composition extends EventEmitter<CompositionEvent<Compositi
377
376
  /**
378
377
  * 更新主合成组件
379
378
  */
380
- private updateRootComposition;
379
+ private updateCompositionTime;
381
380
  /**
382
381
  * 通过名称获取元素
383
382
  * @param name - 元素名称
package/dist/index.js 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.5.0-alpha.1
6
+ * Version: v2.5.0-alpha.2
7
7
  */
8
8
 
9
9
  'use strict';
@@ -12872,6 +12872,25 @@ var singleSplits = [
12872
12872
  this.configureMaterial(this.renderer);
12873
12873
  if (baseRenderComponentData.geometry) {
12874
12874
  this.geometry = this.engine.findObject(baseRenderComponentData.geometry);
12875
+ var uvTransform = baseRenderComponentData.splits && !baseRenderComponentData.textureSheetAnimation ? baseRenderComponentData.splits[0] : singleSplits[0];
12876
+ var x = uvTransform[0];
12877
+ var y = uvTransform[1];
12878
+ var isRotate90 = uvTransform[4];
12879
+ var width = isRotate90 ? uvTransform[3] : uvTransform[2];
12880
+ var height = isRotate90 ? uvTransform[2] : uvTransform[3];
12881
+ var aUV = this.geometry.getAttributeData("aUV");
12882
+ var aPos = this.geometry.getAttributeData("aPos");
12883
+ if (aUV && aPos) {
12884
+ var vertexCount = aUV.length / 2;
12885
+ for(var i = 0; i < vertexCount; i++){
12886
+ var positionOffset = i * 3;
12887
+ var uvOffset = i * 2;
12888
+ var positionX = aPos[positionOffset];
12889
+ var positionY = aPos[positionOffset + 1];
12890
+ aUV[uvOffset] = (positionX + 0.5) * width + x;
12891
+ aUV[uvOffset + 1] = (positionY + 0.5) * height + y;
12892
+ }
12893
+ }
12875
12894
  } else {
12876
12895
  this.geometry = this.defaultGeometry;
12877
12896
  this.configureDefaultGeometry(this.renderer);
@@ -20234,7 +20253,7 @@ var RuntimeClip = /*#__PURE__*/ function() {
20234
20253
  this.playable.play();
20235
20254
  }
20236
20255
  this.parentMixer.setClipWeight(this.playable, weight);
20237
- var clipTime = parseFloat(clip.toLocalTime(localTime).toFixed(3));
20256
+ var clipTime = clip.toLocalTime(localTime);
20238
20257
  this.playable.setTime(clipTime);
20239
20258
  // 判断动画是否结束
20240
20259
  if (ended) {
@@ -21423,11 +21442,12 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
21423
21442
  * 前进合成到指定时间
21424
21443
  * @param time - 相对0时刻的时间
21425
21444
  */ _proto.forwardTime = function forwardTime(time) {
21426
- var deltaTime = time * 1000 - this.rootComposition.time * 1000;
21445
+ var deltaTime = time * 1000 - this.time * 1000;
21427
21446
  var reverse = deltaTime < 0;
21428
21447
  var step = 15;
21429
21448
  var t = Math.abs(deltaTime);
21430
21449
  var ss = reverse ? -step : step;
21450
+ // FIXME Update 中可能会修改合成时间,这边需要优化更新逻辑
21431
21451
  for(t; t > step; t -= step){
21432
21452
  this.update(ss);
21433
21453
  }
@@ -21467,13 +21487,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
21467
21487
  this.callAwake(this.rootItem);
21468
21488
  this.rootItem.beginPlay();
21469
21489
  }
21470
- var dt = parseFloat(this.getUpdateTime(deltaTime * this.speed).toFixed(0));
21471
- this.updateRootComposition(dt / 1000);
21490
+ var previousCompositionTime = this.time;
21491
+ this.updateCompositionTime(deltaTime * this.speed / 1000);
21492
+ var deltaTimeInMs = (this.time - previousCompositionTime) * 1000;
21472
21493
  this.updateVideo();
21473
21494
  // 更新 model-tree-plugin
21474
- this.updatePluginLoaders(deltaTime);
21475
- this.sceneTicking.update.tick(dt);
21476
- this.sceneTicking.lateUpdate.tick(dt);
21495
+ this.updatePluginLoaders(deltaTimeInMs);
21496
+ this.sceneTicking.update.tick(deltaTimeInMs);
21497
+ this.sceneTicking.lateUpdate.tick(deltaTimeInMs);
21477
21498
  this.updateCamera();
21478
21499
  this.prepareRender();
21479
21500
  if (this.isEnded && !this.isEndCalled) {
@@ -21489,14 +21510,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
21489
21510
  _proto.shouldDispose = function shouldDispose() {
21490
21511
  return this.isEnded && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
21491
21512
  };
21492
- _proto.getUpdateTime = function getUpdateTime(t) {
21493
- var startTimeInMs = this.startTime * 1000;
21494
- var now = this.rootComposition.time * 1000;
21495
- if (t < 0 && now + t < startTimeInMs) {
21496
- return startTimeInMs - now;
21497
- }
21498
- return t;
21499
- };
21500
21513
  _proto.callAwake = function callAwake(item) {
21501
21514
  for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
21502
21515
  var component = _step.value;
@@ -21541,14 +21554,18 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
21541
21554
  };
21542
21555
  /**
21543
21556
  * 更新主合成组件
21544
- */ _proto.updateRootComposition = function updateRootComposition(deltaTime) {
21557
+ */ _proto.updateCompositionTime = function updateCompositionTime(deltaTime) {
21545
21558
  if (this.rootComposition.state === PlayState.Paused || !this.rootComposition.isActiveAndEnabled) {
21546
21559
  return;
21547
21560
  }
21548
- var localTime = parseFloat((this.time + deltaTime - this.rootItem.start).toFixed(3));
21549
- var isEnded = false;
21561
+ // 相对于合成开始时间的时间
21562
+ var localTime = this.time + deltaTime - this.startTime;
21563
+ if (deltaTime < 0 && localTime < 0) {
21564
+ localTime = 0;
21565
+ }
21550
21566
  var duration = this.rootItem.duration;
21551
21567
  var endBehavior = this.rootItem.endBehavior;
21568
+ var isEnded = false;
21552
21569
  if (localTime - duration > 0.001) {
21553
21570
  isEnded = true;
21554
21571
  switch(endBehavior){
@@ -21573,7 +21590,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
21573
21590
  }
21574
21591
  }
21575
21592
  }
21576
- this.rootComposition.time = localTime;
21593
+ this.rootComposition.time = localTime + this.startTime;
21577
21594
  // end state changed, handle onEnd flags
21578
21595
  if (this.isEnded !== isEnded) {
21579
21596
  if (isEnded) {
@@ -28376,7 +28393,7 @@ function getStandardSpriteContent(sprite, transform) {
28376
28393
  return ret;
28377
28394
  }
28378
28395
 
28379
- var version$1 = "2.5.0-alpha.1";
28396
+ var version$1 = "2.5.0-alpha.2";
28380
28397
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
28381
28398
  var standardVersion = /^(\d+)\.(\d+)$/;
28382
28399
  var reverseParticle = false;
@@ -31626,7 +31643,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
31626
31643
  registerPlugin("particle", ParticleLoader, exports.VFXItem);
31627
31644
  registerPlugin("cal", CalculateLoader, exports.VFXItem);
31628
31645
  registerPlugin("interact", InteractLoader, exports.VFXItem);
31629
- var version = "2.5.0-alpha.1";
31646
+ var version = "2.5.0-alpha.2";
31630
31647
  logger.info("Core version: " + version + ".");
31631
31648
 
31632
31649
  exports.AbstractPlugin = AbstractPlugin;