@galacean/engine-core 1.1.0-beta.39 → 1.1.0-beta.43

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.
@@ -11820,7 +11820,7 @@ var PrimitiveType;
11820
11820
  var theta = thetaStart + u * thetaRange;
11821
11821
  var sinTheta = Math.sin(theta);
11822
11822
  var cosTheta = Math.cos(theta);
11823
- var curRadius = radius - y * radius;
11823
+ var curRadius = radius - v * radius;
11824
11824
  var posX = curRadius * sinTheta;
11825
11825
  var posY = y * unitHeight - halfHeight;
11826
11826
  var posZ = curRadius * cosTheta;
@@ -11954,8 +11954,8 @@ var PrimitiveType;
11954
11954
  indices[indicesOffset++] = d;
11955
11955
  indices[indicesOffset++] = c;
11956
11956
  }
11957
- PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, thetaRange, torsoVertexCount, 1, vertices, indices, indicesOffset);
11958
- PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, -thetaRange, torsoVertexCount + capVertexCount, -1, vertices, indices, indicesOffset + 6 * capRectangleCount);
11957
+ PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, thetaStart, thetaRange, torsoVertexCount, 1, vertices, indices, indicesOffset);
11958
+ PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, thetaStart, -thetaRange, torsoVertexCount + capVertexCount, -1, vertices, indices, indicesOffset + 6 * capRectangleCount);
11959
11959
  if (!isRestoreMode) {
11960
11960
  var bounds = capsuleMesh.bounds;
11961
11961
  bounds.min.set(-radius, -radius - halfHeight, -radius);
@@ -11996,7 +11996,7 @@ var PrimitiveType;
11996
11996
  }
11997
11997
  return indices;
11998
11998
  };
