@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/components/shape-component.d.ts +2 -261
- package/dist/events/types.d.ts +7 -0
- package/dist/index.js +546 -80
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +547 -81
- package/dist/index.mjs.map +1 -1
- package/dist/material/material.d.ts +10 -0
- package/dist/plugins/shape/graphics-path.d.ts +2 -2
- package/dist/plugins/shape/rectangle.d.ts +1 -1
- package/dist/plugins/shape/shape-path.d.ts +10 -0
- package/dist/plugins/sprite/sprite-item.d.ts +1 -1
- package/dist/plugins/timeline/playable-assets/color-property-playable-asset.d.ts +1 -1
- package/dist/plugins/timeline/playable-assets/index.d.ts +2 -0
- package/dist/plugins/timeline/playable-assets/vector4-property-playable-asset.d.ts +1 -1
- package/dist/render/render-frame.d.ts +2 -0
- package/dist/render/renderer.d.ts +2 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.1.0-alpha.
|
|
6
|
+
* Version: v2.1.0-alpha.14
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -1622,6 +1622,34 @@ var BuiltinObjectGUID = {
|
|
|
1622
1622
|
UnlitShader: "unlit000000000000000000000000000"
|
|
1623
1623
|
};
|
|
1624
1624
|
|
|
1625
|
+
/**
|
|
1626
|
+
* 矢量图形类型
|
|
1627
|
+
*/ var ShapePrimitiveType;
|
|
1628
|
+
(function(ShapePrimitiveType) {
|
|
1629
|
+
/**
|
|
1630
|
+
* 自定义图形
|
|
1631
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
|
|
1632
|
+
/**
|
|
1633
|
+
* 矩形
|
|
1634
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
|
|
1635
|
+
/**
|
|
1636
|
+
* 椭圆
|
|
1637
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
|
|
1638
|
+
/**
|
|
1639
|
+
* 多边形
|
|
1640
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
|
|
1641
|
+
/**
|
|
1642
|
+
* 星形
|
|
1643
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
|
|
1644
|
+
})(ShapePrimitiveType || (ShapePrimitiveType = {}));
|
|
1645
|
+
|
|
1646
|
+
// 本期无该功能 待补充
|
|
1647
|
+
var ShapeConnectType;
|
|
1648
|
+
(function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
|
|
1649
|
+
// @待补充
|
|
1650
|
+
var ShapePointType;
|
|
1651
|
+
(function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
|
|
1652
|
+
|
|
1625
1653
|
/**
|
|
1626
1654
|
* 动态换图类型
|
|
1627
1655
|
* @since 1.1.0
|
|
@@ -1816,6 +1844,9 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1816
1844
|
get TextWeight () { return TextWeight; },
|
|
1817
1845
|
get FontStyle () { return FontStyle; },
|
|
1818
1846
|
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
1847
|
+
get ShapePrimitiveType () { return ShapePrimitiveType; },
|
|
1848
|
+
get ShapeConnectType () { return ShapeConnectType; },
|
|
1849
|
+
get ShapePointType () { return ShapePointType; },
|
|
1819
1850
|
get BackgroundType () { return BackgroundType; },
|
|
1820
1851
|
get MultimediaType () { return MultimediaType; },
|
|
1821
1852
|
get DataType () { return DataType; },
|
|
@@ -6945,6 +6976,28 @@ exports.MaterialRenderType = void 0;
|
|
|
6945
6976
|
this.shaderDirty = true;
|
|
6946
6977
|
}
|
|
6947
6978
|
},
|
|
6979
|
+
{
|
|
6980
|
+
key: "mainTexture",
|
|
6981
|
+
get: /**
|
|
6982
|
+
* 材质的主纹理
|
|
6983
|
+
*/ function get() {
|
|
6984
|
+
return this.getTexture("_MainTex");
|
|
6985
|
+
},
|
|
6986
|
+
set: function set(value) {
|
|
6987
|
+
this.setTexture("_MainTex", value);
|
|
6988
|
+
}
|
|
6989
|
+
},
|
|
6990
|
+
{
|
|
6991
|
+
key: "color",
|
|
6992
|
+
get: /**
|
|
6993
|
+
* 材质的主颜色
|
|
6994
|
+
*/ function get() {
|
|
6995
|
+
return this.getColor("_Color");
|
|
6996
|
+
},
|
|
6997
|
+
set: function set(value) {
|
|
6998
|
+
this.setColor("_Color", value);
|
|
6999
|
+
}
|
|
7000
|
+
},
|
|
6948
7001
|
{
|
|
6949
7002
|
key: "blending",
|
|
6950
7003
|
set: /******** effects-core 中会调用 引擎必须实现 ***********************/ /**
|
|
@@ -10081,7 +10134,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
|
|
|
10081
10134
|
|
|
10082
10135
|
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}";
|
|
10083
10136
|
|
|
10084
|
-
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D
|
|
10137
|
+
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;}";
|
|
10085
10138
|
|
|
10086
10139
|
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";
|
|
10087
10140
|
|
|
@@ -10610,6 +10663,9 @@ var seed$5 = 1;
|
|
|
10610
10663
|
this.renderer = renderer;
|
|
10611
10664
|
if (postProcessingEnabled) {
|
|
10612
10665
|
var enableHDR = true;
|
|
10666
|
+
if (!this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
|
|
10667
|
+
throw new Error("Half float texture is not supported.");
|
|
10668
|
+
}
|
|
10613
10669
|
// 使用HDR浮点纹理,FLOAT在IOS上报错,使用HALF_FLOAT
|
|
10614
10670
|
var textureType = enableHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
|
|
10615
10671
|
attachments = [
|
|
@@ -11330,7 +11386,7 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
|
|
|
11330
11386
|
var GlobalUniforms = function GlobalUniforms() {
|
|
11331
11387
|
this.floats = {};
|
|
11332
11388
|
this.ints = {};
|
|
11333
|
-
|
|
11389
|
+
this.vector3s = {};
|
|
11334
11390
|
this.vector4s = {};
|
|
11335
11391
|
this.matrices = {};
|
|
11336
11392
|
//...
|
|
@@ -11571,6 +11627,9 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
11571
11627
|
_proto.setGlobalVector4 = function setGlobalVector4(name, value) {
|
|
11572
11628
|
// OVERRIDE
|
|
11573
11629
|
};
|
|
11630
|
+
_proto.setGlobalVector3 = function setGlobalVector3(name, value) {
|
|
11631
|
+
// OVERRIDE
|
|
11632
|
+
};
|
|
11574
11633
|
_proto.setGlobalMatrix = function setGlobalMatrix(name, value) {
|
|
11575
11634
|
// OVERRIDE
|
|
11576
11635
|
};
|
|
@@ -13236,10 +13295,10 @@ var Vector4Curve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13236
13295
|
}
|
|
13237
13296
|
var _proto = Vector4Curve.prototype;
|
|
13238
13297
|
_proto.onCreate = function onCreate(arg) {
|
|
13239
|
-
this.xCurve = createValueGetter(arg
|
|
13240
|
-
this.yCurve = createValueGetter(arg
|
|
13241
|
-
this.zCurve = createValueGetter(arg
|
|
13242
|
-
this.wCurve = createValueGetter(arg
|
|
13298
|
+
this.xCurve = createValueGetter(arg[0]);
|
|
13299
|
+
this.yCurve = createValueGetter(arg[1]);
|
|
13300
|
+
this.zCurve = createValueGetter(arg[2]);
|
|
13301
|
+
this.wCurve = createValueGetter(arg[3]);
|
|
13243
13302
|
};
|
|
13244
13303
|
_proto.getValue = function getValue(t) {
|
|
13245
13304
|
var x = this.xCurve.getValue(t);
|
|
@@ -13339,10 +13398,10 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13339
13398
|
}
|
|
13340
13399
|
var _proto = ColorCurve.prototype;
|
|
13341
13400
|
_proto.onCreate = function onCreate(arg) {
|
|
13342
|
-
this.rCurve = createValueGetter(arg
|
|
13343
|
-
this.gCurve = createValueGetter(arg
|
|
13344
|
-
this.bCurve = createValueGetter(arg
|
|
13345
|
-
this.aCurve = createValueGetter(arg
|
|
13401
|
+
this.rCurve = createValueGetter(arg[0]);
|
|
13402
|
+
this.gCurve = createValueGetter(arg[1]);
|
|
13403
|
+
this.bCurve = createValueGetter(arg[2]);
|
|
13404
|
+
this.aCurve = createValueGetter(arg[3]);
|
|
13346
13405
|
};
|
|
13347
13406
|
_proto.getValue = function getValue(t) {
|
|
13348
13407
|
var r = this.rCurve.getValue(t);
|
|
@@ -13444,7 +13503,7 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13444
13503
|
* @param texture - 纹理对象
|
|
13445
13504
|
*/ _proto.setTexture = function setTexture(texture) {
|
|
13446
13505
|
this.renderer.texture = texture;
|
|
13447
|
-
this.material.setTexture("
|
|
13506
|
+
this.material.setTexture("_MainTex", texture);
|
|
13448
13507
|
};
|
|
13449
13508
|
/**
|
|
13450
13509
|
* @internal
|
|
@@ -13523,15 +13582,7 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13523
13582
|
geometry.setIndexData(indexData);
|
|
13524
13583
|
geometry.setAttributeData("atlasOffset", attributes.atlasOffset);
|
|
13525
13584
|
geometry.setDrawCount(data.index.length);
|
|
13526
|
-
|
|
13527
|
-
var texture1 = textures[i];
|
|
13528
|
-
material.setTexture("uSampler" + i, texture1);
|
|
13529
|
-
}
|
|
13530
|
-
// FIXME: 内存泄漏的临时方案,后面再调整
|
|
13531
|
-
var emptyTexture = this.emptyTexture;
|
|
13532
|
-
for(var k = textures.length; k < exports.maxSpriteMeshItemCount; k++){
|
|
13533
|
-
material.setTexture("uSampler" + k, emptyTexture);
|
|
13534
|
-
}
|
|
13585
|
+
material.setTexture("_MainTex", texture);
|
|
13535
13586
|
};
|
|
13536
13587
|
_proto.getItemGeometryData = function getItemGeometryData() {
|
|
13537
13588
|
var renderer = this.renderer;
|
|
@@ -13649,7 +13700,7 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13649
13700
|
setBlendMode(material, states.blendMode);
|
|
13650
13701
|
setMaskMode(material, states.maskMode);
|
|
13651
13702
|
setSideMode(material, states.side);
|
|
13652
|
-
material.shader.shaderData.properties = '
|
|
13703
|
+
material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
|
|
13653
13704
|
if (!material.hasUniform("_Color")) {
|
|
13654
13705
|
material.setVector4("_Color", new Vector4(0, 0, 0, 1));
|
|
13655
13706
|
}
|
|
@@ -15387,6 +15438,329 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
15387
15438
|
return PolyStar;
|
|
15388
15439
|
}(ShapePrimitive);
|
|
15389
15440
|
|
|
15441
|
+
// const tempPoints = [new Point(), new Point(), new Point(), new Point()];
|
|
15442
|
+
/**
|
|
15443
|
+
* The `Rectangle` object is an area defined by its position, as indicated by its upper-left corner
|
|
15444
|
+
* point (`x`, `y`) and by its `width` and its `height`.
|
|
15445
|
+
*/ var Rectangle$1 = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15446
|
+
_inherits(Rectangle, ShapePrimitive);
|
|
15447
|
+
function Rectangle(x, y, width, height) {
|
|
15448
|
+
if (x === void 0) x = 0;
|
|
15449
|
+
if (y === void 0) y = 0;
|
|
15450
|
+
if (width === void 0) width = 0;
|
|
15451
|
+
if (height === void 0) height = 0;
|
|
15452
|
+
var _this;
|
|
15453
|
+
_this = ShapePrimitive.call(this) || this;
|
|
15454
|
+
_this.x = Number(x);
|
|
15455
|
+
_this.y = Number(y);
|
|
15456
|
+
_this.width = Number(width);
|
|
15457
|
+
_this.height = Number(height);
|
|
15458
|
+
return _this;
|
|
15459
|
+
}
|
|
15460
|
+
var _proto = Rectangle.prototype;
|
|
15461
|
+
/** Determines whether the Rectangle is empty. */ _proto.isEmpty = function isEmpty() {
|
|
15462
|
+
return this.left === this.right || this.top === this.bottom;
|
|
15463
|
+
};
|
|
15464
|
+
/**
|
|
15465
|
+
* Creates a clone of this Rectangle
|
|
15466
|
+
* @returns a copy of the rectangle
|
|
15467
|
+
*/ _proto.clone = function clone() {
|
|
15468
|
+
return new Rectangle(this.x, this.y, this.width, this.height);
|
|
15469
|
+
};
|
|
15470
|
+
/**
|
|
15471
|
+
* Converts a Bounds object to a Rectangle object.
|
|
15472
|
+
* @param bounds - The bounds to copy and convert to a rectangle.
|
|
15473
|
+
* @returns Returns itself.
|
|
15474
|
+
*/ // copyFromBounds (bounds: Bounds): this {
|
|
15475
|
+
// this.x = bounds.minX;
|
|
15476
|
+
// this.y = bounds.minY;
|
|
15477
|
+
// this.width = bounds.maxX - bounds.minX;
|
|
15478
|
+
// this.height = bounds.maxY - bounds.minY;
|
|
15479
|
+
// return this;
|
|
15480
|
+
// }
|
|
15481
|
+
/**
|
|
15482
|
+
* Copies another rectangle to this one.
|
|
15483
|
+
* @param rectangle - The rectangle to copy from.
|
|
15484
|
+
* @returns Returns itself.
|
|
15485
|
+
*/ _proto.copyFrom = function copyFrom(rectangle) {
|
|
15486
|
+
this.x = rectangle.x;
|
|
15487
|
+
this.y = rectangle.y;
|
|
15488
|
+
this.width = rectangle.width;
|
|
15489
|
+
this.height = rectangle.height;
|
|
15490
|
+
return this;
|
|
15491
|
+
};
|
|
15492
|
+
/**
|
|
15493
|
+
* Copies this rectangle to another one.
|
|
15494
|
+
* @param rectangle - The rectangle to copy to.
|
|
15495
|
+
* @returns Returns given parameter.
|
|
15496
|
+
*/ _proto.copyTo = function copyTo(rectangle) {
|
|
15497
|
+
rectangle.copyFrom(this);
|
|
15498
|
+
return rectangle;
|
|
15499
|
+
};
|
|
15500
|
+
/**
|
|
15501
|
+
* Checks whether the x and y coordinates given are contained within this Rectangle
|
|
15502
|
+
* @param x - The X coordinate of the point to test
|
|
15503
|
+
* @param y - The Y coordinate of the point to test
|
|
15504
|
+
* @returns Whether the x/y coordinates are within this Rectangle
|
|
15505
|
+
*/ _proto.contains = function contains(x, y) {
|
|
15506
|
+
if (this.width <= 0 || this.height <= 0) {
|
|
15507
|
+
return false;
|
|
15508
|
+
}
|
|
15509
|
+
if (x >= this.x && x < this.x + this.width) {
|
|
15510
|
+
if (y >= this.y && y < this.y + this.height) {
|
|
15511
|
+
return true;
|
|
15512
|
+
}
|
|
15513
|
+
}
|
|
15514
|
+
return false;
|
|
15515
|
+
};
|
|
15516
|
+
/**
|
|
15517
|
+
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
|
15518
|
+
* @param x - The X coordinate of the point to test
|
|
15519
|
+
* @param y - The Y coordinate of the point to test
|
|
15520
|
+
* @param strokeWidth - The width of the line to check
|
|
15521
|
+
* @returns Whether the x/y coordinates are within this rectangle
|
|
15522
|
+
*/ _proto.strokeContains = function strokeContains(x, y, strokeWidth) {
|
|
15523
|
+
var _this = this, width = _this.width, height = _this.height;
|
|
15524
|
+
if (width <= 0 || height <= 0) {
|
|
15525
|
+
return false;
|
|
15526
|
+
}
|
|
15527
|
+
var _x = this.x;
|
|
15528
|
+
var _y = this.y;
|
|
15529
|
+
var outerLeft = _x - strokeWidth / 2;
|
|
15530
|
+
var outerRight = _x + width + strokeWidth / 2;
|
|
15531
|
+
var outerTop = _y - strokeWidth / 2;
|
|
15532
|
+
var outerBottom = _y + height + strokeWidth / 2;
|
|
15533
|
+
var innerLeft = _x + strokeWidth / 2;
|
|
15534
|
+
var innerRight = _x + width - strokeWidth / 2;
|
|
15535
|
+
var innerTop = _y + strokeWidth / 2;
|
|
15536
|
+
var innerBottom = _y + height - strokeWidth / 2;
|
|
15537
|
+
return x >= outerLeft && x <= outerRight && y >= outerTop && y <= outerBottom && !(x > innerLeft && x < innerRight && y > innerTop && y < innerBottom);
|
|
15538
|
+
};
|
|
15539
|
+
/**
|
|
15540
|
+
* Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
|
|
15541
|
+
* Returns true only if the area of the intersection is >0, this means that Rectangles
|
|
15542
|
+
* sharing a side are not overlapping. Another side effect is that an arealess rectangle
|
|
15543
|
+
* (width or height equal to zero) can't intersect any other rectangle.
|
|
15544
|
+
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
|
15545
|
+
* @param {Matrix} transform - The transformation matrix of `other`.
|
|
15546
|
+
* @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
|
|
15547
|
+
*/ // intersects (other: Rectangle, transform?: Matrix4): boolean {
|
|
15548
|
+
// if (!transform) {
|
|
15549
|
+
// const x0 = this.x < other.x ? other.x : this.x;
|
|
15550
|
+
// const x1 = this.right > other.right ? other.right : this.right;
|
|
15551
|
+
// if (x1 <= x0) {
|
|
15552
|
+
// return false;
|
|
15553
|
+
// }
|
|
15554
|
+
// const y0 = this.y < other.y ? other.y : this.y;
|
|
15555
|
+
// const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;
|
|
15556
|
+
// return y1 > y0;
|
|
15557
|
+
// }
|
|
15558
|
+
// const x0 = this.left;
|
|
15559
|
+
// const x1 = this.right;
|
|
15560
|
+
// const y0 = this.top;
|
|
15561
|
+
// const y1 = this.bottom;
|
|
15562
|
+
// if (x1 <= x0 || y1 <= y0) {
|
|
15563
|
+
// return false;
|
|
15564
|
+
// }
|
|
15565
|
+
// const lt = tempPoints[0].set(other.left, other.top);
|
|
15566
|
+
// const lb = tempPoints[1].set(other.left, other.bottom);
|
|
15567
|
+
// const rt = tempPoints[2].set(other.right, other.top);
|
|
15568
|
+
// const rb = tempPoints[3].set(other.right, other.bottom);
|
|
15569
|
+
// if (rt.x <= lt.x || lb.y <= lt.y) {
|
|
15570
|
+
// return false;
|
|
15571
|
+
// }
|
|
15572
|
+
// const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));
|
|
15573
|
+
// if (s === 0) {
|
|
15574
|
+
// return false;
|
|
15575
|
+
// }
|
|
15576
|
+
// transform.apply(lt, lt);
|
|
15577
|
+
// transform.apply(lb, lb);
|
|
15578
|
+
// transform.apply(rt, rt);
|
|
15579
|
+
// transform.apply(rb, rb);
|
|
15580
|
+
// if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0
|
|
15581
|
+
// || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1
|
|
15582
|
+
// || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0
|
|
15583
|
+
// || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {
|
|
15584
|
+
// return false;
|
|
15585
|
+
// }
|
|
15586
|
+
// const nx = s * (lb.y - lt.y);
|
|
15587
|
+
// const ny = s * (lt.x - lb.x);
|
|
15588
|
+
// const n00 = (nx * x0) + (ny * y0);
|
|
15589
|
+
// const n10 = (nx * x1) + (ny * y0);
|
|
15590
|
+
// const n01 = (nx * x0) + (ny * y1);
|
|
15591
|
+
// const n11 = (nx * x1) + (ny * y1);
|
|
15592
|
+
// if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)
|
|
15593
|
+
// || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) {
|
|
15594
|
+
// return false;
|
|
15595
|
+
// }
|
|
15596
|
+
// const mx = s * (lt.y - rt.y);
|
|
15597
|
+
// const my = s * (rt.x - lt.x);
|
|
15598
|
+
// const m00 = (mx * x0) + (my * y0);
|
|
15599
|
+
// const m10 = (mx * x1) + (my * y0);
|
|
15600
|
+
// const m01 = (mx * x0) + (my * y1);
|
|
15601
|
+
// const m11 = (mx * x1) + (my * y1);
|
|
15602
|
+
// if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)
|
|
15603
|
+
// || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) {
|
|
15604
|
+
// return false;
|
|
15605
|
+
// }
|
|
15606
|
+
// return true;
|
|
15607
|
+
// }
|
|
15608
|
+
/**
|
|
15609
|
+
* Pads the rectangle making it grow in all directions.
|
|
15610
|
+
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
|
15611
|
+
* @param paddingX - The horizontal padding amount.
|
|
15612
|
+
* @param paddingY - The vertical padding amount.
|
|
15613
|
+
* @returns Returns itself.
|
|
15614
|
+
*/ _proto.pad = function pad(paddingX, paddingY) {
|
|
15615
|
+
if (paddingX === void 0) paddingX = 0;
|
|
15616
|
+
if (paddingY === void 0) paddingY = paddingX;
|
|
15617
|
+
this.x -= paddingX;
|
|
15618
|
+
this.y -= paddingY;
|
|
15619
|
+
this.width += paddingX * 2;
|
|
15620
|
+
this.height += paddingY * 2;
|
|
15621
|
+
return this;
|
|
15622
|
+
};
|
|
15623
|
+
/**
|
|
15624
|
+
* Fits this rectangle around the passed one.
|
|
15625
|
+
* @param rectangle - The rectangle to fit.
|
|
15626
|
+
* @returns Returns itself.
|
|
15627
|
+
*/ _proto.fit = function fit(rectangle) {
|
|
15628
|
+
var x1 = Math.max(this.x, rectangle.x);
|
|
15629
|
+
var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
|
|
15630
|
+
var y1 = Math.max(this.y, rectangle.y);
|
|
15631
|
+
var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
|
|
15632
|
+
this.x = x1;
|
|
15633
|
+
this.width = Math.max(x2 - x1, 0);
|
|
15634
|
+
this.y = y1;
|
|
15635
|
+
this.height = Math.max(y2 - y1, 0);
|
|
15636
|
+
return this;
|
|
15637
|
+
};
|
|
15638
|
+
/**
|
|
15639
|
+
* Enlarges rectangle that way its corners lie on grid
|
|
15640
|
+
* @param resolution - resolution
|
|
15641
|
+
* @param eps - precision
|
|
15642
|
+
* @returns Returns itself.
|
|
15643
|
+
*/ _proto.ceil = function ceil(resolution, eps) {
|
|
15644
|
+
if (resolution === void 0) resolution = 1;
|
|
15645
|
+
if (eps === void 0) eps = 0.001;
|
|
15646
|
+
var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
|
|
15647
|
+
var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
|
|
15648
|
+
this.x = Math.floor((this.x + eps) * resolution) / resolution;
|
|
15649
|
+
this.y = Math.floor((this.y + eps) * resolution) / resolution;
|
|
15650
|
+
this.width = x2 - this.x;
|
|
15651
|
+
this.height = y2 - this.y;
|
|
15652
|
+
return this;
|
|
15653
|
+
};
|
|
15654
|
+
/**
|
|
15655
|
+
* Enlarges this rectangle to include the passed rectangle.
|
|
15656
|
+
* @param rectangle - The rectangle to include.
|
|
15657
|
+
* @returns Returns itself.
|
|
15658
|
+
*/ _proto.enlarge = function enlarge(rectangle) {
|
|
15659
|
+
var x1 = Math.min(this.x, rectangle.x);
|
|
15660
|
+
var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
|
|
15661
|
+
var y1 = Math.min(this.y, rectangle.y);
|
|
15662
|
+
var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
|
|
15663
|
+
this.x = x1;
|
|
15664
|
+
this.width = x2 - x1;
|
|
15665
|
+
this.y = y1;
|
|
15666
|
+
this.height = y2 - y1;
|
|
15667
|
+
return this;
|
|
15668
|
+
};
|
|
15669
|
+
/**
|
|
15670
|
+
* Returns the framing rectangle of the rectangle as a Rectangle object
|
|
15671
|
+
* @param out - optional rectangle to store the result
|
|
15672
|
+
* @returns The framing rectangle
|
|
15673
|
+
*/ _proto.getBounds = function getBounds(out) {
|
|
15674
|
+
out = out || new Rectangle();
|
|
15675
|
+
out.copyFrom(this);
|
|
15676
|
+
return out;
|
|
15677
|
+
};
|
|
15678
|
+
_proto.getX = function getX() {
|
|
15679
|
+
return this.x;
|
|
15680
|
+
};
|
|
15681
|
+
_proto.getY = function getY() {
|
|
15682
|
+
return this.y;
|
|
15683
|
+
};
|
|
15684
|
+
_proto.build = function build(points) {
|
|
15685
|
+
var x = this.x;
|
|
15686
|
+
var y = this.y;
|
|
15687
|
+
var width = this.width;
|
|
15688
|
+
var height = this.height;
|
|
15689
|
+
if (!(width >= 0 && height >= 0)) {
|
|
15690
|
+
return points;
|
|
15691
|
+
}
|
|
15692
|
+
points[0] = x;
|
|
15693
|
+
points[1] = y;
|
|
15694
|
+
points[2] = x + width;
|
|
15695
|
+
points[3] = y;
|
|
15696
|
+
points[4] = x + width;
|
|
15697
|
+
points[5] = y + height;
|
|
15698
|
+
points[6] = x;
|
|
15699
|
+
points[7] = y + height;
|
|
15700
|
+
return points;
|
|
15701
|
+
};
|
|
15702
|
+
_proto.triangulate = function triangulate(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15703
|
+
var count = 0;
|
|
15704
|
+
var verticesStride = 2;
|
|
15705
|
+
verticesOffset *= verticesStride;
|
|
15706
|
+
vertices[verticesOffset + count] = points[0];
|
|
15707
|
+
vertices[verticesOffset + count + 1] = points[1];
|
|
15708
|
+
count += verticesStride;
|
|
15709
|
+
vertices[verticesOffset + count] = points[2];
|
|
15710
|
+
vertices[verticesOffset + count + 1] = points[3];
|
|
15711
|
+
count += verticesStride;
|
|
15712
|
+
vertices[verticesOffset + count] = points[6];
|
|
15713
|
+
vertices[verticesOffset + count + 1] = points[7];
|
|
15714
|
+
count += verticesStride;
|
|
15715
|
+
vertices[verticesOffset + count] = points[4];
|
|
15716
|
+
vertices[verticesOffset + count + 1] = points[5];
|
|
15717
|
+
count += verticesStride;
|
|
15718
|
+
var verticesIndex = verticesOffset / verticesStride;
|
|
15719
|
+
// triangle 1
|
|
15720
|
+
indices[indicesOffset++] = verticesIndex;
|
|
15721
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15722
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15723
|
+
// triangle 2
|
|
15724
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15725
|
+
indices[indicesOffset++] = verticesIndex + 3;
|
|
15726
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15727
|
+
};
|
|
15728
|
+
_create_class(Rectangle, [
|
|
15729
|
+
{
|
|
15730
|
+
key: "left",
|
|
15731
|
+
get: /** Returns the left edge of the rectangle. */ function get() {
|
|
15732
|
+
return this.x;
|
|
15733
|
+
}
|
|
15734
|
+
},
|
|
15735
|
+
{
|
|
15736
|
+
key: "right",
|
|
15737
|
+
get: /** Returns the right edge of the rectangle. */ function get() {
|
|
15738
|
+
return this.x + this.width;
|
|
15739
|
+
}
|
|
15740
|
+
},
|
|
15741
|
+
{
|
|
15742
|
+
key: "top",
|
|
15743
|
+
get: /** Returns the top edge of the rectangle. */ function get() {
|
|
15744
|
+
return this.y;
|
|
15745
|
+
}
|
|
15746
|
+
},
|
|
15747
|
+
{
|
|
15748
|
+
key: "bottom",
|
|
15749
|
+
get: /** Returns the bottom edge of the rectangle. */ function get() {
|
|
15750
|
+
return this.y + this.height;
|
|
15751
|
+
}
|
|
15752
|
+
}
|
|
15753
|
+
], [
|
|
15754
|
+
{
|
|
15755
|
+
key: "EMPTY",
|
|
15756
|
+
get: /** A constant empty rectangle. This is a new object every time the property is accessed */ function get() {
|
|
15757
|
+
return new Rectangle(0, 0, 0, 0);
|
|
15758
|
+
}
|
|
15759
|
+
}
|
|
15760
|
+
]);
|
|
15761
|
+
return Rectangle;
|
|
15762
|
+
}(ShapePrimitive);
|
|
15763
|
+
|
|
15390
15764
|
var ShapePath = /*#__PURE__*/ function() {
|
|
15391
15765
|
function ShapePath(graphicsPath) {
|
|
15392
15766
|
this.graphicsPath = graphicsPath;
|
|
@@ -15423,6 +15797,11 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15423
15797
|
this.polyStar(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
15424
15798
|
break;
|
|
15425
15799
|
}
|
|
15800
|
+
case "rect":
|
|
15801
|
+
{
|
|
15802
|
+
this.rect(data[0], data[1], data[2], data[3], data[4]);
|
|
15803
|
+
break;
|
|
15804
|
+
}
|
|
15426
15805
|
}
|
|
15427
15806
|
}
|
|
15428
15807
|
this.endPoly();
|
|
@@ -15468,6 +15847,18 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15468
15847
|
return this;
|
|
15469
15848
|
};
|
|
15470
15849
|
/**
|
|
15850
|
+
* Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
|
|
15851
|
+
* @param x - The x-coordinate of the upper-left corner of the rectangle.
|
|
15852
|
+
* @param y - The y-coordinate of the upper-left corner of the rectangle.
|
|
15853
|
+
* @param w - The width of the rectangle.
|
|
15854
|
+
* @param h - The height of the rectangle.
|
|
15855
|
+
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
15856
|
+
* @returns The instance of the current object for chaining.
|
|
15857
|
+
*/ _proto.rect = function rect(x, y, w, h, transform) {
|
|
15858
|
+
this.drawShape(new Rectangle$1(x, y, w, h), transform);
|
|
15859
|
+
return this;
|
|
15860
|
+
};
|
|
15861
|
+
/**
|
|
15471
15862
|
* Draws a given shape on the canvas.
|
|
15472
15863
|
* This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.
|
|
15473
15864
|
* An optional transformation matrix can be applied to the shape, allowing for complex transformations.
|
|
@@ -15603,8 +15994,8 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
15603
15994
|
};
|
|
15604
15995
|
/**
|
|
15605
15996
|
* Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
|
|
15606
|
-
* @param x - The x-coordinate of the
|
|
15607
|
-
* @param y - The y-coordinate of the
|
|
15997
|
+
* @param x - The x-coordinate of the upper-left corner of the rectangle.
|
|
15998
|
+
* @param y - The y-coordinate of the upper-left corner of the rectangle.
|
|
15608
15999
|
* @param w - The width of the rectangle.
|
|
15609
16000
|
* @param h - The height of the rectangle.
|
|
15610
16001
|
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
@@ -15783,7 +16174,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15783
16174
|
this.path.clear();
|
|
15784
16175
|
var shapeData = data;
|
|
15785
16176
|
switch(shapeData.type){
|
|
15786
|
-
case
|
|
16177
|
+
case ShapePrimitiveType.Custom:
|
|
15787
16178
|
{
|
|
15788
16179
|
var customData = shapeData;
|
|
15789
16180
|
var points = customData.points;
|
|
@@ -15820,28 +16211,28 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15820
16211
|
}
|
|
15821
16212
|
break;
|
|
15822
16213
|
}
|
|
15823
|
-
case
|
|
16214
|
+
case ShapePrimitiveType.Ellipse:
|
|
15824
16215
|
{
|
|
15825
16216
|
var ellipseData = shapeData;
|
|
15826
16217
|
this.path.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
|
|
15827
16218
|
this.setFillColor(ellipseData.fill);
|
|
15828
16219
|
break;
|
|
15829
16220
|
}
|
|
15830
|
-
case
|
|
16221
|
+
case ShapePrimitiveType.Rectangle:
|
|
15831
16222
|
{
|
|
15832
16223
|
var rectangleData = shapeData;
|
|
15833
|
-
this.path.rect(-rectangleData.width / 2, rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
16224
|
+
this.path.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
15834
16225
|
this.setFillColor(rectangleData.fill);
|
|
15835
16226
|
break;
|
|
15836
16227
|
}
|
|
15837
|
-
case
|
|
16228
|
+
case ShapePrimitiveType.Star:
|
|
15838
16229
|
{
|
|
15839
16230
|
var starData = shapeData;
|
|
15840
16231
|
this.path.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
|
|
15841
16232
|
this.setFillColor(starData.fill);
|
|
15842
16233
|
break;
|
|
15843
16234
|
}
|
|
15844
|
-
case
|
|
16235
|
+
case ShapePrimitiveType.Polygon:
|
|
15845
16236
|
{
|
|
15846
16237
|
var polygonData = shapeData;
|
|
15847
16238
|
this.path.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
|
|
@@ -15873,28 +16264,6 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15873
16264
|
exports.ShapeComponent = __decorate([
|
|
15874
16265
|
effectsClass("ShapeComponent")
|
|
15875
16266
|
], exports.ShapeComponent);
|
|
15876
|
-
exports.ShapePrimitiveType = void 0;
|
|
15877
|
-
(function(ShapePrimitiveType) {
|
|
15878
|
-
/**
|
|
15879
|
-
* 自定义图形
|
|
15880
|
-
*/ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
|
|
15881
|
-
/**
|
|
15882
|
-
* 矩形
|
|
15883
|
-
*/ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
|
|
15884
|
-
/**
|
|
15885
|
-
* 椭圆
|
|
15886
|
-
*/ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
|
|
15887
|
-
/**
|
|
15888
|
-
* 多边形
|
|
15889
|
-
*/ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
|
|
15890
|
-
/**
|
|
15891
|
-
* 星形
|
|
15892
|
-
*/ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
|
|
15893
|
-
})(exports.ShapePrimitiveType || (exports.ShapePrimitiveType = {}));
|
|
15894
|
-
exports.ShapeConnectType = void 0;
|
|
15895
|
-
(function(ShapeConnectType) {})(exports.ShapeConnectType || (exports.ShapeConnectType = {}));
|
|
15896
|
-
exports.ShapePointType = void 0;
|
|
15897
|
-
(function(ShapePointType) {})(exports.ShapePointType || (exports.ShapePointType = {}));
|
|
15898
16267
|
|
|
15899
16268
|
exports.Fake3DComponent = /*#__PURE__*/ function(Component) {
|
|
15900
16269
|
_inherits(Fake3DComponent, Component);
|
|
@@ -16457,7 +16826,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16457
16826
|
_proto.onDisable = function onDisable() {
|
|
16458
16827
|
if (this.item && this.item.composition) {
|
|
16459
16828
|
var _this_previewContent;
|
|
16460
|
-
if (this.duringPlay) {
|
|
16829
|
+
if (this.duringPlay && !this.item.transform.getValid()) {
|
|
16461
16830
|
this.item.composition.removeInteractiveItem(this.item, this.item.props.content.options.type);
|
|
16462
16831
|
this.duringPlay = false;
|
|
16463
16832
|
}
|
|
@@ -16660,10 +17029,10 @@ function shouldIgnoreBouncing(arg, mul) {
|
|
|
16660
17029
|
return this.boundingBoxData;
|
|
16661
17030
|
};
|
|
16662
17031
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
16663
|
-
var maxX =
|
|
16664
|
-
var maxY =
|
|
16665
|
-
var minX =
|
|
16666
|
-
var minY =
|
|
17032
|
+
var maxX = -Number.MAX_VALUE;
|
|
17033
|
+
var maxY = -Number.MAX_VALUE;
|
|
17034
|
+
var minX = Number.MAX_VALUE;
|
|
17035
|
+
var minY = Number.MAX_VALUE;
|
|
16667
17036
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.boundingBoxData.area), _step; !(_step = _iterator()).done;){
|
|
16668
17037
|
var triangle = _step.value;
|
|
16669
17038
|
maxX = Math.max(triangle.p0.x, triangle.p1.x, triangle.p2.x, maxX);
|
|
@@ -18080,7 +18449,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
18080
18449
|
options: {}
|
|
18081
18450
|
};
|
|
18082
18451
|
}
|
|
18083
|
-
if (duration
|
|
18452
|
+
if (duration < 0) {
|
|
18084
18453
|
throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
|
|
18085
18454
|
}
|
|
18086
18455
|
this.rendererComponents.length = 0;
|
|
@@ -18441,6 +18810,16 @@ exports.SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
18441
18810
|
}
|
|
18442
18811
|
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
18443
18812
|
var ta = this.textureSheetAnimation;
|
|
18813
|
+
var video = this.renderer.texture.source.video;
|
|
18814
|
+
if (video) {
|
|
18815
|
+
if (time === 0) {
|
|
18816
|
+
video.pause();
|
|
18817
|
+
} else {
|
|
18818
|
+
video.play().catch(function(e) {
|
|
18819
|
+
_this.engine.renderErrors.add(e);
|
|
18820
|
+
});
|
|
18821
|
+
}
|
|
18822
|
+
}
|
|
18444
18823
|
if (ta) {
|
|
18445
18824
|
var _this_material_getVector4;
|
|
18446
18825
|
var total = ta.total || ta.row * ta.col;
|
|
@@ -18495,21 +18874,20 @@ exports.SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
18495
18874
|
dy
|
|
18496
18875
|
]);
|
|
18497
18876
|
}
|
|
18498
|
-
var video = this.renderer.texture.source.video;
|
|
18499
|
-
if (video) {
|
|
18500
|
-
if (time === 0 || time === this.item.duration) {
|
|
18501
|
-
video.pause();
|
|
18502
|
-
} else {
|
|
18503
|
-
video.play().catch(function(e) {
|
|
18504
|
-
_this.engine.renderErrors.add(e);
|
|
18505
|
-
});
|
|
18506
|
-
}
|
|
18507
|
-
}
|
|
18508
18877
|
};
|
|
18509
18878
|
_proto.onDestroy = function onDestroy() {
|
|
18879
|
+
var textures = this.getTextures();
|
|
18510
18880
|
if (this.item && this.item.composition) {
|
|
18511
|
-
this.item.composition.destroyTextures(
|
|
18881
|
+
this.item.composition.destroyTextures(textures);
|
|
18512
18882
|
}
|
|
18883
|
+
textures.forEach(function(texture) {
|
|
18884
|
+
var source = texture.source;
|
|
18885
|
+
if (source.sourceType === exports.TextureSourceType.video && (source == null ? void 0 : source.video)) {
|
|
18886
|
+
source.video.pause();
|
|
18887
|
+
source.video.src = "";
|
|
18888
|
+
source.video.load();
|
|
18889
|
+
}
|
|
18890
|
+
});
|
|
18513
18891
|
};
|
|
18514
18892
|
_proto.createGeometry = function createGeometry(mode) {
|
|
18515
18893
|
var maxVertex = 12 * this.splits.length;
|
|
@@ -24001,6 +24379,51 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
24001
24379
|
return Vector4PropertyMixerPlayable;
|
|
24002
24380
|
}(Playable);
|
|
24003
24381
|
|
|
24382
|
+
var ColorPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
24383
|
+
_inherits(ColorPropertyMixerPlayable, Playable);
|
|
24384
|
+
function ColorPropertyMixerPlayable() {
|
|
24385
|
+
var _this;
|
|
24386
|
+
_this = Playable.apply(this, arguments) || this;
|
|
24387
|
+
_this.propertyName = "";
|
|
24388
|
+
return _this;
|
|
24389
|
+
}
|
|
24390
|
+
var _proto = ColorPropertyMixerPlayable.prototype;
|
|
24391
|
+
_proto.processFrame = function processFrame(context) {
|
|
24392
|
+
var boundObject = context.output.getUserData();
|
|
24393
|
+
if (!boundObject) {
|
|
24394
|
+
return;
|
|
24395
|
+
}
|
|
24396
|
+
var hasInput = false;
|
|
24397
|
+
var value = boundObject[this.propertyName];
|
|
24398
|
+
if (!_instanceof1(value, Color)) {
|
|
24399
|
+
return;
|
|
24400
|
+
}
|
|
24401
|
+
value.setZero();
|
|
24402
|
+
// evaluate the curve
|
|
24403
|
+
for(var i = 0; i < this.getInputCount(); i++){
|
|
24404
|
+
var weight = this.getInputWeight(i);
|
|
24405
|
+
if (weight > 0) {
|
|
24406
|
+
var propertyClipPlayable = this.getInput(i);
|
|
24407
|
+
if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
|
|
24408
|
+
console.error("ColorPropertyMixerPlayable received incompatible input");
|
|
24409
|
+
continue;
|
|
24410
|
+
}
|
|
24411
|
+
var curveValue = propertyClipPlayable.value;
|
|
24412
|
+
value.r += curveValue.r * weight;
|
|
24413
|
+
value.g += curveValue.g * weight;
|
|
24414
|
+
value.b += curveValue.b * weight;
|
|
24415
|
+
value.a += curveValue.a * weight;
|
|
24416
|
+
hasInput = true;
|
|
24417
|
+
}
|
|
24418
|
+
}
|
|
24419
|
+
// set value
|
|
24420
|
+
if (hasInput) {
|
|
24421
|
+
boundObject[this.propertyName] = value;
|
|
24422
|
+
}
|
|
24423
|
+
};
|
|
24424
|
+
return ColorPropertyMixerPlayable;
|
|
24425
|
+
}(Playable);
|
|
24426
|
+
|
|
24004
24427
|
var PropertyTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
24005
24428
|
_inherits(PropertyTrack, TrackAsset);
|
|
24006
24429
|
function PropertyTrack() {
|
|
@@ -24160,7 +24583,7 @@ exports.ColorPropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
|
|
|
24160
24583
|
}
|
|
24161
24584
|
var _proto = ColorPropertyTrack.prototype;
|
|
24162
24585
|
_proto.createTrackMixer = function createTrackMixer(graph) {
|
|
24163
|
-
var mixer = new
|
|
24586
|
+
var mixer = new ColorPropertyMixerPlayable(graph);
|
|
24164
24587
|
var propertyNames = this.propertyNames;
|
|
24165
24588
|
if (propertyNames.length > 0) {
|
|
24166
24589
|
var propertyName = propertyNames[propertyNames.length - 1];
|
|
@@ -24174,6 +24597,27 @@ exports.ColorPropertyTrack = __decorate([
|
|
|
24174
24597
|
effectsClass(DataType.ColorPropertyTrack)
|
|
24175
24598
|
], exports.ColorPropertyTrack);
|
|
24176
24599
|
|
|
24600
|
+
exports.ColorPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
24601
|
+
_inherits(ColorPropertyPlayableAsset, PlayableAsset);
|
|
24602
|
+
function ColorPropertyPlayableAsset() {
|
|
24603
|
+
return PlayableAsset.apply(this, arguments);
|
|
24604
|
+
}
|
|
24605
|
+
var _proto = ColorPropertyPlayableAsset.prototype;
|
|
24606
|
+
_proto.createPlayable = function createPlayable(graph) {
|
|
24607
|
+
var clipPlayable = new PropertyClipPlayable(graph);
|
|
24608
|
+
clipPlayable.curve = createValueGetter(this.curveData);
|
|
24609
|
+
clipPlayable.value = clipPlayable.curve.getValue(0);
|
|
24610
|
+
return clipPlayable;
|
|
24611
|
+
};
|
|
24612
|
+
return ColorPropertyPlayableAsset;
|
|
24613
|
+
}(PlayableAsset);
|
|
24614
|
+
__decorate([
|
|
24615
|
+
serialize()
|
|
24616
|
+
], exports.ColorPropertyPlayableAsset.prototype, "curveData", void 0);
|
|
24617
|
+
exports.ColorPropertyPlayableAsset = __decorate([
|
|
24618
|
+
effectsClass(DataType.ColorPropertyPlayableAsset)
|
|
24619
|
+
], exports.ColorPropertyPlayableAsset);
|
|
24620
|
+
|
|
24177
24621
|
exports.FloatPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
24178
24622
|
_inherits(FloatPropertyPlayableAsset, PlayableAsset);
|
|
24179
24623
|
function FloatPropertyPlayableAsset() {
|
|
@@ -24378,6 +24822,27 @@ function compareTracks(a, b) {
|
|
|
24378
24822
|
}
|
|
24379
24823
|
}
|
|
24380
24824
|
|
|
24825
|
+
exports.Vector4PropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
24826
|
+
_inherits(Vector4PropertyPlayableAsset, PlayableAsset);
|
|
24827
|
+
function Vector4PropertyPlayableAsset() {
|
|
24828
|
+
return PlayableAsset.apply(this, arguments);
|
|
24829
|
+
}
|
|
24830
|
+
var _proto = Vector4PropertyPlayableAsset.prototype;
|
|
24831
|
+
_proto.createPlayable = function createPlayable(graph) {
|
|
24832
|
+
var clipPlayable = new PropertyClipPlayable(graph);
|
|
24833
|
+
clipPlayable.curve = createValueGetter(this.curveData);
|
|
24834
|
+
clipPlayable.value = clipPlayable.curve.getValue(0);
|
|
24835
|
+
return clipPlayable;
|
|
24836
|
+
};
|
|
24837
|
+
return Vector4PropertyPlayableAsset;
|
|
24838
|
+
}(PlayableAsset);
|
|
24839
|
+
__decorate([
|
|
24840
|
+
serialize()
|
|
24841
|
+
], exports.Vector4PropertyPlayableAsset.prototype, "curveData", void 0);
|
|
24842
|
+
exports.Vector4PropertyPlayableAsset = __decorate([
|
|
24843
|
+
effectsClass("Vector4PropertyPlayableAsset")
|
|
24844
|
+
], exports.Vector4PropertyPlayableAsset);
|
|
24845
|
+
|
|
24381
24846
|
exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
|
|
24382
24847
|
_inherits(ObjectBindingTrack, TrackAsset1);
|
|
24383
24848
|
function ObjectBindingTrack() {
|
|
@@ -24415,7 +24880,7 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
24415
24880
|
function TextLayout(options) {
|
|
24416
24881
|
this.width = 0;
|
|
24417
24882
|
this.height = 0;
|
|
24418
|
-
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,
|
|
24883
|
+
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;
|
|
24419
24884
|
var tempWidth = fontSize + letterSpace;
|
|
24420
24885
|
this.autoWidth = autoWidth;
|
|
24421
24886
|
this.maxTextWidth = text.length * tempWidth;
|
|
@@ -24982,7 +25447,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
24982
25447
|
}
|
|
24983
25448
|
//与 toDataURL() 两种方式都需要像素读取操作
|
|
24984
25449
|
var imageData = context.getImageData(0, 0, this.canvas.width, this.canvas.height);
|
|
24985
|
-
this.material.setTexture("
|
|
25450
|
+
this.material.setTexture("_MainTex", Texture.createWithData(this.engine, {
|
|
24986
25451
|
data: new Uint8Array(imageData.data),
|
|
24987
25452
|
width: imageData.width,
|
|
24988
25453
|
height: imageData.height
|
|
@@ -28180,7 +28645,7 @@ var listOrder = 0;
|
|
|
28180
28645
|
var itemProps = sourceItemData;
|
|
28181
28646
|
if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
|
|
28182
28647
|
itemProps.listIndex = listOrder++;
|
|
28183
|
-
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || //@ts-expect-error
|
|
28648
|
+
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine || //@ts-expect-error
|
|
28184
28649
|
itemProps.type === ItemType.shape) {
|
|
28185
28650
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
|
|
28186
28651
|
var componentPath = _step2.value;
|
|
@@ -28221,8 +28686,10 @@ var listOrder = 0;
|
|
|
28221
28686
|
shapeData = shape;
|
|
28222
28687
|
}
|
|
28223
28688
|
if (shapeData !== undefined) {
|
|
28224
|
-
|
|
28225
|
-
|
|
28689
|
+
if (!("aPoint" in shapeData && "index" in shapeData)) {
|
|
28690
|
+
// @ts-expect-error 类型转换问题
|
|
28691
|
+
renderContent.renderer.shape = getGeometryByShape(shapeData, split);
|
|
28692
|
+
}
|
|
28226
28693
|
}
|
|
28227
28694
|
}
|
|
28228
28695
|
if ("trails" in renderContent && renderContent.trails !== undefined) {
|
|
@@ -28589,16 +29056,15 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28589
29056
|
if (pause) {
|
|
28590
29057
|
this.resume();
|
|
28591
29058
|
}
|
|
28592
|
-
if (!this.rootComposition.isStartCalled) {
|
|
28593
|
-
this.rootComposition.onStart();
|
|
28594
|
-
this.rootComposition.isStartCalled = true;
|
|
28595
|
-
}
|
|
28596
29059
|
this.setSpeed(1);
|
|
28597
29060
|
this.forwardTime(time + this.startTime);
|
|
28598
29061
|
this.setSpeed(speed);
|
|
28599
29062
|
if (pause) {
|
|
28600
29063
|
this.pause();
|
|
28601
29064
|
}
|
|
29065
|
+
this.emit("goto", {
|
|
29066
|
+
time: time
|
|
29067
|
+
});
|
|
28602
29068
|
};
|
|
28603
29069
|
_proto.addItem = function addItem(item) {
|
|
28604
29070
|
this.items.push(item);
|
|
@@ -31138,7 +31604,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
31138
31604
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
31139
31605
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
31140
31606
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
31141
|
-
var version = "2.1.0-alpha.
|
|
31607
|
+
var version = "2.1.0-alpha.14";
|
|
31142
31608
|
logger.info("Core version: " + version + ".");
|
|
31143
31609
|
|
|
31144
31610
|
exports.AbstractPlugin = AbstractPlugin;
|