@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.
@@ -2542,8 +2542,8 @@ var ActiveChangeFlag;
2542
2542
  var _this;
2543
2543
  _this = EngineObject1.call(this, entity.engine) || this;
2544
2544
  /** @internal */ _this._awoken = false;
2545
- _this._phasedActive = false;
2546
2545
  _this._phasedActiveInScene = false;
2546
+ _this._phasedActive = false;
2547
2547
  _this._enabled = true;
2548
2548
  _this._entity = entity;
2549
2549
  return _this;
@@ -2675,10 +2675,10 @@ __decorate([
2675
2675
  ], Component.prototype, "_awoken", void 0);
2676
2676
  __decorate([
2677
2677
  ignoreClone
2678
- ], Component.prototype, "_phasedActive", void 0);
2678
+ ], Component.prototype, "_phasedActiveInScene", void 0);
2679
2679
  __decorate([
2680
2680
  ignoreClone
2681
- ], Component.prototype, "_phasedActiveInScene", void 0);
2681
+ ], Component.prototype, "_phasedActive", void 0);
2682
2682
  __decorate([
2683
2683
  assignmentClone
2684
2684
  ], Component.prototype, "_enabled", void 0);
@@ -12314,7 +12314,7 @@ var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher1) {
12314
12314
  _proto.drawBatches = function drawBatches(camera) {
12315
12315
  var _this = this, engine = _this._engine, batchedQueue = _this._batchedQueue;
12316
12316
  var mesh = this._meshes[this._flushId];
12317
- var subMeshes = mesh.subMeshes;
12317
+ var subMeshes = mesh.subMeshes, primitive = mesh._primitive;
12318
12318
  var sceneData = camera.scene.shaderData;
12319
12319
  var cameraData = camera.shaderData;
12320
12320
  for(var i = 0, len = subMeshes.length; i < len; i++){
@@ -12346,7 +12346,7 @@ var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher1) {
12346
12346
  program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
12347
12347
  program.uploadAll(program.materialUniformBlock, material.shaderData);
12348
12348
  material.renderState._apply(engine, false, pass._renderStateDataMap, material.shaderData);
12349
- engine._hardwareRenderer.drawPrimitive(mesh._primitive, subMesh, program);
12349
+ engine._hardwareRenderer.drawPrimitive(primitive, subMesh, program);
12350
12350
  }
12351
12351
  };
12352
12352
  return SpriteMaskBatcher;
@@ -12592,16 +12592,31 @@ var SafeLoopArray = /*#__PURE__*/ function() {
12592
12592
  }
12593
12593
  var _proto = SceneManager.prototype;
12594
12594
  _proto.addScene = function addScene(indexOrScene, scene) {
12595
+ var scenes = this._scenes;
12596
+ var index;
12595
12597
  if (typeof indexOrScene === "number") {
12596
- this._scenes.add(indexOrScene, scene);
12598
+ if (indexOrScene < 0 || indexOrScene > scenes.length) {
12599
+ throw "The index is out of range.";
12600
+ }
12601
+ index = indexOrScene;
12597
12602
  } else {
12603
+ index = scenes.length;
12598
12604
  scene = indexOrScene;
12599
- this._scenes.push(scene);
12600
12605
  }
12601
12606
  if (scene.engine !== this.engine) {
12602
12607
  throw "The scene is not belong to this engine.";
12603
12608
  }
12604
- scene._processActive(true);
12609
+ if (scene._sceneManager) {
12610
+ var currentIndex = scenes.indexOf(scene);
12611
+ if (currentIndex !== index) {
12612
+ scenes.removeByIndex(currentIndex);
12613
+ scenes.add(index, scene);
12614
+ }
12615
+ } else {
12616
+ scene._sceneManager = this;
12617
+ scenes.add(index, scene);
12618
+ scene.isActive && scene._processActive(true);
12619
+ }
12605
12620
  };
12606
12621
  /**
12607
12622
  * Remove scene.
@@ -12612,7 +12627,8 @@ var SafeLoopArray = /*#__PURE__*/ function() {
12612
12627
  if (index !== -1) {
12613
12628
  var removedScene = scenes.getArray()[index];
12614
12629
  scenes.removeByIndex(index);
12615
- removedScene._processActive(false);
12630
+ scene._sceneManager = null;
12631
+ removedScene.isActive && removedScene._processActive(false);
12616
12632
  }
12617
12633
  };
12618
12634
  /**
@@ -13816,9 +13832,9 @@ exports.Collider = /*#__PURE__*/ function(Component1) {
13816
13832
  oldCollider.removeShape(shape);
13817
13833
  }
13818
13834
  this._shapes.push(shape);
13819
- this.scene.physics._addColliderShape(shape);
13820
13835
  shape._collider = this;
13821
13836
  this._nativeCollider.addShape(shape._nativeShape);
13837
+ this._phasedActiveInScene && this.scene.physics._addColliderShape(shape);
13822
13838
  }
