@galacean/effects-core 2.0.0-alpha.11 → 2.0.0-alpha.12
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/asset-loader.d.ts +0 -6
- package/dist/composition.d.ts +0 -6
- package/dist/fallback/utils.d.ts +0 -11
- package/dist/gl/index.d.ts +3 -0
- package/dist/index.js +1725 -1445
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1718 -1444
- package/dist/index.mjs.map +1 -1
- package/dist/math/value-getter.d.ts +7 -0
- package/dist/plugins/cal/calculate-vfx-item.d.ts +34 -0
- package/dist/plugins/sprite/sprite-item.d.ts +1 -2
- package/dist/render/{frame-buffer.d.ts → framebuffer.d.ts} +6 -6
- package/dist/render/geometry.d.ts +8 -0
- package/dist/render/index.d.ts +2 -2
- package/dist/render/render-frame.d.ts +4 -4
- package/dist/render/render-pass.d.ts +8 -8
- package/dist/render/{render-buffer.d.ts → renderbuffer.d.ts} +4 -4
- package/dist/render/renderer.d.ts +5 -5
- package/dist/texture/texture.d.ts +1 -0
- package/dist/texture/types.d.ts +2 -2
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.12
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -3698,6 +3698,17 @@ Euler.tempMat0 = new Matrix4();
|
|
|
3698
3698
|
* 水平右侧 垂直底部
|
|
3699
3699
|
*/ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_RIGHT_BOTTOM"] = 8] = "PARTICLE_ORIGIN_RIGHT_BOTTOM";
|
|
3700
3700
|
})(ParticleOrigin || (ParticleOrigin = {}));
|
|
3701
|
+
var RenderType;
|
|
3702
|
+
(function(RenderType) {
|
|
3703
|
+
RenderType["Opaque"] = "Opaque";
|
|
3704
|
+
RenderType["Transparent"] = "Transparent";
|
|
3705
|
+
})(RenderType || (RenderType = {}));
|
|
3706
|
+
var RenderFace;
|
|
3707
|
+
(function(RenderFace) {
|
|
3708
|
+
RenderFace["Both"] = "Both";
|
|
3709
|
+
RenderFace["Back"] = "Back";
|
|
3710
|
+
RenderFace["Front"] = "Front";
|
|
3711
|
+
})(RenderFace || (RenderFace = {}));
|
|
3701
3712
|
|
|
3702
3713
|
const END_BEHAVIOR_DESTROY = 0;
|
|
3703
3714
|
const END_BEHAVIOR_PAUSE = 1;
|
|
@@ -4017,6 +4028,7 @@ var DataType;
|
|
|
4017
4028
|
DataType["CameraController"] = "CameraController";
|
|
4018
4029
|
DataType["Geometry"] = "Geometry";
|
|
4019
4030
|
DataType["Texture"] = "Texture";
|
|
4031
|
+
DataType["AnimationClip"] = "AnimationClip";
|
|
4020
4032
|
DataType["TextComponent"] = "TextComponent";
|
|
4021
4033
|
// FIXME: 先完成ECS的场景转换,后面移到spec中
|
|
4022
4034
|
DataType["MeshComponent"] = "MeshComponent";
|
|
@@ -4050,6 +4062,60 @@ var GeometryType;
|
|
|
4050
4062
|
* Draw a connected group of triangles. Each vertex connects to the previous and the first vertex in the fan.
|
|
4051
4063
|
*/ GeometryType[GeometryType["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN";
|
|
4052
4064
|
})(GeometryType || (GeometryType = {}));
|
|
4065
|
+
var VertexFormatType;
|
|
4066
|
+
(function(VertexFormatType) {
|
|
4067
|
+
VertexFormatType[VertexFormatType["Float32"] = 0] = "Float32";
|
|
4068
|
+
VertexFormatType[VertexFormatType["Int16"] = 1] = "Int16";
|
|
4069
|
+
VertexFormatType[VertexFormatType["Int8"] = 2] = "Int8";
|
|
4070
|
+
VertexFormatType[VertexFormatType["UInt16"] = 3] = "UInt16";
|
|
4071
|
+
VertexFormatType[VertexFormatType["UInt8"] = 4] = "UInt8";
|
|
4072
|
+
})(VertexFormatType || (VertexFormatType = {}));
|
|
4073
|
+
var IndexFormatType;
|
|
4074
|
+
(function(IndexFormatType) {
|
|
4075
|
+
IndexFormatType[IndexFormatType["UInt16"] = 0] = "UInt16";
|
|
4076
|
+
IndexFormatType[IndexFormatType["UInt32"] = 1] = "UInt32";
|
|
4077
|
+
})(IndexFormatType || (IndexFormatType = {}));
|
|
4078
|
+
// BINORMAL[n] Binormal float4
|
|
4079
|
+
// BLENDINDICES[n] 混合索引 uint
|
|
4080
|
+
// BLENDWEIGHT[n] 混合权重 FLOAT
|
|
4081
|
+
// COLOR[n] 漫射和反射颜色 float4
|
|
4082
|
+
// NORMAL[n] 法向矢量 float4
|
|
4083
|
+
// POSITION[n] 对象空间中的顶点位置。 float4
|
|
4084
|
+
// POSITIONT 变换的顶点位置。 float4
|
|
4085
|
+
// PSIZE[n] 点大小 FLOAT
|
|
4086
|
+
// TANGENT[n] 正切 float4
|
|
4087
|
+
// TEXCOORD[n] 纹理坐标 float4
|
|
4088
|
+
// POSITION_BS[n] Blend Shape 空间中的顶点位置 float4
|
|
4089
|
+
// NORMAL_BS[n] Blend Shape 空间中的法向矢量 float4
|
|
4090
|
+
// TANGENT_BS[n] Blend Shape 空间中的正切矢量 float4
|
|
4091
|
+
var VertexBufferSemantic;
|
|
4092
|
+
(function(VertexBufferSemantic) {
|
|
4093
|
+
VertexBufferSemantic["Position"] = "POSITION";
|
|
4094
|
+
VertexBufferSemantic["Uv"] = "TEXCOORD0";
|
|
4095
|
+
VertexBufferSemantic["Uv2"] = "TEXCOORD1";
|
|
4096
|
+
VertexBufferSemantic["Normal"] = "NORMAL";
|
|
4097
|
+
VertexBufferSemantic["Tangent"] = "TANGENT";
|
|
4098
|
+
VertexBufferSemantic["Color"] = "COLOR";
|
|
4099
|
+
VertexBufferSemantic["Joints"] = "JOINTS";
|
|
4100
|
+
VertexBufferSemantic["Weights"] = "WEIGHTS";
|
|
4101
|
+
//
|
|
4102
|
+
VertexBufferSemantic["PositionBS0"] = "POSITION_BS0";
|
|
4103
|
+
VertexBufferSemantic["PositionBS1"] = "POSITION_BS1";
|
|
4104
|
+
VertexBufferSemantic["PositionBS2"] = "POSITION_BS2";
|
|
4105
|
+
VertexBufferSemantic["PositionBS3"] = "POSITION_BS3";
|
|
4106
|
+
VertexBufferSemantic["PositionBS4"] = "POSITION_BS4";
|
|
4107
|
+
VertexBufferSemantic["PositionBS5"] = "POSITION_BS5";
|
|
4108
|
+
VertexBufferSemantic["PositionBS6"] = "POSITION_BS6";
|
|
4109
|
+
VertexBufferSemantic["PositionBS7"] = "POSITION_BS7";
|
|
4110
|
+
VertexBufferSemantic["NormalBS0"] = "NORMAL_BS0";
|
|
4111
|
+
VertexBufferSemantic["NormalBS1"] = "NORMAL_BS1";
|
|
4112
|
+
VertexBufferSemantic["NormalBS2"] = "NORMAL_BS2";
|
|
4113
|
+
VertexBufferSemantic["NormalBS3"] = "NORMAL_BS3";
|
|
4114
|
+
VertexBufferSemantic["TangentBS0"] = "TANGENT_BS0";
|
|
4115
|
+
VertexBufferSemantic["TangentBS1"] = "TANGENT_BS1";
|
|
4116
|
+
VertexBufferSemantic["TangentBS2"] = "TANGENT_BS2";
|
|
4117
|
+
VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
|
|
4118
|
+
})(VertexBufferSemantic || (VertexBufferSemantic = {}));
|
|
4053
4119
|
|
|
4054
4120
|
class BuiltinObjectGUID {
|
|
4055
4121
|
}
|
|
@@ -4070,6 +4136,8 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4070
4136
|
get ItemType () { return ItemType; },
|
|
4071
4137
|
get RenderMode () { return RenderMode; },
|
|
4072
4138
|
get ParticleOrigin () { return ParticleOrigin; },
|
|
4139
|
+
get RenderType () { return RenderType; },
|
|
4140
|
+
get RenderFace () { return RenderFace; },
|
|
4073
4141
|
get CameraClipMode () { return CameraClipMode; },
|
|
4074
4142
|
get CompositionEndBehavior () { return CompositionEndBehavior; },
|
|
4075
4143
|
get BackgroundType () { return BackgroundType; },
|
|
@@ -4103,6 +4171,9 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4103
4171
|
get FontStyle () { return FontStyle; },
|
|
4104
4172
|
get DataType () { return DataType; },
|
|
4105
4173
|
get GeometryType () { return GeometryType; },
|
|
4174
|
+
get VertexFormatType () { return VertexFormatType; },
|
|
4175
|
+
get IndexFormatType () { return IndexFormatType; },
|
|
4176
|
+
get VertexBufferSemantic () { return VertexBufferSemantic; },
|
|
4106
4177
|
BuiltinObjectGUID: BuiltinObjectGUID
|
|
4107
4178
|
});
|
|
4108
4179
|
|
|
@@ -7404,6 +7475,10 @@ function buildEasingCurve(leftKeyframe, rightKeyframe) {
|
|
|
7404
7475
|
}
|
|
7405
7476
|
}
|
|
7406
7477
|
|
|
7478
|
+
const CURVE_PRO_TIME = 0;
|
|
7479
|
+
const CURVE_PRO_VALUE = 1;
|
|
7480
|
+
const CURVE_PRO_IN_TANGENT = 2;
|
|
7481
|
+
const CURVE_PRO_OUT_TANGENT = 3;
|
|
7407
7482
|
const NOT_IMPLEMENT = 'not_implement';
|
|
7408
7483
|
class ValueGetter {
|
|
7409
7484
|
static getAllData(meta, halfFloat) {
|
|
@@ -7820,6 +7895,48 @@ class BezierCurve extends ValueGetter {
|
|
|
7820
7895
|
return data;
|
|
7821
7896
|
}
|
|
7822
7897
|
}
|
|
7898
|
+
class PathSegments extends ValueGetter {
|
|
7899
|
+
onCreate(props) {
|
|
7900
|
+
this.keys = props[0];
|
|
7901
|
+
this.values = props[1];
|
|
7902
|
+
}
|
|
7903
|
+
getValue(time) {
|
|
7904
|
+
const keys = this.keys;
|
|
7905
|
+
const values = this.values;
|
|
7906
|
+
for(let i = 0; i < keys.length - 1; i++){
|
|
7907
|
+
const k0 = keys[i];
|
|
7908
|
+
const k1 = keys[i + 1];
|
|
7909
|
+
if (k0[0] <= time && k1[0] >= time) {
|
|
7910
|
+
const dis = k1[1] - k0[1];
|
|
7911
|
+
let dt;
|
|
7912
|
+
if (dis === 0) {
|
|
7913
|
+
dt = (time - k0[0]) / (k1[0] - k0[0]);
|
|
7914
|
+
} else {
|
|
7915
|
+
const val = curveValueEvaluate(time, k0, k1);
|
|
7916
|
+
dt = (val - k0[1]) / dis;
|
|
7917
|
+
}
|
|
7918
|
+
return this.calculateVec(i, dt);
|
|
7919
|
+
}
|
|
7920
|
+
}
|
|
7921
|
+
if (time <= keys[0][0]) {
|
|
7922
|
+
return values[0].slice();
|
|
7923
|
+
}
|
|
7924
|
+
return values[values.length - 1].slice();
|
|
7925
|
+
}
|
|
7926
|
+
calculateVec(i, dt) {
|
|
7927
|
+
const vec0 = this.values[i];
|
|
7928
|
+
const vec1 = this.values[i + 1];
|
|
7929
|
+
const ret = [
|
|
7930
|
+
0,
|
|
7931
|
+
0,
|
|
7932
|
+
0
|
|
7933
|
+
];
|
|
7934
|
+
for(let j = 0; j < vec0.length; j++){
|
|
7935
|
+
ret[j] = vec0[j] * (1 - dt) + vec1[j] * dt;
|
|
7936
|
+
}
|
|
7937
|
+
return ret;
|
|
7938
|
+
}
|
|
7939
|
+
}
|
|
7823
7940
|
class BezierCurvePath extends ValueGetter {
|
|
7824
7941
|
onCreate(props) {
|
|
7825
7942
|
const [keyframes, points, controlPoints] = props;
|
|
@@ -7921,9 +8038,9 @@ const map$1 = {
|
|
|
7921
8038
|
[ValueType.GRADIENT_COLOR] (props) {
|
|
7922
8039
|
return new GradientValue(props);
|
|
7923
8040
|
},
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
8041
|
+
[ValueType.LINEAR_PATH] (pros) {
|
|
8042
|
+
return new PathSegments(pros);
|
|
8043
|
+
},
|
|
7927
8044
|
[ValueType.BEZIER_CURVE] (props) {
|
|
7928
8045
|
if (props.length === 1) {
|
|
7929
8046
|
return new StaticValue(props[0][1][1]);
|
|
@@ -7961,6 +8078,20 @@ function lineSegIntegrateByTime(t, t0, t1, y0, y1) {
|
|
|
7961
8078
|
const t03 = t02 * t0;
|
|
7962
8079
|
return (2 * t3 * (y0 - y1) + 3 * t2 * (t0 * y1 - t1 * y0) - t03 * (2 * y0 + y1) + 3 * t02 * t1 * y0) / (6 * (t0 - t1));
|
|
7963
8080
|
}
|
|
8081
|
+
function curveValueEvaluate(time, keyframe0, keyframe1) {
|
|
8082
|
+
const dt = keyframe1[CURVE_PRO_TIME] - keyframe0[CURVE_PRO_TIME];
|
|
8083
|
+
const m0 = keyframe0[CURVE_PRO_OUT_TANGENT] * dt;
|
|
8084
|
+
const m1 = keyframe1[CURVE_PRO_IN_TANGENT] * dt;
|
|
8085
|
+
const t = (time - keyframe0[CURVE_PRO_TIME]) / dt;
|
|
8086
|
+
const t2 = t * t;
|
|
8087
|
+
const t3 = t2 * t;
|
|
8088
|
+
const a = 2 * t3 - 3 * t2 + 1;
|
|
8089
|
+
const b = t3 - 2 * t2 + t;
|
|
8090
|
+
const c = t3 - t2;
|
|
8091
|
+
const d = -2 * t3 + 3 * t2;
|
|
8092
|
+
//(2*v0+m0+m1-2*v1)*(t-t0)^3/k^3+(3*v1-3*v0-2*m0-m1)*(t-t0)^2/k^2+m0 *(t-t0)/k+v0
|
|
8093
|
+
return a * keyframe0[CURVE_PRO_VALUE] + b * m0 + c * m1 + d * keyframe1[CURVE_PRO_VALUE];
|
|
8094
|
+
}
|
|
7964
8095
|
function getKeyFrameMetaByRawValue(meta, value) {
|
|
7965
8096
|
if (value) {
|
|
7966
8097
|
const type = value[0];
|
|
@@ -8848,6 +8979,38 @@ function copy(target) {
|
|
|
8848
8979
|
}
|
|
8849
8980
|
}
|
|
8850
8981
|
}
|
|
8982
|
+
function vertexFormatType2GLType(formatType) {
|
|
8983
|
+
switch(formatType){
|
|
8984
|
+
case VertexFormatType.Float32:
|
|
8985
|
+
return WebGLRenderingContext['FLOAT'];
|
|
8986
|
+
case VertexFormatType.Int16:
|
|
8987
|
+
return WebGLRenderingContext['SHORT'];
|
|
8988
|
+
case VertexFormatType.Int8:
|
|
8989
|
+
return WebGLRenderingContext['BYTE'];
|
|
8990
|
+
case VertexFormatType.UInt16:
|
|
8991
|
+
return WebGLRenderingContext['UNSIGNED_SHORT'];
|
|
8992
|
+
case VertexFormatType.UInt8:
|
|
8993
|
+
return WebGLRenderingContext['UNSIGNED_BYTE'];
|
|
8994
|
+
default:
|
|
8995
|
+
return WebGLRenderingContext['FLOAT'];
|
|
8996
|
+
}
|
|
8997
|
+
}
|
|
8998
|
+
function glType2VertexFormatType(webglType) {
|
|
8999
|
+
switch(webglType){
|
|
9000
|
+
case WebGLRenderingContext['FLOAT']:
|
|
9001
|
+
return VertexFormatType.Float32;
|
|
9002
|
+
case WebGLRenderingContext['SHORT']:
|
|
9003
|
+
return VertexFormatType.Int16;
|
|
9004
|
+
case WebGLRenderingContext['BYTE']:
|
|
9005
|
+
return VertexFormatType.Int8;
|
|
9006
|
+
case WebGLRenderingContext['UNSIGNED_SHORT']:
|
|
9007
|
+
return VertexFormatType.UInt16;
|
|
9008
|
+
case WebGLRenderingContext['UNSIGNED_BYTE']:
|
|
9009
|
+
return VertexFormatType.UInt8;
|
|
9010
|
+
default:
|
|
9011
|
+
return VertexFormatType.Float32;
|
|
9012
|
+
}
|
|
9013
|
+
}
|
|
8851
9014
|
|
|
8852
9015
|
var ShaderType;
|
|
8853
9016
|
(function(ShaderType) {
|
|
@@ -9529,6 +9692,29 @@ function generateHalfFloatTexture(engine, data, width, height) {
|
|
|
9529
9692
|
wrapT: glContext.CLAMP_TO_EDGE
|
|
9530
9693
|
});
|
|
9531
9694
|
}
|
|
9695
|
+
function generateWhiteTexture(engine) {
|
|
9696
|
+
return Texture.create(engine, {
|
|
9697
|
+
id: 'whitetexture00000000000000000000',
|
|
9698
|
+
data: {
|
|
9699
|
+
width: 1,
|
|
9700
|
+
height: 1,
|
|
9701
|
+
data: new Uint8Array([
|
|
9702
|
+
255,
|
|
9703
|
+
255,
|
|
9704
|
+
255,
|
|
9705
|
+
255
|
|
9706
|
+
])
|
|
9707
|
+
},
|
|
9708
|
+
sourceType: TextureSourceType.data,
|
|
9709
|
+
type: glContext.UNSIGNED_BYTE,
|
|
9710
|
+
format: glContext.RGBA,
|
|
9711
|
+
internalFormat: glContext.RGBA,
|
|
9712
|
+
wrapS: glContext.MIRRORED_REPEAT,
|
|
9713
|
+
wrapT: glContext.MIRRORED_REPEAT,
|
|
9714
|
+
minFilter: glContext.NEAREST,
|
|
9715
|
+
magFilter: glContext.NEAREST
|
|
9716
|
+
});
|
|
9717
|
+
}
|
|
9532
9718
|
|
|
9533
9719
|
const HEADER_LEN = 12 + 13 * 4; // identifier + header elements (not including key value meta-data pairs)
|
|
9534
9720
|
const COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D()
|
|
@@ -10447,8 +10633,8 @@ let seed$5 = 1;
|
|
|
10447
10633
|
/**
|
|
10448
10634
|
* 配置当前pass的RT,在每帧渲染前调用
|
|
10449
10635
|
*/ configure(renderer) {
|
|
10450
|
-
if (this.
|
|
10451
|
-
renderer.
|
|
10636
|
+
if (this.framebuffer) {
|
|
10637
|
+
renderer.setFramebuffer(this.framebuffer);
|
|
10452
10638
|
} else {
|
|
10453
10639
|
const [x, y, width, height] = this.getViewport();
|
|
10454
10640
|
renderer.setViewport(x, y, width, height);
|
|
@@ -10490,9 +10676,9 @@ let seed$5 = 1;
|
|
|
10490
10676
|
});
|
|
10491
10677
|
this.attachments.forEach((att)=>!att.externalTexture && att.dispose());
|
|
10492
10678
|
this.attachments = attachments;
|
|
10493
|
-
if (this.
|
|
10494
|
-
this.
|
|
10495
|
-
this.
|
|
10679
|
+
if (this.framebuffer) {
|
|
10680
|
+
this.framebuffer.bind();
|
|
10681
|
+
this.framebuffer.resetColorTextures(colors.map((color)=>color));
|
|
10496
10682
|
}
|
|
10497
10683
|
}
|
|
10498
10684
|
}
|
|
@@ -10511,18 +10697,18 @@ let seed$5 = 1;
|
|
|
10511
10697
|
this.isCustomViewport = true;
|
|
10512
10698
|
this.viewportScale = 1;
|
|
10513
10699
|
this.customViewport = options.viewport.slice(0, 4);
|
|
10514
|
-
if (this.
|
|
10700
|
+
if (this.framebuffer) {
|
|
10515
10701
|
const vp = this.customViewport;
|
|
10516
10702
|
// TODO 为什么framebuffer和renderpass的isCustomViewport不一样?
|
|
10517
|
-
this.
|
|
10518
|
-
this.
|
|
10703
|
+
this.framebuffer.isCustomViewport = false;
|
|
10704
|
+
this.framebuffer.resize(vp[0], vp[1], vp[2], vp[3]);
|
|
10519
10705
|
}
|
|
10520
10706
|
} else {
|
|
10521
10707
|
this.isCustomViewport = false;
|
|
10522
10708
|
this.viewportScale = options.viewportScale || 1;
|
|
10523
|
-
if (this.
|
|
10524
|
-
this.
|
|
10525
|
-
this.
|
|
10709
|
+
if (this.framebuffer) {
|
|
10710
|
+
this.framebuffer.isCustomViewport = true;
|
|
10711
|
+
this.framebuffer.viewportScale = this.viewportScale;
|
|
10526
10712
|
}
|
|
10527
10713
|
}
|
|
10528
10714
|
}
|
|
@@ -10531,14 +10717,13 @@ let seed$5 = 1;
|
|
|
10531
10717
|
const renderer = this.renderer;
|
|
10532
10718
|
const options = this.options;
|
|
10533
10719
|
if (this.attachments.length) {
|
|
10534
|
-
var
|
|
10720
|
+
var _this_framebuffer;
|
|
10535
10721
|
this.attachments.forEach((att)=>!att.externalTexture && att.dispose());
|
|
10536
10722
|
this.attachments.length = 0;
|
|
10537
|
-
(
|
|
10723
|
+
(_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.dispose({
|
|
10538
10724
|
depthStencilAttachment: 2
|
|
10539
10725
|
});
|
|
10540
|
-
|
|
10541
|
-
this.frameBuffer = null;
|
|
10726
|
+
this.framebuffer = null;
|
|
10542
10727
|
}
|
|
10543
10728
|
const vs = this.viewportScale;
|
|
10544
10729
|
// renderpass 的 viewport 相关参数都需要动态的修改
|
|
@@ -10563,7 +10748,7 @@ let seed$5 = 1;
|
|
|
10563
10748
|
return attachment;
|
|
10564
10749
|
});
|
|
10565
10750
|
this.attachments = attachments;
|
|
10566
|
-
const framebuffer =
|
|
10751
|
+
const framebuffer = Framebuffer.create({
|
|
10567
10752
|
storeAction: this.storeAction,
|
|
10568
10753
|
name,
|
|
10569
10754
|
viewport,
|
|
@@ -10576,7 +10761,7 @@ let seed$5 = 1;
|
|
|
10576
10761
|
}, renderer);
|
|
10577
10762
|
framebuffer.bind();
|
|
10578
10763
|
framebuffer.unbind();
|
|
10579
|
-
this.
|
|
10764
|
+
this.framebuffer = framebuffer;
|
|
10580
10765
|
} else {
|
|
10581
10766
|
this.attachments.length = 0;
|
|
10582
10767
|
}
|
|
@@ -10584,8 +10769,8 @@ let seed$5 = 1;
|
|
|
10584
10769
|
/**
|
|
10585
10770
|
* 获取当前视口大小,格式:[x偏移,y偏移,宽度,高度]
|
|
10586
10771
|
*/ getViewport() {
|
|
10587
|
-
var
|
|
10588
|
-
const ret = ((
|
|
10772
|
+
var _this_framebuffer;
|
|
10773
|
+
const ret = ((_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.viewport) || this.customViewport;
|
|
10589
10774
|
if (ret) {
|
|
10590
10775
|
return ret;
|
|
10591
10776
|
}
|
|
@@ -10606,24 +10791,24 @@ let seed$5 = 1;
|
|
|
10606
10791
|
/**
|
|
10607
10792
|
* 获取深度 Attachment,可能没有
|
|
10608
10793
|
*/ getDepthAttachment() {
|
|
10609
|
-
const
|
|
10610
|
-
if (
|
|
10794
|
+
const framebuffer = this.framebuffer;
|
|
10795
|
+
if (framebuffer) {
|
|
10611
10796
|
return {
|
|
10612
|
-
storageType:
|
|
10613
|
-
storage:
|
|
10614
|
-
texture:
|
|
10797
|
+
storageType: framebuffer.depthStencilStorageType,
|
|
10798
|
+
storage: framebuffer.depthStorage,
|
|
10799
|
+
texture: framebuffer.getDepthTexture() ? this.getDepthTexture(framebuffer.getDepthTexture(), framebuffer.externalStorage) : undefined
|
|
10615
10800
|
};
|
|
10616
10801
|
}
|
|
10617
10802
|
}
|
|
10618
10803
|
/**
|
|
10619
10804
|
* 获取蒙版 Attachment,可能没有
|
|
10620
10805
|
*/ getStencilAttachment() {
|
|
10621
|
-
const
|
|
10622
|
-
if (
|
|
10806
|
+
const framebuffer = this.framebuffer;
|
|
10807
|
+
if (framebuffer) {
|
|
10623
10808
|
return {
|
|
10624
|
-
storageType:
|
|
10625
|
-
storage:
|
|
10626
|
-
texture:
|
|
10809
|
+
storageType: framebuffer.depthStencilStorageType,
|
|
10810
|
+
storage: framebuffer.stencilStorage,
|
|
10811
|
+
texture: framebuffer.getStencilTexture() ? this.getStencilTexture(framebuffer.getStencilTexture(), framebuffer.externalStorage) : undefined
|
|
10627
10812
|
};
|
|
10628
10813
|
}
|
|
10629
10814
|
}
|
|
@@ -10688,7 +10873,7 @@ let seed$5 = 1;
|
|
|
10688
10873
|
}
|
|
10689
10874
|
this.destroyed = true;
|
|
10690
10875
|
const depthStencilOpt = (options == null ? void 0 : options.depthStencilAttachment) ? options.depthStencilAttachment : 0;
|
|
10691
|
-
const fbo = this.
|
|
10876
|
+
const fbo = this.framebuffer;
|
|
10692
10877
|
if (fbo) {
|
|
10693
10878
|
fbo.dispose({
|
|
10694
10879
|
depthStencilAttachment: depthStencilOpt
|
|
@@ -10771,9 +10956,9 @@ var thresholdFrag = "precision highp float;varying vec2 uv;uniform sampler2D _Ma
|
|
|
10771
10956
|
// Bloom 阈值 Pass
|
|
10772
10957
|
class BloomThresholdPass extends RenderPass {
|
|
10773
10958
|
configure(renderer) {
|
|
10774
|
-
this.mainTexture = renderer.
|
|
10959
|
+
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
10775
10960
|
this.sceneTextureHandle.texture = this.mainTexture;
|
|
10776
|
-
renderer.
|
|
10961
|
+
renderer.setFramebuffer(this.framebuffer);
|
|
10777
10962
|
}
|
|
10778
10963
|
execute(renderer) {
|
|
10779
10964
|
renderer.clear({
|
|
@@ -10831,8 +11016,8 @@ class BloomThresholdPass extends RenderPass {
|
|
|
10831
11016
|
}
|
|
10832
11017
|
class HQGaussianDownSamplePass extends RenderPass {
|
|
10833
11018
|
configure(renderer) {
|
|
10834
|
-
this.mainTexture = renderer.
|
|
10835
|
-
renderer.
|
|
11019
|
+
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
11020
|
+
renderer.setFramebuffer(this.framebuffer);
|
|
10836
11021
|
}
|
|
10837
11022
|
execute(renderer) {
|
|
10838
11023
|
renderer.clear({
|
|
@@ -10846,7 +11031,7 @@ class HQGaussianDownSamplePass extends RenderPass {
|
|
|
10846
11031
|
this.screenMesh
|
|
10847
11032
|
]);
|
|
10848
11033
|
if (this.type === 'V') {
|
|
10849
|
-
this.gaussianResult.texture = renderer.
|
|
11034
|
+
this.gaussianResult.texture = renderer.getFramebuffer().getColorTextures()[0];
|
|
10850
11035
|
}
|
|
10851
11036
|
}
|
|
10852
11037
|
constructor(renderer, type, options){
|
|
@@ -10899,8 +11084,8 @@ class HQGaussianDownSamplePass extends RenderPass {
|
|
|
10899
11084
|
}
|
|
10900
11085
|
class HQGaussianUpSamplePass extends RenderPass {
|
|
10901
11086
|
configure(renderer) {
|
|
10902
|
-
this.mainTexture = renderer.
|
|
10903
|
-
renderer.
|
|
11087
|
+
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
11088
|
+
renderer.setFramebuffer(this.framebuffer);
|
|
10904
11089
|
}
|
|
10905
11090
|
execute(renderer) {
|
|
10906
11091
|
renderer.clear({
|
|
@@ -10963,11 +11148,11 @@ class HQGaussianUpSamplePass extends RenderPass {
|
|
|
10963
11148
|
// 合并Bloom的高斯模糊结果,并应用ACES Tonemapping
|
|
10964
11149
|
class ToneMappingPass extends RenderPass {
|
|
10965
11150
|
configure(renderer) {
|
|
10966
|
-
this.mainTexture = renderer.
|
|
11151
|
+
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
10967
11152
|
if (!this.sceneTextureHandle.texture) {
|
|
10968
11153
|
this.sceneTextureHandle.texture = this.mainTexture;
|
|
10969
11154
|
}
|
|
10970
|
-
renderer.
|
|
11155
|
+
renderer.setFramebuffer(null);
|
|
10971
11156
|
}
|
|
10972
11157
|
execute(renderer) {
|
|
10973
11158
|
renderer.clear({
|
|
@@ -11322,7 +11507,7 @@ let seed$4 = 1;
|
|
|
11322
11507
|
this.destroyed = true;
|
|
11323
11508
|
}
|
|
11324
11509
|
/**
|
|
11325
|
-
* 重置 RenderPass ColorAttachment,解决
|
|
11510
|
+
* 重置 RenderPass ColorAttachment,解决 Framebuffer 即读又写的问题
|
|
11326
11511
|
* @param renderPasses - RenderPass 对象数组
|
|
11327
11512
|
* @param startIndex - 开始重置的索引
|
|
11328
11513
|
*/ resetRenderPassDefaultAttachment(renderPasses, startIndex) {
|
|
@@ -11532,7 +11717,7 @@ let seed$4 = 1;
|
|
|
11532
11717
|
// TODO tex和size没有地方用到。
|
|
11533
11718
|
/**
|
|
11534
11719
|
* 创建拷贝 RenderPass 用到的 Mesh 对象
|
|
11535
|
-
* @param semantics - RenderPass 渲染时
|
|
11720
|
+
* @param semantics - RenderPass 渲染时 Framebuffer 的颜色和深度纹理、大小和是否混合
|
|
11536
11721
|
*/ createCopyMesh(semantics) {
|
|
11537
11722
|
const name = EFFECTS_COPY_MESH_NAME;
|
|
11538
11723
|
const engine = this.renderer.engine;
|
|
@@ -11817,8 +12002,8 @@ function findPreviousRenderPass(renderPasses, renderPass) {
|
|
|
11817
12002
|
}
|
|
11818
12003
|
class FinalCopyRP extends RenderPass {
|
|
11819
12004
|
configure(renderer) {
|
|
11820
|
-
this.prePassTexture = renderer.
|
|
11821
|
-
renderer.
|
|
12005
|
+
this.prePassTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12006
|
+
renderer.setFramebuffer(null);
|
|
11822
12007
|
}
|
|
11823
12008
|
execute(renderer) {
|
|
11824
12009
|
renderer.clear(this.clearAction);
|
|
@@ -11844,7 +12029,7 @@ class GlobalUniforms {
|
|
|
11844
12029
|
}
|
|
11845
12030
|
}
|
|
11846
12031
|
|
|
11847
|
-
class
|
|
12032
|
+
class Renderbuffer {
|
|
11848
12033
|
get isDestroyed() {
|
|
11849
12034
|
return this.destroyed;
|
|
11850
12035
|
}
|
|
@@ -12005,7 +12190,7 @@ var RenderTextureFormat;
|
|
|
12005
12190
|
})(RenderTextureFormat || (RenderTextureFormat = {}));
|
|
12006
12191
|
/**
|
|
12007
12192
|
*
|
|
12008
|
-
*/ class
|
|
12193
|
+
*/ class Framebuffer {
|
|
12009
12194
|
resize(x, y, width, height) {
|
|
12010
12195
|
// OVERRIDE
|
|
12011
12196
|
}
|
|
@@ -12053,11 +12238,11 @@ class Renderer {
|
|
|
12053
12238
|
setGlobalMatrix(name, value) {
|
|
12054
12239
|
// OVERRIDE
|
|
12055
12240
|
}
|
|
12056
|
-
|
|
12241
|
+
getFramebuffer() {
|
|
12057
12242
|
// OVERRIDE
|
|
12058
12243
|
return null;
|
|
12059
12244
|
}
|
|
12060
|
-
|
|
12245
|
+
setFramebuffer(framebuffer) {}
|
|
12061
12246
|
setViewport(x, y, width, height) {
|
|
12062
12247
|
// OVERRIDE
|
|
12063
12248
|
}
|
|
@@ -12114,7 +12299,7 @@ class Renderer {
|
|
|
12114
12299
|
renderMeshes(meshes) {
|
|
12115
12300
|
// OVERRIDE
|
|
12116
12301
|
}
|
|
12117
|
-
drawGeometry(geometry, material) {
|
|
12302
|
+
drawGeometry(geometry, material, subMeshIndex = 0) {
|
|
12118
12303
|
// OVERRIDE
|
|
12119
12304
|
}
|
|
12120
12305
|
getTemporaryRT(name, width, height, depthBuffer, filter, format) {
|
|
@@ -12430,7 +12615,7 @@ class InteractComponent extends RendererComponent {
|
|
|
12430
12615
|
}
|
|
12431
12616
|
getBoundingBox() {
|
|
12432
12617
|
const worldMatrix = this.transform.getWorldMatrix();
|
|
12433
|
-
const triangles = trianglesFromRect(Vector3.ZERO, 0.5, 0.5);
|
|
12618
|
+
const triangles = trianglesFromRect(Vector3.ZERO, 0.5 * this.transform.size.x, 0.5 * this.transform.size.y);
|
|
12434
12619
|
triangles.forEach((triangle)=>{
|
|
12435
12620
|
worldMatrix.transformPoint(triangle.p0);
|
|
12436
12621
|
worldMatrix.transformPoint(triangle.p1);
|
|
@@ -12662,1188 +12847,749 @@ class PlayableAsset {
|
|
|
12662
12847
|
fromData(data) {}
|
|
12663
12848
|
}
|
|
12664
12849
|
|
|
12665
|
-
|
|
12666
|
-
|
|
12667
|
-
|
|
12668
|
-
|
|
12669
|
-
|
|
12670
|
-
|
|
12671
|
-
|
|
12672
|
-
|
|
12673
|
-
|
|
12674
|
-
|
|
12675
|
-
|
|
12676
|
-
|
|
12850
|
+
const singleSplits = [
|
|
12851
|
+
[
|
|
12852
|
+
0,
|
|
12853
|
+
0,
|
|
12854
|
+
1,
|
|
12855
|
+
1,
|
|
12856
|
+
undefined
|
|
12857
|
+
]
|
|
12858
|
+
];
|
|
12859
|
+
const tempColor = [
|
|
12860
|
+
1,
|
|
12861
|
+
1,
|
|
12862
|
+
1,
|
|
12863
|
+
1
|
|
12864
|
+
];
|
|
12865
|
+
let seed$2 = 0;
|
|
12866
|
+
class SpriteColorPlayable extends Playable {
|
|
12867
|
+
onPlayablePlay() {
|
|
12868
|
+
this.spriteMaterial = this.bindingItem.getComponent(SpriteComponent).material;
|
|
12677
12869
|
}
|
|
12678
|
-
|
|
12679
|
-
|
|
12680
|
-
|
|
12681
|
-
|
|
12870
|
+
processFrame(dt) {
|
|
12871
|
+
let colorInc = vecFill(tempColor, 1);
|
|
12872
|
+
let colorChanged;
|
|
12873
|
+
const life = this.time / this.bindingItem.duration;
|
|
12874
|
+
const opacityOverLifetime = this.opacityOverLifetime;
|
|
12875
|
+
const colorOverLifetime = this.colorOverLifetime;
|
|
12876
|
+
if (colorOverLifetime) {
|
|
12877
|
+
colorInc = getColorFromGradientStops(colorOverLifetime, life, true);
|
|
12878
|
+
colorChanged = true;
|
|
12879
|
+
}
|
|
12880
|
+
if (opacityOverLifetime) {
|
|
12881
|
+
colorInc[3] *= opacityOverLifetime.getValue(life);
|
|
12882
|
+
colorChanged = true;
|
|
12883
|
+
}
|
|
12884
|
+
if (colorChanged) {
|
|
12885
|
+
vecMulCombine(this.renderColor, colorInc, this.startColor);
|
|
12886
|
+
this.spriteMaterial.getVector4('_Color').setFromArray(this.renderColor);
|
|
12682
12887
|
}
|
|
12683
|
-
return defaultMixPlayable;
|
|
12684
|
-
}
|
|
12685
|
-
createClip(classConstructor, name) {
|
|
12686
|
-
const newClip = new TimelineClip();
|
|
12687
|
-
newClip.playable = new classConstructor();
|
|
12688
|
-
newClip.name = name ? name : 'TimelineClip' + newClip.id;
|
|
12689
|
-
this.addClip(newClip);
|
|
12690
|
-
return newClip;
|
|
12691
|
-
}
|
|
12692
|
-
getClips() {
|
|
12693
|
-
return this.clips;
|
|
12694
12888
|
}
|
|
12695
|
-
|
|
12696
|
-
|
|
12697
|
-
|
|
12698
|
-
|
|
12889
|
+
fromData(clipData) {
|
|
12890
|
+
this.clipData = clipData;
|
|
12891
|
+
const colorOverLifetime = clipData.colorOverLifetime;
|
|
12892
|
+
if (colorOverLifetime) {
|
|
12893
|
+
var _colorOverLifetime_opacity;
|
|
12894
|
+
this.opacityOverLifetime = createValueGetter((_colorOverLifetime_opacity = colorOverLifetime.opacity) != null ? _colorOverLifetime_opacity : 1);
|
|
12895
|
+
if (colorOverLifetime.color && colorOverLifetime.color[0] === ValueType.GRADIENT_COLOR) {
|
|
12896
|
+
this.colorOverLifetime = colorStopsFromGradient(colorOverLifetime.color[1]);
|
|
12699
12897
|
}
|
|
12700
12898
|
}
|
|
12701
|
-
|
|
12702
|
-
|
|
12703
|
-
|
|
12704
|
-
|
|
12705
|
-
|
|
12899
|
+
this.startColor = clipData.startColor || [
|
|
12900
|
+
1,
|
|
12901
|
+
1,
|
|
12902
|
+
1,
|
|
12903
|
+
1
|
|
12904
|
+
];
|
|
12905
|
+
return this;
|
|
12706
12906
|
}
|
|
12707
12907
|
constructor(...args){
|
|
12708
12908
|
super(...args);
|
|
12709
|
-
this.
|
|
12710
|
-
|
|
12711
|
-
|
|
12712
|
-
|
|
12713
|
-
|
|
12714
|
-
|
|
12715
|
-
* @internal
|
|
12716
|
-
*/ class TimelineClip {
|
|
12717
|
-
constructor(){
|
|
12718
|
-
this.start = 0;
|
|
12719
|
-
this.duration = 0;
|
|
12909
|
+
this.renderColor = [
|
|
12910
|
+
1,
|
|
12911
|
+
1,
|
|
12912
|
+
1,
|
|
12913
|
+
1
|
|
12914
|
+
];
|
|
12720
12915
|
}
|
|
12721
12916
|
}
|
|
12722
|
-
|
|
12723
|
-
|
|
12724
|
-
|
|
12725
|
-
|
|
12726
|
-
|
|
12727
|
-
|
|
12728
|
-
propertyName,
|
|
12729
|
-
value
|
|
12730
|
-
};
|
|
12731
|
-
} else {
|
|
12732
|
-
this.curveValues[componentType + propertyName].value = value;
|
|
12733
|
-
}
|
|
12734
|
-
return this.curveValues[componentType + propertyName];
|
|
12735
|
-
}
|
|
12736
|
-
findCurveValue(componentType, propertyName) {
|
|
12737
|
-
return this.curveValues[componentType + propertyName];
|
|
12917
|
+
class SpriteComponent extends RendererComponent {
|
|
12918
|
+
/**
|
|
12919
|
+
* 设置当前 Mesh 的可见性。
|
|
12920
|
+
* @param visible - true:可见,false:不可见
|
|
12921
|
+
*/ setVisible(visible) {
|
|
12922
|
+
this.visible = visible;
|
|
12738
12923
|
}
|
|
12739
|
-
|
|
12740
|
-
|
|
12741
|
-
|
|
12742
|
-
|
|
12743
|
-
}
|
|
12924
|
+
/**
|
|
12925
|
+
* 获取当前 Mesh 的可见性。
|
|
12926
|
+
*/ getVisible() {
|
|
12927
|
+
return this.visible;
|
|
12744
12928
|
}
|
|
12745
|
-
|
|
12746
|
-
|
|
12747
|
-
|
|
12929
|
+
/**
|
|
12930
|
+
* 设置当前图层的颜色
|
|
12931
|
+
* > Tips: 透明度也属于颜色的一部分,当有透明度/颜色 K 帧变化时,该 API 会失效
|
|
12932
|
+
* @since 2.0.0
|
|
12933
|
+
* @param color - 颜色值
|
|
12934
|
+
*/ setColor(color) {
|
|
12935
|
+
this.color = color;
|
|
12936
|
+
this.material.setVector4('_Color', new Vector4().setFromArray(color));
|
|
12748
12937
|
}
|
|
12749
|
-
|
|
12750
|
-
|
|
12751
|
-
|
|
12752
|
-
|
|
12753
|
-
|
|
12754
|
-
this.
|
|
12938
|
+
/**
|
|
12939
|
+
* 设置当前 Mesh 的纹理
|
|
12940
|
+
* @since 2.0.0
|
|
12941
|
+
* @param texture - 纹理对象
|
|
12942
|
+
*/ setTexture(texture) {
|
|
12943
|
+
this.renderer.texture = texture;
|
|
12944
|
+
this.material.setTexture('uSampler0', texture);
|
|
12755
12945
|
}
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
const tempSize$1 = new Vector3(1, 1, 1);
|
|
12760
|
-
const tempPos = new Vector3();
|
|
12761
|
-
/**
|
|
12762
|
-
* @since 2.0.0
|
|
12763
|
-
* @internal
|
|
12764
|
-
*/ class TransformAnimationPlayable extends AnimationPlayable {
|
|
12765
|
-
processFrame(dt) {
|
|
12766
|
-
if (this.bindingItem.composition) {
|
|
12767
|
-
this.sampleAnimation();
|
|
12946
|
+
render(renderer) {
|
|
12947
|
+
if (!this.getVisible()) {
|
|
12948
|
+
return;
|
|
12768
12949
|
}
|
|
12950
|
+
const material = this.material;
|
|
12951
|
+
const geo = this.geometry;
|
|
12952
|
+
if (renderer.renderingData.currentFrame.globalUniforms) {
|
|
12953
|
+
renderer.setGlobalMatrix('effects_ObjectToWorld', this.transform.getWorldMatrix());
|
|
12954
|
+
}
|
|
12955
|
+
this.material.setVector2('_Size', this.transform.size);
|
|
12956
|
+
renderer.drawGeometry(geo, material);
|
|
12769
12957
|
}
|
|
12770
|
-
|
|
12771
|
-
|
|
12772
|
-
|
|
12773
|
-
|
|
12774
|
-
|
|
12775
|
-
|
|
12776
|
-
|
|
12777
|
-
|
|
12778
|
-
|
|
12779
|
-
|
|
12780
|
-
|
|
12781
|
-
|
|
12782
|
-
|
|
12958
|
+
start() {
|
|
12959
|
+
this.priority = this.item.listIndex;
|
|
12960
|
+
this.item.getHitTestParams = this.getHitTestParams;
|
|
12961
|
+
}
|
|
12962
|
+
update(dt) {
|
|
12963
|
+
this.frameAnimationTime += dt / 1000;
|
|
12964
|
+
const time = this.frameAnimationTime;
|
|
12965
|
+
const duration = this.item.duration;
|
|
12966
|
+
const life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
12967
|
+
const ta = this.textureSheetAnimation;
|
|
12968
|
+
if (ta) {
|
|
12969
|
+
const total = ta.total || ta.row * ta.col;
|
|
12970
|
+
let texRectX = 0;
|
|
12971
|
+
let texRectY = 0;
|
|
12972
|
+
let texRectW = 1;
|
|
12973
|
+
let texRectH = 1;
|
|
12974
|
+
let flip;
|
|
12975
|
+
if (this.splits) {
|
|
12976
|
+
const sp = this.splits[0];
|
|
12977
|
+
flip = sp[4];
|
|
12978
|
+
texRectX = sp[0];
|
|
12979
|
+
texRectY = sp[1];
|
|
12980
|
+
if (flip) {
|
|
12981
|
+
texRectW = sp[3];
|
|
12982
|
+
texRectH = sp[2];
|
|
12983
|
+
} else {
|
|
12984
|
+
texRectW = sp[2];
|
|
12985
|
+
texRectH = sp[3];
|
|
12986
|
+
}
|
|
12783
12987
|
}
|
|
12784
|
-
|
|
12785
|
-
|
|
12786
|
-
|
|
12787
|
-
|
|
12788
|
-
// this.animationStream.setCurveValue('transform', 'scale.z', tempSize.z * startSize.z);
|
|
12789
|
-
}
|
|
12790
|
-
if (this.rotationOverLifetime) {
|
|
12791
|
-
const func = (v)=>this.rotationOverLifetime.asRotation ? v.getValue(life) : v.getIntegrateValue(0, life, duration);
|
|
12792
|
-
const incZ = func(this.rotationOverLifetime.z);
|
|
12793
|
-
const separateAxes = this.rotationOverLifetime.separateAxes;
|
|
12794
|
-
tempRot$1.x = separateAxes ? func(this.rotationOverLifetime.x) : 0;
|
|
12795
|
-
tempRot$1.y = separateAxes ? func(this.rotationOverLifetime.y) : 0;
|
|
12796
|
-
tempRot$1.z = incZ;
|
|
12797
|
-
const rot = tempRot$1.addEulers(this.originalTransform.rotation, tempRot$1);
|
|
12798
|
-
this.bindingItem.transform.setRotation(rot.x, rot.y, rot.z);
|
|
12799
|
-
// this.animationStream.setCurveValue('transform', 'rotation.x', rot.x);
|
|
12800
|
-
// this.animationStream.setCurveValue('transform', 'rotation.y', rot.y);
|
|
12801
|
-
// this.animationStream.setCurveValue('transform', 'rotation.z', rot.z);
|
|
12802
|
-
}
|
|
12803
|
-
if (this.positionOverLifetime) {
|
|
12804
|
-
const pos = tempPos;
|
|
12805
|
-
calculateTranslation(pos, this, this.gravity, this.time, duration, this.originalTransform.position, this.velocity);
|
|
12806
|
-
if (this.originalTransform.path) {
|
|
12807
|
-
pos.add(this.originalTransform.path.getValue(life));
|
|
12808
|
-
}
|
|
12809
|
-
this.bindingItem.transform.setPosition(pos.x, pos.y, pos.z);
|
|
12810
|
-
// this.animationStream.setCurveValue('transform', 'position.x', pos.x);
|
|
12811
|
-
// this.animationStream.setCurveValue('transform', 'position.y', pos.y);
|
|
12812
|
-
// this.animationStream.setCurveValue('transform', 'position.z', pos.z);
|
|
12813
|
-
}
|
|
12814
|
-
}
|
|
12815
|
-
fromData(data) {
|
|
12816
|
-
const scale = this.bindingItem.transform.scale;
|
|
12817
|
-
this.originalTransform = {
|
|
12818
|
-
position: this.bindingItem.transform.position.clone(),
|
|
12819
|
-
rotation: this.bindingItem.transform.getRotation().clone(),
|
|
12820
|
-
// TODO 编辑器 scale 没有z轴控制
|
|
12821
|
-
scale: new Vector3(scale.x, scale.y, scale.x)
|
|
12822
|
-
};
|
|
12823
|
-
const positionOverLifetime = data.positionOverLifetime;
|
|
12824
|
-
const rotationOverLifetime = data.rotationOverLifetime;
|
|
12825
|
-
const sizeOverLifetime = data.sizeOverLifetime;
|
|
12826
|
-
// TODO: 没有 K 帧数据的不需要传 positionOverLifetime 空对象
|
|
12827
|
-
if (positionOverLifetime && Object.keys(positionOverLifetime).length !== 0) {
|
|
12828
|
-
this.positionOverLifetime = positionOverLifetime;
|
|
12829
|
-
if (positionOverLifetime.path) {
|
|
12830
|
-
this.originalTransform.path = createValueGetter(positionOverLifetime.path);
|
|
12831
|
-
}
|
|
12832
|
-
const linearVelEnable = positionOverLifetime.linearX || positionOverLifetime.linearY || positionOverLifetime.linearZ;
|
|
12833
|
-
if (linearVelEnable) {
|
|
12834
|
-
this.linearVelOverLifetime = {
|
|
12835
|
-
x: positionOverLifetime.linearX && createValueGetter(positionOverLifetime.linearX),
|
|
12836
|
-
y: positionOverLifetime.linearY && createValueGetter(positionOverLifetime.linearY),
|
|
12837
|
-
z: positionOverLifetime.linearZ && createValueGetter(positionOverLifetime.linearZ),
|
|
12838
|
-
asMovement: positionOverLifetime.asMovement,
|
|
12839
|
-
enabled: !!linearVelEnable
|
|
12840
|
-
};
|
|
12841
|
-
}
|
|
12842
|
-
const orbitalVelEnable = positionOverLifetime.orbitalX || positionOverLifetime.orbitalY || positionOverLifetime.orbitalZ;
|
|
12843
|
-
if (orbitalVelEnable) {
|
|
12844
|
-
this.orbitalVelOverLifetime = {
|
|
12845
|
-
x: positionOverLifetime.orbitalX && createValueGetter(positionOverLifetime.orbitalX),
|
|
12846
|
-
y: positionOverLifetime.orbitalY && createValueGetter(positionOverLifetime.orbitalY),
|
|
12847
|
-
z: positionOverLifetime.orbitalZ && createValueGetter(positionOverLifetime.orbitalZ),
|
|
12848
|
-
center: ensureVec3(positionOverLifetime.orbCenter),
|
|
12849
|
-
asRotation: positionOverLifetime.asRotation,
|
|
12850
|
-
enabled: !!orbitalVelEnable
|
|
12851
|
-
};
|
|
12852
|
-
}
|
|
12853
|
-
this.speedOverLifetime = positionOverLifetime.speedOverLifetime && createValueGetter(positionOverLifetime.speedOverLifetime);
|
|
12854
|
-
}
|
|
12855
|
-
if (sizeOverLifetime) {
|
|
12856
|
-
if (sizeOverLifetime.separateAxes) {
|
|
12857
|
-
this.sizeSeparateAxes = true;
|
|
12858
|
-
this.sizeXOverLifetime = createValueGetter(sizeOverLifetime.x || 1);
|
|
12859
|
-
this.sizeYOverLifetime = createValueGetter(sizeOverLifetime.y || 1);
|
|
12860
|
-
this.sizeZOverLifetime = createValueGetter(sizeOverLifetime.z || 1);
|
|
12988
|
+
let dx, dy;
|
|
12989
|
+
if (flip) {
|
|
12990
|
+
dx = 1 / ta.row * texRectW;
|
|
12991
|
+
dy = 1 / ta.col * texRectH;
|
|
12861
12992
|
} else {
|
|
12862
|
-
|
|
12993
|
+
dx = 1 / ta.col * texRectW;
|
|
12994
|
+
dy = 1 / ta.row * texRectH;
|
|
12863
12995
|
}
|
|
12864
|
-
|
|
12865
|
-
|
|
12866
|
-
|
|
12867
|
-
|
|
12868
|
-
|
|
12869
|
-
|
|
12870
|
-
|
|
12871
|
-
|
|
12872
|
-
|
|
12873
|
-
|
|
12874
|
-
|
|
12996
|
+
let texOffset;
|
|
12997
|
+
if (ta.animate) {
|
|
12998
|
+
const frameIndex = Math.round(life * (total - 1));
|
|
12999
|
+
const yIndex = Math.floor(frameIndex / ta.col);
|
|
13000
|
+
const xIndex = frameIndex - yIndex * ta.col;
|
|
13001
|
+
texOffset = flip ? [
|
|
13002
|
+
dx * yIndex,
|
|
13003
|
+
dy * (ta.col - xIndex)
|
|
13004
|
+
] : [
|
|
13005
|
+
dx * xIndex,
|
|
13006
|
+
dy * (1 + yIndex)
|
|
13007
|
+
];
|
|
13008
|
+
} else {
|
|
13009
|
+
texOffset = [
|
|
13010
|
+
0,
|
|
13011
|
+
dy
|
|
13012
|
+
];
|
|
12875
13013
|
}
|
|
13014
|
+
this.material.getVector4('_TexOffset').setFromArray([
|
|
13015
|
+
texRectX + texOffset[0],
|
|
13016
|
+
texRectH + texRectY - texOffset[1],
|
|
13017
|
+
dx,
|
|
13018
|
+
dy
|
|
13019
|
+
]);
|
|
12876
13020
|
}
|
|
12877
|
-
this.gravity = Vector3.fromArray((positionOverLifetime == null ? void 0 : positionOverLifetime.gravity) || []);
|
|
12878
|
-
var _positionOverLifetime_gravityOverLifetime;
|
|
12879
|
-
this.gravityModifier = createValueGetter((_positionOverLifetime_gravityOverLifetime = positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime) != null ? _positionOverLifetime_gravityOverLifetime : 0);
|
|
12880
|
-
this.direction = (positionOverLifetime == null ? void 0 : positionOverLifetime.direction) ? Vector3.fromArray(positionOverLifetime.direction).normalize() : new Vector3();
|
|
12881
|
-
this.startSpeed = (positionOverLifetime == null ? void 0 : positionOverLifetime.startSpeed) || 0;
|
|
12882
|
-
this.velocity = this.direction.clone();
|
|
12883
|
-
this.velocity.multiply(this.startSpeed);
|
|
12884
|
-
}
|
|
12885
|
-
}
|
|
12886
|
-
class TransformAnimationPlayableAsset extends PlayableAsset {
|
|
12887
|
-
createPlayable() {
|
|
12888
|
-
const transformAnimationPlayable = new TransformAnimationPlayable();
|
|
12889
|
-
transformAnimationPlayable.fromData(this.transformAnimationData);
|
|
12890
|
-
return transformAnimationPlayable;
|
|
12891
|
-
}
|
|
12892
|
-
fromData(data) {
|
|
12893
|
-
this.transformAnimationData = data;
|
|
12894
|
-
}
|
|
12895
|
-
}
|
|
12896
|
-
/**
|
|
12897
|
-
* @since 2.0.0
|
|
12898
|
-
* @internal
|
|
12899
|
-
*/ class ActivationPlayable extends Playable {
|
|
12900
|
-
onGraphStart() {
|
|
12901
|
-
this.bindingItem.transform.setValid(false);
|
|
12902
|
-
this.hideRendererComponents();
|
|
12903
|
-
}
|
|
12904
|
-
onPlayablePlay() {
|
|
12905
|
-
this.bindingItem.transform.setValid(true);
|
|
12906
|
-
this.showRendererComponents();
|
|
12907
|
-
}
|
|
12908
|
-
onPlayableDestroy() {
|
|
12909
|
-
this.bindingItem.transform.setValid(false);
|
|
12910
|
-
this.hideRendererComponents();
|
|
12911
13021
|
}
|
|
12912
|
-
|
|
12913
|
-
|
|
12914
|
-
|
|
12915
|
-
rendererComponent.enabled = false;
|
|
12916
|
-
}
|
|
13022
|
+
onDestroy() {
|
|
13023
|
+
if (this.item && this.item.composition) {
|
|
13024
|
+
this.item.composition.destroyTextures(this.getTextures());
|
|
12917
13025
|
}
|
|
12918
13026
|
}
|
|
12919
|
-
|
|
12920
|
-
|
|
12921
|
-
|
|
12922
|
-
|
|
12923
|
-
}
|
|
13027
|
+
getItemInitData(item, idx, pointStartIndex, textureIndex) {
|
|
13028
|
+
let geoData = item.geoData;
|
|
13029
|
+
if (!geoData) {
|
|
13030
|
+
geoData = item.geoData = this.getItemGeometryData(item, idx);
|
|
12924
13031
|
}
|
|
12925
|
-
|
|
12926
|
-
|
|
12927
|
-
|
|
12928
|
-
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
|
|
12936
|
-
|
|
12937
|
-
|
|
13032
|
+
const index = geoData.index;
|
|
13033
|
+
const idxCount = index.length;
|
|
13034
|
+
// @ts-expect-error
|
|
13035
|
+
const indexData = this.wireframe ? new Uint8Array([
|
|
13036
|
+
0,
|
|
13037
|
+
1,
|
|
13038
|
+
1,
|
|
13039
|
+
3,
|
|
13040
|
+
2,
|
|
13041
|
+
3,
|
|
13042
|
+
2,
|
|
13043
|
+
0
|
|
13044
|
+
]) : new index.constructor(idxCount);
|
|
13045
|
+
if (!this.wireframe) {
|
|
13046
|
+
for(let i = 0; i < idxCount; i++){
|
|
13047
|
+
indexData[i] = pointStartIndex + index[i];
|
|
12938
13048
|
}
|
|
12939
13049
|
}
|
|
12940
|
-
|
|
13050
|
+
return {
|
|
13051
|
+
atlasOffset: geoData.atlasOffset,
|
|
13052
|
+
index: indexData
|
|
13053
|
+
};
|
|
12941
13054
|
}
|
|
12942
|
-
|
|
12943
|
-
|
|
12944
|
-
|
|
12945
|
-
|
|
13055
|
+
setItem() {
|
|
13056
|
+
const textures = [];
|
|
13057
|
+
let texture = this.renderer.texture;
|
|
13058
|
+
if (texture) {
|
|
13059
|
+
addItem(textures, texture);
|
|
12946
13060
|
}
|
|
12947
|
-
|
|
12948
|
-
|
|
12949
|
-
|
|
12950
|
-
|
|
12951
|
-
|
|
12952
|
-
|
|
12953
|
-
|
|
13061
|
+
texture = this.renderer.texture;
|
|
13062
|
+
const textureIndex = texture ? textures.indexOf(texture) : -1;
|
|
13063
|
+
const data = this.getItemInitData(this, 0, 0, textureIndex);
|
|
13064
|
+
const renderer = this.renderer;
|
|
13065
|
+
const texParams = this.material.getVector4('_TexParams');
|
|
13066
|
+
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
13067
|
+
texParams.y = +this.preMultiAlpha;
|
|
13068
|
+
texParams.z = renderer.renderMode;
|
|
13069
|
+
const attributes = {
|
|
13070
|
+
atlasOffset: new Float32Array(data.atlasOffset.length),
|
|
13071
|
+
index: new Uint16Array(data.index.length)
|
|
13072
|
+
};
|
|
13073
|
+
attributes.atlasOffset.set(data.atlasOffset);
|
|
13074
|
+
attributes.index.set(data.index);
|
|
13075
|
+
const { material, geometry } = this;
|
|
13076
|
+
const indexData = attributes.index;
|
|
13077
|
+
geometry.setIndexData(indexData);
|
|
13078
|
+
geometry.setAttributeData('atlasOffset', attributes.atlasOffset);
|
|
13079
|
+
geometry.setDrawCount(data.index.length);
|
|
13080
|
+
for(let i = 0; i < textures.length; i++){
|
|
13081
|
+
const texture = textures[i];
|
|
13082
|
+
material.setTexture('uSampler' + i, texture);
|
|
12954
13083
|
}
|
|
12955
|
-
|
|
12956
|
-
|
|
12957
|
-
|
|
12958
|
-
|
|
12959
|
-
for (const track of this.tracks){
|
|
12960
|
-
for (const clip of track.getClips()){
|
|
12961
|
-
clip.playable.onPlayablePlay();
|
|
12962
|
-
}
|
|
12963
|
-
}
|
|
13084
|
+
// FIXME: 内存泄漏的临时方案,后面再调整
|
|
13085
|
+
const emptyTexture = this.emptyTexture;
|
|
13086
|
+
for(let k = textures.length; k < maxSpriteMeshItemCount; k++){
|
|
13087
|
+
material.setTexture('uSampler' + k, emptyTexture);
|
|
12964
13088
|
}
|
|
12965
|
-
|
|
12966
|
-
|
|
12967
|
-
|
|
12968
|
-
|
|
12969
|
-
|
|
12970
|
-
|
|
12971
|
-
|
|
12972
|
-
|
|
12973
|
-
|
|
12974
|
-
|
|
12975
|
-
|
|
12976
|
-
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
|
|
12980
|
-
|
|
12981
|
-
|
|
12982
|
-
|
|
12983
|
-
|
|
12984
|
-
|
|
12985
|
-
|
|
12986
|
-
|
|
12987
|
-
|
|
13089
|
+
}
|
|
13090
|
+
createGeometry(mode) {
|
|
13091
|
+
const maxVertex = 12 * this.splits.length;
|
|
13092
|
+
return Geometry.create(this.engine, {
|
|
13093
|
+
attributes: {
|
|
13094
|
+
aPos: {
|
|
13095
|
+
type: glContext.FLOAT,
|
|
13096
|
+
size: 3,
|
|
13097
|
+
data: new Float32Array([
|
|
13098
|
+
-0.5,
|
|
13099
|
+
0.5,
|
|
13100
|
+
0,
|
|
13101
|
+
-0.5,
|
|
13102
|
+
-0.5,
|
|
13103
|
+
0,
|
|
13104
|
+
0.5,
|
|
13105
|
+
0.5,
|
|
13106
|
+
0,
|
|
13107
|
+
0.5,
|
|
13108
|
+
-0.5,
|
|
13109
|
+
0
|
|
13110
|
+
])
|
|
13111
|
+
},
|
|
13112
|
+
atlasOffset: {
|
|
13113
|
+
size: 2,
|
|
13114
|
+
offset: 0,
|
|
13115
|
+
releasable: true,
|
|
13116
|
+
type: glContext.FLOAT,
|
|
13117
|
+
data: new Float32Array(0)
|
|
12988
13118
|
}
|
|
12989
|
-
}
|
|
13119
|
+
},
|
|
13120
|
+
indices: {
|
|
13121
|
+
data: new Uint16Array(0),
|
|
13122
|
+
releasable: true
|
|
13123
|
+
},
|
|
13124
|
+
mode,
|
|
13125
|
+
maxVertex
|
|
13126
|
+
});
|
|
13127
|
+
}
|
|
13128
|
+
createMaterial(renderInfo, count) {
|
|
13129
|
+
const { side, occlusion, blending, maskMode, mask } = renderInfo;
|
|
13130
|
+
const materialProps = {
|
|
13131
|
+
shader: spriteMeshShaderFromRenderInfo(renderInfo, count, 1)
|
|
13132
|
+
};
|
|
13133
|
+
this.preMultiAlpha = getPreMultiAlpha(blending);
|
|
13134
|
+
const material = Material.create(this.engine, materialProps);
|
|
13135
|
+
const states = {
|
|
13136
|
+
side,
|
|
13137
|
+
blending: true,
|
|
13138
|
+
blendMode: blending,
|
|
13139
|
+
mask,
|
|
13140
|
+
maskMode,
|
|
13141
|
+
depthTest: true,
|
|
13142
|
+
depthMask: occlusion
|
|
13143
|
+
};
|
|
13144
|
+
material.blending = states.blending;
|
|
13145
|
+
material.stencilRef = states.mask !== undefined ? [
|
|
13146
|
+
states.mask,
|
|
13147
|
+
states.mask
|
|
13148
|
+
] : undefined;
|
|
13149
|
+
material.depthTest = states.depthTest;
|
|
13150
|
+
material.depthMask = states.depthMask;
|
|
13151
|
+
setBlendMode(material, states.blendMode);
|
|
13152
|
+
setMaskMode(material, states.maskMode);
|
|
13153
|
+
setSideMode(material, states.side);
|
|
13154
|
+
if (!material.hasUniform('_Color')) {
|
|
13155
|
+
material.setVector4('_Color', new Vector4(0, 0, 0, 1));
|
|
12990
13156
|
}
|
|
12991
|
-
|
|
12992
|
-
|
|
12993
|
-
if (!this.item.delaying) {
|
|
12994
|
-
const lifetime = this.time / this.item.duration;
|
|
12995
|
-
this.item.lifetime = lifetime;
|
|
12996
|
-
for (const track of this.tracks){
|
|
12997
|
-
for (const clip of track.getClips()){
|
|
12998
|
-
clip.playable.setTime(this.time);
|
|
12999
|
-
}
|
|
13000
|
-
}
|
|
13001
|
-
this.playableGraph.evaluate(dt);
|
|
13157
|
+
if (!material.hasUniform('_TexOffset')) {
|
|
13158
|
+
material.setVector4('_TexOffset', new Vector4());
|
|
13002
13159
|
}
|
|
13160
|
+
if (!material.hasUniform('_TexParams')) {
|
|
13161
|
+
material.setVector4('_TexParams', new Vector4());
|
|
13162
|
+
}
|
|
13163
|
+
return material;
|
|
13003
13164
|
}
|
|
13004
|
-
|
|
13005
|
-
|
|
13006
|
-
|
|
13007
|
-
|
|
13008
|
-
|
|
13009
|
-
|
|
13010
|
-
|
|
13011
|
-
|
|
13012
|
-
|
|
13013
|
-
|
|
13014
|
-
|
|
13015
|
-
|
|
13016
|
-
|
|
13017
|
-
} else if (this.options.endBehavior === END_BEHAVIOR_FREEZE) {
|
|
13018
|
-
localTime = Math.min(duration, localTime);
|
|
13165
|
+
getItemGeometryData(item, aIndex) {
|
|
13166
|
+
const { splits, renderer, textureSheetAnimation } = item;
|
|
13167
|
+
const sx = 1, sy = 1;
|
|
13168
|
+
if (renderer.shape) {
|
|
13169
|
+
const { index, aPoint } = renderer.shape;
|
|
13170
|
+
const point = new Float32Array(aPoint);
|
|
13171
|
+
const position = [];
|
|
13172
|
+
const atlasOffset = [];
|
|
13173
|
+
for(let i = 0; i < point.length; i += 6){
|
|
13174
|
+
point[i] *= sx;
|
|
13175
|
+
point[i + 1] *= sy;
|
|
13176
|
+
atlasOffset.push(aPoint[i + 2], aPoint[i + 3]);
|
|
13177
|
+
position.push(point[i], point[i + 1], 0.0);
|
|
13019
13178
|
}
|
|
13179
|
+
this.geometry.setAttributeData('aPos', new Float32Array(position));
|
|
13180
|
+
return {
|
|
13181
|
+
index,
|
|
13182
|
+
atlasOffset
|
|
13183
|
+
};
|
|
13020
13184
|
}
|
|
13021
|
-
|
|
13022
|
-
|
|
13023
|
-
|
|
13024
|
-
|
|
13025
|
-
|
|
13026
|
-
|
|
13027
|
-
|
|
13028
|
-
|
|
13029
|
-
|
|
13030
|
-
|
|
13031
|
-
|
|
13032
|
-
|
|
13033
|
-
|
|
13034
|
-
|
|
13035
|
-
|
|
13036
|
-
|
|
13037
|
-
|
|
13185
|
+
const originData = [
|
|
13186
|
+
-.5,
|
|
13187
|
+
.5,
|
|
13188
|
+
-.5,
|
|
13189
|
+
-.5,
|
|
13190
|
+
.5,
|
|
13191
|
+
.5,
|
|
13192
|
+
.5,
|
|
13193
|
+
-.5
|
|
13194
|
+
];
|
|
13195
|
+
const atlasOffset = [];
|
|
13196
|
+
const index = [];
|
|
13197
|
+
let col = 2;
|
|
13198
|
+
let row = 2;
|
|
13199
|
+
if (splits.length === 1) {
|
|
13200
|
+
col = 1;
|
|
13201
|
+
row = 1;
|
|
13202
|
+
}
|
|
13203
|
+
const position = [];
|
|
13204
|
+
for(let x = 0; x < col; x++){
|
|
13205
|
+
for(let y = 0; y < row; y++){
|
|
13206
|
+
const base = (y * 2 + x) * 4;
|
|
13207
|
+
// @ts-expect-error
|
|
13208
|
+
const split = textureSheetAnimation ? [
|
|
13209
|
+
0,
|
|
13210
|
+
0,
|
|
13211
|
+
1,
|
|
13212
|
+
1,
|
|
13213
|
+
splits[0][4]
|
|
13214
|
+
] : splits[y * 2 + x];
|
|
13215
|
+
const texOffset = split[4] ? [
|
|
13216
|
+
0,
|
|
13217
|
+
0,
|
|
13218
|
+
1,
|
|
13219
|
+
0,
|
|
13220
|
+
0,
|
|
13221
|
+
1,
|
|
13222
|
+
1,
|
|
13223
|
+
1
|
|
13224
|
+
] : [
|
|
13225
|
+
0,
|
|
13226
|
+
1,
|
|
13227
|
+
0,
|
|
13228
|
+
0,
|
|
13229
|
+
1,
|
|
13230
|
+
1,
|
|
13231
|
+
1,
|
|
13232
|
+
0
|
|
13233
|
+
];
|
|
13234
|
+
const dw = ((x + x + 1) / col - 1) / 2;
|
|
13235
|
+
const dh = ((y + y + 1) / row - 1) / 2;
|
|
13236
|
+
const tox = split[0];
|
|
13237
|
+
const toy = split[1];
|
|
13238
|
+
const tsx = split[4] ? split[3] : split[2];
|
|
13239
|
+
const tsy = split[4] ? split[2] : split[3];
|
|
13240
|
+
const origin = [
|
|
13241
|
+
originData[0] / col + dw,
|
|
13242
|
+
originData[1] / row + dh,
|
|
13243
|
+
originData[2] / col + dw,
|
|
13244
|
+
originData[3] / row + dh,
|
|
13245
|
+
originData[4] / col + dw,
|
|
13246
|
+
originData[5] / row + dh,
|
|
13247
|
+
originData[6] / col + dw,
|
|
13248
|
+
originData[7] / row + dh
|
|
13249
|
+
];
|
|
13250
|
+
atlasOffset.push(texOffset[0] * tsx + tox, texOffset[1] * tsy + toy, texOffset[2] * tsx + tox, texOffset[3] * tsy + toy, texOffset[4] * tsx + tox, texOffset[5] * tsy + toy, texOffset[6] * tsx + tox, texOffset[7] * tsy + toy);
|
|
13251
|
+
position.push(origin[0] * sx, origin[1] * sy, 0.0, origin[2] * sx, origin[3] * sy, 0.0, origin[4] * sx, origin[5] * sy, 0.0, origin[6] * sx, origin[7] * sy, 0.0);
|
|
13252
|
+
index.push(base, 1 + base, 2 + base, 2 + base, 1 + base, 3 + base);
|
|
13038
13253
|
}
|
|
13039
13254
|
}
|
|
13255
|
+
this.geometry.setAttributeData('aPos', new Float32Array(position));
|
|
13256
|
+
return {
|
|
13257
|
+
index,
|
|
13258
|
+
atlasOffset
|
|
13259
|
+
};
|
|
13040
13260
|
}
|
|
13041
|
-
|
|
13042
|
-
|
|
13043
|
-
this.
|
|
13044
|
-
|
|
13045
|
-
|
|
13046
|
-
for (const track of this.tracks){
|
|
13047
|
-
const trackMixPlayable = track.createPlayable();
|
|
13048
|
-
const trackOutput = track.createOutput();
|
|
13049
|
-
graph.addOutput(trackOutput);
|
|
13050
|
-
trackOutput.setSourcePlayeble(trackMixPlayable);
|
|
13261
|
+
getTextures() {
|
|
13262
|
+
const ret = [];
|
|
13263
|
+
const tex = this.renderer.texture;
|
|
13264
|
+
if (tex) {
|
|
13265
|
+
ret.push(tex);
|
|
13051
13266
|
}
|
|
13267
|
+
return ret;
|
|
13052
13268
|
}
|
|
13053
|
-
|
|
13054
|
-
|
|
13055
|
-
|
|
13056
|
-
|
|
13057
|
-
|
|
13058
|
-
|
|
13059
|
-
endBehavior: this.item.endBehavior || ItemEndBehavior.destroy
|
|
13060
|
-
};
|
|
13061
|
-
this.id = this.item.id;
|
|
13062
|
-
this.name = this.item.name;
|
|
13063
|
-
const activationTrack = this.createTrack(Track, 'ActivationTrack');
|
|
13064
|
-
activationTrack.createClip(ActivationPlayable, 'ActivationTimelineClip');
|
|
13065
|
-
//@ts-expect-error
|
|
13066
|
-
if (data.tracks) {
|
|
13067
|
-
//@ts-expect-error
|
|
13068
|
-
const tracks = data.tracks;
|
|
13069
|
-
for (const track of tracks){
|
|
13070
|
-
const newTrack = this.createTrack(Track);
|
|
13071
|
-
for (const clipAsset of track.clips){
|
|
13072
|
-
switch(clipAsset.dataType){
|
|
13073
|
-
case 'TransformAnimationPlayableAsset':
|
|
13074
|
-
newTrack.name = 'AnimationTrack';
|
|
13075
|
-
newTrack.createClip(TransformAnimationPlayable, 'AnimationTimelineClip').playable.fromData(clipAsset.animationClip);
|
|
13076
|
-
break;
|
|
13077
|
-
case 'SpriteColorAnimationPlayableAsset':
|
|
13078
|
-
newTrack.name = 'SpriteColorTrack';
|
|
13079
|
-
newTrack.createClip(SpriteColorPlayable, 'SpriteColorClip').playable.fromData(clipAsset.animationClip);
|
|
13080
|
-
break;
|
|
13081
|
-
}
|
|
13082
|
-
}
|
|
13083
|
-
}
|
|
13084
|
-
}
|
|
13085
|
-
}
|
|
13086
|
-
toData() {
|
|
13087
|
-
super.toData();
|
|
13088
|
-
}
|
|
13089
|
-
constructor(engine){
|
|
13090
|
-
super(engine);
|
|
13091
|
-
this.reusable = false;
|
|
13092
|
-
this.timelineStarted = false;
|
|
13093
|
-
this.playableGraph = new PlayableGraph();
|
|
13094
|
-
/**
|
|
13095
|
-
* 元素动画已经播放的时间
|
|
13096
|
-
*/ this.time = 0;
|
|
13097
|
-
this.tracks = [];
|
|
13098
|
-
this.trackSeed = 0;
|
|
13099
|
-
}
|
|
13100
|
-
}
|
|
13101
|
-
__decorate([
|
|
13102
|
-
serialize()
|
|
13103
|
-
], TimelineComponent.prototype, "time", void 0);
|
|
13104
|
-
|
|
13105
|
-
const singleSplits = [
|
|
13106
|
-
[
|
|
13107
|
-
0,
|
|
13108
|
-
0,
|
|
13109
|
-
1,
|
|
13110
|
-
1,
|
|
13111
|
-
undefined
|
|
13112
|
-
]
|
|
13113
|
-
];
|
|
13114
|
-
const tempColor = [
|
|
13115
|
-
1,
|
|
13116
|
-
1,
|
|
13117
|
-
1,
|
|
13118
|
-
1
|
|
13119
|
-
];
|
|
13120
|
-
let seed$2 = 0;
|
|
13121
|
-
class SpriteColorPlayable extends Playable {
|
|
13122
|
-
onPlayablePlay() {
|
|
13123
|
-
this.spriteMaterial = this.bindingItem.getComponent(SpriteComponent).material;
|
|
13124
|
-
}
|
|
13125
|
-
processFrame(dt) {
|
|
13126
|
-
let colorInc = vecFill(tempColor, 1);
|
|
13127
|
-
let colorChanged;
|
|
13128
|
-
const life = this.time / this.bindingItem.duration;
|
|
13129
|
-
const opacityOverLifetime = this.opacityOverLifetime;
|
|
13130
|
-
const colorOverLifetime = this.colorOverLifetime;
|
|
13131
|
-
if (colorOverLifetime) {
|
|
13132
|
-
colorInc = getColorFromGradientStops(colorOverLifetime, life, true);
|
|
13133
|
-
colorChanged = true;
|
|
13134
|
-
}
|
|
13135
|
-
if (opacityOverLifetime) {
|
|
13136
|
-
colorInc[3] *= opacityOverLifetime.getValue(life);
|
|
13137
|
-
colorChanged = true;
|
|
13138
|
-
}
|
|
13139
|
-
if (colorChanged) {
|
|
13140
|
-
vecMulCombine(this.renderColor, colorInc, this.startColor);
|
|
13141
|
-
this.spriteMaterial.getVector4('_Color').setFromArray(this.renderColor);
|
|
13269
|
+
/**
|
|
13270
|
+
* 获取图层包围盒的类型和世界坐标
|
|
13271
|
+
* @returns
|
|
13272
|
+
*/ getBoundingBox() {
|
|
13273
|
+
if (!this.item) {
|
|
13274
|
+
return;
|
|
13142
13275
|
}
|
|
13276
|
+
const worldMatrix = this.transform.getWorldMatrix();
|
|
13277
|
+
const triangles = trianglesFromRect(Vector3.ZERO, 0.5 * this.transform.size.x, 0.5 * this.transform.size.y);
|
|
13278
|
+
triangles.forEach((triangle)=>{
|
|
13279
|
+
worldMatrix.transformPoint(triangle.p0);
|
|
13280
|
+
worldMatrix.transformPoint(triangle.p1);
|
|
13281
|
+
worldMatrix.transformPoint(triangle.p2);
|
|
13282
|
+
});
|
|
13283
|
+
return {
|
|
13284
|
+
type: HitTestType.triangle,
|
|
13285
|
+
area: triangles
|
|
13286
|
+
};
|
|
13143
13287
|
}
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
}
|
|
13288
|
+
// TODO: [1.31] @十弦 https://github.com/galacean/effects-runtime/commit/fe8736540b9a461d8e96658f4d755ff8089a263b#diff-a3618f4527c5fe6e842f20d67d5c82984568502c6bf6fdfcbd24f69e2894ca90
|
|
13289
|
+
fromData(data) {
|
|
13290
|
+
super.fromData(data);
|
|
13291
|
+
const { interaction, options, listIndex = 0 } = data;
|
|
13292
|
+
let renderer = data.renderer;
|
|
13293
|
+
if (!renderer) {
|
|
13294
|
+
//@ts-expect-error
|
|
13295
|
+
renderer = {};
|
|
13153
13296
|
}
|
|
13154
|
-
this.
|
|
13297
|
+
this.interaction = interaction;
|
|
13298
|
+
var _renderer_renderMode, _renderer_blending, _renderer_texture, _renderer_side, _renderer_mask, _renderer_maskMode;
|
|
13299
|
+
this.renderer = {
|
|
13300
|
+
renderMode: (_renderer_renderMode = renderer.renderMode) != null ? _renderer_renderMode : RenderMode.BILLBOARD,
|
|
13301
|
+
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
13302
|
+
texture: (_renderer_texture = renderer.texture) != null ? _renderer_texture : this.engine.emptyTexture,
|
|
13303
|
+
occlusion: !!renderer.occlusion,
|
|
13304
|
+
transparentOcclusion: !!renderer.transparentOcclusion || renderer.maskMode === MaskMode.MASK,
|
|
13305
|
+
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
13306
|
+
shape: renderer.shape,
|
|
13307
|
+
mask: (_renderer_mask = renderer.mask) != null ? _renderer_mask : 0,
|
|
13308
|
+
maskMode: (_renderer_maskMode = renderer.maskMode) != null ? _renderer_maskMode : MaskMode.NONE,
|
|
13309
|
+
order: listIndex
|
|
13310
|
+
};
|
|
13311
|
+
this.emptyTexture = this.engine.emptyTexture;
|
|
13312
|
+
this.splits = data.splits || singleSplits;
|
|
13313
|
+
this.textureSheetAnimation = data.textureSheetAnimation;
|
|
13314
|
+
this.cachePrefix = '-';
|
|
13315
|
+
this.renderInfo = getImageItemRenderInfo(this);
|
|
13316
|
+
const geometry = this.createGeometry(glContext.TRIANGLES);
|
|
13317
|
+
const material = this.createMaterial(this.renderInfo, 2);
|
|
13318
|
+
this.worldMatrix = Matrix4.fromIdentity();
|
|
13319
|
+
this.material = material;
|
|
13320
|
+
this.geometry = geometry;
|
|
13321
|
+
this.name = 'MSprite' + seed$2++;
|
|
13322
|
+
const startColor = options.startColor || [
|
|
13155
13323
|
1,
|
|
13156
13324
|
1,
|
|
13157
13325
|
1,
|
|
13158
13326
|
1
|
|
13159
13327
|
];
|
|
13160
|
-
|
|
13328
|
+
this.material.setVector4('_Color', new Vector4().setFromArray(startColor));
|
|
13329
|
+
this.material.setVector4('_TexOffset', new Vector4().setFromArray([
|
|
13330
|
+
0,
|
|
13331
|
+
0,
|
|
13332
|
+
1,
|
|
13333
|
+
1
|
|
13334
|
+
]));
|
|
13335
|
+
this.setItem();
|
|
13161
13336
|
}
|
|
13162
|
-
|
|
13163
|
-
super(
|
|
13164
|
-
|
|
13337
|
+
toData() {
|
|
13338
|
+
super.toData();
|
|
13339
|
+
}
|
|
13340
|
+
constructor(engine, props){
|
|
13341
|
+
super(engine);
|
|
13342
|
+
this.frameAnimationTime = 0;
|
|
13343
|
+
this.color = [
|
|
13165
13344
|
1,
|
|
13166
13345
|
1,
|
|
13167
13346
|
1,
|
|
13168
13347
|
1
|
|
13169
13348
|
];
|
|
13349
|
+
this.visible = true;
|
|
13350
|
+
this.getHitTestParams = (force)=>{
|
|
13351
|
+
const ui = this.interaction;
|
|
13352
|
+
if (force || ui) {
|
|
13353
|
+
const area = this.getBoundingBox();
|
|
13354
|
+
if (area) {
|
|
13355
|
+
var _this_interaction;
|
|
13356
|
+
return {
|
|
13357
|
+
behavior: ((_this_interaction = this.interaction) == null ? void 0 : _this_interaction.behavior) || 0,
|
|
13358
|
+
type: area.type,
|
|
13359
|
+
triangles: area.area,
|
|
13360
|
+
backfaceCulling: this.renderer.side === SideMode.FRONT
|
|
13361
|
+
};
|
|
13362
|
+
}
|
|
13363
|
+
}
|
|
13364
|
+
};
|
|
13365
|
+
if (props) {
|
|
13366
|
+
this.fromData(props);
|
|
13367
|
+
}
|
|
13170
13368
|
}
|
|
13171
13369
|
}
|
|
13172
|
-
|
|
13173
|
-
|
|
13174
|
-
|
|
13175
|
-
|
|
13176
|
-
|
|
13177
|
-
|
|
13178
|
-
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
-
|
|
13182
|
-
|
|
13370
|
+
SpriteComponent = __decorate([
|
|
13371
|
+
effectsClass(DataType.SpriteComponent)
|
|
13372
|
+
], SpriteComponent);
|
|
13373
|
+
|
|
13374
|
+
const RUNTIME_ENV = 'runtime_env';
|
|
13375
|
+
const RENDER_PREFER_LOOKUP_TEXTURE = 'lookup_texture';
|
|
13376
|
+
// 文本元素使用 offscreen canvas 绘制
|
|
13377
|
+
const TEMPLATE_USE_OFFSCREEN_CANVAS = 'offscreen_canvas';
|
|
13378
|
+
// 后处理配置相关
|
|
13379
|
+
const POST_PROCESS_SETTINGS = 'post_process_settings';
|
|
13380
|
+
const config = {};
|
|
13381
|
+
function getConfig(name) {
|
|
13382
|
+
return config[name];
|
|
13383
|
+
}
|
|
13384
|
+
function setConfig(name, value) {
|
|
13385
|
+
return config[name] = value;
|
|
13386
|
+
}
|
|
13387
|
+
|
|
13388
|
+
class Cone {
|
|
13389
|
+
generate(opt) {
|
|
13390
|
+
const arc = getArcAngle(this.arc, this.arcMode, opt);
|
|
13391
|
+
const a = arc * DEG2RAD;
|
|
13392
|
+
const x = Math.cos(a) * this.radius;
|
|
13393
|
+
const y = Math.sin(a) * this.radius;
|
|
13394
|
+
const position = new Vector3(x, y, 0);
|
|
13395
|
+
const l = Math.tan(this.angle * DEG2RAD);
|
|
13396
|
+
const dir = position.clone().multiply(l);
|
|
13397
|
+
// dir + [0,0,1]
|
|
13398
|
+
dir.z += 1;
|
|
13399
|
+
return {
|
|
13400
|
+
position: position.multiply(random(0, 1)),
|
|
13401
|
+
direction: dir.normalize()
|
|
13402
|
+
};
|
|
13183
13403
|
}
|
|
13184
|
-
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
* @param color - 颜色值
|
|
13189
|
-
*/ setColor(color) {
|
|
13190
|
-
this.color = color;
|
|
13191
|
-
this.material.setVector4('_Color', new Vector4().setFromArray(color));
|
|
13404
|
+
constructor(props){
|
|
13405
|
+
Object.keys(props).forEach((key)=>{
|
|
13406
|
+
this[key] = props[key];
|
|
13407
|
+
});
|
|
13192
13408
|
}
|
|
13193
|
-
|
|
13194
|
-
|
|
13195
|
-
|
|
13196
|
-
|
|
13197
|
-
|
|
13198
|
-
|
|
13199
|
-
|
|
13409
|
+
}
|
|
13410
|
+
function getArcAngle(arc, arcMode, opt) {
|
|
13411
|
+
if (arcMode === ShapeArcMode.RANDOM) {
|
|
13412
|
+
arc = random(0, arc);
|
|
13413
|
+
} else if (arcMode === ShapeArcMode.UNIDIRECTIONAL_CYCLE) {
|
|
13414
|
+
const d = opt.index % (opt.total + 1);
|
|
13415
|
+
arc = arc / opt.total * d;
|
|
13416
|
+
} else if (arcMode === ShapeArcMode.BIDIRECTIONAL_CYCLE) {
|
|
13417
|
+
const d = opt.index / (opt.total + 1);
|
|
13418
|
+
const i = d - Math.floor(d);
|
|
13419
|
+
arc = arc * (Math.floor(d) % 2 ? 1 - i : i);
|
|
13420
|
+
} else if (arcMode === ShapeArcMode.UNIFORM_BURST) {
|
|
13421
|
+
arc = arc * opt.burstIndex / opt.burstCount;
|
|
13200
13422
|
}
|
|
13201
|
-
|
|
13202
|
-
|
|
13203
|
-
|
|
13204
|
-
|
|
13205
|
-
|
|
13206
|
-
const
|
|
13207
|
-
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
|
|
13211
|
-
|
|
13423
|
+
return arc;
|
|
13424
|
+
}
|
|
13425
|
+
|
|
13426
|
+
class Circle {
|
|
13427
|
+
generate(opt) {
|
|
13428
|
+
const arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
13429
|
+
const direction = new Vector3(Math.cos(arc), Math.sin(arc), 0);
|
|
13430
|
+
const radius = this.radius;
|
|
13431
|
+
return {
|
|
13432
|
+
direction,
|
|
13433
|
+
position: direction.clone().multiply(radius)
|
|
13434
|
+
};
|
|
13212
13435
|
}
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13216
|
-
|
|
13436
|
+
constructor(props){
|
|
13437
|
+
Object.keys(props).forEach((key)=>{
|
|
13438
|
+
this[key] = props[key];
|
|
13439
|
+
});
|
|
13217
13440
|
}
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
|
|
13221
|
-
const
|
|
13222
|
-
const
|
|
13223
|
-
|
|
13224
|
-
|
|
13225
|
-
|
|
13226
|
-
|
|
13227
|
-
let texRectW = 1;
|
|
13228
|
-
let texRectH = 1;
|
|
13229
|
-
let flip;
|
|
13230
|
-
if (this.splits) {
|
|
13231
|
-
const sp = this.splits[0];
|
|
13232
|
-
flip = sp[4];
|
|
13233
|
-
texRectX = sp[0];
|
|
13234
|
-
texRectY = sp[1];
|
|
13235
|
-
if (flip) {
|
|
13236
|
-
texRectW = sp[3];
|
|
13237
|
-
texRectH = sp[2];
|
|
13238
|
-
} else {
|
|
13239
|
-
texRectW = sp[2];
|
|
13240
|
-
texRectH = sp[3];
|
|
13241
|
-
}
|
|
13242
|
-
}
|
|
13243
|
-
let dx, dy;
|
|
13244
|
-
if (flip) {
|
|
13245
|
-
dx = 1 / ta.row * texRectW;
|
|
13246
|
-
dy = 1 / ta.col * texRectH;
|
|
13247
|
-
} else {
|
|
13248
|
-
dx = 1 / ta.col * texRectW;
|
|
13249
|
-
dy = 1 / ta.row * texRectH;
|
|
13250
|
-
}
|
|
13251
|
-
let texOffset;
|
|
13252
|
-
if (ta.animate) {
|
|
13253
|
-
const frameIndex = Math.round(life * (total - 1));
|
|
13254
|
-
const yIndex = Math.floor(frameIndex / ta.col);
|
|
13255
|
-
const xIndex = frameIndex - yIndex * ta.col;
|
|
13256
|
-
texOffset = flip ? [
|
|
13257
|
-
dx * yIndex,
|
|
13258
|
-
dy * (ta.col - xIndex)
|
|
13259
|
-
] : [
|
|
13260
|
-
dx * xIndex,
|
|
13261
|
-
dy * (1 + yIndex)
|
|
13262
|
-
];
|
|
13263
|
-
} else {
|
|
13264
|
-
texOffset = [
|
|
13265
|
-
0,
|
|
13266
|
-
dy
|
|
13267
|
-
];
|
|
13268
|
-
}
|
|
13269
|
-
this.material.getVector4('_TexOffset').setFromArray([
|
|
13270
|
-
texRectX + texOffset[0],
|
|
13271
|
-
texRectH + texRectY - texOffset[1],
|
|
13272
|
-
dx,
|
|
13273
|
-
dy
|
|
13274
|
-
]);
|
|
13275
|
-
}
|
|
13441
|
+
}
|
|
13442
|
+
class Rectangle {
|
|
13443
|
+
generate(opt) {
|
|
13444
|
+
const x = random(-this._d, this._d);
|
|
13445
|
+
const y = random(-this._h, this._h);
|
|
13446
|
+
return {
|
|
13447
|
+
direction: new Vector3(0, 0, 1),
|
|
13448
|
+
position: new Vector3(x, y, 0)
|
|
13449
|
+
};
|
|
13276
13450
|
}
|
|
13277
|
-
|
|
13278
|
-
|
|
13279
|
-
|
|
13280
|
-
}
|
|
13451
|
+
constructor(arg){
|
|
13452
|
+
this._d = (arg.width || 1) / 2;
|
|
13453
|
+
this._h = (arg.height || 1) / 2;
|
|
13281
13454
|
}
|
|
13282
|
-
|
|
13283
|
-
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
const
|
|
13288
|
-
const
|
|
13289
|
-
|
|
13290
|
-
const
|
|
13291
|
-
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
|
|
13295
|
-
|
|
13296
|
-
|
|
13297
|
-
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
indexData[i] = pointStartIndex + index[i];
|
|
13303
|
-
}
|
|
13455
|
+
}
|
|
13456
|
+
class RectangleEdge {
|
|
13457
|
+
generate(opt) {
|
|
13458
|
+
const arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
13459
|
+
const direction = new Vector3(Math.cos(arc), Math.sin(arc), 0);
|
|
13460
|
+
const w = this._d;
|
|
13461
|
+
const h = this._h;
|
|
13462
|
+
const r0 = Math.atan2(h, w);
|
|
13463
|
+
const tan = Math.tan(arc);
|
|
13464
|
+
const position = new Vector3();
|
|
13465
|
+
if (arc < r0) {
|
|
13466
|
+
position.set(w, w * tan, 0);
|
|
13467
|
+
} else if (arc >= r0 && arc < Math.PI - r0) {
|
|
13468
|
+
position.set(h / tan, h, 0);
|
|
13469
|
+
} else if (arc < Math.PI + r0) {
|
|
13470
|
+
position.set(-w, -w * tan, 0);
|
|
13471
|
+
} else if (arc < Math.PI * 2 - r0) {
|
|
13472
|
+
position.set(-h / tan, -h, 0);
|
|
13473
|
+
} else {
|
|
13474
|
+
position.set(w, w * tan, 0);
|
|
13304
13475
|
}
|
|
13305
13476
|
return {
|
|
13306
|
-
|
|
13307
|
-
|
|
13477
|
+
direction,
|
|
13478
|
+
position
|
|
13308
13479
|
};
|
|
13309
13480
|
}
|
|
13310
|
-
|
|
13311
|
-
|
|
13312
|
-
|
|
13313
|
-
|
|
13314
|
-
|
|
13315
|
-
|
|
13316
|
-
|
|
13317
|
-
|
|
13318
|
-
|
|
13319
|
-
const
|
|
13320
|
-
|
|
13321
|
-
|
|
13322
|
-
|
|
13323
|
-
texParams.z = renderer.renderMode;
|
|
13324
|
-
const attributes = {
|
|
13325
|
-
atlasOffset: new Float32Array(data.atlasOffset.length),
|
|
13326
|
-
index: new Uint16Array(data.index.length)
|
|
13481
|
+
constructor(arg){
|
|
13482
|
+
this._d = (arg.width || 1) / 2;
|
|
13483
|
+
this._h = (arg.height || 1) / 2;
|
|
13484
|
+
this.arcMode = arg.arcMode;
|
|
13485
|
+
this.arc = arg.arc;
|
|
13486
|
+
}
|
|
13487
|
+
}
|
|
13488
|
+
class Edge {
|
|
13489
|
+
generate(options) {
|
|
13490
|
+
const x = this.arcMode === ShapeArcMode.UNIFORM_BURST ? options.burstIndex % options.burstCount / (options.burstCount - 1) : random(0, 1);
|
|
13491
|
+
return {
|
|
13492
|
+
direction: new Vector3(0, 1, 0),
|
|
13493
|
+
position: new Vector3(this._d * (x - 0.5), 0, 0)
|
|
13327
13494
|
};
|
|
13328
|
-
attributes.atlasOffset.set(data.atlasOffset);
|
|
13329
|
-
attributes.index.set(data.index);
|
|
13330
|
-
const { material, geometry } = this;
|
|
13331
|
-
const indexData = attributes.index;
|
|
13332
|
-
geometry.setIndexData(indexData);
|
|
13333
|
-
geometry.setAttributeData('atlasOffset', attributes.atlasOffset);
|
|
13334
|
-
geometry.setDrawCount(data.index.length);
|
|
13335
|
-
for(let i = 0; i < textures.length; i++){
|
|
13336
|
-
const texture = textures[i];
|
|
13337
|
-
material.setTexture('uSampler' + i, texture);
|
|
13338
|
-
}
|
|
13339
|
-
// FIXME: 内存泄漏的临时方案,后面再调整
|
|
13340
|
-
const emptyTexture = this.emptyTexture;
|
|
13341
|
-
for(let k = textures.length; k < maxSpriteMeshItemCount; k++){
|
|
13342
|
-
material.setTexture('uSampler' + k, emptyTexture);
|
|
13343
|
-
}
|
|
13344
13495
|
}
|
|
13345
|
-
|
|
13346
|
-
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
aPos: {
|
|
13350
|
-
type: glContext.FLOAT,
|
|
13351
|
-
size: 3,
|
|
13352
|
-
data: new Float32Array([
|
|
13353
|
-
-0.5,
|
|
13354
|
-
0.5,
|
|
13355
|
-
0,
|
|
13356
|
-
-0.5,
|
|
13357
|
-
-0.5,
|
|
13358
|
-
0,
|
|
13359
|
-
0.5,
|
|
13360
|
-
0.5,
|
|
13361
|
-
0,
|
|
13362
|
-
0.5,
|
|
13363
|
-
-0.5,
|
|
13364
|
-
0
|
|
13365
|
-
])
|
|
13366
|
-
},
|
|
13367
|
-
atlasOffset: {
|
|
13368
|
-
size: 2,
|
|
13369
|
-
offset: 0,
|
|
13370
|
-
releasable: true,
|
|
13371
|
-
type: glContext.FLOAT,
|
|
13372
|
-
data: new Float32Array(0)
|
|
13373
|
-
}
|
|
13374
|
-
},
|
|
13375
|
-
indices: {
|
|
13376
|
-
data: new Uint16Array(0),
|
|
13377
|
-
releasable: true
|
|
13378
|
-
},
|
|
13379
|
-
mode,
|
|
13380
|
-
maxVertex
|
|
13381
|
-
});
|
|
13496
|
+
constructor(args){
|
|
13497
|
+
// TODO: 为通过帧对比暂时使用老计算,修复粒子发射器直线宽度问题下面一行改为: this._d = args.width || 1 ;
|
|
13498
|
+
this._d = (args.width || 1) / 2;
|
|
13499
|
+
this.arcMode = args.arcMode;
|
|
13382
13500
|
}
|
|
13383
|
-
|
|
13384
|
-
|
|
13385
|
-
|
|
13386
|
-
|
|
13501
|
+
}
|
|
13502
|
+
|
|
13503
|
+
const tempMat4$2 = new Matrix4();
|
|
13504
|
+
class Donut {
|
|
13505
|
+
generate(opt) {
|
|
13506
|
+
const dradius = this.donutRadius;
|
|
13507
|
+
const center = this.radius - dradius;
|
|
13508
|
+
const angle = random(0, Math.PI * 2);
|
|
13509
|
+
const arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
13510
|
+
const rot = tempMat4$2.setFromRotationZ(arc);
|
|
13511
|
+
const direction = new Vector3(Math.cos(angle), Math.sin(angle), 0);
|
|
13512
|
+
const position = new Vector3(center + Math.cos(angle) * dradius, 0, Math.sin(angle) * dradius);
|
|
13513
|
+
return {
|
|
13514
|
+
direction: rot.transformNormal(direction),
|
|
13515
|
+
position: rot.transformPoint(position)
|
|
13387
13516
|
};
|
|
13388
|
-
this.preMultiAlpha = getPreMultiAlpha(blending);
|
|
13389
|
-
const material = Material.create(this.engine, materialProps);
|
|
13390
|
-
const states = {
|
|
13391
|
-
side,
|
|
13392
|
-
blending: true,
|
|
13393
|
-
blendMode: blending,
|
|
13394
|
-
mask,
|
|
13395
|
-
maskMode,
|
|
13396
|
-
depthTest: true,
|
|
13397
|
-
depthMask: occlusion
|
|
13398
|
-
};
|
|
13399
|
-
material.blending = states.blending;
|
|
13400
|
-
material.stencilRef = states.mask !== undefined ? [
|
|
13401
|
-
states.mask,
|
|
13402
|
-
states.mask
|
|
13403
|
-
] : undefined;
|
|
13404
|
-
material.depthTest = states.depthTest;
|
|
13405
|
-
material.depthMask = states.depthMask;
|
|
13406
|
-
setBlendMode(material, states.blendMode);
|
|
13407
|
-
setMaskMode(material, states.maskMode);
|
|
13408
|
-
setSideMode(material, states.side);
|
|
13409
|
-
if (!material.hasUniform('_Color')) {
|
|
13410
|
-
material.setVector4('_Color', new Vector4(0, 0, 0, 1));
|
|
13411
|
-
}
|
|
13412
|
-
if (!material.hasUniform('_TexOffset')) {
|
|
13413
|
-
material.setVector4('_TexOffset', new Vector4());
|
|
13414
|
-
}
|
|
13415
|
-
if (!material.hasUniform('_TexParams')) {
|
|
13416
|
-
material.setVector4('_TexParams', new Vector4());
|
|
13417
|
-
}
|
|
13418
|
-
return material;
|
|
13419
13517
|
}
|
|
13420
|
-
|
|
13421
|
-
|
|
13422
|
-
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
}
|
|
13440
|
-
const originData = [
|
|
13441
|
-
-.5,
|
|
13442
|
-
.5,
|
|
13443
|
-
-.5,
|
|
13444
|
-
-.5,
|
|
13445
|
-
.5,
|
|
13446
|
-
.5,
|
|
13447
|
-
.5,
|
|
13448
|
-
-.5
|
|
13449
|
-
];
|
|
13450
|
-
const atlasOffset = [];
|
|
13451
|
-
const index = [];
|
|
13452
|
-
let col = 2;
|
|
13453
|
-
let row = 2;
|
|
13454
|
-
if (splits.length === 1) {
|
|
13455
|
-
col = 1;
|
|
13456
|
-
row = 1;
|
|
13457
|
-
}
|
|
13458
|
-
const position = [];
|
|
13459
|
-
for(let x = 0; x < col; x++){
|
|
13460
|
-
for(let y = 0; y < row; y++){
|
|
13461
|
-
const base = (y * 2 + x) * 4;
|
|
13462
|
-
// @ts-expect-error
|
|
13463
|
-
const split = textureSheetAnimation ? [
|
|
13464
|
-
0,
|
|
13465
|
-
0,
|
|
13466
|
-
1,
|
|
13467
|
-
1,
|
|
13468
|
-
splits[0][4]
|
|
13469
|
-
] : splits[y * 2 + x];
|
|
13470
|
-
const texOffset = split[4] ? [
|
|
13471
|
-
0,
|
|
13472
|
-
0,
|
|
13473
|
-
1,
|
|
13474
|
-
0,
|
|
13475
|
-
0,
|
|
13476
|
-
1,
|
|
13477
|
-
1,
|
|
13478
|
-
1
|
|
13479
|
-
] : [
|
|
13480
|
-
0,
|
|
13481
|
-
1,
|
|
13482
|
-
0,
|
|
13483
|
-
0,
|
|
13484
|
-
1,
|
|
13485
|
-
1,
|
|
13486
|
-
1,
|
|
13487
|
-
0
|
|
13488
|
-
];
|
|
13489
|
-
const dw = ((x + x + 1) / col - 1) / 2;
|
|
13490
|
-
const dh = ((y + y + 1) / row - 1) / 2;
|
|
13491
|
-
const tox = split[0];
|
|
13492
|
-
const toy = split[1];
|
|
13493
|
-
const tsx = split[4] ? split[3] : split[2];
|
|
13494
|
-
const tsy = split[4] ? split[2] : split[3];
|
|
13495
|
-
const origin = [
|
|
13496
|
-
originData[0] / col + dw,
|
|
13497
|
-
originData[1] / row + dh,
|
|
13498
|
-
originData[2] / col + dw,
|
|
13499
|
-
originData[3] / row + dh,
|
|
13500
|
-
originData[4] / col + dw,
|
|
13501
|
-
originData[5] / row + dh,
|
|
13502
|
-
originData[6] / col + dw,
|
|
13503
|
-
originData[7] / row + dh
|
|
13504
|
-
];
|
|
13505
|
-
atlasOffset.push(texOffset[0] * tsx + tox, texOffset[1] * tsy + toy, texOffset[2] * tsx + tox, texOffset[3] * tsy + toy, texOffset[4] * tsx + tox, texOffset[5] * tsy + toy, texOffset[6] * tsx + tox, texOffset[7] * tsy + toy);
|
|
13506
|
-
position.push(origin[0] * sx, origin[1] * sy, 0.0, origin[2] * sx, origin[3] * sy, 0.0, origin[4] * sx, origin[5] * sy, 0.0, origin[6] * sx, origin[7] * sy, 0.0);
|
|
13507
|
-
index.push(base, 1 + base, 2 + base, 2 + base, 1 + base, 3 + base);
|
|
13508
|
-
}
|
|
13509
|
-
}
|
|
13510
|
-
this.geometry.setAttributeData('aPos', new Float32Array(position));
|
|
13518
|
+
constructor(props){
|
|
13519
|
+
Object.keys(props).forEach((key)=>{
|
|
13520
|
+
this[key] = props[key];
|
|
13521
|
+
});
|
|
13522
|
+
}
|
|
13523
|
+
}
|
|
13524
|
+
|
|
13525
|
+
const tempMat4$1 = new Matrix4();
|
|
13526
|
+
class Sphere {
|
|
13527
|
+
getHorizontalAngle() {
|
|
13528
|
+
return random(-90, 90);
|
|
13529
|
+
}
|
|
13530
|
+
generate(opt) {
|
|
13531
|
+
const rz = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
13532
|
+
const rh = this.getHorizontalAngle() * DEG2RAD;
|
|
13533
|
+
const radius = this.radius;
|
|
13534
|
+
const point = new Vector3(Math.cos(rh), 0, Math.sin(rh));
|
|
13535
|
+
const mat4 = tempMat4$1.setFromRotationZ(rz);
|
|
13536
|
+
const p = mat4.transformNormal(point);
|
|
13511
13537
|
return {
|
|
13512
|
-
|
|
13513
|
-
|
|
13538
|
+
position: p.clone().multiply(radius),
|
|
13539
|
+
direction: p
|
|
13514
13540
|
};
|
|
13515
13541
|
}
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
|
|
13519
|
-
if (tex) {
|
|
13520
|
-
ret.push(tex);
|
|
13521
|
-
}
|
|
13522
|
-
return ret;
|
|
13523
|
-
}
|
|
13524
|
-
/**
|
|
13525
|
-
* 获取图层包围盒的类型和世界坐标
|
|
13526
|
-
* @returns
|
|
13527
|
-
*/ getBoundingBox() {
|
|
13528
|
-
if (!this.item) {
|
|
13529
|
-
return;
|
|
13530
|
-
}
|
|
13531
|
-
const worldMatrix = this.transform.getWorldMatrix();
|
|
13532
|
-
const triangles = trianglesFromRect(Vector3.ZERO, 1 / 2, 1 / 2);
|
|
13533
|
-
triangles.forEach((triangle)=>{
|
|
13534
|
-
worldMatrix.transformPoint(triangle.p0);
|
|
13535
|
-
worldMatrix.transformPoint(triangle.p1);
|
|
13536
|
-
worldMatrix.transformPoint(triangle.p2);
|
|
13542
|
+
constructor(props){
|
|
13543
|
+
Object.keys(props).forEach((key)=>{
|
|
13544
|
+
this[key] = props[key];
|
|
13537
13545
|
});
|
|
13546
|
+
}
|
|
13547
|
+
}
|
|
13548
|
+
class Hemisphere extends Sphere {
|
|
13549
|
+
getHorizontalAngle() {
|
|
13550
|
+
return random(0, 90);
|
|
13551
|
+
}
|
|
13552
|
+
}
|
|
13553
|
+
|
|
13554
|
+
class TextureShape {
|
|
13555
|
+
generate(opt) {
|
|
13556
|
+
const anchors = this.anchors;
|
|
13557
|
+
const pointCount = anchors.length / 2 - 1;
|
|
13558
|
+
const index = Math.floor(getArcAngle(pointCount, this.arcMode, opt));
|
|
13559
|
+
const pointX = (anchors[index * 2] + this.block[0] * this.random * Math.random()) % 1 - 0.5;
|
|
13560
|
+
const pointY = (anchors[index * 2 + 1] + this.block[1] * this.random * Math.random()) % 1 - 0.5;
|
|
13561
|
+
const dir = new Vector3(pointX, pointY, 0);
|
|
13538
13562
|
return {
|
|
13539
|
-
|
|
13540
|
-
|
|
13563
|
+
position: new Vector3(pointX * this.width, pointY * this.height, 0),
|
|
13564
|
+
direction: dir.normalize()
|
|
13541
13565
|
};
|
|
13542
13566
|
}
|
|
13543
|
-
|
|
13544
|
-
|
|
13545
|
-
|
|
13546
|
-
|
|
13547
|
-
|
|
13548
|
-
|
|
13549
|
-
|
|
13550
|
-
|
|
13551
|
-
|
|
13552
|
-
|
|
13553
|
-
var _renderer_renderMode, _renderer_blending, _renderer_texture, _renderer_side, _renderer_mask, _renderer_maskMode;
|
|
13554
|
-
this.renderer = {
|
|
13555
|
-
renderMode: (_renderer_renderMode = renderer.renderMode) != null ? _renderer_renderMode : RenderMode.BILLBOARD,
|
|
13556
|
-
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
13557
|
-
texture: (_renderer_texture = renderer.texture) != null ? _renderer_texture : this.engine.emptyTexture,
|
|
13558
|
-
occlusion: !!renderer.occlusion,
|
|
13559
|
-
transparentOcclusion: !!renderer.transparentOcclusion || renderer.maskMode === MaskMode.MASK,
|
|
13560
|
-
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
13561
|
-
shape: renderer.shape,
|
|
13562
|
-
mask: (_renderer_mask = renderer.mask) != null ? _renderer_mask : 0,
|
|
13563
|
-
maskMode: (_renderer_maskMode = renderer.maskMode) != null ? _renderer_maskMode : MaskMode.NONE,
|
|
13564
|
-
order: listIndex
|
|
13567
|
+
constructor(arg){
|
|
13568
|
+
const detail = arg.detail || {
|
|
13569
|
+
anchors: [
|
|
13570
|
+
0.5,
|
|
13571
|
+
0.5
|
|
13572
|
+
],
|
|
13573
|
+
block: [
|
|
13574
|
+
0,
|
|
13575
|
+
0
|
|
13576
|
+
]
|
|
13565
13577
|
};
|
|
13566
|
-
this.
|
|
13567
|
-
this.
|
|
13568
|
-
this.
|
|
13569
|
-
this.
|
|
13570
|
-
this.
|
|
13571
|
-
|
|
13572
|
-
const material = this.createMaterial(this.renderInfo, 2);
|
|
13573
|
-
this.worldMatrix = Matrix4.fromIdentity();
|
|
13574
|
-
this.material = material;
|
|
13575
|
-
this.geometry = geometry;
|
|
13576
|
-
this.name = 'MSprite' + seed$2++;
|
|
13577
|
-
const startColor = options.startColor || [
|
|
13578
|
-
1,
|
|
13579
|
-
1,
|
|
13580
|
-
1,
|
|
13581
|
-
1
|
|
13582
|
-
];
|
|
13583
|
-
this.material.setVector4('_Color', new Vector4().setFromArray(startColor));
|
|
13584
|
-
this.material.setVector4('_TexOffset', new Vector4().setFromArray([
|
|
13585
|
-
0,
|
|
13586
|
-
0,
|
|
13587
|
-
1,
|
|
13588
|
-
1
|
|
13589
|
-
]));
|
|
13590
|
-
this.setItem();
|
|
13578
|
+
this.anchors = new Float32Array(detail.anchors);
|
|
13579
|
+
this.width = arg.width || 1;
|
|
13580
|
+
this.height = arg.height || 1;
|
|
13581
|
+
this.block = detail.block;
|
|
13582
|
+
this.arcMode = arg.arcMode;
|
|
13583
|
+
this.random = clamp$1(arg.random || 0, 0, 1);
|
|
13591
13584
|
}
|
|
13592
|
-
|
|
13593
|
-
|
|
13594
|
-
|
|
13595
|
-
|
|
13596
|
-
|
|
13597
|
-
|
|
13598
|
-
|
|
13599
|
-
|
|
13600
|
-
1,
|
|
13601
|
-
1
|
|
13602
|
-
];
|
|
13603
|
-
this.visible = true;
|
|
13604
|
-
this.getHitTestParams = (force)=>{
|
|
13605
|
-
const ui = this.interaction;
|
|
13606
|
-
if (force || ui) {
|
|
13607
|
-
const area = this.getBoundingBox();
|
|
13608
|
-
if (area) {
|
|
13609
|
-
var _this_interaction;
|
|
13610
|
-
return {
|
|
13611
|
-
behavior: ((_this_interaction = this.interaction) == null ? void 0 : _this_interaction.behavior) || 0,
|
|
13612
|
-
type: area.type,
|
|
13613
|
-
triangles: area.area,
|
|
13614
|
-
backfaceCulling: this.renderer.side === SideMode.FRONT
|
|
13615
|
-
};
|
|
13616
|
-
}
|
|
13617
|
-
}
|
|
13618
|
-
};
|
|
13619
|
-
if (props) {
|
|
13620
|
-
this.fromData(props);
|
|
13621
|
-
}
|
|
13622
|
-
}
|
|
13623
|
-
}
|
|
13624
|
-
SpriteComponent = __decorate([
|
|
13625
|
-
effectsClass(DataType.SpriteComponent)
|
|
13626
|
-
], SpriteComponent);
|
|
13627
|
-
|
|
13628
|
-
const RUNTIME_ENV = 'runtime_env';
|
|
13629
|
-
const RENDER_PREFER_LOOKUP_TEXTURE = 'lookup_texture';
|
|
13630
|
-
// 文本元素使用 offscreen canvas 绘制
|
|
13631
|
-
const TEMPLATE_USE_OFFSCREEN_CANVAS = 'offscreen_canvas';
|
|
13632
|
-
// 后处理配置相关
|
|
13633
|
-
const POST_PROCESS_SETTINGS = 'post_process_settings';
|
|
13634
|
-
const config = {};
|
|
13635
|
-
function getConfig(name) {
|
|
13636
|
-
return config[name];
|
|
13637
|
-
}
|
|
13638
|
-
function setConfig(name, value) {
|
|
13639
|
-
return config[name] = value;
|
|
13640
|
-
}
|
|
13641
|
-
|
|
13642
|
-
class Cone {
|
|
13643
|
-
generate(opt) {
|
|
13644
|
-
const arc = getArcAngle(this.arc, this.arcMode, opt);
|
|
13645
|
-
const a = arc * DEG2RAD;
|
|
13646
|
-
const x = Math.cos(a) * this.radius;
|
|
13647
|
-
const y = Math.sin(a) * this.radius;
|
|
13648
|
-
const position = new Vector3(x, y, 0);
|
|
13649
|
-
const l = Math.tan(this.angle * DEG2RAD);
|
|
13650
|
-
const dir = position.clone().multiply(l);
|
|
13651
|
-
// dir + [0,0,1]
|
|
13652
|
-
dir.z += 1;
|
|
13653
|
-
return {
|
|
13654
|
-
position: position.multiply(random(0, 1)),
|
|
13655
|
-
direction: dir.normalize()
|
|
13656
|
-
};
|
|
13657
|
-
}
|
|
13658
|
-
constructor(props){
|
|
13659
|
-
Object.keys(props).forEach((key)=>{
|
|
13660
|
-
this[key] = props[key];
|
|
13661
|
-
});
|
|
13662
|
-
}
|
|
13663
|
-
}
|
|
13664
|
-
function getArcAngle(arc, arcMode, opt) {
|
|
13665
|
-
if (arcMode === ShapeArcMode.RANDOM) {
|
|
13666
|
-
arc = random(0, arc);
|
|
13667
|
-
} else if (arcMode === ShapeArcMode.UNIDIRECTIONAL_CYCLE) {
|
|
13668
|
-
const d = opt.index % (opt.total + 1);
|
|
13669
|
-
arc = arc / opt.total * d;
|
|
13670
|
-
} else if (arcMode === ShapeArcMode.BIDIRECTIONAL_CYCLE) {
|
|
13671
|
-
const d = opt.index / (opt.total + 1);
|
|
13672
|
-
const i = d - Math.floor(d);
|
|
13673
|
-
arc = arc * (Math.floor(d) % 2 ? 1 - i : i);
|
|
13674
|
-
} else if (arcMode === ShapeArcMode.UNIFORM_BURST) {
|
|
13675
|
-
arc = arc * opt.burstIndex / opt.burstCount;
|
|
13676
|
-
}
|
|
13677
|
-
return arc;
|
|
13678
|
-
}
|
|
13679
|
-
|
|
13680
|
-
class Circle {
|
|
13681
|
-
generate(opt) {
|
|
13682
|
-
const arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
13683
|
-
const direction = new Vector3(Math.cos(arc), Math.sin(arc), 0);
|
|
13684
|
-
const radius = this.radius;
|
|
13685
|
-
return {
|
|
13686
|
-
direction,
|
|
13687
|
-
position: direction.clone().multiply(radius)
|
|
13688
|
-
};
|
|
13689
|
-
}
|
|
13690
|
-
constructor(props){
|
|
13691
|
-
Object.keys(props).forEach((key)=>{
|
|
13692
|
-
this[key] = props[key];
|
|
13693
|
-
});
|
|
13694
|
-
}
|
|
13695
|
-
}
|
|
13696
|
-
class Rectangle {
|
|
13697
|
-
generate(opt) {
|
|
13698
|
-
const x = random(-this._d, this._d);
|
|
13699
|
-
const y = random(-this._h, this._h);
|
|
13700
|
-
return {
|
|
13701
|
-
direction: new Vector3(0, 0, 1),
|
|
13702
|
-
position: new Vector3(x, y, 0)
|
|
13703
|
-
};
|
|
13704
|
-
}
|
|
13705
|
-
constructor(arg){
|
|
13706
|
-
this._d = (arg.width || 1) / 2;
|
|
13707
|
-
this._h = (arg.height || 1) / 2;
|
|
13708
|
-
}
|
|
13709
|
-
}
|
|
13710
|
-
class RectangleEdge {
|
|
13711
|
-
generate(opt) {
|
|
13712
|
-
const arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
13713
|
-
const direction = new Vector3(Math.cos(arc), Math.sin(arc), 0);
|
|
13714
|
-
const w = this._d;
|
|
13715
|
-
const h = this._h;
|
|
13716
|
-
const r0 = Math.atan2(h, w);
|
|
13717
|
-
const tan = Math.tan(arc);
|
|
13718
|
-
const position = new Vector3();
|
|
13719
|
-
if (arc < r0) {
|
|
13720
|
-
position.set(w, w * tan, 0);
|
|
13721
|
-
} else if (arc >= r0 && arc < Math.PI - r0) {
|
|
13722
|
-
position.set(h / tan, h, 0);
|
|
13723
|
-
} else if (arc < Math.PI + r0) {
|
|
13724
|
-
position.set(-w, -w * tan, 0);
|
|
13725
|
-
} else if (arc < Math.PI * 2 - r0) {
|
|
13726
|
-
position.set(-h / tan, -h, 0);
|
|
13727
|
-
} else {
|
|
13728
|
-
position.set(w, w * tan, 0);
|
|
13729
|
-
}
|
|
13730
|
-
return {
|
|
13731
|
-
direction,
|
|
13732
|
-
position
|
|
13733
|
-
};
|
|
13734
|
-
}
|
|
13735
|
-
constructor(arg){
|
|
13736
|
-
this._d = (arg.width || 1) / 2;
|
|
13737
|
-
this._h = (arg.height || 1) / 2;
|
|
13738
|
-
this.arcMode = arg.arcMode;
|
|
13739
|
-
this.arc = arg.arc;
|
|
13740
|
-
}
|
|
13741
|
-
}
|
|
13742
|
-
class Edge {
|
|
13743
|
-
generate(options) {
|
|
13744
|
-
const x = this.arcMode === ShapeArcMode.UNIFORM_BURST ? options.burstIndex % options.burstCount / (options.burstCount - 1) : random(0, 1);
|
|
13745
|
-
return {
|
|
13746
|
-
direction: new Vector3(0, 1, 0),
|
|
13747
|
-
position: new Vector3(this._d * (x - 0.5), 0, 0)
|
|
13748
|
-
};
|
|
13749
|
-
}
|
|
13750
|
-
constructor(args){
|
|
13751
|
-
// TODO: 为通过帧对比暂时使用老计算,修复粒子发射器直线宽度问题下面一行改为: this._d = args.width || 1 ;
|
|
13752
|
-
this._d = (args.width || 1) / 2;
|
|
13753
|
-
this.arcMode = args.arcMode;
|
|
13754
|
-
}
|
|
13755
|
-
}
|
|
13756
|
-
|
|
13757
|
-
const tempMat4$2 = new Matrix4();
|
|
13758
|
-
class Donut {
|
|
13759
|
-
generate(opt) {
|
|
13760
|
-
const dradius = this.donutRadius;
|
|
13761
|
-
const center = this.radius - dradius;
|
|
13762
|
-
const angle = random(0, Math.PI * 2);
|
|
13763
|
-
const arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
13764
|
-
const rot = tempMat4$2.setFromRotationZ(arc);
|
|
13765
|
-
const direction = new Vector3(Math.cos(angle), Math.sin(angle), 0);
|
|
13766
|
-
const position = new Vector3(center + Math.cos(angle) * dradius, 0, Math.sin(angle) * dradius);
|
|
13767
|
-
return {
|
|
13768
|
-
direction: rot.transformNormal(direction),
|
|
13769
|
-
position: rot.transformPoint(position)
|
|
13770
|
-
};
|
|
13771
|
-
}
|
|
13772
|
-
constructor(props){
|
|
13773
|
-
Object.keys(props).forEach((key)=>{
|
|
13774
|
-
this[key] = props[key];
|
|
13775
|
-
});
|
|
13776
|
-
}
|
|
13777
|
-
}
|
|
13778
|
-
|
|
13779
|
-
const tempMat4$1 = new Matrix4();
|
|
13780
|
-
class Sphere {
|
|
13781
|
-
getHorizontalAngle() {
|
|
13782
|
-
return random(-90, 90);
|
|
13783
|
-
}
|
|
13784
|
-
generate(opt) {
|
|
13785
|
-
const rz = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
13786
|
-
const rh = this.getHorizontalAngle() * DEG2RAD;
|
|
13787
|
-
const radius = this.radius;
|
|
13788
|
-
const point = new Vector3(Math.cos(rh), 0, Math.sin(rh));
|
|
13789
|
-
const mat4 = tempMat4$1.setFromRotationZ(rz);
|
|
13790
|
-
const p = mat4.transformNormal(point);
|
|
13791
|
-
return {
|
|
13792
|
-
position: p.clone().multiply(radius),
|
|
13793
|
-
direction: p
|
|
13794
|
-
};
|
|
13795
|
-
}
|
|
13796
|
-
constructor(props){
|
|
13797
|
-
Object.keys(props).forEach((key)=>{
|
|
13798
|
-
this[key] = props[key];
|
|
13799
|
-
});
|
|
13800
|
-
}
|
|
13801
|
-
}
|
|
13802
|
-
class Hemisphere extends Sphere {
|
|
13803
|
-
getHorizontalAngle() {
|
|
13804
|
-
return random(0, 90);
|
|
13805
|
-
}
|
|
13806
|
-
}
|
|
13807
|
-
|
|
13808
|
-
class TextureShape {
|
|
13809
|
-
generate(opt) {
|
|
13810
|
-
const anchors = this.anchors;
|
|
13811
|
-
const pointCount = anchors.length / 2 - 1;
|
|
13812
|
-
const index = Math.floor(getArcAngle(pointCount, this.arcMode, opt));
|
|
13813
|
-
const pointX = (anchors[index * 2] + this.block[0] * this.random * Math.random()) % 1 - 0.5;
|
|
13814
|
-
const pointY = (anchors[index * 2 + 1] + this.block[1] * this.random * Math.random()) % 1 - 0.5;
|
|
13815
|
-
const dir = new Vector3(pointX, pointY, 0);
|
|
13816
|
-
return {
|
|
13817
|
-
position: new Vector3(pointX * this.width, pointY * this.height, 0),
|
|
13818
|
-
direction: dir.normalize()
|
|
13819
|
-
};
|
|
13820
|
-
}
|
|
13821
|
-
constructor(arg){
|
|
13822
|
-
const detail = arg.detail || {
|
|
13823
|
-
anchors: [
|
|
13824
|
-
0.5,
|
|
13825
|
-
0.5
|
|
13826
|
-
],
|
|
13827
|
-
block: [
|
|
13828
|
-
0,
|
|
13829
|
-
0
|
|
13830
|
-
]
|
|
13831
|
-
};
|
|
13832
|
-
this.anchors = new Float32Array(detail.anchors);
|
|
13833
|
-
this.width = arg.width || 1;
|
|
13834
|
-
this.height = arg.height || 1;
|
|
13835
|
-
this.block = detail.block;
|
|
13836
|
-
this.arcMode = arg.arcMode;
|
|
13837
|
-
this.random = clamp$1(arg.random || 0, 0, 1);
|
|
13838
|
-
}
|
|
13839
|
-
}
|
|
13840
|
-
|
|
13841
|
-
class ShapeNone {
|
|
13842
|
-
generate() {
|
|
13843
|
-
return {
|
|
13844
|
-
position: new Vector3(),
|
|
13845
|
-
direction: new Vector3()
|
|
13846
|
-
};
|
|
13585
|
+
}
|
|
13586
|
+
|
|
13587
|
+
class ShapeNone {
|
|
13588
|
+
generate() {
|
|
13589
|
+
return {
|
|
13590
|
+
position: new Vector3(),
|
|
13591
|
+
direction: new Vector3()
|
|
13592
|
+
};
|
|
13847
13593
|
}
|
|
13848
13594
|
}
|
|
13849
13595
|
const map = {
|
|
@@ -14195,319 +13941,856 @@ function insertNode(i, x, y, last) {
|
|
|
14195
13941
|
last.next.prev = p;
|
|
14196
13942
|
last.next = p;
|
|
14197
13943
|
}
|
|
14198
|
-
return p;
|
|
14199
|
-
}
|
|
14200
|
-
function removeNode(p) {
|
|
14201
|
-
p.next.prev = p.prev;
|
|
14202
|
-
p.prev.next = p.next;
|
|
14203
|
-
if (p.prevZ) p.prevZ.nextZ = p.nextZ;
|
|
14204
|
-
if (p.nextZ) p.nextZ.prevZ = p.prevZ;
|
|
14205
|
-
}
|
|
14206
|
-
function Node(i, x, y) {
|
|
14207
|
-
// vertex index in coordinates array
|
|
14208
|
-
this.i = i;
|
|
14209
|
-
// vertex coordinates
|
|
14210
|
-
this.x = x;
|
|
14211
|
-
this.y = y;
|
|
14212
|
-
// previous and next vertex nodes in a polygon ring
|
|
14213
|
-
this.prev = null;
|
|
14214
|
-
this.next = null;
|
|
14215
|
-
// z-order curve value
|
|
14216
|
-
this.z = null;
|
|
14217
|
-
// previous and next nodes in z-order
|
|
14218
|
-
this.prevZ = null;
|
|
14219
|
-
this.nextZ = null;
|
|
14220
|
-
// indicates whether this is a steiner point
|
|
14221
|
-
this.steiner = false;
|
|
13944
|
+
return p;
|
|
13945
|
+
}
|
|
13946
|
+
function removeNode(p) {
|
|
13947
|
+
p.next.prev = p.prev;
|
|
13948
|
+
p.prev.next = p.next;
|
|
13949
|
+
if (p.prevZ) p.prevZ.nextZ = p.nextZ;
|
|
13950
|
+
if (p.nextZ) p.nextZ.prevZ = p.prevZ;
|
|
13951
|
+
}
|
|
13952
|
+
function Node(i, x, y) {
|
|
13953
|
+
// vertex index in coordinates array
|
|
13954
|
+
this.i = i;
|
|
13955
|
+
// vertex coordinates
|
|
13956
|
+
this.x = x;
|
|
13957
|
+
this.y = y;
|
|
13958
|
+
// previous and next vertex nodes in a polygon ring
|
|
13959
|
+
this.prev = null;
|
|
13960
|
+
this.next = null;
|
|
13961
|
+
// z-order curve value
|
|
13962
|
+
this.z = null;
|
|
13963
|
+
// previous and next nodes in z-order
|
|
13964
|
+
this.prevZ = null;
|
|
13965
|
+
this.nextZ = null;
|
|
13966
|
+
// indicates whether this is a steiner point
|
|
13967
|
+
this.steiner = false;
|
|
13968
|
+
}
|
|
13969
|
+
function signedArea(data, start, end, dim) {
|
|
13970
|
+
var sum = 0;
|
|
13971
|
+
for(var i = start, j = end - dim; i < end; i += dim){
|
|
13972
|
+
sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
|
|
13973
|
+
j = i;
|
|
13974
|
+
}
|
|
13975
|
+
return sum;
|
|
13976
|
+
}
|
|
13977
|
+
|
|
13978
|
+
let indexBase = 0;
|
|
13979
|
+
function earcut(data, holeIndices, dim, ib) {
|
|
13980
|
+
dim = dim || 2;
|
|
13981
|
+
indexBase = ib || 0;
|
|
13982
|
+
const hasHoles = holeIndices && holeIndices.length;
|
|
13983
|
+
const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
|
|
13984
|
+
let outerNode = linkedList(data, 0, outerLen, dim, true);
|
|
13985
|
+
const triangles = [];
|
|
13986
|
+
if (!outerNode || outerNode.next === outerNode.prev) {
|
|
13987
|
+
return triangles;
|
|
13988
|
+
}
|
|
13989
|
+
let minX, minY, maxX, maxY, x, y, invSize;
|
|
13990
|
+
if (hasHoles) {
|
|
13991
|
+
outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
|
|
13992
|
+
}
|
|
13993
|
+
// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
|
|
13994
|
+
if (data.length > 80 * dim) {
|
|
13995
|
+
minX = maxX = data[0];
|
|
13996
|
+
minY = maxY = data[1];
|
|
13997
|
+
for(let i = dim; i < outerLen; i += dim){
|
|
13998
|
+
x = data[i];
|
|
13999
|
+
y = data[i + 1];
|
|
14000
|
+
if (x < minX) {
|
|
14001
|
+
minX = x;
|
|
14002
|
+
}
|
|
14003
|
+
if (y < minY) {
|
|
14004
|
+
minY = y;
|
|
14005
|
+
}
|
|
14006
|
+
if (x > maxX) {
|
|
14007
|
+
maxX = x;
|
|
14008
|
+
}
|
|
14009
|
+
if (y > maxY) {
|
|
14010
|
+
maxY = y;
|
|
14011
|
+
}
|
|
14012
|
+
}
|
|
14013
|
+
// minX, minY and invSize are later used to transform coords into integers for z-order calculation
|
|
14014
|
+
invSize = Math.max(maxX - minX, maxY - minY);
|
|
14015
|
+
invSize = invSize !== 0 ? 1 / invSize : 0;
|
|
14016
|
+
}
|
|
14017
|
+
hackEarcutLinked(outerNode, triangles, dim, minX, minY, invSize);
|
|
14018
|
+
return triangles;
|
|
14019
|
+
}
|
|
14020
|
+
// main ear slicing loop which triangulates a polygon (given as a linked list)
|
|
14021
|
+
function hackEarcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
|
|
14022
|
+
if (!ear) {
|
|
14023
|
+
return;
|
|
14024
|
+
}
|
|
14025
|
+
// interlink polygon nodes in z-order
|
|
14026
|
+
if (!pass && invSize) {
|
|
14027
|
+
indexCurve(ear, minX, minY, invSize);
|
|
14028
|
+
}
|
|
14029
|
+
let stop = ear, prev, next;
|
|
14030
|
+
// iterate through ears, slicing them one by one
|
|
14031
|
+
while(ear.prev !== ear.next){
|
|
14032
|
+
prev = ear.prev;
|
|
14033
|
+
next = ear.next;
|
|
14034
|
+
if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
|
|
14035
|
+
// cut off the triangle
|
|
14036
|
+
triangles.push(prev.i / dim + indexBase);
|
|
14037
|
+
triangles.push(ear.i / dim + indexBase);
|
|
14038
|
+
triangles.push(next.i / dim + indexBase);
|
|
14039
|
+
removeNode(ear);
|
|
14040
|
+
// skipping the next vertex leads to less sliver triangles
|
|
14041
|
+
ear = next.next;
|
|
14042
|
+
stop = next.next;
|
|
14043
|
+
continue;
|
|
14044
|
+
}
|
|
14045
|
+
ear = next;
|
|
14046
|
+
// if we looped through the whole remaining polygon and can't find any more ears
|
|
14047
|
+
if (ear === stop) {
|
|
14048
|
+
// try filtering triangles and slicing again
|
|
14049
|
+
if (!pass) {
|
|
14050
|
+
hackEarcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
|
|
14051
|
+
// if this didn't work, try curing all small self-intersections locally
|
|
14052
|
+
} else if (pass === 1) {
|
|
14053
|
+
ear = hackCureLocalIntersections(filterPoints(ear), triangles, dim);
|
|
14054
|
+
hackEarcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
|
|
14055
|
+
// as a last resort, try splitting the remaining polygon into two
|
|
14056
|
+
} else if (pass === 2) {
|
|
14057
|
+
hackSplitEarcut(ear, triangles, dim, minX, minY, invSize);
|
|
14058
|
+
}
|
|
14059
|
+
break;
|
|
14060
|
+
}
|
|
14061
|
+
}
|
|
14062
|
+
}
|
|
14063
|
+
// go through all polygon nodes and cure small local self-intersections
|
|
14064
|
+
function hackCureLocalIntersections(start, triangles, dim) {
|
|
14065
|
+
let p = start;
|
|
14066
|
+
do {
|
|
14067
|
+
const a = p.prev, b = p.next.next;
|
|
14068
|
+
if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
|
|
14069
|
+
triangles.push(a.i / dim + indexBase);
|
|
14070
|
+
triangles.push(p.i / dim + indexBase);
|
|
14071
|
+
triangles.push(b.i / dim + indexBase);
|
|
14072
|
+
// remove two nodes involved
|
|
14073
|
+
removeNode(p);
|
|
14074
|
+
removeNode(p.next);
|
|
14075
|
+
p = start = b;
|
|
14076
|
+
}
|
|
14077
|
+
p = p.next;
|
|
14078
|
+
}while (p !== start)
|
|
14079
|
+
return filterPoints(p);
|
|
14080
|
+
}
|
|
14081
|
+
// try splitting polygon into two and triangulate them independently
|
|
14082
|
+
function hackSplitEarcut(start, triangles, dim, minX, minY, invSize) {
|
|
14083
|
+
// look for a valid diagonal that divides the polygon into two
|
|
14084
|
+
let a = start;
|
|
14085
|
+
do {
|
|
14086
|
+
let b = a.next.next;
|
|
14087
|
+
while(b !== a.prev){
|
|
14088
|
+
if (a.i !== b.i && isValidDiagonal(a, b)) {
|
|
14089
|
+
// split the polygon in two by the diagonal
|
|
14090
|
+
let c = splitPolygon(a, b);
|
|
14091
|
+
// filter colinear triangles around the cuts
|
|
14092
|
+
a = filterPoints(a, a.next);
|
|
14093
|
+
c = filterPoints(c, c.next);
|
|
14094
|
+
// run earcut on each half
|
|
14095
|
+
hackEarcutLinked(a, triangles, dim, minX, minY, invSize);
|
|
14096
|
+
hackEarcutLinked(c, triangles, dim, minX, minY, invSize);
|
|
14097
|
+
return;
|
|
14098
|
+
}
|
|
14099
|
+
b = b.next;
|
|
14100
|
+
}
|
|
14101
|
+
a = a.next;
|
|
14102
|
+
}while (a !== start)
|
|
14103
|
+
}
|
|
14104
|
+
|
|
14105
|
+
const POINT_INDEX = 2;
|
|
14106
|
+
function getGeometryTriangles(geometry, options) {
|
|
14107
|
+
const { s, p } = geometry;
|
|
14108
|
+
const segments = s[1];
|
|
14109
|
+
const points = p[1];
|
|
14110
|
+
let pointCount = 0;
|
|
14111
|
+
for(let i = 0; i < segments.length; i++){
|
|
14112
|
+
const segment = segments[i];
|
|
14113
|
+
pointCount += segment.length - 1;
|
|
14114
|
+
}
|
|
14115
|
+
const pointData = new Float32Array(pointCount * SPRITE_VERTEX_STRIDE);
|
|
14116
|
+
const { indexBase = 0, uvTransform } = options;
|
|
14117
|
+
let index = 0;
|
|
14118
|
+
let dx = 0, dy = 0, sw = 1, sh = 1, r;
|
|
14119
|
+
if (uvTransform) {
|
|
14120
|
+
dx = uvTransform[0];
|
|
14121
|
+
dy = uvTransform[1];
|
|
14122
|
+
r = uvTransform[4];
|
|
14123
|
+
sw = r ? uvTransform[3] : uvTransform[2];
|
|
14124
|
+
sh = r ? uvTransform[2] : uvTransform[3];
|
|
14125
|
+
}
|
|
14126
|
+
const temp = [
|
|
14127
|
+
0,
|
|
14128
|
+
0
|
|
14129
|
+
];
|
|
14130
|
+
const angle = r === 0 ? 0 : -Math.PI / 2;
|
|
14131
|
+
for(let i = 0; i < segments.length; i++){
|
|
14132
|
+
const segment = segments[i];
|
|
14133
|
+
const p0 = points[i];
|
|
14134
|
+
const p1 = points[i + 1] || points[0];
|
|
14135
|
+
const keys = segment;
|
|
14136
|
+
const point = [
|
|
14137
|
+
0,
|
|
14138
|
+
0
|
|
14139
|
+
];
|
|
14140
|
+
for(let j = 0; j < keys.length - 1; j++){
|
|
14141
|
+
const key = keys[j];
|
|
14142
|
+
getBezier2DValue(point, key, p0, p1, p0[4], p0[5], p1[2], p1[3]);
|
|
14143
|
+
setPoint(point[0], point[1]);
|
|
14144
|
+
}
|
|
14145
|
+
}
|
|
14146
|
+
const indices = earcut(Array.from(pointData), null, SPRITE_VERTEX_STRIDE, indexBase);
|
|
14147
|
+
return {
|
|
14148
|
+
aPoint: pointData,
|
|
14149
|
+
index: new Uint16Array(indices)
|
|
14150
|
+
};
|
|
14151
|
+
function setPoint(x, y) {
|
|
14152
|
+
pointData[index++] = x / 2;
|
|
14153
|
+
pointData[index++] = y / 2;
|
|
14154
|
+
if (uvTransform) {
|
|
14155
|
+
temp[0] = x;
|
|
14156
|
+
temp[1] = y;
|
|
14157
|
+
rotateVec2(temp, temp, angle);
|
|
14158
|
+
pointData[index++] = dx + (temp[0] + 1) / 2 * sw;
|
|
14159
|
+
pointData[index++] = dy + (temp[1] + 1) / 2 * sh;
|
|
14160
|
+
} else {
|
|
14161
|
+
pointData[index++] = (x + 1) / 2;
|
|
14162
|
+
pointData[index++] = (y + 1) / 2;
|
|
14163
|
+
}
|
|
14164
|
+
index += POINT_INDEX;
|
|
14165
|
+
}
|
|
14166
|
+
}
|
|
14167
|
+
/**
|
|
14168
|
+
* 根据新老版形状数据获取形状几何数据
|
|
14169
|
+
* @param shape 新老版形状数据
|
|
14170
|
+
*/ function getGeometriesByShapeData(shape) {
|
|
14171
|
+
const geometries = [];
|
|
14172
|
+
// 该版本的单个形状数据可以包含多个形状,可以加个埋点,五福之后没有就可以下掉
|
|
14173
|
+
if (shape.gs) {
|
|
14174
|
+
shape.gs.forEach((gs)=>{
|
|
14175
|
+
geometries.push({
|
|
14176
|
+
p: [
|
|
14177
|
+
ValueType.SHAPE_POINTS,
|
|
14178
|
+
gs.p
|
|
14179
|
+
],
|
|
14180
|
+
s: [
|
|
14181
|
+
ValueType.SHAPE_SPLITS,
|
|
14182
|
+
gs.s
|
|
14183
|
+
]
|
|
14184
|
+
});
|
|
14185
|
+
});
|
|
14186
|
+
} else if (shape.g) {
|
|
14187
|
+
geometries.push({
|
|
14188
|
+
p: [
|
|
14189
|
+
ValueType.SHAPE_POINTS,
|
|
14190
|
+
shape.g.p
|
|
14191
|
+
],
|
|
14192
|
+
s: [
|
|
14193
|
+
ValueType.SHAPE_SPLITS,
|
|
14194
|
+
shape.g.s
|
|
14195
|
+
]
|
|
14196
|
+
});
|
|
14197
|
+
} else {
|
|
14198
|
+
geometries.push(shape);
|
|
14199
|
+
}
|
|
14200
|
+
return geometries;
|
|
14201
|
+
}
|
|
14202
|
+
function getGeometryByShape(shape, uvTransform) {
|
|
14203
|
+
const datas = [];
|
|
14204
|
+
// 老数据兼容处理
|
|
14205
|
+
const geometries = getGeometriesByShapeData(shape);
|
|
14206
|
+
let indexBase = 0;
|
|
14207
|
+
let aPoint = 0;
|
|
14208
|
+
let index = 0;
|
|
14209
|
+
for(let i = 0; i < geometries.length; i++){
|
|
14210
|
+
const geometry = geometries[i];
|
|
14211
|
+
const data = getGeometryTriangles(geometry, {
|
|
14212
|
+
indexBase,
|
|
14213
|
+
uvTransform
|
|
14214
|
+
});
|
|
14215
|
+
indexBase += data.aPoint.length / 5;
|
|
14216
|
+
datas.push(data);
|
|
14217
|
+
aPoint += data.aPoint.length;
|
|
14218
|
+
index += data.index.length;
|
|
14219
|
+
}
|
|
14220
|
+
if (datas.length === 1) {
|
|
14221
|
+
return datas[0];
|
|
14222
|
+
}
|
|
14223
|
+
const aPointData = new Float32Array(aPoint);
|
|
14224
|
+
const indexData = new Uint16Array(index);
|
|
14225
|
+
// @ts-expect-error
|
|
14226
|
+
for(let i = 0, pointIndex = 0, idx = 0; i < datas[i]; i++){
|
|
14227
|
+
const data = datas[i];
|
|
14228
|
+
aPointData.set(data.aPoint, pointIndex);
|
|
14229
|
+
pointIndex += data.aPoint.length;
|
|
14230
|
+
indexData.set(data.index, idx);
|
|
14231
|
+
idx += data.index.length;
|
|
14232
|
+
}
|
|
14233
|
+
return {
|
|
14234
|
+
aPoint: aPointData,
|
|
14235
|
+
index: indexData
|
|
14236
|
+
};
|
|
14237
|
+
}
|
|
14238
|
+
function rotateVec2(out, vec2, angleInRad) {
|
|
14239
|
+
const c = Math.cos(angleInRad);
|
|
14240
|
+
const s = Math.sin(angleInRad);
|
|
14241
|
+
const x = vec2[0];
|
|
14242
|
+
const y = vec2[1];
|
|
14243
|
+
out[0] = c * x + s * y;
|
|
14244
|
+
out[1] = -s * x + c * y;
|
|
14245
|
+
return out;
|
|
14246
|
+
}
|
|
14247
|
+
function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
|
|
14248
|
+
const ddt = 1 - t;
|
|
14249
|
+
const a = ddt * ddt * ddt;
|
|
14250
|
+
const b = 3 * t * ddt * ddt;
|
|
14251
|
+
const c = 3 * t * t * ddt;
|
|
14252
|
+
const d = t * t * t;
|
|
14253
|
+
out[0] = a * p0[0] + b * cpx0 + c * cpx1 + d * p1[0];
|
|
14254
|
+
out[1] = a * p0[1] + b * cpy0 + c * cpy1 + d * p1[1];
|
|
14255
|
+
return out;
|
|
14256
|
+
}
|
|
14257
|
+
|
|
14258
|
+
/**
|
|
14259
|
+
* @since 2.0.0
|
|
14260
|
+
* @internal
|
|
14261
|
+
*/ class Track extends PlayableAsset {
|
|
14262
|
+
createOutput() {
|
|
14263
|
+
const output = new PlayableOutput();
|
|
14264
|
+
return output;
|
|
14265
|
+
}
|
|
14266
|
+
/**
|
|
14267
|
+
* 重写该方法以创建自定义混合器
|
|
14268
|
+
*/ createMixerPlayable() {
|
|
14269
|
+
return new Playable();
|
|
14270
|
+
}
|
|
14271
|
+
createPlayable() {
|
|
14272
|
+
const defaultMixPlayable = this.createMixerPlayable();
|
|
14273
|
+
for (const clip of this.clips){
|
|
14274
|
+
defaultMixPlayable.connect(clip.playable);
|
|
14275
|
+
}
|
|
14276
|
+
return defaultMixPlayable;
|
|
14277
|
+
}
|
|
14278
|
+
createClip(classConstructor, name) {
|
|
14279
|
+
const newClip = new TimelineClip();
|
|
14280
|
+
newClip.playable = new classConstructor();
|
|
14281
|
+
newClip.name = name ? name : 'TimelineClip' + newClip.id;
|
|
14282
|
+
this.addClip(newClip);
|
|
14283
|
+
return newClip;
|
|
14284
|
+
}
|
|
14285
|
+
getClips() {
|
|
14286
|
+
return this.clips;
|
|
14287
|
+
}
|
|
14288
|
+
findClip(name) {
|
|
14289
|
+
for (const clip of this.clips){
|
|
14290
|
+
if (clip.name === name) {
|
|
14291
|
+
return clip;
|
|
14292
|
+
}
|
|
14293
|
+
}
|
|
14294
|
+
}
|
|
14295
|
+
addClip(clip) {
|
|
14296
|
+
clip.playable.bindingItem = this.bindingItem;
|
|
14297
|
+
clip.id = (this.clipSeed++).toString();
|
|
14298
|
+
this.clips.push(clip);
|
|
14299
|
+
}
|
|
14300
|
+
constructor(...args){
|
|
14301
|
+
super(...args);
|
|
14302
|
+
this.clips = [];
|
|
14303
|
+
this.clipSeed = 0;
|
|
14304
|
+
}
|
|
14305
|
+
}
|
|
14306
|
+
/**
|
|
14307
|
+
* @since 2.0.0
|
|
14308
|
+
* @internal
|
|
14309
|
+
*/ class TimelineClip {
|
|
14310
|
+
constructor(){
|
|
14311
|
+
this.start = 0;
|
|
14312
|
+
this.duration = 0;
|
|
14313
|
+
}
|
|
14314
|
+
}
|
|
14315
|
+
|
|
14316
|
+
class AnimationStream {
|
|
14317
|
+
setCurveValue(componentType, propertyName, value) {
|
|
14318
|
+
if (!this.findCurveValue(componentType, propertyName)) {
|
|
14319
|
+
this.curveValues[componentType + propertyName] = {
|
|
14320
|
+
componentType,
|
|
14321
|
+
propertyName,
|
|
14322
|
+
value
|
|
14323
|
+
};
|
|
14324
|
+
} else {
|
|
14325
|
+
this.curveValues[componentType + propertyName].value = value;
|
|
14326
|
+
}
|
|
14327
|
+
return this.curveValues[componentType + propertyName];
|
|
14328
|
+
}
|
|
14329
|
+
findCurveValue(componentType, propertyName) {
|
|
14330
|
+
return this.curveValues[componentType + propertyName];
|
|
14331
|
+
}
|
|
14332
|
+
getInputStream(index) {
|
|
14333
|
+
const inputPlayable = this.playable.getInput(index);
|
|
14334
|
+
if (inputPlayable instanceof AnimationPlayable) {
|
|
14335
|
+
return inputPlayable.animationStream;
|
|
14336
|
+
}
|
|
14337
|
+
}
|
|
14338
|
+
constructor(playable){
|
|
14339
|
+
this.curveValues = {};
|
|
14340
|
+
this.playable = playable;
|
|
14341
|
+
}
|
|
14342
|
+
}
|
|
14343
|
+
|
|
14344
|
+
class AnimationPlayable extends Playable {
|
|
14345
|
+
constructor(){
|
|
14346
|
+
super();
|
|
14347
|
+
this.animationStream = new AnimationStream(this);
|
|
14348
|
+
}
|
|
14349
|
+
}
|
|
14350
|
+
|
|
14351
|
+
const tempRot$1 = new Euler();
|
|
14352
|
+
const tempSize$1 = new Vector3(1, 1, 1);
|
|
14353
|
+
const tempPos = new Vector3();
|
|
14354
|
+
/**
|
|
14355
|
+
* @since 2.0.0
|
|
14356
|
+
* @internal
|
|
14357
|
+
*/ class TransformAnimationPlayable extends AnimationPlayable {
|
|
14358
|
+
processFrame(dt) {
|
|
14359
|
+
if (this.bindingItem.composition) {
|
|
14360
|
+
this.sampleAnimation();
|
|
14361
|
+
}
|
|
14362
|
+
}
|
|
14363
|
+
/**
|
|
14364
|
+
* 应用时间轴K帧数据到对象
|
|
14365
|
+
*/ sampleAnimation() {
|
|
14366
|
+
const duration = this.bindingItem.duration;
|
|
14367
|
+
let life = this.time / duration;
|
|
14368
|
+
life = life < 0 ? 0 : life > 1 ? 1 : life;
|
|
14369
|
+
if (this.sizeXOverLifetime) {
|
|
14370
|
+
tempSize$1.x = this.sizeXOverLifetime.getValue(life);
|
|
14371
|
+
if (this.sizeSeparateAxes) {
|
|
14372
|
+
tempSize$1.y = this.sizeYOverLifetime.getValue(life);
|
|
14373
|
+
tempSize$1.z = this.sizeZOverLifetime.getValue(life);
|
|
14374
|
+
} else {
|
|
14375
|
+
tempSize$1.z = tempSize$1.y = tempSize$1.x;
|
|
14376
|
+
}
|
|
14377
|
+
const startSize = this.originalTransform.scale;
|
|
14378
|
+
this.bindingItem.transform.setScale(tempSize$1.x * startSize.x, tempSize$1.y * startSize.y, tempSize$1.z * startSize.z);
|
|
14379
|
+
// this.animationStream.setCurveValue('transform', 'scale.x', tempSize.x * startSize.x);
|
|
14380
|
+
// this.animationStream.setCurveValue('transform', 'scale.y', tempSize.y * startSize.y);
|
|
14381
|
+
// this.animationStream.setCurveValue('transform', 'scale.z', tempSize.z * startSize.z);
|
|
14382
|
+
}
|
|
14383
|
+
if (this.rotationOverLifetime) {
|
|
14384
|
+
const func = (v)=>this.rotationOverLifetime.asRotation ? v.getValue(life) : v.getIntegrateValue(0, life, duration);
|
|
14385
|
+
const incZ = func(this.rotationOverLifetime.z);
|
|
14386
|
+
const separateAxes = this.rotationOverLifetime.separateAxes;
|
|
14387
|
+
tempRot$1.x = separateAxes ? func(this.rotationOverLifetime.x) : 0;
|
|
14388
|
+
tempRot$1.y = separateAxes ? func(this.rotationOverLifetime.y) : 0;
|
|
14389
|
+
tempRot$1.z = incZ;
|
|
14390
|
+
const rot = tempRot$1.addEulers(this.originalTransform.rotation, tempRot$1);
|
|
14391
|
+
this.bindingItem.transform.setRotation(rot.x, rot.y, rot.z);
|
|
14392
|
+
// this.animationStream.setCurveValue('transform', 'rotation.x', rot.x);
|
|
14393
|
+
// this.animationStream.setCurveValue('transform', 'rotation.y', rot.y);
|
|
14394
|
+
// this.animationStream.setCurveValue('transform', 'rotation.z', rot.z);
|
|
14395
|
+
}
|
|
14396
|
+
if (this.positionOverLifetime) {
|
|
14397
|
+
const pos = tempPos;
|
|
14398
|
+
calculateTranslation(pos, this, this.gravity, this.time, duration, this.originalTransform.position, this.velocity);
|
|
14399
|
+
if (this.originalTransform.path) {
|
|
14400
|
+
pos.add(this.originalTransform.path.getValue(life));
|
|
14401
|
+
}
|
|
14402
|
+
this.bindingItem.transform.setPosition(pos.x, pos.y, pos.z);
|
|
14403
|
+
// this.animationStream.setCurveValue('transform', 'position.x', pos.x);
|
|
14404
|
+
// this.animationStream.setCurveValue('transform', 'position.y', pos.y);
|
|
14405
|
+
// this.animationStream.setCurveValue('transform', 'position.z', pos.z);
|
|
14406
|
+
}
|
|
14407
|
+
}
|
|
14408
|
+
fromData(data) {
|
|
14409
|
+
const scale = this.bindingItem.transform.scale;
|
|
14410
|
+
this.originalTransform = {
|
|
14411
|
+
position: this.bindingItem.transform.position.clone(),
|
|
14412
|
+
rotation: this.bindingItem.transform.getRotation().clone(),
|
|
14413
|
+
// TODO 编辑器 scale 没有z轴控制
|
|
14414
|
+
scale: new Vector3(scale.x, scale.y, scale.x)
|
|
14415
|
+
};
|
|
14416
|
+
const positionOverLifetime = data.positionOverLifetime;
|
|
14417
|
+
const rotationOverLifetime = data.rotationOverLifetime;
|
|
14418
|
+
const sizeOverLifetime = data.sizeOverLifetime;
|
|
14419
|
+
// TODO: 没有 K 帧数据的不需要传 positionOverLifetime 空对象
|
|
14420
|
+
if (positionOverLifetime && Object.keys(positionOverLifetime).length !== 0) {
|
|
14421
|
+
this.positionOverLifetime = positionOverLifetime;
|
|
14422
|
+
if (positionOverLifetime.path) {
|
|
14423
|
+
this.originalTransform.path = createValueGetter(positionOverLifetime.path);
|
|
14424
|
+
}
|
|
14425
|
+
const linearVelEnable = positionOverLifetime.linearX || positionOverLifetime.linearY || positionOverLifetime.linearZ;
|
|
14426
|
+
if (linearVelEnable) {
|
|
14427
|
+
this.linearVelOverLifetime = {
|
|
14428
|
+
x: positionOverLifetime.linearX && createValueGetter(positionOverLifetime.linearX),
|
|
14429
|
+
y: positionOverLifetime.linearY && createValueGetter(positionOverLifetime.linearY),
|
|
14430
|
+
z: positionOverLifetime.linearZ && createValueGetter(positionOverLifetime.linearZ),
|
|
14431
|
+
asMovement: positionOverLifetime.asMovement,
|
|
14432
|
+
enabled: !!linearVelEnable
|
|
14433
|
+
};
|
|
14434
|
+
}
|
|
14435
|
+
const orbitalVelEnable = positionOverLifetime.orbitalX || positionOverLifetime.orbitalY || positionOverLifetime.orbitalZ;
|
|
14436
|
+
if (orbitalVelEnable) {
|
|
14437
|
+
this.orbitalVelOverLifetime = {
|
|
14438
|
+
x: positionOverLifetime.orbitalX && createValueGetter(positionOverLifetime.orbitalX),
|
|
14439
|
+
y: positionOverLifetime.orbitalY && createValueGetter(positionOverLifetime.orbitalY),
|
|
14440
|
+
z: positionOverLifetime.orbitalZ && createValueGetter(positionOverLifetime.orbitalZ),
|
|
14441
|
+
center: ensureVec3(positionOverLifetime.orbCenter),
|
|
14442
|
+
asRotation: positionOverLifetime.asRotation,
|
|
14443
|
+
enabled: !!orbitalVelEnable
|
|
14444
|
+
};
|
|
14445
|
+
}
|
|
14446
|
+
this.speedOverLifetime = positionOverLifetime.speedOverLifetime && createValueGetter(positionOverLifetime.speedOverLifetime);
|
|
14447
|
+
}
|
|
14448
|
+
if (sizeOverLifetime) {
|
|
14449
|
+
if (sizeOverLifetime.separateAxes) {
|
|
14450
|
+
this.sizeSeparateAxes = true;
|
|
14451
|
+
this.sizeXOverLifetime = createValueGetter(sizeOverLifetime.x || 1);
|
|
14452
|
+
this.sizeYOverLifetime = createValueGetter(sizeOverLifetime.y || 1);
|
|
14453
|
+
this.sizeZOverLifetime = createValueGetter(sizeOverLifetime.z || 1);
|
|
14454
|
+
} else {
|
|
14455
|
+
this.sizeXOverLifetime = createValueGetter(sizeOverLifetime.size || 1);
|
|
14456
|
+
}
|
|
14457
|
+
}
|
|
14458
|
+
if (rotationOverLifetime) {
|
|
14459
|
+
this.rotationOverLifetime = {
|
|
14460
|
+
asRotation: rotationOverLifetime.asRotation,
|
|
14461
|
+
separateAxes: rotationOverLifetime.separateAxes,
|
|
14462
|
+
z: createValueGetter(rotationOverLifetime.z || 0)
|
|
14463
|
+
};
|
|
14464
|
+
if (rotationOverLifetime.separateAxes) {
|
|
14465
|
+
const rotLt = this.rotationOverLifetime;
|
|
14466
|
+
rotLt.x = createValueGetter(rotationOverLifetime.x || 0);
|
|
14467
|
+
rotLt.y = createValueGetter(rotationOverLifetime.y || 0);
|
|
14468
|
+
}
|
|
14469
|
+
}
|
|
14470
|
+
this.gravity = Vector3.fromArray((positionOverLifetime == null ? void 0 : positionOverLifetime.gravity) || []);
|
|
14471
|
+
var _positionOverLifetime_gravityOverLifetime;
|
|
14472
|
+
this.gravityModifier = createValueGetter((_positionOverLifetime_gravityOverLifetime = positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime) != null ? _positionOverLifetime_gravityOverLifetime : 0);
|
|
14473
|
+
this.direction = (positionOverLifetime == null ? void 0 : positionOverLifetime.direction) ? Vector3.fromArray(positionOverLifetime.direction).normalize() : new Vector3();
|
|
14474
|
+
this.startSpeed = (positionOverLifetime == null ? void 0 : positionOverLifetime.startSpeed) || 0;
|
|
14475
|
+
this.velocity = this.direction.clone();
|
|
14476
|
+
this.velocity.multiply(this.startSpeed);
|
|
14477
|
+
}
|
|
14222
14478
|
}
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
|
|
14227
|
-
|
|
14479
|
+
class TransformAnimationPlayableAsset extends PlayableAsset {
|
|
14480
|
+
createPlayable() {
|
|
14481
|
+
const transformAnimationPlayable = new TransformAnimationPlayable();
|
|
14482
|
+
transformAnimationPlayable.fromData(this.transformAnimationData);
|
|
14483
|
+
return transformAnimationPlayable;
|
|
14484
|
+
}
|
|
14485
|
+
fromData(data) {
|
|
14486
|
+
this.transformAnimationData = data;
|
|
14228
14487
|
}
|
|
14229
|
-
return sum;
|
|
14230
14488
|
}
|
|
14231
|
-
|
|
14232
|
-
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
|
|
14237
|
-
|
|
14238
|
-
let outerNode = linkedList(data, 0, outerLen, dim, true);
|
|
14239
|
-
const triangles = [];
|
|
14240
|
-
if (!outerNode || outerNode.next === outerNode.prev) {
|
|
14241
|
-
return triangles;
|
|
14489
|
+
/**
|
|
14490
|
+
* @since 2.0.0
|
|
14491
|
+
* @internal
|
|
14492
|
+
*/ class ActivationPlayable extends Playable {
|
|
14493
|
+
onGraphStart() {
|
|
14494
|
+
this.bindingItem.transform.setValid(false);
|
|
14495
|
+
this.hideRendererComponents();
|
|
14242
14496
|
}
|
|
14243
|
-
|
|
14244
|
-
|
|
14245
|
-
|
|
14497
|
+
onPlayablePlay() {
|
|
14498
|
+
this.bindingItem.transform.setValid(true);
|
|
14499
|
+
this.showRendererComponents();
|
|
14246
14500
|
}
|
|
14247
|
-
|
|
14248
|
-
|
|
14249
|
-
|
|
14250
|
-
|
|
14251
|
-
|
|
14252
|
-
|
|
14253
|
-
|
|
14254
|
-
|
|
14255
|
-
minX = x;
|
|
14256
|
-
}
|
|
14257
|
-
if (y < minY) {
|
|
14258
|
-
minY = y;
|
|
14259
|
-
}
|
|
14260
|
-
if (x > maxX) {
|
|
14261
|
-
maxX = x;
|
|
14501
|
+
onPlayableDestroy() {
|
|
14502
|
+
this.bindingItem.transform.setValid(false);
|
|
14503
|
+
this.hideRendererComponents();
|
|
14504
|
+
}
|
|
14505
|
+
hideRendererComponents() {
|
|
14506
|
+
for (const rendererComponent of this.bindingItem.rendererComponents){
|
|
14507
|
+
if (rendererComponent.enabled) {
|
|
14508
|
+
rendererComponent.enabled = false;
|
|
14262
14509
|
}
|
|
14263
|
-
|
|
14264
|
-
|
|
14510
|
+
}
|
|
14511
|
+
}
|
|
14512
|
+
showRendererComponents() {
|
|
14513
|
+
for (const rendererComponent of this.bindingItem.rendererComponents){
|
|
14514
|
+
if (!rendererComponent.enabled) {
|
|
14515
|
+
rendererComponent.enabled = true;
|
|
14265
14516
|
}
|
|
14266
14517
|
}
|
|
14267
|
-
// minX, minY and invSize are later used to transform coords into integers for z-order calculation
|
|
14268
|
-
invSize = Math.max(maxX - minX, maxY - minY);
|
|
14269
|
-
invSize = invSize !== 0 ? 1 / invSize : 0;
|
|
14270
14518
|
}
|
|
14271
|
-
hackEarcutLinked(outerNode, triangles, dim, minX, minY, invSize);
|
|
14272
|
-
return triangles;
|
|
14273
14519
|
}
|
|
14274
|
-
|
|
14275
|
-
|
|
14276
|
-
|
|
14277
|
-
|
|
14278
|
-
|
|
14279
|
-
|
|
14280
|
-
|
|
14281
|
-
|
|
14520
|
+
class AnimationClip extends EffectsObject {
|
|
14521
|
+
sampleAnimation(vfxItem, time) {
|
|
14522
|
+
const duration = vfxItem.duration;
|
|
14523
|
+
let life = time / duration;
|
|
14524
|
+
life = life < 0 ? 0 : life > 1 ? 1 : life;
|
|
14525
|
+
for (const curve of this.positionCurves){
|
|
14526
|
+
const value = curve.keyFrames.getValue(life);
|
|
14527
|
+
const target = this.findTarget(vfxItem, curve.path);
|
|
14528
|
+
target == null ? void 0 : target.transform.setPosition(value.x, value.y, value.z);
|
|
14529
|
+
}
|
|
14530
|
+
for (const curve of this.eulerCurves){
|
|
14531
|
+
const value = curve.keyFrames.getValue(life);
|
|
14532
|
+
const target = this.findTarget(vfxItem, curve.path);
|
|
14533
|
+
target == null ? void 0 : target.transform.setRotation(value.x, value.y, value.z);
|
|
14534
|
+
}
|
|
14535
|
+
for (const curve of this.scaleCurves){
|
|
14536
|
+
const value = curve.keyFrames.getValue(life);
|
|
14537
|
+
const target = this.findTarget(vfxItem, curve.path);
|
|
14538
|
+
target == null ? void 0 : target.transform.setScale(value.x, value.y, value.z);
|
|
14539
|
+
}
|
|
14540
|
+
// TODO float curves 采样
|
|
14282
14541
|
}
|
|
14283
|
-
|
|
14284
|
-
|
|
14285
|
-
|
|
14286
|
-
|
|
14287
|
-
|
|
14288
|
-
|
|
14289
|
-
|
|
14290
|
-
|
|
14291
|
-
|
|
14292
|
-
|
|
14293
|
-
|
|
14294
|
-
// skipping the next vertex leads to less sliver triangles
|
|
14295
|
-
ear = next.next;
|
|
14296
|
-
stop = next.next;
|
|
14297
|
-
continue;
|
|
14542
|
+
fromData(data) {
|
|
14543
|
+
this.positionCurves.length = 0;
|
|
14544
|
+
this.eulerCurves.length = 0;
|
|
14545
|
+
this.scaleCurves.length = 0;
|
|
14546
|
+
this.floatCurves.length = 0;
|
|
14547
|
+
for (const positionCurveData of data.positionCurves){
|
|
14548
|
+
const curve = {
|
|
14549
|
+
path: positionCurveData.path,
|
|
14550
|
+
keyFrames: createValueGetter(positionCurveData.keyFrames)
|
|
14551
|
+
};
|
|
14552
|
+
this.positionCurves.push(curve);
|
|
14298
14553
|
}
|
|
14299
|
-
|
|
14300
|
-
|
|
14301
|
-
|
|
14302
|
-
|
|
14303
|
-
|
|
14304
|
-
|
|
14305
|
-
|
|
14306
|
-
|
|
14307
|
-
|
|
14308
|
-
|
|
14309
|
-
|
|
14310
|
-
}
|
|
14311
|
-
|
|
14554
|
+
for (const eulerCurveData of data.eulerCurves){
|
|
14555
|
+
const curve = {
|
|
14556
|
+
path: eulerCurveData.path,
|
|
14557
|
+
keyFrames: createValueGetter(eulerCurveData.keyFrames)
|
|
14558
|
+
};
|
|
14559
|
+
this.eulerCurves.push(curve);
|
|
14560
|
+
}
|
|
14561
|
+
for (const scaleCurvesData of data.scaleCurves){
|
|
14562
|
+
const curve = {
|
|
14563
|
+
path: scaleCurvesData.path,
|
|
14564
|
+
keyFrames: createValueGetter(scaleCurvesData.keyFrames)
|
|
14565
|
+
};
|
|
14566
|
+
this.scaleCurves.push(curve);
|
|
14567
|
+
}
|
|
14568
|
+
for (const floatCurveData of data.floatCurves){
|
|
14569
|
+
const curve = {
|
|
14570
|
+
path: floatCurveData.path,
|
|
14571
|
+
keyFrames: createValueGetter(floatCurveData.keyFrames),
|
|
14572
|
+
property: floatCurveData.property,
|
|
14573
|
+
className: floatCurveData.className
|
|
14574
|
+
};
|
|
14575
|
+
this.floatCurves.push(curve);
|
|
14576
|
+
}
|
|
14577
|
+
}
|
|
14578
|
+
findTarget(vfxItem, path) {
|
|
14579
|
+
let target = vfxItem;
|
|
14580
|
+
for (const name of path){
|
|
14581
|
+
let findTag = false;
|
|
14582
|
+
for (const child of target.children){
|
|
14583
|
+
if (child.name === name) {
|
|
14584
|
+
target = child;
|
|
14585
|
+
findTag = true;
|
|
14586
|
+
break;
|
|
14587
|
+
}
|
|
14588
|
+
}
|
|
14589
|
+
if (!findTag) {
|
|
14590
|
+
return;
|
|
14312
14591
|
}
|
|
14313
|
-
break;
|
|
14314
14592
|
}
|
|
14593
|
+
return target;
|
|
14594
|
+
}
|
|
14595
|
+
constructor(...args){
|
|
14596
|
+
super(...args);
|
|
14597
|
+
this.positionCurves = [];
|
|
14598
|
+
this.eulerCurves = [];
|
|
14599
|
+
this.scaleCurves = [];
|
|
14600
|
+
this.floatCurves = [];
|
|
14315
14601
|
}
|
|
14316
14602
|
}
|
|
14317
|
-
|
|
14318
|
-
|
|
14319
|
-
|
|
14320
|
-
|
|
14321
|
-
const a = p.prev, b = p.next.next;
|
|
14322
|
-
if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
|
|
14323
|
-
triangles.push(a.i / dim + indexBase);
|
|
14324
|
-
triangles.push(p.i / dim + indexBase);
|
|
14325
|
-
triangles.push(b.i / dim + indexBase);
|
|
14326
|
-
// remove two nodes involved
|
|
14327
|
-
removeNode(p);
|
|
14328
|
-
removeNode(p.next);
|
|
14329
|
-
p = start = b;
|
|
14603
|
+
class AnimationClipPlayable extends Playable {
|
|
14604
|
+
processFrame(dt) {
|
|
14605
|
+
if (this.bindingItem.composition) {
|
|
14606
|
+
this.clip.sampleAnimation(this.bindingItem, this.time);
|
|
14330
14607
|
}
|
|
14331
|
-
|
|
14332
|
-
|
|
14333
|
-
|
|
14608
|
+
}
|
|
14609
|
+
fromData(data) {
|
|
14610
|
+
this.clip = data.clip;
|
|
14611
|
+
}
|
|
14334
14612
|
}
|
|
14335
|
-
|
|
14336
|
-
|
|
14337
|
-
|
|
14338
|
-
|
|
14339
|
-
|
|
14340
|
-
|
|
14341
|
-
|
|
14342
|
-
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
|
|
14613
|
+
|
|
14614
|
+
/**
|
|
14615
|
+
* @since 2.0.0
|
|
14616
|
+
* @internal
|
|
14617
|
+
*/ class TimelineComponent extends ItemBehaviour {
|
|
14618
|
+
start() {
|
|
14619
|
+
// TODO TimelineClip 需要传入 start 和 duration 数据
|
|
14620
|
+
for (const track of this.tracks){
|
|
14621
|
+
for (const clip of track.getClips()){
|
|
14622
|
+
clip.start = this.item.start;
|
|
14623
|
+
clip.duration = this.item.duration;
|
|
14624
|
+
}
|
|
14625
|
+
}
|
|
14626
|
+
this.compileTracks(this.playableGraph);
|
|
14627
|
+
}
|
|
14628
|
+
// TODO: [1.31] @十弦 vfx-item 下 onUpdate 的改动验证
|
|
14629
|
+
update(dt) {
|
|
14630
|
+
if (this.item.stopped || !this.item.composition) {
|
|
14631
|
+
return;
|
|
14632
|
+
}
|
|
14633
|
+
if (!this.timelineStarted) {
|
|
14634
|
+
for (const track of this.tracks){
|
|
14635
|
+
for (const clip of track.getClips()){
|
|
14636
|
+
clip.playable.onGraphStart();
|
|
14637
|
+
}
|
|
14638
|
+
}
|
|
14639
|
+
this.timelineStarted = true;
|
|
14640
|
+
}
|
|
14641
|
+
const now = this.time;
|
|
14642
|
+
// 判断动画是否开始
|
|
14643
|
+
if (this.item.delaying && now >= 0 && now <= this.item.duration) {
|
|
14644
|
+
this.item.delaying = false;
|
|
14645
|
+
for (const track of this.tracks){
|
|
14646
|
+
for (const clip of track.getClips()){
|
|
14647
|
+
clip.playable.onPlayablePlay();
|
|
14648
|
+
}
|
|
14649
|
+
}
|
|
14650
|
+
}
|
|
14651
|
+
// 判断动画是否结束
|
|
14652
|
+
let ended;
|
|
14653
|
+
if (VFXItem.isParticle(this.item)) {
|
|
14654
|
+
ended = this.item.isEnded(now) && this.item.content.destoryed;
|
|
14655
|
+
} else {
|
|
14656
|
+
ended = this.item.isEnded(now);
|
|
14657
|
+
}
|
|
14658
|
+
if (ended) {
|
|
14659
|
+
const endBehavior = this.item.endBehavior;
|
|
14660
|
+
if (!this.item.ended) {
|
|
14661
|
+
this.item.ended = true;
|
|
14662
|
+
this.item.onEnd();
|
|
14663
|
+
if (endBehavior === ItemEndBehavior.destroy) {
|
|
14664
|
+
for (const track of this.tracks){
|
|
14665
|
+
for (const clip of track.getClips()){
|
|
14666
|
+
clip.playable.onPlayableDestroy();
|
|
14667
|
+
}
|
|
14668
|
+
}
|
|
14669
|
+
this.item.delaying = true;
|
|
14670
|
+
if (!this.item.reusable && !this.reusable) {
|
|
14671
|
+
this.item.dispose();
|
|
14672
|
+
return;
|
|
14673
|
+
}
|
|
14674
|
+
}
|
|
14352
14675
|
}
|
|
14353
|
-
b = b.next;
|
|
14354
14676
|
}
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
|
|
14367
|
-
pointCount += segment.length - 1;
|
|
14677
|
+
// TODO: [1.31] @茂安 验证 https://github.com/galacean/effects-runtime/commits/main/packages/effects-core/src/vfx-item.ts
|
|
14678
|
+
// 在生命周期内更新动画
|
|
14679
|
+
if (!this.item.delaying) {
|
|
14680
|
+
const lifetime = this.time / this.item.duration;
|
|
14681
|
+
this.item.lifetime = lifetime;
|
|
14682
|
+
for (const track of this.tracks){
|
|
14683
|
+
for (const clip of track.getClips()){
|
|
14684
|
+
clip.playable.setTime(this.time);
|
|
14685
|
+
}
|
|
14686
|
+
}
|
|
14687
|
+
this.playableGraph.evaluate(dt);
|
|
14688
|
+
}
|
|
14368
14689
|
}
|
|
14369
|
-
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
let dx = 0, dy = 0, sw = 1, sh = 1, r;
|
|
14373
|
-
if (uvTransform) {
|
|
14374
|
-
dx = uvTransform[0];
|
|
14375
|
-
dy = uvTransform[1];
|
|
14376
|
-
r = uvTransform[4];
|
|
14377
|
-
sw = r ? uvTransform[3] : uvTransform[2];
|
|
14378
|
-
sh = r ? uvTransform[2] : uvTransform[3];
|
|
14690
|
+
// time 单位秒
|
|
14691
|
+
setTime(time) {
|
|
14692
|
+
this.time = time;
|
|
14379
14693
|
}
|
|
14380
|
-
|
|
14381
|
-
|
|
14382
|
-
|
|
14383
|
-
|
|
14384
|
-
|
|
14385
|
-
|
|
14386
|
-
|
|
14387
|
-
|
|
14388
|
-
|
|
14389
|
-
|
|
14390
|
-
|
|
14391
|
-
|
|
14392
|
-
0
|
|
14393
|
-
];
|
|
14394
|
-
for(let j = 0; j < keys.length - 1; j++){
|
|
14395
|
-
const key = keys[j];
|
|
14396
|
-
getBezier2DValue(point, key, p0, p1, p0[4], p0[5], p1[2], p1[3]);
|
|
14397
|
-
setPoint(point[0], point[1]);
|
|
14694
|
+
getTime() {
|
|
14695
|
+
return this.time;
|
|
14696
|
+
}
|
|
14697
|
+
toLocalTime(time) {
|
|
14698
|
+
let localTime = time - this.options.start;
|
|
14699
|
+
const duration = this.options.duration;
|
|
14700
|
+
if (localTime - duration > 0.001) {
|
|
14701
|
+
if (this.options.endBehavior === END_BEHAVIOR_RESTART) {
|
|
14702
|
+
localTime = localTime % duration;
|
|
14703
|
+
} else if (this.options.endBehavior === END_BEHAVIOR_FREEZE) {
|
|
14704
|
+
localTime = Math.min(duration, localTime);
|
|
14705
|
+
}
|
|
14398
14706
|
}
|
|
14707
|
+
return localTime;
|
|
14399
14708
|
}
|
|
14400
|
-
|
|
14401
|
-
|
|
14402
|
-
|
|
14403
|
-
|
|
14404
|
-
|
|
14405
|
-
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
pointData[index++] = (y + 1) / 2;
|
|
14709
|
+
createTrack(classConstructor, name) {
|
|
14710
|
+
const newTrack = new classConstructor();
|
|
14711
|
+
newTrack.bindingItem = this.item;
|
|
14712
|
+
newTrack.id = (this.trackSeed++).toString();
|
|
14713
|
+
newTrack.name = name ? name : 'Track' + newTrack.id;
|
|
14714
|
+
this.tracks.push(newTrack);
|
|
14715
|
+
return newTrack;
|
|
14716
|
+
}
|
|
14717
|
+
getTracks() {
|
|
14718
|
+
return this.tracks;
|
|
14719
|
+
}
|
|
14720
|
+
findTrack(name) {
|
|
14721
|
+
for (const track of this.tracks){
|
|
14722
|
+
if (track.name === name) {
|
|
14723
|
+
return track;
|
|
14724
|
+
}
|
|
14417
14725
|
}
|
|
14418
|
-
index += POINT_INDEX;
|
|
14419
14726
|
}
|
|
14420
|
-
|
|
14421
|
-
|
|
14422
|
-
|
|
14423
|
-
* @param shape 新老版形状数据
|
|
14424
|
-
*/ function getGeometriesByShapeData(shape) {
|
|
14425
|
-
const geometries = [];
|
|
14426
|
-
// 该版本的单个形状数据可以包含多个形状,可以加个埋点,五福之后没有就可以下掉
|
|
14427
|
-
if (shape.gs) {
|
|
14428
|
-
shape.gs.forEach((gs)=>{
|
|
14429
|
-
geometries.push({
|
|
14430
|
-
p: [
|
|
14431
|
-
ValueType.SHAPE_POINTS,
|
|
14432
|
-
gs.p
|
|
14433
|
-
],
|
|
14434
|
-
s: [
|
|
14435
|
-
ValueType.SHAPE_SPLITS,
|
|
14436
|
-
gs.s
|
|
14437
|
-
]
|
|
14438
|
-
});
|
|
14439
|
-
});
|
|
14440
|
-
} else if (shape.g) {
|
|
14441
|
-
geometries.push({
|
|
14442
|
-
p: [
|
|
14443
|
-
ValueType.SHAPE_POINTS,
|
|
14444
|
-
shape.g.p
|
|
14445
|
-
],
|
|
14446
|
-
s: [
|
|
14447
|
-
ValueType.SHAPE_SPLITS,
|
|
14448
|
-
shape.g.s
|
|
14449
|
-
]
|
|
14450
|
-
});
|
|
14451
|
-
} else {
|
|
14452
|
-
geometries.push(shape);
|
|
14727
|
+
rebuildGraph() {
|
|
14728
|
+
this.playableGraph = new PlayableGraph();
|
|
14729
|
+
this.compileTracks(this.playableGraph);
|
|
14453
14730
|
}
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
let aPoint = 0;
|
|
14462
|
-
let index = 0;
|
|
14463
|
-
for(let i = 0; i < geometries.length; i++){
|
|
14464
|
-
const geometry = geometries[i];
|
|
14465
|
-
const data = getGeometryTriangles(geometry, {
|
|
14466
|
-
indexBase,
|
|
14467
|
-
uvTransform
|
|
14468
|
-
});
|
|
14469
|
-
indexBase += data.aPoint.length / 5;
|
|
14470
|
-
datas.push(data);
|
|
14471
|
-
aPoint += data.aPoint.length;
|
|
14472
|
-
index += data.index.length;
|
|
14731
|
+
compileTracks(graph) {
|
|
14732
|
+
for (const track of this.tracks){
|
|
14733
|
+
const trackMixPlayable = track.createPlayable();
|
|
14734
|
+
const trackOutput = track.createOutput();
|
|
14735
|
+
graph.addOutput(trackOutput);
|
|
14736
|
+
trackOutput.setSourcePlayeble(trackMixPlayable);
|
|
14737
|
+
}
|
|
14473
14738
|
}
|
|
14474
|
-
|
|
14475
|
-
|
|
14739
|
+
fromData(data) {
|
|
14740
|
+
super.fromData(data);
|
|
14741
|
+
this.options = {
|
|
14742
|
+
start: this.item.start,
|
|
14743
|
+
duration: this.item.duration,
|
|
14744
|
+
looping: this.item.endBehavior === ItemEndBehavior.loop,
|
|
14745
|
+
endBehavior: this.item.endBehavior || ItemEndBehavior.destroy
|
|
14746
|
+
};
|
|
14747
|
+
this.id = this.item.id;
|
|
14748
|
+
this.name = this.item.name;
|
|
14749
|
+
const activationTrack = this.createTrack(Track, 'ActivationTrack');
|
|
14750
|
+
activationTrack.createClip(ActivationPlayable, 'ActivationTimelineClip');
|
|
14751
|
+
//@ts-expect-error
|
|
14752
|
+
if (data.tracks) {
|
|
14753
|
+
//@ts-expect-error
|
|
14754
|
+
const tracks = data.tracks;
|
|
14755
|
+
for (const track of tracks){
|
|
14756
|
+
const newTrack = this.createTrack(Track);
|
|
14757
|
+
for (const clipAsset of track.clips){
|
|
14758
|
+
switch(clipAsset.dataType){
|
|
14759
|
+
case 'TransformAnimationPlayableAsset':
|
|
14760
|
+
newTrack.name = 'TransformAnimationTrack';
|
|
14761
|
+
newTrack.createClip(TransformAnimationPlayable, 'TransformAnimationTimelineClip').playable.fromData(clipAsset.animationClip);
|
|
14762
|
+
break;
|
|
14763
|
+
case 'SpriteColorAnimationPlayableAsset':
|
|
14764
|
+
newTrack.name = 'SpriteColorTrack';
|
|
14765
|
+
newTrack.createClip(SpriteColorPlayable, 'SpriteColorClip').playable.fromData(clipAsset.animationClip);
|
|
14766
|
+
break;
|
|
14767
|
+
case 'AnimationClipPlayableAsset':
|
|
14768
|
+
newTrack.name = 'AnimationTrack';
|
|
14769
|
+
newTrack.createClip(AnimationClipPlayable, 'AnimationTimelineClip').playable.fromData(clipAsset.animationClip);
|
|
14770
|
+
break;
|
|
14771
|
+
}
|
|
14772
|
+
}
|
|
14773
|
+
}
|
|
14774
|
+
}
|
|
14476
14775
|
}
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14776
|
+
toData() {
|
|
14777
|
+
super.toData();
|
|
14778
|
+
}
|
|
14779
|
+
constructor(engine){
|
|
14780
|
+
super(engine);
|
|
14781
|
+
this.reusable = false;
|
|
14782
|
+
this.timelineStarted = false;
|
|
14783
|
+
this.playableGraph = new PlayableGraph();
|
|
14784
|
+
/**
|
|
14785
|
+
* 元素动画已经播放的时间
|
|
14786
|
+
*/ this.time = 0;
|
|
14787
|
+
this.tracks = [];
|
|
14788
|
+
this.trackSeed = 0;
|
|
14486
14789
|
}
|
|
14487
|
-
return {
|
|
14488
|
-
aPoint: aPointData,
|
|
14489
|
-
index: indexData
|
|
14490
|
-
};
|
|
14491
|
-
}
|
|
14492
|
-
function rotateVec2(out, vec2, angleInRad) {
|
|
14493
|
-
const c = Math.cos(angleInRad);
|
|
14494
|
-
const s = Math.sin(angleInRad);
|
|
14495
|
-
const x = vec2[0];
|
|
14496
|
-
const y = vec2[1];
|
|
14497
|
-
out[0] = c * x + s * y;
|
|
14498
|
-
out[1] = -s * x + c * y;
|
|
14499
|
-
return out;
|
|
14500
|
-
}
|
|
14501
|
-
function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
|
|
14502
|
-
const ddt = 1 - t;
|
|
14503
|
-
const a = ddt * ddt * ddt;
|
|
14504
|
-
const b = 3 * t * ddt * ddt;
|
|
14505
|
-
const c = 3 * t * t * ddt;
|
|
14506
|
-
const d = t * t * t;
|
|
14507
|
-
out[0] = a * p0[0] + b * cpx0 + c * cpx1 + d * p1[0];
|
|
14508
|
-
out[1] = a * p0[1] + b * cpy0 + c * cpy1 + d * p1[1];
|
|
14509
|
-
return out;
|
|
14510
14790
|
}
|
|
14791
|
+
__decorate([
|
|
14792
|
+
serialize()
|
|
14793
|
+
], TimelineComponent.prototype, "time", void 0);
|
|
14511
14794
|
|
|
14512
14795
|
class Burst {
|
|
14513
14796
|
getGeneratorOptions(timePassed, lifetime) {
|
|
@@ -19299,7 +19582,6 @@ function getStandardCameraContent(model) {
|
|
|
19299
19582
|
}
|
|
19300
19583
|
}
|
|
19301
19584
|
});
|
|
19302
|
-
const itemGuidMap = {};
|
|
19303
19585
|
for (const item of composition.items){
|
|
19304
19586
|
itemGuidMap[item.id] = generateGUID();
|
|
19305
19587
|
// TODO: 编辑器测试用,上线后删除
|
|
@@ -20872,14 +21154,6 @@ const tmpScale = new Vector3(1, 1, 1);
|
|
|
20872
21154
|
* 也负责 Item 相关的动画播放控制,和持有渲染帧数据。
|
|
20873
21155
|
*/ class Composition {
|
|
20874
21156
|
/**
|
|
20875
|
-
* 合成结束回调
|
|
20876
|
-
* @param {(composition: Composition) => void} func
|
|
20877
|
-
* @deprecated since 2.0 - use `onEnd` instead
|
|
20878
|
-
*/ set handleEnd(func) {
|
|
20879
|
-
console.warn('The handleEnd property is deprecated. Use onEnd instead.');
|
|
20880
|
-
this.onEnd = func;
|
|
20881
|
-
}
|
|
20882
|
-
/**
|
|
20883
21157
|
* 获取场景中的纹理数组
|
|
20884
21158
|
*/ get textures() {
|
|
20885
21159
|
return this.compositionSourceManager.textures;
|
|
@@ -22546,5 +22820,5 @@ registerPlugin('particle', ParticleLoader, VFXItem, true);
|
|
|
22546
22820
|
registerPlugin('cal', CalculateLoader, VFXItem, true);
|
|
22547
22821
|
registerPlugin('interact', InteractLoader, VFXItem, true);
|
|
22548
22822
|
|
|
22549
|
-
export { AbstractPlugin, ActivationPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FilterMode, Float16ArrayWrapper,
|
|
22823
|
+
export { AbstractPlugin, ActivationPlayable, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractBehavior, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, 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, 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, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteComponent, SpriteLoader, StaticValue, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextLoader, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineClip, TimelineComponent, Track, Transform, TransformAnimationPlayable, TransformAnimationPlayableAsset, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, assertExist, asserts, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, decimalEqual, deepClone, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAndroid, isArray, isFunction, isIOS, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isWebGL2, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, maxSpriteTextureCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, pointOnLine, random, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxFragmentTextures, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, vertexFormatType2GLType };
|
|
22550
22824
|
//# sourceMappingURL=index.mjs.map
|