11999
- PrimitiveMesh._createCapsuleCap = function _createCapsuleCap(radius, height, radialSegments, capAlphaRange, offset, posIndex, vertices, indices, indicesOffset) {
11999
+ PrimitiveMesh._createCapsuleCap = function _createCapsuleCap(radius, height, radialSegments, thetaStart, thetaRange, offset, posIndex, vertices, indices, indicesOffset) {
12000
12000
  var radialCount = radialSegments + 1;
12001
12001
  var halfHeight = height * 0.5 * posIndex;
12002
12002
  var capVertexCount = radialCount * radialCount;
@@ -12009,12 +12009,12 @@ var PrimitiveType;
12009
12009
  var y = i * radialCountReciprocal | 0;
12010
12010
  var u = x * radialSegmentsReciprocal;
12011
12011
  var v = y * radialSegmentsReciprocal;
12012
- var alphaDelta = u * capAlphaRange;
12013
- var thetaDelta = v * Math.PI / 2;
12014
- var sinTheta = Math.sin(thetaDelta);
12015
- var posX = -radius * Math.cos(alphaDelta) * sinTheta;
12016
- var posY = radius * Math.cos(thetaDelta) * posIndex + halfHeight;
12017
- var posZ = radius * Math.sin(alphaDelta) * sinTheta;
12012
+ var theta = thetaStart + u * thetaRange;
12013
+ var alpha = v * Math.PI * 0.5;
12014
+ var sinAlpha = Math.sin(alpha);
12015
+ var posX = radius * Math.sin(theta) * sinAlpha;
12016
+ var posY = radius * Math.cos(alpha) * posIndex + halfHeight;
12017
+ var posZ = radius * Math.cos(theta) * sinAlpha;
12018
12018
  var index = (i + offset) * vertexFloatCount;
12019
12019
  // Position
12020
12020
  vertices[index++] = posX;
@@ -12537,7 +12537,9 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
12537
12537
  this._batchedQueue = null;
12538
12538
  var _this = this, meshes = _this._meshes, vertexBuffers = _this._vertexBuffers, indiceBuffers = _this._indiceBuffers;
12539
12539
  for(var i = 0, n = meshes.length; i < n; ++i){
12540
- meshes[i].destroy();
12540
+ var mesh = meshes[i];
12541
+ mesh._addReferCount(-1);
12542
+ mesh.destroy();
12541
12543
  }
12542
12544
  this._meshes = null;
12543
12545
  for(var i1 = 0, n1 = vertexBuffers.length; i1 < n1; ++i1){
@@ -12560,7 +12562,7 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
12560
12562
  _proto._createMesh = function _createMesh(engine, index) {
12561
12563
  var MAX_VERTEX_COUNT = Basic2DBatcher.MAX_VERTEX_COUNT;
12562
12564
  var mesh = new BufferMesh(engine, "BufferMesh" + index);
12563
- mesh.isGCIgnored = true;
12565
+ mesh._addReferCount(1);
12564
12566
  var vertexElements = [];
12565
12567
  var vertexStride = this.createVertexElements(vertexElements);
12566
12568
  // vertices
@@ -19615,6 +19617,47 @@ ShaderPool.init();
19615
19617
  /** @internal Conversion of space units to pixel units for 2D. */ Engine._pixelsPerUnit = 100;
19616
19618
  })();
19617
19619
 
19620
+ /**
19621
+ * Canvas.
19622
+ */ var Canvas = /*#__PURE__*/ function() {
19623
+ function Canvas() {
19624
+ /* @internal */ this._sizeUpdateFlagManager = new UpdateFlagManager();
19625
+ }
19626
+ _create_class(Canvas, [
19627
+ {
19628
+ key: "width",
19629
+ get: /**
19630
+ * The width of the canvas.
19631
+ */ function get() {
19632
+ return this._width;
19633
+ },
19634
+ set: function set(value) {
19635
+ if (this._width !== value) {
19636
+ this._width = value;
19637
+ this._sizeUpdateFlagManager.dispatch();
19638
+ this._onSizeChanged(value, this._width);
19639
+ }
19640
+ }
19641
+ },
19642
+ {
19643
+ key: "height",
19644
+ get: /**
19645
+ *The height of the canvas.
19646
+ */ function get() {
19647
+ return this._height;
19648
+ },
19649
+ set: function set(value) {
19650
+ if (this._height !== value) {
19651
+ this._height = value;
19652
+ this._sizeUpdateFlagManager.dispatch();
19653
+ this._onSizeChanged(this._width, value);
19654
+ }
19655
+ }
19656
+ }
19657
+ ]);
19658
+ return Canvas;
19659
+ }();
19660
+
19618
19661
  /**
19619
19662
  * The Background mode enumeration.
19620
19663
  */ exports.BackgroundMode = void 0;
@@ -23224,7 +23267,6 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23224
23267
  _this._viewport = new miniprogram.Vector4(0, 0, 1, 1);
23225
23268
  _this._pixelViewport = new miniprogram.Rect(0, 0, 0, 0);
23226
23269
  _this._inverseProjectionMatrix = new miniprogram.Matrix();
23227
- _this._lastAspectSize = new miniprogram.Vector2(0, 0);
23228
23270
  _this._invViewProjMat = new miniprogram.Matrix();
23229
23271
  var transform = _this.entity.transform;
23230
23272
  _this._transform = transform;
@@ -23234,6 +23276,10 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23234
23276
  _this._renderPipeline = new BasicRenderPipeline(_assert_this_initialized(_this));
23235
23277
  _this.shaderData._addReferCount(1);
23236
23278
  _this._updatePixelViewport();
23279
+ _this._onPixelViewportChanged = _this._onPixelViewportChanged.bind(_assert_this_initialized(_this));
23280
+ //@ts-ignore
23281
+ _this._viewport._onValueChanged = _this._onPixelViewportChanged;
23282
+ _this.engine.canvas._sizeUpdateFlagManager.addListener(_this._onPixelViewportChanged);
23237
23283
  return _this;
23238
23284
  }
23239
23285
  var _proto = Camera1.prototype;
@@ -23422,6 +23468,9 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23422
23468
  this._isInvViewProjDirty.destroy();
23423
23469
  this._isViewMatrixDirty.destroy();
23424
23470
  this.shaderData._addReferCount(-1);
23471
+ //@ts-ignore
23472
+ this._viewport._onValueChanged = null;
23473
+ this.engine.canvas._sizeUpdateFlagManager.removeListener(this._onPixelViewportChanged);
23425
23474
  this._entity = null;
23426
23475
  this._globalShaderMacro = null;
23427
23476
  this._frustum = null;
@@ -23434,16 +23483,20 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23434
23483
  this._isInvViewProjDirty = null;
23435
23484
  this._viewport = null;
23436
23485
  this._inverseProjectionMatrix = null;
23437
- this._lastAspectSize = null;
23438
23486
  this._invViewProjMat = null;
23439
23487
  };