13823
13839
  };
13824
13840
  /**
@@ -13828,7 +13844,7 @@ exports.Collider = /*#__PURE__*/ function(Component1) {
13828
13844
  var index = this._shapes.indexOf(shape);
13829
13845
  if (index !== -1) {
13830
13846
  this._shapes.splice(index, 1);
13831
- this.scene.physics._removeColliderShape(shape);
13847
+ this._phasedActiveInScene && this.scene.physics._removeColliderShape(shape);
13832
13848
  shape._collider = null;
13833
13849
  this._nativeCollider.removeShape(shape._nativeShape);
13834
13850
  }
@@ -13839,7 +13855,7 @@ exports.Collider = /*#__PURE__*/ function(Component1) {
13839
13855
  var shapes = this._shapes;
13840
13856
  for(var i = 0, n = shapes.length; i < n; i++){
13841
13857
  var shape = shapes[i];
13842
- this.scene.physics._removeColliderShape(shape);
13858
+ this._phasedActiveInScene && this.scene.physics._removeColliderShape(shape);
13843
13859
  shape._destroy();
13844
13860
  this._nativeCollider.removeShape(shape._nativeShape);
13845
13861
  }
@@ -13864,12 +13880,22 @@ exports.Collider = /*#__PURE__*/ function(Component1) {
13864
13880
  /**
13865
13881
  * @internal
13866
13882
  */ _proto._onEnableInScene = function _onEnableInScene() {
13867
- this.scene.physics._addCollider(this);
13883
+ var physics = this.scene.physics;
13884
+ physics._addCollider(this);
13885
+ var shapes = this.shapes;
13886
+ for(var i = 0, n = shapes.length; i < n; i++){
13887
+ physics._addColliderShape(shapes[i]);
13888
+ }
13868
13889
  };
13869
13890
  /**
13870
13891
  * @internal
13871
13892
  */ _proto._onDisableInScene = function _onDisableInScene() {
13872
- this.scene.physics._removeCollider(this);
13893
+ var physics = this.scene.physics;
13894
+ physics._removeCollider(this);
13895
+ var shapes = this.shapes;
13896
+ for(var i = 0, n = shapes.length; i < n; i++){
13897
+ physics._removeColliderShape(shapes[i]);
13898
+ }
13873
13899
  };
13874
13900
  /**
13875
13901
  * @internal
@@ -14247,12 +14273,22 @@ var Collision = function Collision() {
14247
14273
  /**
14248
14274
  * @internal
14249
14275
  */ _proto._onEnableInScene = function _onEnableInScene() {
14250
- this.scene.physics._addCharacterController(this);
14276
+ var physics = this.scene.physics;
14277
+ physics._addCharacterController(this);
14278
+ var shapes = this.shapes;
14279
+ for(var i = 0, n = shapes.length; i < n; i++){
14280
+ physics._addColliderShape(shapes[i]);
14281
+ }
14251
14282
  };
14252
14283
  /**
14253
14284
  * @internal
14254
14285
  */ _proto._onDisableInScene = function _onDisableInScene() {
14255
- this.scene.physics._removeCharacterController(this);
14286
+ var physics = this.scene.physics;
14287
+ physics._removeCharacterController(this);
14288
+ var shapes = this.shapes;
14289
+ for(var i = 0, n = shapes.length; i < n; i++){
14290
+ physics._removeColliderShape(shapes[i]);
14291
+ }
14256
14292
  };
14257
14293
  _proto._setUpDirection = function _setUpDirection() {
14258
14294
  this._nativeCollider.setUpDirection(this._upDirection);
@@ -16404,10 +16440,6 @@ ShaderPool.init();
16404
16440
  magentaMaterial.isGCIgnored = true;
16405
16441
  magentaMaterial.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
16406
16442
  _this._magentaMaterial = magentaMaterial;
16407
- var backgroundTextureMaterial = new Material(_assert_this_initialized(_this), Shader.find("background-texture"));
16408
- backgroundTextureMaterial.isGCIgnored = true;
16409
- backgroundTextureMaterial.renderState.depthState.compareFunction = exports.CompareFunction.LessEqual;
16410
- _this._backgroundTextureMaterial = backgroundTextureMaterial;
16411
16443
  var innerSettings = _this._settings;
16412
16444
  var colorSpace = configuration.colorSpace || exports.ColorSpace.Linear;
16413
16445
  colorSpace === exports.ColorSpace.Gamma && _this._macroCollection.enable(Engine._gammaMacro);
@@ -17025,6 +17057,7 @@ ShaderPool.init();
17025
17057
  this./** @internal */ _textureFillMode = exports.BackgroundTextureFillMode.AspectFitHeight;
17026
17058
  this._texture = null;
17027
17059
  this._initMesh(_engine);
17060
+ this._initMaterial(_engine);
17028
17061
  }
17029
17062
  var _proto = Background.prototype;
17030
17063
  /**
@@ -17032,19 +17065,14 @@ ShaderPool.init();
17032
17065
  */ _proto.destroy = function destroy() {
17033
17066
  this._mesh._addReferCount(-1);
17034
17067
  this._mesh = null;
17068
+ this._material._addReferCount(-1);
17069
+ this._material = null;
17035
17070
  this.texture = null;
17036
17071
  this.solidColor = null;
17037
17072
  this.sky.destroy();
17038
17073
  };
17039
17074
  /**
17040
17075
  * @internal
17041
- * Standalone for CanvasRenderer plugin.
17042
- */ _proto._initMesh = function _initMesh(engine) {
17043
- this._mesh = this._createPlane(engine);
17044
- this._mesh._addReferCount(1);
17045
- };
17046
- /**
17047
- * @internal
17048
17076
  */ _proto._resizeBackgroundTexture = function _resizeBackgroundTexture() {
17049
17077
  if (!this._texture) {
17050
17078
  return;
@@ -17078,6 +17106,15 @@ ShaderPool.init();
17078
17106
  _backgroundTextureMesh.setPositions(positions);
17079
17107
  _backgroundTextureMesh.uploadData(false);
17080
17108
  };
17109
+ _proto._initMesh = function _initMesh(engine) {
17110
+ this._mesh = this._createPlane(engine);
17111
+ this._mesh._addReferCount(1);
17112
+ };
17113
+ _proto._initMaterial = function _initMaterial(engine) {
17114
+ var material = this._material = new Material(engine, Shader.find("background-texture"));
17115
+ material.renderState.depthState.compareFunction = exports.CompareFunction.LessEqual;
17116
+ material._addReferCount(1);
17117
+ };
17081
17118
  _proto._createPlane = function _createPlane(engine) {
17082
17119
  var mesh = new ModelMesh(engine);
17083
17120
  mesh.isGCIgnored = true;
@@ -17117,7 +17154,7 @@ ShaderPool.init();
17117
17154
  (_value = value) == null ? void 0 : _value._addReferCount(1);
17118
17155
  (_this__texture = this._texture) == null ? void 0 : _this__texture._addReferCount(-1);
17119
17156
  this._texture = value;
17120
- this._engine._backgroundTextureMaterial.shaderData.setTexture("material_BaseTexture", value);
17157
+ this._material.shaderData.setTexture("material_BaseTexture", value);
17121
17158
  }
17122
17159
  }
17123
17160
  },
@@ -17692,11 +17729,6 @@ ShaderPool.init();
17692
17729
  ]);
