@galacean/engine 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.
package/dist/browser.js CHANGED
@@ -17091,7 +17091,7 @@
17091
17091
  _proto.drawBatches = function drawBatches(camera) {
17092
17092
  var _this = this, engine = _this._engine, batchedQueue = _this._batchedQueue;
17093
17093
  var mesh = this._meshes[this._flushId];
17094
- var subMeshes = mesh.subMeshes;
17094
+ var subMeshes = mesh.subMeshes, primitive = mesh._primitive;
17095
17095
  var sceneData = camera.scene.shaderData;
17096
17096
  var cameraData = camera.shaderData;
17097
17097
  for(var i = 0, len = subMeshes.length; i < len; i++){
@@ -17123,7 +17123,7 @@
17123
17123
  program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
17124
17124
  program.uploadAll(program.materialUniformBlock, material.shaderData);
17125
17125
  material.renderState._apply(engine, false, pass._renderStateDataMap, material.shaderData);
17126
- engine._hardwareRenderer.drawPrimitive(mesh._primitive, subMesh, program);
17126
+ engine._hardwareRenderer.drawPrimitive(primitive, subMesh, program);
17127
17127
  }
17128
17128
  };
17129
17129
  return SpriteMaskBatcher;
@@ -22381,11 +22381,6 @@
22381
22381
  ]);
22382
22382
  return Light;
22383
22383
  }(Component);
22384
- (function() {
22385
- /**
22386
- * Each type of light source is at most 10, beyond which it will not take effect.
22387
- * */ Light._maxLight = 10;
22388
- })();
22389
22384
  __decorate$1([
22390
22385
  ignoreClone
22391
22386
  ], Light.prototype, "_lightIndex", void 0);
@@ -22402,13 +22397,12 @@
22402
22397
  var _proto = DirectLight.prototype;
