@galacean/effects-threejs 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 threejs plugin 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
  import * as THREE from 'three';
@@ -1620,6 +1620,34 @@ var BuiltinObjectGUID = {
1620
1620
  UnlitShader: "unlit000000000000000000000000000"
1621
1621
  };
1622
1622
 
1623
+ /**
1624
+ * 矢量图形类型
1625
+ */ var ShapePrimitiveType;
1626
+ (function(ShapePrimitiveType) {
1627
+ /**
1628
+ * 自定义图形
1629
+ */ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
1630
+ /**
1631
+ * 矩形
1632
+ */ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
1633
+ /**
1634
+ * 椭圆
1635
+ */ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
1636
+ /**
1637
+ * 多边形
1638
+ */ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
1639
+ /**
1640
+ * 星形
1641
+ */ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
1642
+ })(ShapePrimitiveType || (ShapePrimitiveType = {}));
1643
+
1644
+ // 本期无该功能 待补充
1645
+ var ShapeConnectType;
1646
+ (function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
1647
+ // @待补充
1648
+ var ShapePointType;
1649
+ (function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
1650
+
1623
1651
  /**
1624
1652
  * 动态换图类型
1625
1653
  * @since 1.1.0
@@ -1814,6 +1842,9 @@ var index$1 = /*#__PURE__*/Object.freeze({
1814
1842
  get TextWeight () { return TextWeight; },
1815
1843
  get FontStyle () { return FontStyle; },
1816
1844
  BuiltinObjectGUID: BuiltinObjectGUID,
1845
+ get ShapePrimitiveType () { return ShapePrimitiveType; },
1846
+ get ShapeConnectType () { return ShapeConnectType; },
1847
+ get ShapePointType () { return ShapePointType; },
1817
1848
  get BackgroundType () { return BackgroundType; },
1818
1849
  get MultimediaType () { return MultimediaType; },
1819
1850
  get DataType () { return DataType; },
@@ -6943,6 +6974,28 @@ var MaterialRenderType;
6943
6974
  this.shaderDirty = true;
6944
6975
  }
6945
6976
  },
6977
+ {
6978
+ key: "mainTexture",
6979
+ get: /**
6980
+ * 材质的主纹理
6981
+ */ function get() {
6982
+ return this.getTexture("_MainTex");
6983
+ },
6984
+ set: function set(value) {
6985
+ this.setTexture("_MainTex", value);
6986
+ }
6987
+ },
6988
+ {
6989
+ key: "color",
6990
+ get: /**
6991
+ * 材质的主颜色
6992
+ */ function get() {
6993
+ return this.getColor("_Color");
6994
+ },
6995
+ set: function set(value) {
6996
+ this.setColor("_Color", value);
6997
+ }
6998
+ },
6946
6999
  {
6947
7000
  key: "blending",
6948
7001
  set: /******** effects-core 中会调用 引擎必须实现 ***********************/ /**
@@ -10079,7 +10132,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
10079
10132
 
10080
10133
  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}";
10081
10134
 
10082
- 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;}";
10135
+ 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;}";
10083
10136
 
10084
10137
  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";
10085
10138
 
@@ -10608,6 +10661,9 @@ var seed$6 = 1;
10608
10661
  this.renderer = renderer;
10609
10662
  if (postProcessingEnabled) {
10610
10663
  var enableHDR = true;
10664
+ if (!this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
10665
+ throw new Error("Half float texture is not supported.");
10666
+ }
10611
10667
  // 使用HDR浮点纹理,FLOAT在IOS上报错,使用HALF_FLOAT
10612
10668
  var textureType = enableHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
10613
10669
  attachments = [
@@ -11328,7 +11384,7 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
11328
11384
  var GlobalUniforms = function GlobalUniforms() {
11329
11385
  this.floats = {};
11330
11386
  this.ints = {};
11331
- // vector3s: Record<string, vec3> = {};
11387
+ this.vector3s = {};
11332
11388
  this.vector4s = {};
11333
11389
  this.matrices = {};
11334
11390
  //...
@@ -11569,6 +11625,9 @@ var Renderer = /*#__PURE__*/ function() {
11569
11625
  _proto.setGlobalVector4 = function setGlobalVector4(name, value) {
11570
11626
  // OVERRIDE
11571
11627
  };
11628
+ _proto.setGlobalVector3 = function setGlobalVector3(name, value) {
11629
+ // OVERRIDE
11630
+ };
11572
11631
  _proto.setGlobalMatrix = function setGlobalMatrix(name, value) {
11573
11632
  // OVERRIDE
11574
11633
  };
@@ -13234,10 +13293,10 @@ var Vector4Curve = /*#__PURE__*/ function(ValueGetter) {
13234
13293
  }
13235
13294
  var _proto = Vector4Curve.prototype;
13236
13295
  _proto.onCreate = function onCreate(arg) {
13237
- this.xCurve = createValueGetter(arg.x);
13238
- this.yCurve = createValueGetter(arg.y);
13239
- this.zCurve = createValueGetter(arg.z);
13240
- this.wCurve = createValueGetter(arg.w);
13296
+ this.xCurve = createValueGetter(arg[0]);
13297
+ this.yCurve = createValueGetter(arg[1]);
13298
+ this.zCurve = createValueGetter(arg[2]);
13299
+ this.wCurve = createValueGetter(arg[3]);
13241
13300
  };
13242
13301
  _proto.getValue = function getValue(t) {
13243
13302
  var x = this.xCurve.getValue(t);
@@ -13337,10 +13396,10 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
13337
13396
  }
13338
13397
  var _proto = ColorCurve.prototype;
13339
13398
  _proto.onCreate = function onCreate(arg) {
13340
- this.rCurve = createValueGetter(arg.r);
13341
- this.gCurve = createValueGetter(arg.g);
13342
- this.bCurve = createValueGetter(arg.b);
13343
- this.aCurve = createValueGetter(arg.a);
13399
+ this.rCurve = createValueGetter(arg[0]);
13400
+ this.gCurve = createValueGetter(arg[1]);
13401
+ this.bCurve = createValueGetter(arg[2]);
13402
+ this.aCurve = createValueGetter(arg[3]);
13344
13403
  };
13345
13404
  _proto.getValue = function getValue(t) {
13346
13405
  var r = this.rCurve.getValue(t);
@@ -13442,7 +13501,7 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
13442
13501
  * @param texture - 纹理对象
13443
13502
  */ _proto.setTexture = function setTexture(texture) {
13444
13503
  this.renderer.texture = texture;
13445
- this.material.setTexture("uSampler0", texture);
13504
+ this.material.setTexture("_MainTex", texture);
13446
13505
  };
13447
13506
  /**
13448
13507
  * @internal
@@ -13521,15 +13580,7 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
13521
13580
  geometry.setIndexData(indexData);
13522
13581
  geometry.setAttributeData("atlasOffset", attributes.atlasOffset);
13523
13582
  geometry.setDrawCount(data.index.length);
13524
- for(var i = 0; i < textures.length; i++){
13525
- var texture1 = textures[i];
13526
- material.setTexture("uSampler" + i, texture1);
13527
- }
13528
- // FIXME: 内存泄漏的临时方案,后面再调整
13529
- var emptyTexture = this.emptyTexture;
13530
- for(var k = textures.length; k < maxSpriteMeshItemCount; k++){
13531
- material.setTexture("uSampler" + k, emptyTexture);
13532
- }
13583
+ material.setTexture("_MainTex", texture);
13533
13584
  };
13534
13585
  _proto.getItemGeometryData = function getItemGeometryData() {
13535
13586
  var renderer = this.renderer;
@@ -13647,7 +13698,7 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
13647
13698
  setBlendMode(material, states.blendMode);
13648
13699
  setMaskMode(material, states.maskMode);
13649
13700
  setSideMode(material, states.side);
13650
- material.shader.shaderData.properties = 'uSampler0("uSampler0",2D) = "white" {}';
13701
+ material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
13651
13702
  if (!material.hasUniform("_Color")) {
13652
13703
  material.setVector4("_Color", new Vector4(0, 0, 0, 1));
13653
13704
  }
@@ -15385,6 +15436,329 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
15385
15436
  return PolyStar;
15386
15437
  }(ShapePrimitive);
15387
15438
 
15439
+ // const tempPoints = [new Point(), new Point(), new Point(), new Point()];
15440
+ /**
15441
+ * The `Rectangle` object is an area defined by its position, as indicated by its upper-left corner
15442
+ * point (`x`, `y`) and by its `width` and its `height`.
15443
+ */ var Rectangle$1 = /*#__PURE__*/ function(ShapePrimitive) {
15444
+ _inherits(Rectangle, ShapePrimitive);
15445
+ function Rectangle(x, y, width, height) {
15446
+ if (x === void 0) x = 0;
15447
+ if (y === void 0) y = 0;
15448
+ if (width === void 0) width = 0;
15449
+ if (height === void 0) height = 0;
15450
+ var _this;
15451
+ _this = ShapePrimitive.call(this) || this;
15452
+ _this.x = Number(x);
15453
+ _this.y = Number(y);
15454
+ _this.width = Number(width);
15455
+ _this.height = Number(height);
15456
+ return _this;
15457
+ }
15458
+ var _proto = Rectangle.prototype;
15459
+ /** Determines whether the Rectangle is empty. */ _proto.isEmpty = function isEmpty() {
15460
+ return this.left === this.right || this.top === this.bottom;
15461
+ };
15462
+ /**
15463
+ * Creates a clone of this Rectangle
15464
+ * @returns a copy of the rectangle
15465
+ */ _proto.clone = function clone() {
15466
+ return new Rectangle(this.x, this.y, this.width, this.height);
15467
+ };
15468
+ /**
15469
+ * Converts a Bounds object to a Rectangle object.
15470
+ * @param bounds - The bounds to copy and convert to a rectangle.
15471
+ * @returns Returns itself.
15472
+ */ // copyFromBounds (bounds: Bounds): this {
15473
+ // this.x = bounds.minX;
15474
+ // this.y = bounds.minY;
15475
+ // this.width = bounds.maxX - bounds.minX;
15476
+ // this.height = bounds.maxY - bounds.minY;
15477
+ // return this;
15478
+ // }
15479
+ /**
15480
+ * Copies another rectangle to this one.
15481
+ * @param rectangle - The rectangle to copy from.
15482
+ * @returns Returns itself.
15483
+ */ _proto.copyFrom = function copyFrom(rectangle) {
15484
+ this.x = rectangle.x;
15485
+ this.y = rectangle.y;
15486
+ this.width = rectangle.width;
15487
+ this.height = rectangle.height;
15488
+ return this;
15489
+ };
15490
+ /**
15491
+ * Copies this rectangle to another one.
15492
+ * @param rectangle - The rectangle to copy to.
15493
+ * @returns Returns given parameter.
15494
+ */ _proto.copyTo = function copyTo(rectangle) {
15495
+ rectangle.copyFrom(this);
15496
+ return rectangle;
15497
+ };
15498
+ /**
15499
+ * Checks whether the x and y coordinates given are contained within this Rectangle
15500
+ * @param x - The X coordinate of the point to test
15501
+ * @param y - The Y coordinate of the point to test
15502
+ * @returns Whether the x/y coordinates are within this Rectangle
15503
+ */ _proto.contains = function contains(x, y) {
15504
+ if (this.width <= 0 || this.height <= 0) {
15505
+ return false;
15506
+ }
15507
+ if (x >= this.x && x < this.x + this.width) {
15508
+ if (y >= this.y && y < this.y + this.height) {
15509
+ return true;
15510
+ }
15511
+ }
15512
+ return false;
15513
+ };
15514
+ /**
15515
+ * Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
15516
+ * @param x - The X coordinate of the point to test
15517
+ * @param y - The Y coordinate of the point to test
15518
+ * @param strokeWidth - The width of the line to check
15519
+ * @returns Whether the x/y coordinates are within this rectangle
15520
+ */ _proto.strokeContains = function strokeContains(x, y, strokeWidth) {
15521
+ var _this = this, width = _this.width, height = _this.height;
15522
+ if (width <= 0 || height <= 0) {
15523
+ return false;
15524
+ }
15525
+ var _x = this.x;
15526
+ var _y = this.y;
15527
+ var outerLeft = _x - strokeWidth / 2;
15528
+ var outerRight = _x + width + strokeWidth / 2;
15529
+ var outerTop = _y - strokeWidth / 2;
15530
+ var outerBottom = _y + height + strokeWidth / 2;
15531
+ var innerLeft = _x + strokeWidth / 2;
15532
+ var innerRight = _x + width - strokeWidth / 2;
15533
+ var innerTop = _y + strokeWidth / 2;
15534
+ var innerBottom = _y + height - strokeWidth / 2;
15535
+ return x >= outerLeft && x <= outerRight && y >= outerTop && y <= outerBottom && !(x > innerLeft && x < innerRight && y > innerTop && y < innerBottom);
15536
+ };
15537
+ /**
15538
+ * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
15539
+ * Returns true only if the area of the intersection is >0, this means that Rectangles
15540
+ * sharing a side are not overlapping. Another side effect is that an arealess rectangle
15541
+ * (width or height equal to zero) can't intersect any other rectangle.
15542
+ * @param {Rectangle} other - The Rectangle to intersect with `this`.
15543
+ * @param {Matrix} transform - The transformation matrix of `other`.
15544
+ * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
15545
+ */ // intersects (other: Rectangle, transform?: Matrix4): boolean {
15546
+ // if (!transform) {
15547
+ // const x0 = this.x < other.x ? other.x : this.x;
15548
+ // const x1 = this.right > other.right ? other.right : this.right;
15549
+ // if (x1 <= x0) {
15550
+ // return false;
15551
+ // }
15552
+ // const y0 = this.y < other.y ? other.y : this.y;
15553
+ // const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;
15554
+ // return y1 > y0;
15555
+ // }
15556
+ // const x0 = this.left;
15557
+ // const x1 = this.right;
15558
+ // const y0 = this.top;
15559
+ // const y1 = this.bottom;
15560
+ // if (x1 <= x0 || y1 <= y0) {
15561
+ // return false;
15562
+ // }
15563
+ // const lt = tempPoints[0].set(other.left, other.top);
15564
+ // const lb = tempPoints[1].set(other.left, other.bottom);
15565
+ // const rt = tempPoints[2].set(other.right, other.top);
15566
+ // const rb = tempPoints[3].set(other.right, other.bottom);
15567
+ // if (rt.x <= lt.x || lb.y <= lt.y) {
15568
+ // return false;
15569
+ // }
15570
+ // const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));
15571
+ // if (s === 0) {
15572
+ // return false;
15573
+ // }
15574
+ // transform.apply(lt, lt);
15575
+ // transform.apply(lb, lb);
15576
+ // transform.apply(rt, rt);
15577
+ // transform.apply(rb, rb);
15578
+ // if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0
15579
+ // || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1
15580
+ // || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0
15581
+ // || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {
15582
+ // return false;
15583
+ // }
15584
+ // const nx = s * (lb.y - lt.y);
15585
+ // const ny = s * (lt.x - lb.x);
15586
+ // const n00 = (nx * x0) + (ny * y0);
15587
+ // const n10 = (nx * x1) + (ny * y0);
15588
+ // const n01 = (nx * x0) + (ny * y1);
15589
+ // const n11 = (nx * x1) + (ny * y1);
15590
+ // if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)
15591
+ // || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) {
15592
+ // return false;
15593
+ // }
15594
+ // const mx = s * (lt.y - rt.y);
15595
+ // const my = s * (rt.x - lt.x);
15596
+ // const m00 = (mx * x0) + (my * y0);
15597
+ // const m10 = (mx * x1) + (my * y0);
15598
+ // const m01 = (mx * x0) + (my * y1);
15599
+ // const m11 = (mx * x1) + (my * y1);
15600
+ // if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)
15601
+ // || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) {
15602
+ // return false;
15603
+ // }
15604
+ // return true;
15605
+ // }
15606
+ /**
15607
+ * Pads the rectangle making it grow in all directions.
15608
+ * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
15609
+ * @param paddingX - The horizontal padding amount.
15610
+ * @param paddingY - The vertical padding amount.
15611
+ * @returns Returns itself.
15612
+ */ _proto.pad = function pad(paddingX, paddingY) {
15613
+ if (paddingX === void 0) paddingX = 0;
15614
+ if (paddingY === void 0) paddingY = paddingX;
15615
+ this.x -= paddingX;
15616
+ this.y -= paddingY;
15617
+ this.width += paddingX * 2;
15618
+ this.height += paddingY * 2;
15619
+ return this;
15620
+ };
15621
+ /**
15622
+ * Fits this rectangle around the passed one.
15623
+ * @param rectangle - The rectangle to fit.
15624
+ * @returns Returns itself.
15625
+ */ _proto.fit = function fit(rectangle) {
15626
+ var x1 = Math.max(this.x, rectangle.x);
15627
+ var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
15628
+ var y1 = Math.max(this.y, rectangle.y);
15629
+ var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
15630
+ this.x = x1;
15631
+ this.width = Math.max(x2 - x1, 0);
15632
+ this.y = y1;
15633
+ this.height = Math.max(y2 - y1, 0);
15634
+ return this;
15635
+ };
15636
+ /**
15637
+ * Enlarges rectangle that way its corners lie on grid
15638
+ * @param resolution - resolution
15639
+ * @param eps - precision
15640
+ * @returns Returns itself.
15641
+ */ _proto.ceil = function ceil(resolution, eps) {
15642
+ if (resolution === void 0) resolution = 1;
15643
+ if (eps === void 0) eps = 0.001;
15644
+ var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
15645
+ var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
15646
+ this.x = Math.floor((this.x + eps) * resolution) / resolution;
15647
+ this.y = Math.floor((this.y + eps) * resolution) / resolution;
15648
+ this.width = x2 - this.x;
15649
+ this.height = y2 - this.y;
15650
+ return this;
15651
+ };
15652
+ /**
15653
+ * Enlarges this rectangle to include the passed rectangle.
15654
+ * @param rectangle - The rectangle to include.
15655
+ * @returns Returns itself.
15656
+ */ _proto.enlarge = function enlarge(rectangle) {
15657
+ var x1 = Math.min(this.x, rectangle.x);
15658
+ var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
15659
+ var y1 = Math.min(this.y, rectangle.y);
15660
+ var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
15661
+ this.x = x1;
15662
+ this.width = x2 - x1;
15663
+ this.y = y1;
15664
+ this.height = y2 - y1;
15665
+ return this;
15666
+ };
15667
+ /**
15668
+ * Returns the framing rectangle of the rectangle as a Rectangle object
15669
+ * @param out - optional rectangle to store the result
15670
+ * @returns The framing rectangle
15671
+ */ _proto.getBounds = function getBounds(out) {
15672
+ out = out || new Rectangle();
15673
+ out.copyFrom(this);
15674
+ return out;
15675
+ };
15676
+ _proto.getX = function getX() {
15677
+ return this.x;
15678
+ };
15679
+ _proto.getY = function getY() {
15680
+ return this.y;
15681
+ };
15682
+ _proto.build = function build(points) {
15683
+ var x = this.x;
15684
+ var y = this.y;
15685
+ var width = this.width;
15686
+ var height = this.height;
15687
+ if (!(width >= 0 && height >= 0)) {
15688
+ return points;
15689
+ }
15690
+ points[0] = x;
15691
+ points[1] = y;
15692
+ points[2] = x + width;
15693
+ points[3] = y;
15694
+ points[4] = x + width;
15695
+ points[5] = y + height;
15696
+ points[6] = x;
15697
+ points[7] = y + height;
15698
+ return points;
15699
+ };
15700
+ _proto.triangulate = function triangulate(points, vertices, verticesOffset, indices, indicesOffset) {
15701
+ var count = 0;
15702
+ var verticesStride = 2;
15703
+ verticesOffset *= verticesStride;
15704
+ vertices[verticesOffset + count] = points[0];
15705
+ vertices[verticesOffset + count + 1] = points[1];
15706
+ count += verticesStride;
15707
+ vertices[verticesOffset + count] = points[2];
15708
+ vertices[verticesOffset + count + 1] = points[3];
15709
+ count += verticesStride;
15710
+ vertices[verticesOffset + count] = points[6];
15711
+ vertices[verticesOffset + count + 1] = points[7];
15712
+ count += verticesStride;
15713
+ vertices[verticesOffset + count] = points[4];
15714
+ vertices[verticesOffset + count + 1] = points[5];
15715
+ count += verticesStride;
15716
+ var verticesIndex = verticesOffset / verticesStride;
15717
+ // triangle 1
15718
+ indices[indicesOffset++] = verticesIndex;
15719
+ indices[indicesOffset++] = verticesIndex + 1;
15720
+ indices[indicesOffset++] = verticesIndex + 2;
15721
+ // triangle 2
15722
+ indices[indicesOffset++] = verticesIndex + 1;
15723
+ indices[indicesOffset++] = verticesIndex + 3;
15724
+ indices[indicesOffset++] = verticesIndex + 2;
15725
+ };
15726
+ _create_class(Rectangle, [
15727
+ {
15728
+ key: "left",
15729
+ get: /** Returns the left edge of the rectangle. */ function get() {
15730
+ return this.x;
15731
+ }
15732
+ },
15733
+ {
15734
+ key: "right",
15735
+ get: /** Returns the right edge of the rectangle. */ function get() {
15736
+ return this.x + this.width;
15737
+ }
15738
+ },
15739
+ {
15740
+ key: "top",
15741
+ get: /** Returns the top edge of the rectangle. */ function get() {
15742
+ return this.y;
15743
+ }
15744
+ },
15745
+ {
15746
+ key: "bottom",
15747
+ get: /** Returns the bottom edge of the rectangle. */ function get() {
15748
+ return this.y + this.height;
15749
+ }
15750
+ }
15751
+ ], [
15752
+ {
15753
+ key: "EMPTY",
15754
+ get: /** A constant empty rectangle. This is a new object every time the property is accessed */ function get() {
15755
+ return new Rectangle(0, 0, 0, 0);
15756
+ }
15757
+ }
15758
+ ]);
15759
+ return Rectangle;
15760
+ }(ShapePrimitive);
15761
+
15388
15762
  var ShapePath = /*#__PURE__*/ function() {
15389
15763
  function ShapePath(graphicsPath) {
15390
15764
  this.graphicsPath = graphicsPath;
@@ -15421,6 +15795,11 @@ var ShapePath = /*#__PURE__*/ function() {
15421
15795
  this.polyStar(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
15422
15796
  break;
15423
15797
  }
15798
+ case "rect":
15799
+ {
15800
+ this.rect(data[0], data[1], data[2], data[3], data[4]);
15801
+ break;
15802
+ }
15424
15803
  }
15425
15804
  }
15426
15805
  this.endPoly();
@@ -15466,6 +15845,18 @@ var ShapePath = /*#__PURE__*/ function() {
15466
15845
  return this;
15467
15846
  };
15468
15847
  /**
15848
+ * Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
15849
+ * @param x - The x-coordinate of the upper-left corner of the rectangle.
15850
+ * @param y - The y-coordinate of the upper-left corner of the rectangle.
15851
+ * @param w - The width of the rectangle.
15852
+ * @param h - The height of the rectangle.
15853
+ * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
15854
+ * @returns The instance of the current object for chaining.
15855
+ */ _proto.rect = function rect(x, y, w, h, transform) {
15856
+ this.drawShape(new Rectangle$1(x, y, w, h), transform);
15857
+ return this;
15858
+ };
15859
+ /**
15469
15860
  * Draws a given shape on the canvas.
15470
15861
  * This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.
15471
15862
  * An optional transformation matrix can be applied to the shape, allowing for complex transformations.
@@ -15601,8 +15992,8 @@ var GraphicsPath = /*#__PURE__*/ function() {
15601
15992
  };
15602
15993
  /**
15603
15994
  * Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
15604
- * @param x - The x-coordinate of the top-left corner of the rectangle.
15605
- * @param y - The y-coordinate of the top-left corner of the rectangle.
15995
+ * @param x - The x-coordinate of the upper-left corner of the rectangle.
15996
+ * @param y - The y-coordinate of the upper-left corner of the rectangle.
15606
15997
  * @param w - The width of the rectangle.
15607
15998
  * @param h - The height of the rectangle.
15608
15999
  * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
@@ -15781,7 +16172,7 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
15781
16172
  this.path.clear();
15782
16173
  var shapeData = data;
15783
16174
  switch(shapeData.type){
15784
- case 0:
16175
+ case ShapePrimitiveType.Custom:
15785
16176
  {
15786
16177
  var customData = shapeData;
15787
16178
  var points = customData.points;
@@ -15818,28 +16209,28 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
15818
16209
  }
15819
16210
  break;
15820
16211
  }
15821
- case 2:
16212
+ case ShapePrimitiveType.Ellipse:
15822
16213
  {
15823
16214
  var ellipseData = shapeData;
15824
16215
  this.path.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
15825
16216
  this.setFillColor(ellipseData.fill);
15826
16217
  break;
15827
16218
  }
15828
- case 1:
16219
+ case ShapePrimitiveType.Rectangle:
15829
16220
  {
15830
16221
  var rectangleData = shapeData;
15831
- this.path.rect(-rectangleData.width / 2, rectangleData.height / 2, rectangleData.width, rectangleData.height);
16222
+ this.path.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height);
15832
16223
  this.setFillColor(rectangleData.fill);
15833
16224
  break;
15834
16225
  }
15835
- case 4:
16226
+ case ShapePrimitiveType.Star:
15836
16227
  {
15837
16228
  var starData = shapeData;
15838
16229
  this.path.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
15839
16230
  this.setFillColor(starData.fill);
15840
16231
  break;
15841
16232
  }
15842
- case 3:
16233
+ case ShapePrimitiveType.Polygon:
15843
16234
  {
15844
16235
  var polygonData = shapeData;
15845
16236
  this.path.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
@@ -15871,28 +16262,6 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
15871
16262
  ShapeComponent = __decorate([
15872
16263
  effectsClass("ShapeComponent")
15873
16264
  ], ShapeComponent);
15874
- var ShapePrimitiveType;
15875
- (function(ShapePrimitiveType) {
15876
- /**
15877
- * 自定义图形
15878
- */ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
15879
- /**
15880
- * 矩形
15881
- */ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
15882
- /**
15883
- * 椭圆
15884
- */ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
15885
- /**
15886
- * 多边形
15887
- */ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
15888
- /**
15889
- * 星形
15890
- */ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
15891
- })(ShapePrimitiveType || (ShapePrimitiveType = {}));
15892
- var ShapeConnectType;
15893
- (function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
15894
- var ShapePointType;
15895
- (function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
15896
16265
 
15897
16266
  var Fake3DComponent = /*#__PURE__*/ function(Component) {
15898
16267
  _inherits(Fake3DComponent, Component);
@@ -16455,7 +16824,7 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
16455
16824
  _proto.onDisable = function onDisable() {
16456
16825
  if (this.item && this.item.composition) {
16457
16826
  var _this_previewContent;
16458
- if (this.duringPlay) {
16827
+ if (this.duringPlay && !this.item.transform.getValid()) {
16459
16828
  this.item.composition.removeInteractiveItem(this.item, this.item.props.content.options.type);
16460
16829
  this.duringPlay = false;
16461
16830
  }
@@ -16658,10 +17027,10 @@ function shouldIgnoreBouncing(arg, mul) {
16658
17027
  return this.boundingBoxData;
16659
17028
  };
16660
17029
  _proto.getBoundingBox = function getBoundingBox() {
16661
- var maxX = 0;
16662
- var maxY = 0;
16663
- var minX = 0;
16664
- var minY = 0;
17030
+ var maxX = -Number.MAX_VALUE;
17031
+ var maxY = -Number.MAX_VALUE;
17032
+ var minX = Number.MAX_VALUE;
17033
+ var minY = Number.MAX_VALUE;
16665
17034
  for(var _iterator = _create_for_of_iterator_helper_loose(this.boundingBoxData.area), _step; !(_step = _iterator()).done;){
16666
17035
  var triangle = _step.value;
16667
17036
  maxX = Math.max(triangle.p0.x, triangle.p1.x, triangle.p2.x, maxX);
@@ -18078,7 +18447,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
18078
18447
  options: {}
18079
18448
  };
18080
18449
  }
18081
- if (duration <= 0) {
18450
+ if (duration < 0) {
18082
18451
  throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
18083
18452
  }
18084
18453
  this.rendererComponents.length = 0;
@@ -18439,6 +18808,16 @@ var SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
18439
18808
  }
18440
18809
  var life = Math.min(Math.max(time / duration, 0.0), 1.0);
18441
18810
  var ta = this.textureSheetAnimation;
18811
+ var video = this.renderer.texture.source.video;
18812
+ if (video) {
18813
+ if (time === 0) {
18814
+ video.pause();
18815
+ } else {
18816
+ video.play().catch(function(e) {
18817
+ _this.engine.renderErrors.add(e);
18818
+ });
18819
+ }
18820
+ }
18442
18821
  if (ta) {
18443
18822
  var _this_material_getVector4;
18444
18823
  var total = ta.total || ta.row * ta.col;
@@ -18493,21 +18872,20 @@ var SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
18493
18872
  dy
18494
18873
  ]);
18495
18874
  }
18496
- var video = this.renderer.texture.source.video;
18497
- if (video) {
18498
- if (time === 0 || time === this.item.duration) {
18499
- video.pause();
18500
- } else {
18501
- video.play().catch(function(e) {
18502
- _this.engine.renderErrors.add(e);
18503
- });
18504
- }
18505
- }
18506
18875
  };
18507
18876
  _proto.onDestroy = function onDestroy() {
18877
+ var textures = this.getTextures();
18508
18878
  if (this.item && this.item.composition) {
18509
- this.item.composition.destroyTextures(this.getTextures());
18879
+ this.item.composition.destroyTextures(textures);
18510
18880
  }
18881
+ textures.forEach(function(texture) {
18882
+ var source = texture.source;
18883
+ if (source.sourceType === TextureSourceType.video && (source == null ? void 0 : source.video)) {
18884
+ source.video.pause();
18885
+ source.video.src = "";
18886
+ source.video.load();
18887
+ }
18888
+ });
18511
18889
  };
18512
18890
  _proto.createGeometry = function createGeometry(mode) {
18513
18891
  var maxVertex = 12 * this.splits.length;
@@ -23999,6 +24377,51 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
23999
24377
  return Vector4PropertyMixerPlayable;
24000
24378
  }(Playable);
24001
24379
 
24380
+ var ColorPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24381
+ _inherits(ColorPropertyMixerPlayable, Playable);
24382
+ function ColorPropertyMixerPlayable() {
24383
+ var _this;
24384
+ _this = Playable.apply(this, arguments) || this;
24385
+ _this.propertyName = "";
24386
+ return _this;
24387
+ }
24388
+ var _proto = ColorPropertyMixerPlayable.prototype;
24389
+ _proto.processFrame = function processFrame(context) {
24390
+ var boundObject = context.output.getUserData();
24391
+ if (!boundObject) {
24392
+ return;
24393
+ }
24394
+ var hasInput = false;
24395
+ var value = boundObject[this.propertyName];
24396
+ if (!_instanceof1(value, Color)) {
24397
+ return;
24398
+ }
24399
+ value.setZero();
24400
+ // evaluate the curve
24401
+ for(var i = 0; i < this.getInputCount(); i++){
24402
+ var weight = this.getInputWeight(i);
24403
+ if (weight > 0) {
24404
+ var propertyClipPlayable = this.getInput(i);
24405
+ if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
24406
+ console.error("ColorPropertyMixerPlayable received incompatible input");
24407
+ continue;
24408
+ }
24409
+ var curveValue = propertyClipPlayable.value;
24410
+ value.r += curveValue.r * weight;
24411
+ value.g += curveValue.g * weight;
24412
+ value.b += curveValue.b * weight;
24413
+ value.a += curveValue.a * weight;
24414
+ hasInput = true;
24415
+ }
24416
+ }
24417
+ // set value
24418
+ if (hasInput) {
24419
+ boundObject[this.propertyName] = value;
24420
+ }
24421
+ };
24422
+ return ColorPropertyMixerPlayable;
24423
+ }(Playable);
24424
+
24002
24425
  var PropertyTrack = /*#__PURE__*/ function(TrackAsset) {
24003
24426
  _inherits(PropertyTrack, TrackAsset);
24004
24427
  function PropertyTrack() {
@@ -24158,7 +24581,7 @@ var ColorPropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
24158
24581
  }
24159
24582
  var _proto = ColorPropertyTrack.prototype;
24160
24583
  _proto.createTrackMixer = function createTrackMixer(graph) {
24161
- var mixer = new FloatPropertyMixerPlayable(graph);
24584
+ var mixer = new ColorPropertyMixerPlayable(graph);
24162
24585
  var propertyNames = this.propertyNames;
24163
24586
  if (propertyNames.length > 0) {
24164
24587
  var propertyName = propertyNames[propertyNames.length - 1];
@@ -24172,6 +24595,27 @@ ColorPropertyTrack = __decorate([
24172
24595
  effectsClass(DataType.ColorPropertyTrack)
24173
24596
  ], ColorPropertyTrack);
24174
24597
 
24598
+ var ColorPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
24599
+ _inherits(ColorPropertyPlayableAsset, PlayableAsset);
24600
+ function ColorPropertyPlayableAsset() {
24601
+ return PlayableAsset.apply(this, arguments);
24602
+ }
24603
+ var _proto = ColorPropertyPlayableAsset.prototype;
24604
+ _proto.createPlayable = function createPlayable(graph) {
24605
+ var clipPlayable = new PropertyClipPlayable(graph);
24606
+ clipPlayable.curve = createValueGetter(this.curveData);
24607
+ clipPlayable.value = clipPlayable.curve.getValue(0);
24608
+ return clipPlayable;
24609
+ };
24610
+ return ColorPropertyPlayableAsset;
24611
+ }(PlayableAsset);
24612
+ __decorate([
24613
+ serialize()
24614
+ ], ColorPropertyPlayableAsset.prototype, "curveData", void 0);
24615
+ ColorPropertyPlayableAsset = __decorate([
24616
+ effectsClass(DataType.ColorPropertyPlayableAsset)
24617
+ ], ColorPropertyPlayableAsset);
24618
+
24175
24619
  var FloatPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
24176
24620
  _inherits(FloatPropertyPlayableAsset, PlayableAsset);
24177
24621
  function FloatPropertyPlayableAsset() {
@@ -24376,6 +24820,27 @@ function compareTracks(a, b) {
24376
24820
  }
24377
24821
  }
24378
24822
 
24823
+ var Vector4PropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
24824
+ _inherits(Vector4PropertyPlayableAsset, PlayableAsset);
24825
+ function Vector4PropertyPlayableAsset() {
24826
+ return PlayableAsset.apply(this, arguments);
24827
+ }
24828
+ var _proto = Vector4PropertyPlayableAsset.prototype;
24829
+ _proto.createPlayable = function createPlayable(graph) {
24830
+ var clipPlayable = new PropertyClipPlayable(graph);
24831
+ clipPlayable.curve = createValueGetter(this.curveData);
24832
+ clipPlayable.value = clipPlayable.curve.getValue(0);
24833
+ return clipPlayable;
24834
+ };
24835
+ return Vector4PropertyPlayableAsset;
24836
+ }(PlayableAsset);
24837
+ __decorate([
24838
+ serialize()
24839
+ ], Vector4PropertyPlayableAsset.prototype, "curveData", void 0);
24840
+ Vector4PropertyPlayableAsset = __decorate([
24841
+ effectsClass("Vector4PropertyPlayableAsset")
24842
+ ], Vector4PropertyPlayableAsset);
24843
+
24379
24844
  var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
24380
24845
  _inherits(ObjectBindingTrack, TrackAsset1);
24381
24846
  function ObjectBindingTrack() {
@@ -24413,7 +24878,7 @@ var TextLayout = /*#__PURE__*/ function() {
24413
24878
  function TextLayout(options) {
24414
24879
  this.width = 0;
24415
24880
  this.height = 0;
24416
- 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;
24881
+ 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;
24417
24882
  var tempWidth = fontSize + letterSpace;
24418
24883
  this.autoWidth = autoWidth;
24419
24884
  this.maxTextWidth = text.length * tempWidth;
@@ -24980,7 +25445,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
24980
25445
  }
24981
25446
  //与 toDataURL() 两种方式都需要像素读取操作
24982
25447
  var imageData = context.getImageData(0, 0, this.canvas.width, this.canvas.height);
24983
- this.material.setTexture("uSampler0", Texture.createWithData(this.engine, {
25448
+ this.material.setTexture("_MainTex", Texture.createWithData(this.engine, {
24984
25449
  data: new Uint8Array(imageData.data),
24985
25450
  width: imageData.width,
24986
25451
  height: imageData.height
@@ -28178,7 +28643,7 @@ var listOrder = 0;
28178
28643
  var itemProps = sourceItemData;
28179
28644
  if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
28180
28645
  itemProps.listIndex = listOrder++;
28181
- if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || //@ts-expect-error
28646
+ if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine || //@ts-expect-error
28182
28647
  itemProps.type === ItemType.shape) {
28183
28648
  for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
28184
28649
  var componentPath = _step2.value;
@@ -28219,8 +28684,10 @@ var listOrder = 0;
28219
28684
  shapeData = shape;
28220
28685
  }
28221
28686
  if (shapeData !== undefined) {
28222
- // @ts-expect-error 类型转换问题
28223
- renderContent.renderer.shape = getGeometryByShape(shapeData, split);
28687
+ if (!("aPoint" in shapeData && "index" in shapeData)) {
28688
+ // @ts-expect-error 类型转换问题
28689
+ renderContent.renderer.shape = getGeometryByShape(shapeData, split);
28690
+ }
28224
28691
  }
28225
28692
  }
28226
28693
  if ("trails" in renderContent && renderContent.trails !== undefined) {
@@ -28587,16 +29054,15 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
28587
29054
  if (pause) {
28588
29055
  this.resume();
28589
29056
  }
28590
- if (!this.rootComposition.isStartCalled) {
28591
- this.rootComposition.onStart();
28592
- this.rootComposition.isStartCalled = true;
28593
- }
28594
29057
  this.setSpeed(1);
28595
29058
  this.forwardTime(time + this.startTime);
28596
29059
  this.setSpeed(speed);
28597
29060
  if (pause) {
28598
29061
  this.pause();
28599
29062
  }
29063
+ this.emit("goto", {
29064
+ time: time
29065
+ });
28600
29066
  };
28601
29067
  _proto.addItem = function addItem(item) {
28602
29068
  this.items.push(item);
@@ -31136,7 +31602,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
31136
31602
  registerPlugin("particle", ParticleLoader, VFXItem, true);
31137
31603
  registerPlugin("cal", CalculateLoader, VFXItem, true);
31138
31604
  registerPlugin("interact", InteractLoader, VFXItem, true);
31139
- var version$1 = "2.1.0-alpha.12";
31605
+ var version$1 = "2.1.0-alpha.14";
31140
31606
  logger.info("Core version: " + version$1 + ".");
31141
31607
 
31142
31608
  var _obj;
@@ -31172,22 +31638,7 @@ var _obj3;
31172
31638
  * 必须初始化的 uniform 的 map 对象(THREE 必须在初始化的时候赋值)
31173
31639
  */ var TEXTURE_UNIFORM_MAP = [
31174
31640
  "uMaskTex",
31175
- "uSampler0",
31176
- "uSampler1",
31177
- "uSampler2",
31178
- "uSampler3",
31179
- "uSampler4",
31180
- "uSampler5",
31181
- "uSampler6",
31182
- "uSampler7",
31183
- "uSampler8",
31184
- "uSampler9",
31185
- "uSampler10",
31186
- "uSampler11",
31187
- "uSampler12",
31188
- "uSampler13",
31189
- "uSampler14",
31190
- "uSampler15",
31641
+ "_MainTex",
31191
31642
  "uColorOverLifetime",
31192
31643
  "uColorOverTrail"
31193
31644
  ];
@@ -31218,9 +31669,7 @@ var _obj3;
31218
31669
  vertex: (_shader_vertex = shader == null ? void 0 : shader.vertex) != null ? _shader_vertex : "",
31219
31670
  fragment: (_shader_fragment = shader == null ? void 0 : shader.fragment) != null ? _shader_fragment : ""
31220
31671
  });
31221
- for(var i = 0; i < maxSpriteMeshItemCount; i++){
31222
- _this.uniforms["uSampler" + i] = new THREE.Uniform(null);
31223
- }
31672
+ _this.uniforms["_MainTex"] = new THREE.Uniform(null);
31224
31673
  _this.uniforms["uEditorTransform"] = new THREE.Uniform([
31225
31674
  1,
31226
31675
  1,
@@ -32780,8 +33229,8 @@ setMaxSpriteMeshItemCount(8);
32780
33229
  */ Mesh.create = function(engine, props) {
32781
33230
  return new ThreeMesh(engine, props);
32782
33231
  };
32783
- var version = "2.1.0-alpha.12";
33232
+ var version = "2.1.0-alpha.14";
32784
33233
  logger.info("THREEJS plugin version: " + version + ".");
32785
33234
 
32786
- export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, 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, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, 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, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
33235
+ export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, 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, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, 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, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
32787
33236
  //# sourceMappingURL=index.mjs.map