@galacean/engine 1.3.7 → 1.3.9

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
@@ -23579,39 +23579,43 @@
23579
23579
  return null;
23580
23580
  };
23581
23581
  _proto._freeArea = function _freeArea(area) {
23582
- var areas = this.vertexFreeAreas;
23583
- var areaLen = areas.length;
23584
- if (areaLen === 0) {
23585
- areas.push(area);
23586
- return;
23587
- }
23582
+ var start = area.start, size = area.size;
23583
+ var freeAreas = this.vertexFreeAreas;
23584
+ var end = start + size;
23588
23585
  var pool = PrimitiveChunk.areaPool;
23589
- var preArea = area;
23590
- var notMerge = true;
23591
- for(var i = 0; i < areaLen; ++i){
23592
- var curArea = areas[i];
23593
- var preStart = preArea.start, size = preArea.size;
23594
- var curStart = curArea.start;
23595
- var preEnd = preStart + size;
23596
- var curEnd = curStart + curArea.size;
23597
- if (preEnd < curStart) {
23598
- notMerge && areas.splice(i, 0, preArea);
23586
+ for(var i = 0, areaLen = freeAreas.length; i < areaLen; ++i){
23587
+ var curFreeArea = freeAreas[i];
23588
+ var curStart = curFreeArea.start;
23589
+ var curEnd = curStart + curFreeArea.size;
23590
+ if (end < curStart) {
23591
+ // The area to be freed is to the left of the current free area and is not connected
23592
+ freeAreas.splice(i, 0, area);
23593
+ return;
23594
+ } else if (end === curStart) {
23595
+ // The area to be freed is to the left of the current free area and is connected
23596
+ curFreeArea.start = start;
23597
+ curFreeArea.size += size;
23598
+ pool.return(area);
23599
+ return;
23600
+ } else if (start === curEnd) {
23601
+ // The area to be freed is to the right of the current free area and is connected
23602
+ curFreeArea.size += size;
23603
+ pool.return(area);
23604
+ var nextIndex = i + 1;
23605
+ if (nextIndex < areaLen) {
23606
+ var nextFreeArea = freeAreas[nextIndex];
23607
+ if (end === nextFreeArea.start) {
23608
+ // The cur free area after merge is to the left of the next free area and is connected
23609
+ curFreeArea.size += nextFreeArea.size;
23610
+ freeAreas.splice(nextIndex, 1);
23611
+ pool.return(nextFreeArea);
23612
+ }
23613
+ }
23599
23614
  return;
23600
- } else if (preEnd === curStart) {
23601
- curArea.start = preStart;
23602
- curArea.size += size;
23603
- pool.return(preArea);
23604
- preArea = curArea;
23605
- notMerge = false;
23606
- } else if (preStart === curEnd) {
23607
- curArea.size += size;
23608
- pool.return(preArea);
23609
- preArea = curArea;
23610
- notMerge = false;
23611
- } else if (preStart > curEnd) {
23612
- i + 1 === areaLen && areas.push(preArea);
23613
23615
  }
23614
23616
  }
23617
+ // The area to be freed is to the right of the last free area and is not connected or free areas is empty
23618
+ freeAreas.push(area);
23615
23619
  };
23616
23620
  return PrimitiveChunk;
23617
23621
  }();
@@ -24746,6 +24750,7 @@
24746
24750
  */ SystemInfo._initialize = function _initialize() {
24747
24751
  {
24748
24752
  if (typeof navigator == "undefined") {
24753
+ SystemInfo._isBrowser = false;
24749
24754
  return;
24750
24755
  }
24751
24756
  var userAgent = navigator.userAgent;
@@ -24857,6 +24862,9 @@
24857
24862
  (function() {
24858
24863
  /** The operating system is running on. */ SystemInfo.operatingSystem = "";
24859
24864
  })();
24865
+ (function() {
24866
+ /** @internal */ SystemInfo._isBrowser = true;
24867
+ })();
24860
24868
  (function() {
24861
24869
  /** Whether the system support SIMD. */ SystemInfo._simdSupported = null;
24862
24870
  })();
@@ -48059,9 +48067,14 @@
48059
48067
  var _this;
48060
48068
  _this = GLTFExtensionParser1.call(this) || this;
48061
48069
  _this._supportWebP = false;
48062
- var testCanvas = document.createElement("canvas");
48063
- testCanvas.width = testCanvas.height = 1;
48064
- _this._supportWebP = testCanvas.toDataURL("image/webp").indexOf("data:image/webp") == 0;
48070
+ // @ts-ignore
48071
+ if (SystemInfo._isBrowser) {
48072
+ var testCanvas = document.createElement("canvas");
48073
+ testCanvas.width = testCanvas.height = 1;
48074
+ _this._supportWebP = testCanvas.toDataURL("image/webp").indexOf("data:image/webp") == 0;
48075
+ } else {
48076
+ _this._supportWebP = false;
48077
+ }
48065
48078
  return _this;
48066
48079
  };
48067
48080
  _inherits(EXT_texture_webp, GLTFExtensionParser1);
@@ -48088,7 +48101,7 @@
48088
48101
  ], EXT_texture_webp);
48089
48102
 
48090
48103
  //@ts-ignore
48091
- var version = "1.3.7";
48104
+ var version = "1.3.9";
48092
48105
  console.log("Galacean engine version: " + version);
48093
48106
  for(var key in CoreObjects){
48094
48107
  Loader.registerClass(key, CoreObjects[key]);