23440
23488
  _proto._updatePixelViewport = function _updatePixelViewport() {
23441
- var _this__renderTarget, _this__renderTarget1;
23489
+ var width, height;
23490
+ var renderTarget = this._renderTarget;
23491
+ if (renderTarget) {
23492
+ width = renderTarget.width;
23493
+ height = renderTarget.height;
23494
+ } else {
23495
+ var canvas = this.engine.canvas;
23496
+ width = canvas.width;
23497
+ height = canvas.height;
23498
+ }
23442
23499
  var viewport = this._viewport;
23443
- var _this__renderTarget_width;
23444
- var width = (_this__renderTarget_width = (_this__renderTarget = this._renderTarget) == null ? void 0 : _this__renderTarget.width) != null ? _this__renderTarget_width : this.engine.canvas.width;
23445
- var _this__renderTarget_height;
23446
- var height = (_this__renderTarget_height = (_this__renderTarget1 = this._renderTarget) == null ? void 0 : _this__renderTarget1.height) != null ? _this__renderTarget_height : this.engine.canvas.height;
23447
23500
  this._pixelViewport.set(viewport.x * width, viewport.y * height, viewport.z * width, viewport.w * height);
23448
23501
  };
23449
23502
  _proto._projMatChange = function _projMatChange() {
@@ -23490,6 +23543,11 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23490
23543
  }
23491
23544
  return this._inverseProjectionMatrix;
23492
23545
  };