17693
17730
  return Light;
17694
17731
  }(Component);
17695
- (function() {
17696
- /**
17697
- * Each type of light source is at most 10, beyond which it will not take effect.
17698
- * */ Light._maxLight = 10;
17699
- })();
17700
17732
  __decorate([
17701
17733
  ignoreClone
17702
17734
  ], Light.prototype, "_lightIndex", void 0);
@@ -17714,13 +17746,12 @@ __decorate([
17714
17746
  var _proto = DirectLight.prototype;
17715
17747
  /**
17716
17748
  * @internal
17717
- */ _proto._appendData = function _appendData(lightIndex) {
17749
+ */ _proto._appendData = function _appendData(lightIndex, data) {
17718
17750
  var cullingMaskStart = lightIndex * 2;
17719
17751
  var colorStart = lightIndex * 3;
17720
17752
  var directionStart = lightIndex * 3;
17721
17753
  var lightColor = this._getLightIntensityColor();
17722
17754
  var direction = this.direction;
17723
- var data = DirectLight._combinedData;
17724
17755
  var cullingMask = this.cullingMask;
17725
17756
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
17726
17757
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
@@ -17749,8 +17780,7 @@ __decorate([
17749
17780
  };
17750
17781
  /**
17751
17782
  * @internal
17752
- */ DirectLight._updateShaderData = function _updateShaderData(shaderData) {
17753
- var data = DirectLight._combinedData;
17783
+ */ DirectLight._updateShaderData = function _updateShaderData(shaderData, data) {
17754
17784
  shaderData.setIntArray(DirectLight._cullingMaskProperty, data.cullingMask);
17755
17785
  shaderData.setFloatArray(DirectLight._colorProperty, data.color);
17756
17786
  shaderData.setFloatArray(DirectLight._directionProperty, data.direction);
@@ -17793,13 +17823,6 @@ __decorate([
17793
17823
  (function() {
17794
17824
  DirectLight._directionProperty = ShaderProperty.getByName("scene_DirectLightDirection");
17795
17825
  })();
17796
- (function() {
17797
- DirectLight._combinedData = {
17798
- cullingMask: new Int32Array(Light._maxLight * 2),
17799
- color: new Float32Array(Light._maxLight * 3),
17800
- direction: new Float32Array(Light._maxLight * 3)
17801
- };
17802
- })();
17803
17826
 
17804
17827
  /**
17805
17828
  * Point light.
@@ -17814,14 +17837,13 @@ __decorate([
17814
17837
  var _proto = PointLight.prototype;
17815
17838
  /**
17816
17839
  * @internal
17817
- */ _proto._appendData = function _appendData(lightIndex) {
17840
+ */ _proto._appendData = function _appendData(lightIndex, data) {
17818
17841
  var cullingMaskStart = lightIndex * 2;
17819
17842
  var colorStart = lightIndex * 3;
17820
17843
  var positionStart = lightIndex * 3;
17821
17844
  var distanceStart = lightIndex;
17822
17845
  var lightColor = this._getLightIntensityColor();
17823
17846
  var lightPosition = this.position;
17824
- var data = PointLight._combinedData;
17825
17847
  var cullingMask = this.cullingMask;
17826
17848
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
17827
17849
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
@@ -17851,8 +17873,7 @@ __decorate([
17851
17873
  };
17852
17874
  /**
17853
17875
  * @internal
17854
- */ PointLight._updateShaderData = function _updateShaderData(shaderData) {
17855
- var data = PointLight._combinedData;
17876
+ */ PointLight._updateShaderData = function _updateShaderData(shaderData, data) {
17856
17877
  shaderData.setIntArray(PointLight._cullingMaskProperty, data.cullingMask);
17857
17878
  shaderData.setFloatArray(PointLight._colorProperty, data.color);
17858
17879
  shaderData.setFloatArray(PointLight._positionProperty, data.position);
@@ -17890,14 +17911,6 @@ __decorate([
17890
17911
  (function() {
17891
17912
  PointLight._distanceProperty = ShaderProperty.getByName("scene_PointLightDistance");
17892
17913
  })();
17893
- (function() {
17894
- PointLight._combinedData = {
17895
- cullingMask: new Int32Array(Light._maxLight * 2),
17896
- color: new Float32Array(Light._maxLight * 3),
17897
- position: new Float32Array(Light._maxLight * 3),
17898
- distance: new Float32Array(Light._maxLight)
17899
- };
17900
- })();
17901
17914
 
17902
17915
  /**
17903
17916
  * Spot light.
@@ -17916,7 +17929,7 @@ __decorate([
17916
17929
  var _proto = SpotLight.prototype;
17917
17930
  /**
17918
17931
  * @internal
17919
- */ _proto._appendData = function _appendData(lightIndex) {
17932
+ */ _proto._appendData = function _appendData(lightIndex, data) {
17920
17933
  var cullingMaskStart = lightIndex * 2;
17921
17934
  var colorStart = lightIndex * 3;
17922
17935
  var positionStart = lightIndex * 3;
@@ -17927,7 +17940,6 @@ __decorate([
17927
17940
  var lightColor = this._getLightIntensityColor();
17928
17941
  var position = this.position;
17929
17942
  var direction = this.direction;
17930
- var data = SpotLight._combinedData;
17931
17943
  var cullingMask = this.cullingMask;
17932
17944
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
17933
17945
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
@@ -17962,8 +17974,7 @@ __decorate([
17962
17974
  };
17963
17975
  /**
17964
17976
  * @internal
17965
- */ SpotLight._updateShaderData = function _updateShaderData(shaderData) {
17966
- var data = SpotLight._combinedData;
17977
+ */ SpotLight._updateShaderData = function _updateShaderData(shaderData, data) {
17967
17978
  shaderData.setIntArray(SpotLight._cullingMaskProperty, data.cullingMask);
17968
17979
  shaderData.setFloatArray(SpotLight._colorProperty, data.color);
17969
17980
  shaderData.setFloatArray(SpotLight._positionProperty, data.position);
@@ -18033,17 +18044,6 @@ __decorate([
18033
18044
  (function() {
18034
18045
  SpotLight._penumbraCosProperty = ShaderProperty.getByName("scene_SpotLightPenumbraCos");
18035
18046
  })();
18036
- (function() {
18037
- SpotLight._combinedData = {
18038
- cullingMask: new Int32Array(Light._maxLight * 2),
18039
- color: new Float32Array(Light._maxLight * 3),
18040
- position: new Float32Array(Light._maxLight * 3),
18041
- direction: new Float32Array(Light._maxLight * 3),
18042
- distance: new Float32Array(Light._maxLight),
18043
- angleCos: new Float32Array(Light._maxLight),
18044
- penumbraCos: new Float32Array(Light._maxLight)
18045
- };
18046
- })();
18047
18047
 
18048
18048
  /**
18049
18049
  * Light manager.
@@ -18052,6 +18052,26 @@ __decorate([
18052
18052
  /** @internal */ this._spotLights = new DisorderedArray();
18053
18053
  /** @internal */ this._pointLights = new DisorderedArray();
18054
18054
  /** @internal */ this._directLights = new DisorderedArray();
18055
+ this._directData = {
18056
+ cullingMask: new Int32Array(LightManager._maxLight * 2),
18057
+ color: new Float32Array(LightManager._maxLight * 3),
18058
+ direction: new Float32Array(LightManager._maxLight * 3)
18059
+ };
18060
+ this._pointData = {
18061
+ cullingMask: new Int32Array(LightManager._maxLight * 2),
18062
+ color: new Float32Array(LightManager._maxLight * 3),
18063
+ position: new Float32Array(LightManager._maxLight * 3),
18064
+ distance: new Float32Array(LightManager._maxLight)
18065
+ };
18066
+ this._spotData = {
18067
+ cullingMask: new Int32Array(LightManager._maxLight * 2),
18068
+ color: new Float32Array(LightManager._maxLight * 3),
18069
+ position: new Float32Array(LightManager._maxLight * 3),
18070
+ direction: new Float32Array(LightManager._maxLight * 3),
18071
+ distance: new Float32Array(LightManager._maxLight),
18072
+ angleCos: new Float32Array(LightManager._maxLight),
18073
+ penumbraCos: new Float32Array(LightManager._maxLight)
18074
+ };
18055
18075
  }
18056
18076
  var _proto = LightManager.prototype;
18057
18077
  /**
@@ -18111,38 +18131,34 @@ __decorate([
18111
18131
  /**
18112
18132
  * @internal
18113
18133
  */ _proto._updateShaderData = function _updateShaderData(shaderData) {
18114
- var spotLight = this._spotLights;
18115
- var pointLight = this._pointLights;
18116
- var directLight = this._directLights;
18134
+ var _this = this, spotLight = _this._spotLights, pointLight = _this._pointLights, directLight = _this._directLights;
18135
+ var _this1 = this, spotData = _this1._spotData, pointData = _this1._pointData, directData = _this1._directData;
18117
18136
  var spotLightCount = spotLight.length;
18118
18137
  var pointLightCount = pointLight.length;
18119
18138
  var directLightCount = directLight.length;
18120
- for(var i = 0, len = spotLightCount; i < len; i++){
18121
- var light = spotLight.get(i);
18122
- light._appendData(i);
18139
+ for(var i = 0; i < spotLightCount; i++){
18140
+ spotLight.get(i)._appendData(i, spotData);
18123
18141
  }
18124
- for(var i1 = 0, len1 = pointLightCount; i1 < len1; i1++){
18125
- var light1 = pointLight.get(i1);
18126
- light1._appendData(i1);
18142
+ for(var i1 = 0; i1 < pointLightCount; i1++){
18143
+ pointLight.get(i1)._appendData(i1, pointData);
18127
18144
  }
18128
- for(var i2 = 0, len2 = directLightCount; i2 < len2; i2++){
18129
- var light2 = directLight.get(i2);
18130
- light2._appendData(i2);
18145
+ for(var i2 = 0; i2 < directLightCount; i2++){
18146
+ directLight.get(i2)._appendData(i2, directData);
18131
18147
  }
18132
18148
  if (directLightCount) {
18133
- DirectLight._updateShaderData(shaderData);
18149
+ DirectLight._updateShaderData(shaderData, directData);
18134
18150
  shaderData.enableMacro("SCENE_DIRECT_LIGHT_COUNT", directLightCount.toString());
18135
18151
  } else {
18136
18152
  shaderData.disableMacro("SCENE_DIRECT_LIGHT_COUNT");
18137
18153
  }
18138
18154
  if (pointLightCount) {
18139
- PointLight._updateShaderData(shaderData);
18155
+ PointLight._updateShaderData(shaderData, pointData);
18140
18156
  shaderData.enableMacro("SCENE_POINT_LIGHT_COUNT", pointLightCount.toString());
18141
18157
  } else {
18142
18158
  shaderData.disableMacro("SCENE_POINT_LIGHT_COUNT");
18143
18159
  }
18144
18160
  if (spotLightCount) {
18145
- SpotLight._updateShaderData(shaderData);
18161
+ SpotLight._updateShaderData(shaderData, spotData);
18146
18162
  shaderData.enableMacro("SCENE_SPOT_LIGHT_COUNT", spotLightCount.toString());
18147
18163
  } else {
18148
18164
  shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
@@ -18183,6 +18199,11 @@ __decorate([
18183
18199
  };
18184
18200
  return LightManager;
18185
18201
  }();
18202
+ (function() {
18203
+ /**
18204
+ * Each type of light source is at most 10, beyond which it will not take effect.
18205
+ * */ LightManager._maxLight = 10;
18206
+ })();
18186
18207
 
18187
18208
  /**
18188
18209
  * Scene.
@@ -18213,6 +18234,7 @@ __decorate([
18213
18234
  _this._fogEnd = 300;
18214
18235
  _this._fogDensity = 0.01;
18215
18236
  _this._fogParams = new miniprogram.Vector4();
18237
+ _this._isActive = true;
18216
18238
  _this.name = name || "";
18217
18239
  var shaderData = _this.shaderData;
18218
18240
  shaderData._addReferCount(1);
@@ -18460,6 +18482,24 @@ __decorate([
18460
18482
  this._fogParams.w = density / Math.sqrt(Math.LN2);
18461
18483
  };
18462
18484
  _create_class(Scene, [
18485
+ {
18486
+ key: "isActive",
18487
+ get: /**
18488
+ * Whether the scene is active.
18489
+ */ function get() {
18490
+ return this._isActive;
18491
+ },
18492
+ set: function set(value) {
18493
+ if (this._isActive !== value) {
18494
+ this._isActive = value;
18495
+ if (value) {
18496
+ this._sceneManager && this._processActive(true);
18497
+ } else {
18498
+ this._sceneManager && this._processActive(false);
18499
+ }
18500
+ }
18501
+ }
18502
+ },
18463
18503
  {
18464
18504
  key: "shaderData",
18465
18505
  get: /**
@@ -18778,7 +18818,11 @@ __decorate([
18778
18818
  * @internal
18779
18819
  */ _proto._onDestroy = function _onDestroy() {
18780
18820
  Component1.prototype._onDestroy.call(this);
18781
- this.scene._componentsManager.addPendingDestroyScript(this);
18821
+ if (this.scene) {
18822
+ this.scene._componentsManager.addPendingDestroyScript(this);
18823
+ } else {
18824
+ this.onDestroy();
18825
+ }
18782
18826
  };
18783
18827
  return Script;
18784
18828
  }(Component);
@@ -18921,7 +18965,7 @@ var passNum = 0;
18921
18965
  _proto.drawBatches = function drawBatches(camera) {
18922
18966
  var _this = this, engine = _this._engine, batchedQueue = _this._batchedQueue;
18923
18967
  var mesh = this._meshes[this._flushId];
18924
- var subMeshes = mesh.subMeshes;
18968
+ var subMeshes = mesh.subMeshes, primitive = mesh._primitive;
18925
18969
  var maskManager = engine._spriteMaskManager;
18926
18970
  var sceneData = camera.scene.shaderData;
18927
18971
  var cameraData = camera.shaderData;
@@ -18951,7 +18995,7 @@ var passNum = 0;
18951
18995
  program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
18952
18996
  program.uploadAll(program.materialUniformBlock, material.shaderData);
18953
18997
  material.renderState._apply(engine, false, shaderPass._renderStateDataMap, material.shaderData);
18954
- engine._hardwareRenderer.drawPrimitive(mesh._primitive, subMesh, program);
18998
+ engine._hardwareRenderer.drawPrimitive(primitive, subMesh, program);
18955
18999
  maskManager.postRender(renderer);
18956
19000
  }
18957
19001
  };
@@ -20328,8 +20372,8 @@ var /**
20328
20372
  };
20329
20373
  _proto._drawBackgroundTexture = function _drawBackgroundTexture(engine, background) {
20330
20374
  var rhi = engine._hardwareRenderer;
20331
- var material = engine._backgroundTextureMaterial, canvas = engine.canvas;
20332
- var mesh = background._mesh;
20375
+ var canvas = engine.canvas;
20376
+ var material = background._material, mesh = background._mesh;
20333
20377
  if ((this._lastCanvasSize.x !== canvas.width || this._lastCanvasSize.y !== canvas.height) && background._textureFillMode !== exports.BackgroundTextureFillMode.Fill) {
20334
20378
  this._lastCanvasSize.set(canvas.width, canvas.height);
20335
20379
  background._resizeBackgroundTexture();
@@ -20504,7 +20548,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
20504
20548
  // Use the intersection of the near clipping plane as the origin point.
20505
20549
  var origin = this._innerViewportToWorldPoint(point.x, point.y, 0.0, invViewProjMat, out.origin);
20506
20550
  // Use the intersection of the far clipping plane as the origin point.
20507
- var direction = this._innerViewportToWorldPoint(point.x, point.y, 1.0, invViewProjMat, out.direction);
20551
+ var direction = this._innerViewportToWorldPoint(point.x, point.y, 1 - miniprogram.MathUtil.zeroTolerance, invViewProjMat, out.direction);
20508
20552
  miniprogram.Vector3.subtract(direction, origin, direction);
20509
20553
  direction.normalize();
20510
20554
  return out;
@@ -24308,16 +24352,22 @@ AnimationCurveOwner.registerAssembler(Transform, "scale", ScaleAnimationCurveOwn
24308
24352
  /**
24309
24353
  * @internal
24310
24354
  */ var BlendShapeWeightsAnimationCurveOwnerAssembler = /*#__PURE__*/ function() {
24311
- function BlendShapeWeightsAnimationCurveOwnerAssembler() {}
24355
+ function BlendShapeWeightsAnimationCurveOwnerAssembler() {
24356
+ this._skinnedMeshRenderer = [];
24357
+ }
24312
24358
  var _proto = BlendShapeWeightsAnimationCurveOwnerAssembler.prototype;
24313
24359
  _proto.initialize = function initialize(owner) {
24314
- this._skinnedMeshRenderer = owner.target.getComponent(SkinnedMeshRenderer);
24360
+ // @todo: Compatible with multiple SkinnedMeshRenderer in a entity, optimize later.
24361
+ owner.target.getComponents(SkinnedMeshRenderer, this._skinnedMeshRenderer);
24315
24362
  };
24316
24363
  _proto.getTargetValue = function getTargetValue() {
24317
- return this._skinnedMeshRenderer.blendShapeWeights;
24364
+ return this._skinnedMeshRenderer[0].blendShapeWeights;
24318
24365
  };
24319
24366
  _proto.setTargetValue = function setTargetValue(value) {
24320
- this._skinnedMeshRenderer.blendShapeWeights = value;
24367
+ var skinnedMeshRenderer = this._skinnedMeshRenderer;
24368
+ for(var i = 0, n = skinnedMeshRenderer.length; i < n; i++){
24369
+ skinnedMeshRenderer[i].blendShapeWeights = value;
24370
+ }
24321
24371
  };
24322
24372
  return BlendShapeWeightsAnimationCurveOwnerAssembler;
24323
24373
  }();
@@ -27714,15 +27764,13 @@ var MainModule = /*#__PURE__*/ function() {
27714
27764
  /** The initial lifetime of particles when emitted. */ this.startLifetime = new ParticleCompositeCurve(5);
27715
27765
  /** The initial speed of particles when the Particle Generator first spawns them. */ this.startSpeed = new ParticleCompositeCurve(5);
27716
27766
  /** A flag to enable specifying particle size individually for each axis. */ this.startSize3D = false;
27717
- /** The initial size of particles when the Particle Generator first spawns them. */ this.startSize = new ParticleCompositeCurve(1);
27718
27767
  /** The initial size of particles along the x-axis when the Particle Generator first spawns them. */ this.startSizeX = new ParticleCompositeCurve(1);
27719
27768
  /** The initial size of particles along the y-axis when the Particle Generator first spawns them. */ this.startSizeY = new ParticleCompositeCurve(1);
27720
27769
  /** The initial size of particles along the z-axis when the Particle Generator first spawns them. */ this.startSizeZ = new ParticleCompositeCurve(1);
27721
- /** A flag to enable 3D particle rotation. */ this.startRotation3D = false;
27722
- /** The initial rotation of particles when the Particle Generator first spawns them. */ this.startRotation = new ParticleCompositeCurve(0);
27770
+ /** A flag to enable 3D particle rotation, when disabled, only `startRotationZ` is used. */ this.startRotation3D = false;
27723
27771
  /** The initial rotation of particles around the x-axis when emitted.*/ this.startRotationX = new ParticleCompositeCurve(0);
27724
27772
  /** The initial rotation of particles around the y-axis when emitted. */ this.startRotationY = new ParticleCompositeCurve(0);
27725
- this.startRotationZ = new ParticleCompositeCurve(0);
27773
+ /** The initial rotation of particles around the z-axis when emitted. */ this.startRotationZ = new ParticleCompositeCurve(0);
27726
27774
  /** Makes some particles spin in the opposite direction. */ this.flipRotation = 0;
27727
27775
  /** The mode of start color */ this.startColor = new ParticleCompositeGradient(new miniprogram.Color(1, 1, 1, 1));
27728
27776
  /** A scale that this Particle Generator applies to gravity, defined by Physics.gravity. */ this.gravityModifier = new ParticleCompositeCurve(0);
@@ -27825,6 +27873,17 @@ var MainModule = /*#__PURE__*/ function() {
27825
27873
  }
27826
27874
  }
27827
27875
  }
27876
+ },
27877
+ {
27878
+ key: "startSize",
27879
+ get: /**
27880
+ * The initial size of particles when the Particle Generator first spawns them.
27881
+ */ function get() {
27882
+ return this.startSizeX;
27883
+ },
27884
+ set: function set(value) {
27885
+ this.startSizeX = value;
27886
+ }
27828
27887
  }
27829
27888
  ]);
27830
27889
  return MainModule;
@@ -27868,9 +27927,6 @@ __decorate([
27868
27927
  __decorate([
27869
27928
  deepClone
27870
27929
  ], MainModule.prototype, "startSpeed", void 0);
27871
- __decorate([
27872
- deepClone
27873
- ], MainModule.prototype, "startSize", void 0);
27874
27930
  __decorate([
27875
27931
  deepClone
27876
27932
  ], MainModule.prototype, "startSizeX", void 0);
@@ -27880,9 +27936,6 @@ __decorate([
27880
27936
  __decorate([
27881
27937
  deepClone
27882
27938
  ], MainModule.prototype, "startSizeZ", void 0);
27883
- __decorate([
27884
- deepClone
27885
- ], MainModule.prototype, "startRotation", void 0);
27886
27939
  __decorate([
27887
27940
  deepClone
27888
27941
  ], MainModule.prototype, "startRotationX", void 0);
@@ -27890,7 +27943,6 @@ __decorate([
27890
27943
  deepClone
27891
27944
  ], MainModule.prototype, "startRotationY", void 0);
27892
27945
  __decorate([
27893
- deepClone,
27894
27946
  deepClone
27895
27947
  ], MainModule.prototype, "startRotationZ", void 0);
27896
27948
  __decorate([
@@ -27931,7 +27983,7 @@ __decorate([
27931
27983
  function RotationOverLifetimeModule() {
27932
27984
  var _this;
27933
27985
  _this = ParticleGeneratorModule1.apply(this, arguments) || this;
27934
- /** Specifies whether the rotation is separate on each axis, when disabled only z axis is used. */ _this.separateAxes = false;
27986
+ /** Specifies whether the rotation is separate on each axis, when disabled, only `rotationZ` is used. */ _this.separateAxes = false;
27935
27987
  /** Rotation over lifetime for z axis. */ _this.rotationX = new ParticleCompositeCurve(0);
27936
27988
  /** Rotation over lifetime for z axis. */ _this.rotationY = new ParticleCompositeCurve(0);
27937
27989
  /** Rotation over lifetime for z axis. */ _this.rotationZ = new ParticleCompositeCurve(45);
@@ -28285,9 +28337,6 @@ __decorate([
28285
28337
  }
28286
28338
  var _proto = TextureSheetAnimationModule.prototype;
28287
28339
  /**
28288
- * @inheritDoc
28289
- */ _proto.cloneTo = function cloneTo(dest) {};
28290
- /**
28291
28340
  * @internal
28292
28341
  */ _proto._updateShaderData = function _updateShaderData(shaderData) {
28293
28342
  var frameMacro = null;
@@ -28775,7 +28824,7 @@ __decorate([
28775
28824
  instanceVertices[offset + 16] = miniprogram.MathUtil.degreeToRadian(main.startRotationY.evaluate(undefined, startRotationRand.random()));
28776
28825
  instanceVertices[offset + 17] = miniprogram.MathUtil.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
28777
28826
  } else {
28778
- instanceVertices[offset + 15] = miniprogram.MathUtil.degreeToRadian(main.startRotation.evaluate(undefined, startRotationRand.random()));
28827
+ instanceVertices[offset + 15] = miniprogram.MathUtil.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
28779
28828
  }
28780
28829
  // Start speed
28781
28830
  instanceVertices[offset + 18] = startSpeed;