@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.
- package/dist/main.js +83 -29
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +83 -29
- package/dist/module.js +83 -30
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Camera.d.ts +1 -1
- package/types/Canvas.d.ts +14 -5
- package/types/index.d.ts +1 -1
package/dist/main.js
CHANGED
|
@@ -11819,7 +11819,7 @@ var PrimitiveType;
|
|
|
11819
11819
|
var theta = thetaStart + u * thetaRange;
|
|
11820
11820
|
var sinTheta = Math.sin(theta);
|
|
11821
11821
|
var cosTheta = Math.cos(theta);
|
|
11822
|
-
var curRadius = radius -
|
|
11822
|
+
var curRadius = radius - v * radius;
|
|
11823
11823
|
var posX = curRadius * sinTheta;
|
|
11824
11824
|
var posY = y * unitHeight - halfHeight;
|
|
11825
11825
|
var posZ = curRadius * cosTheta;
|
|
@@ -11953,8 +11953,8 @@ var PrimitiveType;
|
|
|
11953
11953
|
indices[indicesOffset++] = d;
|
|
11954
11954
|
indices[indicesOffset++] = c;
|
|
11955
11955
|
}
|
|
11956
|
-
PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, thetaRange, torsoVertexCount, 1, vertices, indices, indicesOffset);
|
|
11957
|
-
PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, -thetaRange, torsoVertexCount + capVertexCount, -1, vertices, indices, indicesOffset + 6 * capRectangleCount);
|
|
11956
|
+
PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, thetaStart, thetaRange, torsoVertexCount, 1, vertices, indices, indicesOffset);
|
|
11957
|
+
PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, thetaStart, -thetaRange, torsoVertexCount + capVertexCount, -1, vertices, indices, indicesOffset + 6 * capRectangleCount);
|
|
11958
11958
|
if (!isRestoreMode) {
|
|
11959
11959
|
var bounds = capsuleMesh.bounds;
|
|
11960
11960
|
bounds.min.set(-radius, -radius - halfHeight, -radius);
|
|
@@ -11995,7 +11995,7 @@ var PrimitiveType;
|
|
|
11995
11995
|
}
|
|
11996
11996
|
return indices;
|
|
11997
11997
|
};
|
|
11998
|
-
PrimitiveMesh._createCapsuleCap = function _createCapsuleCap(radius, height, radialSegments,
|
|
11998
|
+
PrimitiveMesh._createCapsuleCap = function _createCapsuleCap(radius, height, radialSegments, thetaStart, thetaRange, offset, posIndex, vertices, indices, indicesOffset) {
|
|
11999
11999
|
var radialCount = radialSegments + 1;
|
|
12000
12000
|
var halfHeight = height * 0.5 * posIndex;
|
|
12001
12001
|
var capVertexCount = radialCount * radialCount;
|
|
@@ -12008,12 +12008,12 @@ var PrimitiveType;
|
|
|
12008
12008
|
var y = i * radialCountReciprocal | 0;
|
|
12009
12009
|
var u = x * radialSegmentsReciprocal;
|
|
12010
12010
|
var v = y * radialSegmentsReciprocal;
|
|
12011
|
-
var
|
|
12012
|
-
var
|
|
12013
|
-
var
|
|
12014
|
-
var posX =
|
|
12015
|
-
var posY = radius * Math.cos(
|
|
12016
|
-
var posZ = radius * Math.
|
|
12011
|
+
var theta = thetaStart + u * thetaRange;
|
|
12012
|
+
var alpha = v * Math.PI * 0.5;
|
|
12013
|
+
var sinAlpha = Math.sin(alpha);
|
|
12014
|
+
var posX = radius * Math.sin(theta) * sinAlpha;
|
|
12015
|
+
var posY = radius * Math.cos(alpha) * posIndex + halfHeight;
|
|
12016
|
+
var posZ = radius * Math.cos(theta) * sinAlpha;
|
|
12017
12017
|
var index = (i + offset) * vertexFloatCount;
|
|
12018
12018
|
// Position
|
|
12019
12019
|
vertices[index++] = posX;
|
|
@@ -12536,7 +12536,9 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
12536
12536
|
this._batchedQueue = null;
|
|
12537
12537
|
var _this = this, meshes = _this._meshes, vertexBuffers = _this._vertexBuffers, indiceBuffers = _this._indiceBuffers;
|
|
12538
12538
|
for(var i = 0, n = meshes.length; i < n; ++i){
|
|
12539
|
-
meshes[i]
|
|
12539
|
+
var mesh = meshes[i];
|
|
12540
|
+
mesh._addReferCount(-1);
|
|
12541
|
+
mesh.destroy();
|
|
12540
12542
|
}
|
|
12541
12543
|
this._meshes = null;
|
|
12542
12544
|
for(var i1 = 0, n1 = vertexBuffers.length; i1 < n1; ++i1){
|
|
@@ -12559,7 +12561,7 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
12559
12561
|
_proto._createMesh = function _createMesh(engine, index) {
|
|
12560
12562
|
var MAX_VERTEX_COUNT = Basic2DBatcher.MAX_VERTEX_COUNT;
|
|
12561
12563
|
var mesh = new BufferMesh(engine, "BufferMesh" + index);
|
|
12562
|
-
mesh.
|
|
12564
|
+
mesh._addReferCount(1);
|
|
12563
12565
|
var vertexElements = [];
|
|
12564
12566
|
var vertexStride = this.createVertexElements(vertexElements);
|
|
12565
12567
|
// vertices
|
|
@@ -19614,6 +19616,47 @@ ShaderPool.init();
|
|
|
19614
19616
|
/** @internal Conversion of space units to pixel units for 2D. */ Engine._pixelsPerUnit = 100;
|
|
19615
19617
|
})();
|
|
19616
19618
|
|
|
19619
|
+
/**
|
|
19620
|
+
* Canvas.
|
|
19621
|
+
*/ var Canvas = /*#__PURE__*/ function() {
|
|
19622
|
+
function Canvas() {
|
|
19623
|
+
/* @internal */ this._sizeUpdateFlagManager = new UpdateFlagManager();
|
|
19624
|
+
}
|
|
19625
|
+
_create_class(Canvas, [
|
|
19626
|
+
{
|
|
19627
|
+
key: "width",
|
|
19628
|
+
get: /**
|
|
19629
|
+
* The width of the canvas.
|
|
19630
|
+
*/ function get() {
|
|
19631
|
+
return this._width;
|
|
19632
|
+
},
|
|
19633
|
+
set: function set(value) {
|
|
19634
|
+
if (this._width !== value) {
|
|
19635
|
+
this._width = value;
|
|
19636
|
+
this._sizeUpdateFlagManager.dispatch();
|
|
19637
|
+
this._onSizeChanged(value, this._width);
|
|
19638
|
+
}
|
|
19639
|
+
}
|
|
19640
|
+
},
|
|
19641
|
+
{
|
|
19642
|
+
key: "height",
|
|
19643
|
+
get: /**
|
|
19644
|
+
*The height of the canvas.
|
|
19645
|
+
*/ function get() {
|
|
19646
|
+
return this._height;
|
|
19647
|
+
},
|
|
19648
|
+
set: function set(value) {
|
|
19649
|
+
if (this._height !== value) {
|
|
19650
|
+
this._height = value;
|
|
19651
|
+
this._sizeUpdateFlagManager.dispatch();
|
|
19652
|
+
this._onSizeChanged(this._width, value);
|
|
19653
|
+
}
|
|
19654
|
+
}
|
|
19655
|
+
}
|
|
19656
|
+
]);
|
|
19657
|
+
return Canvas;
|
|
19658
|
+
}();
|
|
19659
|
+
|
|
19617
19660
|
/**
|
|
19618
19661
|
* The Background mode enumeration.
|
|
19619
19662
|
*/ exports.BackgroundMode = void 0;
|
|
@@ -23223,7 +23266,6 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23223
23266
|
_this._viewport = new engineMath.Vector4(0, 0, 1, 1);
|
|
23224
23267
|
_this._pixelViewport = new engineMath.Rect(0, 0, 0, 0);
|
|
23225
23268
|
_this._inverseProjectionMatrix = new engineMath.Matrix();
|
|
23226
|
-
_this._lastAspectSize = new engineMath.Vector2(0, 0);
|
|
23227
23269
|
_this._invViewProjMat = new engineMath.Matrix();
|
|
23228
23270
|
var transform = _this.entity.transform;
|
|
23229
23271
|
_this._transform = transform;
|
|
@@ -23233,6 +23275,10 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23233
23275
|
_this._renderPipeline = new BasicRenderPipeline(_assert_this_initialized(_this));
|
|
23234
23276
|
_this.shaderData._addReferCount(1);
|
|
23235
23277
|
_this._updatePixelViewport();
|
|
23278
|
+
_this._onPixelViewportChanged = _this._onPixelViewportChanged.bind(_assert_this_initialized(_this));
|
|
23279
|
+
//@ts-ignore
|
|
23280
|
+
_this._viewport._onValueChanged = _this._onPixelViewportChanged;
|
|
23281
|
+
_this.engine.canvas._sizeUpdateFlagManager.addListener(_this._onPixelViewportChanged);
|
|
23236
23282
|
return _this;
|
|
23237
23283
|
}
|
|
23238
23284
|
var _proto = Camera1.prototype;
|
|
@@ -23421,6 +23467,9 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23421
23467
|
this._isInvViewProjDirty.destroy();
|
|
23422
23468
|
this._isViewMatrixDirty.destroy();
|
|
23423
23469
|
this.shaderData._addReferCount(-1);
|
|
23470
|
+
//@ts-ignore
|
|
23471
|
+
this._viewport._onValueChanged = null;
|
|
23472
|
+
this.engine.canvas._sizeUpdateFlagManager.removeListener(this._onPixelViewportChanged);
|
|
23424
23473
|
this._entity = null;
|
|
23425
23474
|
this._globalShaderMacro = null;
|
|
23426
23475
|
this._frustum = null;
|
|
@@ -23433,16 +23482,20 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23433
23482
|
this._isInvViewProjDirty = null;
|
|
23434
23483
|
this._viewport = null;
|
|
23435
23484
|
this._inverseProjectionMatrix = null;
|
|
23436
|
-
this._lastAspectSize = null;
|
|
23437
23485
|
this._invViewProjMat = null;
|
|
23438
23486
|
};
|
|
23439
23487
|
_proto._updatePixelViewport = function _updatePixelViewport() {
|
|
23440
|
-
var
|
|
23488
|
+
var width, height;
|
|
23489
|
+
var renderTarget = this._renderTarget;
|
|
23490
|
+
if (renderTarget) {
|
|
23491
|
+
width = renderTarget.width;
|
|
23492
|
+
height = renderTarget.height;
|
|
23493
|
+
} else {
|
|
23494
|
+
var canvas = this.engine.canvas;
|
|
23495
|
+
width = canvas.width;
|
|
23496
|
+
height = canvas.height;
|
|
23497
|
+
}
|
|
23441
23498
|
var viewport = this._viewport;
|
|
23442
|
-
var _this__renderTarget_width;
|
|
23443
|
-
var width = (_this__renderTarget_width = (_this__renderTarget = this._renderTarget) == null ? void 0 : _this__renderTarget.width) != null ? _this__renderTarget_width : this.engine.canvas.width;
|
|
23444
|
-
var _this__renderTarget_height;
|
|
23445
|
-
var height = (_this__renderTarget_height = (_this__renderTarget1 = this._renderTarget) == null ? void 0 : _this__renderTarget1.height) != null ? _this__renderTarget_height : this.engine.canvas.height;
|
|
23446
23499
|
this._pixelViewport.set(viewport.x * width, viewport.y * height, viewport.z * width, viewport.w * height);
|
|
23447
23500
|
};
|
|
23448
23501
|
_proto._projMatChange = function _projMatChange() {
|
|
@@ -23489,6 +23542,11 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23489
23542
|
}
|
|
23490
23543
|
return this._inverseProjectionMatrix;
|
|
23491
23544
|
};
|
|
23545
|
+
_proto._onPixelViewportChanged = function _onPixelViewportChanged() {
|
|
23546
|
+
this._updatePixelViewport();
|
|
23547
|
+
var _this__customAspectRatio;
|
|
23548
|
+
(_this__customAspectRatio = this._customAspectRatio) != null ? _this__customAspectRatio : this._projMatChange();
|
|
23549
|
+
};
|
|
23492
23550
|
_create_class(Camera1, [
|
|
23493
23551
|
{
|
|
23494
23552
|
key: "shaderData",
|
|
@@ -23562,8 +23620,6 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23562
23620
|
if (value !== this._viewport) {
|
|
23563
23621
|
this._viewport.copyFrom(value);
|
|
23564
23622
|
}
|
|
23565
|
-
this._projMatChange();
|
|
23566
|
-
this._updatePixelViewport();
|
|
23567
23623
|
}
|
|
23568
23624
|
},
|
|
23569
23625
|
{
|
|
@@ -23636,13 +23692,10 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23636
23692
|
get: function get() {
|
|
23637
23693
|
var virtualCamera = this._virtualCamera;
|
|
23638
23694
|
var projectionMatrix = virtualCamera.projectionMatrix;
|
|
23639
|
-
|
|
23640
|
-
if ((!this._isProjectionDirty || this._isProjMatSetting) && this._lastAspectSize.x === canvas.width && this._lastAspectSize.y === canvas.height) {
|
|
23695
|
+
if (!this._isProjectionDirty || this._isProjMatSetting) {
|
|
23641
23696
|
return projectionMatrix;
|
|
23642
23697
|
}
|
|
23643
23698
|
this._isProjectionDirty = false;
|
|
23644
|
-
this._lastAspectSize.x = canvas.width;
|
|
23645
|
-
this._lastAspectSize.y = canvas.height;
|
|
23646
23699
|
var aspectRatio = this.aspectRatio;
|
|
23647
23700
|
if (!virtualCamera.isOrthographic) {
|
|
23648
23701
|
engineMath.Matrix.perspective(engineMath.MathUtil.degreeToRadian(this._fieldOfView), aspectRatio, this._nearClipPlane, this._farClipPlane, projectionMatrix);
|
|
@@ -23688,7 +23741,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23688
23741
|
(_value = value) == null ? void 0 : _value._addReferCount(1);
|
|
23689
23742
|
(_this__renderTarget = this._renderTarget) == null ? void 0 : _this__renderTarget._addReferCount(-1);
|
|
23690
23743
|
this._renderTarget = value;
|
|
23691
|
-
this.
|
|
23744
|
+
this._onPixelViewportChanged();
|
|
23692
23745
|
}
|
|
23693
23746
|
}
|
|
23694
23747
|
}
|
|
@@ -23737,12 +23790,12 @@ __decorate([
|
|
|
23737
23790
|
__decorate([
|
|
23738
23791
|
deepClone
|
|
23739
23792
|
], exports.Camera.prototype, "_inverseProjectionMatrix", void 0);
|
|
23740
|
-
__decorate([
|
|
23741
|
-
deepClone
|
|
23742
|
-
], exports.Camera.prototype, "_lastAspectSize", void 0);
|
|
23743
23793
|
__decorate([
|
|
23744
23794
|
deepClone
|
|
23745
23795
|
], exports.Camera.prototype, "_invViewProjMat", void 0);
|
|
23796
|
+
__decorate([
|
|
23797
|
+
ignoreClone
|
|
23798
|
+
], exports.Camera.prototype, "_onPixelViewportChanged", null);
|
|
23746
23799
|
exports.Camera = __decorate([
|
|
23747
23800
|
dependentComponents(Transform, exports.DependentMode.CheckOnly)
|
|
23748
23801
|
], exports.Camera);
|
|
@@ -30857,6 +30910,7 @@ exports.Buffer = Buffer;
|
|
|
30857
30910
|
exports.BufferMesh = BufferMesh;
|
|
30858
30911
|
exports.BufferUtil = BufferUtil;
|
|
30859
30912
|
exports.Burst = Burst;
|
|
30913
|
+
exports.Canvas = Canvas;
|
|
30860
30914
|
exports.CapsuleColliderShape = CapsuleColliderShape;
|
|
30861
30915
|
exports.CharacterController = CharacterController;
|
|
30862
30916
|
exports.CircleShape = CircleShape;
|