23546
+ _proto._onPixelViewportChanged = function _onPixelViewportChanged() {
23547
+ this._updatePixelViewport();
23548
+ var _this__customAspectRatio;
23549
+ (_this__customAspectRatio = this._customAspectRatio) != null ? _this__customAspectRatio : this._projMatChange();
23550
+ };
23493
23551
  _create_class(Camera1, [
23494
23552
  {
23495
23553
  key: "shaderData",
@@ -23563,8 +23621,6 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23563
23621
  if (value !== this._viewport) {
23564
23622
  this._viewport.copyFrom(value);
23565
23623
  }
23566
- this._projMatChange();
23567
- this._updatePixelViewport();
23568
23624
  }
23569
23625
  },
23570
23626
  {
@@ -23637,13 +23693,10 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23637
23693
  get: function get() {
23638
23694
  var virtualCamera = this._virtualCamera;
23639
23695
  var projectionMatrix = virtualCamera.projectionMatrix;
23640
- var canvas = this._entity.engine.canvas;
23641
- if ((!this._isProjectionDirty || this._isProjMatSetting) && this._lastAspectSize.x === canvas.width && this._lastAspectSize.y === canvas.height) {
23696
+ if (!this._isProjectionDirty || this._isProjMatSetting) {
23642
23697
  return projectionMatrix;
23643
23698
  }
23644
23699
  this._isProjectionDirty = false;
23645
- this._lastAspectSize.x = canvas.width;
23646
- this._lastAspectSize.y = canvas.height;
23647
23700
  var aspectRatio = this.aspectRatio;
23648
23701
  if (!virtualCamera.isOrthographic) {
23649
23702
  miniprogram.Matrix.perspective(miniprogram.MathUtil.degreeToRadian(this._fieldOfView), aspectRatio, this._nearClipPlane, this._farClipPlane, projectionMatrix);
@@ -23689,7 +23742,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23689
23742
  (_value = value) == null ? void 0 : _value._addReferCount(1);
23690
23743
  (_this__renderTarget = this._renderTarget) == null ? void 0 : _this__renderTarget._addReferCount(-1);
23691
23744
  this._renderTarget = value;
23692
- this._updatePixelViewport();
23745
+ this._onPixelViewportChanged();
23693
23746
  }
23694
23747
  }
23695
23748
  }
@@ -23738,12 +23791,12 @@ __decorate([
23738
23791
  __decorate([
23739
23792
  deepClone
23740
23793
  ], exports.Camera.prototype, "_inverseProjectionMatrix", void 0);
23741
- __decorate([
23742
- deepClone
23743
- ], exports.Camera.prototype, "_lastAspectSize", void 0);
23744
23794
  __decorate([
23745
23795
  deepClone
23746
23796
  ], exports.Camera.prototype, "_invViewProjMat", void 0);
23797
+ __decorate([
23798
+ ignoreClone
23799
+ ], exports.Camera.prototype, "_onPixelViewportChanged", null);
23747
23800
  exports.Camera = __decorate([
23748
23801
  dependentComponents(Transform, exports.DependentMode.CheckOnly)
23749
23802
  ], exports.Camera);
@@ -30858,6 +30911,7 @@ exports.Buffer = Buffer;
30858
30911
  exports.BufferMesh = BufferMesh;
30859
30912
  exports.BufferUtil = BufferUtil;
30860
30913
  exports.Burst = Burst;
30914
+ exports.Canvas = Canvas;
30861
30915
  exports.CapsuleColliderShape = CapsuleColliderShape;
30862
30916
  exports.CharacterController = CharacterController;
30863
30917
  exports.CircleShape = CircleShape;
package/dist/module.js CHANGED
@@ -11815,7 +11815,7 @@ var PrimitiveType;
11815
11815
  var theta = thetaStart + u * thetaRange;
11816
11816
  var sinTheta = Math.sin(theta);
11817
11817
  var cosTheta = Math.cos(theta);
11818
- var curRadius = radius - y * radius;
11818
+ var curRadius = radius - v * radius;
11819
11819
  var posX = curRadius * sinTheta;
11820
11820
  var posY = y * unitHeight - halfHeight;
11821
11821
  var posZ = curRadius * cosTheta;
@@ -11949,8 +11949,8 @@ var PrimitiveType;
11949
11949
  indices[indicesOffset++] = d;
11950
11950
  indices[indicesOffset++] = c;
11951
11951
  }
11952
- PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, thetaRange, torsoVertexCount, 1, vertices, indices, indicesOffset);
11953
- PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, -thetaRange, torsoVertexCount + capVertexCount, -1, vertices, indices, indicesOffset + 6 * capRectangleCount);
11952
+ PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, thetaStart, thetaRange, torsoVertexCount, 1, vertices, indices, indicesOffset);
11953
+ PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, thetaStart, -thetaRange, torsoVertexCount + capVertexCount, -1, vertices, indices, indicesOffset + 6 * capRectangleCount);
11954
11954
  if (!isRestoreMode) {
11955
11955
  var bounds = capsuleMesh.bounds;
11956
11956
  bounds.min.set(-radius, -radius - halfHeight, -radius);
@@ -11991,7 +11991,7 @@ var PrimitiveType;
11991
11991
  }
11992
11992
  return indices;
11993
11993
  };
