@galacean/engine-core 1.1.0-beta.3 → 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 +161 -112
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +161 -112
- package/dist/module.js +161 -112
- 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/RenderPipeline/MeshRenderElement.d.ts +3 -1
- package/types/RenderPipeline/SpriteElement.d.ts +3 -1
- package/types/RenderPipeline/SpriteMaskElement.d.ts +3 -1
- package/types/RenderPipeline/TextRenderElement.d.ts +3 -1
- package/types/Scene.d.ts +6 -0
- package/types/lighting/DirectLight.d.ts +8 -1
- package/types/lighting/Light.d.ts +0 -4
- package/types/lighting/LightManager.d.ts +7 -0
- package/types/lighting/PointLight.d.ts +9 -1
- package/types/lighting/SpotLight.d.ts +12 -1
- package/types/particle/modules/MainModule.d.ts +7 -5
- package/types/particle/modules/RotationOverLifetimeModule.d.ts +1 -1
- package/types/particle/modules/TextureSheetAnimationModule.d.ts +0 -4
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);
|
|
@@ -12313,7 +12313,7 @@ var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher1) {
|
|
|
12313
12313
|
_proto.drawBatches = function drawBatches(camera) {
|
|
12314
12314
|
var _this = this, engine = _this._engine, batchedQueue = _this._batchedQueue;
|
|
12315
12315
|
var mesh = this._meshes[this._flushId];
|
|
12316
|
-
var subMeshes = mesh.subMeshes;
|
|
12316
|
+
var subMeshes = mesh.subMeshes, primitive = mesh._primitive;
|
|
12317
12317
|
var sceneData = camera.scene.shaderData;
|
|
12318
12318
|
var cameraData = camera.shaderData;
|
|
12319
12319
|
for(var i = 0, len = subMeshes.length; i < len; i++){
|
|
@@ -12345,7 +12345,7 @@ var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher1) {
|
|
|
12345
12345
|
program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
|
|
12346
12346
|
program.uploadAll(program.materialUniformBlock, material.shaderData);
|
|
12347
12347
|
material.renderState._apply(engine, false, pass._renderStateDataMap, material.shaderData);
|
|
12348
|
-
engine._hardwareRenderer.drawPrimitive(
|
|
12348
|
+
engine._hardwareRenderer.drawPrimitive(primitive, subMesh, program);
|
|
12349
12349
|
}
|
|
12350
12350
|
};
|
|
12351
12351
|
return SpriteMaskBatcher;
|
|
@@ -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
|
},
|
|
@@ -17691,11 +17728,6 @@ ShaderPool.init();
|
|
|
17691
17728
|
]);
|
|
17692
17729
|
return Light;
|
|
17693
17730
|
}(Component);
|
|
17694
|
-
(function() {
|
|
17695
|
-
/**
|
|
17696
|
-
* Each type of light source is at most 10, beyond which it will not take effect.
|
|
17697
|
-
* */ Light._maxLight = 10;
|
|
17698
|
-
})();
|
|
17699
17731
|
__decorate([
|
|
17700
17732
|
ignoreClone
|
|
17701
17733
|
], Light.prototype, "_lightIndex", void 0);
|
|
@@ -17713,13 +17745,12 @@ __decorate([
|
|
|
17713
17745
|
var _proto = DirectLight.prototype;
|
|
17714
17746
|
/**
|
|
17715
17747
|
* @internal
|
|
17716
|
-
*/ _proto._appendData = function _appendData(lightIndex) {
|
|
17748
|
+
*/ _proto._appendData = function _appendData(lightIndex, data) {
|
|
17717
17749
|
var cullingMaskStart = lightIndex * 2;
|
|
17718
17750
|
var colorStart = lightIndex * 3;
|
|
17719
17751
|
var directionStart = lightIndex * 3;
|
|
17720
17752
|
var lightColor = this._getLightIntensityColor();
|
|
17721
17753
|
var direction = this.direction;
|
|
17722
|
-
var data = DirectLight._combinedData;
|
|
17723
17754
|
var cullingMask = this.cullingMask;
|
|
17724
17755
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
17725
17756
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
@@ -17748,8 +17779,7 @@ __decorate([
|
|
|
17748
17779
|
};
|
|
17749
17780
|
/**
|
|
17750
17781
|
* @internal
|
|
17751
|
-
*/ DirectLight._updateShaderData = function _updateShaderData(shaderData) {
|
|
17752
|
-
var data = DirectLight._combinedData;
|
|
17782
|
+
*/ DirectLight._updateShaderData = function _updateShaderData(shaderData, data) {
|
|
17753
17783
|
shaderData.setIntArray(DirectLight._cullingMaskProperty, data.cullingMask);
|
|
17754
17784
|
shaderData.setFloatArray(DirectLight._colorProperty, data.color);
|
|
17755
17785
|
shaderData.setFloatArray(DirectLight._directionProperty, data.direction);
|
|
@@ -17792,13 +17822,6 @@ __decorate([
|
|
|
17792
17822
|
(function() {
|
|
17793
17823
|
DirectLight._directionProperty = ShaderProperty.getByName("scene_DirectLightDirection");
|
|
17794
17824
|
})();
|
|
17795
|
-
(function() {
|
|
17796
|
-
DirectLight._combinedData = {
|
|
17797
|
-
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
17798
|
-
color: new Float32Array(Light._maxLight * 3),
|
|
17799
|
-
direction: new Float32Array(Light._maxLight * 3)
|
|
17800
|
-
};
|
|
17801
|
-
})();
|
|
17802
17825
|
|
|
17803
17826
|
/**
|
|
17804
17827
|
* Point light.
|
|
@@ -17813,14 +17836,13 @@ __decorate([
|
|
|
17813
17836
|
var _proto = PointLight.prototype;
|
|
17814
17837
|
/**
|
|
17815
17838
|
* @internal
|
|
17816
|
-
*/ _proto._appendData = function _appendData(lightIndex) {
|
|
17839
|
+
*/ _proto._appendData = function _appendData(lightIndex, data) {
|
|
17817
17840
|
var cullingMaskStart = lightIndex * 2;
|
|
17818
17841
|
var colorStart = lightIndex * 3;
|
|
17819
17842
|
var positionStart = lightIndex * 3;
|
|
17820
17843
|
var distanceStart = lightIndex;
|
|
17821
17844
|
var lightColor = this._getLightIntensityColor();
|
|
17822
17845
|
var lightPosition = this.position;
|
|
17823
|
-
var data = PointLight._combinedData;
|
|
17824
17846
|
var cullingMask = this.cullingMask;
|
|
17825
17847
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
17826
17848
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
@@ -17850,8 +17872,7 @@ __decorate([
|
|
|
17850
17872
|
};
|
|
17851
17873
|
/**
|
|
17852
17874
|
* @internal
|
|
17853
|
-
*/ PointLight._updateShaderData = function _updateShaderData(shaderData) {
|
|
17854
|
-
var data = PointLight._combinedData;
|
|
17875
|
+
*/ PointLight._updateShaderData = function _updateShaderData(shaderData, data) {
|
|
17855
17876
|
shaderData.setIntArray(PointLight._cullingMaskProperty, data.cullingMask);
|
|
17856
17877
|
shaderData.setFloatArray(PointLight._colorProperty, data.color);
|
|
17857
17878
|
shaderData.setFloatArray(PointLight._positionProperty, data.position);
|
|
@@ -17889,14 +17910,6 @@ __decorate([
|
|
|
17889
17910
|
(function() {
|
|
17890
17911
|
PointLight._distanceProperty = ShaderProperty.getByName("scene_PointLightDistance");
|
|
17891
17912
|
})();
|
|
17892
|
-
(function() {
|
|
17893
|
-
PointLight._combinedData = {
|
|
17894
|
-
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
17895
|
-
color: new Float32Array(Light._maxLight * 3),
|
|
17896
|
-
position: new Float32Array(Light._maxLight * 3),
|
|
17897
|
-
distance: new Float32Array(Light._maxLight)
|
|
17898
|
-
};
|
|
17899
|
-
})();
|
|
17900
17913
|
|
|
17901
17914
|
/**
|
|
17902
17915
|
* Spot light.
|
|
@@ -17915,7 +17928,7 @@ __decorate([
|
|
|
17915
17928
|
var _proto = SpotLight.prototype;
|
|
17916
17929
|
/**
|
|
17917
17930
|
* @internal
|
|
17918
|
-
*/ _proto._appendData = function _appendData(lightIndex) {
|
|
17931
|
+
*/ _proto._appendData = function _appendData(lightIndex, data) {
|
|
17919
17932
|
var cullingMaskStart = lightIndex * 2;
|
|
17920
17933
|
var colorStart = lightIndex * 3;
|
|
17921
17934
|
var positionStart = lightIndex * 3;
|
|
@@ -17926,7 +17939,6 @@ __decorate([
|
|
|
17926
17939
|
var lightColor = this._getLightIntensityColor();
|
|
17927
17940
|
var position = this.position;
|
|
17928
17941
|
var direction = this.direction;
|
|
17929
|
-
var data = SpotLight._combinedData;
|
|
17930
17942
|
var cullingMask = this.cullingMask;
|
|
17931
17943
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
17932
17944
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
@@ -17961,8 +17973,7 @@ __decorate([
|
|
|
17961
17973
|
};
|
|
17962
17974
|
/**
|
|
17963
17975
|
* @internal
|
|
17964
|
-
*/ SpotLight._updateShaderData = function _updateShaderData(shaderData) {
|
|
17965
|
-
var data = SpotLight._combinedData;
|
|
17976
|
+
*/ SpotLight._updateShaderData = function _updateShaderData(shaderData, data) {
|
|
17966
17977
|
shaderData.setIntArray(SpotLight._cullingMaskProperty, data.cullingMask);
|
|
17967
17978
|
shaderData.setFloatArray(SpotLight._colorProperty, data.color);
|
|
17968
17979
|
shaderData.setFloatArray(SpotLight._positionProperty, data.position);
|
|
@@ -18032,17 +18043,6 @@ __decorate([
|
|
|
18032
18043
|
(function() {
|
|
18033
18044
|
SpotLight._penumbraCosProperty = ShaderProperty.getByName("scene_SpotLightPenumbraCos");
|
|
18034
18045
|
})();
|
|
18035
|
-
(function() {
|
|
18036
|
-
SpotLight._combinedData = {
|
|
18037
|
-
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
18038
|
-
color: new Float32Array(Light._maxLight * 3),
|
|
18039
|
-
position: new Float32Array(Light._maxLight * 3),
|
|
18040
|
-
direction: new Float32Array(Light._maxLight * 3),
|
|
18041
|
-
distance: new Float32Array(Light._maxLight),
|
|
18042
|
-
angleCos: new Float32Array(Light._maxLight),
|
|
18043
|
-
penumbraCos: new Float32Array(Light._maxLight)
|
|
18044
|
-
};
|
|
18045
|
-
})();
|
|
18046
18046
|
|
|
18047
18047
|
/**
|
|
18048
18048
|
* Light manager.
|
|
@@ -18051,6 +18051,26 @@ __decorate([
|
|
|
18051
18051
|
/** @internal */ this._spotLights = new DisorderedArray();
|
|
18052
18052
|
/** @internal */ this._pointLights = new DisorderedArray();
|
|
18053
18053
|
/** @internal */ this._directLights = new DisorderedArray();
|
|
18054
|
+
this._directData = {
|
|
18055
|
+
cullingMask: new Int32Array(LightManager._maxLight * 2),
|
|
18056
|
+
color: new Float32Array(LightManager._maxLight * 3),
|
|
18057
|
+
direction: new Float32Array(LightManager._maxLight * 3)
|
|
18058
|
+
};
|
|
18059
|
+
this._pointData = {
|
|
18060
|
+
cullingMask: new Int32Array(LightManager._maxLight * 2),
|
|
18061
|
+
color: new Float32Array(LightManager._maxLight * 3),
|
|
18062
|
+
position: new Float32Array(LightManager._maxLight * 3),
|
|
18063
|
+
distance: new Float32Array(LightManager._maxLight)
|
|
18064
|
+
};
|
|
18065
|
+
this._spotData = {
|
|
18066
|
+
cullingMask: new Int32Array(LightManager._maxLight * 2),
|
|
18067
|
+
color: new Float32Array(LightManager._maxLight * 3),
|
|
18068
|
+
position: new Float32Array(LightManager._maxLight * 3),
|
|
18069
|
+
direction: new Float32Array(LightManager._maxLight * 3),
|
|
18070
|
+
distance: new Float32Array(LightManager._maxLight),
|
|
18071
|
+
angleCos: new Float32Array(LightManager._maxLight),
|
|
18072
|
+
penumbraCos: new Float32Array(LightManager._maxLight)
|
|
18073
|
+
};
|
|
18054
18074
|
}
|
|
18055
18075
|
var _proto = LightManager.prototype;
|
|
18056
18076
|
/**
|
|
@@ -18110,38 +18130,34 @@ __decorate([
|
|
|
18110
18130
|
/**
|
|
18111
18131
|
* @internal
|
|
18112
18132
|
*/ _proto._updateShaderData = function _updateShaderData(shaderData) {
|
|
18113
|
-
var spotLight =
|
|
18114
|
-
var
|
|
18115
|
-
var directLight = this._directLights;
|
|
18133
|
+
var _this = this, spotLight = _this._spotLights, pointLight = _this._pointLights, directLight = _this._directLights;
|
|
18134
|
+
var _this1 = this, spotData = _this1._spotData, pointData = _this1._pointData, directData = _this1._directData;
|
|
18116
18135
|
var spotLightCount = spotLight.length;
|
|
18117
18136
|
var pointLightCount = pointLight.length;
|
|
18118
18137
|
var directLightCount = directLight.length;
|
|
18119
|
-
for(var i = 0
|
|
18120
|
-
|
|
18121
|
-
light._appendData(i);
|
|
18138
|
+
for(var i = 0; i < spotLightCount; i++){
|
|
18139
|
+
spotLight.get(i)._appendData(i, spotData);
|
|
18122
18140
|
}
|
|
18123
|
-
for(var i1 = 0
|
|
18124
|
-
|
|
18125
|
-
light1._appendData(i1);
|
|
18141
|
+
for(var i1 = 0; i1 < pointLightCount; i1++){
|
|
18142
|
+
pointLight.get(i1)._appendData(i1, pointData);
|
|
18126
18143
|
}
|
|
18127
|
-
for(var i2 = 0
|
|
18128
|
-
|
|
18129
|
-
light2._appendData(i2);
|
|
18144
|
+
for(var i2 = 0; i2 < directLightCount; i2++){
|
|
18145
|
+
directLight.get(i2)._appendData(i2, directData);
|
|
18130
18146
|
}
|
|
18131
18147
|
if (directLightCount) {
|
|
18132
|
-
DirectLight._updateShaderData(shaderData);
|
|
18148
|
+
DirectLight._updateShaderData(shaderData, directData);
|
|
18133
18149
|
shaderData.enableMacro("SCENE_DIRECT_LIGHT_COUNT", directLightCount.toString());
|
|
18134
18150
|
} else {
|
|
18135
18151
|
shaderData.disableMacro("SCENE_DIRECT_LIGHT_COUNT");
|
|
18136
18152
|
}
|
|
18137
18153
|
if (pointLightCount) {
|
|
18138
|
-
PointLight._updateShaderData(shaderData);
|
|
18154
|
+
PointLight._updateShaderData(shaderData, pointData);
|
|
18139
18155
|
shaderData.enableMacro("SCENE_POINT_LIGHT_COUNT", pointLightCount.toString());
|
|
18140
18156
|
} else {
|
|
18141
18157
|
shaderData.disableMacro("SCENE_POINT_LIGHT_COUNT");
|
|
18142
18158
|
}
|
|
18143
18159
|
if (spotLightCount) {
|
|
18144
|
-
SpotLight._updateShaderData(shaderData);
|
|
18160
|
+
SpotLight._updateShaderData(shaderData, spotData);
|
|
18145
18161
|
shaderData.enableMacro("SCENE_SPOT_LIGHT_COUNT", spotLightCount.toString());
|
|
18146
18162
|
} else {
|
|
18147
18163
|
shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
|
|
@@ -18182,6 +18198,11 @@ __decorate([
|
|
|
18182
18198
|
};
|
|
18183
18199
|
return LightManager;
|
|
18184
18200
|
}();
|
|
18201
|
+
(function() {
|
|
18202
|
+
/**
|
|
18203
|
+
* Each type of light source is at most 10, beyond which it will not take effect.
|
|
18204
|
+
* */ LightManager._maxLight = 10;
|
|
18205
|
+
})();
|
|
18185
18206
|
|
|
18186
18207
|
/**
|
|
18187
18208
|
* Scene.
|
|
@@ -18212,6 +18233,7 @@ __decorate([
|
|
|
18212
18233
|
_this._fogEnd = 300;
|
|
18213
18234
|
_this._fogDensity = 0.01;
|
|
18214
18235
|
_this._fogParams = new engineMath.Vector4();
|
|
18236
|
+
_this._isActive = true;
|
|
18215
18237
|
_this.name = name || "";
|
|
18216
18238
|
var shaderData = _this.shaderData;
|
|
18217
18239
|
shaderData._addReferCount(1);
|
|
@@ -18459,6 +18481,24 @@ __decorate([
|
|
|
18459
18481
|
this._fogParams.w = density / Math.sqrt(Math.LN2);
|
|
18460
18482
|
};
|
|
18461
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
|
+
},
|
|
18462
18502
|
{
|
|
18463
18503
|
key: "shaderData",
|
|
18464
18504
|
get: /**
|
|
@@ -18777,7 +18817,11 @@ __decorate([
|
|
|
18777
18817
|
* @internal
|
|
18778
18818
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
18779
18819
|
Component1.prototype._onDestroy.call(this);
|
|
18780
|
-
this.scene
|
|
18820
|
+
if (this.scene) {
|
|
18821
|
+
this.scene._componentsManager.addPendingDestroyScript(this);
|
|
18822
|
+
} else {
|
|
18823
|
+
this.onDestroy();
|
|
18824
|
+
}
|
|
18781
18825
|
};
|
|
18782
18826
|
return Script;
|
|
18783
18827
|
}(Component);
|
|
@@ -18920,7 +18964,7 @@ var passNum = 0;
|
|
|
18920
18964
|
_proto.drawBatches = function drawBatches(camera) {
|
|
18921
18965
|
var _this = this, engine = _this._engine, batchedQueue = _this._batchedQueue;
|
|
18922
18966
|
var mesh = this._meshes[this._flushId];
|
|
18923
|
-
var subMeshes = mesh.subMeshes;
|
|
18967
|
+
var subMeshes = mesh.subMeshes, primitive = mesh._primitive;
|
|
18924
18968
|
var maskManager = engine._spriteMaskManager;
|
|
18925
18969
|
var sceneData = camera.scene.shaderData;
|
|
18926
18970
|
var cameraData = camera.shaderData;
|
|
@@ -18950,7 +18994,7 @@ var passNum = 0;
|
|
|
18950
18994
|
program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
|
|
18951
18995
|
program.uploadAll(program.materialUniformBlock, material.shaderData);
|
|
18952
18996
|
material.renderState._apply(engine, false, shaderPass._renderStateDataMap, material.shaderData);
|
|
18953
|
-
engine._hardwareRenderer.drawPrimitive(
|
|
18997
|
+
engine._hardwareRenderer.drawPrimitive(primitive, subMesh, program);
|
|
18954
18998
|
maskManager.postRender(renderer);
|
|
18955
18999
|
}
|
|
18956
19000
|
};
|
|
@@ -20327,8 +20371,8 @@ var /**
|
|
|
20327
20371
|
};
|
|
20328
20372
|
_proto._drawBackgroundTexture = function _drawBackgroundTexture(engine, background) {
|
|
20329
20373
|
var rhi = engine._hardwareRenderer;
|
|
20330
|
-
var
|
|
20331
|
-
var mesh = background._mesh;
|
|
20374
|
+
var canvas = engine.canvas;
|
|
20375
|
+
var material = background._material, mesh = background._mesh;
|
|
20332
20376
|
if ((this._lastCanvasSize.x !== canvas.width || this._lastCanvasSize.y !== canvas.height) && background._textureFillMode !== exports.BackgroundTextureFillMode.Fill) {
|
|
20333
20377
|
this._lastCanvasSize.set(canvas.width, canvas.height);
|
|
20334
20378
|
background._resizeBackgroundTexture();
|
|
@@ -20503,7 +20547,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
20503
20547
|
// Use the intersection of the near clipping plane as the origin point.
|
|
20504
20548
|
var origin = this._innerViewportToWorldPoint(point.x, point.y, 0.0, invViewProjMat, out.origin);
|
|
20505
20549
|
// Use the intersection of the far clipping plane as the origin point.
|
|
20506
|
-
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);
|
|
20507
20551
|
engineMath.Vector3.subtract(direction, origin, direction);
|
|
20508
20552
|
direction.normalize();
|
|
20509
20553
|
return out;
|
|
@@ -24307,16 +24351,22 @@ AnimationCurveOwner.registerAssembler(Transform, "scale", ScaleAnimationCurveOwn
|
|
|
24307
24351
|
/**
|
|
24308
24352
|
* @internal
|
|
24309
24353
|
*/ var BlendShapeWeightsAnimationCurveOwnerAssembler = /*#__PURE__*/ function() {
|
|
24310
|
-
function BlendShapeWeightsAnimationCurveOwnerAssembler() {
|
|
24354
|
+
function BlendShapeWeightsAnimationCurveOwnerAssembler() {
|
|
24355
|
+
this._skinnedMeshRenderer = [];
|
|
24356
|
+
}
|
|
24311
24357
|
var _proto = BlendShapeWeightsAnimationCurveOwnerAssembler.prototype;
|
|
24312
24358
|
_proto.initialize = function initialize(owner) {
|
|
24313
|
-
|
|
24359
|
+
// @todo: Compatible with multiple SkinnedMeshRenderer in a entity, optimize later.
|
|
24360
|
+
owner.target.getComponents(SkinnedMeshRenderer, this._skinnedMeshRenderer);
|
|
24314
24361
|
};
|
|
24315
24362
|
_proto.getTargetValue = function getTargetValue() {
|
|
24316
|
-
return this._skinnedMeshRenderer.blendShapeWeights;
|
|
24363
|
+
return this._skinnedMeshRenderer[0].blendShapeWeights;
|
|
24317
24364
|
};
|
|
24318
24365
|
_proto.setTargetValue = function setTargetValue(value) {
|
|
24319
|
-
this._skinnedMeshRenderer
|
|
24366
|
+
var skinnedMeshRenderer = this._skinnedMeshRenderer;
|
|
24367
|
+
for(var i = 0, n = skinnedMeshRenderer.length; i < n; i++){
|
|
24368
|
+
skinnedMeshRenderer[i].blendShapeWeights = value;
|
|
24369
|
+
}
|
|
24320
24370
|
};
|
|
24321
24371
|
return BlendShapeWeightsAnimationCurveOwnerAssembler;
|
|
24322
24372
|
}();
|
|
@@ -27713,15 +27763,13 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
27713
27763
|
/** The initial lifetime of particles when emitted. */ this.startLifetime = new ParticleCompositeCurve(5);
|
|
27714
27764
|
/** The initial speed of particles when the Particle Generator first spawns them. */ this.startSpeed = new ParticleCompositeCurve(5);
|
|
27715
27765
|
/** A flag to enable specifying particle size individually for each axis. */ this.startSize3D = false;
|
|
27716
|
-
/** The initial size of particles when the Particle Generator first spawns them. */ this.startSize = new ParticleCompositeCurve(1);
|
|
27717
27766
|
/** The initial size of particles along the x-axis when the Particle Generator first spawns them. */ this.startSizeX = new ParticleCompositeCurve(1);
|
|
27718
27767
|
/** The initial size of particles along the y-axis when the Particle Generator first spawns them. */ this.startSizeY = new ParticleCompositeCurve(1);
|
|
27719
27768
|
/** The initial size of particles along the z-axis when the Particle Generator first spawns them. */ this.startSizeZ = new ParticleCompositeCurve(1);
|
|
27720
|
-
/** A flag to enable 3D particle rotation. */ this.startRotation3D = false;
|
|
27721
|
-
/** The initial rotation of particles when the Particle Generator first spawns them. */ this.startRotation = new ParticleCompositeCurve(0);
|
|
27769
|
+
/** A flag to enable 3D particle rotation, when disabled, only `startRotationZ` is used. */ this.startRotation3D = false;
|
|
27722
27770
|
/** The initial rotation of particles around the x-axis when emitted.*/ this.startRotationX = new ParticleCompositeCurve(0);
|
|
27723
27771
|
/** The initial rotation of particles around the y-axis when emitted. */ this.startRotationY = new ParticleCompositeCurve(0);
|
|
27724
|
-
this.startRotationZ = new ParticleCompositeCurve(0);
|
|
27772
|
+
/** The initial rotation of particles around the z-axis when emitted. */ this.startRotationZ = new ParticleCompositeCurve(0);
|
|
27725
27773
|
/** Makes some particles spin in the opposite direction. */ this.flipRotation = 0;
|
|
27726
27774
|
/** The mode of start color */ this.startColor = new ParticleCompositeGradient(new engineMath.Color(1, 1, 1, 1));
|
|
27727
27775
|
/** A scale that this Particle Generator applies to gravity, defined by Physics.gravity. */ this.gravityModifier = new ParticleCompositeCurve(0);
|
|
@@ -27824,6 +27872,17 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
27824
27872
|
}
|
|
27825
27873
|
}
|
|
27826
27874
|
}
|
|
27875
|
+
},
|
|
27876
|
+
{
|
|
27877
|
+
key: "startSize",
|
|
27878
|
+
get: /**
|
|
27879
|
+
* The initial size of particles when the Particle Generator first spawns them.
|
|
27880
|
+
*/ function get() {
|
|
27881
|
+
return this.startSizeX;
|
|
27882
|
+
},
|
|
27883
|
+
set: function set(value) {
|
|
27884
|
+
this.startSizeX = value;
|
|
27885
|
+
}
|
|
27827
27886
|
}
|
|
27828
27887
|
]);
|
|
27829
27888
|
return MainModule;
|
|
@@ -27867,9 +27926,6 @@ __decorate([
|
|
|
27867
27926
|
__decorate([
|
|
27868
27927
|
deepClone
|
|
27869
27928
|
], MainModule.prototype, "startSpeed", void 0);
|
|
27870
|
-
__decorate([
|
|
27871
|
-
deepClone
|
|
27872
|
-
], MainModule.prototype, "startSize", void 0);
|
|
27873
27929
|
__decorate([
|
|
27874
27930
|
deepClone
|
|
27875
27931
|
], MainModule.prototype, "startSizeX", void 0);
|
|
@@ -27879,9 +27935,6 @@ __decorate([
|
|
|
27879
27935
|
__decorate([
|
|
27880
27936
|
deepClone
|
|
27881
27937
|
], MainModule.prototype, "startSizeZ", void 0);
|
|
27882
|
-
__decorate([
|
|
27883
|
-
deepClone
|
|
27884
|
-
], MainModule.prototype, "startRotation", void 0);
|
|
27885
27938
|
__decorate([
|
|
27886
27939
|
deepClone
|
|
27887
27940
|
], MainModule.prototype, "startRotationX", void 0);
|
|
@@ -27889,7 +27942,6 @@ __decorate([
|
|
|
27889
27942
|
deepClone
|
|
27890
27943
|
], MainModule.prototype, "startRotationY", void 0);
|
|
27891
27944
|
__decorate([
|
|
27892
|
-
deepClone,
|
|
27893
27945
|
deepClone
|
|
27894
27946
|
], MainModule.prototype, "startRotationZ", void 0);
|
|
27895
27947
|
__decorate([
|
|
@@ -27930,7 +27982,7 @@ __decorate([
|
|
|
27930
27982
|
function RotationOverLifetimeModule() {
|
|
27931
27983
|
var _this;
|
|
27932
27984
|
_this = ParticleGeneratorModule1.apply(this, arguments) || this;
|
|
27933
|
-
/** Specifies whether the rotation is separate on each axis, when disabled only
|
|
27985
|
+
/** Specifies whether the rotation is separate on each axis, when disabled, only `rotationZ` is used. */ _this.separateAxes = false;
|
|
27934
27986
|
/** Rotation over lifetime for z axis. */ _this.rotationX = new ParticleCompositeCurve(0);
|
|
27935
27987
|
/** Rotation over lifetime for z axis. */ _this.rotationY = new ParticleCompositeCurve(0);
|
|
27936
27988
|
/** Rotation over lifetime for z axis. */ _this.rotationZ = new ParticleCompositeCurve(45);
|
|
@@ -28284,9 +28336,6 @@ __decorate([
|
|
|
28284
28336
|
}
|
|
28285
28337
|
var _proto = TextureSheetAnimationModule.prototype;
|
|
28286
28338
|
/**
|
|
28287
|
-
* @inheritDoc
|
|
28288
|
-
*/ _proto.cloneTo = function cloneTo(dest) {};
|
|
28289
|
-
/**
|
|
28290
28339
|
* @internal
|
|
28291
28340
|
*/ _proto._updateShaderData = function _updateShaderData(shaderData) {
|
|
28292
28341
|
var frameMacro = null;
|
|
@@ -28774,7 +28823,7 @@ __decorate([
|
|
|
28774
28823
|
instanceVertices[offset + 16] = engineMath.MathUtil.degreeToRadian(main.startRotationY.evaluate(undefined, startRotationRand.random()));
|
|
28775
28824
|
instanceVertices[offset + 17] = engineMath.MathUtil.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
|
|
28776
28825
|
} else {
|
|
28777
|
-
instanceVertices[offset + 15] = engineMath.MathUtil.degreeToRadian(main.
|
|
28826
|
+
instanceVertices[offset + 15] = engineMath.MathUtil.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
|
|
28778
28827
|
}
|
|
28779
28828
|
// Start speed
|
|
28780
28829
|
instanceVertices[offset + 18] = startSpeed;
|