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