22403
22398
  /**
22404
22399
  * @internal
22405
- */ _proto._appendData = function _appendData(lightIndex) {
22400
+ */ _proto._appendData = function _appendData(lightIndex, data) {
22406
22401
  var cullingMaskStart = lightIndex * 2;
22407
22402
  var colorStart = lightIndex * 3;
22408
22403
  var directionStart = lightIndex * 3;
22409
22404
  var lightColor = this._getLightIntensityColor();
22410
22405
  var direction = this.direction;
22411
- var data = DirectLight._combinedData;
22412
22406
  var cullingMask = this.cullingMask;
22413
22407
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
22414
22408
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
@@ -22437,8 +22431,7 @@
22437
22431
  };
22438
22432
  /**
22439
22433
  * @internal
22440
- */ DirectLight._updateShaderData = function _updateShaderData(shaderData) {
22441
- var data = DirectLight._combinedData;
22434
+ */ DirectLight._updateShaderData = function _updateShaderData(shaderData, data) {
22442
22435
  shaderData.setIntArray(DirectLight._cullingMaskProperty, data.cullingMask);
22443
22436
  shaderData.setFloatArray(DirectLight._colorProperty, data.color);
22444
22437
  shaderData.setFloatArray(DirectLight._directionProperty, data.direction);
@@ -22481,13 +22474,6 @@
22481
22474
  (function() {
22482
22475
  DirectLight._directionProperty = ShaderProperty.getByName("scene_DirectLightDirection");
22483
22476
  })();
22484
- (function() {
22485
- DirectLight._combinedData = {
22486
- cullingMask: new Int32Array(Light._maxLight * 2),
22487
- color: new Float32Array(Light._maxLight * 3),
22488
- direction: new Float32Array(Light._maxLight * 3)
22489
- };
22490
- })();
22491
22477
  /**
22492
22478
  * Point light.
22493
22479
  */ var PointLight = /*#__PURE__*/ function(Light1) {
@@ -22501,14 +22487,13 @@
22501
22487
  var _proto = PointLight.prototype;
22502
22488
  /**
22503
22489
  * @internal
22504
- */ _proto._appendData = function _appendData(lightIndex) {
22490
+ */ _proto._appendData = function _appendData(lightIndex, data) {
22505
22491
  var cullingMaskStart = lightIndex * 2;
22506
22492
  var colorStart = lightIndex * 3;
22507
22493
  var positionStart = lightIndex * 3;
22508
22494
  var distanceStart = lightIndex;
22509
22495
  var lightColor = this._getLightIntensityColor();
22510
22496
  var lightPosition = this.position;
22511
- var data = PointLight._combinedData;
22512
22497
  var cullingMask = this.cullingMask;
22513
22498
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
22514
22499
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
@@ -22538,8 +22523,7 @@
22538
22523
  };
22539
22524
  /**
22540
22525
  * @internal
22541
- */ PointLight._updateShaderData = function _updateShaderData(shaderData) {
22542
- var data = PointLight._combinedData;
22526
+ */ PointLight._updateShaderData = function _updateShaderData(shaderData, data) {
22543
22527
  shaderData.setIntArray(PointLight._cullingMaskProperty, data.cullingMask);
22544
22528
  shaderData.setFloatArray(PointLight._colorProperty, data.color);
22545
22529
  shaderData.setFloatArray(PointLight._positionProperty, data.position);
@@ -22577,14 +22561,6 @@
22577
22561
  (function() {
22578
22562
  PointLight._distanceProperty = ShaderProperty.getByName("scene_PointLightDistance");
22579
22563
  })();
22580
- (function() {
22581
- PointLight._combinedData = {
22582
- cullingMask: new Int32Array(Light._maxLight * 2),
22583
- color: new Float32Array(Light._maxLight * 3),
22584
- position: new Float32Array(Light._maxLight * 3),
22585
- distance: new Float32Array(Light._maxLight)
22586
- };
22587
- })();
22588
22564
  /**
22589
22565
  * Spot light.
22590
22566
  */ var SpotLight = /*#__PURE__*/ function(Light1) {
@@ -22602,7 +22578,7 @@
22602
22578
  var _proto = SpotLight.prototype;
22603
22579
  /**
22604
22580
  * @internal
22605
- */ _proto._appendData = function _appendData(lightIndex) {
22581
+ */ _proto._appendData = function _appendData(lightIndex, data) {
22606
22582
  var cullingMaskStart = lightIndex * 2;
22607
22583
  var colorStart = lightIndex * 3;
22608
22584
  var positionStart = lightIndex * 3;
@@ -22613,7 +22589,6 @@
22613
22589
  var lightColor = this._getLightIntensityColor();
22614
22590
  var position = this.position;
22615
22591
  var direction = this.direction;
22616
- var data = SpotLight._combinedData;
22617
22592
  var cullingMask = this.cullingMask;
22618
22593
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
22619
22594
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
@@ -22648,8 +22623,7 @@
22648
22623
  };
22649
22624
  /**
22650
22625
  * @internal
22651
- */ SpotLight._updateShaderData = function _updateShaderData(shaderData) {
22652
- var data = SpotLight._combinedData;
22626
+ */ SpotLight._updateShaderData = function _updateShaderData(shaderData, data) {
22653
22627
  shaderData.setIntArray(SpotLight._cullingMaskProperty, data.cullingMask);
22654
22628
  shaderData.setFloatArray(SpotLight._colorProperty, data.color);
22655
22629
  shaderData.setFloatArray(SpotLight._positionProperty, data.position);
@@ -22719,25 +22693,34 @@
22719
22693
  (function() {
22720
22694
  SpotLight._penumbraCosProperty = ShaderProperty.getByName("scene_SpotLightPenumbraCos");
22721
22695
  })();
22722
- (function() {
22723
- SpotLight._combinedData = {
22724
- cullingMask: new Int32Array(Light._maxLight * 2),
22725
- color: new Float32Array(Light._maxLight * 3),
22726
- position: new Float32Array(Light._maxLight * 3),
22727
- direction: new Float32Array(Light._maxLight * 3),
22728
- distance: new Float32Array(Light._maxLight),
22729
- angleCos: new Float32Array(Light._maxLight),
22730
- penumbraCos: new Float32Array(Light._maxLight)
22731
- };
22732
- })();
22733
22696
  /**
22734
22697
  * Light manager.
22735
22698
  */ var LightManager = /*#__PURE__*/ function() {
22736
- var LightManager = function LightManager() {
22699
+ function LightManager() {
22737
22700
  /** @internal */ this._spotLights = new DisorderedArray();
22738
22701
  /** @internal */ this._pointLights = new DisorderedArray();
22739
22702
  /** @internal */ this._directLights = new DisorderedArray();
22740
- };
22703
+ this._directData = {
22704
+ cullingMask: new Int32Array(LightManager._maxLight * 2),
22705
+ color: new Float32Array(LightManager._maxLight * 3),
22706
+ direction: new Float32Array(LightManager._maxLight * 3)
22707
+ };
22708
+ this._pointData = {
22709
+ cullingMask: new Int32Array(LightManager._maxLight * 2),
22710
+ color: new Float32Array(LightManager._maxLight * 3),
22711
+ position: new Float32Array(LightManager._maxLight * 3),
22712
+ distance: new Float32Array(LightManager._maxLight)
22713
+ };
22714
+ this._spotData = {
22715
+ cullingMask: new Int32Array(LightManager._maxLight * 2),
22716
+ color: new Float32Array(LightManager._maxLight * 3),
22717
+ position: new Float32Array(LightManager._maxLight * 3),
22718
+ direction: new Float32Array(LightManager._maxLight * 3),
22719
+ distance: new Float32Array(LightManager._maxLight),
22720
+ angleCos: new Float32Array(LightManager._maxLight),
22721
+ penumbraCos: new Float32Array(LightManager._maxLight)
22722
+ };
22723
+ }
22741
22724
  var _proto = LightManager.prototype;
22742
22725
  /**
22743
22726
  * @internal
@@ -22796,38 +22779,34 @@
22796
22779
  /**
22797
22780
  * @internal
22798
22781
  */ _proto._updateShaderData = function _updateShaderData(shaderData) {
22799
- var spotLight = this._spotLights;
22800
- var pointLight = this._pointLights;
22801
- var directLight = this._directLights;
22782
+ var _this = this, spotLight = _this._spotLights, pointLight = _this._pointLights, directLight = _this._directLights;
22783
+ var _this1 = this, spotData = _this1._spotData, pointData = _this1._pointData, directData = _this1._directData;
22802
22784
  var spotLightCount = spotLight.length;
22803
22785
  var pointLightCount = pointLight.length;
22804
22786
  var directLightCount = directLight.length;
22805
- for(var i = 0, len = spotLightCount; i < len; i++){
22806
- var light = spotLight.get(i);
22807
- light._appendData(i);
22787
+ for(var i = 0; i < spotLightCount; i++){
22788
+ spotLight.get(i)._appendData(i, spotData);
22808
22789
  }
22809
- for(var i1 = 0, len1 = pointLightCount; i1 < len1; i1++){
22810
- var light1 = pointLight.get(i1);
22811
- light1._appendData(i1);
22790
+ for(var i1 = 0; i1 < pointLightCount; i1++){
22791
+ pointLight.get(i1)._appendData(i1, pointData);
22812
22792
  }
22813
- for(var i2 = 0, len2 = directLightCount; i2 < len2; i2++){
22814
- var light2 = directLight.get(i2);
22815
- light2._appendData(i2);
22793
+ for(var i2 = 0; i2 < directLightCount; i2++){
22794
+ directLight.get(i2)._appendData(i2, directData);
22816
22795
  }
22817
22796
  if (directLightCount) {
22818
- DirectLight._updateShaderData(shaderData);
22797
+ DirectLight._updateShaderData(shaderData, directData);
22819
22798
  shaderData.enableMacro("SCENE_DIRECT_LIGHT_COUNT", directLightCount.toString());
22820
22799
  } else {
22821
22800
  shaderData.disableMacro("SCENE_DIRECT_LIGHT_COUNT");
22822
22801
  }
22823
22802
  if (pointLightCount) {
22824
- PointLight._updateShaderData(shaderData);
22803
+ PointLight._updateShaderData(shaderData, pointData);
22825
22804
  shaderData.enableMacro("SCENE_POINT_LIGHT_COUNT", pointLightCount.toString());
22826
22805
  } else {
22827
22806
  shaderData.disableMacro("SCENE_POINT_LIGHT_COUNT");
22828
22807
  }
22829
22808
  if (spotLightCount) {
22830
- SpotLight._updateShaderData(shaderData);
22809
+ SpotLight._updateShaderData(shaderData, spotData);
22831
22810
  shaderData.enableMacro("SCENE_SPOT_LIGHT_COUNT", spotLightCount.toString());
22832
22811
  } else {
22833
22812
  shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
@@ -22868,6 +22847,11 @@
22868
22847
  };
22869
22848
  return LightManager;
22870
22849
  }();
22850
+ (function() {
22851
+ /**
22852
+ * Each type of light source is at most 10, beyond which it will not take effect.
22853
+ * */ LightManager._maxLight = 10;
22854
+ })();
22871
22855
  /**
22872
22856
  * Scene.
22873
22857
  */ var Scene = /*#__PURE__*/ function(EngineObject1) {
@@ -23601,7 +23585,7 @@
23601
23585
  _proto.drawBatches = function drawBatches(camera) {
23602
23586
  var _this = this, engine = _this._engine, batchedQueue = _this._batchedQueue;
23603
23587
  var mesh = this._meshes[this._flushId];
23604
- var subMeshes = mesh.subMeshes;
23588
+ var subMeshes = mesh.subMeshes, primitive = mesh._primitive;
23605
23589
  var maskManager = engine._spriteMaskManager;
23606
23590
  var sceneData = camera.scene.shaderData;
23607
23591
  var cameraData = camera.shaderData;
@@ -23631,7 +23615,7 @@
23631
23615
  program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
23632
23616
  program.uploadAll(program.materialUniformBlock, material.shaderData);
23633
23617
  material.renderState._apply(engine, false, shaderPass._renderStateDataMap, material.shaderData);
23634
- engine._hardwareRenderer.drawPrimitive(mesh._primitive, subMesh, program);
23618
+ engine._hardwareRenderer.drawPrimitive(primitive, subMesh, program);
23635
23619
  maskManager.postRender(renderer);
23636
23620
  }
23637
23621
  };
@@ -28948,16 +28932,22 @@
28948
28932
  /**
28949
28933
  * @internal
28950
28934
  */ var BlendShapeWeightsAnimationCurveOwnerAssembler = /*#__PURE__*/ function() {
28951
- var BlendShapeWeightsAnimationCurveOwnerAssembler = function BlendShapeWeightsAnimationCurveOwnerAssembler() {};
28935
+ var BlendShapeWeightsAnimationCurveOwnerAssembler = function BlendShapeWeightsAnimationCurveOwnerAssembler() {
28936
+ this._skinnedMeshRenderer = [];
28937
+ };
28952
28938
  var _proto = BlendShapeWeightsAnimationCurveOwnerAssembler.prototype;
28953
28939
  _proto.initialize = function initialize(owner) {
28954
- this._skinnedMeshRenderer = owner.target.getComponent(SkinnedMeshRenderer);
28940
+ // @todo: Compatible with multiple SkinnedMeshRenderer in a entity, optimize later.
28941
+ owner.target.getComponents(SkinnedMeshRenderer, this._skinnedMeshRenderer);
28955
28942
  };
28956
28943
  _proto.getTargetValue = function getTargetValue() {
28957
- return this._skinnedMeshRenderer.blendShapeWeights;
28944
+ return this._skinnedMeshRenderer[0].blendShapeWeights;
28958
28945
  };
28959
28946
  _proto.setTargetValue = function setTargetValue(value) {
28960
- this._skinnedMeshRenderer.blendShapeWeights = value;
28947
+ var skinnedMeshRenderer = this._skinnedMeshRenderer;
28948
+ for(var i = 0, n = skinnedMeshRenderer.length; i < n; i++){
28949
+ skinnedMeshRenderer[i].blendShapeWeights = value;
28950
+ }
28961
28951
  };
28962
28952
  return BlendShapeWeightsAnimationCurveOwnerAssembler;
28963
28953
  }();
@@ -32298,15 +32288,13 @@
32298
32288
  /** The initial lifetime of particles when emitted. */ this.startLifetime = new ParticleCompositeCurve(5);
32299
32289
  /** The initial speed of particles when the Particle Generator first spawns them. */ this.startSpeed = new ParticleCompositeCurve(5);
32300
32290
  /** A flag to enable specifying particle size individually for each axis. */ this.startSize3D = false;
32301
- /** The initial size of particles when the Particle Generator first spawns them. */ this.startSize = new ParticleCompositeCurve(1);
32302
32291
  /** The initial size of particles along the x-axis when the Particle Generator first spawns them. */ this.startSizeX = new ParticleCompositeCurve(1);
32303
32292
  /** The initial size of particles along the y-axis when the Particle Generator first spawns them. */ this.startSizeY = new ParticleCompositeCurve(1);
32304
32293
  /** The initial size of particles along the z-axis when the Particle Generator first spawns them. */ this.startSizeZ = new ParticleCompositeCurve(1);
32305
- /** A flag to enable 3D particle rotation. */ this.startRotation3D = false;
32306
- /** The initial rotation of particles when the Particle Generator first spawns them. */ this.startRotation = new ParticleCompositeCurve(0);
32294
+ /** A flag to enable 3D particle rotation, when disabled, only `startRotationZ` is used. */ this.startRotation3D = false;
32307
32295
  /** The initial rotation of particles around the x-axis when emitted.*/ this.startRotationX = new ParticleCompositeCurve(0);
32308
32296
  /** The initial rotation of particles around the y-axis when emitted. */ this.startRotationY = new ParticleCompositeCurve(0);
32309
- this.startRotationZ = new ParticleCompositeCurve(0);
32297
+ /** The initial rotation of particles around the z-axis when emitted. */ this.startRotationZ = new ParticleCompositeCurve(0);
32310
32298
  /** Makes some particles spin in the opposite direction. */ this.flipRotation = 0;
32311
32299
  /** The mode of start color */ this.startColor = new ParticleCompositeGradient(new Color$1(1, 1, 1, 1));
32312
32300
  /** A scale that this Particle Generator applies to gravity, defined by Physics.gravity. */ this.gravityModifier = new ParticleCompositeCurve(0);
@@ -32409,6 +32397,17 @@
32409
32397
  }
32410
32398
  }
32411
32399
  }
32400
+ },
32401
+ {
32402
+ key: "startSize",
32403
+ get: /**
32404
+ * The initial size of particles when the Particle Generator first spawns them.
32405
+ */ function get() {
32406
+ return this.startSizeX;
32407
+ },
32408
+ set: function set(value) {
32409
+ this.startSizeX = value;
32410
+ }
32412
32411
  }
32413
32412
  ]);
32414
32413
  return MainModule;
@@ -32452,9 +32451,6 @@
32452
32451
  __decorate$1([
32453
32452
  deepClone
32454
32453
  ], MainModule.prototype, "startSpeed", void 0);
32455
- __decorate$1([
32456
- deepClone
32457
- ], MainModule.prototype, "startSize", void 0);
32458
32454
  __decorate$1([
32459
32455
  deepClone
32460
32456
  ], MainModule.prototype, "startSizeX", void 0);
@@ -32464,9 +32460,6 @@
32464
32460
  __decorate$1([
32465
32461
  deepClone
32466
32462
  ], MainModule.prototype, "startSizeZ", void 0);
32467
- __decorate$1([
32468
- deepClone
32469
- ], MainModule.prototype, "startRotation", void 0);
32470
32463
  __decorate$1([
32471
32464
  deepClone
32472
32465
  ], MainModule.prototype, "startRotationX", void 0);
@@ -32474,7 +32467,6 @@
32474
32467
  deepClone
32475
32468
  ], MainModule.prototype, "startRotationY", void 0);
32476
32469
  __decorate$1([
32477
- deepClone,
32478
32470
  deepClone
32479
32471
  ], MainModule.prototype, "startRotationZ", void 0);
32480
32472
  __decorate$1([
@@ -32513,7 +32505,7 @@
32513
32505
  var RotationOverLifetimeModule = function RotationOverLifetimeModule() {
32514
32506
  var _this;
32515
32507
  _this = ParticleGeneratorModule1.apply(this, arguments) || this;
32516
- /** Specifies whether the rotation is separate on each axis, when disabled only z axis is used. */ _this.separateAxes = false;
32508
+ /** Specifies whether the rotation is separate on each axis, when disabled, only `rotationZ` is used. */ _this.separateAxes = false;
32517
32509
  /** Rotation over lifetime for z axis. */ _this.rotationX = new ParticleCompositeCurve(0);
32518
32510
  /** Rotation over lifetime for z axis. */ _this.rotationY = new ParticleCompositeCurve(0);
32519
32511
  /** Rotation over lifetime for z axis. */ _this.rotationZ = new ParticleCompositeCurve(45);
@@ -32865,9 +32857,6 @@
32865
32857
  _inherits$2(TextureSheetAnimationModule, ParticleGeneratorModule1);
32866
32858
  var _proto = TextureSheetAnimationModule.prototype;
32867
32859
  /**
32868
- * @inheritDoc
32869
- */ _proto.cloneTo = function cloneTo(dest) {};
32870
- /**
32871
32860
  * @internal
32872
32861
  */ _proto._updateShaderData = function _updateShaderData(shaderData) {
32873
32862
  var frameMacro = null;
@@ -33353,7 +33342,7 @@
33353
33342
  instanceVertices[offset + 16] = MathUtil$1.degreeToRadian(main.startRotationY.evaluate(undefined, startRotationRand.random()));
33354
33343
  instanceVertices[offset + 17] = MathUtil$1.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
33355
33344
  } else {
33356
- instanceVertices[offset + 15] = MathUtil$1.degreeToRadian(main.startRotation.evaluate(undefined, startRotationRand.random()));
33345
+ instanceVertices[offset + 15] = MathUtil$1.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
33357
33346
  }
33358
33347
  // Start speed
33359
33348
  instanceVertices[offset + 18] = startSpeed;
@@ -40473,12 +40462,12 @@
40473
40462
  if (curve2.interpolation === exports.InterpolationType.CubicSpine) {
40474
40463
  keyframe2.inTangent = Array.from(output.subarray(offset2, offset2 + outputSize));
40475
40464
  offset2 += outputSize;
40476
- keyframe2.value = output.subarray(offset2, offset2 + outputSize);
40465
+ keyframe2.value = output.slice(offset2, offset2 + outputSize);
40477
40466
  offset2 += outputSize;
40478
40467
  keyframe2.outTangent = Array.from(output.subarray(offset2, offset2 + outputSize));
40479
40468
  offset2 += outputSize;
40480
40469
  } else {
40481
- keyframe2.value = output.subarray(offset2, offset2 + outputSize);
40470
+ keyframe2.value = output.slice(offset2, offset2 + outputSize);
40482
40471
  offset2 += outputSize;
40483
40472
  }
40484
40473
  curve2.addKey(keyframe2);
@@ -42906,7 +42895,7 @@
42906
42895
  ], GALACEAN_animation_event);
42907
42896
 
42908
42897
  //@ts-ignore
42909
- var version = "1.1.0-beta.2";
42898
+ var version = "1.1.0-beta.4";
42910
42899
  console.log("Galacean engine version: " + version);
42911
42900
  for(var key in CoreObjects){
42912
42901
  Loader.registerClass(key, CoreObjects[key]);