@galacean/effects-threejs 2.1.0-alpha.11 → 2.1.0-alpha.13
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 +511 -73
- 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 +512 -74
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.1.0-alpha.
|
|
6
|
+
* Version: v2.1.0-alpha.13
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -6943,6 +6943,28 @@ var MaterialRenderType;
|
|
|
6943
6943
|
this.shaderDirty = true;
|
|
6944
6944
|
}
|
|
6945
6945
|
},
|
|
6946
|
+
{
|
|
6947
|
+
key: "mainTexture",
|
|
6948
|
+
get: /**
|
|
6949
|
+
* 材质的主纹理
|
|
6950
|
+
*/ function get() {
|
|
6951
|
+
return this.getTexture("_MainTex");
|
|
6952
|
+
},
|
|
6953
|
+
set: function set(value) {
|
|
6954
|
+
this.setTexture("_MainTex", value);
|
|
6955
|
+
}
|
|
6956
|
+
},
|
|
6957
|
+
{
|
|
6958
|
+
key: "color",
|
|
6959
|
+
get: /**
|
|
6960
|
+
* 材质的主颜色
|
|
6961
|
+
*/ function get() {
|
|
6962
|
+
return this.getColor("_Color");
|
|
6963
|
+
},
|
|
6964
|
+
set: function set(value) {
|
|
6965
|
+
this.setColor("_Color", value);
|
|
6966
|
+
}
|
|
6967
|
+
},
|
|
6946
6968
|
{
|
|
6947
6969
|
key: "blending",
|
|
6948
6970
|
set: /******** effects-core 中会调用 引擎必须实现 ***********************/ /**
|
|
@@ -10079,7 +10101,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
|
|
|
10079
10101
|
|
|
10080
10102
|
var itemVert = "precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 texParams=_TexParams;vTexCoord=vec2(atlasOffset.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(0.0,texParams.y,texParams.x);vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
|
|
10081
10103
|
|
|
10082
|
-
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D
|
|
10104
|
+
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(_MainTex,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
|
|
10083
10105
|
|
|
10084
10106
|
var particleFrag = "#version 100\nprecision mediump float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n";
|
|
10085
10107
|
|
|
@@ -10608,6 +10630,9 @@ var seed$6 = 1;
|
|
|
10608
10630
|
this.renderer = renderer;
|
|
10609
10631
|
if (postProcessingEnabled) {
|
|
10610
10632
|
var enableHDR = true;
|
|
10633
|
+
if (!this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
|
|
10634
|
+
throw new Error("Half float texture is not supported.");
|
|
10635
|
+
}
|
|
10611
10636
|
// 使用HDR浮点纹理,FLOAT在IOS上报错,使用HALF_FLOAT
|
|
10612
10637
|
var textureType = enableHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
|
|
10613
10638
|
attachments = [
|
|
@@ -11328,7 +11353,7 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
|
|
|
11328
11353
|
var GlobalUniforms = function GlobalUniforms() {
|
|
11329
11354
|
this.floats = {};
|
|
11330
11355
|
this.ints = {};
|
|
11331
|
-
|
|
11356
|
+
this.vector3s = {};
|
|
11332
11357
|
this.vector4s = {};
|
|
11333
11358
|
this.matrices = {};
|
|
11334
11359
|
//...
|
|
@@ -11569,6 +11594,9 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
11569
11594
|
_proto.setGlobalVector4 = function setGlobalVector4(name, value) {
|
|
11570
11595
|
// OVERRIDE
|
|
11571
11596
|
};
|
|
11597
|
+
_proto.setGlobalVector3 = function setGlobalVector3(name, value) {
|
|
11598
|
+
// OVERRIDE
|
|
11599
|
+
};
|
|
11572
11600
|
_proto.setGlobalMatrix = function setGlobalMatrix(name, value) {
|
|
11573
11601
|
// OVERRIDE
|
|
11574
11602
|
};
|
|
@@ -13234,10 +13262,10 @@ var Vector4Curve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13234
13262
|
}
|
|
13235
13263
|
var _proto = Vector4Curve.prototype;
|
|
13236
13264
|
_proto.onCreate = function onCreate(arg) {
|
|
13237
|
-
this.xCurve = createValueGetter(arg
|
|
13238
|
-
this.yCurve = createValueGetter(arg
|
|
13239
|
-
this.zCurve = createValueGetter(arg
|
|
13240
|
-
this.wCurve = createValueGetter(arg
|
|
13265
|
+
this.xCurve = createValueGetter(arg[0]);
|
|
13266
|
+
this.yCurve = createValueGetter(arg[1]);
|
|
13267
|
+
this.zCurve = createValueGetter(arg[2]);
|
|
13268
|
+
this.wCurve = createValueGetter(arg[3]);
|
|
13241
13269
|
};
|
|
13242
13270
|
_proto.getValue = function getValue(t) {
|
|
13243
13271
|
var x = this.xCurve.getValue(t);
|
|
@@ -13337,10 +13365,10 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13337
13365
|
}
|
|
13338
13366
|
var _proto = ColorCurve.prototype;
|
|
13339
13367
|
_proto.onCreate = function onCreate(arg) {
|
|
13340
|
-
this.rCurve = createValueGetter(arg
|
|
13341
|
-
this.gCurve = createValueGetter(arg
|
|
13342
|
-
this.bCurve = createValueGetter(arg
|
|
13343
|
-
this.aCurve = createValueGetter(arg
|
|
13368
|
+
this.rCurve = createValueGetter(arg[0]);
|
|
13369
|
+
this.gCurve = createValueGetter(arg[1]);
|
|
13370
|
+
this.bCurve = createValueGetter(arg[2]);
|
|
13371
|
+
this.aCurve = createValueGetter(arg[3]);
|
|
13344
13372
|
};
|
|
13345
13373
|
_proto.getValue = function getValue(t) {
|
|
13346
13374
|
var r = this.rCurve.getValue(t);
|
|
@@ -13442,7 +13470,7 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13442
13470
|
* @param texture - 纹理对象
|
|
13443
13471
|
*/ _proto.setTexture = function setTexture(texture) {
|
|
13444
13472
|
this.renderer.texture = texture;
|
|
13445
|
-
this.material.setTexture("
|
|
13473
|
+
this.material.setTexture("_MainTex", texture);
|
|
13446
13474
|
};
|
|
13447
13475
|
/**
|
|
13448
13476
|
* @internal
|
|
@@ -13521,15 +13549,7 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13521
13549
|
geometry.setIndexData(indexData);
|
|
13522
13550
|
geometry.setAttributeData("atlasOffset", attributes.atlasOffset);
|
|
13523
13551
|
geometry.setDrawCount(data.index.length);
|
|
13524
|
-
|
|
13525
|
-
var texture1 = textures[i];
|
|
13526
|
-
material.setTexture("uSampler" + i, texture1);
|
|
13527
|
-
}
|
|
13528
|
-
// FIXME: 内存泄漏的临时方案,后面再调整
|
|
13529
|
-
var emptyTexture = this.emptyTexture;
|
|
13530
|
-
for(var k = textures.length; k < maxSpriteMeshItemCount; k++){
|
|
13531
|
-
material.setTexture("uSampler" + k, emptyTexture);
|
|
13532
|
-
}
|
|
13552
|
+
material.setTexture("_MainTex", texture);
|
|
13533
13553
|
};
|
|
13534
13554
|
_proto.getItemGeometryData = function getItemGeometryData() {
|
|
13535
13555
|
var renderer = this.renderer;
|
|
@@ -13647,7 +13667,7 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13647
13667
|
setBlendMode(material, states.blendMode);
|
|
13648
13668
|
setMaskMode(material, states.maskMode);
|
|
13649
13669
|
setSideMode(material, states.side);
|
|
13650
|
-
material.shader.shaderData.properties = '
|
|
13670
|
+
material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
|
|
13651
13671
|
if (!material.hasUniform("_Color")) {
|
|
13652
13672
|
material.setVector4("_Color", new Vector4(0, 0, 0, 1));
|
|
13653
13673
|
}
|
|
@@ -15385,6 +15405,329 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
15385
15405
|
return PolyStar;
|
|
15386
15406
|
}(ShapePrimitive);
|
|
15387
15407
|
|
|
15408
|
+
// const tempPoints = [new Point(), new Point(), new Point(), new Point()];
|
|
15409
|
+
/**
|
|
15410
|
+
* The `Rectangle` object is an area defined by its position, as indicated by its upper-left corner
|
|
15411
|
+
* point (`x`, `y`) and by its `width` and its `height`.
|
|
15412
|
+
*/ var Rectangle$1 = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15413
|
+
_inherits(Rectangle, ShapePrimitive);
|
|
15414
|
+
function Rectangle(x, y, width, height) {
|
|
15415
|
+
if (x === void 0) x = 0;
|
|
15416
|
+
if (y === void 0) y = 0;
|
|
15417
|
+
if (width === void 0) width = 0;
|
|
15418
|
+
if (height === void 0) height = 0;
|
|
15419
|
+
var _this;
|
|
15420
|
+
_this = ShapePrimitive.call(this) || this;
|
|
15421
|
+
_this.x = Number(x);
|
|
15422
|
+
_this.y = Number(y);
|
|
15423
|
+
_this.width = Number(width);
|
|
15424
|
+
_this.height = Number(height);
|
|
15425
|
+
return _this;
|
|
15426
|
+
}
|
|
15427
|
+
var _proto = Rectangle.prototype;
|
|
15428
|
+
/** Determines whether the Rectangle is empty. */ _proto.isEmpty = function isEmpty() {
|
|
15429
|
+
return this.left === this.right || this.top === this.bottom;
|
|
15430
|
+
};
|
|
15431
|
+
/**
|
|
15432
|
+
* Creates a clone of this Rectangle
|
|
15433
|
+
* @returns a copy of the rectangle
|
|
15434
|
+
*/ _proto.clone = function clone() {
|
|
15435
|
+
return new Rectangle(this.x, this.y, this.width, this.height);
|
|
15436
|
+
};
|
|
15437
|
+
/**
|
|
15438
|
+
* Converts a Bounds object to a Rectangle object.
|
|
15439
|
+
* @param bounds - The bounds to copy and convert to a rectangle.
|
|
15440
|
+
* @returns Returns itself.
|
|
15441
|
+
*/ // copyFromBounds (bounds: Bounds): this {
|
|
15442
|
+
// this.x = bounds.minX;
|
|
15443
|
+
// this.y = bounds.minY;
|
|
15444
|
+
// this.width = bounds.maxX - bounds.minX;
|
|
15445
|
+
// this.height = bounds.maxY - bounds.minY;
|
|
15446
|
+
// return this;
|
|
15447
|
+
// }
|
|
15448
|
+
/**
|
|
15449
|
+
* Copies another rectangle to this one.
|
|
15450
|
+
* @param rectangle - The rectangle to copy from.
|
|
15451
|
+
* @returns Returns itself.
|
|
15452
|
+
*/ _proto.copyFrom = function copyFrom(rectangle) {
|
|
15453
|
+
this.x = rectangle.x;
|
|
15454
|
+
this.y = rectangle.y;
|
|
15455
|
+
this.width = rectangle.width;
|
|
15456
|
+
this.height = rectangle.height;
|
|
15457
|
+
return this;
|
|
15458
|
+
};
|
|
15459
|
+
/**
|
|
15460
|
+
* Copies this rectangle to another one.
|
|
15461
|
+
* @param rectangle - The rectangle to copy to.
|
|
15462
|
+
* @returns Returns given parameter.
|
|
15463
|
+
*/ _proto.copyTo = function copyTo(rectangle) {
|
|
15464
|
+
rectangle.copyFrom(this);
|
|
15465
|
+
return rectangle;
|
|
15466
|
+
};
|
|
15467
|
+
/**
|
|
15468
|
+
* Checks whether the x and y coordinates given are contained within this Rectangle
|
|
15469
|
+
* @param x - The X coordinate of the point to test
|
|
15470
|
+
* @param y - The Y coordinate of the point to test
|
|
15471
|
+
* @returns Whether the x/y coordinates are within this Rectangle
|
|
15472
|
+
*/ _proto.contains = function contains(x, y) {
|
|
15473
|
+
if (this.width <= 0 || this.height <= 0) {
|
|
15474
|
+
return false;
|
|
15475
|
+
}
|
|
15476
|
+
if (x >= this.x && x < this.x + this.width) {
|
|
15477
|
+
if (y >= this.y && y < this.y + this.height) {
|
|
15478
|
+
return true;
|
|
15479
|
+
}
|
|
15480
|
+
}
|
|
15481
|
+
return false;
|
|
15482
|
+
};
|
|
15483
|
+
/**
|
|
15484
|
+
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
|
15485
|
+
* @param x - The X coordinate of the point to test
|
|
15486
|
+
* @param y - The Y coordinate of the point to test
|
|
15487
|
+
* @param strokeWidth - The width of the line to check
|
|
15488
|
+
* @returns Whether the x/y coordinates are within this rectangle
|
|
15489
|
+
*/ _proto.strokeContains = function strokeContains(x, y, strokeWidth) {
|
|
15490
|
+
var _this = this, width = _this.width, height = _this.height;
|
|
15491
|
+
if (width <= 0 || height <= 0) {
|
|
15492
|
+
return false;
|
|
15493
|
+
}
|
|
15494
|
+
var _x = this.x;
|
|
15495
|
+
var _y = this.y;
|
|
15496
|
+
var outerLeft = _x - strokeWidth / 2;
|
|
15497
|
+
var outerRight = _x + width + strokeWidth / 2;
|
|
15498
|
+
var outerTop = _y - strokeWidth / 2;
|
|
15499
|
+
var outerBottom = _y + height + strokeWidth / 2;
|
|
15500
|
+
var innerLeft = _x + strokeWidth / 2;
|
|
15501
|
+
var innerRight = _x + width - strokeWidth / 2;
|
|
15502
|
+
var innerTop = _y + strokeWidth / 2;
|
|
15503
|
+
var innerBottom = _y + height - strokeWidth / 2;
|
|
15504
|
+
return x >= outerLeft && x <= outerRight && y >= outerTop && y <= outerBottom && !(x > innerLeft && x < innerRight && y > innerTop && y < innerBottom);
|
|
15505
|
+
};
|
|
15506
|
+
/**
|
|
15507
|
+
* Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
|
|
15508
|
+
* Returns true only if the area of the intersection is >0, this means that Rectangles
|
|
15509
|
+
* sharing a side are not overlapping. Another side effect is that an arealess rectangle
|
|
15510
|
+
* (width or height equal to zero) can't intersect any other rectangle.
|
|
15511
|
+
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
|
15512
|
+
* @param {Matrix} transform - The transformation matrix of `other`.
|
|
15513
|
+
* @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
|
|
15514
|
+
*/ // intersects (other: Rectangle, transform?: Matrix4): boolean {
|
|
15515
|
+
// if (!transform) {
|
|
15516
|
+
// const x0 = this.x < other.x ? other.x : this.x;
|
|
15517
|
+
// const x1 = this.right > other.right ? other.right : this.right;
|
|
15518
|
+
// if (x1 <= x0) {
|
|
15519
|
+
// return false;
|
|
15520
|
+
// }
|
|
15521
|
+
// const y0 = this.y < other.y ? other.y : this.y;
|
|
15522
|
+
// const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;
|
|
15523
|
+
// return y1 > y0;
|
|
15524
|
+
// }
|
|
15525
|
+
// const x0 = this.left;
|
|
15526
|
+
// const x1 = this.right;
|
|
15527
|
+
// const y0 = this.top;
|
|
15528
|
+
// const y1 = this.bottom;
|
|
15529
|
+
// if (x1 <= x0 || y1 <= y0) {
|
|
15530
|
+
// return false;
|
|
15531
|
+
// }
|
|
15532
|
+
// const lt = tempPoints[0].set(other.left, other.top);
|
|
15533
|
+
// const lb = tempPoints[1].set(other.left, other.bottom);
|
|
15534
|
+
// const rt = tempPoints[2].set(other.right, other.top);
|
|
15535
|
+
// const rb = tempPoints[3].set(other.right, other.bottom);
|
|
15536
|
+
// if (rt.x <= lt.x || lb.y <= lt.y) {
|
|
15537
|
+
// return false;
|
|
15538
|
+
// }
|
|
15539
|
+
// const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));
|
|
15540
|
+
// if (s === 0) {
|
|
15541
|
+
// return false;
|
|
15542
|
+
// }
|
|
15543
|
+
// transform.apply(lt, lt);
|
|
15544
|
+
// transform.apply(lb, lb);
|
|
15545
|
+
// transform.apply(rt, rt);
|
|
15546
|
+
// transform.apply(rb, rb);
|
|
15547
|
+
// if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0
|
|
15548
|
+
// || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1
|
|
15549
|
+
// || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0
|
|
15550
|
+
// || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {
|
|
15551
|
+
// return false;
|
|
15552
|
+
// }
|
|
15553
|
+
// const nx = s * (lb.y - lt.y);
|
|
15554
|
+
// const ny = s * (lt.x - lb.x);
|
|
15555
|
+
// const n00 = (nx * x0) + (ny * y0);
|
|
15556
|
+
// const n10 = (nx * x1) + (ny * y0);
|
|
15557
|
+
// const n01 = (nx * x0) + (ny * y1);
|
|
15558
|
+
// const n11 = (nx * x1) + (ny * y1);
|
|
15559
|
+
// if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)
|
|
15560
|
+
// || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) {
|
|
15561
|
+
// return false;
|
|
15562
|
+
// }
|
|
15563
|
+
// const mx = s * (lt.y - rt.y);
|
|
15564
|
+
// const my = s * (rt.x - lt.x);
|
|
15565
|
+
// const m00 = (mx * x0) + (my * y0);
|
|
15566
|
+
// const m10 = (mx * x1) + (my * y0);
|
|
15567
|
+
// const m01 = (mx * x0) + (my * y1);
|
|
15568
|
+
// const m11 = (mx * x1) + (my * y1);
|
|
15569
|
+
// if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)
|
|
15570
|
+
// || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) {
|
|
15571
|
+
// return false;
|
|
15572
|
+
// }
|
|
15573
|
+
// return true;
|
|
15574
|
+
// }
|
|
15575
|
+
/**
|
|
15576
|
+
* Pads the rectangle making it grow in all directions.
|
|
15577
|
+
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
|
15578
|
+
* @param paddingX - The horizontal padding amount.
|
|
15579
|
+
* @param paddingY - The vertical padding amount.
|
|
15580
|
+
* @returns Returns itself.
|
|
15581
|
+
*/ _proto.pad = function pad(paddingX, paddingY) {
|
|
15582
|
+
if (paddingX === void 0) paddingX = 0;
|
|
15583
|
+
if (paddingY === void 0) paddingY = paddingX;
|
|
15584
|
+
this.x -= paddingX;
|
|
15585
|
+
this.y -= paddingY;
|
|
15586
|
+
this.width += paddingX * 2;
|
|
15587
|
+
this.height += paddingY * 2;
|
|
15588
|
+
return this;
|
|
15589
|
+
};
|
|
15590
|
+
/**
|
|
15591
|
+
* Fits this rectangle around the passed one.
|
|
15592
|
+
* @param rectangle - The rectangle to fit.
|
|
15593
|
+
* @returns Returns itself.
|
|
15594
|
+
*/ _proto.fit = function fit(rectangle) {
|
|
15595
|
+
var x1 = Math.max(this.x, rectangle.x);
|
|
15596
|
+
var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
|
|
15597
|
+
var y1 = Math.max(this.y, rectangle.y);
|
|
15598
|
+
var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
|
|
15599
|
+
this.x = x1;
|
|
15600
|
+
this.width = Math.max(x2 - x1, 0);
|
|
15601
|
+
this.y = y1;
|
|
15602
|
+
this.height = Math.max(y2 - y1, 0);
|
|
15603
|
+
return this;
|
|
15604
|
+
};
|
|
15605
|
+
/**
|
|
15606
|
+
* Enlarges rectangle that way its corners lie on grid
|
|
15607
|
+
* @param resolution - resolution
|
|
15608
|
+
* @param eps - precision
|
|
15609
|
+
* @returns Returns itself.
|
|
15610
|
+
*/ _proto.ceil = function ceil(resolution, eps) {
|
|
15611
|
+
if (resolution === void 0) resolution = 1;
|
|
15612
|
+
if (eps === void 0) eps = 0.001;
|
|
15613
|
+
var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
|
|
15614
|
+
var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
|
|
15615
|
+
this.x = Math.floor((this.x + eps) * resolution) / resolution;
|
|
15616
|
+
this.y = Math.floor((this.y + eps) * resolution) / resolution;
|
|
15617
|
+
this.width = x2 - this.x;
|
|
15618
|
+
this.height = y2 - this.y;
|
|
15619
|
+
return this;
|
|
15620
|
+
};
|
|
15621
|
+
/**
|
|
15622
|
+
* Enlarges this rectangle to include the passed rectangle.
|
|
15623
|
+
* @param rectangle - The rectangle to include.
|
|
15624
|
+
* @returns Returns itself.
|
|
15625
|
+
*/ _proto.enlarge = function enlarge(rectangle) {
|
|
15626
|
+
var x1 = Math.min(this.x, rectangle.x);
|
|
15627
|
+
var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
|
|
15628
|
+
var y1 = Math.min(this.y, rectangle.y);
|
|
15629
|
+
var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
|
|
15630
|
+
this.x = x1;
|
|
15631
|
+
this.width = x2 - x1;
|
|
15632
|
+
this.y = y1;
|
|
15633
|
+
this.height = y2 - y1;
|
|
15634
|
+
return this;
|
|
15635
|
+
};
|
|
15636
|
+
/**
|
|
15637
|
+
* Returns the framing rectangle of the rectangle as a Rectangle object
|
|
15638
|
+
* @param out - optional rectangle to store the result
|
|
15639
|
+
* @returns The framing rectangle
|
|
15640
|
+
*/ _proto.getBounds = function getBounds(out) {
|
|
15641
|
+
out = out || new Rectangle();
|
|
15642
|
+
out.copyFrom(this);
|
|
15643
|
+
return out;
|
|
15644
|
+
};
|
|
15645
|
+
_proto.getX = function getX() {
|
|
15646
|
+
return this.x;
|
|
15647
|
+
};
|
|
15648
|
+
_proto.getY = function getY() {
|
|
15649
|
+
return this.y;
|
|
15650
|
+
};
|
|
15651
|
+
_proto.build = function build(points) {
|
|
15652
|
+
var x = this.x;
|
|
15653
|
+
var y = this.y;
|
|
15654
|
+
var width = this.width;
|
|
15655
|
+
var height = this.height;
|
|
15656
|
+
if (!(width >= 0 && height >= 0)) {
|
|
15657
|
+
return points;
|
|
15658
|
+
}
|
|
15659
|
+
points[0] = x;
|
|
15660
|
+
points[1] = y;
|
|
15661
|
+
points[2] = x + width;
|
|
15662
|
+
points[3] = y;
|
|
15663
|
+
points[4] = x + width;
|
|
15664
|
+
points[5] = y + height;
|
|
15665
|
+
points[6] = x;
|
|
15666
|
+
points[7] = y + height;
|
|
15667
|
+
return points;
|
|
15668
|
+
};
|
|
15669
|
+
_proto.triangulate = function triangulate(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15670
|
+
var count = 0;
|
|
15671
|
+
var verticesStride = 2;
|
|
15672
|
+
verticesOffset *= verticesStride;
|
|
15673
|
+
vertices[verticesOffset + count] = points[0];
|
|
15674
|
+
vertices[verticesOffset + count + 1] = points[1];
|
|
15675
|
+
count += verticesStride;
|
|
15676
|
+
vertices[verticesOffset + count] = points[2];
|
|
15677
|
+
vertices[verticesOffset + count + 1] = points[3];
|
|
15678
|
+
count += verticesStride;
|
|
15679
|
+
vertices[verticesOffset + count] = points[6];
|
|
15680
|
+
vertices[verticesOffset + count + 1] = points[7];
|
|
15681
|
+
count += verticesStride;
|
|
15682
|
+
vertices[verticesOffset + count] = points[4];
|
|
15683
|
+
vertices[verticesOffset + count + 1] = points[5];
|
|
15684
|
+
count += verticesStride;
|
|
15685
|
+
var verticesIndex = verticesOffset / verticesStride;
|
|
15686
|
+
// triangle 1
|
|
15687
|
+
indices[indicesOffset++] = verticesIndex;
|
|
15688
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15689
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15690
|
+
// triangle 2
|
|
15691
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15692
|
+
indices[indicesOffset++] = verticesIndex + 3;
|
|
15693
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15694
|
+
};
|
|
15695
|
+
_create_class(Rectangle, [
|
|
15696
|
+
{
|
|
15697
|
+
key: "left",
|
|
15698
|
+
get: /** Returns the left edge of the rectangle. */ function get() {
|
|
15699
|
+
return this.x;
|
|
15700
|
+
}
|
|
15701
|
+
},
|
|
15702
|
+
{
|
|
15703
|
+
key: "right",
|
|
15704
|
+
get: /** Returns the right edge of the rectangle. */ function get() {
|
|
15705
|
+
return this.x + this.width;
|
|
15706
|
+
}
|
|
15707
|
+
},
|
|
15708
|
+
{
|
|
15709
|
+
key: "top",
|
|
15710
|
+
get: /** Returns the top edge of the rectangle. */ function get() {
|
|
15711
|
+
return this.y;
|
|
15712
|
+
}
|
|
15713
|
+
},
|
|
15714
|
+
{
|
|
15715
|
+
key: "bottom",
|
|
15716
|
+
get: /** Returns the bottom edge of the rectangle. */ function get() {
|
|
15717
|
+
return this.y + this.height;
|
|
15718
|
+
}
|
|
15719
|
+
}
|
|
15720
|
+
], [
|
|
15721
|
+
{
|
|
15722
|
+
key: "EMPTY",
|
|
15723
|
+
get: /** A constant empty rectangle. This is a new object every time the property is accessed */ function get() {
|
|
15724
|
+
return new Rectangle(0, 0, 0, 0);
|
|
15725
|
+
}
|
|
15726
|
+
}
|
|
15727
|
+
]);
|
|
15728
|
+
return Rectangle;
|
|
15729
|
+
}(ShapePrimitive);
|
|
15730
|
+
|
|
15388
15731
|
var ShapePath = /*#__PURE__*/ function() {
|
|
15389
15732
|
function ShapePath(graphicsPath) {
|
|
15390
15733
|
this.graphicsPath = graphicsPath;
|
|
@@ -15421,6 +15764,11 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15421
15764
|
this.polyStar(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
15422
15765
|
break;
|
|
15423
15766
|
}
|
|
15767
|
+
case "rect":
|
|
15768
|
+
{
|
|
15769
|
+
this.rect(data[0], data[1], data[2], data[3], data[4]);
|
|
15770
|
+
break;
|
|
15771
|
+
}
|
|
15424
15772
|
}
|
|
15425
15773
|
}
|
|
15426
15774
|
this.endPoly();
|
|
@@ -15466,6 +15814,18 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15466
15814
|
return this;
|
|
15467
15815
|
};
|
|
15468
15816
|
/**
|
|
15817
|
+
* Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
|
|
15818
|
+
* @param x - The x-coordinate of the upper-left corner of the rectangle.
|
|
15819
|
+
* @param y - The y-coordinate of the upper-left corner of the rectangle.
|
|
15820
|
+
* @param w - The width of the rectangle.
|
|
15821
|
+
* @param h - The height of the rectangle.
|
|
15822
|
+
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
15823
|
+
* @returns The instance of the current object for chaining.
|
|
15824
|
+
*/ _proto.rect = function rect(x, y, w, h, transform) {
|
|
15825
|
+
this.drawShape(new Rectangle$1(x, y, w, h), transform);
|
|
15826
|
+
return this;
|
|
15827
|
+
};
|
|
15828
|
+
/**
|
|
15469
15829
|
* Draws a given shape on the canvas.
|
|
15470
15830
|
* This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.
|
|
15471
15831
|
* An optional transformation matrix can be applied to the shape, allowing for complex transformations.
|
|
@@ -15601,8 +15961,8 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
15601
15961
|
};
|
|
15602
15962
|
/**
|
|
15603
15963
|
* Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
|
|
15604
|
-
* @param x - The x-coordinate of the
|
|
15605
|
-
* @param y - The y-coordinate of the
|
|
15964
|
+
* @param x - The x-coordinate of the upper-left corner of the rectangle.
|
|
15965
|
+
* @param y - The y-coordinate of the upper-left corner of the rectangle.
|
|
15606
15966
|
* @param w - The width of the rectangle.
|
|
15607
15967
|
* @param h - The height of the rectangle.
|
|
15608
15968
|
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
@@ -15828,7 +16188,7 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15828
16188
|
case 1:
|
|
15829
16189
|
{
|
|
15830
16190
|
var rectangleData = shapeData;
|
|
15831
|
-
this.path.rect(-rectangleData.width / 2, rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
16191
|
+
this.path.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
15832
16192
|
this.setFillColor(rectangleData.fill);
|
|
15833
16193
|
break;
|
|
15834
16194
|
}
|
|
@@ -16390,6 +16750,7 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16390
16750
|
0
|
|
16391
16751
|
]
|
|
16392
16752
|
};
|
|
16753
|
+
_this.duringPlay = false;
|
|
16393
16754
|
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
16394
16755
|
_this.getHitTestParams = function(force) {
|
|
16395
16756
|
if (!_this.clickable) {
|
|
@@ -16454,7 +16815,10 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16454
16815
|
_proto.onDisable = function onDisable() {
|
|
16455
16816
|
if (this.item && this.item.composition) {
|
|
16456
16817
|
var _this_previewContent;
|
|
16457
|
-
|
|
16818
|
+
if (this.duringPlay && !this.item.transform.getValid()) {
|
|
16819
|
+
this.item.composition.removeInteractiveItem(this.item, this.item.props.content.options.type);
|
|
16820
|
+
this.duringPlay = false;
|
|
16821
|
+
}
|
|
16458
16822
|
this.clickable = false;
|
|
16459
16823
|
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.mesh.dispose();
|
|
16460
16824
|
this.endDragTarget();
|
|
@@ -16465,15 +16829,15 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16465
16829
|
if (type === InteractType.CLICK) {
|
|
16466
16830
|
this.clickable = true;
|
|
16467
16831
|
}
|
|
16468
|
-
var options = this.item.props.content.options;
|
|
16469
|
-
if (this.item.composition) {
|
|
16470
|
-
this.item.composition.addInteractiveItem(this.item, options.type);
|
|
16471
|
-
}
|
|
16472
16832
|
};
|
|
16473
16833
|
_proto.onUpdate = function onUpdate(dt) {
|
|
16474
16834
|
var _this_previewContent;
|
|
16475
|
-
|
|
16476
|
-
|
|
16835
|
+
this.duringPlay = true;
|
|
16836
|
+
// trigger messageBegin when item enter
|
|
16837
|
+
if (this.item.time > 0 && this.item.time - dt / 1000 <= 0) {
|
|
16838
|
+
var _this_item_composition;
|
|
16839
|
+
var options = this.item.props.content.options;
|
|
16840
|
+
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
|
|
16477
16841
|
}
|
|
16478
16842
|
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
16479
16843
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
@@ -16654,10 +17018,10 @@ function shouldIgnoreBouncing(arg, mul) {
|
|
|
16654
17018
|
return this.boundingBoxData;
|
|
16655
17019
|
};
|
|
16656
17020
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
16657
|
-
var maxX =
|
|
16658
|
-
var maxY =
|
|
16659
|
-
var minX =
|
|
16660
|
-
var minY =
|
|
17021
|
+
var maxX = -Number.MAX_VALUE;
|
|
17022
|
+
var maxY = -Number.MAX_VALUE;
|
|
17023
|
+
var minX = Number.MAX_VALUE;
|
|
17024
|
+
var minY = Number.MAX_VALUE;
|
|
16661
17025
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.boundingBoxData.area), _step; !(_step = _iterator()).done;){
|
|
16662
17026
|
var triangle = _step.value;
|
|
16663
17027
|
maxX = Math.max(triangle.p0.x, triangle.p1.x, triangle.p2.x, maxX);
|
|
@@ -18074,7 +18438,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
18074
18438
|
options: {}
|
|
18075
18439
|
};
|
|
18076
18440
|
}
|
|
18077
|
-
if (duration
|
|
18441
|
+
if (duration < 0) {
|
|
18078
18442
|
throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
|
|
18079
18443
|
}
|
|
18080
18444
|
this.rendererComponents.length = 0;
|
|
@@ -18435,6 +18799,16 @@ var SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
18435
18799
|
}
|
|
18436
18800
|
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
18437
18801
|
var ta = this.textureSheetAnimation;
|
|
18802
|
+
var video = this.renderer.texture.source.video;
|
|
18803
|
+
if (video) {
|
|
18804
|
+
if (time === 0) {
|
|
18805
|
+
video.pause();
|
|
18806
|
+
} else {
|
|
18807
|
+
video.play().catch(function(e) {
|
|
18808
|
+
_this.engine.renderErrors.add(e);
|
|
18809
|
+
});
|
|
18810
|
+
}
|
|
18811
|
+
}
|
|
18438
18812
|
if (ta) {
|
|
18439
18813
|
var _this_material_getVector4;
|
|
18440
18814
|
var total = ta.total || ta.row * ta.col;
|
|
@@ -18489,16 +18863,6 @@ var SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
18489
18863
|
dy
|
|
18490
18864
|
]);
|
|
18491
18865
|
}
|
|
18492
|
-
var video = this.renderer.texture.source.video;
|
|
18493
|
-
if (video) {
|
|
18494
|
-
if (time === 0 || time === this.item.duration) {
|
|
18495
|
-
video.pause();
|
|
18496
|
-
} else {
|
|
18497
|
-
video.play().catch(function(e) {
|
|
18498
|
-
_this.engine.renderErrors.add(e);
|
|
18499
|
-
});
|
|
18500
|
-
}
|
|
18501
|
-
}
|
|
18502
18866
|
};
|
|
18503
18867
|
_proto.onDestroy = function onDestroy() {
|
|
18504
18868
|
if (this.item && this.item.composition) {
|
|
@@ -23995,6 +24359,51 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23995
24359
|
return Vector4PropertyMixerPlayable;
|
|
23996
24360
|
}(Playable);
|
|
23997
24361
|
|
|
24362
|
+
var ColorPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
24363
|
+
_inherits(ColorPropertyMixerPlayable, Playable);
|
|
24364
|
+
function ColorPropertyMixerPlayable() {
|
|
24365
|
+
var _this;
|
|
24366
|
+
_this = Playable.apply(this, arguments) || this;
|
|
24367
|
+
_this.propertyName = "";
|
|
24368
|
+
return _this;
|
|
24369
|
+
}
|
|
24370
|
+
var _proto = ColorPropertyMixerPlayable.prototype;
|
|
24371
|
+
_proto.processFrame = function processFrame(context) {
|
|
24372
|
+
var boundObject = context.output.getUserData();
|
|
24373
|
+
if (!boundObject) {
|
|
24374
|
+
return;
|
|
24375
|
+
}
|
|
24376
|
+
var hasInput = false;
|
|
24377
|
+
var value = boundObject[this.propertyName];
|
|
24378
|
+
if (!_instanceof1(value, Color)) {
|
|
24379
|
+
return;
|
|
24380
|
+
}
|
|
24381
|
+
value.setZero();
|
|
24382
|
+
// evaluate the curve
|
|
24383
|
+
for(var i = 0; i < this.getInputCount(); i++){
|
|
24384
|
+
var weight = this.getInputWeight(i);
|
|
24385
|
+
if (weight > 0) {
|
|
24386
|
+
var propertyClipPlayable = this.getInput(i);
|
|
24387
|
+
if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
|
|
24388
|
+
console.error("ColorPropertyMixerPlayable received incompatible input");
|
|
24389
|
+
continue;
|
|
24390
|
+
}
|
|
24391
|
+
var curveValue = propertyClipPlayable.value;
|
|
24392
|
+
value.r += curveValue.r * weight;
|
|
24393
|
+
value.g += curveValue.g * weight;
|
|
24394
|
+
value.b += curveValue.b * weight;
|
|
24395
|
+
value.a += curveValue.a * weight;
|
|
24396
|
+
hasInput = true;
|
|
24397
|
+
}
|
|
24398
|
+
}
|
|
24399
|
+
// set value
|
|
24400
|
+
if (hasInput) {
|
|
24401
|
+
boundObject[this.propertyName] = value;
|
|
24402
|
+
}
|
|
24403
|
+
};
|
|
24404
|
+
return ColorPropertyMixerPlayable;
|
|
24405
|
+
}(Playable);
|
|
24406
|
+
|
|
23998
24407
|
var PropertyTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
23999
24408
|
_inherits(PropertyTrack, TrackAsset);
|
|
24000
24409
|
function PropertyTrack() {
|
|
@@ -24154,7 +24563,7 @@ var ColorPropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
|
|
|
24154
24563
|
}
|
|
24155
24564
|
var _proto = ColorPropertyTrack.prototype;
|
|
24156
24565
|
_proto.createTrackMixer = function createTrackMixer(graph) {
|
|
24157
|
-
var mixer = new
|
|
24566
|
+
var mixer = new ColorPropertyMixerPlayable(graph);
|
|
24158
24567
|
var propertyNames = this.propertyNames;
|
|
24159
24568
|
if (propertyNames.length > 0) {
|
|
24160
24569
|
var propertyName = propertyNames[propertyNames.length - 1];
|
|
@@ -24168,6 +24577,27 @@ ColorPropertyTrack = __decorate([
|
|
|
24168
24577
|
effectsClass(DataType.ColorPropertyTrack)
|
|
24169
24578
|
], ColorPropertyTrack);
|
|
24170
24579
|
|
|
24580
|
+
var ColorPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
24581
|
+
_inherits(ColorPropertyPlayableAsset, PlayableAsset);
|
|
24582
|
+
function ColorPropertyPlayableAsset() {
|
|
24583
|
+
return PlayableAsset.apply(this, arguments);
|
|
24584
|
+
}
|
|
24585
|
+
var _proto = ColorPropertyPlayableAsset.prototype;
|
|
24586
|
+
_proto.createPlayable = function createPlayable(graph) {
|
|
24587
|
+
var clipPlayable = new PropertyClipPlayable(graph);
|
|
24588
|
+
clipPlayable.curve = createValueGetter(this.curveData);
|
|
24589
|
+
clipPlayable.value = clipPlayable.curve.getValue(0);
|
|
24590
|
+
return clipPlayable;
|
|
24591
|
+
};
|
|
24592
|
+
return ColorPropertyPlayableAsset;
|
|
24593
|
+
}(PlayableAsset);
|
|
24594
|
+
__decorate([
|
|
24595
|
+
serialize()
|
|
24596
|
+
], ColorPropertyPlayableAsset.prototype, "curveData", void 0);
|
|
24597
|
+
ColorPropertyPlayableAsset = __decorate([
|
|
24598
|
+
effectsClass(DataType.ColorPropertyPlayableAsset)
|
|
24599
|
+
], ColorPropertyPlayableAsset);
|
|
24600
|
+
|
|
24171
24601
|
var FloatPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
24172
24602
|
_inherits(FloatPropertyPlayableAsset, PlayableAsset);
|
|
24173
24603
|
function FloatPropertyPlayableAsset() {
|
|
@@ -24372,6 +24802,27 @@ function compareTracks(a, b) {
|
|
|
24372
24802
|
}
|
|
24373
24803
|
}
|
|
24374
24804
|
|
|
24805
|
+
var Vector4PropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
24806
|
+
_inherits(Vector4PropertyPlayableAsset, PlayableAsset);
|
|
24807
|
+
function Vector4PropertyPlayableAsset() {
|
|
24808
|
+
return PlayableAsset.apply(this, arguments);
|
|
24809
|
+
}
|
|
24810
|
+
var _proto = Vector4PropertyPlayableAsset.prototype;
|
|
24811
|
+
_proto.createPlayable = function createPlayable(graph) {
|
|
24812
|
+
var clipPlayable = new PropertyClipPlayable(graph);
|
|
24813
|
+
clipPlayable.curve = createValueGetter(this.curveData);
|
|
24814
|
+
clipPlayable.value = clipPlayable.curve.getValue(0);
|
|
24815
|
+
return clipPlayable;
|
|
24816
|
+
};
|
|
24817
|
+
return Vector4PropertyPlayableAsset;
|
|
24818
|
+
}(PlayableAsset);
|
|
24819
|
+
__decorate([
|
|
24820
|
+
serialize()
|
|
24821
|
+
], Vector4PropertyPlayableAsset.prototype, "curveData", void 0);
|
|
24822
|
+
Vector4PropertyPlayableAsset = __decorate([
|
|
24823
|
+
effectsClass("Vector4PropertyPlayableAsset")
|
|
24824
|
+
], Vector4PropertyPlayableAsset);
|
|
24825
|
+
|
|
24375
24826
|
var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
|
|
24376
24827
|
_inherits(ObjectBindingTrack, TrackAsset1);
|
|
24377
24828
|
function ObjectBindingTrack() {
|
|
@@ -24609,6 +25060,8 @@ var TextComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
24609
25060
|
/**
|
|
24610
25061
|
* 文本行数
|
|
24611
25062
|
*/ _this.lineCount = 0;
|
|
25063
|
+
_this.SCALE_FACTOR = 0.1;
|
|
25064
|
+
_this.ALPHA_FIX_VALUE = 1 / 255;
|
|
24612
25065
|
_this.name = "MText" + seed$2++;
|
|
24613
25066
|
_this.geometry = _this.createGeometry(glContext.TRIANGLES);
|
|
24614
25067
|
if (props) {
|
|
@@ -24974,7 +25427,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
24974
25427
|
}
|
|
24975
25428
|
//与 toDataURL() 两种方式都需要像素读取操作
|
|
24976
25429
|
var imageData = context.getImageData(0, 0, this.canvas.width, this.canvas.height);
|
|
24977
|
-
this.material.setTexture("
|
|
25430
|
+
this.material.setTexture("_MainTex", Texture.createWithData(this.engine, {
|
|
24978
25431
|
data: new Uint8Array(imageData.data),
|
|
24979
25432
|
width: imageData.width,
|
|
24980
25433
|
height: imageData.height
|
|
@@ -28172,7 +28625,7 @@ var listOrder = 0;
|
|
|
28172
28625
|
var itemProps = sourceItemData;
|
|
28173
28626
|
if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
|
|
28174
28627
|
itemProps.listIndex = listOrder++;
|
|
28175
|
-
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || //@ts-expect-error
|
|
28628
|
+
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine || //@ts-expect-error
|
|
28176
28629
|
itemProps.type === ItemType.shape) {
|
|
28177
28630
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
|
|
28178
28631
|
var componentPath = _step2.value;
|
|
@@ -28213,8 +28666,10 @@ var listOrder = 0;
|
|
|
28213
28666
|
shapeData = shape;
|
|
28214
28667
|
}
|
|
28215
28668
|
if (shapeData !== undefined) {
|
|
28216
|
-
|
|
28217
|
-
|
|
28669
|
+
if (!("aPoint" in shapeData && "index" in shapeData)) {
|
|
28670
|
+
// @ts-expect-error 类型转换问题
|
|
28671
|
+
renderContent.renderer.shape = getGeometryByShape(shapeData, split);
|
|
28672
|
+
}
|
|
28218
28673
|
}
|
|
28219
28674
|
}
|
|
28220
28675
|
if ("trails" in renderContent && renderContent.trails !== undefined) {
|
|
@@ -31130,7 +31585,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
31130
31585
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
31131
31586
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
31132
31587
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
31133
|
-
var version$1 = "2.1.0-alpha.
|
|
31588
|
+
var version$1 = "2.1.0-alpha.13";
|
|
31134
31589
|
logger.info("Core version: " + version$1 + ".");
|
|
31135
31590
|
|
|
31136
31591
|
var _obj;
|
|
@@ -31166,22 +31621,7 @@ var _obj3;
|
|
|
31166
31621
|
* 必须初始化的 uniform 的 map 对象(THREE 必须在初始化的时候赋值)
|
|
31167
31622
|
*/ var TEXTURE_UNIFORM_MAP = [
|
|
31168
31623
|
"uMaskTex",
|
|
31169
|
-
"
|
|
31170
|
-
"uSampler1",
|
|
31171
|
-
"uSampler2",
|
|
31172
|
-
"uSampler3",
|
|
31173
|
-
"uSampler4",
|
|
31174
|
-
"uSampler5",
|
|
31175
|
-
"uSampler6",
|
|
31176
|
-
"uSampler7",
|
|
31177
|
-
"uSampler8",
|
|
31178
|
-
"uSampler9",
|
|
31179
|
-
"uSampler10",
|
|
31180
|
-
"uSampler11",
|
|
31181
|
-
"uSampler12",
|
|
31182
|
-
"uSampler13",
|
|
31183
|
-
"uSampler14",
|
|
31184
|
-
"uSampler15",
|
|
31624
|
+
"_MainTex",
|
|
31185
31625
|
"uColorOverLifetime",
|
|
31186
31626
|
"uColorOverTrail"
|
|
31187
31627
|
];
|
|
@@ -31212,9 +31652,7 @@ var _obj3;
|
|
|
31212
31652
|
vertex: (_shader_vertex = shader == null ? void 0 : shader.vertex) != null ? _shader_vertex : "",
|
|
31213
31653
|
fragment: (_shader_fragment = shader == null ? void 0 : shader.fragment) != null ? _shader_fragment : ""
|
|
31214
31654
|
});
|
|
31215
|
-
|
|
31216
|
-
_this.uniforms["uSampler" + i] = new THREE.Uniform(null);
|
|
31217
|
-
}
|
|
31655
|
+
_this.uniforms["_MainTex"] = new THREE.Uniform(null);
|
|
31218
31656
|
_this.uniforms["uEditorTransform"] = new THREE.Uniform([
|
|
31219
31657
|
1,
|
|
31220
31658
|
1,
|
|
@@ -32774,8 +33212,8 @@ setMaxSpriteMeshItemCount(8);
|
|
|
32774
33212
|
*/ Mesh.create = function(engine, props) {
|
|
32775
33213
|
return new ThreeMesh(engine, props);
|
|
32776
33214
|
};
|
|
32777
|
-
var version = "2.1.0-alpha.
|
|
33215
|
+
var version = "2.1.0-alpha.13";
|
|
32778
33216
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
32779
33217
|
|
|
32780
|
-
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyTrack, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapeConnectType, ShapePointType, ShapePrimitiveType, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector4Curve, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
33218
|
+
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapeConnectType, ShapePointType, ShapePrimitiveType, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
32781
33219
|
//# sourceMappingURL=index.mjs.map
|