@galacean/engine 1.3.3 → 1.3.6

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/browser.js CHANGED
@@ -15560,6 +15560,9 @@
15560
15560
  __decorate$1([
15561
15561
  assignmentClone
15562
15562
  ], SpriteMask.prototype, "influenceLayers", void 0);
15563
+ __decorate$1([
15564
+ ignoreClone
15565
+ ], SpriteMask.prototype, "_renderElement", void 0);
15563
15566
  __decorate$1([
15564
15567
  ignoreClone
15565
15568
  ], SpriteMask.prototype, "_subChunk", void 0);
@@ -15967,9 +15970,12 @@
15967
15970
  // Safari gets data confusion through getImageData when the canvas width is not an integer.
15968
15971
  // The measure text width of some special invisible characters may be 0, so make sure the width is at least 1.
15969
15972
  // @todo: Text layout may vary from standard and not support emoji.
15970
- var textMetrics = context.measureText(measureString);
15973
+ var _context_measureText = context.measureText(measureString), actualBoundingBoxLeft = _context_measureText.actualBoundingBoxLeft, actualBoundingBoxRight = _context_measureText.actualBoundingBoxRight, actualWidth = _context_measureText.width;
15971
15974
  // In some case (ex: " "), actualBoundingBoxRight and actualBoundingBoxLeft will be 0, so use width.
15972
- var width = Math.max(1, Math.round(textMetrics.actualBoundingBoxRight - textMetrics.actualBoundingBoxLeft || textMetrics.width));
15975
+ // TODO: With testing, actualBoundingBoxLeft + actualBoundingBoxRight is the actual rendering width
15976
+ // but the space rules between characters are unclear. Using actualBoundingBoxRight + Math.abs(actualBoundingBoxLeft) is the closest to the native effect.
15977
+ var width = Math.max(1, Math.round(Math.max(actualBoundingBoxRight + Math.abs(actualBoundingBoxLeft), actualWidth)));
15978
+ // Make sure enough width.
15973
15979
  var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
15974
15980
  var height = baseline * TextUtils._heightMultiplier;
15975
15981
  baseline = TextUtils._baselineMultiplier * baseline | 0;
@@ -15983,7 +15989,11 @@
15983
15989
  context.clearRect(0, 0, width, height);
15984
15990
  context.textBaseline = "middle";
15985
15991
  context.fillStyle = "#fff";
15986
- context.fillText(measureString, 0, baseline);
15992
+ if (actualBoundingBoxLeft > 0) {
15993
+ context.fillText(measureString, actualBoundingBoxLeft, baseline);
15994
+ } else {
15995
+ context.fillText(measureString, 0, baseline);
15996
+ }
15987
15997
  var colorData = context.getImageData(0, 0, width, height).data;
15988
15998
  var len = colorData.length;
15989
15999
  var top = -1;
@@ -16027,9 +16037,9 @@
16027
16037
  y: 0,
16028
16038
  w: width,
16029
16039
  h: size,
16030
- offsetX: 0,
16040
+ offsetX: actualBoundingBoxLeft > 0 ? actualBoundingBoxLeft : 0,
16031
16041
  offsetY: (ascent - descent) * 0.5,
16032
- xAdvance: width,
16042
+ xAdvance: Math.round(actualWidth),
16033
16043
  uvs: [
16034
16044
  new Vector2(),
16035
16045
  new Vector2(),
@@ -16594,7 +16604,7 @@
16594
16604
  j === firstRow && (minX = Math.min(minX, left));
16595
16605
  maxX = Math.max(maxX, right);
16596
16606
  }
16597
- startX += charInfo.xAdvance;
16607
+ startX += charInfo.xAdvance + charInfo.offsetX;
16598
16608
  }
16599
16609
  }
16600
16610
  startY -= lineHeight;
@@ -17411,8 +17421,6 @@
17411
17421
  _this = ReferResource1.call(this, engine) || this;
17412
17422
  /** @internal */ _this._renderStates = [] // todo: later will as a part of shaderData when shader effect frame is OK, that is more powerful and flexible.
17413
17423
  ;
17414
- /** @internal */ _this._priority = 0 // todo: temporary resolution of submesh rendering order issue.
17415
- ;
17416
17424
  _this._shaderData = new ShaderData(ShaderDataGroup.Material);
17417
17425
  _this.shader = shader;
17418
17426
  return _this;
