@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/module.js
CHANGED
|
@@ -2537,8 +2537,8 @@ var ActiveChangeFlag;
|
|
|
2537
2537
|
var _this;
|
|
2538
2538
|
_this = EngineObject1.call(this, entity.engine) || this;
|
|
2539
2539
|
/** @internal */ _this._awoken = false;
|
|
2540
|
-
_this._phasedActive = false;
|
|
2541
2540
|
_this._phasedActiveInScene = false;
|
|
2541
|
+
_this._phasedActive = false;
|
|
2542
2542
|
_this._enabled = true;
|
|
2543
2543
|
_this._entity = entity;
|
|
2544
2544
|
return _this;
|
|
@@ -2670,10 +2670,10 @@ __decorate([
|
|
|
2670
2670
|
], Component.prototype, "_awoken", void 0);
|
|
2671
2671
|
__decorate([
|
|
2672
2672
|
ignoreClone
|
|
2673
|
-
], Component.prototype, "
|
|
2673
|
+
], Component.prototype, "_phasedActiveInScene", void 0);
|
|
2674
2674
|
__decorate([
|
|
2675
2675
|
ignoreClone
|
|
2676
|
-
], Component.prototype, "
|
|
2676
|
+
], Component.prototype, "_phasedActive", void 0);
|
|
2677
2677
|
__decorate([
|
|
2678
2678
|
assignmentClone
|
|
2679
2679
|
], Component.prototype, "_enabled", void 0);
|
|
@@ -12309,7 +12309,7 @@ var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher1) {
|
|
|
12309
12309
|
_proto.drawBatches = function drawBatches(camera) {
|
|
12310
12310
|
var _this = this, engine = _this._engine, batchedQueue = _this._batchedQueue;
|
|
12311
12311
|
var mesh = this._meshes[this._flushId];
|
|
12312
|
-
var subMeshes = mesh.subMeshes;
|
|
12312
|
+
var subMeshes = mesh.subMeshes, primitive = mesh._primitive;
|
|
12313
12313
|
var sceneData = camera.scene.shaderData;
|
|
12314
12314
|
var cameraData = camera.shaderData;
|
|
12315
12315
|
for(var i = 0, len = subMeshes.length; i < len; i++){
|
|
@@ -12341,7 +12341,7 @@ var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher1) {
|
|
|
12341
12341
|
program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
|
|
12342
12342
|
program.uploadAll(program.materialUniformBlock, material.shaderData);
|
|
12343
12343
|
material.renderState._apply(engine, false, pass._renderStateDataMap, material.shaderData);
|
|
12344
|
-
engine._hardwareRenderer.drawPrimitive(
|
|
12344
|
+
engine._hardwareRenderer.drawPrimitive(primitive, subMesh, program);
|
|
12345
12345
|
}
|
|
12346
12346
|
};
|
|
12347
12347
|
return SpriteMaskBatcher;
|
|
@@ -12587,16 +12587,31 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
12587
12587
|
}
|
|
12588
12588
|
var _proto = SceneManager.prototype;
|
|
12589
12589
|
_proto.addScene = function addScene(indexOrScene, scene) {
|
|
12590
|
+
var scenes = this._scenes;
|
|
12591
|
+
var index;
|
|
12590
12592
|
if (typeof indexOrScene === "number") {
|
|
12591
|
-
|
|
12593
|
+
if (indexOrScene < 0 || indexOrScene > scenes.length) {
|
|
12594
|
+
throw "The index is out of range.";
|
|
12595
|
+
}
|
|
12596
|
+
index = indexOrScene;
|
|
12592
12597
|
} else {
|
|
12598
|
+
index = scenes.length;
|
|
12593
12599
|
scene = indexOrScene;
|
|
12594
|
-
this._scenes.push(scene);
|
|
12595
12600
|
}
|
|
12596
12601
|
if (scene.engine !== this.engine) {
|
|
12597
12602
|
throw "The scene is not belong to this engine.";
|
|
12598
12603
|
}
|
|
12599
|
-
scene.
|
|
12604
|
+
if (scene._sceneManager) {
|
|
12605
|
+
var currentIndex = scenes.indexOf(scene);
|
|
12606
|
+
if (currentIndex !== index) {
|
|
12607
|
+
scenes.removeByIndex(currentIndex);
|
|
12608
|
+
scenes.add(index, scene);
|
|
12609
|
+
}
|
|
12610
|
+
} else {
|
|
12611
|
+
scene._sceneManager = this;
|
|
12612
|
+
scenes.add(index, scene);
|
|
12613
|
+
scene.isActive && scene._processActive(true);
|
|
12614
|
+
}
|
|
12600
12615
|
};
|
|
12601
12616
|
/**
|
|
12602
12617
|
* Remove scene.
|
|
@@ -12607,7 +12622,8 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
12607
12622
|
if (index !== -1) {
|
|
12608
12623
|
var removedScene = scenes.getArray()[index];
|
|
12609
12624
|
scenes.removeByIndex(index);
|
|
12610
|
-
|
|
12625
|
+
scene._sceneManager = null;
|
|
12626
|
+
removedScene.isActive && removedScene._processActive(false);
|
|
12611
12627
|
}
|
|
12612
12628
|
};
|
|
12613
12629
|
/**
|
|
@@ -13811,9 +13827,9 @@ var Collider = /*#__PURE__*/ function(Component1) {
|
|
|
13811
13827
|
oldCollider.removeShape(shape);
|
|
13812
13828
|
}
|
|
13813
13829
|
this._shapes.push(shape);
|
|
13814
|
-
this.scene.physics._addColliderShape(shape);
|
|
13815
13830
|
shape._collider = this;
|
|
13816
13831
|
this._nativeCollider.addShape(shape._nativeShape);
|
|
13832
|
+
this._phasedActiveInScene && this.scene.physics._addColliderShape(shape);
|
|
13817
13833
|
}
|
|
13818
13834
|
};
|
|
13819
13835
|
/**
|
|
@@ -13823,7 +13839,7 @@ var Collider = /*#__PURE__*/ function(Component1) {
|
|
|
13823
13839
|
var index = this._shapes.indexOf(shape);
|
|
13824
13840
|
if (index !== -1) {
|
|
13825
13841
|
this._shapes.splice(index, 1);
|
|
13826
|
-
this.scene.physics._removeColliderShape(shape);
|
|
13842
|
+
this._phasedActiveInScene && this.scene.physics._removeColliderShape(shape);
|
|
13827
13843
|
shape._collider = null;
|
|
13828
13844
|
this._nativeCollider.removeShape(shape._nativeShape);
|
|
13829
13845
|
}
|
|
@@ -13834,7 +13850,7 @@ var Collider = /*#__PURE__*/ function(Component1) {
|
|
|
13834
13850
|
var shapes = this._shapes;
|
|
13835
13851
|
for(var i = 0, n = shapes.length; i < n; i++){
|
|
13836
13852
|
var shape = shapes[i];
|
|
13837
|
-
this.scene.physics._removeColliderShape(shape);
|
|
13853
|
+
this._phasedActiveInScene && this.scene.physics._removeColliderShape(shape);
|
|
13838
13854
|
shape._destroy();
|
|
13839
13855
|
this._nativeCollider.removeShape(shape._nativeShape);
|
|
13840
13856
|
}
|
|
@@ -13859,12 +13875,22 @@ var Collider = /*#__PURE__*/ function(Component1) {
|
|
|
13859
13875
|
/**
|
|
13860
13876
|
* @internal
|
|
13861
13877
|
*/ _proto._onEnableInScene = function _onEnableInScene() {
|
|
13862
|
-
this.scene.physics
|
|
13878
|
+
var physics = this.scene.physics;
|
|
13879
|
+
physics._addCollider(this);
|
|
13880
|
+
var shapes = this.shapes;
|
|
13881
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
13882
|
+
physics._addColliderShape(shapes[i]);
|
|
13883
|
+
}
|
|
13863
13884
|
};
|
|
13864
13885
|
/**
|
|
13865
13886
|
* @internal
|
|
13866
13887
|
*/ _proto._onDisableInScene = function _onDisableInScene() {
|
|
13867
|
-
this.scene.physics
|
|
13888
|
+
var physics = this.scene.physics;
|
|
13889
|
+
physics._removeCollider(this);
|
|
13890
|
+
var shapes = this.shapes;
|
|
13891
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
13892
|
+
physics._removeColliderShape(shapes[i]);
|
|
13893
|
+
}
|
|
13868
13894
|
};
|
|
13869
13895
|
/**
|
|
13870
13896
|
* @internal
|
|
@@ -14242,12 +14268,22 @@ var Collision = function Collision() {
|
|
|
14242
14268
|
/**
|
|
14243
14269
|
* @internal
|
|
14244
14270
|
*/ _proto._onEnableInScene = function _onEnableInScene() {
|
|
14245
|
-
this.scene.physics
|
|
14271
|
+
var physics = this.scene.physics;
|
|
14272
|
+
physics._addCharacterController(this);
|
|
14273
|
+
var shapes = this.shapes;
|
|
14274
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
14275
|
+
physics._addColliderShape(shapes[i]);
|
|
14276
|
+
}
|
|
14246
14277
|
};
|
|
14247
14278
|
/**
|
|
14248
14279
|
* @internal
|
|
14249
14280
|
*/ _proto._onDisableInScene = function _onDisableInScene() {
|
|
14250
|
-
this.scene.physics
|
|
14281
|
+
var physics = this.scene.physics;
|
|
14282
|
+
physics._removeCharacterController(this);
|
|
14283
|
+
var shapes = this.shapes;
|
|
14284
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
14285
|
+
physics._removeColliderShape(shapes[i]);
|
|
14286
|
+
}
|
|
14251
14287
|
};
|
|
14252
14288
|
_proto._setUpDirection = function _setUpDirection() {
|
|
14253
14289
|
this._nativeCollider.setUpDirection(this._upDirection);
|
|
@@ -16399,10 +16435,6 @@ ShaderPool.init();
|
|
|
16399
16435
|
magentaMaterial.isGCIgnored = true;
|
|
16400
16436
|
magentaMaterial.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
|
|
16401
16437
|
_this._magentaMaterial = magentaMaterial;
|
|
16402
|
-
var backgroundTextureMaterial = new Material(_assert_this_initialized(_this), Shader.find("background-texture"));
|
|
16403
|
-
backgroundTextureMaterial.isGCIgnored = true;
|
|
16404
|
-
backgroundTextureMaterial.renderState.depthState.compareFunction = CompareFunction.LessEqual;
|
|
16405
|
-
_this._backgroundTextureMaterial = backgroundTextureMaterial;
|
|
16406
16438
|
var innerSettings = _this._settings;
|
|
16407
16439
|
var colorSpace = configuration.colorSpace || ColorSpace.Linear;
|
|
16408
16440
|
colorSpace === ColorSpace.Gamma && _this._macroCollection.enable(Engine._gammaMacro);
|
|
@@ -17020,6 +17052,7 @@ ShaderPool.init();
|
|
|
17020
17052
|
this./** @internal */ _textureFillMode = BackgroundTextureFillMode.AspectFitHeight;
|
|
17021
17053
|
this._texture = null;
|
|
17022
17054
|
this._initMesh(_engine);
|
|
17055
|
+
this._initMaterial(_engine);
|
|
17023
17056
|
}
|
|
17024
17057
|
var _proto = Background.prototype;
|
|
17025
17058
|
/**
|
|
@@ -17027,19 +17060,14 @@ ShaderPool.init();
|
|
|
17027
17060
|
*/ _proto.destroy = function destroy() {
|
|
17028
17061
|
this._mesh._addReferCount(-1);
|
|
17029
17062
|
this._mesh = null;
|
|
17063
|
+
this._material._addReferCount(-1);
|
|
17064
|
+
this._material = null;
|
|
17030
17065
|
this.texture = null;
|
|
17031
17066
|
this.solidColor = null;
|
|
17032
17067
|
this.sky.destroy();
|
|
17033
17068
|
};
|
|
17034
17069
|
/**
|
|
17035
17070
|
* @internal
|
|
17036
|
-
* Standalone for CanvasRenderer plugin.
|
|
17037
|
-
*/ _proto._initMesh = function _initMesh(engine) {
|
|
17038
|
-
this._mesh = this._createPlane(engine);
|
|
17039
|
-
this._mesh._addReferCount(1);
|
|
17040
|
-
};
|
|
17041
|
-
/**
|
|
17042
|
-
* @internal
|
|
17043
17071
|
*/ _proto._resizeBackgroundTexture = function _resizeBackgroundTexture() {
|
|
17044
17072
|
if (!this._texture) {
|
|
17045
17073
|
return;
|
|
@@ -17073,6 +17101,15 @@ ShaderPool.init();
|
|
|
17073
17101
|
_backgroundTextureMesh.setPositions(positions);
|
|
17074
17102
|
_backgroundTextureMesh.uploadData(false);
|
|
17075
17103
|
};
|
|
17104
|
+
_proto._initMesh = function _initMesh(engine) {
|
|
17105
|
+
this._mesh = this._createPlane(engine);
|
|
17106
|
+
this._mesh._addReferCount(1);
|
|
17107
|
+
};
|
|
17108
|
+
_proto._initMaterial = function _initMaterial(engine) {
|
|
17109
|
+
var material = this._material = new Material(engine, Shader.find("background-texture"));
|
|
17110
|
+
material.renderState.depthState.compareFunction = CompareFunction.LessEqual;
|
|
17111
|
+
material._addReferCount(1);
|
|
17112
|
+
};
|
|
17076
17113
|
_proto._createPlane = function _createPlane(engine) {
|
|
17077
17114
|
var mesh = new ModelMesh(engine);
|
|
17078
17115
|
mesh.isGCIgnored = true;
|
|
@@ -17112,7 +17149,7 @@ ShaderPool.init();
|
|
|
17112
17149
|
(_value = value) == null ? void 0 : _value._addReferCount(1);
|
|
17113
17150
|
(_this__texture = this._texture) == null ? void 0 : _this__texture._addReferCount(-1);
|
|
17114
17151
|
this._texture = value;
|
|
17115
|
-
this.
|
|
17152
|
+
this._material.shaderData.setTexture("material_BaseTexture", value);
|
|
17116
17153
|
}
|
|
17117
17154
|
}
|
|
17118
17155
|
},
|
|
@@ -17687,11 +17724,6 @@ ShaderPool.init();
|
|
|
17687
17724
|
]);
|
|
17688
17725
|
return Light;
|
|
17689
17726
|
}(Component);
|
|
17690
|
-
(function() {
|
|
17691
|
-
/**
|
|
17692
|
-
* Each type of light source is at most 10, beyond which it will not take effect.
|
|
17693
|
-
* */ Light._maxLight = 10;
|
|
17694
|
-
})();
|
|
17695
17727
|
__decorate([
|
|
17696
17728
|
ignoreClone
|
|
17697
17729
|
], Light.prototype, "_lightIndex", void 0);
|
|
@@ -17709,13 +17741,12 @@ __decorate([
|
|
|
17709
17741
|
var _proto = DirectLight.prototype;
|
|
17710
17742
|
/**
|
|
17711
17743
|
* @internal
|
|
17712
|
-
*/ _proto._appendData = function _appendData(lightIndex) {
|
|
17744
|
+
*/ _proto._appendData = function _appendData(lightIndex, data) {
|
|
17713
17745
|
var cullingMaskStart = lightIndex * 2;
|
|
17714
17746
|
var colorStart = lightIndex * 3;
|
|
17715
17747
|
var directionStart = lightIndex * 3;
|
|
17716
17748
|
var lightColor = this._getLightIntensityColor();
|
|
17717
17749
|
var direction = this.direction;
|
|
17718
|
-
var data = DirectLight._combinedData;
|
|
17719
17750
|
var cullingMask = this.cullingMask;
|
|
17720
17751
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
17721
17752
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
@@ -17744,8 +17775,7 @@ __decorate([
|
|
|
17744
17775
|
};
|
|
17745
17776
|
/**
|
|
17746
17777
|
* @internal
|
|
17747
|
-
*/ DirectLight._updateShaderData = function _updateShaderData(shaderData) {
|
|
17748
|
-
var data = DirectLight._combinedData;
|
|
17778
|
+
*/ DirectLight._updateShaderData = function _updateShaderData(shaderData, data) {
|
|
17749
17779
|
shaderData.setIntArray(DirectLight._cullingMaskProperty, data.cullingMask);
|
|
17750
17780
|
shaderData.setFloatArray(DirectLight._colorProperty, data.color);
|
|
17751
17781
|
shaderData.setFloatArray(DirectLight._directionProperty, data.direction);
|
|
@@ -17788,13 +17818,6 @@ __decorate([
|
|
|
17788
17818
|
(function() {
|
|
17789
17819
|
DirectLight._directionProperty = ShaderProperty.getByName("scene_DirectLightDirection");
|
|
17790
17820
|
})();
|
|
17791
|
-
(function() {
|
|
17792
|
-
DirectLight._combinedData = {
|
|
17793
|
-
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
17794
|
-
color: new Float32Array(Light._maxLight * 3),
|
|
17795
|
-
direction: new Float32Array(Light._maxLight * 3)
|
|
17796
|
-
};
|
|
17797
|
-
})();
|
|
17798
17821
|
|
|
17799
17822
|
/**
|
|
17800
17823
|
* Point light.
|
|
@@ -17809,14 +17832,13 @@ __decorate([
|
|
|
17809
17832
|
var _proto = PointLight.prototype;
|
|
17810
17833
|
/**
|
|
17811
17834
|
* @internal
|
|
17812
|
-
*/ _proto._appendData = function _appendData(lightIndex) {
|
|
17835
|
+
*/ _proto._appendData = function _appendData(lightIndex, data) {
|
|
17813
17836
|
var cullingMaskStart = lightIndex * 2;
|
|
17814
17837
|
var colorStart = lightIndex * 3;
|
|
17815
17838
|
var positionStart = lightIndex * 3;
|
|
17816
17839
|
var distanceStart = lightIndex;
|
|
17817
17840
|
var lightColor = this._getLightIntensityColor();
|
|
17818
17841
|
var lightPosition = this.position;
|
|
17819
|
-
var data = PointLight._combinedData;
|
|
17820
17842
|
var cullingMask = this.cullingMask;
|
|
17821
17843
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
17822
17844
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
@@ -17846,8 +17868,7 @@ __decorate([
|
|
|
17846
17868
|
};
|
|
17847
17869
|
/**
|
|
17848
17870
|
* @internal
|
|
17849
|
-
*/ PointLight._updateShaderData = function _updateShaderData(shaderData) {
|
|
17850
|
-
var data = PointLight._combinedData;
|
|
17871
|
+
*/ PointLight._updateShaderData = function _updateShaderData(shaderData, data) {
|
|
17851
17872
|
shaderData.setIntArray(PointLight._cullingMaskProperty, data.cullingMask);
|
|
17852
17873
|
shaderData.setFloatArray(PointLight._colorProperty, data.color);
|
|
17853
17874
|
shaderData.setFloatArray(PointLight._positionProperty, data.position);
|
|
@@ -17885,14 +17906,6 @@ __decorate([
|
|
|
17885
17906
|
(function() {
|
|
17886
17907
|
PointLight._distanceProperty = ShaderProperty.getByName("scene_PointLightDistance");
|
|
17887
17908
|
})();
|
|
17888
|
-
(function() {
|
|
17889
|
-
PointLight._combinedData = {
|
|
17890
|
-
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
17891
|
-
color: new Float32Array(Light._maxLight * 3),
|
|
17892
|
-
position: new Float32Array(Light._maxLight * 3),
|
|
17893
|
-
distance: new Float32Array(Light._maxLight)
|
|
17894
|
-
};
|
|
17895
|
-
})();
|
|
17896
17909
|
|
|
17897
17910
|
/**
|
|
17898
17911
|
* Spot light.
|
|
@@ -17911,7 +17924,7 @@ __decorate([
|
|
|
17911
17924
|
var _proto = SpotLight.prototype;
|
|
17912
17925
|
/**
|
|
17913
17926
|
* @internal
|
|
17914
|
-
*/ _proto._appendData = function _appendData(lightIndex) {
|
|
17927
|
+
*/ _proto._appendData = function _appendData(lightIndex, data) {
|
|
17915
17928
|
var cullingMaskStart = lightIndex * 2;
|
|
17916
17929
|
var colorStart = lightIndex * 3;
|
|
17917
17930
|
var positionStart = lightIndex * 3;
|
|
@@ -17922,7 +17935,6 @@ __decorate([
|
|
|
17922
17935
|
var lightColor = this._getLightIntensityColor();
|
|
17923
17936
|
var position = this.position;
|
|
17924
17937
|
var direction = this.direction;
|
|
17925
|
-
var data = SpotLight._combinedData;
|
|
17926
17938
|
var cullingMask = this.cullingMask;
|
|
17927
17939
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
17928
17940
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
@@ -17957,8 +17969,7 @@ __decorate([
|
|
|
17957
17969
|
};
|
|
17958
17970
|
/**
|
|
17959
17971
|
* @internal
|
|
17960
|
-
*/ SpotLight._updateShaderData = function _updateShaderData(shaderData) {
|
|
17961
|
-
var data = SpotLight._combinedData;
|
|
17972
|
+
*/ SpotLight._updateShaderData = function _updateShaderData(shaderData, data) {
|
|
17962
17973
|
shaderData.setIntArray(SpotLight._cullingMaskProperty, data.cullingMask);
|
|
17963
17974
|
shaderData.setFloatArray(SpotLight._colorProperty, data.color);
|
|
17964
17975
|
shaderData.setFloatArray(SpotLight._positionProperty, data.position);
|
|
@@ -18028,17 +18039,6 @@ __decorate([
|
|
|
18028
18039
|
(function() {
|
|
18029
18040
|
SpotLight._penumbraCosProperty = ShaderProperty.getByName("scene_SpotLightPenumbraCos");
|
|
18030
18041
|
})();
|
|
18031
|
-
(function() {
|
|
18032
|
-
SpotLight._combinedData = {
|
|
18033
|
-
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
18034
|
-
color: new Float32Array(Light._maxLight * 3),
|
|
18035
|
-
position: new Float32Array(Light._maxLight * 3),
|
|
18036
|
-
direction: new Float32Array(Light._maxLight * 3),
|
|
18037
|
-
distance: new Float32Array(Light._maxLight),
|
|
18038
|
-
angleCos: new Float32Array(Light._maxLight),
|
|
18039
|
-
penumbraCos: new Float32Array(Light._maxLight)
|
|
18040
|
-
};
|
|
18041
|
-
})();
|
|
18042
18042
|
|
|
18043
18043
|
/**
|
|
18044
18044
|
* Light manager.
|
|
@@ -18047,6 +18047,26 @@ __decorate([
|
|
|
18047
18047
|
/** @internal */ this._spotLights = new DisorderedArray();
|
|
18048
18048
|
/** @internal */ this._pointLights = new DisorderedArray();
|
|
18049
18049
|
/** @internal */ this._directLights = new DisorderedArray();
|
|
18050
|
+
this._directData = {
|
|
18051
|
+
cullingMask: new Int32Array(LightManager._maxLight * 2),
|
|
18052
|
+
color: new Float32Array(LightManager._maxLight * 3),
|
|
18053
|
+
direction: new Float32Array(LightManager._maxLight * 3)
|
|
18054
|
+
};
|
|
18055
|
+
this._pointData = {
|
|
18056
|
+
cullingMask: new Int32Array(LightManager._maxLight * 2),
|
|
18057
|
+
color: new Float32Array(LightManager._maxLight * 3),
|
|
18058
|
+
position: new Float32Array(LightManager._maxLight * 3),
|
|
18059
|
+
distance: new Float32Array(LightManager._maxLight)
|
|
18060
|
+
};
|
|
18061
|
+
this._spotData = {
|
|
18062
|
+
cullingMask: new Int32Array(LightManager._maxLight * 2),
|
|
18063
|
+
color: new Float32Array(LightManager._maxLight * 3),
|
|
18064
|
+
position: new Float32Array(LightManager._maxLight * 3),
|
|
18065
|
+
direction: new Float32Array(LightManager._maxLight * 3),
|
|
18066
|
+
distance: new Float32Array(LightManager._maxLight),
|
|
18067
|
+
angleCos: new Float32Array(LightManager._maxLight),
|
|
18068
|
+
penumbraCos: new Float32Array(LightManager._maxLight)
|
|
18069
|
+
};
|
|
18050
18070
|
}
|
|
18051
18071
|
var _proto = LightManager.prototype;
|
|
18052
18072
|
/**
|
|
@@ -18106,38 +18126,34 @@ __decorate([
|
|
|
18106
18126
|
/**
|
|
18107
18127
|
* @internal
|
|
18108
18128
|
*/ _proto._updateShaderData = function _updateShaderData(shaderData) {
|
|
18109
|
-
var spotLight =
|
|
18110
|
-
var
|
|
18111
|
-
var directLight = this._directLights;
|
|
18129
|
+
var _this = this, spotLight = _this._spotLights, pointLight = _this._pointLights, directLight = _this._directLights;
|
|
18130
|
+
var _this1 = this, spotData = _this1._spotData, pointData = _this1._pointData, directData = _this1._directData;
|
|
18112
18131
|
var spotLightCount = spotLight.length;
|
|
18113
18132
|
var pointLightCount = pointLight.length;
|
|
18114
18133
|
var directLightCount = directLight.length;
|
|
18115
|
-
for(var i = 0
|
|
18116
|
-
|
|
18117
|
-
light._appendData(i);
|
|
18134
|
+
for(var i = 0; i < spotLightCount; i++){
|
|
18135
|
+
spotLight.get(i)._appendData(i, spotData);
|
|
18118
18136
|
}
|
|
18119
|
-
for(var i1 = 0
|
|
18120
|
-
|
|
18121
|
-
light1._appendData(i1);
|
|
18137
|
+
for(var i1 = 0; i1 < pointLightCount; i1++){
|
|
18138
|
+
pointLight.get(i1)._appendData(i1, pointData);
|
|
18122
18139
|
}
|
|
18123
|
-
for(var i2 = 0
|
|
18124
|
-
|
|
18125
|
-
light2._appendData(i2);
|
|
18140
|
+
for(var i2 = 0; i2 < directLightCount; i2++){
|
|
18141
|
+
directLight.get(i2)._appendData(i2, directData);
|
|
18126
18142
|
}
|
|
18127
18143
|
if (directLightCount) {
|
|
18128
|
-
DirectLight._updateShaderData(shaderData);
|
|
18144
|
+
DirectLight._updateShaderData(shaderData, directData);
|
|
18129
18145
|
shaderData.enableMacro("SCENE_DIRECT_LIGHT_COUNT", directLightCount.toString());
|
|
18130
18146
|
} else {
|
|
18131
18147
|
shaderData.disableMacro("SCENE_DIRECT_LIGHT_COUNT");
|
|
18132
18148
|
}
|
|
18133
18149
|
if (pointLightCount) {
|
|
18134
|
-
PointLight._updateShaderData(shaderData);
|
|
18150
|
+
PointLight._updateShaderData(shaderData, pointData);
|
|
18135
18151
|
shaderData.enableMacro("SCENE_POINT_LIGHT_COUNT", pointLightCount.toString());
|
|
18136
18152
|
} else {
|
|
18137
18153
|
shaderData.disableMacro("SCENE_POINT_LIGHT_COUNT");
|
|
18138
18154
|
}
|
|
18139
18155
|
if (spotLightCount) {
|
|
18140
|
-
SpotLight._updateShaderData(shaderData);
|
|
18156
|
+
SpotLight._updateShaderData(shaderData, spotData);
|
|
18141
18157
|
shaderData.enableMacro("SCENE_SPOT_LIGHT_COUNT", spotLightCount.toString());
|
|
18142
18158
|
} else {
|
|
18143
18159
|
shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
|
|
@@ -18178,6 +18194,11 @@ __decorate([
|
|
|
18178
18194
|
};
|
|
18179
18195
|
return LightManager;
|
|
18180
18196
|
}();
|
|
18197
|
+
(function() {
|
|
18198
|
+
/**
|
|
18199
|
+
* Each type of light source is at most 10, beyond which it will not take effect.
|
|
18200
|
+
* */ LightManager._maxLight = 10;
|
|
18201
|
+
})();
|
|
18181
18202
|
|
|
18182
18203
|
/**
|
|
18183
18204
|
* Scene.
|
|
@@ -18208,6 +18229,7 @@ __decorate([
|
|
|
18208
18229
|
_this._fogEnd = 300;
|
|
18209
18230
|
_this._fogDensity = 0.01;
|
|
18210
18231
|
_this._fogParams = new Vector4();
|
|
18232
|
+
_this._isActive = true;
|
|
18211
18233
|
_this.name = name || "";
|
|
18212
18234
|
var shaderData = _this.shaderData;
|
|
18213
18235
|
shaderData._addReferCount(1);
|
|
@@ -18455,6 +18477,24 @@ __decorate([
|
|
|
18455
18477
|
this._fogParams.w = density / Math.sqrt(Math.LN2);
|
|
18456
18478
|
};
|
|
18457
18479
|
_create_class(Scene, [
|
|
18480
|
+
{
|
|
18481
|
+
key: "isActive",
|
|
18482
|
+
get: /**
|
|
18483
|
+
* Whether the scene is active.
|
|
18484
|
+
*/ function get() {
|
|
18485
|
+
return this._isActive;
|
|
18486
|
+
},
|
|
18487
|
+
set: function set(value) {
|
|
18488
|
+
if (this._isActive !== value) {
|
|
18489
|
+
this._isActive = value;
|
|
18490
|
+
if (value) {
|
|
18491
|
+
this._sceneManager && this._processActive(true);
|
|
18492
|
+
} else {
|
|
18493
|
+
this._sceneManager && this._processActive(false);
|
|
18494
|
+
}
|
|
18495
|
+
}
|
|
18496
|
+
}
|
|
18497
|
+
},
|
|
18458
18498
|
{
|
|
18459
18499
|
key: "shaderData",
|
|
18460
18500
|
get: /**
|
|
@@ -18773,7 +18813,11 @@ __decorate([
|
|
|
18773
18813
|
* @internal
|
|
18774
18814
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
18775
18815
|
Component1.prototype._onDestroy.call(this);
|
|
18776
|
-
this.scene
|
|
18816
|
+
if (this.scene) {
|
|
18817
|
+
this.scene._componentsManager.addPendingDestroyScript(this);
|
|
18818
|
+
} else {
|
|
18819
|
+
this.onDestroy();
|
|
18820
|
+
}
|
|
18777
18821
|
};
|
|
18778
18822
|
return Script;
|
|
18779
18823
|
}(Component);
|
|
@@ -18916,7 +18960,7 @@ var passNum = 0;
|
|
|
18916
18960
|
_proto.drawBatches = function drawBatches(camera) {
|
|
18917
18961
|
var _this = this, engine = _this._engine, batchedQueue = _this._batchedQueue;
|
|
18918
18962
|
var mesh = this._meshes[this._flushId];
|
|
18919
|
-
var subMeshes = mesh.subMeshes;
|
|
18963
|
+
var subMeshes = mesh.subMeshes, primitive = mesh._primitive;
|
|
18920
18964
|
var maskManager = engine._spriteMaskManager;
|
|
18921
18965
|
var sceneData = camera.scene.shaderData;
|
|
18922
18966
|
var cameraData = camera.shaderData;
|
|
@@ -18946,7 +18990,7 @@ var passNum = 0;
|
|
|
18946
18990
|
program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
|
|
18947
18991
|
program.uploadAll(program.materialUniformBlock, material.shaderData);
|
|
18948
18992
|
material.renderState._apply(engine, false, shaderPass._renderStateDataMap, material.shaderData);
|
|
18949
|
-
engine._hardwareRenderer.drawPrimitive(
|
|
18993
|
+
engine._hardwareRenderer.drawPrimitive(primitive, subMesh, program);
|
|
18950
18994
|
maskManager.postRender(renderer);
|
|
18951
18995
|
}
|
|
18952
18996
|
};
|
|
@@ -20323,8 +20367,8 @@ var /**
|
|
|
20323
20367
|
};
|
|
20324
20368
|
_proto._drawBackgroundTexture = function _drawBackgroundTexture(engine, background) {
|
|
20325
20369
|
var rhi = engine._hardwareRenderer;
|
|
20326
|
-
var
|
|
20327
|
-
var mesh = background._mesh;
|
|
20370
|
+
var canvas = engine.canvas;
|
|
20371
|
+
var material = background._material, mesh = background._mesh;
|
|
20328
20372
|
if ((this._lastCanvasSize.x !== canvas.width || this._lastCanvasSize.y !== canvas.height) && background._textureFillMode !== BackgroundTextureFillMode.Fill) {
|
|
20329
20373
|
this._lastCanvasSize.set(canvas.width, canvas.height);
|
|
20330
20374
|
background._resizeBackgroundTexture();
|
|
@@ -20499,7 +20543,7 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
20499
20543
|
// Use the intersection of the near clipping plane as the origin point.
|
|
20500
20544
|
var origin = this._innerViewportToWorldPoint(point.x, point.y, 0.0, invViewProjMat, out.origin);
|
|
20501
20545
|
// Use the intersection of the far clipping plane as the origin point.
|
|
20502
|
-
var direction = this._innerViewportToWorldPoint(point.x, point.y, 1.
|
|
20546
|
+
var direction = this._innerViewportToWorldPoint(point.x, point.y, 1 - MathUtil$1.zeroTolerance, invViewProjMat, out.direction);
|
|
20503
20547
|
Vector3.subtract(direction, origin, direction);
|
|
20504
20548
|
direction.normalize();
|
|
20505
20549
|
return out;
|
|
@@ -24303,16 +24347,22 @@ AnimationCurveOwner.registerAssembler(Transform, "scale", ScaleAnimationCurveOwn
|
|
|
24303
24347
|
/**
|
|
24304
24348
|
* @internal
|
|
24305
24349
|
*/ var BlendShapeWeightsAnimationCurveOwnerAssembler = /*#__PURE__*/ function() {
|
|
24306
|
-
function BlendShapeWeightsAnimationCurveOwnerAssembler() {
|
|
24350
|
+
function BlendShapeWeightsAnimationCurveOwnerAssembler() {
|
|
24351
|
+
this._skinnedMeshRenderer = [];
|
|
24352
|
+
}
|
|
24307
24353
|
var _proto = BlendShapeWeightsAnimationCurveOwnerAssembler.prototype;
|
|
24308
24354
|
_proto.initialize = function initialize(owner) {
|
|
24309
|
-
|
|
24355
|
+
// @todo: Compatible with multiple SkinnedMeshRenderer in a entity, optimize later.
|
|
24356
|
+
owner.target.getComponents(SkinnedMeshRenderer, this._skinnedMeshRenderer);
|
|
24310
24357
|
};
|
|
24311
24358
|
_proto.getTargetValue = function getTargetValue() {
|
|
24312
|
-
return this._skinnedMeshRenderer.blendShapeWeights;
|
|
24359
|
+
return this._skinnedMeshRenderer[0].blendShapeWeights;
|
|
24313
24360
|
};
|
|
24314
24361
|
_proto.setTargetValue = function setTargetValue(value) {
|
|
24315
|
-
this._skinnedMeshRenderer
|
|
24362
|
+
var skinnedMeshRenderer = this._skinnedMeshRenderer;
|
|
24363
|
+
for(var i = 0, n = skinnedMeshRenderer.length; i < n; i++){
|
|
24364
|
+
skinnedMeshRenderer[i].blendShapeWeights = value;
|
|
24365
|
+
}
|
|
24316
24366
|
};
|
|
24317
24367
|
return BlendShapeWeightsAnimationCurveOwnerAssembler;
|
|
24318
24368
|
}();
|
|
@@ -27709,15 +27759,13 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
27709
27759
|
/** The initial lifetime of particles when emitted. */ this.startLifetime = new ParticleCompositeCurve(5);
|
|
27710
27760
|
/** The initial speed of particles when the Particle Generator first spawns them. */ this.startSpeed = new ParticleCompositeCurve(5);
|
|
27711
27761
|
/** A flag to enable specifying particle size individually for each axis. */ this.startSize3D = false;
|
|
27712
|
-
/** The initial size of particles when the Particle Generator first spawns them. */ this.startSize = new ParticleCompositeCurve(1);
|
|
27713
27762
|
/** The initial size of particles along the x-axis when the Particle Generator first spawns them. */ this.startSizeX = new ParticleCompositeCurve(1);
|
|
27714
27763
|
/** The initial size of particles along the y-axis when the Particle Generator first spawns them. */ this.startSizeY = new ParticleCompositeCurve(1);
|
|
27715
27764
|
/** The initial size of particles along the z-axis when the Particle Generator first spawns them. */ this.startSizeZ = new ParticleCompositeCurve(1);
|
|
27716
|
-
/** A flag to enable 3D particle rotation. */ this.startRotation3D = false;
|
|
27717
|
-
/** The initial rotation of particles when the Particle Generator first spawns them. */ this.startRotation = new ParticleCompositeCurve(0);
|
|
27765
|
+
/** A flag to enable 3D particle rotation, when disabled, only `startRotationZ` is used. */ this.startRotation3D = false;
|
|
27718
27766
|
/** The initial rotation of particles around the x-axis when emitted.*/ this.startRotationX = new ParticleCompositeCurve(0);
|
|
27719
27767
|
/** The initial rotation of particles around the y-axis when emitted. */ this.startRotationY = new ParticleCompositeCurve(0);
|
|
27720
|
-
this.startRotationZ = new ParticleCompositeCurve(0);
|
|
27768
|
+
/** The initial rotation of particles around the z-axis when emitted. */ this.startRotationZ = new ParticleCompositeCurve(0);
|
|
27721
27769
|
/** Makes some particles spin in the opposite direction. */ this.flipRotation = 0;
|
|
27722
27770
|
/** The mode of start color */ this.startColor = new ParticleCompositeGradient(new Color$1(1, 1, 1, 1));
|
|
27723
27771
|
/** A scale that this Particle Generator applies to gravity, defined by Physics.gravity. */ this.gravityModifier = new ParticleCompositeCurve(0);
|
|
@@ -27820,6 +27868,17 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
27820
27868
|
}
|
|
27821
27869
|
}
|
|
27822
27870
|
}
|
|
27871
|
+
},
|
|
27872
|
+
{
|
|
27873
|
+
key: "startSize",
|
|
27874
|
+
get: /**
|
|
27875
|
+
* The initial size of particles when the Particle Generator first spawns them.
|
|
27876
|
+
*/ function get() {
|
|
27877
|
+
return this.startSizeX;
|
|
27878
|
+
},
|
|
27879
|
+
set: function set(value) {
|
|
27880
|
+
this.startSizeX = value;
|
|
27881
|
+
}
|
|
27823
27882
|
}
|
|
27824
27883
|
]);
|
|
27825
27884
|
return MainModule;
|
|
@@ -27863,9 +27922,6 @@ __decorate([
|
|
|
27863
27922
|
__decorate([
|
|
27864
27923
|
deepClone
|
|
27865
27924
|
], MainModule.prototype, "startSpeed", void 0);
|
|
27866
|
-
__decorate([
|
|
27867
|
-
deepClone
|
|
27868
|
-
], MainModule.prototype, "startSize", void 0);
|
|
27869
27925
|
__decorate([
|
|
27870
27926
|
deepClone
|
|
27871
27927
|
], MainModule.prototype, "startSizeX", void 0);
|
|
@@ -27875,9 +27931,6 @@ __decorate([
|
|
|
27875
27931
|
__decorate([
|
|
27876
27932
|
deepClone
|
|
27877
27933
|
], MainModule.prototype, "startSizeZ", void 0);
|
|
27878
|
-
__decorate([
|
|
27879
|
-
deepClone
|
|
27880
|
-
], MainModule.prototype, "startRotation", void 0);
|
|
27881
27934
|
__decorate([
|
|
27882
27935
|
deepClone
|
|
27883
27936
|
], MainModule.prototype, "startRotationX", void 0);
|
|
@@ -27885,7 +27938,6 @@ __decorate([
|
|
|
27885
27938
|
deepClone
|
|
27886
27939
|
], MainModule.prototype, "startRotationY", void 0);
|
|
27887
27940
|
__decorate([
|
|
27888
|
-
deepClone,
|
|
27889
27941
|
deepClone
|
|
27890
27942
|
], MainModule.prototype, "startRotationZ", void 0);
|
|
27891
27943
|
__decorate([
|
|
@@ -27926,7 +27978,7 @@ __decorate([
|
|
|
27926
27978
|
function RotationOverLifetimeModule() {
|
|
27927
27979
|
var _this;
|
|
27928
27980
|
_this = ParticleGeneratorModule1.apply(this, arguments) || this;
|
|
27929
|
-
/** Specifies whether the rotation is separate on each axis, when disabled only
|
|
27981
|
+
/** Specifies whether the rotation is separate on each axis, when disabled, only `rotationZ` is used. */ _this.separateAxes = false;
|
|
27930
27982
|
/** Rotation over lifetime for z axis. */ _this.rotationX = new ParticleCompositeCurve(0);
|
|
27931
27983
|
/** Rotation over lifetime for z axis. */ _this.rotationY = new ParticleCompositeCurve(0);
|
|
27932
27984
|
/** Rotation over lifetime for z axis. */ _this.rotationZ = new ParticleCompositeCurve(45);
|
|
@@ -28280,9 +28332,6 @@ __decorate([
|
|
|
28280
28332
|
}
|
|
28281
28333
|
var _proto = TextureSheetAnimationModule.prototype;
|
|
28282
28334
|
/**
|
|
28283
|
-
* @inheritDoc
|
|
28284
|
-
*/ _proto.cloneTo = function cloneTo(dest) {};
|
|
28285
|
-
/**
|
|
28286
28335
|
* @internal
|
|
28287
28336
|
*/ _proto._updateShaderData = function _updateShaderData(shaderData) {
|
|
28288
28337
|
var frameMacro = null;
|
|
@@ -28770,7 +28819,7 @@ __decorate([
|
|
|
28770
28819
|
instanceVertices[offset + 16] = MathUtil$1.degreeToRadian(main.startRotationY.evaluate(undefined, startRotationRand.random()));
|
|
28771
28820
|
instanceVertices[offset + 17] = MathUtil$1.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
|
|
28772
28821
|
} else {
|
|
28773
|
-
instanceVertices[offset + 15] = MathUtil$1.degreeToRadian(main.
|
|
28822
|
+
instanceVertices[offset + 15] = MathUtil$1.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
|
|
28774
28823
|
}
|
|
28775
28824
|
// Start speed
|
|
28776
28825
|
instanceVertices[offset + 18] = startSpeed;
|