@galacean/engine-core 1.1.0-beta.2 → 1.1.0-beta.4

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.
@@ -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;
@@ -17692,11 +17692,6 @@ ShaderPool.init();
17692
17692
  ]);
17693
17693
  return Light;
17694
17694
  }(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
17695
  __decorate([
17701
17696
  ignoreClone
17702
17697
  ], Light.prototype, "_lightIndex", void 0);
@@ -17714,13 +17709,12 @@ __decorate([
17714
17709
  var _proto = DirectLight.prototype;
17715
17710
  /**
17716
17711
  * @internal
17717
- */ _proto._appendData = function _appendData(lightIndex) {
17712
+ */ _proto._appendData = function _appendData(lightIndex, data) {
17718
17713
  var cullingMaskStart = lightIndex * 2;
17719
17714
  var colorStart = lightIndex * 3;
17720
17715
  var directionStart = lightIndex * 3;
17721
17716
  var lightColor = this._getLightIntensityColor();
17722
17717
  var direction = this.direction;
17723
- var data = DirectLight._combinedData;
17724
17718
  var cullingMask = this.cullingMask;
17725
17719
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
17726
17720
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
@@ -17749,8 +17743,7 @@ __decorate([
17749
17743
  };
17750
17744
  /**
17751
17745
  * @internal
17752
- */ DirectLight._updateShaderData = function _updateShaderData(shaderData) {
17753
- var data = DirectLight._combinedData;
17746
+ */ DirectLight._updateShaderData = function _updateShaderData(shaderData, data) {
17754
17747
  shaderData.setIntArray(DirectLight._cullingMaskProperty, data.cullingMask);
17755
17748
  shaderData.setFloatArray(DirectLight._colorProperty, data.color);
17756
17749
  shaderData.setFloatArray(DirectLight._directionProperty, data.direction);
@@ -17793,13 +17786,6 @@ __decorate([
17793
17786
  (function() {
17794
17787
  DirectLight._directionProperty = ShaderProperty.getByName("scene_DirectLightDirection");
17795
17788
  })();
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
17789
 
17804
17790
  /**
17805
17791
  * Point light.
@@ -17814,14 +17800,13 @@ __decorate([
17814
17800
  var _proto = PointLight.prototype;
17815
17801
  /**
17816
17802
  * @internal
17817
- */ _proto._appendData = function _appendData(lightIndex) {
17803
+ */ _proto._appendData = function _appendData(lightIndex, data) {
17818
17804
  var cullingMaskStart = lightIndex * 2;
17819
17805
  var colorStart = lightIndex * 3;
17820
17806
  var positionStart = lightIndex * 3;
17821
17807
  var distanceStart = lightIndex;
17822
17808
  var lightColor = this._getLightIntensityColor();
17823
17809
  var lightPosition = this.position;
17824
- var data = PointLight._combinedData;
17825
17810
  var cullingMask = this.cullingMask;
17826
17811
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
17827
17812
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
@@ -17851,8 +17836,7 @@ __decorate([
17851
17836
  };
17852
17837
  /**
17853
17838
  * @internal
17854
- */ PointLight._updateShaderData = function _updateShaderData(shaderData) {
17855
- var data = PointLight._combinedData;
17839
+ */ PointLight._updateShaderData = function _updateShaderData(shaderData, data) {
17856
17840
  shaderData.setIntArray(PointLight._cullingMaskProperty, data.cullingMask);
17857
17841
  shaderData.setFloatArray(PointLight._colorProperty, data.color);
17858
17842
  shaderData.setFloatArray(PointLight._positionProperty, data.position);
@@ -17890,14 +17874,6 @@ __decorate([
17890
17874
  (function() {
17891
17875
  PointLight._distanceProperty = ShaderProperty.getByName("scene_PointLightDistance");
17892
17876
  })();
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
17877
 
17902
17878
  /**
17903
17879
  * Spot light.
@@ -17916,7 +17892,7 @@ __decorate([
17916
17892
  var _proto = SpotLight.prototype;
17917
17893
  /**
17918
17894
  * @internal
17919
- */ _proto._appendData = function _appendData(lightIndex) {
17895
+ */ _proto._appendData = function _appendData(lightIndex, data) {
17920
17896
  var cullingMaskStart = lightIndex * 2;
17921
17897
  var colorStart = lightIndex * 3;
17922
17898
  var positionStart = lightIndex * 3;
@@ -17927,7 +17903,6 @@ __decorate([
17927
17903
  var lightColor = this._getLightIntensityColor();
17928
17904
  var position = this.position;
17929
17905
  var direction = this.direction;
17930
- var data = SpotLight._combinedData;
17931
17906
  var cullingMask = this.cullingMask;
17932
17907
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
17933
17908
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
@@ -17962,8 +17937,7 @@ __decorate([
17962
17937
  };
17963
17938
  /**
17964
17939
  * @internal
17965
- */ SpotLight._updateShaderData = function _updateShaderData(shaderData) {
17966
- var data = SpotLight._combinedData;
17940
+ */ SpotLight._updateShaderData = function _updateShaderData(shaderData, data) {
17967
17941
  shaderData.setIntArray(SpotLight._cullingMaskProperty, data.cullingMask);
17968
17942
  shaderData.setFloatArray(SpotLight._colorProperty, data.color);
17969
17943
  shaderData.setFloatArray(SpotLight._positionProperty, data.position);
@@ -18033,17 +18007,6 @@ __decorate([
18033
18007
  (function() {
18034
18008
  SpotLight._penumbraCosProperty = ShaderProperty.getByName("scene_SpotLightPenumbraCos");
18035
18009
  })();
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
18010
 
18048
18011
  /**
18049
18012
  * Light manager.
@@ -18052,6 +18015,26 @@ __decorate([
18052
18015
  /** @internal */ this._spotLights = new DisorderedArray();
18053
18016
  /** @internal */ this._pointLights = new DisorderedArray();
18054
18017
  /** @internal */ this._directLights = new DisorderedArray();
18018
+ this._directData = {
18019
+ cullingMask: new Int32Array(LightManager._maxLight * 2),
18020
+ color: new Float32Array(LightManager._maxLight * 3),
18021
+ direction: new Float32Array(LightManager._maxLight * 3)
18022
+ };
18023
+ this._pointData = {
18024
+ cullingMask: new Int32Array(LightManager._maxLight * 2),
18025
+ color: new Float32Array(LightManager._maxLight * 3),
18026
+ position: new Float32Array(LightManager._maxLight * 3),
18027
+ distance: new Float32Array(LightManager._maxLight)
18028
+ };
18029
+ this._spotData = {
18030
+ cullingMask: new Int32Array(LightManager._maxLight * 2),
18031
+ color: new Float32Array(LightManager._maxLight * 3),
18032
+ position: new Float32Array(LightManager._maxLight * 3),
18033
+ direction: new Float32Array(LightManager._maxLight * 3),
18034
+ distance: new Float32Array(LightManager._maxLight),
18035
+ angleCos: new Float32Array(LightManager._maxLight),
18036
+ penumbraCos: new Float32Array(LightManager._maxLight)
18037
+ };
18055
18038
  }
18056
18039
  var _proto = LightManager.prototype;
18057
18040
  /**
@@ -18111,38 +18094,34 @@ __decorate([
18111
18094
  /**
18112
18095
  * @internal
18113
18096
  */ _proto._updateShaderData = function _updateShaderData(shaderData) {
18114
- var spotLight = this._spotLights;
18115
- var pointLight = this._pointLights;
18116
- var directLight = this._directLights;
18097
+ var _this = this, spotLight = _this._spotLights, pointLight = _this._pointLights, directLight = _this._directLights;
18098
+ var _this1 = this, spotData = _this1._spotData, pointData = _this1._pointData, directData = _this1._directData;
18117
18099
  var spotLightCount = spotLight.length;
18118
18100
  var pointLightCount = pointLight.length;
18119
18101
  var directLightCount = directLight.length;
18120
- for(var i = 0, len = spotLightCount; i < len; i++){
18121
- var light = spotLight.get(i);
18122
- light._appendData(i);
18102
+ for(var i = 0; i < spotLightCount; i++){
18103
+ spotLight.get(i)._appendData(i, spotData);
18123
18104
  }
18124
- for(var i1 = 0, len1 = pointLightCount; i1 < len1; i1++){
18125
- var light1 = pointLight.get(i1);
18126
- light1._appendData(i1);
18105
+ for(var i1 = 0; i1 < pointLightCount; i1++){
18106
+ pointLight.get(i1)._appendData(i1, pointData);
18127
18107
  }
18128
- for(var i2 = 0, len2 = directLightCount; i2 < len2; i2++){
18129
- var light2 = directLight.get(i2);
18130
- light2._appendData(i2);
18108
+ for(var i2 = 0; i2 < directLightCount; i2++){
18109
+ directLight.get(i2)._appendData(i2, directData);
18131
18110
  }
18132
18111
  if (directLightCount) {
18133
- DirectLight._updateShaderData(shaderData);
18112
+ DirectLight._updateShaderData(shaderData, directData);
18134
18113
  shaderData.enableMacro("SCENE_DIRECT_LIGHT_COUNT", directLightCount.toString());
18135
18114
  } else {
18136
18115
  shaderData.disableMacro("SCENE_DIRECT_LIGHT_COUNT");
18137
18116
  }
18138
18117
  if (pointLightCount) {
18139
- PointLight._updateShaderData(shaderData);
18118
+ PointLight._updateShaderData(shaderData, pointData);
18140
18119
  shaderData.enableMacro("SCENE_POINT_LIGHT_COUNT", pointLightCount.toString());
18141
18120
  } else {
18142
18121
  shaderData.disableMacro("SCENE_POINT_LIGHT_COUNT");
18143
18122
  }
18144
18123
  if (spotLightCount) {
18145
- SpotLight._updateShaderData(shaderData);
18124
+ SpotLight._updateShaderData(shaderData, spotData);
18146
18125
  shaderData.enableMacro("SCENE_SPOT_LIGHT_COUNT", spotLightCount.toString());
18147
18126
  } else {
18148
18127
  shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
@@ -18183,6 +18162,11 @@ __decorate([
18183
18162
  };
18184
18163
  return LightManager;
18185
18164
  }();
18165
+ (function() {
18166
+ /**
18167
+ * Each type of light source is at most 10, beyond which it will not take effect.
18168
+ * */ LightManager._maxLight = 10;
18169
+ })();
18186
18170
 
18187
18171
  /**
18188
18172
  * Scene.
@@ -18921,7 +18905,7 @@ var passNum = 0;
18921
18905
  _proto.drawBatches = function drawBatches(camera) {
18922
18906
  var _this = this, engine = _this._engine, batchedQueue = _this._batchedQueue;
18923
18907
  var mesh = this._meshes[this._flushId];
18924
- var subMeshes = mesh.subMeshes;
18908
+ var subMeshes = mesh.subMeshes, primitive = mesh._primitive;
18925
18909
  var maskManager = engine._spriteMaskManager;
18926
18910
  var sceneData = camera.scene.shaderData;
18927
18911
  var cameraData = camera.shaderData;
@@ -18951,7 +18935,7 @@ var passNum = 0;
18951
18935
  program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
18952
18936
  program.uploadAll(program.materialUniformBlock, material.shaderData);
18953
18937
  material.renderState._apply(engine, false, shaderPass._renderStateDataMap, material.shaderData);
18954
- engine._hardwareRenderer.drawPrimitive(mesh._primitive, subMesh, program);
18938
+ engine._hardwareRenderer.drawPrimitive(primitive, subMesh, program);
18955
18939
  maskManager.postRender(renderer);
18956
18940
  }
18957
18941
  };
@@ -24308,16 +24292,22 @@ AnimationCurveOwner.registerAssembler(Transform, "scale", ScaleAnimationCurveOwn
24308
24292
  /**
24309
24293
  * @internal
24310
24294
  */ var BlendShapeWeightsAnimationCurveOwnerAssembler = /*#__PURE__*/ function() {
24311
- function BlendShapeWeightsAnimationCurveOwnerAssembler() {}
24295
+ function BlendShapeWeightsAnimationCurveOwnerAssembler() {
24296
+ this._skinnedMeshRenderer = [];
24297
+ }
24312
24298
  var _proto = BlendShapeWeightsAnimationCurveOwnerAssembler.prototype;
24313
24299
  _proto.initialize = function initialize(owner) {
24314
- this._skinnedMeshRenderer = owner.target.getComponent(SkinnedMeshRenderer);
24300
+ // @todo: Compatible with multiple SkinnedMeshRenderer in a entity, optimize later.
24301
+ owner.target.getComponents(SkinnedMeshRenderer, this._skinnedMeshRenderer);
24315
24302
  };
24316
24303
  _proto.getTargetValue = function getTargetValue() {
24317
- return this._skinnedMeshRenderer.blendShapeWeights;
24304
+ return this._skinnedMeshRenderer[0].blendShapeWeights;
24318
24305
  };
24319
24306
  _proto.setTargetValue = function setTargetValue(value) {
24320
- this._skinnedMeshRenderer.blendShapeWeights = value;
24307
+ var skinnedMeshRenderer = this._skinnedMeshRenderer;
24308
+ for(var i = 0, n = skinnedMeshRenderer.length; i < n; i++){
24309
+ skinnedMeshRenderer[i].blendShapeWeights = value;
24310
+ }
24321
24311
  };
24322
24312
  return BlendShapeWeightsAnimationCurveOwnerAssembler;
24323
24313
  }();
@@ -27714,15 +27704,13 @@ var MainModule = /*#__PURE__*/ function() {
27714
27704
  /** The initial lifetime of particles when emitted. */ this.startLifetime = new ParticleCompositeCurve(5);
27715
27705
  /** The initial speed of particles when the Particle Generator first spawns them. */ this.startSpeed = new ParticleCompositeCurve(5);
27716
27706
  /** 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
27707
  /** The initial size of particles along the x-axis when the Particle Generator first spawns them. */ this.startSizeX = new ParticleCompositeCurve(1);
27719
27708
  /** The initial size of particles along the y-axis when the Particle Generator first spawns them. */ this.startSizeY = new ParticleCompositeCurve(1);
27720
27709
  /** 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);
27710
+ /** A flag to enable 3D particle rotation, when disabled, only `startRotationZ` is used. */ this.startRotation3D = false;
27723
27711
  /** The initial rotation of particles around the x-axis when emitted.*/ this.startRotationX = new ParticleCompositeCurve(0);
27724
27712
  /** The initial rotation of particles around the y-axis when emitted. */ this.startRotationY = new ParticleCompositeCurve(0);
27725
- this.startRotationZ = new ParticleCompositeCurve(0);
27713
+ /** The initial rotation of particles around the z-axis when emitted. */ this.startRotationZ = new ParticleCompositeCurve(0);
27726
27714
  /** Makes some particles spin in the opposite direction. */ this.flipRotation = 0;
27727
27715
  /** The mode of start color */ this.startColor = new ParticleCompositeGradient(new miniprogram.Color(1, 1, 1, 1));
27728
27716
  /** A scale that this Particle Generator applies to gravity, defined by Physics.gravity. */ this.gravityModifier = new ParticleCompositeCurve(0);
@@ -27825,6 +27813,17 @@ var MainModule = /*#__PURE__*/ function() {
27825
27813
  }
27826
27814
  }
27827
27815
  }
27816
+ },
27817
+ {
27818
+ key: "startSize",
27819
+ get: /**
27820
+ * The initial size of particles when the Particle Generator first spawns them.
27821
+ */ function get() {
27822
+ return this.startSizeX;
27823
+ },
27824
+ set: function set(value) {
27825
+ this.startSizeX = value;
27826
+ }
27828
27827
  }
27829
27828
  ]);
27830
27829
  return MainModule;
@@ -27868,9 +27867,6 @@ __decorate([
27868
27867
  __decorate([
27869
27868
  deepClone
27870
27869
  ], MainModule.prototype, "startSpeed", void 0);
27871
- __decorate([
27872
- deepClone
27873
- ], MainModule.prototype, "startSize", void 0);
27874
27870
  __decorate([
27875
27871
  deepClone
27876
27872
  ], MainModule.prototype, "startSizeX", void 0);
@@ -27880,9 +27876,6 @@ __decorate([
27880
27876
  __decorate([
27881
27877
  deepClone
27882
27878
  ], MainModule.prototype, "startSizeZ", void 0);
27883
- __decorate([
27884
- deepClone
27885
- ], MainModule.prototype, "startRotation", void 0);
27886
27879
  __decorate([
27887
27880
  deepClone
27888
27881
  ], MainModule.prototype, "startRotationX", void 0);
@@ -27890,7 +27883,6 @@ __decorate([
27890
27883
  deepClone
27891
27884
  ], MainModule.prototype, "startRotationY", void 0);
27892
27885
  __decorate([
27893
- deepClone,
27894
27886
  deepClone
27895
27887
  ], MainModule.prototype, "startRotationZ", void 0);
27896
27888
  __decorate([
@@ -27931,7 +27923,7 @@ __decorate([
27931
27923
  function RotationOverLifetimeModule() {
27932
27924
  var _this;
27933
27925
  _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;
27926
+ /** Specifies whether the rotation is separate on each axis, when disabled, only `rotationZ` is used. */ _this.separateAxes = false;
27935
27927
  /** Rotation over lifetime for z axis. */ _this.rotationX = new ParticleCompositeCurve(0);
27936
27928
  /** Rotation over lifetime for z axis. */ _this.rotationY = new ParticleCompositeCurve(0);
27937
27929
  /** Rotation over lifetime for z axis. */ _this.rotationZ = new ParticleCompositeCurve(45);
@@ -28285,9 +28277,6 @@ __decorate([
28285
28277
  }
28286
28278
  var _proto = TextureSheetAnimationModule.prototype;
28287
28279
  /**
28288
- * @inheritDoc
28289
- */ _proto.cloneTo = function cloneTo(dest) {};
28290
- /**
28291
28280
  * @internal
28292
28281
  */ _proto._updateShaderData = function _updateShaderData(shaderData) {
28293
28282
  var frameMacro = null;
@@ -28775,7 +28764,7 @@ __decorate([
28775
28764
  instanceVertices[offset + 16] = miniprogram.MathUtil.degreeToRadian(main.startRotationY.evaluate(undefined, startRotationRand.random()));
28776
28765
  instanceVertices[offset + 17] = miniprogram.MathUtil.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
28777
28766
  } else {
28778
- instanceVertices[offset + 15] = miniprogram.MathUtil.degreeToRadian(main.startRotation.evaluate(undefined, startRotationRand.random()));
28767
+ instanceVertices[offset + 15] = miniprogram.MathUtil.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
28779
28768
  }
28780
28769
  // Start speed
28781
28770
  instanceVertices[offset + 18] = startSpeed;