@@ -23619,12 +23627,12 @@
23619
23627
  /**
23620
23628
  * @internal
23621
23629
  */ var PrimitiveChunkManager = /*#__PURE__*/ function() {
23622
- function PrimitiveChunkManager(engine, maxVertexCount) {
23623
- if (maxVertexCount === void 0) maxVertexCount = PrimitiveChunkManager.MAX_VERTEX_COUNT;
23630
+ var PrimitiveChunkManager = function PrimitiveChunkManager(engine, maxVertexCount) {
23631
+ if (maxVertexCount === void 0) maxVertexCount = 4096;
23624
23632
  this.engine = engine;
23625
23633
  this.maxVertexCount = maxVertexCount;
23626
23634
  this.primitiveChunks = new Array();
23627
- }
23635
+ };
23628
23636
  var _proto = PrimitiveChunkManager.prototype;
23629
23637
  _proto.allocateSubChunk = function allocateSubChunk(vertexCount) {
23630
23638
  var _primitiveChunks, _length;
@@ -23661,9 +23669,6 @@
23661
23669
  };
23662
23670
  return PrimitiveChunkManager;
23663
23671
  }();
23664
- (function() {
23665
- /** The maximum number of vertex. */ PrimitiveChunkManager.MAX_VERTEX_COUNT = 4096;
23666
- })();
23667
23672
  /**
23668
23673
  * @internal
23669
23674
  */ var BatcherManager = /*#__PURE__*/ function() {
@@ -25643,6 +25648,8 @@
25643
25648
  _this._setUpDirection = _this._setUpDirection.bind(_assert_this_initialized(_this));
25644
25649
  //@ts-ignore
25645
25650
  _this._upDirection._onValueChanged = _this._setUpDirection;
25651
+ // sync world position to physical space
25652
+ _this._onUpdate();
25646
25653
  return _this;
25647
25654
  };
25648
25655
  _inherits$2(CharacterController, Collider1);
@@ -25654,7 +25661,9 @@
25654
25661
  * @param elapsedTime - Time elapsed since last call
25655
25662
  * @return flags - The ControllerCollisionFlag
25656
25663
  */ _proto.move = function move(disp, minDist, elapsedTime) {
25657
- return this._nativeCollider.move(disp, minDist, elapsedTime);
25664
+ var flags = this._nativeCollider.move(disp, minDist, elapsedTime);
25665
+ this._syncWorldPositionFromPhysicalSpace();
25666
+ return flags;
25658
25667
  };
25659
25668
  /**
25660
25669
  * Add collider shape on this controller.
@@ -25690,8 +25699,7 @@
25690
25699
  /**
25691
25700
  * @internal
25692
25701
  */ _proto._onLateUpdate = function _onLateUpdate() {
25693
- var position = this.entity.transform.worldPosition;
25694
- this._nativeCollider.getWorldPosition(position);
25702
+ this._syncWorldPositionFromPhysicalSpace();
25695
25703
  this._updateFlag.flag = false;
25696
25704
  };
