@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/module.js CHANGED
@@ -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(mesh._primitive, subMesh, program);
12344
+ engine._hardwareRenderer.drawPrimitive(primitive, subMesh, program);
12345
12345
  }
12346
12346
  };
12347
12347
  return SpriteMaskBatcher;
@@ -17687,11 +17687,6 @@ ShaderPool.init();
17687
17687
  ]);
17688
17688
  return Light;
17689
17689
  }(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
17690
  __decorate([
17696
17691
  ignoreClone
17697
17692
  ], Light.prototype, "_lightIndex", void 0);
@@ -17709,13 +17704,12 @@ __decorate([
17709
17704
  var _proto = DirectLight.prototype;
17710
17705
  /**
17711
17706
  * @internal
17712
- */ _proto._appendData = function _appendData(lightIndex) {
17707
+ */ _proto._appendData = function _appendData(lightIndex, data) {
17713
17708
  var cullingMaskStart = lightIndex * 2;
17714
17709
  var colorStart = lightIndex * 3;
17715
17710
  var directionStart = lightIndex * 3;
17716
17711
  var lightColor = this._getLightIntensityColor();
17717
17712
  var direction = this.direction;
17718
- var data = DirectLight._combinedData;
17719
17713
  var cullingMask = this.cullingMask;
17720
17714
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
17721
17715
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
@@ -17744,8 +17738,7 @@ __decorate([
17744
17738
  };
17745
17739
  /**
17746
17740
  * @internal
17747
- */ DirectLight._updateShaderData = function _updateShaderData(shaderData) {
17748
- var data = DirectLight._combinedData;
17741
+ */ DirectLight._updateShaderData = function _updateShaderData(shaderData, data) {
17749
17742
  shaderData.setIntArray(DirectLight._cullingMaskProperty, data.cullingMask);
17750
17743
  shaderData.setFloatArray(DirectLight._colorProperty, data.color);
17751
17744
  shaderData.setFloatArray(DirectLight._directionProperty, data.direction);
@@ -17788,13 +17781,6 @@ __decorate([
17788
17781
  (function() {
17789
17782
  DirectLight._directionProperty = ShaderProperty.getByName("scene_DirectLightDirection");
17790
17783
  })();
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
17784
 
17799
17785
  /**
17800
17786
  * Point light.
@@ -17809,14 +17795,13 @@ __decorate([
17809
17795
  var _proto = PointLight.prototype;
17810
17796
  /**
17811
17797
  * @internal
17812
- */ _proto._appendData = function _appendData(lightIndex) {
17798
+ */ _proto._appendData = function _appendData(lightIndex, data) {
17813
17799
  var cullingMaskStart = lightIndex * 2;
17814
17800
  var colorStart = lightIndex * 3;
17815
17801
  var positionStart = lightIndex * 3;
17816
17802
  var distanceStart = lightIndex;
17817
17803
  var lightColor = this._getLightIntensityColor();
17818
17804
  var lightPosition = this.position;
17819
- var data = PointLight._combinedData;
17820
17805
  var cullingMask = this.cullingMask;
17821
17806
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
17822
17807
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
@@ -17846,8 +17831,7 @@ __decorate([
17846
17831
  };
17847
17832
  /**
17848
17833
  * @internal
17849
- */ PointLight._updateShaderData = function _updateShaderData(shaderData) {
17850
- var data = PointLight._combinedData;
17834
+ */ PointLight._updateShaderData = function _updateShaderData(shaderData, data) {
17851
17835
  shaderData.setIntArray(PointLight._cullingMaskProperty, data.cullingMask);
17852
17836
  shaderData.setFloatArray(PointLight._colorProperty, data.color);
17853
17837
  shaderData.setFloatArray(PointLight._positionProperty, data.position);
@@ -17885,14 +17869,6 @@ __decorate([
17885
17869
  (function() {
17886
17870
  PointLight._distanceProperty = ShaderProperty.getByName("scene_PointLightDistance");
17887
17871
  })();
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
17872
 
17897
17873
  /**
17898
17874
  * Spot light.
@@ -17911,7 +17887,7 @@ __decorate([
17911
17887
  var _proto = SpotLight.prototype;
17912
17888
  /**
17913
17889
  * @internal
17914
- */ _proto._appendData = function _appendData(lightIndex) {
17890
+ */ _proto._appendData = function _appendData(lightIndex, data) {
17915
17891
  var cullingMaskStart = lightIndex * 2;
17916
17892
  var colorStart = lightIndex * 3;
17917
17893
  var positionStart = lightIndex * 3;
@@ -17922,7 +17898,6 @@ __decorate([
17922
17898
  var lightColor = this._getLightIntensityColor();
17923
17899
  var position = this.position;
17924
17900
  var direction = this.direction;
17925
- var data = SpotLight._combinedData;
17926
17901
  var cullingMask = this.cullingMask;
17927
17902
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
17928
17903
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
@@ -17957,8 +17932,7 @@ __decorate([
17957
17932
  };
17958
17933
  /**
17959
17934
  * @internal
17960
- */ SpotLight._updateShaderData = function _updateShaderData(shaderData) {
17961
- var data = SpotLight._combinedData;
17935
+ */ SpotLight._updateShaderData = function _updateShaderData(shaderData, data) {
17962
17936
  shaderData.setIntArray(SpotLight._cullingMaskProperty, data.cullingMask);
17963
17937
  shaderData.setFloatArray(SpotLight._colorProperty, data.color);
17964
17938
  shaderData.setFloatArray(SpotLight._positionProperty, data.position);
@@ -18028,17 +18002,6 @@ __decorate([
18028
18002
  (function() {
18029
18003
  SpotLight._penumbraCosProperty = ShaderProperty.getByName("scene_SpotLightPenumbraCos");
18030
18004
  })();
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
18005
 
18043
18006
  /**
18044
18007
  * Light manager.
@@ -18047,6 +18010,26 @@ __decorate([
18047
18010
  /** @internal */ this._spotLights = new DisorderedArray();
18048
18011
  /** @internal */ this._pointLights = new DisorderedArray();
18049
18012
  /** @internal */ this._directLights = new DisorderedArray();
18013
+ this._directData = {
18014
+ cullingMask: new Int32Array(LightManager._maxLight * 2),
18015
+ color: new Float32Array(LightManager._maxLight * 3),
18016
+ direction: new Float32Array(LightManager._maxLight * 3)
18017
+ };
18018
+ this._pointData = {
18019
+ cullingMask: new Int32Array(LightManager._maxLight * 2),
18020
+ color: new Float32Array(LightManager._maxLight * 3),
18021
+ position: new Float32Array(LightManager._maxLight * 3),
18022
+ distance: new Float32Array(LightManager._maxLight)
18023
+ };
18024
+ this._spotData = {
18025
+ cullingMask: new Int32Array(LightManager._maxLight * 2),
18026
+ color: new Float32Array(LightManager._maxLight * 3),
18027
+ position: new Float32Array(LightManager._maxLight * 3),
18028
+ direction: new Float32Array(LightManager._maxLight * 3),
18029
+ distance: new Float32Array(LightManager._maxLight),
18030
+ angleCos: new Float32Array(LightManager._maxLight),
18031
+ penumbraCos: new Float32Array(LightManager._maxLight)
18032
+ };
18050
18033
  }
18051
18034
  var _proto = LightManager.prototype;
18052
18035
  /**
@@ -18106,38 +18089,34 @@ __decorate([
18106
18089
  /**
18107
18090
  * @internal
18108
18091
  */ _proto._updateShaderData = function _updateShaderData(shaderData) {
18109
- var spotLight = this._spotLights;
18110
- var pointLight = this._pointLights;
18111
- var directLight = this._directLights;
18092
+ var _this = this, spotLight = _this._spotLights, pointLight = _this._pointLights, directLight = _this._directLights;
18093
+ var _this1 = this, spotData = _this1._spotData, pointData = _this1._pointData, directData = _this1._directData;
18112
18094
  var spotLightCount = spotLight.length;
18113
18095
  var pointLightCount = pointLight.length;
18114
18096
  var directLightCount = directLight.length;
18115
- for(var i = 0, len = spotLightCount; i < len; i++){
18116
- var light = spotLight.get(i);
18117
- light._appendData(i);
18097
+ for(var i = 0; i < spotLightCount; i++){
18098
+ spotLight.get(i)._appendData(i, spotData);
18118
18099
  }
18119
- for(var i1 = 0, len1 = pointLightCount; i1 < len1; i1++){
18120
- var light1 = pointLight.get(i1);
18121
- light1._appendData(i1);
18100
+ for(var i1 = 0; i1 < pointLightCount; i1++){
18101
+ pointLight.get(i1)._appendData(i1, pointData);
18122
18102
  }
18123
- for(var i2 = 0, len2 = directLightCount; i2 < len2; i2++){
18124
- var light2 = directLight.get(i2);
18125
- light2._appendData(i2);
18103
+ for(var i2 = 0; i2 < directLightCount; i2++){
18104
+ directLight.get(i2)._appendData(i2, directData);
18126
18105
  }
18127
18106
  if (directLightCount) {
18128
- DirectLight._updateShaderData(shaderData);
18107
+ DirectLight._updateShaderData(shaderData, directData);
18129
18108
  shaderData.enableMacro("SCENE_DIRECT_LIGHT_COUNT", directLightCount.toString());
18130
18109
  } else {
18131
18110
  shaderData.disableMacro("SCENE_DIRECT_LIGHT_COUNT");
18132
18111
  }
18133
18112
  if (pointLightCount) {
18134
- PointLight._updateShaderData(shaderData);
18113
+ PointLight._updateShaderData(shaderData, pointData);
18135
18114
  shaderData.enableMacro("SCENE_POINT_LIGHT_COUNT", pointLightCount.toString());
18136
18115
  } else {
18137
18116
  shaderData.disableMacro("SCENE_POINT_LIGHT_COUNT");
18138
18117
  }
18139
18118
  if (spotLightCount) {
18140
- SpotLight._updateShaderData(shaderData);
18119
+ SpotLight._updateShaderData(shaderData, spotData);
18141
18120
  shaderData.enableMacro("SCENE_SPOT_LIGHT_COUNT", spotLightCount.toString());
18142
18121
  } else {
18143
18122
  shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
@@ -18178,6 +18157,11 @@ __decorate([
18178
18157
  };
18179
18158
  return LightManager;
18180
18159
  }();
18160
+ (function() {
18161
+ /**
18162
+ * Each type of light source is at most 10, beyond which it will not take effect.
18163
+ * */ LightManager._maxLight = 10;
18164
+ })();
18181
18165
 
18182
18166
  /**
18183
18167
  * Scene.
@@ -18916,7 +18900,7 @@ var passNum = 0;
18916
18900
  _proto.drawBatches = function drawBatches(camera) {
18917
18901
  var _this = this, engine = _this._engine, batchedQueue = _this._batchedQueue;
18918
18902
  var mesh = this._meshes[this._flushId];
18919
- var subMeshes = mesh.subMeshes;
18903
+ var subMeshes = mesh.subMeshes, primitive = mesh._primitive;
18920
18904
  var maskManager = engine._spriteMaskManager;
18921
18905
  var sceneData = camera.scene.shaderData;
18922
18906
  var cameraData = camera.shaderData;
@@ -18946,7 +18930,7 @@ var passNum = 0;
18946
18930
  program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
18947
18931
  program.uploadAll(program.materialUniformBlock, material.shaderData);
18948
18932
  material.renderState._apply(engine, false, shaderPass._renderStateDataMap, material.shaderData);
18949
- engine._hardwareRenderer.drawPrimitive(mesh._primitive, subMesh, program);
18933
+ engine._hardwareRenderer.drawPrimitive(primitive, subMesh, program);
18950
18934
  maskManager.postRender(renderer);
18951
18935
  }
18952
18936
  };
@@ -24303,16 +24287,22 @@ AnimationCurveOwner.registerAssembler(Transform, "scale", ScaleAnimationCurveOwn
24303
24287
  /**
24304
24288
  * @internal
24305
24289
  */ var BlendShapeWeightsAnimationCurveOwnerAssembler = /*#__PURE__*/ function() {
24306
- function BlendShapeWeightsAnimationCurveOwnerAssembler() {}
24290
+ function BlendShapeWeightsAnimationCurveOwnerAssembler() {
24291
+ this._skinnedMeshRenderer = [];
24292
+ }
24307
24293
  var _proto = BlendShapeWeightsAnimationCurveOwnerAssembler.prototype;
24308
24294
  _proto.initialize = function initialize(owner) {
24309
- this._skinnedMeshRenderer = owner.target.getComponent(SkinnedMeshRenderer);
24295
+ // @todo: Compatible with multiple SkinnedMeshRenderer in a entity, optimize later.
24296
+ owner.target.getComponents(SkinnedMeshRenderer, this._skinnedMeshRenderer);
24310
24297
  };
24311
24298
  _proto.getTargetValue = function getTargetValue() {
24312
- return this._skinnedMeshRenderer.blendShapeWeights;
24299
+ return this._skinnedMeshRenderer[0].blendShapeWeights;
24313
24300
  };
24314
24301
  _proto.setTargetValue = function setTargetValue(value) {
24315
- this._skinnedMeshRenderer.blendShapeWeights = value;
24302
+ var skinnedMeshRenderer = this._skinnedMeshRenderer;
24303
+ for(var i = 0, n = skinnedMeshRenderer.length; i < n; i++){
24304
+ skinnedMeshRenderer[i].blendShapeWeights = value;
24305
+ }
24316
24306
  };
24317
24307
  return BlendShapeWeightsAnimationCurveOwnerAssembler;
24318
24308
  }();
@@ -27709,15 +27699,13 @@ var MainModule = /*#__PURE__*/ function() {
27709
27699
  /** The initial lifetime of particles when emitted. */ this.startLifetime = new ParticleCompositeCurve(5);
27710
27700
  /** The initial speed of particles when the Particle Generator first spawns them. */ this.startSpeed = new ParticleCompositeCurve(5);
27711
27701
  /** 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
27702
  /** The initial size of particles along the x-axis when the Particle Generator first spawns them. */ this.startSizeX = new ParticleCompositeCurve(1);
27714
27703
  /** The initial size of particles along the y-axis when the Particle Generator first spawns them. */ this.startSizeY = new ParticleCompositeCurve(1);
27715
27704
  /** 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);
27705
+ /** A flag to enable 3D particle rotation, when disabled, only `startRotationZ` is used. */ this.startRotation3D = false;
27718
27706
  /** The initial rotation of particles around the x-axis when emitted.*/ this.startRotationX = new ParticleCompositeCurve(0);
27719
27707
  /** The initial rotation of particles around the y-axis when emitted. */ this.startRotationY = new ParticleCompositeCurve(0);
27720
- this.startRotationZ = new ParticleCompositeCurve(0);
27708
+ /** The initial rotation of particles around the z-axis when emitted. */ this.startRotationZ = new ParticleCompositeCurve(0);
27721
27709
  /** Makes some particles spin in the opposite direction. */ this.flipRotation = 0;
27722
27710
  /** The mode of start color */ this.startColor = new ParticleCompositeGradient(new Color$1(1, 1, 1, 1));
27723
27711
  /** A scale that this Particle Generator applies to gravity, defined by Physics.gravity. */ this.gravityModifier = new ParticleCompositeCurve(0);
@@ -27820,6 +27808,17 @@ var MainModule = /*#__PURE__*/ function() {
27820
27808
  }
27821
27809
  }
27822
27810
  }
27811
+ },
27812
+ {
27813
+ key: "startSize",
27814
+ get: /**
27815
+ * The initial size of particles when the Particle Generator first spawns them.
27816
+ */ function get() {
27817
+ return this.startSizeX;
27818
+ },
27819
+ set: function set(value) {
27820
+ this.startSizeX = value;
27821
+ }
27823
27822
  }
27824
27823
  ]);
27825
27824
  return MainModule;
@@ -27863,9 +27862,6 @@ __decorate([
27863
27862
  __decorate([
27864
27863
  deepClone
27865
27864
  ], MainModule.prototype, "startSpeed", void 0);
27866
- __decorate([
27867
- deepClone
27868
- ], MainModule.prototype, "startSize", void 0);
27869
27865
  __decorate([
27870
27866
  deepClone
27871
27867
  ], MainModule.prototype, "startSizeX", void 0);
@@ -27875,9 +27871,6 @@ __decorate([
27875
27871
  __decorate([
27876
27872
  deepClone
27877
27873
  ], MainModule.prototype, "startSizeZ", void 0);
27878
- __decorate([
27879
- deepClone
27880
- ], MainModule.prototype, "startRotation", void 0);
27881
27874
  __decorate([
27882
27875
  deepClone
27883
27876
  ], MainModule.prototype, "startRotationX", void 0);
@@ -27885,7 +27878,6 @@ __decorate([
27885
27878
  deepClone
27886
27879
  ], MainModule.prototype, "startRotationY", void 0);
27887
27880
  __decorate([
27888
- deepClone,
27889
27881
  deepClone
27890
27882
  ], MainModule.prototype, "startRotationZ", void 0);
27891
27883
  __decorate([
@@ -27926,7 +27918,7 @@ __decorate([
27926
27918
  function RotationOverLifetimeModule() {
27927
27919
  var _this;
27928
27920
  _this = ParticleGeneratorModule1.apply(this, arguments) || this;
27929
- /** Specifies whether the rotation is separate on each axis, when disabled only z axis is used. */ _this.separateAxes = false;
27921
+ /** Specifies whether the rotation is separate on each axis, when disabled, only `rotationZ` is used. */ _this.separateAxes = false;
27930
27922
  /** Rotation over lifetime for z axis. */ _this.rotationX = new ParticleCompositeCurve(0);
27931
27923
  /** Rotation over lifetime for z axis. */ _this.rotationY = new ParticleCompositeCurve(0);
27932
27924
  /** Rotation over lifetime for z axis. */ _this.rotationZ = new ParticleCompositeCurve(45);
@@ -28280,9 +28272,6 @@ __decorate([
28280
28272
  }
28281
28273
  var _proto = TextureSheetAnimationModule.prototype;
28282
28274
  /**
28283
- * @inheritDoc
28284
- */ _proto.cloneTo = function cloneTo(dest) {};
28285
- /**
28286
28275
  * @internal
28287
28276
  */ _proto._updateShaderData = function _updateShaderData(shaderData) {
28288
28277
  var frameMacro = null;
@@ -28770,7 +28759,7 @@ __decorate([
28770
28759
  instanceVertices[offset + 16] = MathUtil$1.degreeToRadian(main.startRotationY.evaluate(undefined, startRotationRand.random()));
28771
28760
  instanceVertices[offset + 17] = MathUtil$1.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
28772
28761
  } else {
28773
- instanceVertices[offset + 15] = MathUtil$1.degreeToRadian(main.startRotation.evaluate(undefined, startRotationRand.random()));
28762
+ instanceVertices[offset + 15] = MathUtil$1.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
28774
28763
  }
28775
28764
  // Start speed
28776
28765
  instanceVertices[offset + 18] = startSpeed;