11994
- PrimitiveMesh._createCapsuleCap = function _createCapsuleCap(radius, height, radialSegments, capAlphaRange, offset, posIndex, vertices, indices, indicesOffset) {
11994
+ PrimitiveMesh._createCapsuleCap = function _createCapsuleCap(radius, height, radialSegments, thetaStart, thetaRange, offset, posIndex, vertices, indices, indicesOffset) {
11995
11995
  var radialCount = radialSegments + 1;
11996
11996
  var halfHeight = height * 0.5 * posIndex;
11997
11997
  var capVertexCount = radialCount * radialCount;
@@ -12004,12 +12004,12 @@ var PrimitiveType;
12004
12004
  var y = i * radialCountReciprocal | 0;
12005
12005
  var u = x * radialSegmentsReciprocal;
12006
12006
  var v = y * radialSegmentsReciprocal;
12007
- var alphaDelta = u * capAlphaRange;
12008
- var thetaDelta = v * Math.PI / 2;
12009
- var sinTheta = Math.sin(thetaDelta);
12010
- var posX = -radius * Math.cos(alphaDelta) * sinTheta;
12011
- var posY = radius * Math.cos(thetaDelta) * posIndex + halfHeight;
12012
- var posZ = radius * Math.sin(alphaDelta) * sinTheta;
12007
+ var theta = thetaStart + u * thetaRange;
12008
+ var alpha = v * Math.PI * 0.5;
12009
+ var sinAlpha = Math.sin(alpha);
12010
+ var posX = radius * Math.sin(theta) * sinAlpha;
12011
+ var posY = radius * Math.cos(alpha) * posIndex + halfHeight;
12012
+ var posZ = radius * Math.cos(theta) * sinAlpha;
12013
12013
  var index = (i + offset) * vertexFloatCount;
12014
12014
  // Position
12015
12015
  vertices[index++] = posX;
@@ -12532,7 +12532,9 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
12532
12532
  this._batchedQueue = null;
12533
12533
  var _this = this, meshes = _this._meshes, vertexBuffers = _this._vertexBuffers, indiceBuffers = _this._indiceBuffers;
12534
12534
  for(var i = 0, n = meshes.length; i < n; ++i){
12535
- meshes[i].destroy();
12535
+ var mesh = meshes[i];
12536
+ mesh._addReferCount(-1);
12537
+ mesh.destroy();
12536
12538
  }
12537
12539
  this._meshes = null;
12538
12540
  for(var i1 = 0, n1 = vertexBuffers.length; i1 < n1; ++i1){
@@ -12555,7 +12557,7 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
12555
12557
  _proto._createMesh = function _createMesh(engine, index) {
12556
12558
  var MAX_VERTEX_COUNT = Basic2DBatcher.MAX_VERTEX_COUNT;
12557
12559
  var mesh = new BufferMesh(engine, "BufferMesh" + index);
12558
- mesh.isGCIgnored = true;
12560
+ mesh._addReferCount(1);
12559
12561
  var vertexElements = [];
12560
12562
  var vertexStride = this.createVertexElements(vertexElements);
12561
12563
  // vertices
@@ -19610,6 +19612,47 @@ ShaderPool.init();
19610
19612
  /** @internal Conversion of space units to pixel units for 2D. */ Engine._pixelsPerUnit = 100;
19611
19613
  })();
19612
19614
 
19615
+ /**
19616
+ * Canvas.
19617
+ */ var Canvas = /*#__PURE__*/ function() {
19618
+ function Canvas() {
19619
+ /* @internal */ this._sizeUpdateFlagManager = new UpdateFlagManager();
19620
+ }
19621
+ _create_class(Canvas, [
19622
+ {
19623
+ key: "width",
19624
+ get: /**
19625
+ * The width of the canvas.
19626
+ */ function get() {
19627
+ return this._width;
19628
+ },
19629
+ set: function set(value) {
19630
+ if (this._width !== value) {
19631
+ this._width = value;
19632
+ this._sizeUpdateFlagManager.dispatch();
19633
+ this._onSizeChanged(value, this._width);
19634
+ }
19635
+ }
19636
+ },
19637
+ {
19638
+ key: "height",
19639
+ get: /**
19640
+ *The height of the canvas.
19641
+ */ function get() {
19642
+ return this._height;
19643
+ },
19644
+ set: function set(value) {
19645
+ if (this._height !== value) {
19646
+ this._height = value;
19647
+ this._sizeUpdateFlagManager.dispatch();
19648
+ this._onSizeChanged(this._width, value);
19649
+ }
19650
+ }
19651
+ }
19652
+ ]);
19653
+ return Canvas;
19654
+ }();
19655
+
19613
19656
  /**
19614
19657
  * The Background mode enumeration.
19615
19658
  */ var BackgroundMode;
@@ -23219,7 +23262,6 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23219
23262
  _this._viewport = new Vector4(0, 0, 1, 1);
23220
23263
  _this._pixelViewport = new Rect(0, 0, 0, 0);
23221
23264
  _this._inverseProjectionMatrix = new Matrix();
23222
- _this._lastAspectSize = new Vector2(0, 0);
23223
23265
  _this._invViewProjMat = new Matrix();
23224
23266
  var transform = _this.entity.transform;
23225
23267
  _this._transform = transform;
@@ -23229,6 +23271,10 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23229
23271
  _this._renderPipeline = new BasicRenderPipeline(_assert_this_initialized(_this));
23230
23272
  _this.shaderData._addReferCount(1);
23231
23273
  _this._updatePixelViewport();
23274
+ _this._onPixelViewportChanged = _this._onPixelViewportChanged.bind(_assert_this_initialized(_this));
23275
+ //@ts-ignore
23276
+ _this._viewport._onValueChanged = _this._onPixelViewportChanged;
23277
+ _this.engine.canvas._sizeUpdateFlagManager.addListener(_this._onPixelViewportChanged);
23232
23278
  return _this;
23233
23279
  }
23234
23280
  var _proto = Camera1.prototype;
@@ -23417,6 +23463,9 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23417
23463
  this._isInvViewProjDirty.destroy();
23418
23464
  this._isViewMatrixDirty.destroy();
23419
23465
  this.shaderData._addReferCount(-1);
23466
+ //@ts-ignore
23467
+ this._viewport._onValueChanged = null;
23468
+ this.engine.canvas._sizeUpdateFlagManager.removeListener(this._onPixelViewportChanged);
23420
23469
  this._entity = null;
23421
23470
  this._globalShaderMacro = null;
23422
23471
  this._frustum = null;
@@ -23429,16 +23478,20 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23429
23478
  this._isInvViewProjDirty = null;
23430
23479
  this._viewport = null;
23431
23480
  this._inverseProjectionMatrix = null;
23432
- this._lastAspectSize = null;
23433
23481
  this._invViewProjMat = null;
23434
23482
  };