25697
25705
  /**
@@ -25714,6 +25722,9 @@
25714
25722
  physics._removeColliderShape(shapes[i]);
25715
25723
  }
25716
25724
  };
25725
+ _proto._syncWorldPositionFromPhysicalSpace = function _syncWorldPositionFromPhysicalSpace() {
25726
+ this._nativeCollider.getWorldPosition(this.entity.transform.worldPosition);
25727
+ };
25717
25728
  _proto._setUpDirection = function _setUpDirection() {
25718
25729
  this._nativeCollider.setUpDirection(this._upDirection);
25719
25730
  };
@@ -33268,7 +33279,9 @@
33268
33279
  // Precalculate to get the transition
33269
33280
  srcPlayData.update(playDeltaTime);
33270
33281
  var clipTime = srcPlayData.clipTime, isForwards = srcPlayData.isForwards;
33271
- var transition = this._applyTransitionsByCondition(layerIndex, layerData, layer, state, layer.stateMachine.anyStateTransitions, aniUpdate) || this._applyStateTransitions(layerIndex, layerData, layer, isForwards, srcPlayData, state.transitions, lastClipTime, clipTime, playDeltaTime, aniUpdate);
33282
+ var transitions = state.transitions;
33283
+ var anyStateTransitions = layer.stateMachine.anyStateTransitions;
33284
+ var transition = anyStateTransitions.length && this._applyTransitionsByCondition(layerIndex, layerData, layer, state, anyStateTransitions, aniUpdate) || transitions.length && this._applyStateTransitions(layerIndex, layerData, layer, isForwards, srcPlayData, transitions, lastClipTime, clipTime, playDeltaTime, aniUpdate);
33272
33285
  var playCostTime;
33273
33286
  if (transition) {
33274
33287
  var clipDuration = state.clip.length;
@@ -33350,7 +33363,7 @@
33350
33363
  dstPlayCostTime = // > transition: The time that will be played is enough to finish the transition
33351
33364
  playedTime - dstPlayDeltaTime > transitionDuration ? playedTime - transitionDuration : dstPlayDeltaTime;
33352
33365
  }
33353
- var actualCostTime = dstPlaySpeed === 0 ? 0 : dstPlayCostTime / dstPlaySpeed;
33366
+ var actualCostTime = dstPlaySpeed === 0 ? deltaTime : dstPlayCostTime / dstPlaySpeed;
33354
33367
  var srcPlayCostTime = actualCostTime * srcPlaySpeed;
33355
33368
  srcPlayData.update(srcPlayCostTime);
33356
33369
  destPlayData.update(dstPlayCostTime);
@@ -33358,6 +33371,7 @@
33358
33371
  (crossWeight >= 1.0 - MathUtil.zeroTolerance || transitionDuration === 0) && (crossWeight = 1.0);
33359
33372
  var crossFadeFinished = crossWeight === 1.0;
33360
33373
  if (crossFadeFinished) {
33374
+ srcPlayData.playState = AnimatorStatePlayState.Finished;
33361
33375
  this._preparePlayOwner(layerData, destState);
33362
33376
  this._evaluatePlayingState(destPlayData, weight, additive, aniUpdate);
33363
33377
  } else {
@@ -33410,7 +33424,7 @@
33410
33424
  dstPlayCostTime = // > transition: The time that will be played is enough to finish the transition
33411
33425
  playedTime - playDeltaTime > transitionDuration ? playedTime - transitionDuration : playDeltaTime;
33412
33426
  }
33413
- var actualCostTime = playSpeed === 0 ? 0 : dstPlayCostTime / playSpeed;
33427
+ var actualCostTime = playSpeed === 0 ? deltaTime : dstPlayCostTime / playSpeed;
33414
33428
  destPlayData.update(dstPlayCostTime);
33415
33429
  var crossWeight = Math.abs(destPlayData.frameTime) / transitionDuration;
33416
33430
  (crossWeight >= 1.0 - MathUtil.zeroTolerance || transitionDuration === 0) && (crossWeight = 1.0);
@@ -33450,14 +33464,16 @@
33450
33464
  }
33451
33465
  };
33452
33466
  _proto._updateFinishedState = function _updateFinishedState(layerIndex, layerData, layer, weight, additive, deltaTime, aniUpdate) {
33453
- var stateMachine = layer.stateMachine;
33467
+ layer.stateMachine;
33454
33468
  var playData = layerData.srcPlayData;
33455
33469
  var state = playData.state;
33456
33470
  var actualSpeed = state.speed * this.speed;
33457
33471
  var actualDeltaTime = actualSpeed * deltaTime;
33458
33472
  playData.updateOrientation(actualDeltaTime);
33459
33473
  var clipTime = playData.clipTime, isForwards = playData.isForwards;
33460
- var transition = this._applyTransitionsByCondition(layerIndex, layerData, layer, state, stateMachine.anyStateTransitions, aniUpdate) || this._applyStateTransitions(layerIndex, layerData, layer, isForwards, playData, state.transitions, clipTime, clipTime, actualDeltaTime, aniUpdate);
33474
+ var transitions = state.transitions;
33475
+ var anyStateTransitions = layer.stateMachine.anyStateTransitions;
33476
+ var transition = anyStateTransitions.length && this._applyTransitionsByCondition(layerIndex, layerData, layer, state, anyStateTransitions, aniUpdate) || transitions.length && this._applyStateTransitions(layerIndex, layerData, layer, isForwards, playData, transitions, clipTime, clipTime, actualDeltaTime, aniUpdate);
33461
33477
  if (transition) {
33462
33478
  this._updateState(layerIndex, layerData, layer, deltaTime, aniUpdate);
33463
33479
  } else {
@@ -48070,7 +48086,7 @@
48070
48086
  ], EXT_texture_webp);
48071
48087
 
48072
48088
  //@ts-ignore
48073
- var version = "1.3.3";
48089
+ var version = "1.3.6";
48074
48090
  console.log("Galacean engine version: " + version);
48075
48091
  for(var key in CoreObjects){
48076
48092
  Loader.registerClass(key, CoreObjects[key]);