@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.js +549 -100
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +550 -101
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
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.
|
|
6
|
+
* Version: v2.1.0-alpha.14
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -1644,6 +1644,34 @@ var BuiltinObjectGUID = {
|
|
|
1644
1644
|
UnlitShader: "unlit000000000000000000000000000"
|
|
1645
1645
|
};
|
|
1646
1646
|
|
|
1647
|
+
/**
|
|
1648
|
+
* 矢量图形类型
|
|
1649
|
+
*/ var ShapePrimitiveType;
|
|
1650
|
+
(function(ShapePrimitiveType) {
|
|
1651
|
+
/**
|
|
1652
|
+
* 自定义图形
|
|
1653
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
|
|
1654
|
+
/**
|
|
1655
|
+
* 矩形
|
|
1656
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
|
|
1657
|
+
/**
|
|
1658
|
+
* 椭圆
|
|
1659
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
|
|
1660
|
+
/**
|
|
1661
|
+
* 多边形
|
|
1662
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
|
|
1663
|
+
/**
|
|
1664
|
+
* 星形
|
|
1665
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
|
|
1666
|
+
})(ShapePrimitiveType || (ShapePrimitiveType = {}));
|
|
1667
|
+
|
|
1668
|
+
// 本期无该功能 待补充
|
|
1669
|
+
var ShapeConnectType;
|
|
1670
|
+
(function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
|
|
1671
|
+
// @待补充
|
|
1672
|
+
var ShapePointType;
|
|
1673
|
+
(function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
|
|
1674
|
+
|
|
1647
1675
|
/**
|
|
1648
1676
|
* 动态换图类型
|
|
1649
1677
|
* @since 1.1.0
|
|
@@ -1838,6 +1866,9 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1838
1866
|
get TextWeight () { return TextWeight; },
|
|
1839
1867
|
get FontStyle () { return FontStyle; },
|
|
1840
1868
|
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
1869
|
+
get ShapePrimitiveType () { return ShapePrimitiveType; },
|
|
1870
|
+
get ShapeConnectType () { return ShapeConnectType; },
|
|
1871
|
+
get ShapePointType () { return ShapePointType; },
|
|
1841
1872
|
get BackgroundType () { return BackgroundType; },
|
|
1842
1873
|
get MultimediaType () { return MultimediaType; },
|
|
1843
1874
|
get DataType () { return DataType; },
|
|
@@ -6967,6 +6998,28 @@ exports.MaterialRenderType = void 0;
|
|
|
6967
6998
|
this.shaderDirty = true;
|
|
6968
6999
|
}
|
|
6969
7000
|
},
|
|
7001
|
+
{
|
|
7002
|
+
key: "mainTexture",
|
|
7003
|
+
get: /**
|
|
7004
|
+
* 材质的主纹理
|
|
7005
|
+
*/ function get() {
|
|
7006
|
+
return this.getTexture("_MainTex");
|
|
7007
|
+
},
|
|
7008
|
+
set: function set(value) {
|
|
7009
|
+
this.setTexture("_MainTex", value);
|
|
7010
|
+
}
|
|
7011
|
+
},
|
|
7012
|
+
{
|
|
7013
|
+
key: "color",
|
|
7014
|
+
get: /**
|
|
7015
|
+
* 材质的主颜色
|
|
7016
|
+
*/ function get() {
|
|
7017
|
+
return this.getColor("_Color");
|
|
7018
|
+
},
|
|
7019
|
+
set: function set(value) {
|
|
7020
|
+
this.setColor("_Color", value);
|
|
7021
|
+
}
|
|
7022
|
+
},
|
|
6970
7023
|
{
|
|
6971
7024
|
key: "blending",
|
|
6972
7025
|
set: /******** effects-core 中会调用 引擎必须实现 ***********************/ /**
|
|
@@ -10103,7 +10156,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
|
|
|
10103
10156
|
|
|
10104
10157
|
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}";
|
|
10105
10158
|
|
|
10106
|
-
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D
|
|
10159
|
+
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;}";
|
|
10107
10160
|
|
|
10108
10161
|
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";
|
|
10109
10162
|
|
|
@@ -10632,6 +10685,9 @@ var seed$6 = 1;
|
|
|
10632
10685
|
this.renderer = renderer;
|
|
10633
10686
|
if (postProcessingEnabled) {
|
|
10634
10687
|
var enableHDR = true;
|
|
10688
|
+
if (!this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
|
|
10689
|
+
throw new Error("Half float texture is not supported.");
|
|
10690
|
+
}
|
|
10635
10691
|
// 使用HDR浮点纹理,FLOAT在IOS上报错,使用HALF_FLOAT
|
|
10636
10692
|
var textureType = enableHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
|
|
10637
10693
|
attachments = [
|
|
@@ -11352,7 +11408,7 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
|
|
|
11352
11408
|
var GlobalUniforms = function GlobalUniforms() {
|
|
11353
11409
|
this.floats = {};
|
|
11354
11410
|
this.ints = {};
|
|
11355
|
-
|
|
11411
|
+
this.vector3s = {};
|
|
11356
11412
|
this.vector4s = {};
|
|
11357
11413
|
this.matrices = {};
|
|
11358
11414
|
//...
|
|
@@ -11593,6 +11649,9 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
11593
11649
|
_proto.setGlobalVector4 = function setGlobalVector4(name, value) {
|
|
11594
11650
|
// OVERRIDE
|
|
11595
11651
|
};
|
|
11652
|
+
_proto.setGlobalVector3 = function setGlobalVector3(name, value) {
|
|
11653
|
+
// OVERRIDE
|
|
11654
|
+
};
|
|
11596
11655
|
_proto.setGlobalMatrix = function setGlobalMatrix(name, value) {
|
|
11597
11656
|
// OVERRIDE
|
|
11598
11657
|
};
|
|
@@ -13258,10 +13317,10 @@ var Vector4Curve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13258
13317
|
}
|
|
13259
13318
|
var _proto = Vector4Curve.prototype;
|
|
13260
13319
|
_proto.onCreate = function onCreate(arg) {
|
|
13261
|
-
this.xCurve = createValueGetter(arg
|
|
13262
|
-
this.yCurve = createValueGetter(arg
|
|
13263
|
-
this.zCurve = createValueGetter(arg
|
|
13264
|
-
this.wCurve = createValueGetter(arg
|
|
13320
|
+
this.xCurve = createValueGetter(arg[0]);
|
|
13321
|
+
this.yCurve = createValueGetter(arg[1]);
|
|
13322
|
+
this.zCurve = createValueGetter(arg[2]);
|
|
13323
|
+
this.wCurve = createValueGetter(arg[3]);
|
|
13265
13324
|
};
|
|
13266
13325
|
_proto.getValue = function getValue(t) {
|
|
13267
13326
|
var x = this.xCurve.getValue(t);
|
|
@@ -13361,10 +13420,10 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13361
13420
|
}
|
|
13362
13421
|
var _proto = ColorCurve.prototype;
|
|
13363
13422
|
_proto.onCreate = function onCreate(arg) {
|
|
13364
|
-
this.rCurve = createValueGetter(arg
|
|
13365
|
-
this.gCurve = createValueGetter(arg
|
|
13366
|
-
this.bCurve = createValueGetter(arg
|
|
13367
|
-
this.aCurve = createValueGetter(arg
|
|
13423
|
+
this.rCurve = createValueGetter(arg[0]);
|
|
13424
|
+
this.gCurve = createValueGetter(arg[1]);
|
|
13425
|
+
this.bCurve = createValueGetter(arg[2]);
|
|
13426
|
+
this.aCurve = createValueGetter(arg[3]);
|
|
13368
13427
|
};
|
|
13369
13428
|
_proto.getValue = function getValue(t) {
|
|
13370
13429
|
var r = this.rCurve.getValue(t);
|
|
@@ -13466,7 +13525,7 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13466
13525
|
* @param texture - 纹理对象
|
|
13467
13526
|
*/ _proto.setTexture = function setTexture(texture) {
|
|
13468
13527
|
this.renderer.texture = texture;
|
|
13469
|
-
this.material.setTexture("
|
|
13528
|
+
this.material.setTexture("_MainTex", texture);
|
|
13470
13529
|
};
|
|
13471
13530
|
/**
|
|
13472
13531
|
* @internal
|
|
@@ -13545,15 +13604,7 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13545
13604
|
geometry.setIndexData(indexData);
|
|
13546
13605
|
geometry.setAttributeData("atlasOffset", attributes.atlasOffset);
|
|
13547
13606
|
geometry.setDrawCount(data.index.length);
|
|
13548
|
-
|
|
13549
|
-
var texture1 = textures[i];
|
|
13550
|
-
material.setTexture("uSampler" + i, texture1);
|
|
13551
|
-
}
|
|
13552
|
-
// FIXME: 内存泄漏的临时方案,后面再调整
|
|
13553
|
-
var emptyTexture = this.emptyTexture;
|
|
13554
|
-
for(var k = textures.length; k < exports.maxSpriteMeshItemCount; k++){
|
|
13555
|
-
material.setTexture("uSampler" + k, emptyTexture);
|
|
13556
|
-
}
|
|
13607
|
+
material.setTexture("_MainTex", texture);
|
|
13557
13608
|
};
|
|
13558
13609
|
_proto.getItemGeometryData = function getItemGeometryData() {
|
|
13559
13610
|
var renderer = this.renderer;
|
|
@@ -13671,7 +13722,7 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13671
13722
|
setBlendMode(material, states.blendMode);
|
|
13672
13723
|
setMaskMode(material, states.maskMode);
|
|
13673
13724
|
setSideMode(material, states.side);
|
|
13674
|
-
material.shader.shaderData.properties = '
|
|
13725
|
+
material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
|
|
13675
13726
|
if (!material.hasUniform("_Color")) {
|
|
13676
13727
|
material.setVector4("_Color", new Vector4(0, 0, 0, 1));
|
|
13677
13728
|
}
|
|
@@ -15409,6 +15460,329 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
15409
15460
|
return PolyStar;
|
|
15410
15461
|
}(ShapePrimitive);
|
|
15411
15462
|
|
|
15463
|
+
// const tempPoints = [new Point(), new Point(), new Point(), new Point()];
|
|
15464
|
+
/**
|
|
15465
|
+
* The `Rectangle` object is an area defined by its position, as indicated by its upper-left corner
|
|
15466
|
+
* point (`x`, `y`) and by its `width` and its `height`.
|
|
15467
|
+
*/ var Rectangle$1 = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15468
|
+
_inherits(Rectangle, ShapePrimitive);
|
|
15469
|
+
function Rectangle(x, y, width, height) {
|
|
15470
|
+
if (x === void 0) x = 0;
|
|
15471
|
+
if (y === void 0) y = 0;
|
|
15472
|
+
if (width === void 0) width = 0;
|
|
15473
|
+
if (height === void 0) height = 0;
|
|
15474
|
+
var _this;
|
|
15475
|
+
_this = ShapePrimitive.call(this) || this;
|
|
15476
|
+
_this.x = Number(x);
|
|
15477
|
+
_this.y = Number(y);
|
|
15478
|
+
_this.width = Number(width);
|
|
15479
|
+
_this.height = Number(height);
|
|
15480
|
+
return _this;
|
|
15481
|
+
}
|
|
15482
|
+
var _proto = Rectangle.prototype;
|
|
15483
|
+
/** Determines whether the Rectangle is empty. */ _proto.isEmpty = function isEmpty() {
|
|
15484
|
+
return this.left === this.right || this.top === this.bottom;
|
|
15485
|
+
};
|
|
15486
|
+
/**
|
|
15487
|
+
* Creates a clone of this Rectangle
|
|
15488
|
+
* @returns a copy of the rectangle
|
|
15489
|
+
*/ _proto.clone = function clone() {
|
|
15490
|
+
return new Rectangle(this.x, this.y, this.width, this.height);
|
|
15491
|
+
};
|
|
15492
|
+
/**
|
|
15493
|
+
* Converts a Bounds object to a Rectangle object.
|
|
15494
|
+
* @param bounds - The bounds to copy and convert to a rectangle.
|
|
15495
|
+
* @returns Returns itself.
|
|
15496
|
+
*/ // copyFromBounds (bounds: Bounds): this {
|
|
15497
|
+
// this.x = bounds.minX;
|
|
15498
|
+
// this.y = bounds.minY;
|
|
15499
|
+
// this.width = bounds.maxX - bounds.minX;
|
|
15500
|
+
// this.height = bounds.maxY - bounds.minY;
|
|
15501
|
+
// return this;
|
|
15502
|
+
// }
|
|
15503
|
+
/**
|
|
15504
|
+
* Copies another rectangle to this one.
|
|
15505
|
+
* @param rectangle - The rectangle to copy from.
|
|
15506
|
+
* @returns Returns itself.
|
|
15507
|
+
*/ _proto.copyFrom = function copyFrom(rectangle) {
|
|
15508
|
+
this.x = rectangle.x;
|
|
15509
|
+
this.y = rectangle.y;
|
|
15510
|
+
this.width = rectangle.width;
|
|
15511
|
+
this.height = rectangle.height;
|
|
15512
|
+
return this;
|
|
15513
|
+
};
|
|
15514
|
+
/**
|
|
15515
|
+
* Copies this rectangle to another one.
|
|
15516
|
+
* @param rectangle - The rectangle to copy to.
|
|
15517
|
+
* @returns Returns given parameter.
|
|
15518
|
+
*/ _proto.copyTo = function copyTo(rectangle) {
|
|
15519
|
+
rectangle.copyFrom(this);
|
|
15520
|
+
return rectangle;
|
|
15521
|
+
};
|
|
15522
|
+
/**
|
|
15523
|
+
* Checks whether the x and y coordinates given are contained within this Rectangle
|
|
15524
|
+
* @param x - The X coordinate of the point to test
|
|
15525
|
+
* @param y - The Y coordinate of the point to test
|
|
15526
|
+
* @returns Whether the x/y coordinates are within this Rectangle
|
|
15527
|
+
*/ _proto.contains = function contains(x, y) {
|
|
15528
|
+
if (this.width <= 0 || this.height <= 0) {
|
|
15529
|
+
return false;
|
|
15530
|
+
}
|
|
15531
|
+
if (x >= this.x && x < this.x + this.width) {
|
|
15532
|
+
if (y >= this.y && y < this.y + this.height) {
|
|
15533
|
+
return true;
|
|
15534
|
+
}
|
|
15535
|
+
}
|
|
15536
|
+
return false;
|
|
15537
|
+
};
|
|
15538
|
+
/**
|
|
15539
|
+
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
|
15540
|
+
* @param x - The X coordinate of the point to test
|
|
15541
|
+
* @param y - The Y coordinate of the point to test
|
|
15542
|
+
* @param strokeWidth - The width of the line to check
|
|
15543
|
+
* @returns Whether the x/y coordinates are within this rectangle
|
|
15544
|
+
*/ _proto.strokeContains = function strokeContains(x, y, strokeWidth) {
|
|
15545
|
+
var _this = this, width = _this.width, height = _this.height;
|
|
15546
|
+
if (width <= 0 || height <= 0) {
|
|
15547
|
+
return false;
|
|
15548
|
+
}
|
|
15549
|
+
var _x = this.x;
|
|
15550
|
+
var _y = this.y;
|
|
15551
|
+
var outerLeft = _x - strokeWidth / 2;
|
|
15552
|
+
var outerRight = _x + width + strokeWidth / 2;
|
|
15553
|
+
var outerTop = _y - strokeWidth / 2;
|
|
15554
|
+
var outerBottom = _y + height + strokeWidth / 2;
|
|
15555
|
+
var innerLeft = _x + strokeWidth / 2;
|
|
15556
|
+
var innerRight = _x + width - strokeWidth / 2;
|
|
15557
|
+
var innerTop = _y + strokeWidth / 2;
|
|
15558
|
+
var innerBottom = _y + height - strokeWidth / 2;
|
|
15559
|
+
return x >= outerLeft && x <= outerRight && y >= outerTop && y <= outerBottom && !(x > innerLeft && x < innerRight && y > innerTop && y < innerBottom);
|
|
15560
|
+
};
|
|
15561
|
+
/**
|
|
15562
|
+
* Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
|
|
15563
|
+
* Returns true only if the area of the intersection is >0, this means that Rectangles
|
|
15564
|
+
* sharing a side are not overlapping. Another side effect is that an arealess rectangle
|
|
15565
|
+
* (width or height equal to zero) can't intersect any other rectangle.
|
|
15566
|
+
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
|
15567
|
+
* @param {Matrix} transform - The transformation matrix of `other`.
|
|
15568
|
+
* @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
|
|
15569
|
+
*/ // intersects (other: Rectangle, transform?: Matrix4): boolean {
|
|
15570
|
+
// if (!transform) {
|
|
15571
|
+
// const x0 = this.x < other.x ? other.x : this.x;
|
|
15572
|
+
// const x1 = this.right > other.right ? other.right : this.right;
|
|
15573
|
+
// if (x1 <= x0) {
|
|
15574
|
+
// return false;
|
|
15575
|
+
// }
|
|
15576
|
+
// const y0 = this.y < other.y ? other.y : this.y;
|
|
15577
|
+
// const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;
|
|
15578
|
+
// return y1 > y0;
|
|
15579
|
+
// }
|
|
15580
|
+
// const x0 = this.left;
|
|
15581
|
+
// const x1 = this.right;
|
|
15582
|
+
// const y0 = this.top;
|
|
15583
|
+
// const y1 = this.bottom;
|
|
15584
|
+
// if (x1 <= x0 || y1 <= y0) {
|
|
15585
|
+
// return false;
|
|
15586
|
+
// }
|
|
15587
|
+
// const lt = tempPoints[0].set(other.left, other.top);
|
|
15588
|
+
// const lb = tempPoints[1].set(other.left, other.bottom);
|
|
15589
|
+
// const rt = tempPoints[2].set(other.right, other.top);
|
|
15590
|
+
// const rb = tempPoints[3].set(other.right, other.bottom);
|
|
15591
|
+
// if (rt.x <= lt.x || lb.y <= lt.y) {
|
|
15592
|
+
// return false;
|
|
15593
|
+
// }
|
|
15594
|
+
// const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));
|
|
15595
|
+
// if (s === 0) {
|
|
15596
|
+
// return false;
|
|
15597
|
+
// }
|
|
15598
|
+
// transform.apply(lt, lt);
|
|
15599
|
+
// transform.apply(lb, lb);
|
|
15600
|
+
// transform.apply(rt, rt);
|
|
15601
|
+
// transform.apply(rb, rb);
|
|
15602
|
+
// if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0
|
|
15603
|
+
// || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1
|
|
15604
|
+
// || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0
|
|
15605
|
+
// || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {
|
|
15606
|
+
// return false;
|
|
15607
|
+
// }
|
|
15608
|
+
// const nx = s * (lb.y - lt.y);
|
|
15609
|
+
// const ny = s * (lt.x - lb.x);
|
|
15610
|
+
// const n00 = (nx * x0) + (ny * y0);
|
|
15611
|
+
// const n10 = (nx * x1) + (ny * y0);
|
|
15612
|
+
// const n01 = (nx * x0) + (ny * y1);
|
|
15613
|
+
// const n11 = (nx * x1) + (ny * y1);
|
|
15614
|
+
// if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)
|
|
15615
|
+
// || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) {
|
|
15616
|
+
// return false;
|
|
15617
|
+
// }
|
|
15618
|
+
// const mx = s * (lt.y - rt.y);
|
|
15619
|
+
// const my = s * (rt.x - lt.x);
|
|
15620
|
+
// const m00 = (mx * x0) + (my * y0);
|
|
15621
|
+
// const m10 = (mx * x1) + (my * y0);
|
|
15622
|
+
// const m01 = (mx * x0) + (my * y1);
|
|
15623
|
+
// const m11 = (mx * x1) + (my * y1);
|
|
15624
|
+
// if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)
|
|
15625
|
+
// || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) {
|
|
15626
|
+
// return false;
|
|
15627
|
+
// }
|
|
15628
|
+
// return true;
|
|
15629
|
+
// }
|
|
15630
|
+
/**
|
|
15631
|
+
* Pads the rectangle making it grow in all directions.
|
|
15632
|
+
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
|
15633
|
+
* @param paddingX - The horizontal padding amount.
|
|
15634
|
+
* @param paddingY - The vertical padding amount.
|
|
15635
|
+
* @returns Returns itself.
|
|
15636
|
+
*/ _proto.pad = function pad(paddingX, paddingY) {
|
|
15637
|
+
if (paddingX === void 0) paddingX = 0;
|
|
15638
|
+
if (paddingY === void 0) paddingY = paddingX;
|
|
15639
|
+
this.x -= paddingX;
|
|
15640
|
+
this.y -= paddingY;
|
|
15641
|
+
this.width += paddingX * 2;
|
|
15642
|
+
this.height += paddingY * 2;
|
|
15643
|
+
return this;
|
|
15644
|
+
};
|
|
15645
|
+
/**
|
|
15646
|
+
* Fits this rectangle around the passed one.
|
|
15647
|
+
* @param rectangle - The rectangle to fit.
|
|
15648
|
+
* @returns Returns itself.
|
|
15649
|
+
*/ _proto.fit = function fit(rectangle) {
|
|
15650
|
+
var x1 = Math.max(this.x, rectangle.x);
|
|
15651
|
+
var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
|
|
15652
|
+
var y1 = Math.max(this.y, rectangle.y);
|
|
15653
|
+
var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
|
|
15654
|
+
this.x = x1;
|
|
15655
|
+
this.width = Math.max(x2 - x1, 0);
|
|
15656
|
+
this.y = y1;
|
|
15657
|
+
this.height = Math.max(y2 - y1, 0);
|
|
15658
|
+
return this;
|
|
15659
|
+
};
|
|
15660
|
+
/**
|
|
15661
|
+
* Enlarges rectangle that way its corners lie on grid
|
|
15662
|
+
* @param resolution - resolution
|
|
15663
|
+
* @param eps - precision
|
|
15664
|
+
* @returns Returns itself.
|
|
15665
|
+
*/ _proto.ceil = function ceil(resolution, eps) {
|
|
15666
|
+
if (resolution === void 0) resolution = 1;
|
|
15667
|
+
if (eps === void 0) eps = 0.001;
|
|
15668
|
+
var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
|
|
15669
|
+
var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
|
|
15670
|
+
this.x = Math.floor((this.x + eps) * resolution) / resolution;
|
|
15671
|
+
this.y = Math.floor((this.y + eps) * resolution) / resolution;
|
|
15672
|
+
this.width = x2 - this.x;
|
|
15673
|
+
this.height = y2 - this.y;
|
|
15674
|
+
return this;
|
|
15675
|
+
};
|
|
15676
|
+
/**
|
|
15677
|
+
* Enlarges this rectangle to include the passed rectangle.
|
|
15678
|
+
* @param rectangle - The rectangle to include.
|
|
15679
|
+
* @returns Returns itself.
|
|
15680
|
+
*/ _proto.enlarge = function enlarge(rectangle) {
|
|
15681
|
+
var x1 = Math.min(this.x, rectangle.x);
|
|
15682
|
+
var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
|
|
15683
|
+
var y1 = Math.min(this.y, rectangle.y);
|
|
15684
|
+
var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
|
|
15685
|
+
this.x = x1;
|
|
15686
|
+
this.width = x2 - x1;
|
|
15687
|
+
this.y = y1;
|
|
15688
|
+
this.height = y2 - y1;
|
|
15689
|
+
return this;
|
|
15690
|
+
};
|
|
15691
|
+
/**
|
|
15692
|
+
* Returns the framing rectangle of the rectangle as a Rectangle object
|
|
15693
|
+
* @param out - optional rectangle to store the result
|
|
15694
|
+
* @returns The framing rectangle
|
|
15695
|
+
*/ _proto.getBounds = function getBounds(out) {
|
|
15696
|
+
out = out || new Rectangle();
|
|
15697
|
+
out.copyFrom(this);
|
|
15698
|
+
return out;
|
|
15699
|
+
};
|
|
15700
|
+
_proto.getX = function getX() {
|
|
15701
|
+
return this.x;
|
|
15702
|
+
};
|
|
15703
|
+
_proto.getY = function getY() {
|
|
15704
|
+
return this.y;
|
|
15705
|
+
};
|
|
15706
|
+
_proto.build = function build(points) {
|
|
15707
|
+
var x = this.x;
|
|
15708
|
+
var y = this.y;
|
|
15709
|
+
var width = this.width;
|
|
15710
|
+
var height = this.height;
|
|
15711
|
+
if (!(width >= 0 && height >= 0)) {
|
|
15712
|
+
return points;
|
|
15713
|
+
}
|
|
15714
|
+
points[0] = x;
|
|
15715
|
+
points[1] = y;
|
|
15716
|
+
points[2] = x + width;
|
|
15717
|
+
points[3] = y;
|
|
15718
|
+
points[4] = x + width;
|
|
15719
|
+
points[5] = y + height;
|
|
15720
|
+
points[6] = x;
|
|
15721
|
+
points[7] = y + height;
|
|
15722
|
+
return points;
|
|
15723
|
+
};
|
|
15724
|
+
_proto.triangulate = function triangulate(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15725
|
+
var count = 0;
|
|
15726
|
+
var verticesStride = 2;
|
|
15727
|
+
verticesOffset *= verticesStride;
|
|
15728
|
+
vertices[verticesOffset + count] = points[0];
|
|
15729
|
+
vertices[verticesOffset + count + 1] = points[1];
|
|
15730
|
+
count += verticesStride;
|
|
15731
|
+
vertices[verticesOffset + count] = points[2];
|
|
15732
|
+
vertices[verticesOffset + count + 1] = points[3];
|
|
15733
|
+
count += verticesStride;
|
|
15734
|
+
vertices[verticesOffset + count] = points[6];
|
|
15735
|
+
vertices[verticesOffset + count + 1] = points[7];
|
|
15736
|
+
count += verticesStride;
|
|
15737
|
+
vertices[verticesOffset + count] = points[4];
|
|
15738
|
+
vertices[verticesOffset + count + 1] = points[5];
|
|
15739
|
+
count += verticesStride;
|
|
15740
|
+
var verticesIndex = verticesOffset / verticesStride;
|
|
15741
|
+
// triangle 1
|
|
15742
|
+
indices[indicesOffset++] = verticesIndex;
|
|
15743
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15744
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15745
|
+
// triangle 2
|
|
15746
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15747
|
+
indices[indicesOffset++] = verticesIndex + 3;
|
|
15748
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15749
|
+
};
|
|
15750
|
+
_create_class(Rectangle, [
|
|
15751
|
+
{
|
|
15752
|
+
key: "left",
|
|
15753
|
+
get: /** Returns the left edge of the rectangle. */ function get() {
|
|
15754
|
+
return this.x;
|
|
15755
|
+
}
|
|
15756
|
+
},
|
|
15757
|
+
{
|
|
15758
|
+
key: "right",
|
|
15759
|
+
get: /** Returns the right edge of the rectangle. */ function get() {
|
|
15760
|
+
return this.x + this.width;
|
|
15761
|
+
}
|
|
15762
|
+
},
|
|
15763
|
+
{
|
|
15764
|
+
key: "top",
|
|
15765
|
+
get: /** Returns the top edge of the rectangle. */ function get() {
|
|
15766
|
+
return this.y;
|
|
15767
|
+
}
|
|
15768
|
+
},
|
|
15769
|
+
{
|
|
15770
|
+
key: "bottom",
|
|
15771
|
+
get: /** Returns the bottom edge of the rectangle. */ function get() {
|
|
15772
|
+
return this.y + this.height;
|
|
15773
|
+
}
|
|
15774
|
+
}
|
|
15775
|
+
], [
|
|
15776
|
+
{
|
|
15777
|
+
key: "EMPTY",
|
|
15778
|
+
get: /** A constant empty rectangle. This is a new object every time the property is accessed */ function get() {
|
|
15779
|
+
return new Rectangle(0, 0, 0, 0);
|
|
15780
|
+
}
|
|
15781
|
+
}
|
|
15782
|
+
]);
|
|
15783
|
+
return Rectangle;
|
|
15784
|
+
}(ShapePrimitive);
|
|
15785
|
+
|
|
15412
15786
|
var ShapePath = /*#__PURE__*/ function() {
|
|
15413
15787
|
function ShapePath(graphicsPath) {
|
|
15414
15788
|
this.graphicsPath = graphicsPath;
|
|
@@ -15445,6 +15819,11 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15445
15819
|
this.polyStar(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
15446
15820
|
break;
|
|
15447
15821
|
}
|
|
15822
|
+
case "rect":
|
|
15823
|
+
{
|
|
15824
|
+
this.rect(data[0], data[1], data[2], data[3], data[4]);
|
|
15825
|
+
break;
|
|
15826
|
+
}
|
|
15448
15827
|
}
|
|
15449
15828
|
}
|
|
15450
15829
|
this.endPoly();
|
|
@@ -15490,6 +15869,18 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15490
15869
|
return this;
|
|
15491
15870
|
};
|
|
15492
15871
|
/**
|
|
15872
|
+
* Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
|
|
15873
|
+
* @param x - The x-coordinate of the upper-left corner of the rectangle.
|
|
15874
|
+
* @param y - The y-coordinate of the upper-left corner of the rectangle.
|
|
15875
|
+
* @param w - The width of the rectangle.
|
|
15876
|
+
* @param h - The height of the rectangle.
|
|
15877
|
+
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
15878
|
+
* @returns The instance of the current object for chaining.
|
|
15879
|
+
*/ _proto.rect = function rect(x, y, w, h, transform) {
|
|
15880
|
+
this.drawShape(new Rectangle$1(x, y, w, h), transform);
|
|
15881
|
+
return this;
|
|
15882
|
+
};
|
|
15883
|
+
/**
|
|
15493
15884
|
* Draws a given shape on the canvas.
|
|
15494
15885
|
* This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.
|
|
15495
15886
|
* An optional transformation matrix can be applied to the shape, allowing for complex transformations.
|
|
@@ -15625,8 +16016,8 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
15625
16016
|
};
|
|
15626
16017
|
/**
|
|
15627
16018
|
* Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
|
|
15628
|
-
* @param x - The x-coordinate of the
|
|
15629
|
-
* @param y - The y-coordinate of the
|
|
16019
|
+
* @param x - The x-coordinate of the upper-left corner of the rectangle.
|
|
16020
|
+
* @param y - The y-coordinate of the upper-left corner of the rectangle.
|
|
15630
16021
|
* @param w - The width of the rectangle.
|
|
15631
16022
|
* @param h - The height of the rectangle.
|
|
15632
16023
|
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
@@ -15805,7 +16196,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15805
16196
|
this.path.clear();
|
|
15806
16197
|
var shapeData = data;
|
|
15807
16198
|
switch(shapeData.type){
|
|
15808
|
-
case
|
|
16199
|
+
case ShapePrimitiveType.Custom:
|
|
15809
16200
|
{
|
|
15810
16201
|
var customData = shapeData;
|
|
15811
16202
|
var points = customData.points;
|
|
@@ -15842,28 +16233,28 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15842
16233
|
}
|
|
15843
16234
|
break;
|
|
15844
16235
|
}
|
|
15845
|
-
case
|
|
16236
|
+
case ShapePrimitiveType.Ellipse:
|
|
15846
16237
|
{
|
|
15847
16238
|
var ellipseData = shapeData;
|
|
15848
16239
|
this.path.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
|
|
15849
16240
|
this.setFillColor(ellipseData.fill);
|
|
15850
16241
|
break;
|
|
15851
16242
|
}
|
|
15852
|
-
case
|
|
16243
|
+
case ShapePrimitiveType.Rectangle:
|
|
15853
16244
|
{
|
|
15854
16245
|
var rectangleData = shapeData;
|
|
15855
|
-
this.path.rect(-rectangleData.width / 2, rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
16246
|
+
this.path.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
15856
16247
|
this.setFillColor(rectangleData.fill);
|
|
15857
16248
|
break;
|
|
15858
16249
|
}
|
|
15859
|
-
case
|
|
16250
|
+
case ShapePrimitiveType.Star:
|
|
15860
16251
|
{
|
|
15861
16252
|
var starData = shapeData;
|
|
15862
16253
|
this.path.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
|
|
15863
16254
|
this.setFillColor(starData.fill);
|
|
15864
16255
|
break;
|
|
15865
16256
|
}
|
|
15866
|
-
case
|
|
16257
|
+
case ShapePrimitiveType.Polygon:
|
|
15867
16258
|
{
|
|
15868
16259
|
var polygonData = shapeData;
|
|
15869
16260
|
this.path.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
|
|
@@ -15895,28 +16286,6 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15895
16286
|
exports.ShapeComponent = __decorate([
|
|
15896
16287
|
effectsClass("ShapeComponent")
|
|
15897
16288
|
], exports.ShapeComponent);
|
|
15898
|
-
exports.ShapePrimitiveType = void 0;
|
|
15899
|
-
(function(ShapePrimitiveType) {
|
|
15900
|
-
/**
|
|
15901
|
-
* 自定义图形
|
|
15902
|
-
*/ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
|
|
15903
|
-
/**
|
|
15904
|
-
* 矩形
|
|
15905
|
-
*/ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
|
|
15906
|
-
/**
|
|
15907
|
-
* 椭圆
|
|
15908
|
-
*/ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
|
|
15909
|
-
/**
|
|
15910
|
-
* 多边形
|
|
15911
|
-
*/ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
|
|
15912
|
-
/**
|
|
15913
|
-
* 星形
|
|
15914
|
-
*/ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
|
|
15915
|
-
})(exports.ShapePrimitiveType || (exports.ShapePrimitiveType = {}));
|
|
15916
|
-
exports.ShapeConnectType = void 0;
|
|
15917
|
-
(function(ShapeConnectType) {})(exports.ShapeConnectType || (exports.ShapeConnectType = {}));
|
|
15918
|
-
exports.ShapePointType = void 0;
|
|
15919
|
-
(function(ShapePointType) {})(exports.ShapePointType || (exports.ShapePointType = {}));
|
|
15920
16289
|
|
|
15921
16290
|
exports.Fake3DComponent = /*#__PURE__*/ function(Component) {
|
|
15922
16291
|
_inherits(Fake3DComponent, Component);
|
|
@@ -16479,7 +16848,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16479
16848
|
_proto.onDisable = function onDisable() {
|
|
16480
16849
|
if (this.item && this.item.composition) {
|
|
16481
16850
|
var _this_previewContent;
|
|
16482
|
-
if (this.duringPlay) {
|
|
16851
|
+
if (this.duringPlay && !this.item.transform.getValid()) {
|
|
16483
16852
|
this.item.composition.removeInteractiveItem(this.item, this.item.props.content.options.type);
|
|
16484
16853
|
this.duringPlay = false;
|
|
16485
16854
|
}
|
|
@@ -16682,10 +17051,10 @@ function shouldIgnoreBouncing(arg, mul) {
|
|
|
16682
17051
|
return this.boundingBoxData;
|
|
16683
17052
|
};
|
|
16684
17053
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
16685
|
-
var maxX =
|
|
16686
|
-
var maxY =
|
|
16687
|
-
var minX =
|
|
16688
|
-
var minY =
|
|
17054
|
+
var maxX = -Number.MAX_VALUE;
|
|
17055
|
+
var maxY = -Number.MAX_VALUE;
|
|
17056
|
+
var minX = Number.MAX_VALUE;
|
|
17057
|
+
var minY = Number.MAX_VALUE;
|
|
16689
17058
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.boundingBoxData.area), _step; !(_step = _iterator()).done;){
|
|
16690
17059
|
var triangle = _step.value;
|
|
16691
17060
|
maxX = Math.max(triangle.p0.x, triangle.p1.x, triangle.p2.x, maxX);
|
|
@@ -18102,7 +18471,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
18102
18471
|
options: {}
|
|
18103
18472
|
};
|
|
18104
18473
|
}
|
|
18105
|
-
if (duration
|
|
18474
|
+
if (duration < 0) {
|
|
18106
18475
|
throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
|
|
18107
18476
|
}
|
|
18108
18477
|
this.rendererComponents.length = 0;
|
|
@@ -18463,6 +18832,16 @@ exports.SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
18463
18832
|
}
|
|
18464
18833
|
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
18465
18834
|
var ta = this.textureSheetAnimation;
|
|
18835
|
+
var video = this.renderer.texture.source.video;
|
|
18836
|
+
if (video) {
|
|
18837
|
+
if (time === 0) {
|
|
18838
|
+
video.pause();
|
|
18839
|
+
} else {
|
|
18840
|
+
video.play().catch(function(e) {
|
|
18841
|
+
_this.engine.renderErrors.add(e);
|
|
18842
|
+
});
|
|
18843
|
+
}
|
|
18844
|
+
}
|
|
18466
18845
|
if (ta) {
|
|
18467
18846
|
var _this_material_getVector4;
|
|
18468
18847
|
var total = ta.total || ta.row * ta.col;
|
|
@@ -18517,21 +18896,20 @@ exports.SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
18517
18896
|
dy
|
|
18518
18897
|
]);
|
|
18519
18898
|
}
|
|
18520
|
-
var video = this.renderer.texture.source.video;
|
|
18521
|
-
if (video) {
|
|
18522
|
-
if (time === 0 || time === this.item.duration) {
|
|
18523
|
-
video.pause();
|
|
18524
|
-
} else {
|
|
18525
|
-
video.play().catch(function(e) {
|
|
18526
|
-
_this.engine.renderErrors.add(e);
|
|
18527
|
-
});
|
|
18528
|
-
}
|
|
18529
|
-
}
|
|
18530
18899
|
};
|
|
18531
18900
|
_proto.onDestroy = function onDestroy() {
|
|
18901
|
+
var textures = this.getTextures();
|
|
18532
18902
|
if (this.item && this.item.composition) {
|
|
18533
|
-
this.item.composition.destroyTextures(
|
|
18903
|
+
this.item.composition.destroyTextures(textures);
|
|
18534
18904
|
}
|
|
18905
|
+
textures.forEach(function(texture) {
|
|
18906
|
+
var source = texture.source;
|
|
18907
|
+
if (source.sourceType === exports.TextureSourceType.video && (source == null ? void 0 : source.video)) {
|
|
18908
|
+
source.video.pause();
|
|
18909
|
+
source.video.src = "";
|
|
18910
|
+
source.video.load();
|
|
18911
|
+
}
|
|
18912
|
+
});
|
|
18535
18913
|
};
|
|
18536
18914
|
_proto.createGeometry = function createGeometry(mode) {
|
|
18537
18915
|
var maxVertex = 12 * this.splits.length;
|
|
@@ -24023,6 +24401,51 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
24023
24401
|
return Vector4PropertyMixerPlayable;
|
|
24024
24402
|
}(Playable);
|
|
24025
24403
|
|
|
24404
|
+
var ColorPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
24405
|
+
_inherits(ColorPropertyMixerPlayable, Playable);
|
|
24406
|
+
function ColorPropertyMixerPlayable() {
|
|
24407
|
+
var _this;
|
|
24408
|
+
_this = Playable.apply(this, arguments) || this;
|
|
24409
|
+
_this.propertyName = "";
|
|
24410
|
+
return _this;
|
|
24411
|
+
}
|
|
24412
|
+
var _proto = ColorPropertyMixerPlayable.prototype;
|
|
24413
|
+
_proto.processFrame = function processFrame(context) {
|
|
24414
|
+
var boundObject = context.output.getUserData();
|
|
24415
|
+
if (!boundObject) {
|
|
24416
|
+
return;
|
|
24417
|
+
}
|
|
24418
|
+
var hasInput = false;
|
|
24419
|
+
var value = boundObject[this.propertyName];
|
|
24420
|
+
if (!_instanceof1(value, Color)) {
|
|
24421
|
+
return;
|
|
24422
|
+
}
|
|
24423
|
+
value.setZero();
|
|
24424
|
+
// evaluate the curve
|
|
24425
|
+
for(var i = 0; i < this.getInputCount(); i++){
|
|
24426
|
+
var weight = this.getInputWeight(i);
|
|
24427
|
+
if (weight > 0) {
|
|
24428
|
+
var propertyClipPlayable = this.getInput(i);
|
|
24429
|
+
if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
|
|
24430
|
+
console.error("ColorPropertyMixerPlayable received incompatible input");
|
|
24431
|
+
continue;
|
|
24432
|
+
}
|
|
24433
|
+
var curveValue = propertyClipPlayable.value;
|
|
24434
|
+
value.r += curveValue.r * weight;
|
|
24435
|
+
value.g += curveValue.g * weight;
|
|
24436
|
+
value.b += curveValue.b * weight;
|
|
24437
|
+
value.a += curveValue.a * weight;
|
|
24438
|
+
hasInput = true;
|
|
24439
|
+
}
|
|
24440
|
+
}
|
|
24441
|
+
// set value
|
|
24442
|
+
if (hasInput) {
|
|
24443
|
+
boundObject[this.propertyName] = value;
|
|
24444
|
+
}
|
|
24445
|
+
};
|
|
24446
|
+
return ColorPropertyMixerPlayable;
|
|
24447
|
+
}(Playable);
|
|
24448
|
+
|
|
24026
24449
|
var PropertyTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
24027
24450
|
_inherits(PropertyTrack, TrackAsset);
|
|
24028
24451
|
function PropertyTrack() {
|
|
@@ -24182,7 +24605,7 @@ exports.ColorPropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
|
|
|
24182
24605
|
}
|
|
24183
24606
|
var _proto = ColorPropertyTrack.prototype;
|
|
24184
24607
|
_proto.createTrackMixer = function createTrackMixer(graph) {
|
|
24185
|
-
var mixer = new
|
|
24608
|
+
var mixer = new ColorPropertyMixerPlayable(graph);
|
|
24186
24609
|
var propertyNames = this.propertyNames;
|
|
24187
24610
|
if (propertyNames.length > 0) {
|
|
24188
24611
|
var propertyName = propertyNames[propertyNames.length - 1];
|
|
@@ -24196,6 +24619,27 @@ exports.ColorPropertyTrack = __decorate([
|
|
|
24196
24619
|
effectsClass(DataType.ColorPropertyTrack)
|
|
24197
24620
|
], exports.ColorPropertyTrack);
|
|
24198
24621
|
|
|
24622
|
+
exports.ColorPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
24623
|
+
_inherits(ColorPropertyPlayableAsset, PlayableAsset);
|
|
24624
|
+
function ColorPropertyPlayableAsset() {
|
|
24625
|
+
return PlayableAsset.apply(this, arguments);
|
|
24626
|
+
}
|
|
24627
|
+
var _proto = ColorPropertyPlayableAsset.prototype;
|
|
24628
|
+
_proto.createPlayable = function createPlayable(graph) {
|
|
24629
|
+
var clipPlayable = new PropertyClipPlayable(graph);
|
|
24630
|
+
clipPlayable.curve = createValueGetter(this.curveData);
|
|
24631
|
+
clipPlayable.value = clipPlayable.curve.getValue(0);
|
|
24632
|
+
return clipPlayable;
|
|
24633
|
+
};
|
|
24634
|
+
return ColorPropertyPlayableAsset;
|
|
24635
|
+
}(PlayableAsset);
|
|
24636
|
+
__decorate([
|
|
24637
|
+
serialize()
|
|
24638
|
+
], exports.ColorPropertyPlayableAsset.prototype, "curveData", void 0);
|
|
24639
|
+
exports.ColorPropertyPlayableAsset = __decorate([
|
|
24640
|
+
effectsClass(DataType.ColorPropertyPlayableAsset)
|
|
24641
|
+
], exports.ColorPropertyPlayableAsset);
|
|
24642
|
+
|
|
24199
24643
|
exports.FloatPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
24200
24644
|
_inherits(FloatPropertyPlayableAsset, PlayableAsset);
|
|
24201
24645
|
function FloatPropertyPlayableAsset() {
|
|
@@ -24400,6 +24844,27 @@ function compareTracks(a, b) {
|
|
|
24400
24844
|
}
|
|
24401
24845
|
}
|
|
24402
24846
|
|
|
24847
|
+
exports.Vector4PropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
24848
|
+
_inherits(Vector4PropertyPlayableAsset, PlayableAsset);
|
|
24849
|
+
function Vector4PropertyPlayableAsset() {
|
|
24850
|
+
return PlayableAsset.apply(this, arguments);
|
|
24851
|
+
}
|
|
24852
|
+
var _proto = Vector4PropertyPlayableAsset.prototype;
|
|
24853
|
+
_proto.createPlayable = function createPlayable(graph) {
|
|
24854
|
+
var clipPlayable = new PropertyClipPlayable(graph);
|
|
24855
|
+
clipPlayable.curve = createValueGetter(this.curveData);
|
|
24856
|
+
clipPlayable.value = clipPlayable.curve.getValue(0);
|
|
24857
|
+
return clipPlayable;
|
|
24858
|
+
};
|
|
24859
|
+
return Vector4PropertyPlayableAsset;
|
|
24860
|
+
}(PlayableAsset);
|
|
24861
|
+
__decorate([
|
|
24862
|
+
serialize()
|
|
24863
|
+
], exports.Vector4PropertyPlayableAsset.prototype, "curveData", void 0);
|
|
24864
|
+
exports.Vector4PropertyPlayableAsset = __decorate([
|
|
24865
|
+
effectsClass("Vector4PropertyPlayableAsset")
|
|
24866
|
+
], exports.Vector4PropertyPlayableAsset);
|
|
24867
|
+
|
|
24403
24868
|
exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
|
|
24404
24869
|
_inherits(ObjectBindingTrack, TrackAsset1);
|
|
24405
24870
|
function ObjectBindingTrack() {
|
|
@@ -24437,7 +24902,7 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
24437
24902
|
function TextLayout(options) {
|
|
24438
24903
|
this.width = 0;
|
|
24439
24904
|
this.height = 0;
|
|
24440
|
-
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,
|
|
24905
|
+
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;
|
|
24441
24906
|
var tempWidth = fontSize + letterSpace;
|
|
24442
24907
|
this.autoWidth = autoWidth;
|
|
24443
24908
|
this.maxTextWidth = text.length * tempWidth;
|
|
@@ -25004,7 +25469,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25004
25469
|
}
|
|
25005
25470
|
//与 toDataURL() 两种方式都需要像素读取操作
|
|
25006
25471
|
var imageData = context.getImageData(0, 0, this.canvas.width, this.canvas.height);
|
|
25007
|
-
this.material.setTexture("
|
|
25472
|
+
this.material.setTexture("_MainTex", Texture.createWithData(this.engine, {
|
|
25008
25473
|
data: new Uint8Array(imageData.data),
|
|
25009
25474
|
width: imageData.width,
|
|
25010
25475
|
height: imageData.height
|
|
@@ -28202,7 +28667,7 @@ var listOrder = 0;
|
|
|
28202
28667
|
var itemProps = sourceItemData;
|
|
28203
28668
|
if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
|
|
28204
28669
|
itemProps.listIndex = listOrder++;
|
|
28205
|
-
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || //@ts-expect-error
|
|
28670
|
+
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine || //@ts-expect-error
|
|
28206
28671
|
itemProps.type === ItemType.shape) {
|
|
28207
28672
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
|
|
28208
28673
|
var componentPath = _step2.value;
|
|
@@ -28243,8 +28708,10 @@ var listOrder = 0;
|
|
|
28243
28708
|
shapeData = shape;
|
|
28244
28709
|
}
|
|
28245
28710
|
if (shapeData !== undefined) {
|
|
28246
|
-
|
|
28247
|
-
|
|
28711
|
+
if (!("aPoint" in shapeData && "index" in shapeData)) {
|
|
28712
|
+
// @ts-expect-error 类型转换问题
|
|
28713
|
+
renderContent.renderer.shape = getGeometryByShape(shapeData, split);
|
|
28714
|
+
}
|
|
28248
28715
|
}
|
|
28249
28716
|
}
|
|
28250
28717
|
if ("trails" in renderContent && renderContent.trails !== undefined) {
|
|
@@ -28611,16 +29078,15 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28611
29078
|
if (pause) {
|
|
28612
29079
|
this.resume();
|
|
28613
29080
|
}
|
|
28614
|
-
if (!this.rootComposition.isStartCalled) {
|
|
28615
|
-
this.rootComposition.onStart();
|
|
28616
|
-
this.rootComposition.isStartCalled = true;
|
|
28617
|
-
}
|
|
28618
29081
|
this.setSpeed(1);
|
|
28619
29082
|
this.forwardTime(time + this.startTime);
|
|
28620
29083
|
this.setSpeed(speed);
|
|
28621
29084
|
if (pause) {
|
|
28622
29085
|
this.pause();
|
|
28623
29086
|
}
|
|
29087
|
+
this.emit("goto", {
|
|
29088
|
+
time: time
|
|
29089
|
+
});
|
|
28624
29090
|
};
|
|
28625
29091
|
_proto.addItem = function addItem(item) {
|
|
28626
29092
|
this.items.push(item);
|
|
@@ -31160,7 +31626,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
31160
31626
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
31161
31627
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
31162
31628
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
31163
|
-
var version$1 = "2.1.0-alpha.
|
|
31629
|
+
var version$1 = "2.1.0-alpha.14";
|
|
31164
31630
|
logger.info("Core version: " + version$1 + ".");
|
|
31165
31631
|
|
|
31166
31632
|
var _obj;
|
|
@@ -31196,22 +31662,7 @@ var _obj3;
|
|
|
31196
31662
|
* 必须初始化的 uniform 的 map 对象(THREE 必须在初始化的时候赋值)
|
|
31197
31663
|
*/ var TEXTURE_UNIFORM_MAP = [
|
|
31198
31664
|
"uMaskTex",
|
|
31199
|
-
"
|
|
31200
|
-
"uSampler1",
|
|
31201
|
-
"uSampler2",
|
|
31202
|
-
"uSampler3",
|
|
31203
|
-
"uSampler4",
|
|
31204
|
-
"uSampler5",
|
|
31205
|
-
"uSampler6",
|
|
31206
|
-
"uSampler7",
|
|
31207
|
-
"uSampler8",
|
|
31208
|
-
"uSampler9",
|
|
31209
|
-
"uSampler10",
|
|
31210
|
-
"uSampler11",
|
|
31211
|
-
"uSampler12",
|
|
31212
|
-
"uSampler13",
|
|
31213
|
-
"uSampler14",
|
|
31214
|
-
"uSampler15",
|
|
31665
|
+
"_MainTex",
|
|
31215
31666
|
"uColorOverLifetime",
|
|
31216
31667
|
"uColorOverTrail"
|
|
31217
31668
|
];
|
|
@@ -31242,9 +31693,7 @@ var _obj3;
|
|
|
31242
31693
|
vertex: (_shader_vertex = shader == null ? void 0 : shader.vertex) != null ? _shader_vertex : "",
|
|
31243
31694
|
fragment: (_shader_fragment = shader == null ? void 0 : shader.fragment) != null ? _shader_fragment : ""
|
|
31244
31695
|
});
|
|
31245
|
-
|
|
31246
|
-
_this.uniforms["uSampler" + i] = new THREE__namespace.Uniform(null);
|
|
31247
|
-
}
|
|
31696
|
+
_this.uniforms["_MainTex"] = new THREE__namespace.Uniform(null);
|
|
31248
31697
|
_this.uniforms["uEditorTransform"] = new THREE__namespace.Uniform([
|
|
31249
31698
|
1,
|
|
31250
31699
|
1,
|
|
@@ -32804,7 +33253,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
32804
33253
|
*/ Mesh.create = function(engine, props) {
|
|
32805
33254
|
return new ThreeMesh(engine, props);
|
|
32806
33255
|
};
|
|
32807
|
-
var version = "2.1.0-alpha.
|
|
33256
|
+
var version = "2.1.0-alpha.14";
|
|
32808
33257
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
32809
33258
|
|
|
32810
33259
|
exports.AbstractPlugin = AbstractPlugin;
|