@galacean/engine 1.1.0-beta.33 → 1.1.0-beta.35

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
@@ -17402,8 +17402,10 @@
17402
17402
  }
17403
17403
  mesh.addSubMesh(this._getSubMeshFromPool(vertexStartIndex, vertexCount));
17404
17404
  batchedQueue[curMeshIndex] = preElement;
17405
- this._vertexBuffers[_flushId].setData(vertices, 0, 0, vertexIndex);
17406
- this._indiceBuffers[_flushId].setData(indices, 0, 0, indiceIndex);
17405
+ // Set data option use Discard, or will resulted in performance slowdown when open antialias and cross-rendering of 3D and 2D elements.
17406
+ // Device: iphone X(16.7.2)、iphone 15 pro max(17.1.1)、iphone XR(17.1.2) etc.
17407
+ this._vertexBuffers[_flushId].setData(vertices, 0, 0, vertexIndex, exports.SetDataOptions.Discard);
17408
+ this._indiceBuffers[_flushId].setData(indices, 0, 0, indiceIndex, exports.SetDataOptions.Discard);
17407
17409
  };
17408
17410
  _proto._getSubMeshFromPool = function _getSubMeshFromPool(start, count) {
17409
17411
  var subMesh = this._subMeshPool.getFromPool();
@@ -23245,7 +23247,7 @@
23245
23247
  /**
23246
23248
  * @internal
23247
23249
  */ _proto._render = function _render(context) {
23248
- if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
23250
+ if (this._isTextNoVisible()) {
23249
23251
  return;
23250
23252
  }
23251
23253
  if (this._isContainDirtyFlag(0x10)) {
@@ -23337,8 +23339,8 @@
23337
23339
  }
23338
23340
  };
23339
23341
  _proto._updateLocalData = function _updateLocalData() {
23340
- var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
23341
23342
  var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
23343
+ var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
23342
23344
  var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
23343
23345
  var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
23344
23346
  var charRenderDataPool = TextRenderer._charRenderDataPool;
@@ -23447,6 +23449,9 @@
23447
23449
  Renderer1.prototype._onTransformChanged.call(this, bit);
23448
23450
  this._setDirtyFlagTrue(0x4 | 0x8);
23449
23451
  };
23452
+ _proto._isTextNoVisible = function _isTextNoVisible() {
23453
+ return this._text === "" || this._fontSize === 0 || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0;
23454
+ };
23450
23455
  _create_class$3(TextRenderer, [
23451
23456
  {
23452
23457
  key: "color",
@@ -23649,6 +23654,16 @@
23649
23654
  get: /**
23650
23655
  * The bounding volume of the TextRenderer.
23651
23656
  */ function get() {
23657
+ if (this._isTextNoVisible()) {
23658
+ if (this._isContainDirtyFlag(0x8)) {
23659
+ var localBounds = this._localBounds;
23660
+ localBounds.min.set(0, 0, 0);
23661
+ localBounds.max.set(0, 0, 0);
23662
+ this._updateBounds(this._bounds);
23663
+ this._setDirtyFlagFalse(0x8);
23664
+ }
23665
+ return this._bounds;
23666
+ }
23652
23667
  this._isContainDirtyFlag(0x1) && this._resetSubFont();
23653
23668
  this._isContainDirtyFlag(0x2) && this._updateLocalData();
23654
23669
  this._isContainDirtyFlag(0x4) && this._updatePosition();
@@ -26627,12 +26642,38 @@
26627
26642
  /**
26628
26643
  * @internal
26629
26644
  */ RenderQueue._compareFromNearToFar = function _compareFromNearToFar(a, b) {
26630
- 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;
26645
+ var dataA = a.data;
26646
+ var dataB = b.data;
26647
+ var componentA = dataA.component;
26648
+ var componentB = dataB.component;
26649
+ var priorityOrder = componentA.priority - componentB.priority;
26650
+ if (priorityOrder !== 0) {
26651
+ return priorityOrder;
26652
+ }
26653
+ // make suer from the same renderer.
26654
+ if (componentA.instanceId === componentB.instanceId) {
26655
+ return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
26656
+ } else {
26657
+ return componentA._distanceForSort - componentB._distanceForSort;
26658
+ }
26631
26659
  };
26632
26660
  /**
26633
26661
  * @internal
26634
26662
  */ RenderQueue._compareFromFarToNear = function _compareFromFarToNear(a, b) {
26635
- 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;
26663
+ var dataA = a.data;
26664
+ var dataB = b.data;
26665
+ var componentA = dataA.component;
26666
+ var componentB = dataB.component;
26667
+ var priorityOrder = componentA.priority - componentB.priority;
26668
+ if (priorityOrder !== 0) {
26669
+ return priorityOrder;
26670
+ }
26671
+ // make suer from the same renderer.
26672
+ if (componentA.instanceId === componentB.instanceId) {
26673
+ return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
26674
+ } else {
26675
+ return componentB._distanceForSort - componentA._distanceForSort;
26676
+ }
26636
26677
  };
26637
26678
  return RenderQueue;
26638
26679
  }();
@@ -43146,7 +43187,7 @@
43146
43187
  };
43147
43188
  _proto._makeSprite = function _makeSprite(engine, config, texture) {
43148
43189
  // Generate a SpriteAtlas object.
43149
- var region = config.region, atlasRegionOffset = config.atlasRegionOffset, atlasRegion = config.atlasRegion, pivot = config.pivot, border = config.border;
43190
+ var region = config.region, atlasRegionOffset = config.atlasRegionOffset, atlasRegion = config.atlasRegion, pivot = config.pivot, border = config.border, width = config.width, height = config.height;
43150
43191
  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);
43151
43192
  if (texture) {
43152
43193
  var invW = 1 / texture.width;
@@ -43158,6 +43199,8 @@
43158
43199
  }
43159
43200
  config.atlasRotated && (sprite.atlasRotated = true);
43160
43201
  }
43202
+ isNaN(width) || (sprite.width = width);
43203
+ isNaN(height) || (sprite.height = height);
43161
43204
  return sprite;
43162
43205
  };
43163
43206
  return SpriteAtlasLoader;
@@ -43192,11 +43235,19 @@
43192
43235
  if (data.texture) {
43193
43236
  return resourceManager // @ts-ignore
43194
43237
  .getResourceByRef(data.texture).then(function(texture) {
43195
- return new Sprite(resourceManager.engine, texture, data.region, data.pivot, data.border);
43238
+ var sprite = new Sprite(resourceManager.engine, texture, data.region, data.pivot, data.border);
43239
+ var width = data.width, height = data.height;
43240
+ isNaN(width) || (sprite.width = width);
43241
+ isNaN(height) || (sprite.height = height);
43242
+ return sprite;
43196
43243
  });
43197
43244
  } else {
43198
43245
  return new AssetPromise(function(resolve) {
43199
- resolve(new Sprite(resourceManager.engine, null, data.region, data.pivot, data.border));
43246
+ var sprite = new Sprite(resourceManager.engine, null, data.region, data.pivot, data.border);
43247
+ var width = data.width, height = data.height;
43248
+ isNaN(width) || (sprite.width = width);
43249
+ isNaN(height) || (sprite.height = height);
43250
+ resolve(sprite);
43200
43251
  });
43201
43252
  }
43202
43253
  };
@@ -43975,7 +44026,7 @@
43975
44026
  ], GALACEAN_animation_event);
43976
44027
 
43977
44028
  //@ts-ignore
43978
- var version = "1.1.0-beta.33";
44029
+ var version = "1.1.0-beta.35";
43979
44030
  console.log("Galacean engine version: " + version);
43980
44031
  for(var key in CoreObjects){
43981
44032
  Loader.registerClass(key, CoreObjects[key]);