@galacean/effects-core 2.1.0-alpha.12 → 2.1.0-alpha.14

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/index.mjs 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.1.0-alpha.12
6
+ * Version: v2.1.0-alpha.14
7
7
  */
8
8
 
9
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -1618,6 +1618,34 @@ var BuiltinObjectGUID = {
1618
1618
  UnlitShader: "unlit000000000000000000000000000"
1619
1619
  };
1620
1620
 
1621
+ /**
1622
+ * 矢量图形类型
1623
+ */ var ShapePrimitiveType;
1624
+ (function(ShapePrimitiveType) {
1625
+ /**
1626
+ * 自定义图形
1627
+ */ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
1628
+ /**
1629
+ * 矩形
1630
+ */ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
1631
+ /**
1632
+ * 椭圆
1633
+ */ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
1634
+ /**
1635
+ * 多边形
1636
+ */ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
1637
+ /**
1638
+ * 星形
1639
+ */ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
1640
+ })(ShapePrimitiveType || (ShapePrimitiveType = {}));
1641
+
1642
+ // 本期无该功能 待补充
1643
+ var ShapeConnectType;
1644
+ (function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
1645
+ // @待补充
1646
+ var ShapePointType;
1647
+ (function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
1648
+
1621
1649
  /**
1622
1650
  * 动态换图类型
1623
1651
  * @since 1.1.0
@@ -1812,6 +1840,9 @@ var index$1 = /*#__PURE__*/Object.freeze({
1812
1840
  get TextWeight () { return TextWeight; },
1813
1841
  get FontStyle () { return FontStyle; },
1814
1842
  BuiltinObjectGUID: BuiltinObjectGUID,
1843
+ get ShapePrimitiveType () { return ShapePrimitiveType; },
1844
+ get ShapeConnectType () { return ShapeConnectType; },
1845
+ get ShapePointType () { return ShapePointType; },
1815
1846
  get BackgroundType () { return BackgroundType; },
1816
1847
  get MultimediaType () { return MultimediaType; },
1817
1848
  get DataType () { return DataType; },
@@ -6941,6 +6972,28 @@ var MaterialRenderType;
6941
6972
  this.shaderDirty = true;
6942
6973
  }
6943
6974
  },
6975
+ {
6976
+ key: "mainTexture",
6977
+ get: /**
6978
+ * 材质的主纹理
6979
+ */ function get() {
6980
+ return this.getTexture("_MainTex");
6981
+ },
6982
+ set: function set(value) {
6983
+ this.setTexture("_MainTex", value);
6984
+ }
6985
+ },
6986
+ {
6987
+ key: "color",
6988
+ get: /**
6989
+ * 材质的主颜色
6990
+ */ function get() {
6991
+ return this.getColor("_Color");
6992
+ },
6993
+ set: function set(value) {
6994
+ this.setColor("_Color", value);
6995
+ }
6996
+ },
6944
6997
  {
6945
6998
  key: "blending",
6946
6999
  set: /******** effects-core 中会调用 引擎必须实现 ***********************/ /**
@@ -10077,7 +10130,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
10077
10130
 
10078
10131
  var itemVert = "precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 texParams=_TexParams;vTexCoord=vec2(atlasOffset.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(0.0,texParams.y,texParams.x);vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
10079
10132
 
10080
- var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(uSampler0,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
10133
+ var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(_MainTex,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
10081
10134
 
10082
10135
  var particleFrag = "#version 100\nprecision mediump float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n";
10083
10136
 
@@ -10606,6 +10659,9 @@ var seed$5 = 1;
10606
10659
  this.renderer = renderer;
10607
10660
  if (postProcessingEnabled) {
10608
10661
  var enableHDR = true;
10662
+ if (!this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
10663
+ throw new Error("Half float texture is not supported.");
10664
+ }
10609
10665
  // 使用HDR浮点纹理,FLOAT在IOS上报错,使用HALF_FLOAT
10610
10666
  var textureType = enableHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
10611
10667
  attachments = [
@@ -11326,7 +11382,7 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
11326
11382
  var GlobalUniforms = function GlobalUniforms() {
11327
11383
  this.floats = {};
11328
11384
  this.ints = {};
11329
- // vector3s: Record<string, vec3> = {};
11385
+ this.vector3s = {};
11330
11386
  this.vector4s = {};
11331
11387
  this.matrices = {};
11332
11388
  //...
@@ -11567,6 +11623,9 @@ var Renderer = /*#__PURE__*/ function() {
11567
11623
  _proto.setGlobalVector4 = function setGlobalVector4(name, value) {
11568
11624
  // OVERRIDE
11569
11625
  };
11626
+ _proto.setGlobalVector3 = function setGlobalVector3(name, value) {
11627
+ // OVERRIDE
11628
+ };
11570
11629
  _proto.setGlobalMatrix = function setGlobalMatrix(name, value) {
11571
11630
  // OVERRIDE
11572
11631
  };
@@ -13232,10 +13291,10 @@ var Vector4Curve = /*#__PURE__*/ function(ValueGetter) {
13232
13291
  }
13233
13292
  var _proto = Vector4Curve.prototype;
13234
13293
  _proto.onCreate = function onCreate(arg) {
13235
- this.xCurve = createValueGetter(arg.x);
13236
- this.yCurve = createValueGetter(arg.y);
13237
- this.zCurve = createValueGetter(arg.z);
13238
- this.wCurve = createValueGetter(arg.w);
13294
+ this.xCurve = createValueGetter(arg[0]);
13295
+ this.yCurve = createValueGetter(arg[1]);
13296
+ this.zCurve = createValueGetter(arg[2]);
13297
+ this.wCurve = createValueGetter(arg[3]);
13239
13298
  };
13240
13299
  _proto.getValue = function getValue(t) {
13241
13300
  var x = this.xCurve.getValue(t);
@@ -13335,10 +13394,10 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
13335
13394
  }
13336
13395
  var _proto = ColorCurve.prototype;
13337
13396
  _proto.onCreate = function onCreate(arg) {
13338
- this.rCurve = createValueGetter(arg.r);
13339
- this.gCurve = createValueGetter(arg.g);
13340
- this.bCurve = createValueGetter(arg.b);
13341
- this.aCurve = createValueGetter(arg.a);
13397
+ this.rCurve = createValueGetter(arg[0]);
13398
+ this.gCurve = createValueGetter(arg[1]);
13399
+ this.bCurve = createValueGetter(arg[2]);
13400
+ this.aCurve = createValueGetter(arg[3]);
13342
13401
  };
13343
13402
  _proto.getValue = function getValue(t) {
13344
13403
  var r = this.rCurve.getValue(t);
@@ -13440,7 +13499,7 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
13440
13499
  * @param texture - 纹理对象
13441
13500
  */ _proto.setTexture = function setTexture(texture) {
13442
13501
  this.renderer.texture = texture;
13443
- this.material.setTexture("uSampler0", texture);
13502
+ this.material.setTexture("_MainTex", texture);
13444
13503
  };
13445
13504
  /**
13446
13505
  * @internal
@@ -13519,15 +13578,7 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
13519
13578
  geometry.setIndexData(indexData);
13520
13579
  geometry.setAttributeData("atlasOffset", attributes.atlasOffset);
13521
13580
  geometry.setDrawCount(data.index.length);
13522
- for(var i = 0; i < textures.length; i++){
13523
- var texture1 = textures[i];
13524
- material.setTexture("uSampler" + i, texture1);
13525
- }
13526
- // FIXME: 内存泄漏的临时方案,后面再调整
13527
- var emptyTexture = this.emptyTexture;
13528
- for(var k = textures.length; k < maxSpriteMeshItemCount; k++){
13529
- material.setTexture("uSampler" + k, emptyTexture);
13530
- }
13581
+ material.setTexture("_MainTex", texture);
13531
13582
  };
13532
13583
  _proto.getItemGeometryData = function getItemGeometryData() {
13533
13584
  var renderer = this.renderer;
@@ -13645,7 +13696,7 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
13645
13696
  setBlendMode(material, states.blendMode);
13646
13697
  setMaskMode(material, states.maskMode);
13647
13698
  setSideMode(material, states.side);
13648
- material.shader.shaderData.properties = 'uSampler0("uSampler0",2D) = "white" {}';
13699
+ material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
13649
13700
  if (!material.hasUniform("_Color")) {
13650
13701
  material.setVector4("_Color", new Vector4(0, 0, 0, 1));
13651
13702
  }
@@ -15383,6 +15434,329 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
15383
15434
  return PolyStar;
15384
15435
  }(ShapePrimitive);
15385
15436
 
15437
+ // const tempPoints = [new Point(), new Point(), new Point(), new Point()];
15438
+ /**
15439
+ * The `Rectangle` object is an area defined by its position, as indicated by its upper-left corner
15440
+ * point (`x`, `y`) and by its `width` and its `height`.
15441
+ */ var Rectangle$1 = /*#__PURE__*/ function(ShapePrimitive) {
15442
+ _inherits(Rectangle, ShapePrimitive);
15443
+ function Rectangle(x, y, width, height) {
15444
+ if (x === void 0) x = 0;
15445
+ if (y === void 0) y = 0;
15446
+ if (width === void 0) width = 0;
15447
+ if (height === void 0) height = 0;
15448
+ var _this;
15449
+ _this = ShapePrimitive.call(this) || this;
15450
+ _this.x = Number(x);
15451
+ _this.y = Number(y);
15452
+ _this.width = Number(width);
15453
+ _this.height = Number(height);
15454
+ return _this;
15455
+ }
15456
+ var _proto = Rectangle.prototype;
15457
+ /** Determines whether the Rectangle is empty. */ _proto.isEmpty = function isEmpty() {
15458
+ return this.left === this.right || this.top === this.bottom;
15459
+ };
15460
+ /**
15461
+ * Creates a clone of this Rectangle
15462
+ * @returns a copy of the rectangle
15463
+ */ _proto.clone = function clone() {
15464
+ return new Rectangle(this.x, this.y, this.width, this.height);
15465
+ };
15466
+ /**
15467
+ * Converts a Bounds object to a Rectangle object.
15468
+ * @param bounds - The bounds to copy and convert to a rectangle.
15469
+ * @returns Returns itself.
15470
+ */ // copyFromBounds (bounds: Bounds): this {
15471
+ // this.x = bounds.minX;
15472
+ // this.y = bounds.minY;
15473
+ // this.width = bounds.maxX - bounds.minX;
15474
+ // this.height = bounds.maxY - bounds.minY;
15475
+ // return this;
15476
+ // }
15477
+ /**
15478
+ * Copies another rectangle to this one.
15479
+ * @param rectangle - The rectangle to copy from.
15480
+ * @returns Returns itself.
15481
+ */ _proto.copyFrom = function copyFrom(rectangle) {
15482
+ this.x = rectangle.x;
15483
+ this.y = rectangle.y;
15484
+ this.width = rectangle.width;
15485
+ this.height = rectangle.height;
15486
+ return this;
15487
+ };
15488
+ /**
15489
+ * Copies this rectangle to another one.
15490
+ * @param rectangle - The rectangle to copy to.
15491
+ * @returns Returns given parameter.
15492
+ */ _proto.copyTo = function copyTo(rectangle) {
15493
+ rectangle.copyFrom(this);
15494
+ return rectangle;
15495
+ };
15496
+ /**
15497
+ * Checks whether the x and y coordinates given are contained within this Rectangle
15498
+ * @param x - The X coordinate of the point to test
15499
+ * @param y - The Y coordinate of the point to test
15500
+ * @returns Whether the x/y coordinates are within this Rectangle
15501
+ */ _proto.contains = function contains(x, y) {
15502
+ if (this.width <= 0 || this.height <= 0) {
15503
+ return false;
15504
+ }
15505
+ if (x >= this.x && x < this.x + this.width) {
15506
+ if (y >= this.y && y < this.y + this.height) {
15507
+ return true;
15508
+ }
15509
+ }
15510
+ return false;
15511
+ };
15512
+ /**
15513
+ * Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
15514
+ * @param x - The X coordinate of the point to test
15515
+ * @param y - The Y coordinate of the point to test
15516
+ * @param strokeWidth - The width of the line to check
15517
+ * @returns Whether the x/y coordinates are within this rectangle
15518
+ */ _proto.strokeContains = function strokeContains(x, y, strokeWidth) {
15519
+ var _this = this, width = _this.width, height = _this.height;
15520
+ if (width <= 0 || height <= 0) {
15521
+ return false;
15522
+ }
15523
+ var _x = this.x;
15524
+ var _y = this.y;
15525
+ var outerLeft = _x - strokeWidth / 2;
15526
+ var outerRight = _x + width + strokeWidth / 2;
15527
+ var outerTop = _y - strokeWidth / 2;
15528
+ var outerBottom = _y + height + strokeWidth / 2;
15529
+ var innerLeft = _x + strokeWidth / 2;
15530
+ var innerRight = _x + width - strokeWidth / 2;
15531
+ var innerTop = _y + strokeWidth / 2;
15532
+ var innerBottom = _y + height - strokeWidth / 2;
15533
+ return x >= outerLeft && x <= outerRight && y >= outerTop && y <= outerBottom && !(x > innerLeft && x < innerRight && y > innerTop && y < innerBottom);
15534
+ };
15535
+ /**
15536
+ * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
15537
+ * Returns true only if the area of the intersection is >0, this means that Rectangles
15538
+ * sharing a side are not overlapping. Another side effect is that an arealess rectangle
15539
+ * (width or height equal to zero) can't intersect any other rectangle.
15540
+ * @param {Rectangle} other - The Rectangle to intersect with `this`.
15541
+ * @param {Matrix} transform - The transformation matrix of `other`.
15542
+ * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
15543
+ */ // intersects (other: Rectangle, transform?: Matrix4): boolean {
15544
+ // if (!transform) {
15545
+ // const x0 = this.x < other.x ? other.x : this.x;
15546
+ // const x1 = this.right > other.right ? other.right : this.right;
15547
+ // if (x1 <= x0) {
15548
+ // return false;
15549
+ // }
15550
+ // const y0 = this.y < other.y ? other.y : this.y;
15551
+ // const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;
15552
+ // return y1 > y0;
15553
+ // }
15554
+ // const x0 = this.left;
15555
+ // const x1 = this.right;
15556
+ // const y0 = this.top;
15557
+ // const y1 = this.bottom;
15558
+ // if (x1 <= x0 || y1 <= y0) {
15559
+ // return false;
15560
+ // }
15561
+ // const lt = tempPoints[0].set(other.left, other.top);
15562
+ // const lb = tempPoints[1].set(other.left, other.bottom);
15563
+ // const rt = tempPoints[2].set(other.right, other.top);
15564
+ // const rb = tempPoints[3].set(other.right, other.bottom);
15565
+ // if (rt.x <= lt.x || lb.y <= lt.y) {
15566
+ // return false;
15567
+ // }
15568
+ // const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));
15569
+ // if (s === 0) {
15570
+ // return false;
15571
+ // }
15572
+ // transform.apply(lt, lt);
15573
+ // transform.apply(lb, lb);
15574
+ // transform.apply(rt, rt);
15575
+ // transform.apply(rb, rb);
15576
+ // if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0
15577
+ // || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1
15578
+ // || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0
15579
+ // || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {
15580
+ // return false;
15581
+ // }
15582
+ // const nx = s * (lb.y - lt.y);
15583
+ // const ny = s * (lt.x - lb.x);
15584
+ // const n00 = (nx * x0) + (ny * y0);
15585
+ // const n10 = (nx * x1) + (ny * y0);
15586
+ // const n01 = (nx * x0) + (ny * y1);
15587
+ // const n11 = (nx * x1) + (ny * y1);
15588
+ // if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)
15589
+ // || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) {
15590
+ // return false;
15591
+ // }
15592
+ // const mx = s * (lt.y - rt.y);
15593
+ // const my = s * (rt.x - lt.x);
15594
+ // const m00 = (mx * x0) + (my * y0);
15595
+ // const m10 = (mx * x1) + (my * y0);
15596
+ // const m01 = (mx * x0) + (my * y1);
15597
+ // const m11 = (mx * x1) + (my * y1);
15598
+ // if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)
15599
+ // || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) {
15600
+ // return false;
15601
+ // }
15602
+ // return true;
15603
+ // }
15604
+ /**
15605
+ * Pads the rectangle making it grow in all directions.
15606
+ * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
15607
+ * @param paddingX - The horizontal padding amount.
15608
+ * @param paddingY - The vertical padding amount.
15609
+ * @returns Returns itself.
15610
+ */ _proto.pad = function pad(paddingX, paddingY) {
15611
+ if (paddingX === void 0) paddingX = 0;
15612
+ if (paddingY === void 0) paddingY = paddingX;
15613
+ this.x -= paddingX;
15614
+ this.y -= paddingY;
15615
+ this.width += paddingX * 2;
15616
+ this.height += paddingY * 2;
15617
+ return this;
15618
+ };
15619
+ /**
15620
+ * Fits this rectangle around the passed one.
15621
+ * @param rectangle - The rectangle to fit.
15622
+ * @returns Returns itself.
15623
+ */ _proto.fit = function fit(rectangle) {
15624
+ var x1 = Math.max(this.x, rectangle.x);
15625
+ var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
15626
+ var y1 = Math.max(this.y, rectangle.y);
15627
+ var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
15628
+ this.x = x1;
15629
+ this.width = Math.max(x2 - x1, 0);
15630
+ this.y = y1;
15631
+ this.height = Math.max(y2 - y1, 0);
15632
+ return this;
15633
+ };
15634
+ /**
15635
+ * Enlarges rectangle that way its corners lie on grid
15636
+ * @param resolution - resolution
15637
+ * @param eps - precision
15638
+ * @returns Returns itself.
15639
+ */ _proto.ceil = function ceil(resolution, eps) {
15640
+ if (resolution === void 0) resolution = 1;
15641
+ if (eps === void 0) eps = 0.001;
15642
+ var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
15643
+ var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
15644
+ this.x = Math.floor((this.x + eps) * resolution) / resolution;
15645
+ this.y = Math.floor((this.y + eps) * resolution) / resolution;
15646
+ this.width = x2 - this.x;
15647
+ this.height = y2 - this.y;
15648
+ return this;
15649
+ };
15650
+ /**
15651
+ * Enlarges this rectangle to include the passed rectangle.
15652
+ * @param rectangle - The rectangle to include.
15653
+ * @returns Returns itself.
15654
+ */ _proto.enlarge = function enlarge(rectangle) {
15655
+ var x1 = Math.min(this.x, rectangle.x);
15656
+ var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
15657
+ var y1 = Math.min(this.y, rectangle.y);
15658
+ var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
15659
+ this.x = x1;
15660
+ this.width = x2 - x1;
15661
+ this.y = y1;
15662
+ this.height = y2 - y1;
15663
+ return this;
15664
+ };
15665
+ /**
15666
+ * Returns the framing rectangle of the rectangle as a Rectangle object
15667
+ * @param out - optional rectangle to store the result
15668
+ * @returns The framing rectangle
15669
+ */ _proto.getBounds = function getBounds(out) {
15670
+ out = out || new Rectangle();
15671
+ out.copyFrom(this);
15672
+ return out;
15673
+ };
15674
+ _proto.getX = function getX() {
15675
+ return this.x;
15676
+ };
15677
+ _proto.getY = function getY() {
15678
+ return this.y;
15679
+ };
15680
+ _proto.build = function build(points) {
15681
+ var x = this.x;
15682
+ var y = this.y;
15683
+ var width = this.width;
15684
+ var height = this.height;
15685
+ if (!(width >= 0 && height >= 0)) {
15686
+ return points;
15687
+ }
15688
+ points[0] = x;
15689
+ points[1] = y;
15690
+ points[2] = x + width;
15691
+ points[3] = y;
15692
+ points[4] = x + width;
15693
+ points[5] = y + height;
15694
+ points[6] = x;
15695
+ points[7] = y + height;
15696
+ return points;
15697
+ };
15698
+ _proto.triangulate = function triangulate(points, vertices, verticesOffset, indices, indicesOffset) {
15699
+ var count = 0;
15700
+ var verticesStride = 2;
15701
+ verticesOffset *= verticesStride;
15702
+ vertices[verticesOffset + count] = points[0];
15703
+ vertices[verticesOffset + count + 1] = points[1];
15704
+ count += verticesStride;
15705
+ vertices[verticesOffset + count] = points[2];
15706
+ vertices[verticesOffset + count + 1] = points[3];
15707
+ count += verticesStride;
15708
+ vertices[verticesOffset + count] = points[6];
15709
+ vertices[verticesOffset + count + 1] = points[7];
15710
+ count += verticesStride;
15711
+ vertices[verticesOffset + count] = points[4];
15712
+ vertices[verticesOffset + count + 1] = points[5];
15713
+ count += verticesStride;
15714
+ var verticesIndex = verticesOffset / verticesStride;
15715
+ // triangle 1
15716
+ indices[indicesOffset++] = verticesIndex;
15717
+ indices[indicesOffset++] = verticesIndex + 1;
15718
+ indices[indicesOffset++] = verticesIndex + 2;
15719
+ // triangle 2
15720
+ indices[indicesOffset++] = verticesIndex + 1;
15721
+ indices[indicesOffset++] = verticesIndex + 3;
15722
+ indices[indicesOffset++] = verticesIndex + 2;
15723
+ };
15724
+ _create_class(Rectangle, [
15725
+ {
15726
+ key: "left",
15727
+ get: /** Returns the left edge of the rectangle. */ function get() {
15728
+ return this.x;
15729
+ }
15730
+ },
15731
+ {
15732
+ key: "right",
15733
+ get: /** Returns the right edge of the rectangle. */ function get() {
15734
+ return this.x + this.width;
15735
+ }
15736
+ },
15737
+ {
15738
+ key: "top",
15739
+ get: /** Returns the top edge of the rectangle. */ function get() {
15740
+ return this.y;
15741
+ }
15742
+ },
15743
+ {
15744
+ key: "bottom",
15745
+ get: /** Returns the bottom edge of the rectangle. */ function get() {
15746
+ return this.y + this.height;
15747
+ }
15748
+ }
15749
+ ], [
15750
+ {
15751
+ key: "EMPTY",
15752
+ get: /** A constant empty rectangle. This is a new object every time the property is accessed */ function get() {
15753
+ return new Rectangle(0, 0, 0, 0);
15754
+ }
15755
+ }
15756
+ ]);
15757
+ return Rectangle;
15758
+ }(ShapePrimitive);
15759
+
15386
15760
  var ShapePath = /*#__PURE__*/ function() {
15387
15761
  function ShapePath(graphicsPath) {
15388
15762
  this.graphicsPath = graphicsPath;
@@ -15419,6 +15793,11 @@ var ShapePath = /*#__PURE__*/ function() {
15419
15793
  this.polyStar(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
15420
15794
  break;
15421
15795
  }
15796
+ case "rect":
15797
+ {
15798
+ this.rect(data[0], data[1], data[2], data[3], data[4]);
15799
+ break;
15800
+ }
15422
15801
  }
15423
15802
  }
15424
15803
  this.endPoly();
@@ -15464,6 +15843,18 @@ var ShapePath = /*#__PURE__*/ function() {
15464
15843
  return this;
15465
15844
  };
15466
15845
  /**
15846
+ * Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
15847
+ * @param x - The x-coordinate of the upper-left corner of the rectangle.
15848
+ * @param y - The y-coordinate of the upper-left corner of the rectangle.
15849
+ * @param w - The width of the rectangle.
15850
+ * @param h - The height of the rectangle.
15851
+ * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
15852
+ * @returns The instance of the current object for chaining.
15853
+ */ _proto.rect = function rect(x, y, w, h, transform) {
15854
+ this.drawShape(new Rectangle$1(x, y, w, h), transform);
15855
+ return this;
15856
+ };
15857
+ /**
15467
15858
  * Draws a given shape on the canvas.
15468
15859
  * This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.
15469
15860
  * An optional transformation matrix can be applied to the shape, allowing for complex transformations.
@@ -15599,8 +15990,8 @@ var GraphicsPath = /*#__PURE__*/ function() {
15599
15990
  };
15600
15991
  /**
15601
15992
  * Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
15602
- * @param x - The x-coordinate of the top-left corner of the rectangle.
15603
- * @param y - The y-coordinate of the top-left corner of the rectangle.
15993
+ * @param x - The x-coordinate of the upper-left corner of the rectangle.
15994
+ * @param y - The y-coordinate of the upper-left corner of the rectangle.
15604
15995
  * @param w - The width of the rectangle.
15605
15996
  * @param h - The height of the rectangle.
15606
15997
  * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
@@ -15779,7 +16170,7 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
15779
16170
  this.path.clear();
15780
16171
  var shapeData = data;
15781
16172
  switch(shapeData.type){
15782
- case 0:
16173
+ case ShapePrimitiveType.Custom:
15783
16174
  {
15784
16175
  var customData = shapeData;
15785
16176
  var points = customData.points;
@@ -15816,28 +16207,28 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
15816
16207
  }
15817
16208
  break;
15818
16209
  }
15819
- case 2:
16210
+ case ShapePrimitiveType.Ellipse:
15820
16211
  {
15821
16212
  var ellipseData = shapeData;
15822
16213
  this.path.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
15823
16214
  this.setFillColor(ellipseData.fill);
15824
16215
  break;
15825
16216
  }
15826
- case 1:
16217
+ case ShapePrimitiveType.Rectangle:
15827
16218
  {
15828
16219
  var rectangleData = shapeData;
15829
- this.path.rect(-rectangleData.width / 2, rectangleData.height / 2, rectangleData.width, rectangleData.height);
16220
+ this.path.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height);
15830
16221
  this.setFillColor(rectangleData.fill);
15831
16222
  break;
15832
16223
  }
15833
- case 4:
16224
+ case ShapePrimitiveType.Star:
15834
16225
  {
15835
16226
  var starData = shapeData;
15836
16227
  this.path.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
15837
16228
  this.setFillColor(starData.fill);
15838
16229
  break;
15839
16230
  }
15840
- case 3:
16231
+ case ShapePrimitiveType.Polygon:
15841
16232
  {
15842
16233
  var polygonData = shapeData;
15843
16234
  this.path.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
@@ -15869,28 +16260,6 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
15869
16260
  ShapeComponent = __decorate([
15870
16261
  effectsClass("ShapeComponent")
15871
16262
  ], ShapeComponent);
15872
- var ShapePrimitiveType;
15873
- (function(ShapePrimitiveType) {
15874
- /**
15875
- * 自定义图形
15876
- */ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
15877
- /**
15878
- * 矩形
15879
- */ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
15880
- /**
15881
- * 椭圆
15882
- */ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
15883
- /**
15884
- * 多边形
15885
- */ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
15886
- /**
15887
- * 星形
15888
- */ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
15889
- })(ShapePrimitiveType || (ShapePrimitiveType = {}));
15890
- var ShapeConnectType;
15891
- (function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
15892
- var ShapePointType;
15893
- (function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
15894
16263
 
15895
16264
  var Fake3DComponent = /*#__PURE__*/ function(Component) {
15896
16265
  _inherits(Fake3DComponent, Component);
@@ -16453,7 +16822,7 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
16453
16822
  _proto.onDisable = function onDisable() {
16454
16823
  if (this.item && this.item.composition) {
16455
16824
  var _this_previewContent;
16456
- if (this.duringPlay) {
16825
+ if (this.duringPlay && !this.item.transform.getValid()) {
16457
16826
  this.item.composition.removeInteractiveItem(this.item, this.item.props.content.options.type);
16458
16827
  this.duringPlay = false;
16459
16828
  }
@@ -16656,10 +17025,10 @@ function shouldIgnoreBouncing(arg, mul) {
16656
17025
  return this.boundingBoxData;
16657
17026
  };
16658
17027
  _proto.getBoundingBox = function getBoundingBox() {
16659
- var maxX = 0;
16660
- var maxY = 0;
16661
- var minX = 0;
16662
- var minY = 0;
17028
+ var maxX = -Number.MAX_VALUE;
17029
+ var maxY = -Number.MAX_VALUE;
17030
+ var minX = Number.MAX_VALUE;
17031
+ var minY = Number.MAX_VALUE;
16663
17032
  for(var _iterator = _create_for_of_iterator_helper_loose(this.boundingBoxData.area), _step; !(_step = _iterator()).done;){
16664
17033
  var triangle = _step.value;
16665
17034
  maxX = Math.max(triangle.p0.x, triangle.p1.x, triangle.p2.x, maxX);
@@ -18076,7 +18445,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
18076
18445
  options: {}
18077
18446
  };
18078
18447
  }
18079
- if (duration <= 0) {
18448
+ if (duration < 0) {
18080
18449
  throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
18081
18450
  }
18082
18451
  this.rendererComponents.length = 0;
@@ -18437,6 +18806,16 @@ var SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
18437
18806
  }
18438
18807
  var life = Math.min(Math.max(time / duration, 0.0), 1.0);
18439
18808
  var ta = this.textureSheetAnimation;
18809
+ var video = this.renderer.texture.source.video;
18810
+ if (video) {
18811
+ if (time === 0) {
18812
+ video.pause();
18813
+ } else {
18814
+ video.play().catch(function(e) {
18815
+ _this.engine.renderErrors.add(e);
18816
+ });
18817
+ }
18818
+ }
18440
18819
  if (ta) {
18441
18820
  var _this_material_getVector4;
18442
18821
  var total = ta.total || ta.row * ta.col;
@@ -18491,21 +18870,20 @@ var SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
18491
18870
  dy
18492
18871
  ]);
18493
18872
  }
18494
- var video = this.renderer.texture.source.video;
18495
- if (video) {
18496
- if (time === 0 || time === this.item.duration) {
18497
- video.pause();
18498
- } else {
18499
- video.play().catch(function(e) {
18500
- _this.engine.renderErrors.add(e);
18501
- });
18502
- }
18503
- }
18504
18873
  };
18505
18874
  _proto.onDestroy = function onDestroy() {
18875
+ var textures = this.getTextures();
18506
18876
  if (this.item && this.item.composition) {
18507
- this.item.composition.destroyTextures(this.getTextures());
18877
+ this.item.composition.destroyTextures(textures);
18508
18878
  }
18879
+ textures.forEach(function(texture) {
18880
+ var source = texture.source;
18881
+ if (source.sourceType === TextureSourceType.video && (source == null ? void 0 : source.video)) {
18882
+ source.video.pause();
18883
+ source.video.src = "";
18884
+ source.video.load();
18885
+ }
18886
+ });
18509
18887
  };
18510
18888
  _proto.createGeometry = function createGeometry(mode) {
18511
18889
  var maxVertex = 12 * this.splits.length;
@@ -23997,6 +24375,51 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
23997
24375
  return Vector4PropertyMixerPlayable;
23998
24376
  }(Playable);
23999
24377
 
24378
+ var ColorPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24379
+ _inherits(ColorPropertyMixerPlayable, Playable);
24380
+ function ColorPropertyMixerPlayable() {
24381
+ var _this;
24382
+ _this = Playable.apply(this, arguments) || this;
24383
+ _this.propertyName = "";
24384
+ return _this;
24385
+ }
24386
+ var _proto = ColorPropertyMixerPlayable.prototype;
24387
+ _proto.processFrame = function processFrame(context) {
24388
+ var boundObject = context.output.getUserData();
24389
+ if (!boundObject) {
24390
+ return;
24391
+ }
24392
+ var hasInput = false;
24393
+ var value = boundObject[this.propertyName];
24394
+ if (!_instanceof1(value, Color)) {
24395
+ return;
24396
+ }
24397
+ value.setZero();
24398
+ // evaluate the curve
24399
+ for(var i = 0; i < this.getInputCount(); i++){
24400
+ var weight = this.getInputWeight(i);
24401
+ if (weight > 0) {
24402
+ var propertyClipPlayable = this.getInput(i);
24403
+ if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
24404
+ console.error("ColorPropertyMixerPlayable received incompatible input");
24405
+ continue;
24406
+ }
24407
+ var curveValue = propertyClipPlayable.value;
24408
+ value.r += curveValue.r * weight;
24409
+ value.g += curveValue.g * weight;
24410
+ value.b += curveValue.b * weight;
24411
+ value.a += curveValue.a * weight;
24412
+ hasInput = true;
24413
+ }
24414
+ }
24415
+ // set value
24416
+ if (hasInput) {
24417
+ boundObject[this.propertyName] = value;
24418
+ }
24419
+ };
24420
+ return ColorPropertyMixerPlayable;
24421
+ }(Playable);
24422
+
24000
24423
  var PropertyTrack = /*#__PURE__*/ function(TrackAsset) {
24001
24424
  _inherits(PropertyTrack, TrackAsset);
24002
24425
  function PropertyTrack() {
@@ -24156,7 +24579,7 @@ var ColorPropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
24156
24579
  }
24157
24580
  var _proto = ColorPropertyTrack.prototype;
24158
24581
  _proto.createTrackMixer = function createTrackMixer(graph) {
24159
- var mixer = new FloatPropertyMixerPlayable(graph);
24582
+ var mixer = new ColorPropertyMixerPlayable(graph);
24160
24583
  var propertyNames = this.propertyNames;
24161
24584
  if (propertyNames.length > 0) {
24162
24585
  var propertyName = propertyNames[propertyNames.length - 1];
@@ -24170,6 +24593,27 @@ ColorPropertyTrack = __decorate([
24170
24593
  effectsClass(DataType.ColorPropertyTrack)
24171
24594
  ], ColorPropertyTrack);
24172
24595
 
24596
+ var ColorPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
24597
+ _inherits(ColorPropertyPlayableAsset, PlayableAsset);
24598
+ function ColorPropertyPlayableAsset() {
24599
+ return PlayableAsset.apply(this, arguments);
24600
+ }
24601
+ var _proto = ColorPropertyPlayableAsset.prototype;
24602
+ _proto.createPlayable = function createPlayable(graph) {
24603
+ var clipPlayable = new PropertyClipPlayable(graph);
24604
+ clipPlayable.curve = createValueGetter(this.curveData);
24605
+ clipPlayable.value = clipPlayable.curve.getValue(0);
24606
+ return clipPlayable;
24607
+ };
24608
+ return ColorPropertyPlayableAsset;
24609
+ }(PlayableAsset);
24610
+ __decorate([
24611
+ serialize()
24612
+ ], ColorPropertyPlayableAsset.prototype, "curveData", void 0);
24613
+ ColorPropertyPlayableAsset = __decorate([
24614
+ effectsClass(DataType.ColorPropertyPlayableAsset)
24615
+ ], ColorPropertyPlayableAsset);
24616
+
24173
24617
  var FloatPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
24174
24618
  _inherits(FloatPropertyPlayableAsset, PlayableAsset);
24175
24619
  function FloatPropertyPlayableAsset() {
@@ -24374,6 +24818,27 @@ function compareTracks(a, b) {
24374
24818
  }
24375
24819
  }
24376
24820
 
24821
+ var Vector4PropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
24822
+ _inherits(Vector4PropertyPlayableAsset, PlayableAsset);
24823
+ function Vector4PropertyPlayableAsset() {
24824
+ return PlayableAsset.apply(this, arguments);
24825
+ }
24826
+ var _proto = Vector4PropertyPlayableAsset.prototype;
24827
+ _proto.createPlayable = function createPlayable(graph) {
24828
+ var clipPlayable = new PropertyClipPlayable(graph);
24829
+ clipPlayable.curve = createValueGetter(this.curveData);
24830
+ clipPlayable.value = clipPlayable.curve.getValue(0);
24831
+ return clipPlayable;
24832
+ };
24833
+ return Vector4PropertyPlayableAsset;
24834
+ }(PlayableAsset);
24835
+ __decorate([
24836
+ serialize()
24837
+ ], Vector4PropertyPlayableAsset.prototype, "curveData", void 0);
24838
+ Vector4PropertyPlayableAsset = __decorate([
24839
+ effectsClass("Vector4PropertyPlayableAsset")
24840
+ ], Vector4PropertyPlayableAsset);
24841
+
24377
24842
  var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
24378
24843
  _inherits(ObjectBindingTrack, TrackAsset1);
24379
24844
  function ObjectBindingTrack() {
@@ -24411,7 +24876,7 @@ var TextLayout = /*#__PURE__*/ function() {
24411
24876
  function TextLayout(options) {
24412
24877
  this.width = 0;
24413
24878
  this.height = 0;
24414
- var _options_textHeight = options.textHeight, textHeight = _options_textHeight === void 0 ? 100 : _options_textHeight, _options_textWidth = options.textWidth, textWidth = _options_textWidth === void 0 ? 100 : _options_textWidth, _options_textOverflow = options.textOverflow, textOverflow = _options_textOverflow === void 0 ? TextOverflow.display : _options_textOverflow, _options_textBaseline = options.textBaseline, textBaseline = _options_textBaseline === void 0 ? TextBaseline.top : _options_textBaseline, _options_textAlign = options.textAlign, textAlign = _options_textAlign === void 0 ? TextAlignment.left : _options_textAlign, text = options.text, _options_letterSpace = options.letterSpace, letterSpace = _options_letterSpace === void 0 ? 0 : _options_letterSpace, _options_autoWidth = options.autoWidth, autoWidth = _options_autoWidth === void 0 ? false : _options_autoWidth, fontSize = options.fontSize, _options_lineHeight = options.lineHeight, lineHeight = _options_lineHeight === void 0 ? fontSize : _options_lineHeight;
24879
+ var _options_textHeight = options.textHeight, textHeight = _options_textHeight === void 0 ? 100 : _options_textHeight, _options_textWidth = options.textWidth, textWidth = _options_textWidth === void 0 ? 100 : _options_textWidth, _options_textOverflow = options.textOverflow, textOverflow = _options_textOverflow === void 0 ? TextOverflow.display : _options_textOverflow, _options_textBaseline = options.textBaseline, textBaseline = _options_textBaseline === void 0 ? TextBaseline.top : _options_textBaseline, _options_textAlign = options.textAlign, textAlign = _options_textAlign === void 0 ? TextAlignment.left : _options_textAlign, _options_text = options.text, text = _options_text === void 0 ? " " : _options_text, _options_letterSpace = options.letterSpace, letterSpace = _options_letterSpace === void 0 ? 0 : _options_letterSpace, _options_autoWidth = options.autoWidth, autoWidth = _options_autoWidth === void 0 ? false : _options_autoWidth, fontSize = options.fontSize, _options_lineHeight = options.lineHeight, lineHeight = _options_lineHeight === void 0 ? fontSize : _options_lineHeight;
24415
24880
  var tempWidth = fontSize + letterSpace;
24416
24881
  this.autoWidth = autoWidth;
24417
24882
  this.maxTextWidth = text.length * tempWidth;
@@ -24978,7 +25443,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
24978
25443
  }
24979
25444
  //与 toDataURL() 两种方式都需要像素读取操作
24980
25445
  var imageData = context.getImageData(0, 0, this.canvas.width, this.canvas.height);
24981
- this.material.setTexture("uSampler0", Texture.createWithData(this.engine, {
25446
+ this.material.setTexture("_MainTex", Texture.createWithData(this.engine, {
24982
25447
  data: new Uint8Array(imageData.data),
24983
25448
  width: imageData.width,
24984
25449
  height: imageData.height
@@ -28176,7 +28641,7 @@ var listOrder = 0;
28176
28641
  var itemProps = sourceItemData;
28177
28642
  if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
28178
28643
  itemProps.listIndex = listOrder++;
28179
- if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || //@ts-expect-error
28644
+ if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine || //@ts-expect-error
28180
28645
  itemProps.type === ItemType.shape) {
28181
28646
  for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
28182
28647
  var componentPath = _step2.value;
@@ -28217,8 +28682,10 @@ var listOrder = 0;
28217
28682
  shapeData = shape;
28218
28683
  }
28219
28684
  if (shapeData !== undefined) {
28220
- // @ts-expect-error 类型转换问题
28221
- renderContent.renderer.shape = getGeometryByShape(shapeData, split);
28685
+ if (!("aPoint" in shapeData && "index" in shapeData)) {
28686
+ // @ts-expect-error 类型转换问题
28687
+ renderContent.renderer.shape = getGeometryByShape(shapeData, split);
28688
+ }
28222
28689
  }
28223
28690
  }
28224
28691
  if ("trails" in renderContent && renderContent.trails !== undefined) {
@@ -28585,16 +29052,15 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
28585
29052
  if (pause) {
28586
29053
  this.resume();
28587
29054
  }
28588
- if (!this.rootComposition.isStartCalled) {
28589
- this.rootComposition.onStart();
28590
- this.rootComposition.isStartCalled = true;
28591
- }
28592
29055
  this.setSpeed(1);
28593
29056
  this.forwardTime(time + this.startTime);
28594
29057
  this.setSpeed(speed);
28595
29058
  if (pause) {
28596
29059
  this.pause();
28597
29060
  }
29061
+ this.emit("goto", {
29062
+ time: time
29063
+ });
28598
29064
  };
28599
29065
  _proto.addItem = function addItem(item) {
28600
29066
  this.items.push(item);
@@ -31134,8 +31600,8 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
31134
31600
  registerPlugin("particle", ParticleLoader, VFXItem, true);
31135
31601
  registerPlugin("cal", CalculateLoader, VFXItem, true);
31136
31602
  registerPlugin("interact", InteractLoader, VFXItem, true);
31137
- var version = "2.1.0-alpha.12";
31603
+ var version = "2.1.0-alpha.14";
31138
31604
  logger.info("Core version: " + version + ".");
31139
31605
 
31140
- export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyTrack, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapeConnectType, ShapePointType, ShapePrimitiveType, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector4Curve, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
31606
+ export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
31141
31607
  //# sourceMappingURL=index.mjs.map