@galacean/effects-core 2.3.0 → 2.3.2

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/camera.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Vector3 } from '@galacean/effects-math/es/core/vector3';
2
- import type { Quaternion } from '@galacean/effects-math/es/core/quaternion';
2
+ import { Quaternion } from '@galacean/effects-math/es/core/quaternion';
3
3
  import { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
4
- import type { Euler } from '@galacean/effects-math/es/core/euler';
4
+ import { Euler } from '@galacean/effects-math/es/core/euler';
5
5
  import * as spec from '@galacean/effects-specification';
6
6
  import { Transform } from './transform';
7
7
  interface CameraOptionsBase {
@@ -95,7 +95,6 @@ export declare class ShapeComponent extends MeshComponent {
95
95
  private hasFill;
96
96
  private shapeDirty;
97
97
  private graphicsPath;
98
- private curveValues;
99
98
  private fillAttribute;
100
99
  private strokeAttributes;
101
100
  private shapeAttribute;
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime core for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.3.0
6
+ * Version: v2.3.2
7
7
  */
8
8
 
9
9
  'use strict';
@@ -930,10 +930,10 @@ var PluginSystem = /*#__PURE__*/ function() {
930
930
  });
931
931
  })();
932
932
  };
933
- _proto.precompile = function precompile(compositions, renderer, options) {
933
+ _proto.precompile = function precompile(compositions, renderer) {
934
934
  for(var _iterator = _create_for_of_iterator_helper_loose(this.plugins), _step; !(_step = _iterator()).done;){
935
935
  var plugin = _step.value;
936
- plugin.precompile(compositions, renderer, options);
936
+ plugin.precompile(compositions, renderer);
937
937
  }
938
938
  };
939
939
  _proto.loadResources = function loadResources(scene, options) {
@@ -1008,7 +1008,7 @@ function getPluginUsageInfo(name) {
1008
1008
  * 在加载到 JSON 后,就可以进行提前编译
1009
1009
  * @param json
1010
1010
  * @param player
1011
- */ _proto.precompile = function precompile(compositions, renderer, options) {};
1011
+ */ _proto.precompile = function precompile(compositions, renderer) {};
1012
1012
  _proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {};
1013
1013
  _proto.onCompositionItemLifeBegin = function onCompositionItemLifeBegin(composition, item) {};
1014
1014
  _proto.onCompositionItemLifeEnd = function onCompositionItemLifeEnd(composition, item) {};
@@ -16327,7 +16327,6 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16327
16327
  _this.hasFill = false;
16328
16328
  _this.shapeDirty = true;
16329
16329
  _this.graphicsPath = new GraphicsPath();
16330
- _this.curveValues = [];
16331
16330
  _this.vert = "\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n";
16332
16331
  _this.frag = "\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n color.rgb *= color.a;\n gl_FragColor = color;\n}\n";
16333
16332
  if (!_this.geometry) {
@@ -16509,31 +16508,25 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16509
16508
  var easingOuts = customShapeAtribute.easingOuts;
16510
16509
  for(var _iterator = _create_for_of_iterator_helper_loose(customShapeAtribute.shapes), _step; !(_step = _iterator()).done;){
16511
16510
  var shape = _step.value;
16512
- this.curveValues = [];
16513
16511
  var indices = shape.indexes;
16512
+ var startPoint = points[indices[0].point];
16513
+ this.graphicsPath.moveTo(startPoint.x, startPoint.y);
16514
16514
  for(var i = 1; i < indices.length; i++){
16515
16515
  var pointIndex = indices[i];
16516
16516
  var lastPointIndex = indices[i - 1];
16517
- this.curveValues.push({
16518
- point: points[pointIndex.point],
16519
- controlPoint1: easingOuts[lastPointIndex.easingOut],
16520
- controlPoint2: easingIns[pointIndex.easingIn]
16521
- });
16522
- }
16523
- // Push the last curve
16524
- this.curveValues.push({
16525
- point: points[indices[0].point],
16526
- controlPoint1: easingOuts[indices[indices.length - 1].easingOut],
16527
- controlPoint2: easingIns[indices[0].easingIn]
16528
- });
16529
- this.graphicsPath.moveTo(this.curveValues[this.curveValues.length - 1].point.x, this.curveValues[this.curveValues.length - 1].point.y);
16530
- for(var _iterator1 = _create_for_of_iterator_helper_loose(this.curveValues), _step1; !(_step1 = _iterator1()).done;){
16531
- var curveValue = _step1.value;
16532
- var point = curveValue.point;
16533
- var control1 = curveValue.controlPoint1;
16534
- var control2 = curveValue.controlPoint2;
16535
- this.graphicsPath.bezierCurveTo(control1.x, control1.y, control2.x, control2.y, point.x, point.y, 1);
16517
+ var point = points[pointIndex.point];
16518
+ var lastPoint = points[lastPointIndex.point];
16519
+ var control1 = easingOuts[lastPointIndex.easingOut];
16520
+ var control2 = easingIns[pointIndex.easingIn];
16521
+ this.graphicsPath.bezierCurveTo(control1.x + lastPoint.x, control1.y + lastPoint.y, control2.x + point.x, control2.y + point.y, point.x, point.y, 1);
16536
16522
  }
16523
+ var pointIndex1 = indices[0];
16524
+ var lastPointIndex1 = indices[indices.length - 1];
16525
+ var point1 = points[pointIndex1.point];
16526
+ var lastPoint1 = points[lastPointIndex1.point];
16527
+ var control11 = easingOuts[lastPointIndex1.easingOut];
16528
+ var control21 = easingIns[pointIndex1.easingIn];
16529
+ this.graphicsPath.bezierCurveTo(control11.x + lastPoint1.x, control11.y + lastPoint1.y, control21.x + point1.x, control21.y + point1.y, point1.x, point1.y, 1);
16537
16530
  if (shape.close) {
16538
16531
  this.graphicsPath.closePath();
16539
16532
  }
@@ -17940,6 +17933,7 @@ var seed$3 = 1;
17940
17933
  this.rotation.y = y;
17941
17934
  this.rotation.z = z;
17942
17935
  this.quat.setFromEuler(this.rotation);
17936
+ // TODO 修正 GE 四元数旋转共轭问题
17943
17937
  this.quat.conjugate();
17944
17938
  this.dirtyFlags.localData = true;
17945
17939
  this.dispatchValueChange();
@@ -26654,14 +26648,36 @@ function getStandardInteractContent(ui) {
26654
26648
  // @ts-expect-error
26655
26649
  customShapeComponent.fill = customShapeComponent.shapes[0].fill;
26656
26650
  }
26651
+ // easingIn 和 easingOut 绝对坐标转相对坐标
26652
+ var easingInFlag = new Array(customShapeComponent.easingIns.length);
26653
+ var easingOutFlag = new Array(customShapeComponent.easingOuts.length).fill(false);
26654
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(customShapeComponent.shapes), _step1; !(_step1 = _iterator1()).done;){
26655
+ var shape = _step1.value;
26656
+ for(var _iterator2 = _create_for_of_iterator_helper_loose(shape.indexes), _step2; !(_step2 = _iterator2()).done;){
26657
+ var index = _step2.value;
26658
+ var point = customShapeComponent.points[index.point];
26659
+ var easingIn = customShapeComponent.easingIns[index.easingIn];
26660
+ var easingOut = customShapeComponent.easingOuts[index.easingOut];
26661
+ if (!easingInFlag[index.easingIn]) {
26662
+ easingIn.x -= point.x;
26663
+ easingIn.y -= point.y;
26664
+ easingInFlag[index.easingIn] = true;
26665
+ }
26666
+ if (!easingOutFlag[index.easingOut]) {
26667
+ easingOut.x -= point.x;
26668
+ easingOut.y -= point.y;
26669
+ easingOutFlag[index.easingOut] = true;
26670
+ }
26671
+ }
26672
+ }
26657
26673
  }
26658
26674
  }
26659
26675
  }
26660
26676
  // Composition id 转 guid
26661
26677
  var compositionId = json.compositionId;
26662
26678
  var compositionIdToGUIDMap = {};
26663
- for(var _iterator1 = _create_for_of_iterator_helper_loose(json.compositions), _step1; !(_step1 = _iterator1()).done;){
26664
- var composition = _step1.value;
26679
+ for(var _iterator3 = _create_for_of_iterator_helper_loose(json.compositions), _step3; !(_step3 = _iterator3()).done;){
26680
+ var composition = _step3.value;
26665
26681
  var guid = generateGUID();
26666
26682
  compositionIdToGUIDMap[composition.id] = guid;
26667
26683
  if (composition.id === compositionId) {
@@ -26670,8 +26686,8 @@ function getStandardInteractContent(ui) {
26670
26686
  composition.id = guid;
26671
26687
  }
26672
26688
  // 预合成元素 refId 同步改为生成的合成 guid
26673
- for(var _iterator2 = _create_for_of_iterator_helper_loose(json.items), _step2; !(_step2 = _iterator2()).done;){
26674
- var item = _step2.value;
26689
+ for(var _iterator4 = _create_for_of_iterator_helper_loose(json.items), _step4; !(_step4 = _iterator4()).done;){
26690
+ var item = _step4.value;
26675
26691
  if (item.content) {
26676
26692
  var compositionOptions = item.content.options;
26677
26693
  if (compositionOptions && compositionOptions.refId !== undefined) {
@@ -27525,8 +27541,10 @@ function getStandardJSON(json) {
27525
27541
  json = version30Migration(version21Migration(json));
27526
27542
  }
27527
27543
  // 3.x 版本格式转换
27528
- if (mainVersion < 4 || mainVersion === 4 && minorVersion < 2) {
27529
- json = version31Migration(json);
27544
+ if (mainVersion < 4) {
27545
+ if (mainVersion === 3 && minorVersion < 2) {
27546
+ json = version31Migration(json);
27547
+ }
27530
27548
  }
27531
27549
  return json;
27532
27550
  }
@@ -28817,6 +28835,8 @@ var tmpScale = new Vector3(1, 1, 1);
28817
28835
  0,
28818
28836
  0
28819
28837
  ] : _options_rotation;
28838
+ var euler = new Euler(rotation[0], rotation[1], rotation[2]);
28839
+ var quat = new Quaternion().setFromEuler(euler);
28820
28840
  this.options = {
28821
28841
  near: near,
28822
28842
  far: far,
@@ -28825,7 +28845,7 @@ var tmpScale = new Vector3(1, 1, 1);
28825
28845
  clipMode: clipMode
28826
28846
  };
28827
28847
  this.transform.setPosition(position[0], position[1], position[2]);
28828
- this.transform.setRotation(rotation[0], rotation[1], rotation[2]);
28848
+ this.transform.setQuaternion(quat.x, quat.y, quat.z, quat.w);
28829
28849
  this.dirty = true;
28830
28850
  this.updateMatrix();
28831
28851
  }
@@ -32079,7 +32099,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
32079
32099
  registerPlugin("particle", ParticleLoader, exports.VFXItem);
32080
32100
  registerPlugin("cal", CalculateLoader, exports.VFXItem);
32081
32101
  registerPlugin("interact", InteractLoader, exports.VFXItem);
32082
- var version = "2.3.0";
32102
+ var version = "2.3.2";
32083
32103
  logger.info("Core version: " + version + ".");
32084
32104
 
32085
32105
  exports.AbstractPlugin = AbstractPlugin;