23435
23483
  _proto._updatePixelViewport = function _updatePixelViewport() {
23436
- var _this__renderTarget, _this__renderTarget1;
23484
+ var width, height;
23485
+ var renderTarget = this._renderTarget;
23486
+ if (renderTarget) {
23487
+ width = renderTarget.width;
23488
+ height = renderTarget.height;
23489
+ } else {
23490
+ var canvas = this.engine.canvas;
23491
+ width = canvas.width;
23492
+ height = canvas.height;
23493
+ }
23437
23494
  var viewport = this._viewport;
23438
- var _this__renderTarget_width;
23439
- var width = (_this__renderTarget_width = (_this__renderTarget = this._renderTarget) == null ? void 0 : _this__renderTarget.width) != null ? _this__renderTarget_width : this.engine.canvas.width;
23440
- var _this__renderTarget_height;
23441
- var height = (_this__renderTarget_height = (_this__renderTarget1 = this._renderTarget) == null ? void 0 : _this__renderTarget1.height) != null ? _this__renderTarget_height : this.engine.canvas.height;
23442
23495
  this._pixelViewport.set(viewport.x * width, viewport.y * height, viewport.z * width, viewport.w * height);
23443
23496
  };
23444
23497
  _proto._projMatChange = function _projMatChange() {
@@ -23485,6 +23538,11 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23485
23538
  }
23486
23539
  return this._inverseProjectionMatrix;
23487
23540
  };
