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