@galacean/engine 1.1.0-beta.34 → 1.1.0-beta.36

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
@@ -6907,13 +6907,15 @@
6907
6907
  ];
6908
6908
  })();
6909
6909
  (function() {
6910
- /** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
6910
+ // _heightMultiplier used to measure the height of text, but in miniprogram performance is different from h5.
6911
+ // so can set _heightMultiplier to adapt miniprogram, the larger the value, the worse the performance.
6912
+ /** @internal */ TextUtils._heightMultiplier = 2;
6911
6913
  })();
6912
6914
  (function() {
6913
- TextUtils._measureBaseline = "M";
6915
+ /** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
6914
6916
  })();
6915
6917
  (function() {
6916
- TextUtils._heightMultiplier = 2;
6918
+ TextUtils._measureBaseline = "M";
6917
6919
  })();
6918
6920
  (function() {
6919
6921
  TextUtils._baselineMultiplier = 1.4;
@@ -6996,7 +6998,7 @@
6996
6998
  var _this = this, engine = _this._engine;
6997
6999
  var fontAtlas = new FontAtlas(engine);
6998
7000
  var texture = new Texture2D(engine, 256, 256, exports.TextureFormat.R8G8B8A8, false);
6999
- texture.filterMode = exports.TextureFilterMode.Point;
7001
+ texture.filterMode = exports.TextureFilterMode.Bilinear;
7000
7002
  fontAtlas.texture = texture;
7001
7003
  fontAtlas.isGCIgnored = texture.isGCIgnored = true;
7002
7004
  this._fontAtlases.push(fontAtlas);
@@ -23247,7 +23249,7 @@
23247
23249
  /**
23248
23250
  * @internal
23249
23251
  */ _proto._render = function _render(context) {
23250
- if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
23252
+ if (this._isTextNoVisible()) {
23251
23253
  return;
23252
23254
  }
23253
23255
  if (this._isContainDirtyFlag(0x10)) {
@@ -23339,8 +23341,8 @@
23339
23341
  }
23340
23342
  };
23341
23343
  _proto._updateLocalData = function _updateLocalData() {
23342
- var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
23343
23344
  var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
23345
+ var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
23344
23346
  var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
23345
23347
  var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
23346
23348
  var charRenderDataPool = TextRenderer._charRenderDataPool;
@@ -23408,7 +23410,7 @@
23408
23410
  var left = startX * pixelsPerUnitReciprocal;
23409
23411
  var right = (startX + w) * pixelsPerUnitReciprocal;
23410
23412
  var top = (startY + ascent) * pixelsPerUnitReciprocal;
23411
- var bottom = (startY - descent + 1) * pixelsPerUnitReciprocal;
23413
+ var bottom = (startY - descent) * pixelsPerUnitReciprocal;
23412
23414
  localPositions.set(left, top, right, bottom);
23413
23415
  i === firstLine && (maxY = Math.max(maxY, top));
23414
23416
  minY = Math.min(minY, bottom);
@@ -23449,6 +23451,9 @@
23449
23451
  Renderer1.prototype._onTransformChanged.call(this, bit);
23450
23452
  this._setDirtyFlagTrue(0x4 | 0x8);
23451
23453
  };
23454
+ _proto._isTextNoVisible = function _isTextNoVisible() {
23455
+ return this._text === "" || this._fontSize === 0 || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0;
23456
+ };
23452
23457
  _create_class$3(TextRenderer, [
23453
23458
  {
23454
23459
  key: "color",
@@ -23651,6 +23656,16 @@
23651
23656
  get: /**
23652
23657
  * The bounding volume of the TextRenderer.
23653
23658
  */ function get() {
23659
+ if (this._isTextNoVisible()) {
23660
+ if (this._isContainDirtyFlag(0x8)) {
23661
+ var localBounds = this._localBounds;
23662
+ localBounds.min.set(0, 0, 0);
23663
+ localBounds.max.set(0, 0, 0);
23664
+ this._updateBounds(this._bounds);
23665
+ this._setDirtyFlagFalse(0x8);
23666
+ }
23667
+ return this._bounds;
23668
+ }
23654
23669
  this._isContainDirtyFlag(0x1) && this._resetSubFont();
23655
23670
  this._isContainDirtyFlag(0x2) && this._updateLocalData();
23656
23671
  this._isContainDirtyFlag(0x4) && this._updatePosition();
@@ -26629,12 +26644,38 @@
26629
26644
  /**
26630
26645
  * @internal
26631
26646
  */ RenderQueue._compareFromNearToFar = function _compareFromNearToFar(a, b) {
26632
- return a.data.component.priority - b.data.component.priority || a.data.material._priority - b.data.material._priority || a.data.component._distanceForSort - b.data.component._distanceForSort;
26647
+ var dataA = a.data;
26648
+ var dataB = b.data;
26649
+ var componentA = dataA.component;
26650
+ var componentB = dataB.component;
26651
+ var priorityOrder = componentA.priority - componentB.priority;
26652
+ if (priorityOrder !== 0) {
26653
+ return priorityOrder;
26654
+ }
26655
+ // make suer from the same renderer.
26656
+ if (componentA.instanceId === componentB.instanceId) {
26657
+ return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
26658
+ } else {
26659
+ return componentA._distanceForSort - componentB._distanceForSort;
26660
+ }
26633
26661
  };
26634
26662
  /**
26635
26663
  * @internal
26636
26664
  */ RenderQueue._compareFromFarToNear = function _compareFromFarToNear(a, b) {
26637
- return a.data.component.priority - b.data.component.priority || a.data.material._priority - b.data.material._priority || b.data.component._distanceForSort - a.data.component._distanceForSort;
26665
+ var dataA = a.data;
26666
+ var dataB = b.data;
26667
+ var componentA = dataA.component;
26668
+ var componentB = dataB.component;
26669
+ var priorityOrder = componentA.priority - componentB.priority;
26670
+ if (priorityOrder !== 0) {
26671
+ return priorityOrder;
26672
+ }
26673
+ // make suer from the same renderer.
26674
+ if (componentA.instanceId === componentB.instanceId) {
26675
+ return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
26676
+ } else {
26677
+ return componentB._distanceForSort - componentA._distanceForSort;
26678
+ }
26638
26679
  };
26639
26680
  return RenderQueue;
26640
26681
  }();
@@ -43148,7 +43189,7 @@
43148
43189
  };
43149
43190
  _proto._makeSprite = function _makeSprite(engine, config, texture) {
43150
43191
  // Generate a SpriteAtlas object.
43151
- var region = config.region, atlasRegionOffset = config.atlasRegionOffset, atlasRegion = config.atlasRegion, pivot = config.pivot, border = config.border;
43192
+ var region = config.region, atlasRegionOffset = config.atlasRegionOffset, atlasRegion = config.atlasRegion, pivot = config.pivot, border = config.border, width = config.width, height = config.height;
43152
43193
  var sprite = new Sprite(engine, texture, region ? this._tempRect.set(region.x, region.y, region.w, region.h) : undefined, pivot ? this._tempVec2.set(pivot.x, pivot.y) : undefined, border ? this._tempVec4.set(border.x, border.y, border.z, border.w) : undefined, config.name);
43153
43194
  if (texture) {
43154
43195
  var invW = 1 / texture.width;
@@ -43160,6 +43201,8 @@
43160
43201
  }
43161
43202
  config.atlasRotated && (sprite.atlasRotated = true);
43162
43203
  }
43204
+ isNaN(width) || (sprite.width = width);
43205
+ isNaN(height) || (sprite.height = height);
43163
43206
  return sprite;
43164
43207
  };
43165
43208
  return SpriteAtlasLoader;
@@ -43194,11 +43237,19 @@
43194
43237
  if (data.texture) {
43195
43238
  return resourceManager // @ts-ignore
43196
43239
  .getResourceByRef(data.texture).then(function(texture) {
43197
- return new Sprite(resourceManager.engine, texture, data.region, data.pivot, data.border);
43240
+ var sprite = new Sprite(resourceManager.engine, texture, data.region, data.pivot, data.border);
43241
+ var width = data.width, height = data.height;
43242
+ isNaN(width) || (sprite.width = width);
43243
+ isNaN(height) || (sprite.height = height);
43244
+ return sprite;
43198
43245
  });
43199
43246
  } else {
43200
43247
  return new AssetPromise(function(resolve) {
43201
- resolve(new Sprite(resourceManager.engine, null, data.region, data.pivot, data.border));
43248
+ var sprite = new Sprite(resourceManager.engine, null, data.region, data.pivot, data.border);
43249
+ var width = data.width, height = data.height;
43250
+ isNaN(width) || (sprite.width = width);
43251
+ isNaN(height) || (sprite.height = height);
43252
+ resolve(sprite);
43202
43253
  });
43203
43254
  }
43204
43255
  };
@@ -43977,7 +44028,7 @@
43977
44028
  ], GALACEAN_animation_event);
43978
44029
 
43979
44030
  //@ts-ignore
43980
- var version = "1.1.0-beta.34";
44031
+ var version = "1.1.0-beta.36";
43981
44032
  console.log("Galacean engine version: " + version);
43982
44033
  for(var key in CoreObjects){
43983
44034
  Loader.registerClass(key, CoreObjects[key]);