23541
+ _proto._onPixelViewportChanged = function _onPixelViewportChanged() {
23542
+ this._updatePixelViewport();
23543
+ var _this__customAspectRatio;
23544
+ (_this__customAspectRatio = this._customAspectRatio) != null ? _this__customAspectRatio : this._projMatChange();
23545
+ };
23488
23546
  _create_class(Camera1, [
23489
23547
  {
23490
23548
  key: "shaderData",
@@ -23558,8 +23616,6 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23558
23616
  if (value !== this._viewport) {
23559
23617
  this._viewport.copyFrom(value);
23560
23618
  }
23561
- this._projMatChange();
23562
- this._updatePixelViewport();
23563
23619
  }
23564
23620
  },
23565
23621
  {
@@ -23632,13 +23688,10 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23632
23688
  get: function get() {
23633
23689
  var virtualCamera = this._virtualCamera;
23634
23690
  var projectionMatrix = virtualCamera.projectionMatrix;
23635
- var canvas = this._entity.engine.canvas;
23636
- if ((!this._isProjectionDirty || this._isProjMatSetting) && this._lastAspectSize.x === canvas.width && this._lastAspectSize.y === canvas.height) {
23691
+ if (!this._isProjectionDirty || this._isProjMatSetting) {
23637
23692
  return projectionMatrix;
23638
23693
  }
23639
23694
  this._isProjectionDirty = false;
23640
- this._lastAspectSize.x = canvas.width;
23641
- this._lastAspectSize.y = canvas.height;
23642
23695
  var aspectRatio = this.aspectRatio;
23643
23696
  if (!virtualCamera.isOrthographic) {
23644
23697
  Matrix.perspective(MathUtil$1.degreeToRadian(this._fieldOfView), aspectRatio, this._nearClipPlane, this._farClipPlane, projectionMatrix);
@@ -23684,7 +23737,7 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23684
23737
  (_value = value) == null ? void 0 : _value._addReferCount(1);
23685
23738
  (_this__renderTarget = this._renderTarget) == null ? void 0 : _this__renderTarget._addReferCount(-1);
23686
23739
  this._renderTarget = value;
23687
- this._updatePixelViewport();
23740
+ this._onPixelViewportChanged();
23688
23741
  }
23689
23742
  }
23690
23743
  }
@@ -23733,12 +23786,12 @@ __decorate([
23733
23786
  __decorate([
23734
23787
  deepClone
23735
23788
  ], Camera.prototype, "_inverseProjectionMatrix", void 0);
23736
- __decorate([
23737
- deepClone
23738
- ], Camera.prototype, "_lastAspectSize", void 0);
23739
23789
  __decorate([
23740
23790
  deepClone
23741
23791
  ], Camera.prototype, "_invViewProjMat", void 0);
23792
+ __decorate([
23793
+ ignoreClone
23794
+ ], Camera.prototype, "_onPixelViewportChanged", null);
23742
23795
  Camera = __decorate([
23743
23796
  dependentComponents(Transform, DependentMode.CheckOnly)
23744
23797
  ], Camera);
@@ -30826,5 +30879,5 @@ var cacheDir = new Vector3();
30826
30879
  return CubeProbe;
30827
30880
  }(Probe);
30828
30881
 
30829
- export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AssetPromise, AssetType, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, Basic2DBatcher, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CapsuleColliderShape, CharacterController, CircleShape, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, CollisionDetectionMode, ColorOverLifetimeModule, ColorSpace, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EventDispatcher, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, Light, Loader, Logger, MainModule, Material, Mesh, MeshRenderer, MeshTopology, ModelMesh, OverflowMode, PBRBaseMaterial, PBRMaterial, PBRSpecularMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerPhase, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RenderBufferDepthFormat, RenderFace, RenderPass, RenderQueue, RenderQueueType, RenderState, RenderStateElementKey as RenderStateDataKey, RenderTarget, RenderTargetBlendState, Renderer, ResourceManager, RotationOverLifetimeModule, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderFactory, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubMesh, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureWrapMode, Time, TrailMaterial, TrailRenderer, Transform, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, assignmentClone, deepClone, dependentComponents, ignoreClone, request, resourceLoader, shallowClone };
30882
+ export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AssetPromise, AssetType, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, Basic2DBatcher, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, Canvas, CapsuleColliderShape, CharacterController, CircleShape, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, CollisionDetectionMode, ColorOverLifetimeModule, ColorSpace, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EventDispatcher, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, Light, Loader, Logger, MainModule, Material, Mesh, MeshRenderer, MeshTopology, ModelMesh, OverflowMode, PBRBaseMaterial, PBRMaterial, PBRSpecularMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerPhase, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RenderBufferDepthFormat, RenderFace, RenderPass, RenderQueue, RenderQueueType, RenderState, RenderStateElementKey as RenderStateDataKey, RenderTarget, RenderTargetBlendState, Renderer, ResourceManager, RotationOverLifetimeModule, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderFactory, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubMesh, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureWrapMode, Time, TrailMaterial, TrailRenderer, Transform, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, assignmentClone, deepClone, dependentComponents, ignoreClone, request, resourceLoader, shallowClone };
30830
30883
  //# sourceMappingURL=module.js.map