@galacean/engine-core 1.1.0-beta.4 → 1.1.0-beta.5
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 +90 -30
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +90 -30
- package/dist/module.js +90 -30
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Background.d.ts +2 -0
- package/types/Component.d.ts +1 -1
- package/types/Scene.d.ts +6 -0
- package/types/physics/PhysicsManager.d.ts +5 -22
package/dist/main.js
CHANGED
|
@@ -2541,8 +2541,8 @@ var ActiveChangeFlag;
|
|
|
2541
2541
|
var _this;
|
|
2542
2542
|
_this = EngineObject1.call(this, entity.engine) || this;
|
|
2543
2543
|
/** @internal */ _this._awoken = false;
|
|
2544
|
-
_this._phasedActive = false;
|
|
2545
2544
|
_this._phasedActiveInScene = false;
|
|
2545
|
+
_this._phasedActive = false;
|
|
2546
2546
|
_this._enabled = true;
|
|
2547
2547
|
_this._entity = entity;
|
|
2548
2548
|
return _this;
|
|
@@ -2674,10 +2674,10 @@ __decorate([
|
|
|
2674
2674
|
], Component.prototype, "_awoken", void 0);
|
|
2675
2675
|
__decorate([
|
|
2676
2676
|
ignoreClone
|
|
2677
|
-
], Component.prototype, "
|
|
2677
|
+
], Component.prototype, "_phasedActiveInScene", void 0);
|
|
2678
2678
|
__decorate([
|
|
2679
2679
|
ignoreClone
|
|
2680
|
-
], Component.prototype, "
|
|
2680
|
+
], Component.prototype, "_phasedActive", void 0);
|
|
2681
2681
|
__decorate([
|
|
2682
2682
|
assignmentClone
|
|
2683
2683
|
], Component.prototype, "_enabled", void 0);
|
|
@@ -12591,16 +12591,31 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
12591
12591
|
}
|
|
12592
12592
|
var _proto = SceneManager.prototype;
|
|
12593
12593
|
_proto.addScene = function addScene(indexOrScene, scene) {
|
|
12594
|
+
var scenes = this._scenes;
|
|
12595
|
+
var index;
|
|
12594
12596
|
if (typeof indexOrScene === "number") {
|
|
12595
|
-
|
|
12597
|
+
if (indexOrScene < 0 || indexOrScene > scenes.length) {
|
|
12598
|
+
throw "The index is out of range.";
|
|
12599
|
+
}
|
|
12600
|
+
index = indexOrScene;
|
|
12596
12601
|
} else {
|
|
12602
|
+
index = scenes.length;
|
|
12597
12603
|
scene = indexOrScene;
|
|
12598
|
-
this._scenes.push(scene);
|
|
12599
12604
|
}
|
|
12600
12605
|
if (scene.engine !== this.engine) {
|
|
12601
12606
|
throw "The scene is not belong to this engine.";
|
|
12602
12607
|
}
|
|
12603
|
-
scene.
|
|
12608
|
+
if (scene._sceneManager) {
|
|
12609
|
+
var currentIndex = scenes.indexOf(scene);
|
|
12610
|
+
if (currentIndex !== index) {
|
|
12611
|
+
scenes.removeByIndex(currentIndex);
|
|
12612
|
+
scenes.add(index, scene);
|
|
12613
|
+
}
|
|
12614
|
+
} else {
|
|
12615
|
+
scene._sceneManager = this;
|
|
12616
|
+
scenes.add(index, scene);
|
|
12617
|
+
scene.isActive && scene._processActive(true);
|
|
12618
|
+
}
|
|
12604
12619
|
};
|
|
12605
12620
|
/**
|
|
12606
12621
|
* Remove scene.
|
|
@@ -12611,7 +12626,8 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
12611
12626
|
if (index !== -1) {
|
|
12612
12627
|
var removedScene = scenes.getArray()[index];
|
|
12613
12628
|
scenes.removeByIndex(index);
|
|
12614
|
-
|
|
12629
|
+
scene._sceneManager = null;
|
|
12630
|
+
removedScene.isActive && removedScene._processActive(false);
|
|
12615
12631
|
}
|
|
12616
12632
|
};
|
|
12617
12633
|
/**
|
|
@@ -13815,9 +13831,9 @@ exports.Collider = /*#__PURE__*/ function(Component1) {
|
|
|
13815
13831
|
oldCollider.removeShape(shape);
|
|
13816
13832
|
}
|
|
13817
13833
|
this._shapes.push(shape);
|
|
13818
|
-
this.scene.physics._addColliderShape(shape);
|
|
13819
13834
|
shape._collider = this;
|
|
13820
13835
|
this._nativeCollider.addShape(shape._nativeShape);
|
|
13836
|
+
this._phasedActiveInScene && this.scene.physics._addColliderShape(shape);
|
|
13821
13837
|
}
|
|
13822
13838
|
};
|
|
13823
13839
|
/**
|
|
@@ -13827,7 +13843,7 @@ exports.Collider = /*#__PURE__*/ function(Component1) {
|
|
|
13827
13843
|
var index = this._shapes.indexOf(shape);
|
|
13828
13844
|
if (index !== -1) {
|
|
13829
13845
|
this._shapes.splice(index, 1);
|
|
13830
|
-
this.scene.physics._removeColliderShape(shape);
|
|
13846
|
+
this._phasedActiveInScene && this.scene.physics._removeColliderShape(shape);
|
|
13831
13847
|
shape._collider = null;
|
|
13832
13848
|
this._nativeCollider.removeShape(shape._nativeShape);
|
|
13833
13849
|
}
|
|
@@ -13838,7 +13854,7 @@ exports.Collider = /*#__PURE__*/ function(Component1) {
|
|
|
13838
13854
|
var shapes = this._shapes;
|
|
13839
13855
|
for(var i = 0, n = shapes.length; i < n; i++){
|
|
13840
13856
|
var shape = shapes[i];
|
|
13841
|
-
this.scene.physics._removeColliderShape(shape);
|
|
13857
|
+
this._phasedActiveInScene && this.scene.physics._removeColliderShape(shape);
|
|
13842
13858
|
shape._destroy();
|
|
13843
13859
|
this._nativeCollider.removeShape(shape._nativeShape);
|
|
13844
13860
|
}
|
|
@@ -13863,12 +13879,22 @@ exports.Collider = /*#__PURE__*/ function(Component1) {
|
|
|
13863
13879
|
/**
|
|
13864
13880
|
* @internal
|
|
13865
13881
|
*/ _proto._onEnableInScene = function _onEnableInScene() {
|
|
13866
|
-
this.scene.physics
|
|
13882
|
+
var physics = this.scene.physics;
|
|
13883
|
+
physics._addCollider(this);
|
|
13884
|
+
var shapes = this.shapes;
|
|
13885
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
13886
|
+
physics._addColliderShape(shapes[i]);
|
|
13887
|
+
}
|
|
13867
13888
|
};
|
|
13868
13889
|
/**
|
|
13869
13890
|
* @internal
|
|
13870
13891
|
*/ _proto._onDisableInScene = function _onDisableInScene() {
|
|
13871
|
-
this.scene.physics
|
|
13892
|
+
var physics = this.scene.physics;
|
|
13893
|
+
physics._removeCollider(this);
|
|
13894
|
+
var shapes = this.shapes;
|
|
13895
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
13896
|
+
physics._removeColliderShape(shapes[i]);
|
|
13897
|
+
}
|
|
13872
13898
|
};
|
|
13873
13899
|
/**
|
|
13874
13900
|
* @internal
|
|
@@ -14246,12 +14272,22 @@ var Collision = function Collision() {
|
|
|
14246
14272
|
/**
|
|
14247
14273
|
* @internal
|
|
14248
14274
|
*/ _proto._onEnableInScene = function _onEnableInScene() {
|
|
14249
|
-
this.scene.physics
|
|
14275
|
+
var physics = this.scene.physics;
|
|
14276
|
+
physics._addCharacterController(this);
|
|
14277
|
+
var shapes = this.shapes;
|
|
14278
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
14279
|
+
physics._addColliderShape(shapes[i]);
|
|
14280
|
+
}
|
|
14250
14281
|
};
|
|
14251
14282
|
/**
|
|
14252
14283
|
* @internal
|
|
14253
14284
|
*/ _proto._onDisableInScene = function _onDisableInScene() {
|
|
14254
|
-
this.scene.physics
|
|
14285
|
+
var physics = this.scene.physics;
|
|
14286
|
+
physics._removeCharacterController(this);
|
|
14287
|
+
var shapes = this.shapes;
|
|
14288
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
14289
|
+
physics._removeColliderShape(shapes[i]);
|
|
14290
|
+
}
|
|
14255
14291
|
};
|
|
14256
14292
|
_proto._setUpDirection = function _setUpDirection() {
|
|
14257
14293
|
this._nativeCollider.setUpDirection(this._upDirection);
|
|
@@ -16403,10 +16439,6 @@ ShaderPool.init();
|
|
|
16403
16439
|
magentaMaterial.isGCIgnored = true;
|
|
16404
16440
|
magentaMaterial.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
|
|
16405
16441
|
_this._magentaMaterial = magentaMaterial;
|
|
16406
|
-
var backgroundTextureMaterial = new Material(_assert_this_initialized(_this), Shader.find("background-texture"));
|
|
16407
|
-
backgroundTextureMaterial.isGCIgnored = true;
|
|
16408
|
-
backgroundTextureMaterial.renderState.depthState.compareFunction = exports.CompareFunction.LessEqual;
|
|
16409
|
-
_this._backgroundTextureMaterial = backgroundTextureMaterial;
|
|
16410
16442
|
var innerSettings = _this._settings;
|
|
16411
16443
|
var colorSpace = configuration.colorSpace || exports.ColorSpace.Linear;
|
|
16412
16444
|
colorSpace === exports.ColorSpace.Gamma && _this._macroCollection.enable(Engine._gammaMacro);
|
|
@@ -17024,6 +17056,7 @@ ShaderPool.init();
|
|
|
17024
17056
|
this./** @internal */ _textureFillMode = exports.BackgroundTextureFillMode.AspectFitHeight;
|
|
17025
17057
|
this._texture = null;
|
|
17026
17058
|
this._initMesh(_engine);
|
|
17059
|
+
this._initMaterial(_engine);
|
|
17027
17060
|
}
|
|
17028
17061
|
var _proto = Background.prototype;
|
|
17029
17062
|
/**
|
|
@@ -17031,19 +17064,14 @@ ShaderPool.init();
|
|
|
17031
17064
|
*/ _proto.destroy = function destroy() {
|
|
17032
17065
|
this._mesh._addReferCount(-1);
|
|
17033
17066
|
this._mesh = null;
|
|
17067
|
+
this._material._addReferCount(-1);
|
|
17068
|
+
this._material = null;
|
|
17034
17069
|
this.texture = null;
|
|
17035
17070
|
this.solidColor = null;
|
|
17036
17071
|
this.sky.destroy();
|
|
17037
17072
|
};
|
|
17038
17073
|
/**
|
|
17039
17074
|
* @internal
|
|
17040
|
-
* Standalone for CanvasRenderer plugin.
|
|
17041
|
-
*/ _proto._initMesh = function _initMesh(engine) {
|
|
17042
|
-
this._mesh = this._createPlane(engine);
|
|
17043
|
-
this._mesh._addReferCount(1);
|
|
17044
|
-
};
|
|
17045
|
-
/**
|
|
17046
|
-
* @internal
|
|
17047
17075
|
*/ _proto._resizeBackgroundTexture = function _resizeBackgroundTexture() {
|
|
17048
17076
|
if (!this._texture) {
|
|
17049
17077
|
return;
|
|
@@ -17077,6 +17105,15 @@ ShaderPool.init();
|
|
|
17077
17105
|
_backgroundTextureMesh.setPositions(positions);
|
|
17078
17106
|
_backgroundTextureMesh.uploadData(false);
|
|
17079
17107
|
};
|
|
17108
|
+
_proto._initMesh = function _initMesh(engine) {
|
|
17109
|
+
this._mesh = this._createPlane(engine);
|
|
17110
|
+
this._mesh._addReferCount(1);
|
|
17111
|
+
};
|
|
17112
|
+
_proto._initMaterial = function _initMaterial(engine) {
|
|
17113
|
+
var material = this._material = new Material(engine, Shader.find("background-texture"));
|
|
17114
|
+
material.renderState.depthState.compareFunction = exports.CompareFunction.LessEqual;
|
|
17115
|
+
material._addReferCount(1);
|
|
17116
|
+
};
|
|
17080
17117
|
_proto._createPlane = function _createPlane(engine) {
|
|
17081
17118
|
var mesh = new ModelMesh(engine);
|
|
17082
17119
|
mesh.isGCIgnored = true;
|
|
@@ -17116,7 +17153,7 @@ ShaderPool.init();
|
|
|
17116
17153
|
(_value = value) == null ? void 0 : _value._addReferCount(1);
|
|
17117
17154
|
(_this__texture = this._texture) == null ? void 0 : _this__texture._addReferCount(-1);
|
|
17118
17155
|
this._texture = value;
|
|
17119
|
-
this.
|
|
17156
|
+
this._material.shaderData.setTexture("material_BaseTexture", value);
|
|
17120
17157
|
}
|
|
17121
17158
|
}
|
|
17122
17159
|
},
|
|
@@ -18196,6 +18233,7 @@ __decorate([
|
|
|
18196
18233
|
_this._fogEnd = 300;
|
|
18197
18234
|
_this._fogDensity = 0.01;
|
|
18198
18235
|
_this._fogParams = new engineMath.Vector4();
|
|
18236
|
+
_this._isActive = true;
|
|
18199
18237
|
_this.name = name || "";
|
|
18200
18238
|
var shaderData = _this.shaderData;
|
|
18201
18239
|
shaderData._addReferCount(1);
|
|
@@ -18443,6 +18481,24 @@ __decorate([
|
|
|
18443
18481
|
this._fogParams.w = density / Math.sqrt(Math.LN2);
|
|
18444
18482
|
};
|
|
18445
18483
|
_create_class(Scene, [
|
|
18484
|
+
{
|
|
18485
|
+
key: "isActive",
|
|
18486
|
+
get: /**
|
|
18487
|
+
* Whether the scene is active.
|
|
18488
|
+
*/ function get() {
|
|
18489
|
+
return this._isActive;
|
|
18490
|
+
},
|
|
18491
|
+
set: function set(value) {
|
|
18492
|
+
if (this._isActive !== value) {
|
|
18493
|
+
this._isActive = value;
|
|
18494
|
+
if (value) {
|
|
18495
|
+
this._sceneManager && this._processActive(true);
|
|
18496
|
+
} else {
|
|
18497
|
+
this._sceneManager && this._processActive(false);
|
|
18498
|
+
}
|
|
18499
|
+
}
|
|
18500
|
+
}
|
|
18501
|
+
},
|
|
18446
18502
|
{
|
|
18447
18503
|
key: "shaderData",
|
|
18448
18504
|
get: /**
|
|
@@ -18761,7 +18817,11 @@ __decorate([
|
|
|
18761
18817
|
* @internal
|
|
18762
18818
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
18763
18819
|
Component1.prototype._onDestroy.call(this);
|
|
18764
|
-
this.scene
|
|
18820
|
+
if (this.scene) {
|
|
18821
|
+
this.scene._componentsManager.addPendingDestroyScript(this);
|
|
18822
|
+
} else {
|
|
18823
|
+
this.onDestroy();
|
|
18824
|
+
}
|
|
18765
18825
|
};
|
|
18766
18826
|
return Script;
|
|
18767
18827
|
}(Component);
|
|
@@ -20311,8 +20371,8 @@ var /**
|
|
|
20311
20371
|
};
|
|
20312
20372
|
_proto._drawBackgroundTexture = function _drawBackgroundTexture(engine, background) {
|
|
20313
20373
|
var rhi = engine._hardwareRenderer;
|
|
20314
|
-
var
|
|
20315
|
-
var mesh = background._mesh;
|
|
20374
|
+
var canvas = engine.canvas;
|
|
20375
|
+
var material = background._material, mesh = background._mesh;
|
|
20316
20376
|
if ((this._lastCanvasSize.x !== canvas.width || this._lastCanvasSize.y !== canvas.height) && background._textureFillMode !== exports.BackgroundTextureFillMode.Fill) {
|
|
20317
20377
|
this._lastCanvasSize.set(canvas.width, canvas.height);
|
|
20318
20378
|
background._resizeBackgroundTexture();
|
|
@@ -20487,7 +20547,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
20487
20547
|
// Use the intersection of the near clipping plane as the origin point.
|
|
20488
20548
|
var origin = this._innerViewportToWorldPoint(point.x, point.y, 0.0, invViewProjMat, out.origin);
|
|
20489
20549
|
// Use the intersection of the far clipping plane as the origin point.
|
|
20490
|
-
var direction = this._innerViewportToWorldPoint(point.x, point.y, 1.
|
|
20550
|
+
var direction = this._innerViewportToWorldPoint(point.x, point.y, 1 - engineMath.MathUtil.zeroTolerance, invViewProjMat, out.direction);
|
|
20491
20551
|
engineMath.Vector3.subtract(direction, origin, direction);
|
|
20492
20552
|
direction.normalize();
|
|
20493
20553
|
return out;
|