@galacean/effects-threejs 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/index.js +1872 -1570
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +1865 -1569
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.12
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -3959,6 +3959,17 @@ Euler.tempMat0 = new Matrix4();
|
|
|
3959
3959
|
* 水平右侧 垂直底部
|
|
3960
3960
|
*/ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_RIGHT_BOTTOM"] = 8] = "PARTICLE_ORIGIN_RIGHT_BOTTOM";
|
|
3961
3961
|
})(ParticleOrigin || (ParticleOrigin = {}));
|
|
3962
|
+
var RenderType;
|
|
3963
|
+
(function(RenderType) {
|
|
3964
|
+
RenderType["Opaque"] = "Opaque";
|
|
3965
|
+
RenderType["Transparent"] = "Transparent";
|
|
3966
|
+
})(RenderType || (RenderType = {}));
|
|
3967
|
+
var RenderFace;
|
|
3968
|
+
(function(RenderFace) {
|
|
3969
|
+
RenderFace["Both"] = "Both";
|
|
3970
|
+
RenderFace["Back"] = "Back";
|
|
3971
|
+
RenderFace["Front"] = "Front";
|
|
3972
|
+
})(RenderFace || (RenderFace = {}));
|
|
3962
3973
|
|
|
3963
3974
|
var END_BEHAVIOR_DESTROY = 0;
|
|
3964
3975
|
var END_BEHAVIOR_PAUSE = 1;
|
|
@@ -4278,6 +4289,7 @@ var DataType;
|
|
|
4278
4289
|
DataType["CameraController"] = "CameraController";
|
|
4279
4290
|
DataType["Geometry"] = "Geometry";
|
|
4280
4291
|
DataType["Texture"] = "Texture";
|
|
4292
|
+
DataType["AnimationClip"] = "AnimationClip";
|
|
4281
4293
|
DataType["TextComponent"] = "TextComponent";
|
|
4282
4294
|
// FIXME: 先完成ECS的场景转换,后面移到spec中
|
|
4283
4295
|
DataType["MeshComponent"] = "MeshComponent";
|
|
@@ -4311,6 +4323,60 @@ var GeometryType;
|
|
|
4311
4323
|
* Draw a connected group of triangles. Each vertex connects to the previous and the first vertex in the fan.
|
|
4312
4324
|
*/ GeometryType[GeometryType["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN";
|
|
4313
4325
|
})(GeometryType || (GeometryType = {}));
|
|
4326
|
+
var VertexFormatType;
|
|
4327
|
+
(function(VertexFormatType) {
|
|
4328
|
+
VertexFormatType[VertexFormatType["Float32"] = 0] = "Float32";
|
|
4329
|
+
VertexFormatType[VertexFormatType["Int16"] = 1] = "Int16";
|
|
4330
|
+
VertexFormatType[VertexFormatType["Int8"] = 2] = "Int8";
|
|
4331
|
+
VertexFormatType[VertexFormatType["UInt16"] = 3] = "UInt16";
|
|
4332
|
+
VertexFormatType[VertexFormatType["UInt8"] = 4] = "UInt8";
|
|
4333
|
+
})(VertexFormatType || (VertexFormatType = {}));
|
|
4334
|
+
var IndexFormatType;
|
|
4335
|
+
(function(IndexFormatType) {
|
|
4336
|
+
IndexFormatType[IndexFormatType["UInt16"] = 0] = "UInt16";
|
|
4337
|
+
IndexFormatType[IndexFormatType["UInt32"] = 1] = "UInt32";
|
|
4338
|
+
})(IndexFormatType || (IndexFormatType = {}));
|
|
4339
|
+
// BINORMAL[n] Binormal float4
|
|
4340
|
+
// BLENDINDICES[n] 混合索引 uint
|
|
4341
|
+
// BLENDWEIGHT[n] 混合权重 FLOAT
|
|
4342
|
+
// COLOR[n] 漫射和反射颜色 float4
|
|
4343
|
+
// NORMAL[n] 法向矢量 float4
|
|
4344
|
+
// POSITION[n] 对象空间中的顶点位置。 float4
|
|
4345
|
+
// POSITIONT 变换的顶点位置。 float4
|
|
4346
|
+
// PSIZE[n] 点大小 FLOAT
|
|
4347
|
+
// TANGENT[n] 正切 float4
|
|
4348
|
+
// TEXCOORD[n] 纹理坐标 float4
|
|
4349
|
+
// POSITION_BS[n] Blend Shape 空间中的顶点位置 float4
|
|
4350
|
+
// NORMAL_BS[n] Blend Shape 空间中的法向矢量 float4
|
|
4351
|
+
// TANGENT_BS[n] Blend Shape 空间中的正切矢量 float4
|
|
4352
|
+
var VertexBufferSemantic;
|
|
4353
|
+
(function(VertexBufferSemantic) {
|
|
4354
|
+
VertexBufferSemantic["Position"] = "POSITION";
|
|
4355
|
+
VertexBufferSemantic["Uv"] = "TEXCOORD0";
|
|
4356
|
+
VertexBufferSemantic["Uv2"] = "TEXCOORD1";
|
|
4357
|
+
VertexBufferSemantic["Normal"] = "NORMAL";
|
|
4358
|
+
VertexBufferSemantic["Tangent"] = "TANGENT";
|
|
4359
|
+
VertexBufferSemantic["Color"] = "COLOR";
|
|
4360
|
+
VertexBufferSemantic["Joints"] = "JOINTS";
|
|
4361
|
+
VertexBufferSemantic["Weights"] = "WEIGHTS";
|
|
4362
|
+
//
|
|
4363
|
+
VertexBufferSemantic["PositionBS0"] = "POSITION_BS0";
|
|
4364
|
+
VertexBufferSemantic["PositionBS1"] = "POSITION_BS1";
|
|
4365
|
+
VertexBufferSemantic["PositionBS2"] = "POSITION_BS2";
|
|
4366
|
+
VertexBufferSemantic["PositionBS3"] = "POSITION_BS3";
|
|
4367
|
+
VertexBufferSemantic["PositionBS4"] = "POSITION_BS4";
|
|
4368
|
+
VertexBufferSemantic["PositionBS5"] = "POSITION_BS5";
|
|
4369
|
+
VertexBufferSemantic["PositionBS6"] = "POSITION_BS6";
|
|
4370
|
+
VertexBufferSemantic["PositionBS7"] = "POSITION_BS7";
|
|
4371
|
+
VertexBufferSemantic["NormalBS0"] = "NORMAL_BS0";
|
|
4372
|
+
VertexBufferSemantic["NormalBS1"] = "NORMAL_BS1";
|
|
4373
|
+
VertexBufferSemantic["NormalBS2"] = "NORMAL_BS2";
|
|
4374
|
+
VertexBufferSemantic["NormalBS3"] = "NORMAL_BS3";
|
|
4375
|
+
VertexBufferSemantic["TangentBS0"] = "TANGENT_BS0";
|
|
4376
|
+
VertexBufferSemantic["TangentBS1"] = "TANGENT_BS1";
|
|
4377
|
+
VertexBufferSemantic["TangentBS2"] = "TANGENT_BS2";
|
|
4378
|
+
VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
|
|
4379
|
+
})(VertexBufferSemantic || (VertexBufferSemantic = {}));
|
|
4314
4380
|
|
|
4315
4381
|
var BuiltinObjectGUID = function BuiltinObjectGUID() {
|
|
4316
4382
|
};
|
|
@@ -4331,6 +4397,8 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4331
4397
|
get ItemType () { return ItemType; },
|
|
4332
4398
|
get RenderMode () { return RenderMode; },
|
|
4333
4399
|
get ParticleOrigin () { return ParticleOrigin; },
|
|
4400
|
+
get RenderType () { return RenderType; },
|
|
4401
|
+
get RenderFace () { return RenderFace; },
|
|
4334
4402
|
get CameraClipMode () { return CameraClipMode; },
|
|
4335
4403
|
get CompositionEndBehavior () { return CompositionEndBehavior; },
|
|
4336
4404
|
get BackgroundType () { return BackgroundType; },
|
|
@@ -4364,6 +4432,9 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4364
4432
|
get FontStyle () { return FontStyle; },
|
|
4365
4433
|
get DataType () { return DataType; },
|
|
4366
4434
|
get GeometryType () { return GeometryType; },
|
|
4435
|
+
get VertexFormatType () { return VertexFormatType; },
|
|
4436
|
+
get IndexFormatType () { return IndexFormatType; },
|
|
4437
|
+
get VertexBufferSemantic () { return VertexBufferSemantic; },
|
|
4367
4438
|
BuiltinObjectGUID: BuiltinObjectGUID
|
|
4368
4439
|
});
|
|
4369
4440
|
|
|
@@ -7759,6 +7830,10 @@ function buildEasingCurve(leftKeyframe, rightKeyframe) {
|
|
|
7759
7830
|
}
|
|
7760
7831
|
}
|
|
7761
7832
|
|
|
7833
|
+
var CURVE_PRO_TIME = 0;
|
|
7834
|
+
var CURVE_PRO_VALUE = 1;
|
|
7835
|
+
var CURVE_PRO_IN_TANGENT = 2;
|
|
7836
|
+
var CURVE_PRO_OUT_TANGENT = 3;
|
|
7762
7837
|
var NOT_IMPLEMENT = "not_implement";
|
|
7763
7838
|
var ValueGetter = /*#__PURE__*/ function() {
|
|
7764
7839
|
function ValueGetter(arg) {
|
|
@@ -8228,6 +8303,54 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
8228
8303
|
};
|
|
8229
8304
|
return BezierCurve;
|
|
8230
8305
|
}(ValueGetter);
|
|
8306
|
+
var PathSegments = /*#__PURE__*/ function(ValueGetter) {
|
|
8307
|
+
_inherits(PathSegments, ValueGetter);
|
|
8308
|
+
function PathSegments() {
|
|
8309
|
+
return ValueGetter.apply(this, arguments);
|
|
8310
|
+
}
|
|
8311
|
+
var _proto = PathSegments.prototype;
|
|
8312
|
+
_proto.onCreate = function onCreate(props) {
|
|
8313
|
+
this.keys = props[0];
|
|
8314
|
+
this.values = props[1];
|
|
8315
|
+
};
|
|
8316
|
+
_proto.getValue = function getValue(time) {
|
|
8317
|
+
var keys = this.keys;
|
|
8318
|
+
var values = this.values;
|
|
8319
|
+
for(var i = 0; i < keys.length - 1; i++){
|
|
8320
|
+
var k0 = keys[i];
|
|
8321
|
+
var k1 = keys[i + 1];
|
|
8322
|
+
if (k0[0] <= time && k1[0] >= time) {
|
|
8323
|
+
var dis = k1[1] - k0[1];
|
|
8324
|
+
var dt = void 0;
|
|
8325
|
+
if (dis === 0) {
|
|
8326
|
+
dt = (time - k0[0]) / (k1[0] - k0[0]);
|
|
8327
|
+
} else {
|
|
8328
|
+
var val = curveValueEvaluate(time, k0, k1);
|
|
8329
|
+
dt = (val - k0[1]) / dis;
|
|
8330
|
+
}
|
|
8331
|
+
return this.calculateVec(i, dt);
|
|
8332
|
+
}
|
|
8333
|
+
}
|
|
8334
|
+
if (time <= keys[0][0]) {
|
|
8335
|
+
return values[0].slice();
|
|
8336
|
+
}
|
|
8337
|
+
return values[values.length - 1].slice();
|
|
8338
|
+
};
|
|
8339
|
+
_proto.calculateVec = function calculateVec(i, dt) {
|
|
8340
|
+
var vec0 = this.values[i];
|
|
8341
|
+
var vec1 = this.values[i + 1];
|
|
8342
|
+
var ret = [
|
|
8343
|
+
0,
|
|
8344
|
+
0,
|
|
8345
|
+
0
|
|
8346
|
+
];
|
|
8347
|
+
for(var j = 0; j < vec0.length; j++){
|
|
8348
|
+
ret[j] = vec0[j] * (1 - dt) + vec1[j] * dt;
|
|
8349
|
+
}
|
|
8350
|
+
return ret;
|
|
8351
|
+
};
|
|
8352
|
+
return PathSegments;
|
|
8353
|
+
}(ValueGetter);
|
|
8231
8354
|
var BezierCurvePath = /*#__PURE__*/ function(ValueGetter) {
|
|
8232
8355
|
_inherits(BezierCurvePath, ValueGetter);
|
|
8233
8356
|
function BezierCurvePath() {
|
|
@@ -8328,10 +8451,9 @@ var map$1 = (_obj$6 = {}, _obj$6[ValueType.RANDOM] = function(props) {
|
|
|
8328
8451
|
return new LineSegments(props);
|
|
8329
8452
|
}, _obj$6[ValueType.GRADIENT_COLOR] = function(props) {
|
|
8330
8453
|
return new GradientValue(props);
|
|
8331
|
-
},
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
_obj$6[ValueType.BEZIER_CURVE] = function(props) {
|
|
8454
|
+
}, _obj$6[ValueType.LINEAR_PATH] = function(pros) {
|
|
8455
|
+
return new PathSegments(pros);
|
|
8456
|
+
}, _obj$6[ValueType.BEZIER_CURVE] = function(props) {
|
|
8335
8457
|
if (props.length === 1) {
|
|
8336
8458
|
return new StaticValue(props[0][1][1]);
|
|
8337
8459
|
}
|
|
@@ -8366,6 +8488,20 @@ function lineSegIntegrateByTime(t, t0, t1, y0, y1) {
|
|
|
8366
8488
|
var t03 = t02 * t0;
|
|
8367
8489
|
return (2 * t3 * (y0 - y1) + 3 * t2 * (t0 * y1 - t1 * y0) - t03 * (2 * y0 + y1) + 3 * t02 * t1 * y0) / (6 * (t0 - t1));
|
|
8368
8490
|
}
|
|
8491
|
+
function curveValueEvaluate(time, keyframe0, keyframe1) {
|
|
8492
|
+
var dt = keyframe1[CURVE_PRO_TIME] - keyframe0[CURVE_PRO_TIME];
|
|
8493
|
+
var m0 = keyframe0[CURVE_PRO_OUT_TANGENT] * dt;
|
|
8494
|
+
var m1 = keyframe1[CURVE_PRO_IN_TANGENT] * dt;
|
|
8495
|
+
var t = (time - keyframe0[CURVE_PRO_TIME]) / dt;
|
|
8496
|
+
var t2 = t * t;
|
|
8497
|
+
var t3 = t2 * t;
|
|
8498
|
+
var a = 2 * t3 - 3 * t2 + 1;
|
|
8499
|
+
var b = t3 - 2 * t2 + t;
|
|
8500
|
+
var c = t3 - t2;
|
|
8501
|
+
var d = -2 * t3 + 3 * t2;
|
|
8502
|
+
//(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
|
|
8503
|
+
return a * keyframe0[CURVE_PRO_VALUE] + b * m0 + c * m1 + d * keyframe1[CURVE_PRO_VALUE];
|
|
8504
|
+
}
|
|
8369
8505
|
function getKeyFrameMetaByRawValue(meta, value) {
|
|
8370
8506
|
if (value) {
|
|
8371
8507
|
var type = value[0];
|
|
@@ -9291,6 +9427,38 @@ function copy(target) {
|
|
|
9291
9427
|
}
|
|
9292
9428
|
}
|
|
9293
9429
|
}
|
|
9430
|
+
function vertexFormatType2GLType(formatType) {
|
|
9431
|
+
switch(formatType){
|
|
9432
|
+
case VertexFormatType.Float32:
|
|
9433
|
+
return WebGLRenderingContext["FLOAT"];
|
|
9434
|
+
case VertexFormatType.Int16:
|
|
9435
|
+
return WebGLRenderingContext["SHORT"];
|
|
9436
|
+
case VertexFormatType.Int8:
|
|
9437
|
+
return WebGLRenderingContext["BYTE"];
|
|
9438
|
+
case VertexFormatType.UInt16:
|
|
9439
|
+
return WebGLRenderingContext["UNSIGNED_SHORT"];
|
|
9440
|
+
case VertexFormatType.UInt8:
|
|
9441
|
+
return WebGLRenderingContext["UNSIGNED_BYTE"];
|
|
9442
|
+
default:
|
|
9443
|
+
return WebGLRenderingContext["FLOAT"];
|
|
9444
|
+
}
|
|
9445
|
+
}
|
|
9446
|
+
function glType2VertexFormatType(webglType) {
|
|
9447
|
+
switch(webglType){
|
|
9448
|
+
case WebGLRenderingContext["FLOAT"]:
|
|
9449
|
+
return VertexFormatType.Float32;
|
|
9450
|
+
case WebGLRenderingContext["SHORT"]:
|
|
9451
|
+
return VertexFormatType.Int16;
|
|
9452
|
+
case WebGLRenderingContext["BYTE"]:
|
|
9453
|
+
return VertexFormatType.Int8;
|
|
9454
|
+
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
9455
|
+
return VertexFormatType.UInt16;
|
|
9456
|
+
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
9457
|
+
return VertexFormatType.UInt8;
|
|
9458
|
+
default:
|
|
9459
|
+
return VertexFormatType.Float32;
|
|
9460
|
+
}
|
|
9461
|
+
}
|
|
9294
9462
|
|
|
9295
9463
|
exports.ShaderType = void 0;
|
|
9296
9464
|
(function(ShaderType) {
|
|
@@ -10132,6 +10300,29 @@ function generateHalfFloatTexture(engine, data, width, height) {
|
|
|
10132
10300
|
wrapT: glContext.CLAMP_TO_EDGE
|
|
10133
10301
|
});
|
|
10134
10302
|
}
|
|
10303
|
+
function generateWhiteTexture(engine) {
|
|
10304
|
+
return Texture.create(engine, {
|
|
10305
|
+
id: "whitetexture00000000000000000000",
|
|
10306
|
+
data: {
|
|
10307
|
+
width: 1,
|
|
10308
|
+
height: 1,
|
|
10309
|
+
data: new Uint8Array([
|
|
10310
|
+
255,
|
|
10311
|
+
255,
|
|
10312
|
+
255,
|
|
10313
|
+
255
|
|
10314
|
+
])
|
|
10315
|
+
},
|
|
10316
|
+
sourceType: exports.TextureSourceType.data,
|
|
10317
|
+
type: glContext.UNSIGNED_BYTE,
|
|
10318
|
+
format: glContext.RGBA,
|
|
10319
|
+
internalFormat: glContext.RGBA,
|
|
10320
|
+
wrapS: glContext.MIRRORED_REPEAT,
|
|
10321
|
+
wrapT: glContext.MIRRORED_REPEAT,
|
|
10322
|
+
minFilter: glContext.NEAREST,
|
|
10323
|
+
magFilter: glContext.NEAREST
|
|
10324
|
+
});
|
|
10325
|
+
}
|
|
10135
10326
|
|
|
10136
10327
|
var HEADER_LEN = 12 + 13 * 4; // identifier + header elements (not including key value meta-data pairs)
|
|
10137
10328
|
var COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D()
|
|
@@ -11305,8 +11496,8 @@ var seed$6 = 1;
|
|
|
11305
11496
|
/**
|
|
11306
11497
|
* 配置当前pass的RT,在每帧渲染前调用
|
|
11307
11498
|
*/ _proto.configure = function configure(renderer) {
|
|
11308
|
-
if (this.
|
|
11309
|
-
renderer.
|
|
11499
|
+
if (this.framebuffer) {
|
|
11500
|
+
renderer.setFramebuffer(this.framebuffer);
|
|
11310
11501
|
} else {
|
|
11311
11502
|
var _this_getViewport = this.getViewport(), x = _this_getViewport[0], y = _this_getViewport[1], width = _this_getViewport[2], height = _this_getViewport[3];
|
|
11312
11503
|
renderer.setViewport(x, y, width, height);
|
|
@@ -11353,9 +11544,9 @@ var seed$6 = 1;
|
|
|
11353
11544
|
return !att.externalTexture && att.dispose();
|
|
11354
11545
|
});
|
|
11355
11546
|
this.attachments = attachments;
|
|
11356
|
-
if (this.
|
|
11357
|
-
this.
|
|
11358
|
-
this.
|
|
11547
|
+
if (this.framebuffer) {
|
|
11548
|
+
this.framebuffer.bind();
|
|
11549
|
+
this.framebuffer.resetColorTextures(colors.map(function(color) {
|
|
11359
11550
|
return color;
|
|
11360
11551
|
}));
|
|
11361
11552
|
}
|
|
@@ -11376,18 +11567,18 @@ var seed$6 = 1;
|
|
|
11376
11567
|
this.isCustomViewport = true;
|
|
11377
11568
|
this.viewportScale = 1;
|
|
11378
11569
|
this.customViewport = options.viewport.slice(0, 4);
|
|
11379
|
-
if (this.
|
|
11570
|
+
if (this.framebuffer) {
|
|
11380
11571
|
var vp = this.customViewport;
|
|
11381
11572
|
// TODO 为什么framebuffer和renderpass的isCustomViewport不一样?
|
|
11382
|
-
this.
|
|
11383
|
-
this.
|
|
11573
|
+
this.framebuffer.isCustomViewport = false;
|
|
11574
|
+
this.framebuffer.resize(vp[0], vp[1], vp[2], vp[3]);
|
|
11384
11575
|
}
|
|
11385
11576
|
} else {
|
|
11386
11577
|
this.isCustomViewport = false;
|
|
11387
11578
|
this.viewportScale = options.viewportScale || 1;
|
|
11388
|
-
if (this.
|
|
11389
|
-
this.
|
|
11390
|
-
this.
|
|
11579
|
+
if (this.framebuffer) {
|
|
11580
|
+
this.framebuffer.isCustomViewport = true;
|
|
11581
|
+
this.framebuffer.viewportScale = this.viewportScale;
|
|
11391
11582
|
}
|
|
11392
11583
|
}
|
|
11393
11584
|
};
|
|
@@ -11397,16 +11588,15 @@ var seed$6 = 1;
|
|
|
11397
11588
|
var renderer = this.renderer;
|
|
11398
11589
|
var options = this.options;
|
|
11399
11590
|
if (this.attachments.length) {
|
|
11400
|
-
var
|
|
11591
|
+
var _this_framebuffer;
|
|
11401
11592
|
this.attachments.forEach(function(att) {
|
|
11402
11593
|
return !att.externalTexture && att.dispose();
|
|
11403
11594
|
});
|
|
11404
11595
|
this.attachments.length = 0;
|
|
11405
|
-
(
|
|
11596
|
+
(_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.dispose({
|
|
11406
11597
|
depthStencilAttachment: 2
|
|
11407
11598
|
});
|
|
11408
|
-
|
|
11409
|
-
this.frameBuffer = null;
|
|
11599
|
+
this.framebuffer = null;
|
|
11410
11600
|
}
|
|
11411
11601
|
var vs = this.viewportScale;
|
|
11412
11602
|
// renderpass 的 viewport 相关参数都需要动态的修改
|
|
@@ -11431,7 +11621,7 @@ var seed$6 = 1;
|
|
|
11431
11621
|
return attachment;
|
|
11432
11622
|
});
|
|
11433
11623
|
this.attachments = attachments;
|
|
11434
|
-
var framebuffer =
|
|
11624
|
+
var framebuffer = Framebuffer.create({
|
|
11435
11625
|
storeAction: this.storeAction,
|
|
11436
11626
|
name: name,
|
|
11437
11627
|
viewport: viewport,
|
|
@@ -11446,7 +11636,7 @@ var seed$6 = 1;
|
|
|
11446
11636
|
}, renderer);
|
|
11447
11637
|
framebuffer.bind();
|
|
11448
11638
|
framebuffer.unbind();
|
|
11449
|
-
this.
|
|
11639
|
+
this.framebuffer = framebuffer;
|
|
11450
11640
|
} else {
|
|
11451
11641
|
this.attachments.length = 0;
|
|
11452
11642
|
}
|
|
@@ -11454,8 +11644,8 @@ var seed$6 = 1;
|
|
|
11454
11644
|
/**
|
|
11455
11645
|
* 获取当前视口大小,格式:[x偏移,y偏移,宽度,高度]
|
|
11456
11646
|
*/ _proto.getViewport = function getViewport() {
|
|
11457
|
-
var
|
|
11458
|
-
var ret = ((
|
|
11647
|
+
var _this_framebuffer;
|
|
11648
|
+
var ret = ((_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.viewport) || this.customViewport;
|
|
11459
11649
|
if (ret) {
|
|
11460
11650
|
return ret;
|
|
11461
11651
|
}
|
|
@@ -11476,24 +11666,24 @@ var seed$6 = 1;
|
|
|
11476
11666
|
/**
|
|
11477
11667
|
* 获取深度 Attachment,可能没有
|
|
11478
11668
|
*/ _proto.getDepthAttachment = function getDepthAttachment() {
|
|
11479
|
-
var
|
|
11480
|
-
if (
|
|
11669
|
+
var framebuffer = this.framebuffer;
|
|
11670
|
+
if (framebuffer) {
|
|
11481
11671
|
return {
|
|
11482
|
-
storageType:
|
|
11483
|
-
storage:
|
|
11484
|
-
texture:
|
|
11672
|
+
storageType: framebuffer.depthStencilStorageType,
|
|
11673
|
+
storage: framebuffer.depthStorage,
|
|
11674
|
+
texture: framebuffer.getDepthTexture() ? this.getDepthTexture(framebuffer.getDepthTexture(), framebuffer.externalStorage) : undefined
|
|
11485
11675
|
};
|
|
11486
11676
|
}
|
|
11487
11677
|
};
|
|
11488
11678
|
/**
|
|
11489
11679
|
* 获取蒙版 Attachment,可能没有
|
|
11490
11680
|
*/ _proto.getStencilAttachment = function getStencilAttachment() {
|
|
11491
|
-
var
|
|
11492
|
-
if (
|
|
11681
|
+
var framebuffer = this.framebuffer;
|
|
11682
|
+
if (framebuffer) {
|
|
11493
11683
|
return {
|
|
11494
|
-
storageType:
|
|
11495
|
-
storage:
|
|
11496
|
-
texture:
|
|
11684
|
+
storageType: framebuffer.depthStencilStorageType,
|
|
11685
|
+
storage: framebuffer.stencilStorage,
|
|
11686
|
+
texture: framebuffer.getStencilTexture() ? this.getStencilTexture(framebuffer.getStencilTexture(), framebuffer.externalStorage) : undefined
|
|
11497
11687
|
};
|
|
11498
11688
|
}
|
|
11499
11689
|
};
|
|
@@ -11558,7 +11748,7 @@ var seed$6 = 1;
|
|
|
11558
11748
|
}
|
|
11559
11749
|
this.destroyed = true;
|
|
11560
11750
|
var depthStencilOpt = (options == null ? void 0 : options.depthStencilAttachment) ? options.depthStencilAttachment : 0;
|
|
11561
|
-
var fbo = this.
|
|
11751
|
+
var fbo = this.framebuffer;
|
|
11562
11752
|
if (fbo) {
|
|
11563
11753
|
fbo.dispose({
|
|
11564
11754
|
depthStencilAttachment: depthStencilOpt
|
|
@@ -11688,9 +11878,9 @@ var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11688
11878
|
}
|
|
11689
11879
|
var _proto = BloomThresholdPass.prototype;
|
|
11690
11880
|
_proto.configure = function configure(renderer) {
|
|
11691
|
-
this.mainTexture = renderer.
|
|
11881
|
+
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
11692
11882
|
this.sceneTextureHandle.texture = this.mainTexture;
|
|
11693
|
-
renderer.
|
|
11883
|
+
renderer.setFramebuffer(this.framebuffer);
|
|
11694
11884
|
};
|
|
11695
11885
|
_proto.execute = function execute(renderer) {
|
|
11696
11886
|
renderer.clear({
|
|
@@ -11760,8 +11950,8 @@ var HQGaussianDownSamplePass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11760
11950
|
}
|
|
11761
11951
|
var _proto = HQGaussianDownSamplePass.prototype;
|
|
11762
11952
|
_proto.configure = function configure(renderer) {
|
|
11763
|
-
this.mainTexture = renderer.
|
|
11764
|
-
renderer.
|
|
11953
|
+
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
11954
|
+
renderer.setFramebuffer(this.framebuffer);
|
|
11765
11955
|
};
|
|
11766
11956
|
_proto.execute = function execute(renderer) {
|
|
11767
11957
|
renderer.clear({
|
|
@@ -11775,7 +11965,7 @@ var HQGaussianDownSamplePass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11775
11965
|
this.screenMesh
|
|
11776
11966
|
]);
|
|
11777
11967
|
if (this.type === "V") {
|
|
11778
|
-
this.gaussianResult.texture = renderer.
|
|
11968
|
+
this.gaussianResult.texture = renderer.getFramebuffer().getColorTextures()[0];
|
|
11779
11969
|
}
|
|
11780
11970
|
};
|
|
11781
11971
|
return HQGaussianDownSamplePass;
|
|
@@ -11830,8 +12020,8 @@ var HQGaussianUpSamplePass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11830
12020
|
}
|
|
11831
12021
|
var _proto = HQGaussianUpSamplePass.prototype;
|
|
11832
12022
|
_proto.configure = function configure(renderer) {
|
|
11833
|
-
this.mainTexture = renderer.
|
|
11834
|
-
renderer.
|
|
12023
|
+
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12024
|
+
renderer.setFramebuffer(this.framebuffer);
|
|
11835
12025
|
};
|
|
11836
12026
|
_proto.execute = function execute(renderer) {
|
|
11837
12027
|
renderer.clear({
|
|
@@ -11900,11 +12090,11 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
11900
12090
|
}
|
|
11901
12091
|
var _proto = ToneMappingPass.prototype;
|
|
11902
12092
|
_proto.configure = function configure(renderer) {
|
|
11903
|
-
this.mainTexture = renderer.
|
|
12093
|
+
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
11904
12094
|
if (!this.sceneTextureHandle.texture) {
|
|
11905
12095
|
this.sceneTextureHandle.texture = this.mainTexture;
|
|
11906
12096
|
}
|
|
11907
|
-
renderer.
|
|
12097
|
+
renderer.setFramebuffer(null);
|
|
11908
12098
|
};
|
|
11909
12099
|
_proto.execute = function execute(renderer) {
|
|
11910
12100
|
renderer.clear({
|
|
@@ -12424,7 +12614,7 @@ var seed$5 = 1;
|
|
|
12424
12614
|
this.destroyed = true;
|
|
12425
12615
|
};
|
|
12426
12616
|
/**
|
|
12427
|
-
* 重置 RenderPass ColorAttachment,解决
|
|
12617
|
+
* 重置 RenderPass ColorAttachment,解决 Framebuffer 即读又写的问题
|
|
12428
12618
|
* @param renderPasses - RenderPass 对象数组
|
|
12429
12619
|
* @param startIndex - 开始重置的索引
|
|
12430
12620
|
*/ _proto.resetRenderPassDefaultAttachment = function resetRenderPassDefaultAttachment(renderPasses, startIndex) {
|
|
@@ -12637,7 +12827,7 @@ var seed$5 = 1;
|
|
|
12637
12827
|
// TODO tex和size没有地方用到。
|
|
12638
12828
|
/**
|
|
12639
12829
|
* 创建拷贝 RenderPass 用到的 Mesh 对象
|
|
12640
|
-
* @param semantics - RenderPass 渲染时
|
|
12830
|
+
* @param semantics - RenderPass 渲染时 Framebuffer 的颜色和深度纹理、大小和是否混合
|
|
12641
12831
|
*/ _proto.createCopyMesh = function createCopyMesh(semantics) {
|
|
12642
12832
|
var name = EFFECTS_COPY_MESH_NAME;
|
|
12643
12833
|
var engine = this.renderer.engine;
|
|
@@ -12728,8 +12918,8 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
|
|
|
12728
12918
|
}
|
|
12729
12919
|
var _proto = FinalCopyRP.prototype;
|
|
12730
12920
|
_proto.configure = function configure(renderer) {
|
|
12731
|
-
this.prePassTexture = renderer.
|
|
12732
|
-
renderer.
|
|
12921
|
+
this.prePassTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12922
|
+
renderer.setFramebuffer(null);
|
|
12733
12923
|
};
|
|
12734
12924
|
_proto.execute = function execute(renderer) {
|
|
12735
12925
|
renderer.clear(this.clearAction);
|
|
@@ -12754,8 +12944,8 @@ var GlobalUniforms = function GlobalUniforms() {
|
|
|
12754
12944
|
;
|
|
12755
12945
|
};
|
|
12756
12946
|
|
|
12757
|
-
var
|
|
12758
|
-
function
|
|
12947
|
+
var Renderbuffer = /*#__PURE__*/ function() {
|
|
12948
|
+
function Renderbuffer(props) {
|
|
12759
12949
|
this.size = [
|
|
12760
12950
|
0,
|
|
12761
12951
|
0
|
|
@@ -12767,7 +12957,7 @@ var RenderBuffer = /*#__PURE__*/ function() {
|
|
|
12767
12957
|
this.format = format;
|
|
12768
12958
|
this.attachment = attachment;
|
|
12769
12959
|
}
|
|
12770
|
-
_create_class(
|
|
12960
|
+
_create_class(Renderbuffer, [
|
|
12771
12961
|
{
|
|
12772
12962
|
key: "isDestroyed",
|
|
12773
12963
|
get: function get() {
|
|
@@ -12775,7 +12965,7 @@ var RenderBuffer = /*#__PURE__*/ function() {
|
|
|
12775
12965
|
}
|
|
12776
12966
|
}
|
|
12777
12967
|
]);
|
|
12778
|
-
return
|
|
12968
|
+
return Renderbuffer;
|
|
12779
12969
|
}();
|
|
12780
12970
|
|
|
12781
12971
|
var isWebGL2Available = typeof WebGL2RenderingContext === "function";
|
|
@@ -12923,9 +13113,9 @@ exports.RenderTextureFormat = void 0;
|
|
|
12923
13113
|
})(exports.RenderTextureFormat || (exports.RenderTextureFormat = {}));
|
|
12924
13114
|
/**
|
|
12925
13115
|
*
|
|
12926
|
-
*/ var
|
|
12927
|
-
function
|
|
12928
|
-
var _proto =
|
|
13116
|
+
*/ var Framebuffer = /*#__PURE__*/ function() {
|
|
13117
|
+
function Framebuffer() {}
|
|
13118
|
+
var _proto = Framebuffer.prototype;
|
|
12929
13119
|
_proto.resize = function resize(x, y, width, height) {
|
|
12930
13120
|
// OVERRIDE
|
|
12931
13121
|
};
|
|
@@ -12953,7 +13143,7 @@ exports.RenderTextureFormat = void 0;
|
|
|
12953
13143
|
_proto.dispose = function dispose(opt) {
|
|
12954
13144
|
// OVERRIDE
|
|
12955
13145
|
};
|
|
12956
|
-
_create_class(
|
|
13146
|
+
_create_class(Framebuffer, [
|
|
12957
13147
|
{
|
|
12958
13148
|
key: "stencilStorage",
|
|
12959
13149
|
get: function get() {
|
|
@@ -12969,7 +13159,7 @@ exports.RenderTextureFormat = void 0;
|
|
|
12969
13159
|
}
|
|
12970
13160
|
}
|
|
12971
13161
|
]);
|
|
12972
|
-
return
|
|
13162
|
+
return Framebuffer;
|
|
12973
13163
|
}();
|
|
12974
13164
|
|
|
12975
13165
|
var Renderer = /*#__PURE__*/ function() {
|
|
@@ -12984,11 +13174,11 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
12984
13174
|
_proto.setGlobalMatrix = function setGlobalMatrix(name, value) {
|
|
12985
13175
|
// OVERRIDE
|
|
12986
13176
|
};
|
|
12987
|
-
_proto.
|
|
13177
|
+
_proto.getFramebuffer = function getFramebuffer() {
|
|
12988
13178
|
// OVERRIDE
|
|
12989
13179
|
return null;
|
|
12990
13180
|
};
|
|
12991
|
-
_proto.
|
|
13181
|
+
_proto.setFramebuffer = function setFramebuffer(framebuffer) {};
|
|
12992
13182
|
_proto.setViewport = function setViewport(x, y, width, height) {
|
|
12993
13183
|
// OVERRIDE
|
|
12994
13184
|
};
|
|
@@ -13045,7 +13235,7 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
13045
13235
|
_proto.renderMeshes = function renderMeshes(meshes) {
|
|
13046
13236
|
// OVERRIDE
|
|
13047
13237
|
};
|
|
13048
|
-
_proto.drawGeometry = function drawGeometry(geometry, material) {
|
|
13238
|
+
_proto.drawGeometry = function drawGeometry(geometry, material, subMeshIndex) {
|
|
13049
13239
|
// OVERRIDE
|
|
13050
13240
|
};
|
|
13051
13241
|
_proto.getTemporaryRT = function getTemporaryRT(name, width, height, depthBuffer, filter, format) {
|
|
@@ -13344,7 +13534,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13344
13534
|
};
|
|
13345
13535
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
13346
13536
|
var worldMatrix = this.transform.getWorldMatrix();
|
|
13347
|
-
var triangles = trianglesFromRect(Vector3.ZERO, 0.5, 0.5);
|
|
13537
|
+
var triangles = trianglesFromRect(Vector3.ZERO, 0.5 * this.transform.size.x, 0.5 * this.transform.size.y);
|
|
13348
13538
|
triangles.forEach(function(triangle) {
|
|
13349
13539
|
worldMatrix.transformPoint(triangle.p0);
|
|
13350
13540
|
worldMatrix.transformPoint(triangle.p1);
|
|
@@ -13575,1330 +13765,833 @@ var PlayableAsset = /*#__PURE__*/ function() {
|
|
|
13575
13765
|
return PlayableAsset;
|
|
13576
13766
|
}();
|
|
13577
13767
|
|
|
13578
|
-
|
|
13579
|
-
|
|
13580
|
-
|
|
13581
|
-
|
|
13582
|
-
|
|
13583
|
-
|
|
13768
|
+
var singleSplits = [
|
|
13769
|
+
[
|
|
13770
|
+
0,
|
|
13771
|
+
0,
|
|
13772
|
+
1,
|
|
13773
|
+
1,
|
|
13774
|
+
undefined
|
|
13775
|
+
]
|
|
13776
|
+
];
|
|
13777
|
+
var tempColor = [
|
|
13778
|
+
1,
|
|
13779
|
+
1,
|
|
13780
|
+
1,
|
|
13781
|
+
1
|
|
13782
|
+
];
|
|
13783
|
+
var seed$3 = 0;
|
|
13784
|
+
var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
13785
|
+
_inherits(SpriteColorPlayable, Playable);
|
|
13786
|
+
function SpriteColorPlayable() {
|
|
13584
13787
|
var _this;
|
|
13585
|
-
_this =
|
|
13586
|
-
_this.
|
|
13587
|
-
|
|
13788
|
+
_this = Playable.apply(this, arguments) || this;
|
|
13789
|
+
_this.renderColor = [
|
|
13790
|
+
1,
|
|
13791
|
+
1,
|
|
13792
|
+
1,
|
|
13793
|
+
1
|
|
13794
|
+
];
|
|
13588
13795
|
return _this;
|
|
13589
13796
|
}
|
|
13590
|
-
var _proto =
|
|
13591
|
-
_proto.
|
|
13592
|
-
|
|
13593
|
-
return output;
|
|
13594
|
-
};
|
|
13595
|
-
/**
|
|
13596
|
-
* 重写该方法以创建自定义混合器
|
|
13597
|
-
*/ _proto.createMixerPlayable = function createMixerPlayable() {
|
|
13598
|
-
return new Playable();
|
|
13797
|
+
var _proto = SpriteColorPlayable.prototype;
|
|
13798
|
+
_proto.onPlayablePlay = function onPlayablePlay() {
|
|
13799
|
+
this.spriteMaterial = this.bindingItem.getComponent(exports.SpriteComponent).material;
|
|
13599
13800
|
};
|
|
13600
|
-
_proto.
|
|
13601
|
-
var
|
|
13602
|
-
|
|
13603
|
-
|
|
13604
|
-
|
|
13801
|
+
_proto.processFrame = function processFrame(dt) {
|
|
13802
|
+
var colorInc = vecFill(tempColor, 1);
|
|
13803
|
+
var colorChanged;
|
|
13804
|
+
var life = this.time / this.bindingItem.duration;
|
|
13805
|
+
var opacityOverLifetime = this.opacityOverLifetime;
|
|
13806
|
+
var colorOverLifetime = this.colorOverLifetime;
|
|
13807
|
+
if (colorOverLifetime) {
|
|
13808
|
+
colorInc = getColorFromGradientStops(colorOverLifetime, life, true);
|
|
13809
|
+
colorChanged = true;
|
|
13605
13810
|
}
|
|
13606
|
-
|
|
13607
|
-
|
|
13608
|
-
|
|
13609
|
-
var newClip = new TimelineClip();
|
|
13610
|
-
newClip.playable = new classConstructor();
|
|
13611
|
-
newClip.name = name ? name : "TimelineClip" + newClip.id;
|
|
13612
|
-
this.addClip(newClip);
|
|
13613
|
-
return newClip;
|
|
13614
|
-
};
|
|
13615
|
-
_proto.getClips = function getClips() {
|
|
13616
|
-
return this.clips;
|
|
13617
|
-
};
|
|
13618
|
-
_proto.findClip = function findClip(name) {
|
|
13619
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
|
|
13620
|
-
var clip = _step.value;
|
|
13621
|
-
if (clip.name === name) {
|
|
13622
|
-
return clip;
|
|
13623
|
-
}
|
|
13811
|
+
if (opacityOverLifetime) {
|
|
13812
|
+
colorInc[3] *= opacityOverLifetime.getValue(life);
|
|
13813
|
+
colorChanged = true;
|
|
13624
13814
|
}
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
|
|
13628
|
-
clip.id = (this.clipSeed++).toString();
|
|
13629
|
-
this.clips.push(clip);
|
|
13630
|
-
};
|
|
13631
|
-
return Track;
|
|
13632
|
-
}(PlayableAsset);
|
|
13633
|
-
/**
|
|
13634
|
-
* @since 2.0.0
|
|
13635
|
-
* @internal
|
|
13636
|
-
*/ var TimelineClip = function TimelineClip() {
|
|
13637
|
-
this.start = 0;
|
|
13638
|
-
this.duration = 0;
|
|
13639
|
-
};
|
|
13640
|
-
|
|
13641
|
-
function _assert_this_initialized(self) {
|
|
13642
|
-
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
13643
|
-
return self;
|
|
13644
|
-
}
|
|
13645
|
-
|
|
13646
|
-
var AnimationStream = /*#__PURE__*/ function() {
|
|
13647
|
-
function AnimationStream(playable) {
|
|
13648
|
-
this.curveValues = {};
|
|
13649
|
-
this.playable = playable;
|
|
13650
|
-
}
|
|
13651
|
-
var _proto = AnimationStream.prototype;
|
|
13652
|
-
_proto.setCurveValue = function setCurveValue(componentType, propertyName, value) {
|
|
13653
|
-
if (!this.findCurveValue(componentType, propertyName)) {
|
|
13654
|
-
this.curveValues[componentType + propertyName] = {
|
|
13655
|
-
componentType: componentType,
|
|
13656
|
-
propertyName: propertyName,
|
|
13657
|
-
value: value
|
|
13658
|
-
};
|
|
13659
|
-
} else {
|
|
13660
|
-
this.curveValues[componentType + propertyName].value = value;
|
|
13815
|
+
if (colorChanged) {
|
|
13816
|
+
vecMulCombine(this.renderColor, colorInc, this.startColor);
|
|
13817
|
+
this.spriteMaterial.getVector4("_Color").setFromArray(this.renderColor);
|
|
13661
13818
|
}
|
|
13662
|
-
return this.curveValues[componentType + propertyName];
|
|
13663
|
-
};
|
|
13664
|
-
_proto.findCurveValue = function findCurveValue(componentType, propertyName) {
|
|
13665
|
-
return this.curveValues[componentType + propertyName];
|
|
13666
13819
|
};
|
|
13667
|
-
_proto.
|
|
13668
|
-
|
|
13669
|
-
|
|
13670
|
-
|
|
13820
|
+
_proto.fromData = function fromData(clipData) {
|
|
13821
|
+
this.clipData = clipData;
|
|
13822
|
+
var colorOverLifetime = clipData.colorOverLifetime;
|
|
13823
|
+
if (colorOverLifetime) {
|
|
13824
|
+
var _colorOverLifetime_opacity;
|
|
13825
|
+
this.opacityOverLifetime = createValueGetter((_colorOverLifetime_opacity = colorOverLifetime.opacity) != null ? _colorOverLifetime_opacity : 1);
|
|
13826
|
+
if (colorOverLifetime.color && colorOverLifetime.color[0] === ValueType.GRADIENT_COLOR) {
|
|
13827
|
+
this.colorOverLifetime = colorStopsFromGradient(colorOverLifetime.color[1]);
|
|
13828
|
+
}
|
|
13671
13829
|
}
|
|
13830
|
+
this.startColor = clipData.startColor || [
|
|
13831
|
+
1,
|
|
13832
|
+
1,
|
|
13833
|
+
1,
|
|
13834
|
+
1
|
|
13835
|
+
];
|
|
13836
|
+
return this;
|
|
13672
13837
|
};
|
|
13673
|
-
return
|
|
13674
|
-
}();
|
|
13675
|
-
|
|
13676
|
-
|
|
13677
|
-
|
|
13678
|
-
function AnimationPlayable() {
|
|
13838
|
+
return SpriteColorPlayable;
|
|
13839
|
+
}(Playable);
|
|
13840
|
+
exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
13841
|
+
_inherits(SpriteComponent, RendererComponent);
|
|
13842
|
+
function SpriteComponent(engine, props) {
|
|
13679
13843
|
var _this;
|
|
13680
|
-
_this =
|
|
13681
|
-
_this.
|
|
13844
|
+
_this = RendererComponent.call(this, engine) || this;
|
|
13845
|
+
_this.frameAnimationTime = 0;
|
|
13846
|
+
_this.color = [
|
|
13847
|
+
1,
|
|
13848
|
+
1,
|
|
13849
|
+
1,
|
|
13850
|
+
1
|
|
13851
|
+
];
|
|
13852
|
+
_this.visible = true;
|
|
13853
|
+
_this.getHitTestParams = function(force) {
|
|
13854
|
+
var ui = _this.interaction;
|
|
13855
|
+
if (force || ui) {
|
|
13856
|
+
var area = _this.getBoundingBox();
|
|
13857
|
+
if (area) {
|
|
13858
|
+
var _this_interaction;
|
|
13859
|
+
return {
|
|
13860
|
+
behavior: ((_this_interaction = _this.interaction) == null ? void 0 : _this_interaction.behavior) || 0,
|
|
13861
|
+
type: area.type,
|
|
13862
|
+
triangles: area.area,
|
|
13863
|
+
backfaceCulling: _this.renderer.side === SideMode.FRONT
|
|
13864
|
+
};
|
|
13865
|
+
}
|
|
13866
|
+
}
|
|
13867
|
+
};
|
|
13868
|
+
if (props) {
|
|
13869
|
+
_this.fromData(props);
|
|
13870
|
+
}
|
|
13682
13871
|
return _this;
|
|
13683
13872
|
}
|
|
13684
|
-
|
|
13685
|
-
|
|
13686
|
-
|
|
13687
|
-
|
|
13688
|
-
|
|
13689
|
-
|
|
13690
|
-
/**
|
|
13691
|
-
* @since 2.0.0
|
|
13692
|
-
* @internal
|
|
13693
|
-
*/ var TransformAnimationPlayable = /*#__PURE__*/ function(AnimationPlayable) {
|
|
13694
|
-
_inherits(TransformAnimationPlayable, AnimationPlayable);
|
|
13695
|
-
function TransformAnimationPlayable() {
|
|
13696
|
-
return AnimationPlayable.apply(this, arguments);
|
|
13697
|
-
}
|
|
13698
|
-
var _proto = TransformAnimationPlayable.prototype;
|
|
13699
|
-
_proto.processFrame = function processFrame(dt) {
|
|
13700
|
-
if (this.bindingItem.composition) {
|
|
13701
|
-
this.sampleAnimation();
|
|
13702
|
-
}
|
|
13873
|
+
var _proto = SpriteComponent.prototype;
|
|
13874
|
+
/**
|
|
13875
|
+
* 设置当前 Mesh 的可见性。
|
|
13876
|
+
* @param visible - true:可见,false:不可见
|
|
13877
|
+
*/ _proto.setVisible = function setVisible(visible) {
|
|
13878
|
+
this.visible = visible;
|
|
13703
13879
|
};
|
|
13704
13880
|
/**
|
|
13705
|
-
*
|
|
13706
|
-
*/ _proto.
|
|
13707
|
-
|
|
13708
|
-
|
|
13709
|
-
|
|
13710
|
-
|
|
13711
|
-
|
|
13712
|
-
|
|
13713
|
-
|
|
13714
|
-
|
|
13715
|
-
|
|
13716
|
-
|
|
13717
|
-
|
|
13718
|
-
|
|
13719
|
-
|
|
13720
|
-
|
|
13721
|
-
|
|
13722
|
-
|
|
13723
|
-
|
|
13724
|
-
|
|
13725
|
-
|
|
13726
|
-
|
|
13727
|
-
|
|
13728
|
-
|
|
13729
|
-
var incZ = func(this.rotationOverLifetime.z);
|
|
13730
|
-
var separateAxes = this.rotationOverLifetime.separateAxes;
|
|
13731
|
-
tempRot$1.x = separateAxes ? func(this.rotationOverLifetime.x) : 0;
|
|
13732
|
-
tempRot$1.y = separateAxes ? func(this.rotationOverLifetime.y) : 0;
|
|
13733
|
-
tempRot$1.z = incZ;
|
|
13734
|
-
var rot = tempRot$1.addEulers(this.originalTransform.rotation, tempRot$1);
|
|
13735
|
-
this.bindingItem.transform.setRotation(rot.x, rot.y, rot.z);
|
|
13736
|
-
// this.animationStream.setCurveValue('transform', 'rotation.x', rot.x);
|
|
13737
|
-
// this.animationStream.setCurveValue('transform', 'rotation.y', rot.y);
|
|
13738
|
-
// this.animationStream.setCurveValue('transform', 'rotation.z', rot.z);
|
|
13881
|
+
* 获取当前 Mesh 的可见性。
|
|
13882
|
+
*/ _proto.getVisible = function getVisible() {
|
|
13883
|
+
return this.visible;
|
|
13884
|
+
};
|
|
13885
|
+
/**
|
|
13886
|
+
* 设置当前图层的颜色
|
|
13887
|
+
* > Tips: 透明度也属于颜色的一部分,当有透明度/颜色 K 帧变化时,该 API 会失效
|
|
13888
|
+
* @since 2.0.0
|
|
13889
|
+
* @param color - 颜色值
|
|
13890
|
+
*/ _proto.setColor = function setColor(color) {
|
|
13891
|
+
this.color = color;
|
|
13892
|
+
this.material.setVector4("_Color", new Vector4().setFromArray(color));
|
|
13893
|
+
};
|
|
13894
|
+
/**
|
|
13895
|
+
* 设置当前 Mesh 的纹理
|
|
13896
|
+
* @since 2.0.0
|
|
13897
|
+
* @param texture - 纹理对象
|
|
13898
|
+
*/ _proto.setTexture = function setTexture(texture) {
|
|
13899
|
+
this.renderer.texture = texture;
|
|
13900
|
+
this.material.setTexture("uSampler0", texture);
|
|
13901
|
+
};
|
|
13902
|
+
_proto.render = function render(renderer) {
|
|
13903
|
+
if (!this.getVisible()) {
|
|
13904
|
+
return;
|
|
13739
13905
|
}
|
|
13740
|
-
|
|
13741
|
-
|
|
13742
|
-
|
|
13743
|
-
|
|
13744
|
-
pos.add(this.originalTransform.path.getValue(life));
|
|
13745
|
-
}
|
|
13746
|
-
this.bindingItem.transform.setPosition(pos.x, pos.y, pos.z);
|
|
13747
|
-
// this.animationStream.setCurveValue('transform', 'position.x', pos.x);
|
|
13748
|
-
// this.animationStream.setCurveValue('transform', 'position.y', pos.y);
|
|
13749
|
-
// this.animationStream.setCurveValue('transform', 'position.z', pos.z);
|
|
13906
|
+
var material = this.material;
|
|
13907
|
+
var geo = this.geometry;
|
|
13908
|
+
if (renderer.renderingData.currentFrame.globalUniforms) {
|
|
13909
|
+
renderer.setGlobalMatrix("effects_ObjectToWorld", this.transform.getWorldMatrix());
|
|
13750
13910
|
}
|
|
13911
|
+
this.material.setVector2("_Size", this.transform.size);
|
|
13912
|
+
renderer.drawGeometry(geo, material);
|
|
13751
13913
|
};
|
|
13752
|
-
_proto.
|
|
13753
|
-
|
|
13754
|
-
this.
|
|
13755
|
-
|
|
13756
|
-
|
|
13757
|
-
|
|
13758
|
-
|
|
13759
|
-
|
|
13760
|
-
var
|
|
13761
|
-
var
|
|
13762
|
-
|
|
13763
|
-
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
|
|
13770
|
-
|
|
13771
|
-
|
|
13772
|
-
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
|
|
13776
|
-
|
|
13777
|
-
}
|
|
13778
|
-
|
|
13779
|
-
|
|
13780
|
-
|
|
13781
|
-
this.orbitalVelOverLifetime = {
|
|
13782
|
-
x: positionOverLifetime.orbitalX && createValueGetter(positionOverLifetime.orbitalX),
|
|
13783
|
-
y: positionOverLifetime.orbitalY && createValueGetter(positionOverLifetime.orbitalY),
|
|
13784
|
-
z: positionOverLifetime.orbitalZ && createValueGetter(positionOverLifetime.orbitalZ),
|
|
13785
|
-
center: ensureVec3(positionOverLifetime.orbCenter),
|
|
13786
|
-
asRotation: positionOverLifetime.asRotation,
|
|
13787
|
-
enabled: !!orbitalVelEnable
|
|
13788
|
-
};
|
|
13914
|
+
_proto.start = function start() {
|
|
13915
|
+
this.priority = this.item.listIndex;
|
|
13916
|
+
this.item.getHitTestParams = this.getHitTestParams;
|
|
13917
|
+
};
|
|
13918
|
+
_proto.update = function update(dt) {
|
|
13919
|
+
this.frameAnimationTime += dt / 1000;
|
|
13920
|
+
var time = this.frameAnimationTime;
|
|
13921
|
+
var duration = this.item.duration;
|
|
13922
|
+
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
13923
|
+
var ta = this.textureSheetAnimation;
|
|
13924
|
+
if (ta) {
|
|
13925
|
+
var total = ta.total || ta.row * ta.col;
|
|
13926
|
+
var texRectX = 0;
|
|
13927
|
+
var texRectY = 0;
|
|
13928
|
+
var texRectW = 1;
|
|
13929
|
+
var texRectH = 1;
|
|
13930
|
+
var flip;
|
|
13931
|
+
if (this.splits) {
|
|
13932
|
+
var sp = this.splits[0];
|
|
13933
|
+
flip = sp[4];
|
|
13934
|
+
texRectX = sp[0];
|
|
13935
|
+
texRectY = sp[1];
|
|
13936
|
+
if (flip) {
|
|
13937
|
+
texRectW = sp[3];
|
|
13938
|
+
texRectH = sp[2];
|
|
13939
|
+
} else {
|
|
13940
|
+
texRectW = sp[2];
|
|
13941
|
+
texRectH = sp[3];
|
|
13942
|
+
}
|
|
13789
13943
|
}
|
|
13790
|
-
|
|
13791
|
-
|
|
13792
|
-
|
|
13793
|
-
|
|
13794
|
-
this.sizeSeparateAxes = true;
|
|
13795
|
-
this.sizeXOverLifetime = createValueGetter(sizeOverLifetime.x || 1);
|
|
13796
|
-
this.sizeYOverLifetime = createValueGetter(sizeOverLifetime.y || 1);
|
|
13797
|
-
this.sizeZOverLifetime = createValueGetter(sizeOverLifetime.z || 1);
|
|
13944
|
+
var dx, dy;
|
|
13945
|
+
if (flip) {
|
|
13946
|
+
dx = 1 / ta.row * texRectW;
|
|
13947
|
+
dy = 1 / ta.col * texRectH;
|
|
13798
13948
|
} else {
|
|
13799
|
-
|
|
13949
|
+
dx = 1 / ta.col * texRectW;
|
|
13950
|
+
dy = 1 / ta.row * texRectH;
|
|
13800
13951
|
}
|
|
13801
|
-
|
|
13802
|
-
|
|
13803
|
-
|
|
13804
|
-
|
|
13805
|
-
|
|
13806
|
-
|
|
13807
|
-
|
|
13808
|
-
|
|
13809
|
-
|
|
13810
|
-
|
|
13811
|
-
|
|
13952
|
+
var texOffset;
|
|
13953
|
+
if (ta.animate) {
|
|
13954
|
+
var frameIndex = Math.round(life * (total - 1));
|
|
13955
|
+
var yIndex = Math.floor(frameIndex / ta.col);
|
|
13956
|
+
var xIndex = frameIndex - yIndex * ta.col;
|
|
13957
|
+
texOffset = flip ? [
|
|
13958
|
+
dx * yIndex,
|
|
13959
|
+
dy * (ta.col - xIndex)
|
|
13960
|
+
] : [
|
|
13961
|
+
dx * xIndex,
|
|
13962
|
+
dy * (1 + yIndex)
|
|
13963
|
+
];
|
|
13964
|
+
} else {
|
|
13965
|
+
texOffset = [
|
|
13966
|
+
0,
|
|
13967
|
+
dy
|
|
13968
|
+
];
|
|
13812
13969
|
}
|
|
13970
|
+
this.material.getVector4("_TexOffset").setFromArray([
|
|
13971
|
+
texRectX + texOffset[0],
|
|
13972
|
+
texRectH + texRectY - texOffset[1],
|
|
13973
|
+
dx,
|
|
13974
|
+
dy
|
|
13975
|
+
]);
|
|
13813
13976
|
}
|
|
13814
|
-
this.gravity = Vector3.fromArray((positionOverLifetime == null ? void 0 : positionOverLifetime.gravity) || []);
|
|
13815
|
-
var _positionOverLifetime_gravityOverLifetime;
|
|
13816
|
-
this.gravityModifier = createValueGetter((_positionOverLifetime_gravityOverLifetime = positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime) != null ? _positionOverLifetime_gravityOverLifetime : 0);
|
|
13817
|
-
this.direction = (positionOverLifetime == null ? void 0 : positionOverLifetime.direction) ? Vector3.fromArray(positionOverLifetime.direction).normalize() : new Vector3();
|
|
13818
|
-
this.startSpeed = (positionOverLifetime == null ? void 0 : positionOverLifetime.startSpeed) || 0;
|
|
13819
|
-
this.velocity = this.direction.clone();
|
|
13820
|
-
this.velocity.multiply(this.startSpeed);
|
|
13821
|
-
};
|
|
13822
|
-
return TransformAnimationPlayable;
|
|
13823
|
-
}(AnimationPlayable);
|
|
13824
|
-
var TransformAnimationPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
13825
|
-
_inherits(TransformAnimationPlayableAsset, PlayableAsset);
|
|
13826
|
-
function TransformAnimationPlayableAsset() {
|
|
13827
|
-
return PlayableAsset.apply(this, arguments);
|
|
13828
|
-
}
|
|
13829
|
-
var _proto = TransformAnimationPlayableAsset.prototype;
|
|
13830
|
-
_proto.createPlayable = function createPlayable() {
|
|
13831
|
-
var transformAnimationPlayable = new TransformAnimationPlayable();
|
|
13832
|
-
transformAnimationPlayable.fromData(this.transformAnimationData);
|
|
13833
|
-
return transformAnimationPlayable;
|
|
13834
|
-
};
|
|
13835
|
-
_proto.fromData = function fromData(data) {
|
|
13836
|
-
this.transformAnimationData = data;
|
|
13837
|
-
};
|
|
13838
|
-
return TransformAnimationPlayableAsset;
|
|
13839
|
-
}(PlayableAsset);
|
|
13840
|
-
/**
|
|
13841
|
-
* @since 2.0.0
|
|
13842
|
-
* @internal
|
|
13843
|
-
*/ var ActivationPlayable = /*#__PURE__*/ function(Playable) {
|
|
13844
|
-
_inherits(ActivationPlayable, Playable);
|
|
13845
|
-
function ActivationPlayable() {
|
|
13846
|
-
return Playable.apply(this, arguments);
|
|
13847
|
-
}
|
|
13848
|
-
var _proto = ActivationPlayable.prototype;
|
|
13849
|
-
_proto.onGraphStart = function onGraphStart() {
|
|
13850
|
-
this.bindingItem.transform.setValid(false);
|
|
13851
|
-
this.hideRendererComponents();
|
|
13852
|
-
};
|
|
13853
|
-
_proto.onPlayablePlay = function onPlayablePlay() {
|
|
13854
|
-
this.bindingItem.transform.setValid(true);
|
|
13855
|
-
this.showRendererComponents();
|
|
13856
13977
|
};
|
|
13857
|
-
_proto.
|
|
13858
|
-
this.
|
|
13859
|
-
|
|
13978
|
+
_proto.onDestroy = function onDestroy() {
|
|
13979
|
+
if (this.item && this.item.composition) {
|
|
13980
|
+
this.item.composition.destroyTextures(this.getTextures());
|
|
13981
|
+
}
|
|
13860
13982
|
};
|
|
13861
|
-
_proto.
|
|
13862
|
-
|
|
13863
|
-
|
|
13864
|
-
|
|
13865
|
-
|
|
13983
|
+
_proto.getItemInitData = function getItemInitData(item, idx, pointStartIndex, textureIndex) {
|
|
13984
|
+
var geoData = item.geoData;
|
|
13985
|
+
if (!geoData) {
|
|
13986
|
+
geoData = item.geoData = this.getItemGeometryData(item, idx);
|
|
13987
|
+
}
|
|
13988
|
+
var index = geoData.index;
|
|
13989
|
+
var idxCount = index.length;
|
|
13990
|
+
// @ts-expect-error
|
|
13991
|
+
var indexData = this.wireframe ? new Uint8Array([
|
|
13992
|
+
0,
|
|
13993
|
+
1,
|
|
13994
|
+
1,
|
|
13995
|
+
3,
|
|
13996
|
+
2,
|
|
13997
|
+
3,
|
|
13998
|
+
2,
|
|
13999
|
+
0
|
|
14000
|
+
]) : new index.constructor(idxCount);
|
|
14001
|
+
if (!this.wireframe) {
|
|
14002
|
+
for(var i = 0; i < idxCount; i++){
|
|
14003
|
+
indexData[i] = pointStartIndex + index[i];
|
|
13866
14004
|
}
|
|
13867
14005
|
}
|
|
14006
|
+
return {
|
|
14007
|
+
atlasOffset: geoData.atlasOffset,
|
|
14008
|
+
index: indexData
|
|
14009
|
+
};
|
|
13868
14010
|
};
|
|
13869
|
-
_proto.
|
|
13870
|
-
|
|
13871
|
-
|
|
13872
|
-
|
|
13873
|
-
|
|
13874
|
-
}
|
|
13875
|
-
}
|
|
13876
|
-
};
|
|
13877
|
-
return ActivationPlayable;
|
|
13878
|
-
}(Playable);
|
|
13879
|
-
|
|
13880
|
-
/**
|
|
13881
|
-
* @since 2.0.0
|
|
13882
|
-
* @internal
|
|
13883
|
-
*/ var TimelineComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
13884
|
-
_inherits(TimelineComponent, ItemBehaviour);
|
|
13885
|
-
function TimelineComponent(engine) {
|
|
13886
|
-
var _this;
|
|
13887
|
-
_this = ItemBehaviour.call(this, engine) || this;
|
|
13888
|
-
_this.reusable = false;
|
|
13889
|
-
_this.timelineStarted = false;
|
|
13890
|
-
_this.playableGraph = new PlayableGraph();
|
|
13891
|
-
/**
|
|
13892
|
-
* 元素动画已经播放的时间
|
|
13893
|
-
*/ _this.time = 0;
|
|
13894
|
-
_this.tracks = [];
|
|
13895
|
-
_this.trackSeed = 0;
|
|
13896
|
-
return _this;
|
|
13897
|
-
}
|
|
13898
|
-
var _proto = TimelineComponent.prototype;
|
|
13899
|
-
_proto.start = function start() {
|
|
13900
|
-
// TODO TimelineClip 需要传入 start 和 duration 数据
|
|
13901
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
|
|
13902
|
-
var track = _step.value;
|
|
13903
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(track.getClips()), _step1; !(_step1 = _iterator1()).done;){
|
|
13904
|
-
var clip = _step1.value;
|
|
13905
|
-
clip.start = this.item.start;
|
|
13906
|
-
clip.duration = this.item.duration;
|
|
13907
|
-
}
|
|
14011
|
+
_proto.setItem = function setItem() {
|
|
14012
|
+
var textures = [];
|
|
14013
|
+
var texture = this.renderer.texture;
|
|
14014
|
+
if (texture) {
|
|
14015
|
+
addItem(textures, texture);
|
|
13908
14016
|
}
|
|
13909
|
-
this.
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
13914
|
-
|
|
14017
|
+
texture = this.renderer.texture;
|
|
14018
|
+
var textureIndex = texture ? textures.indexOf(texture) : -1;
|
|
14019
|
+
var data = this.getItemInitData(this, 0, 0, textureIndex);
|
|
14020
|
+
var renderer = this.renderer;
|
|
14021
|
+
var texParams = this.material.getVector4("_TexParams");
|
|
14022
|
+
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
14023
|
+
texParams.y = +this.preMultiAlpha;
|
|
14024
|
+
texParams.z = renderer.renderMode;
|
|
14025
|
+
var attributes = {
|
|
14026
|
+
atlasOffset: new Float32Array(data.atlasOffset.length),
|
|
14027
|
+
index: new Uint16Array(data.index.length)
|
|
14028
|
+
};
|
|
14029
|
+
attributes.atlasOffset.set(data.atlasOffset);
|
|
14030
|
+
attributes.index.set(data.index);
|
|
14031
|
+
var _this = this, material = _this.material, geometry = _this.geometry;
|
|
14032
|
+
var indexData = attributes.index;
|
|
14033
|
+
geometry.setIndexData(indexData);
|
|
14034
|
+
geometry.setAttributeData("atlasOffset", attributes.atlasOffset);
|
|
14035
|
+
geometry.setDrawCount(data.index.length);
|
|
14036
|
+
for(var i = 0; i < textures.length; i++){
|
|
14037
|
+
var texture1 = textures[i];
|
|
14038
|
+
material.setTexture("uSampler" + i, texture1);
|
|
13915
14039
|
}
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
var clip = _step1.value;
|
|
13921
|
-
clip.playable.onGraphStart();
|
|
13922
|
-
}
|
|
13923
|
-
}
|
|
13924
|
-
this.timelineStarted = true;
|
|
14040
|
+
// FIXME: 内存泄漏的临时方案,后面再调整
|
|
14041
|
+
var emptyTexture = this.emptyTexture;
|
|
14042
|
+
for(var k = textures.length; k < exports.maxSpriteMeshItemCount; k++){
|
|
14043
|
+
material.setTexture("uSampler" + k, emptyTexture);
|
|
13925
14044
|
}
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
13934
|
-
|
|
14045
|
+
};
|
|
14046
|
+
_proto.createGeometry = function createGeometry(mode) {
|
|
14047
|
+
var maxVertex = 12 * this.splits.length;
|
|
14048
|
+
return Geometry.create(this.engine, {
|
|
14049
|
+
attributes: {
|
|
14050
|
+
aPos: {
|
|
14051
|
+
type: glContext.FLOAT,
|
|
14052
|
+
size: 3,
|
|
14053
|
+
data: new Float32Array([
|
|
14054
|
+
-0.5,
|
|
14055
|
+
0.5,
|
|
14056
|
+
0,
|
|
14057
|
+
-0.5,
|
|
14058
|
+
-0.5,
|
|
14059
|
+
0,
|
|
14060
|
+
0.5,
|
|
14061
|
+
0.5,
|
|
14062
|
+
0,
|
|
14063
|
+
0.5,
|
|
14064
|
+
-0.5,
|
|
14065
|
+
0
|
|
14066
|
+
])
|
|
14067
|
+
},
|
|
14068
|
+
atlasOffset: {
|
|
14069
|
+
size: 2,
|
|
14070
|
+
offset: 0,
|
|
14071
|
+
releasable: true,
|
|
14072
|
+
type: glContext.FLOAT,
|
|
14073
|
+
data: new Float32Array(0)
|
|
13935
14074
|
}
|
|
13936
|
-
}
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
|
|
13943
|
-
|
|
14075
|
+
},
|
|
14076
|
+
indices: {
|
|
14077
|
+
data: new Uint16Array(0),
|
|
14078
|
+
releasable: true
|
|
14079
|
+
},
|
|
14080
|
+
mode: mode,
|
|
14081
|
+
maxVertex: maxVertex
|
|
14082
|
+
});
|
|
14083
|
+
};
|
|
14084
|
+
_proto.createMaterial = function createMaterial(renderInfo, count) {
|
|
14085
|
+
var side = renderInfo.side, occlusion = renderInfo.occlusion, blending = renderInfo.blending, maskMode = renderInfo.maskMode, mask = renderInfo.mask;
|
|
14086
|
+
var materialProps = {
|
|
14087
|
+
shader: spriteMeshShaderFromRenderInfo(renderInfo, count, 1)
|
|
14088
|
+
};
|
|
14089
|
+
this.preMultiAlpha = getPreMultiAlpha(blending);
|
|
14090
|
+
var material = Material.create(this.engine, materialProps);
|
|
14091
|
+
var states = {
|
|
14092
|
+
side: side,
|
|
14093
|
+
blending: true,
|
|
14094
|
+
blendMode: blending,
|
|
14095
|
+
mask: mask,
|
|
14096
|
+
maskMode: maskMode,
|
|
14097
|
+
depthTest: true,
|
|
14098
|
+
depthMask: occlusion
|
|
14099
|
+
};
|
|
14100
|
+
material.blending = states.blending;
|
|
14101
|
+
material.stencilRef = states.mask !== undefined ? [
|
|
14102
|
+
states.mask,
|
|
14103
|
+
states.mask
|
|
14104
|
+
] : undefined;
|
|
14105
|
+
material.depthTest = states.depthTest;
|
|
14106
|
+
material.depthMask = states.depthMask;
|
|
14107
|
+
setBlendMode(material, states.blendMode);
|
|
14108
|
+
setMaskMode(material, states.maskMode);
|
|
14109
|
+
setSideMode(material, states.side);
|
|
14110
|
+
if (!material.hasUniform("_Color")) {
|
|
14111
|
+
material.setVector4("_Color", new Vector4(0, 0, 0, 1));
|
|
13944
14112
|
}
|
|
13945
|
-
if (
|
|
13946
|
-
|
|
13947
|
-
if (!this.item.ended) {
|
|
13948
|
-
this.item.ended = true;
|
|
13949
|
-
this.item.onEnd();
|
|
13950
|
-
if (endBehavior === ItemEndBehavior.destroy) {
|
|
13951
|
-
for(var _iterator4 = _create_for_of_iterator_helper_loose(this.tracks), _step4; !(_step4 = _iterator4()).done;){
|
|
13952
|
-
var track2 = _step4.value;
|
|
13953
|
-
for(var _iterator5 = _create_for_of_iterator_helper_loose(track2.getClips()), _step5; !(_step5 = _iterator5()).done;){
|
|
13954
|
-
var clip2 = _step5.value;
|
|
13955
|
-
clip2.playable.onPlayableDestroy();
|
|
13956
|
-
}
|
|
13957
|
-
}
|
|
13958
|
-
this.item.delaying = true;
|
|
13959
|
-
if (!this.item.reusable && !this.reusable) {
|
|
13960
|
-
this.item.dispose();
|
|
13961
|
-
return;
|
|
13962
|
-
}
|
|
13963
|
-
}
|
|
13964
|
-
}
|
|
14113
|
+
if (!material.hasUniform("_TexOffset")) {
|
|
14114
|
+
material.setVector4("_TexOffset", new Vector4());
|
|
13965
14115
|
}
|
|
13966
|
-
|
|
13967
|
-
|
|
13968
|
-
if (!this.item.delaying) {
|
|
13969
|
-
var lifetime = this.time / this.item.duration;
|
|
13970
|
-
this.item.lifetime = lifetime;
|
|
13971
|
-
for(var _iterator6 = _create_for_of_iterator_helper_loose(this.tracks), _step6; !(_step6 = _iterator6()).done;){
|
|
13972
|
-
var track3 = _step6.value;
|
|
13973
|
-
for(var _iterator7 = _create_for_of_iterator_helper_loose(track3.getClips()), _step7; !(_step7 = _iterator7()).done;){
|
|
13974
|
-
var clip3 = _step7.value;
|
|
13975
|
-
clip3.playable.setTime(this.time);
|
|
13976
|
-
}
|
|
13977
|
-
}
|
|
13978
|
-
this.playableGraph.evaluate(dt);
|
|
14116
|
+
if (!material.hasUniform("_TexParams")) {
|
|
14117
|
+
material.setVector4("_TexParams", new Vector4());
|
|
13979
14118
|
}
|
|
14119
|
+
return material;
|
|
13980
14120
|
};
|
|
13981
|
-
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
13986
|
-
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
|
|
13992
|
-
|
|
13993
|
-
|
|
13994
|
-
} else if (this.options.endBehavior === END_BEHAVIOR_FREEZE) {
|
|
13995
|
-
localTime = Math.min(duration, localTime);
|
|
14121
|
+
_proto.getItemGeometryData = function getItemGeometryData(item, aIndex) {
|
|
14122
|
+
var splits = item.splits, renderer = item.renderer, textureSheetAnimation = item.textureSheetAnimation;
|
|
14123
|
+
var sx = 1, sy = 1;
|
|
14124
|
+
if (renderer.shape) {
|
|
14125
|
+
var _renderer_shape = renderer.shape, index = _renderer_shape.index, aPoint = _renderer_shape.aPoint;
|
|
14126
|
+
var point = new Float32Array(aPoint);
|
|
14127
|
+
var position = [];
|
|
14128
|
+
var atlasOffset = [];
|
|
14129
|
+
for(var i = 0; i < point.length; i += 6){
|
|
14130
|
+
point[i] *= sx;
|
|
14131
|
+
point[i + 1] *= sy;
|
|
14132
|
+
atlasOffset.push(aPoint[i + 2], aPoint[i + 3]);
|
|
14133
|
+
position.push(point[i], point[i + 1], 0.0);
|
|
13996
14134
|
}
|
|
14135
|
+
this.geometry.setAttributeData("aPos", new Float32Array(position));
|
|
14136
|
+
return {
|
|
14137
|
+
index: index,
|
|
14138
|
+
atlasOffset: atlasOffset
|
|
14139
|
+
};
|
|
13997
14140
|
}
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
|
|
14009
|
-
|
|
14010
|
-
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14141
|
+
var originData = [
|
|
14142
|
+
-.5,
|
|
14143
|
+
.5,
|
|
14144
|
+
-.5,
|
|
14145
|
+
-.5,
|
|
14146
|
+
.5,
|
|
14147
|
+
.5,
|
|
14148
|
+
.5,
|
|
14149
|
+
-.5
|
|
14150
|
+
];
|
|
14151
|
+
var atlasOffset1 = [];
|
|
14152
|
+
var index1 = [];
|
|
14153
|
+
var col = 2;
|
|
14154
|
+
var row = 2;
|
|
14155
|
+
if (splits.length === 1) {
|
|
14156
|
+
col = 1;
|
|
14157
|
+
row = 1;
|
|
14158
|
+
}
|
|
14159
|
+
var position1 = [];
|
|
14160
|
+
for(var x = 0; x < col; x++){
|
|
14161
|
+
for(var y = 0; y < row; y++){
|
|
14162
|
+
var base = (y * 2 + x) * 4;
|
|
14163
|
+
// @ts-expect-error
|
|
14164
|
+
var split = textureSheetAnimation ? [
|
|
14165
|
+
0,
|
|
14166
|
+
0,
|
|
14167
|
+
1,
|
|
14168
|
+
1,
|
|
14169
|
+
splits[0][4]
|
|
14170
|
+
] : splits[y * 2 + x];
|
|
14171
|
+
var texOffset = split[4] ? [
|
|
14172
|
+
0,
|
|
14173
|
+
0,
|
|
14174
|
+
1,
|
|
14175
|
+
0,
|
|
14176
|
+
0,
|
|
14177
|
+
1,
|
|
14178
|
+
1,
|
|
14179
|
+
1
|
|
14180
|
+
] : [
|
|
14181
|
+
0,
|
|
14182
|
+
1,
|
|
14183
|
+
0,
|
|
14184
|
+
0,
|
|
14185
|
+
1,
|
|
14186
|
+
1,
|
|
14187
|
+
1,
|
|
14188
|
+
0
|
|
14189
|
+
];
|
|
14190
|
+
var dw = ((x + x + 1) / col - 1) / 2;
|
|
14191
|
+
var dh = ((y + y + 1) / row - 1) / 2;
|
|
14192
|
+
var tox = split[0];
|
|
14193
|
+
var toy = split[1];
|
|
14194
|
+
var tsx = split[4] ? split[3] : split[2];
|
|
14195
|
+
var tsy = split[4] ? split[2] : split[3];
|
|
14196
|
+
var origin = [
|
|
14197
|
+
originData[0] / col + dw,
|
|
14198
|
+
originData[1] / row + dh,
|
|
14199
|
+
originData[2] / col + dw,
|
|
14200
|
+
originData[3] / row + dh,
|
|
14201
|
+
originData[4] / col + dw,
|
|
14202
|
+
originData[5] / row + dh,
|
|
14203
|
+
originData[6] / col + dw,
|
|
14204
|
+
originData[7] / row + dh
|
|
14205
|
+
];
|
|
14206
|
+
atlasOffset1.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);
|
|
14207
|
+
position1.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);
|
|
14208
|
+
index1.push(base, 1 + base, 2 + base, 2 + base, 1 + base, 3 + base);
|
|
14016
14209
|
}
|
|
14017
14210
|
}
|
|
14211
|
+
this.geometry.setAttributeData("aPos", new Float32Array(position1));
|
|
14212
|
+
return {
|
|
14213
|
+
index: index1,
|
|
14214
|
+
atlasOffset: atlasOffset1
|
|
14215
|
+
};
|
|
14018
14216
|
};
|
|
14019
|
-
_proto.
|
|
14020
|
-
|
|
14021
|
-
this.
|
|
14217
|
+
_proto.getTextures = function getTextures() {
|
|
14218
|
+
var ret = [];
|
|
14219
|
+
var tex = this.renderer.texture;
|
|
14220
|
+
if (tex) {
|
|
14221
|
+
ret.push(tex);
|
|
14222
|
+
}
|
|
14223
|
+
return ret;
|
|
14022
14224
|
};
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
trackOutput.setSourcePlayeble(trackMixPlayable);
|
|
14225
|
+
/**
|
|
14226
|
+
* 获取图层包围盒的类型和世界坐标
|
|
14227
|
+
* @returns
|
|
14228
|
+
*/ _proto.getBoundingBox = function getBoundingBox() {
|
|
14229
|
+
if (!this.item) {
|
|
14230
|
+
return;
|
|
14030
14231
|
}
|
|
14232
|
+
var worldMatrix = this.transform.getWorldMatrix();
|
|
14233
|
+
var triangles = trianglesFromRect(Vector3.ZERO, 0.5 * this.transform.size.x, 0.5 * this.transform.size.y);
|
|
14234
|
+
triangles.forEach(function(triangle) {
|
|
14235
|
+
worldMatrix.transformPoint(triangle.p0);
|
|
14236
|
+
worldMatrix.transformPoint(triangle.p1);
|
|
14237
|
+
worldMatrix.transformPoint(triangle.p2);
|
|
14238
|
+
});
|
|
14239
|
+
return {
|
|
14240
|
+
type: exports.HitTestType.triangle,
|
|
14241
|
+
area: triangles
|
|
14242
|
+
};
|
|
14031
14243
|
};
|
|
14244
|
+
// TODO: [1.31] @十弦 https://github.com/galacean/effects-runtime/commit/fe8736540b9a461d8e96658f4d755ff8089a263b#diff-a3618f4527c5fe6e842f20d67d5c82984568502c6bf6fdfcbd24f69e2894ca90
|
|
14032
14245
|
_proto.fromData = function fromData(data) {
|
|
14033
|
-
|
|
14034
|
-
|
|
14035
|
-
|
|
14036
|
-
|
|
14037
|
-
looping: this.item.endBehavior === ItemEndBehavior.loop,
|
|
14038
|
-
endBehavior: this.item.endBehavior || ItemEndBehavior.destroy
|
|
14039
|
-
};
|
|
14040
|
-
this.id = this.item.id;
|
|
14041
|
-
this.name = this.item.name;
|
|
14042
|
-
var activationTrack = this.createTrack(Track, "ActivationTrack");
|
|
14043
|
-
activationTrack.createClip(ActivationPlayable, "ActivationTimelineClip");
|
|
14044
|
-
//@ts-expect-error
|
|
14045
|
-
if (data.tracks) {
|
|
14246
|
+
RendererComponent.prototype.fromData.call(this, data);
|
|
14247
|
+
var interaction = data.interaction, options = data.options, _data_listIndex = data.listIndex, listIndex = _data_listIndex === void 0 ? 0 : _data_listIndex;
|
|
14248
|
+
var renderer = data.renderer;
|
|
14249
|
+
if (!renderer) {
|
|
14046
14250
|
//@ts-expect-error
|
|
14047
|
-
|
|
14048
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(tracks), _step; !(_step = _iterator()).done;){
|
|
14049
|
-
var track = _step.value;
|
|
14050
|
-
var newTrack = this.createTrack(Track);
|
|
14051
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(track.clips), _step1; !(_step1 = _iterator1()).done;){
|
|
14052
|
-
var clipAsset = _step1.value;
|
|
14053
|
-
switch(clipAsset.dataType){
|
|
14054
|
-
case "TransformAnimationPlayableAsset":
|
|
14055
|
-
newTrack.name = "AnimationTrack";
|
|
14056
|
-
newTrack.createClip(TransformAnimationPlayable, "AnimationTimelineClip").playable.fromData(clipAsset.animationClip);
|
|
14057
|
-
break;
|
|
14058
|
-
case "SpriteColorAnimationPlayableAsset":
|
|
14059
|
-
newTrack.name = "SpriteColorTrack";
|
|
14060
|
-
newTrack.createClip(SpriteColorPlayable, "SpriteColorClip").playable.fromData(clipAsset.animationClip);
|
|
14061
|
-
break;
|
|
14062
|
-
}
|
|
14063
|
-
}
|
|
14064
|
-
}
|
|
14251
|
+
renderer = {};
|
|
14065
14252
|
}
|
|
14066
|
-
|
|
14067
|
-
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
|
|
14071
|
-
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
var
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
var
|
|
14092
|
-
var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
14093
|
-
_inherits(SpriteColorPlayable, Playable);
|
|
14094
|
-
function SpriteColorPlayable() {
|
|
14095
|
-
var _this;
|
|
14096
|
-
_this = Playable.apply(this, arguments) || this;
|
|
14097
|
-
_this.renderColor = [
|
|
14253
|
+
this.interaction = interaction;
|
|
14254
|
+
var _renderer_renderMode, _renderer_blending, _renderer_texture, _renderer_side, _renderer_mask, _renderer_maskMode;
|
|
14255
|
+
this.renderer = {
|
|
14256
|
+
renderMode: (_renderer_renderMode = renderer.renderMode) != null ? _renderer_renderMode : RenderMode.BILLBOARD,
|
|
14257
|
+
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
14258
|
+
texture: (_renderer_texture = renderer.texture) != null ? _renderer_texture : this.engine.emptyTexture,
|
|
14259
|
+
occlusion: !!renderer.occlusion,
|
|
14260
|
+
transparentOcclusion: !!renderer.transparentOcclusion || renderer.maskMode === MaskMode.MASK,
|
|
14261
|
+
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
14262
|
+
shape: renderer.shape,
|
|
14263
|
+
mask: (_renderer_mask = renderer.mask) != null ? _renderer_mask : 0,
|
|
14264
|
+
maskMode: (_renderer_maskMode = renderer.maskMode) != null ? _renderer_maskMode : MaskMode.NONE,
|
|
14265
|
+
order: listIndex
|
|
14266
|
+
};
|
|
14267
|
+
this.emptyTexture = this.engine.emptyTexture;
|
|
14268
|
+
this.splits = data.splits || singleSplits;
|
|
14269
|
+
this.textureSheetAnimation = data.textureSheetAnimation;
|
|
14270
|
+
this.cachePrefix = "-";
|
|
14271
|
+
this.renderInfo = getImageItemRenderInfo(this);
|
|
14272
|
+
var geometry = this.createGeometry(glContext.TRIANGLES);
|
|
14273
|
+
var material = this.createMaterial(this.renderInfo, 2);
|
|
14274
|
+
this.worldMatrix = Matrix4.fromIdentity();
|
|
14275
|
+
this.material = material;
|
|
14276
|
+
this.geometry = geometry;
|
|
14277
|
+
this.name = "MSprite" + seed$3++;
|
|
14278
|
+
var startColor = options.startColor || [
|
|
14098
14279
|
1,
|
|
14099
14280
|
1,
|
|
14100
14281
|
1,
|
|
14101
14282
|
1
|
|
14102
14283
|
];
|
|
14103
|
-
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
this.spriteMaterial = this.bindingItem.getComponent(exports.SpriteComponent).material;
|
|
14108
|
-
};
|
|
14109
|
-
_proto.processFrame = function processFrame(dt) {
|
|
14110
|
-
var colorInc = vecFill(tempColor, 1);
|
|
14111
|
-
var colorChanged;
|
|
14112
|
-
var life = this.time / this.bindingItem.duration;
|
|
14113
|
-
var opacityOverLifetime = this.opacityOverLifetime;
|
|
14114
|
-
var colorOverLifetime = this.colorOverLifetime;
|
|
14115
|
-
if (colorOverLifetime) {
|
|
14116
|
-
colorInc = getColorFromGradientStops(colorOverLifetime, life, true);
|
|
14117
|
-
colorChanged = true;
|
|
14118
|
-
}
|
|
14119
|
-
if (opacityOverLifetime) {
|
|
14120
|
-
colorInc[3] *= opacityOverLifetime.getValue(life);
|
|
14121
|
-
colorChanged = true;
|
|
14122
|
-
}
|
|
14123
|
-
if (colorChanged) {
|
|
14124
|
-
vecMulCombine(this.renderColor, colorInc, this.startColor);
|
|
14125
|
-
this.spriteMaterial.getVector4("_Color").setFromArray(this.renderColor);
|
|
14126
|
-
}
|
|
14127
|
-
};
|
|
14128
|
-
_proto.fromData = function fromData(clipData) {
|
|
14129
|
-
this.clipData = clipData;
|
|
14130
|
-
var colorOverLifetime = clipData.colorOverLifetime;
|
|
14131
|
-
if (colorOverLifetime) {
|
|
14132
|
-
var _colorOverLifetime_opacity;
|
|
14133
|
-
this.opacityOverLifetime = createValueGetter((_colorOverLifetime_opacity = colorOverLifetime.opacity) != null ? _colorOverLifetime_opacity : 1);
|
|
14134
|
-
if (colorOverLifetime.color && colorOverLifetime.color[0] === ValueType.GRADIENT_COLOR) {
|
|
14135
|
-
this.colorOverLifetime = colorStopsFromGradient(colorOverLifetime.color[1]);
|
|
14136
|
-
}
|
|
14137
|
-
}
|
|
14138
|
-
this.startColor = clipData.startColor || [
|
|
14139
|
-
1,
|
|
14140
|
-
1,
|
|
14284
|
+
this.material.setVector4("_Color", new Vector4().setFromArray(startColor));
|
|
14285
|
+
this.material.setVector4("_TexOffset", new Vector4().setFromArray([
|
|
14286
|
+
0,
|
|
14287
|
+
0,
|
|
14141
14288
|
1,
|
|
14142
14289
|
1
|
|
14143
|
-
];
|
|
14144
|
-
|
|
14290
|
+
]));
|
|
14291
|
+
this.setItem();
|
|
14145
14292
|
};
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14157
|
-
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
|
|
14165
|
-
|
|
14166
|
-
|
|
14167
|
-
|
|
14168
|
-
|
|
14169
|
-
|
|
14170
|
-
|
|
14171
|
-
|
|
14172
|
-
|
|
14173
|
-
|
|
14293
|
+
_proto.toData = function toData() {
|
|
14294
|
+
RendererComponent.prototype.toData.call(this);
|
|
14295
|
+
};
|
|
14296
|
+
return SpriteComponent;
|
|
14297
|
+
}(RendererComponent);
|
|
14298
|
+
exports.SpriteComponent = __decorate([
|
|
14299
|
+
effectsClass(DataType.SpriteComponent)
|
|
14300
|
+
], exports.SpriteComponent);
|
|
14301
|
+
|
|
14302
|
+
var RUNTIME_ENV = "runtime_env";
|
|
14303
|
+
var RENDER_PREFER_LOOKUP_TEXTURE = "lookup_texture";
|
|
14304
|
+
// 文本元素使用 offscreen canvas 绘制
|
|
14305
|
+
var TEMPLATE_USE_OFFSCREEN_CANVAS = "offscreen_canvas";
|
|
14306
|
+
// 后处理配置相关
|
|
14307
|
+
var POST_PROCESS_SETTINGS = "post_process_settings";
|
|
14308
|
+
var config = {};
|
|
14309
|
+
function getConfig(name) {
|
|
14310
|
+
return config[name];
|
|
14311
|
+
}
|
|
14312
|
+
function setConfig(name, value) {
|
|
14313
|
+
return config[name] = value;
|
|
14314
|
+
}
|
|
14315
|
+
|
|
14316
|
+
var Cone = /*#__PURE__*/ function() {
|
|
14317
|
+
function Cone(props) {
|
|
14318
|
+
var _this = this;
|
|
14319
|
+
Object.keys(props).forEach(function(key) {
|
|
14320
|
+
_this[key] = props[key];
|
|
14321
|
+
});
|
|
14322
|
+
}
|
|
14323
|
+
var _proto = Cone.prototype;
|
|
14324
|
+
_proto.generate = function generate(opt) {
|
|
14325
|
+
var arc = getArcAngle(this.arc, this.arcMode, opt);
|
|
14326
|
+
var a = arc * DEG2RAD;
|
|
14327
|
+
var x = Math.cos(a) * this.radius;
|
|
14328
|
+
var y = Math.sin(a) * this.radius;
|
|
14329
|
+
var position = new Vector3(x, y, 0);
|
|
14330
|
+
var l = Math.tan(this.angle * DEG2RAD);
|
|
14331
|
+
var dir = position.clone().multiply(l);
|
|
14332
|
+
// dir + [0,0,1]
|
|
14333
|
+
dir.z += 1;
|
|
14334
|
+
return {
|
|
14335
|
+
position: position.multiply(random(0, 1)),
|
|
14336
|
+
direction: dir.normalize()
|
|
14174
14337
|
};
|
|
14175
|
-
|
|
14176
|
-
|
|
14177
|
-
|
|
14178
|
-
|
|
14338
|
+
};
|
|
14339
|
+
return Cone;
|
|
14340
|
+
}();
|
|
14341
|
+
function getArcAngle(arc, arcMode, opt) {
|
|
14342
|
+
if (arcMode === ShapeArcMode.RANDOM) {
|
|
14343
|
+
arc = random(0, arc);
|
|
14344
|
+
} else if (arcMode === ShapeArcMode.UNIDIRECTIONAL_CYCLE) {
|
|
14345
|
+
var d = opt.index % (opt.total + 1);
|
|
14346
|
+
arc = arc / opt.total * d;
|
|
14347
|
+
} else if (arcMode === ShapeArcMode.BIDIRECTIONAL_CYCLE) {
|
|
14348
|
+
var d1 = opt.index / (opt.total + 1);
|
|
14349
|
+
var i = d1 - Math.floor(d1);
|
|
14350
|
+
arc = arc * (Math.floor(d1) % 2 ? 1 - i : i);
|
|
14351
|
+
} else if (arcMode === ShapeArcMode.UNIFORM_BURST) {
|
|
14352
|
+
arc = arc * opt.burstIndex / opt.burstCount;
|
|
14179
14353
|
}
|
|
14180
|
-
|
|
14181
|
-
|
|
14182
|
-
|
|
14183
|
-
|
|
14184
|
-
|
|
14185
|
-
|
|
14354
|
+
return arc;
|
|
14355
|
+
}
|
|
14356
|
+
|
|
14357
|
+
var Circle = /*#__PURE__*/ function() {
|
|
14358
|
+
function Circle(props) {
|
|
14359
|
+
var _this = this;
|
|
14360
|
+
Object.keys(props).forEach(function(key) {
|
|
14361
|
+
_this[key] = props[key];
|
|
14362
|
+
});
|
|
14363
|
+
}
|
|
14364
|
+
var _proto = Circle.prototype;
|
|
14365
|
+
_proto.generate = function generate(opt) {
|
|
14366
|
+
var arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
14367
|
+
var direction = new Vector3(Math.cos(arc), Math.sin(arc), 0);
|
|
14368
|
+
var radius = this.radius;
|
|
14369
|
+
return {
|
|
14370
|
+
direction: direction,
|
|
14371
|
+
position: direction.clone().multiply(radius)
|
|
14372
|
+
};
|
|
14186
14373
|
};
|
|
14187
|
-
|
|
14188
|
-
|
|
14189
|
-
|
|
14190
|
-
|
|
14374
|
+
return Circle;
|
|
14375
|
+
}();
|
|
14376
|
+
var Rectangle = /*#__PURE__*/ function() {
|
|
14377
|
+
function Rectangle(arg) {
|
|
14378
|
+
this._d = (arg.width || 1) / 2;
|
|
14379
|
+
this._h = (arg.height || 1) / 2;
|
|
14380
|
+
}
|
|
14381
|
+
var _proto = Rectangle.prototype;
|
|
14382
|
+
_proto.generate = function generate(opt) {
|
|
14383
|
+
var x = random(-this._d, this._d);
|
|
14384
|
+
var y = random(-this._h, this._h);
|
|
14385
|
+
return {
|
|
14386
|
+
direction: new Vector3(0, 0, 1),
|
|
14387
|
+
position: new Vector3(x, y, 0)
|
|
14388
|
+
};
|
|
14191
14389
|
};
|
|
14192
|
-
|
|
14193
|
-
|
|
14194
|
-
|
|
14195
|
-
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
this.
|
|
14199
|
-
this.
|
|
14390
|
+
return Rectangle;
|
|
14391
|
+
}();
|
|
14392
|
+
var RectangleEdge = /*#__PURE__*/ function() {
|
|
14393
|
+
function RectangleEdge(arg) {
|
|
14394
|
+
this._d = (arg.width || 1) / 2;
|
|
14395
|
+
this._h = (arg.height || 1) / 2;
|
|
14396
|
+
this.arcMode = arg.arcMode;
|
|
14397
|
+
this.arc = arg.arc;
|
|
14398
|
+
}
|
|
14399
|
+
var _proto = RectangleEdge.prototype;
|
|
14400
|
+
_proto.generate = function generate(opt) {
|
|
14401
|
+
var arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
14402
|
+
var direction = new Vector3(Math.cos(arc), Math.sin(arc), 0);
|
|
14403
|
+
var w = this._d;
|
|
14404
|
+
var h = this._h;
|
|
14405
|
+
var r0 = Math.atan2(h, w);
|
|
14406
|
+
var tan = Math.tan(arc);
|
|
14407
|
+
var position = new Vector3();
|
|
14408
|
+
if (arc < r0) {
|
|
14409
|
+
position.set(w, w * tan, 0);
|
|
14410
|
+
} else if (arc >= r0 && arc < Math.PI - r0) {
|
|
14411
|
+
position.set(h / tan, h, 0);
|
|
14412
|
+
} else if (arc < Math.PI + r0) {
|
|
14413
|
+
position.set(-w, -w * tan, 0);
|
|
14414
|
+
} else if (arc < Math.PI * 2 - r0) {
|
|
14415
|
+
position.set(-h / tan, -h, 0);
|
|
14416
|
+
} else {
|
|
14417
|
+
position.set(w, w * tan, 0);
|
|
14418
|
+
}
|
|
14419
|
+
return {
|
|
14420
|
+
direction: direction,
|
|
14421
|
+
position: position
|
|
14422
|
+
};
|
|
14200
14423
|
};
|
|
14201
|
-
|
|
14202
|
-
|
|
14203
|
-
|
|
14204
|
-
|
|
14205
|
-
|
|
14206
|
-
this.
|
|
14207
|
-
this.
|
|
14424
|
+
return RectangleEdge;
|
|
14425
|
+
}();
|
|
14426
|
+
var Edge = /*#__PURE__*/ function() {
|
|
14427
|
+
function Edge(args) {
|
|
14428
|
+
// TODO: 为通过帧对比暂时使用老计算,修复粒子发射器直线宽度问题下面一行改为: this._d = args.width || 1 ;
|
|
14429
|
+
this._d = (args.width || 1) / 2;
|
|
14430
|
+
this.arcMode = args.arcMode;
|
|
14431
|
+
}
|
|
14432
|
+
var _proto = Edge.prototype;
|
|
14433
|
+
_proto.generate = function generate(options) {
|
|
14434
|
+
var x = this.arcMode === ShapeArcMode.UNIFORM_BURST ? options.burstIndex % options.burstCount / (options.burstCount - 1) : random(0, 1);
|
|
14435
|
+
return {
|
|
14436
|
+
direction: new Vector3(0, 1, 0),
|
|
14437
|
+
position: new Vector3(this._d * (x - 0.5), 0, 0)
|
|
14438
|
+
};
|
|
14208
14439
|
};
|
|
14209
|
-
|
|
14210
|
-
|
|
14211
|
-
|
|
14212
|
-
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
|
|
14217
|
-
|
|
14218
|
-
|
|
14219
|
-
|
|
14440
|
+
return Edge;
|
|
14441
|
+
}();
|
|
14442
|
+
|
|
14443
|
+
var tempMat4$2 = new Matrix4();
|
|
14444
|
+
var Donut = /*#__PURE__*/ function() {
|
|
14445
|
+
function Donut(props) {
|
|
14446
|
+
var _this = this;
|
|
14447
|
+
Object.keys(props).forEach(function(key) {
|
|
14448
|
+
_this[key] = props[key];
|
|
14449
|
+
});
|
|
14450
|
+
}
|
|
14451
|
+
var _proto = Donut.prototype;
|
|
14452
|
+
_proto.generate = function generate(opt) {
|
|
14453
|
+
var dradius = this.donutRadius;
|
|
14454
|
+
var center = this.radius - dradius;
|
|
14455
|
+
var angle = random(0, Math.PI * 2);
|
|
14456
|
+
var arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
14457
|
+
var rot = tempMat4$2.setFromRotationZ(arc);
|
|
14458
|
+
var direction = new Vector3(Math.cos(angle), Math.sin(angle), 0);
|
|
14459
|
+
var position = new Vector3(center + Math.cos(angle) * dradius, 0, Math.sin(angle) * dradius);
|
|
14460
|
+
return {
|
|
14461
|
+
direction: rot.transformNormal(direction),
|
|
14462
|
+
position: rot.transformPoint(position)
|
|
14463
|
+
};
|
|
14220
14464
|
};
|
|
14221
|
-
|
|
14222
|
-
|
|
14223
|
-
|
|
14224
|
-
|
|
14465
|
+
return Donut;
|
|
14466
|
+
}();
|
|
14467
|
+
|
|
14468
|
+
var tempMat4$1 = new Matrix4();
|
|
14469
|
+
var Sphere = /*#__PURE__*/ function() {
|
|
14470
|
+
function Sphere(props) {
|
|
14471
|
+
var _this = this;
|
|
14472
|
+
Object.keys(props).forEach(function(key) {
|
|
14473
|
+
_this[key] = props[key];
|
|
14474
|
+
});
|
|
14475
|
+
}
|
|
14476
|
+
var _proto = Sphere.prototype;
|
|
14477
|
+
_proto.getHorizontalAngle = function getHorizontalAngle() {
|
|
14478
|
+
return random(-90, 90);
|
|
14225
14479
|
};
|
|
14226
|
-
_proto.
|
|
14227
|
-
var
|
|
14228
|
-
var
|
|
14229
|
-
var
|
|
14230
|
-
var
|
|
14231
|
-
|
|
14232
|
-
|
|
14233
|
-
var texRectX = 0;
|
|
14234
|
-
var texRectY = 0;
|
|
14235
|
-
var texRectW = 1;
|
|
14236
|
-
var texRectH = 1;
|
|
14237
|
-
var flip;
|
|
14238
|
-
if (this.splits) {
|
|
14239
|
-
var sp = this.splits[0];
|
|
14240
|
-
flip = sp[4];
|
|
14241
|
-
texRectX = sp[0];
|
|
14242
|
-
texRectY = sp[1];
|
|
14243
|
-
if (flip) {
|
|
14244
|
-
texRectW = sp[3];
|
|
14245
|
-
texRectH = sp[2];
|
|
14246
|
-
} else {
|
|
14247
|
-
texRectW = sp[2];
|
|
14248
|
-
texRectH = sp[3];
|
|
14249
|
-
}
|
|
14250
|
-
}
|
|
14251
|
-
var dx, dy;
|
|
14252
|
-
if (flip) {
|
|
14253
|
-
dx = 1 / ta.row * texRectW;
|
|
14254
|
-
dy = 1 / ta.col * texRectH;
|
|
14255
|
-
} else {
|
|
14256
|
-
dx = 1 / ta.col * texRectW;
|
|
14257
|
-
dy = 1 / ta.row * texRectH;
|
|
14258
|
-
}
|
|
14259
|
-
var texOffset;
|
|
14260
|
-
if (ta.animate) {
|
|
14261
|
-
var frameIndex = Math.round(life * (total - 1));
|
|
14262
|
-
var yIndex = Math.floor(frameIndex / ta.col);
|
|
14263
|
-
var xIndex = frameIndex - yIndex * ta.col;
|
|
14264
|
-
texOffset = flip ? [
|
|
14265
|
-
dx * yIndex,
|
|
14266
|
-
dy * (ta.col - xIndex)
|
|
14267
|
-
] : [
|
|
14268
|
-
dx * xIndex,
|
|
14269
|
-
dy * (1 + yIndex)
|
|
14270
|
-
];
|
|
14271
|
-
} else {
|
|
14272
|
-
texOffset = [
|
|
14273
|
-
0,
|
|
14274
|
-
dy
|
|
14275
|
-
];
|
|
14276
|
-
}
|
|
14277
|
-
this.material.getVector4("_TexOffset").setFromArray([
|
|
14278
|
-
texRectX + texOffset[0],
|
|
14279
|
-
texRectH + texRectY - texOffset[1],
|
|
14280
|
-
dx,
|
|
14281
|
-
dy
|
|
14282
|
-
]);
|
|
14283
|
-
}
|
|
14284
|
-
};
|
|
14285
|
-
_proto.onDestroy = function onDestroy() {
|
|
14286
|
-
if (this.item && this.item.composition) {
|
|
14287
|
-
this.item.composition.destroyTextures(this.getTextures());
|
|
14288
|
-
}
|
|
14289
|
-
};
|
|
14290
|
-
_proto.getItemInitData = function getItemInitData(item, idx, pointStartIndex, textureIndex) {
|
|
14291
|
-
var geoData = item.geoData;
|
|
14292
|
-
if (!geoData) {
|
|
14293
|
-
geoData = item.geoData = this.getItemGeometryData(item, idx);
|
|
14294
|
-
}
|
|
14295
|
-
var index = geoData.index;
|
|
14296
|
-
var idxCount = index.length;
|
|
14297
|
-
// @ts-expect-error
|
|
14298
|
-
var indexData = this.wireframe ? new Uint8Array([
|
|
14299
|
-
0,
|
|
14300
|
-
1,
|
|
14301
|
-
1,
|
|
14302
|
-
3,
|
|
14303
|
-
2,
|
|
14304
|
-
3,
|
|
14305
|
-
2,
|
|
14306
|
-
0
|
|
14307
|
-
]) : new index.constructor(idxCount);
|
|
14308
|
-
if (!this.wireframe) {
|
|
14309
|
-
for(var i = 0; i < idxCount; i++){
|
|
14310
|
-
indexData[i] = pointStartIndex + index[i];
|
|
14311
|
-
}
|
|
14312
|
-
}
|
|
14480
|
+
_proto.generate = function generate(opt) {
|
|
14481
|
+
var rz = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
14482
|
+
var rh = this.getHorizontalAngle() * DEG2RAD;
|
|
14483
|
+
var radius = this.radius;
|
|
14484
|
+
var point = new Vector3(Math.cos(rh), 0, Math.sin(rh));
|
|
14485
|
+
var mat4 = tempMat4$1.setFromRotationZ(rz);
|
|
14486
|
+
var p = mat4.transformNormal(point);
|
|
14313
14487
|
return {
|
|
14314
|
-
|
|
14315
|
-
|
|
14316
|
-
};
|
|
14317
|
-
};
|
|
14318
|
-
_proto.setItem = function setItem() {
|
|
14319
|
-
var textures = [];
|
|
14320
|
-
var texture = this.renderer.texture;
|
|
14321
|
-
if (texture) {
|
|
14322
|
-
addItem(textures, texture);
|
|
14323
|
-
}
|
|
14324
|
-
texture = this.renderer.texture;
|
|
14325
|
-
var textureIndex = texture ? textures.indexOf(texture) : -1;
|
|
14326
|
-
var data = this.getItemInitData(this, 0, 0, textureIndex);
|
|
14327
|
-
var renderer = this.renderer;
|
|
14328
|
-
var texParams = this.material.getVector4("_TexParams");
|
|
14329
|
-
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
14330
|
-
texParams.y = +this.preMultiAlpha;
|
|
14331
|
-
texParams.z = renderer.renderMode;
|
|
14332
|
-
var attributes = {
|
|
14333
|
-
atlasOffset: new Float32Array(data.atlasOffset.length),
|
|
14334
|
-
index: new Uint16Array(data.index.length)
|
|
14488
|
+
position: p.clone().multiply(radius),
|
|
14489
|
+
direction: p
|
|
14335
14490
|
};
|
|
14336
|
-
attributes.atlasOffset.set(data.atlasOffset);
|
|
14337
|
-
attributes.index.set(data.index);
|
|
14338
|
-
var _this = this, material = _this.material, geometry = _this.geometry;
|
|
14339
|
-
var indexData = attributes.index;
|
|
14340
|
-
geometry.setIndexData(indexData);
|
|
14341
|
-
geometry.setAttributeData("atlasOffset", attributes.atlasOffset);
|
|
14342
|
-
geometry.setDrawCount(data.index.length);
|
|
14343
|
-
for(var i = 0; i < textures.length; i++){
|
|
14344
|
-
var texture1 = textures[i];
|
|
14345
|
-
material.setTexture("uSampler" + i, texture1);
|
|
14346
|
-
}
|
|
14347
|
-
// FIXME: 内存泄漏的临时方案,后面再调整
|
|
14348
|
-
var emptyTexture = this.emptyTexture;
|
|
14349
|
-
for(var k = textures.length; k < exports.maxSpriteMeshItemCount; k++){
|
|
14350
|
-
material.setTexture("uSampler" + k, emptyTexture);
|
|
14351
|
-
}
|
|
14352
14491
|
};
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14363
|
-
0,
|
|
14364
|
-
-0.5,
|
|
14365
|
-
-0.5,
|
|
14366
|
-
0,
|
|
14367
|
-
0.5,
|
|
14368
|
-
0.5,
|
|
14369
|
-
0,
|
|
14370
|
-
0.5,
|
|
14371
|
-
-0.5,
|
|
14372
|
-
0
|
|
14373
|
-
])
|
|
14374
|
-
},
|
|
14375
|
-
atlasOffset: {
|
|
14376
|
-
size: 2,
|
|
14377
|
-
offset: 0,
|
|
14378
|
-
releasable: true,
|
|
14379
|
-
type: glContext.FLOAT,
|
|
14380
|
-
data: new Float32Array(0)
|
|
14381
|
-
}
|
|
14382
|
-
},
|
|
14383
|
-
indices: {
|
|
14384
|
-
data: new Uint16Array(0),
|
|
14385
|
-
releasable: true
|
|
14386
|
-
},
|
|
14387
|
-
mode: mode,
|
|
14388
|
-
maxVertex: maxVertex
|
|
14389
|
-
});
|
|
14492
|
+
return Sphere;
|
|
14493
|
+
}();
|
|
14494
|
+
var Hemisphere = /*#__PURE__*/ function(Sphere) {
|
|
14495
|
+
_inherits(Hemisphere, Sphere);
|
|
14496
|
+
function Hemisphere() {
|
|
14497
|
+
return Sphere.apply(this, arguments);
|
|
14498
|
+
}
|
|
14499
|
+
var _proto = Hemisphere.prototype;
|
|
14500
|
+
_proto.getHorizontalAngle = function getHorizontalAngle() {
|
|
14501
|
+
return random(0, 90);
|
|
14390
14502
|
};
|
|
14391
|
-
|
|
14392
|
-
|
|
14393
|
-
|
|
14394
|
-
|
|
14503
|
+
return Hemisphere;
|
|
14504
|
+
}(Sphere);
|
|
14505
|
+
|
|
14506
|
+
var TextureShape = /*#__PURE__*/ function() {
|
|
14507
|
+
function TextureShape(arg) {
|
|
14508
|
+
var detail = arg.detail || {
|
|
14509
|
+
anchors: [
|
|
14510
|
+
0.5,
|
|
14511
|
+
0.5
|
|
14512
|
+
],
|
|
14513
|
+
block: [
|
|
14514
|
+
0,
|
|
14515
|
+
0
|
|
14516
|
+
]
|
|
14395
14517
|
};
|
|
14396
|
-
this.
|
|
14397
|
-
|
|
14398
|
-
|
|
14399
|
-
|
|
14400
|
-
|
|
14401
|
-
|
|
14402
|
-
|
|
14403
|
-
|
|
14404
|
-
|
|
14405
|
-
|
|
14518
|
+
this.anchors = new Float32Array(detail.anchors);
|
|
14519
|
+
this.width = arg.width || 1;
|
|
14520
|
+
this.height = arg.height || 1;
|
|
14521
|
+
this.block = detail.block;
|
|
14522
|
+
this.arcMode = arg.arcMode;
|
|
14523
|
+
this.random = clamp$1(arg.random || 0, 0, 1);
|
|
14524
|
+
}
|
|
14525
|
+
var _proto = TextureShape.prototype;
|
|
14526
|
+
_proto.generate = function generate(opt) {
|
|
14527
|
+
var anchors = this.anchors;
|
|
14528
|
+
var pointCount = anchors.length / 2 - 1;
|
|
14529
|
+
var index = Math.floor(getArcAngle(pointCount, this.arcMode, opt));
|
|
14530
|
+
var pointX = (anchors[index * 2] + this.block[0] * this.random * Math.random()) % 1 - 0.5;
|
|
14531
|
+
var pointY = (anchors[index * 2 + 1] + this.block[1] * this.random * Math.random()) % 1 - 0.5;
|
|
14532
|
+
var dir = new Vector3(pointX, pointY, 0);
|
|
14533
|
+
return {
|
|
14534
|
+
position: new Vector3(pointX * this.width, pointY * this.height, 0),
|
|
14535
|
+
direction: dir.normalize()
|
|
14406
14536
|
};
|
|
14407
|
-
material.blending = states.blending;
|
|
14408
|
-
material.stencilRef = states.mask !== undefined ? [
|
|
14409
|
-
states.mask,
|
|
14410
|
-
states.mask
|
|
14411
|
-
] : undefined;
|
|
14412
|
-
material.depthTest = states.depthTest;
|
|
14413
|
-
material.depthMask = states.depthMask;
|
|
14414
|
-
setBlendMode(material, states.blendMode);
|
|
14415
|
-
setMaskMode(material, states.maskMode);
|
|
14416
|
-
setSideMode(material, states.side);
|
|
14417
|
-
if (!material.hasUniform("_Color")) {
|
|
14418
|
-
material.setVector4("_Color", new Vector4(0, 0, 0, 1));
|
|
14419
|
-
}
|
|
14420
|
-
if (!material.hasUniform("_TexOffset")) {
|
|
14421
|
-
material.setVector4("_TexOffset", new Vector4());
|
|
14422
|
-
}
|
|
14423
|
-
if (!material.hasUniform("_TexParams")) {
|
|
14424
|
-
material.setVector4("_TexParams", new Vector4());
|
|
14425
|
-
}
|
|
14426
|
-
return material;
|
|
14427
14537
|
};
|
|
14428
|
-
|
|
14429
|
-
|
|
14430
|
-
|
|
14431
|
-
|
|
14432
|
-
|
|
14433
|
-
|
|
14434
|
-
|
|
14435
|
-
var atlasOffset = [];
|
|
14436
|
-
for(var i = 0; i < point.length; i += 6){
|
|
14437
|
-
point[i] *= sx;
|
|
14438
|
-
point[i + 1] *= sy;
|
|
14439
|
-
atlasOffset.push(aPoint[i + 2], aPoint[i + 3]);
|
|
14440
|
-
position.push(point[i], point[i + 1], 0.0);
|
|
14441
|
-
}
|
|
14442
|
-
this.geometry.setAttributeData("aPos", new Float32Array(position));
|
|
14443
|
-
return {
|
|
14444
|
-
index: index,
|
|
14445
|
-
atlasOffset: atlasOffset
|
|
14446
|
-
};
|
|
14447
|
-
}
|
|
14448
|
-
var originData = [
|
|
14449
|
-
-.5,
|
|
14450
|
-
.5,
|
|
14451
|
-
-.5,
|
|
14452
|
-
-.5,
|
|
14453
|
-
.5,
|
|
14454
|
-
.5,
|
|
14455
|
-
.5,
|
|
14456
|
-
-.5
|
|
14457
|
-
];
|
|
14458
|
-
var atlasOffset1 = [];
|
|
14459
|
-
var index1 = [];
|
|
14460
|
-
var col = 2;
|
|
14461
|
-
var row = 2;
|
|
14462
|
-
if (splits.length === 1) {
|
|
14463
|
-
col = 1;
|
|
14464
|
-
row = 1;
|
|
14465
|
-
}
|
|
14466
|
-
var position1 = [];
|
|
14467
|
-
for(var x = 0; x < col; x++){
|
|
14468
|
-
for(var y = 0; y < row; y++){
|
|
14469
|
-
var base = (y * 2 + x) * 4;
|
|
14470
|
-
// @ts-expect-error
|
|
14471
|
-
var split = textureSheetAnimation ? [
|
|
14472
|
-
0,
|
|
14473
|
-
0,
|
|
14474
|
-
1,
|
|
14475
|
-
1,
|
|
14476
|
-
splits[0][4]
|
|
14477
|
-
] : splits[y * 2 + x];
|
|
14478
|
-
var texOffset = split[4] ? [
|
|
14479
|
-
0,
|
|
14480
|
-
0,
|
|
14481
|
-
1,
|
|
14482
|
-
0,
|
|
14483
|
-
0,
|
|
14484
|
-
1,
|
|
14485
|
-
1,
|
|
14486
|
-
1
|
|
14487
|
-
] : [
|
|
14488
|
-
0,
|
|
14489
|
-
1,
|
|
14490
|
-
0,
|
|
14491
|
-
0,
|
|
14492
|
-
1,
|
|
14493
|
-
1,
|
|
14494
|
-
1,
|
|
14495
|
-
0
|
|
14496
|
-
];
|
|
14497
|
-
var dw = ((x + x + 1) / col - 1) / 2;
|
|
14498
|
-
var dh = ((y + y + 1) / row - 1) / 2;
|
|
14499
|
-
var tox = split[0];
|
|
14500
|
-
var toy = split[1];
|
|
14501
|
-
var tsx = split[4] ? split[3] : split[2];
|
|
14502
|
-
var tsy = split[4] ? split[2] : split[3];
|
|
14503
|
-
var origin = [
|
|
14504
|
-
originData[0] / col + dw,
|
|
14505
|
-
originData[1] / row + dh,
|
|
14506
|
-
originData[2] / col + dw,
|
|
14507
|
-
originData[3] / row + dh,
|
|
14508
|
-
originData[4] / col + dw,
|
|
14509
|
-
originData[5] / row + dh,
|
|
14510
|
-
originData[6] / col + dw,
|
|
14511
|
-
originData[7] / row + dh
|
|
14512
|
-
];
|
|
14513
|
-
atlasOffset1.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);
|
|
14514
|
-
position1.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);
|
|
14515
|
-
index1.push(base, 1 + base, 2 + base, 2 + base, 1 + base, 3 + base);
|
|
14516
|
-
}
|
|
14517
|
-
}
|
|
14518
|
-
this.geometry.setAttributeData("aPos", new Float32Array(position1));
|
|
14519
|
-
return {
|
|
14520
|
-
index: index1,
|
|
14521
|
-
atlasOffset: atlasOffset1
|
|
14522
|
-
};
|
|
14523
|
-
};
|
|
14524
|
-
_proto.getTextures = function getTextures() {
|
|
14525
|
-
var ret = [];
|
|
14526
|
-
var tex = this.renderer.texture;
|
|
14527
|
-
if (tex) {
|
|
14528
|
-
ret.push(tex);
|
|
14529
|
-
}
|
|
14530
|
-
return ret;
|
|
14531
|
-
};
|
|
14532
|
-
/**
|
|
14533
|
-
* 获取图层包围盒的类型和世界坐标
|
|
14534
|
-
* @returns
|
|
14535
|
-
*/ _proto.getBoundingBox = function getBoundingBox() {
|
|
14536
|
-
if (!this.item) {
|
|
14537
|
-
return;
|
|
14538
|
-
}
|
|
14539
|
-
var worldMatrix = this.transform.getWorldMatrix();
|
|
14540
|
-
var triangles = trianglesFromRect(Vector3.ZERO, 1 / 2, 1 / 2);
|
|
14541
|
-
triangles.forEach(function(triangle) {
|
|
14542
|
-
worldMatrix.transformPoint(triangle.p0);
|
|
14543
|
-
worldMatrix.transformPoint(triangle.p1);
|
|
14544
|
-
worldMatrix.transformPoint(triangle.p2);
|
|
14545
|
-
});
|
|
14538
|
+
return TextureShape;
|
|
14539
|
+
}();
|
|
14540
|
+
|
|
14541
|
+
var ShapeNone = /*#__PURE__*/ function() {
|
|
14542
|
+
function ShapeNone() {}
|
|
14543
|
+
var _proto = ShapeNone.prototype;
|
|
14544
|
+
_proto.generate = function generate() {
|
|
14546
14545
|
return {
|
|
14547
|
-
|
|
14548
|
-
|
|
14546
|
+
position: new Vector3(),
|
|
14547
|
+
direction: new Vector3()
|
|
14549
14548
|
};
|
|
14550
14549
|
};
|
|
14551
|
-
|
|
14552
|
-
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
|
|
14561
|
-
|
|
14562
|
-
|
|
14563
|
-
|
|
14564
|
-
|
|
14565
|
-
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
};
|
|
14574
|
-
this.emptyTexture = this.engine.emptyTexture;
|
|
14575
|
-
this.splits = data.splits || singleSplits;
|
|
14576
|
-
this.textureSheetAnimation = data.textureSheetAnimation;
|
|
14577
|
-
this.cachePrefix = "-";
|
|
14578
|
-
this.renderInfo = getImageItemRenderInfo(this);
|
|
14579
|
-
var geometry = this.createGeometry(glContext.TRIANGLES);
|
|
14580
|
-
var material = this.createMaterial(this.renderInfo, 2);
|
|
14581
|
-
this.worldMatrix = Matrix4.fromIdentity();
|
|
14582
|
-
this.material = material;
|
|
14583
|
-
this.geometry = geometry;
|
|
14584
|
-
this.name = "MSprite" + seed$3++;
|
|
14585
|
-
var startColor = options.startColor || [
|
|
14586
|
-
1,
|
|
14587
|
-
1,
|
|
14588
|
-
1,
|
|
14589
|
-
1
|
|
14590
|
-
];
|
|
14591
|
-
this.material.setVector4("_Color", new Vector4().setFromArray(startColor));
|
|
14592
|
-
this.material.setVector4("_TexOffset", new Vector4().setFromArray([
|
|
14550
|
+
return ShapeNone;
|
|
14551
|
+
}();
|
|
14552
|
+
var _obj$3;
|
|
14553
|
+
var map = (_obj$3 = {}, _obj$3[ShapeType.NONE] = ShapeNone, _obj$3[ShapeType.CONE] = Cone, _obj$3[ShapeType.SPHERE] = Sphere, _obj$3[ShapeType.HEMISPHERE] = Hemisphere, _obj$3[ShapeType.CIRCLE] = Circle, _obj$3[ShapeType.DONUT] = Donut, _obj$3[ShapeType.RECTANGLE] = Rectangle, _obj$3[ShapeType.EDGE] = Edge, _obj$3[ShapeType.RECTANGLE_EDGE] = RectangleEdge, _obj$3[ShapeType.TEXTURE] = TextureShape, _obj$3);
|
|
14554
|
+
function createShape(shapeOptions) {
|
|
14555
|
+
if (!shapeOptions) {
|
|
14556
|
+
return new ShapeNone();
|
|
14557
|
+
}
|
|
14558
|
+
var options = _extends({
|
|
14559
|
+
radius: 1,
|
|
14560
|
+
arc: 360,
|
|
14561
|
+
angle: 0,
|
|
14562
|
+
arcMode: ShapeArcMode.RANDOM
|
|
14563
|
+
}, shapeOptions);
|
|
14564
|
+
var type = shapeOptions.type;
|
|
14565
|
+
var Ctrl = map[type];
|
|
14566
|
+
if (!Ctrl) {
|
|
14567
|
+
throw Error("invalid shape:" + type);
|
|
14568
|
+
}
|
|
14569
|
+
var ctrl = new Ctrl(options);
|
|
14570
|
+
if (type !== ShapeType.NONE) {
|
|
14571
|
+
var alignSpeedDirection = shapeOptions.alignSpeedDirection, _shapeOptions_upDirection = shapeOptions.upDirection, upDirection = _shapeOptions_upDirection === void 0 ? [
|
|
14593
14572
|
0,
|
|
14594
14573
|
0,
|
|
14595
|
-
1,
|
|
14596
14574
|
1
|
|
14597
|
-
]
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14602
|
-
};
|
|
14603
|
-
return SpriteComponent;
|
|
14604
|
-
}(RendererComponent);
|
|
14605
|
-
exports.SpriteComponent = __decorate([
|
|
14606
|
-
effectsClass(DataType.SpriteComponent)
|
|
14607
|
-
], exports.SpriteComponent);
|
|
14608
|
-
|
|
14609
|
-
var RUNTIME_ENV = "runtime_env";
|
|
14610
|
-
var RENDER_PREFER_LOOKUP_TEXTURE = "lookup_texture";
|
|
14611
|
-
// 文本元素使用 offscreen canvas 绘制
|
|
14612
|
-
var TEMPLATE_USE_OFFSCREEN_CANVAS = "offscreen_canvas";
|
|
14613
|
-
// 后处理配置相关
|
|
14614
|
-
var POST_PROCESS_SETTINGS = "post_process_settings";
|
|
14615
|
-
var config = {};
|
|
14616
|
-
function getConfig(name) {
|
|
14617
|
-
return config[name];
|
|
14618
|
-
}
|
|
14619
|
-
function setConfig(name, value) {
|
|
14620
|
-
return config[name] = value;
|
|
14575
|
+
] : _shapeOptions_upDirection;
|
|
14576
|
+
ctrl.alignSpeedDirection = alignSpeedDirection;
|
|
14577
|
+
ctrl.upDirection = Vector3.fromArray(upDirection).normalize();
|
|
14578
|
+
}
|
|
14579
|
+
return ctrl;
|
|
14621
14580
|
}
|
|
14622
14581
|
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14582
|
+
// create a circular doubly linked list from polygon points in the specified winding order
|
|
14583
|
+
function linkedList(data, start, end, dim, clockwise) {
|
|
14584
|
+
var i, last;
|
|
14585
|
+
if (clockwise === signedArea(data, start, end, dim) > 0) {
|
|
14586
|
+
for(i = start; i < end; i += dim)last = insertNode(i, data[i], data[i + 1], last);
|
|
14587
|
+
} else {
|
|
14588
|
+
for(i = end - dim; i >= start; i -= dim)last = insertNode(i, data[i], data[i + 1], last);
|
|
14629
14589
|
}
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
var a = arc * DEG2RAD;
|
|
14634
|
-
var x = Math.cos(a) * this.radius;
|
|
14635
|
-
var y = Math.sin(a) * this.radius;
|
|
14636
|
-
var position = new Vector3(x, y, 0);
|
|
14637
|
-
var l = Math.tan(this.angle * DEG2RAD);
|
|
14638
|
-
var dir = position.clone().multiply(l);
|
|
14639
|
-
// dir + [0,0,1]
|
|
14640
|
-
dir.z += 1;
|
|
14641
|
-
return {
|
|
14642
|
-
position: position.multiply(random(0, 1)),
|
|
14643
|
-
direction: dir.normalize()
|
|
14644
|
-
};
|
|
14645
|
-
};
|
|
14646
|
-
return Cone;
|
|
14647
|
-
}();
|
|
14648
|
-
function getArcAngle(arc, arcMode, opt) {
|
|
14649
|
-
if (arcMode === ShapeArcMode.RANDOM) {
|
|
14650
|
-
arc = random(0, arc);
|
|
14651
|
-
} else if (arcMode === ShapeArcMode.UNIDIRECTIONAL_CYCLE) {
|
|
14652
|
-
var d = opt.index % (opt.total + 1);
|
|
14653
|
-
arc = arc / opt.total * d;
|
|
14654
|
-
} else if (arcMode === ShapeArcMode.BIDIRECTIONAL_CYCLE) {
|
|
14655
|
-
var d1 = opt.index / (opt.total + 1);
|
|
14656
|
-
var i = d1 - Math.floor(d1);
|
|
14657
|
-
arc = arc * (Math.floor(d1) % 2 ? 1 - i : i);
|
|
14658
|
-
} else if (arcMode === ShapeArcMode.UNIFORM_BURST) {
|
|
14659
|
-
arc = arc * opt.burstIndex / opt.burstCount;
|
|
14590
|
+
if (last && equals(last, last.next)) {
|
|
14591
|
+
removeNode(last);
|
|
14592
|
+
last = last.next;
|
|
14660
14593
|
}
|
|
14661
|
-
return
|
|
14662
|
-
}
|
|
14663
|
-
|
|
14664
|
-
var Circle = /*#__PURE__*/ function() {
|
|
14665
|
-
function Circle(props) {
|
|
14666
|
-
var _this = this;
|
|
14667
|
-
Object.keys(props).forEach(function(key) {
|
|
14668
|
-
_this[key] = props[key];
|
|
14669
|
-
});
|
|
14670
|
-
}
|
|
14671
|
-
var _proto = Circle.prototype;
|
|
14672
|
-
_proto.generate = function generate(opt) {
|
|
14673
|
-
var arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
14674
|
-
var direction = new Vector3(Math.cos(arc), Math.sin(arc), 0);
|
|
14675
|
-
var radius = this.radius;
|
|
14676
|
-
return {
|
|
14677
|
-
direction: direction,
|
|
14678
|
-
position: direction.clone().multiply(radius)
|
|
14679
|
-
};
|
|
14680
|
-
};
|
|
14681
|
-
return Circle;
|
|
14682
|
-
}();
|
|
14683
|
-
var Rectangle = /*#__PURE__*/ function() {
|
|
14684
|
-
function Rectangle(arg) {
|
|
14685
|
-
this._d = (arg.width || 1) / 2;
|
|
14686
|
-
this._h = (arg.height || 1) / 2;
|
|
14687
|
-
}
|
|
14688
|
-
var _proto = Rectangle.prototype;
|
|
14689
|
-
_proto.generate = function generate(opt) {
|
|
14690
|
-
var x = random(-this._d, this._d);
|
|
14691
|
-
var y = random(-this._h, this._h);
|
|
14692
|
-
return {
|
|
14693
|
-
direction: new Vector3(0, 0, 1),
|
|
14694
|
-
position: new Vector3(x, y, 0)
|
|
14695
|
-
};
|
|
14696
|
-
};
|
|
14697
|
-
return Rectangle;
|
|
14698
|
-
}();
|
|
14699
|
-
var RectangleEdge = /*#__PURE__*/ function() {
|
|
14700
|
-
function RectangleEdge(arg) {
|
|
14701
|
-
this._d = (arg.width || 1) / 2;
|
|
14702
|
-
this._h = (arg.height || 1) / 2;
|
|
14703
|
-
this.arcMode = arg.arcMode;
|
|
14704
|
-
this.arc = arg.arc;
|
|
14705
|
-
}
|
|
14706
|
-
var _proto = RectangleEdge.prototype;
|
|
14707
|
-
_proto.generate = function generate(opt) {
|
|
14708
|
-
var arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
14709
|
-
var direction = new Vector3(Math.cos(arc), Math.sin(arc), 0);
|
|
14710
|
-
var w = this._d;
|
|
14711
|
-
var h = this._h;
|
|
14712
|
-
var r0 = Math.atan2(h, w);
|
|
14713
|
-
var tan = Math.tan(arc);
|
|
14714
|
-
var position = new Vector3();
|
|
14715
|
-
if (arc < r0) {
|
|
14716
|
-
position.set(w, w * tan, 0);
|
|
14717
|
-
} else if (arc >= r0 && arc < Math.PI - r0) {
|
|
14718
|
-
position.set(h / tan, h, 0);
|
|
14719
|
-
} else if (arc < Math.PI + r0) {
|
|
14720
|
-
position.set(-w, -w * tan, 0);
|
|
14721
|
-
} else if (arc < Math.PI * 2 - r0) {
|
|
14722
|
-
position.set(-h / tan, -h, 0);
|
|
14723
|
-
} else {
|
|
14724
|
-
position.set(w, w * tan, 0);
|
|
14725
|
-
}
|
|
14726
|
-
return {
|
|
14727
|
-
direction: direction,
|
|
14728
|
-
position: position
|
|
14729
|
-
};
|
|
14730
|
-
};
|
|
14731
|
-
return RectangleEdge;
|
|
14732
|
-
}();
|
|
14733
|
-
var Edge = /*#__PURE__*/ function() {
|
|
14734
|
-
function Edge(args) {
|
|
14735
|
-
// TODO: 为通过帧对比暂时使用老计算,修复粒子发射器直线宽度问题下面一行改为: this._d = args.width || 1 ;
|
|
14736
|
-
this._d = (args.width || 1) / 2;
|
|
14737
|
-
this.arcMode = args.arcMode;
|
|
14738
|
-
}
|
|
14739
|
-
var _proto = Edge.prototype;
|
|
14740
|
-
_proto.generate = function generate(options) {
|
|
14741
|
-
var x = this.arcMode === ShapeArcMode.UNIFORM_BURST ? options.burstIndex % options.burstCount / (options.burstCount - 1) : random(0, 1);
|
|
14742
|
-
return {
|
|
14743
|
-
direction: new Vector3(0, 1, 0),
|
|
14744
|
-
position: new Vector3(this._d * (x - 0.5), 0, 0)
|
|
14745
|
-
};
|
|
14746
|
-
};
|
|
14747
|
-
return Edge;
|
|
14748
|
-
}();
|
|
14749
|
-
|
|
14750
|
-
var tempMat4$2 = new Matrix4();
|
|
14751
|
-
var Donut = /*#__PURE__*/ function() {
|
|
14752
|
-
function Donut(props) {
|
|
14753
|
-
var _this = this;
|
|
14754
|
-
Object.keys(props).forEach(function(key) {
|
|
14755
|
-
_this[key] = props[key];
|
|
14756
|
-
});
|
|
14757
|
-
}
|
|
14758
|
-
var _proto = Donut.prototype;
|
|
14759
|
-
_proto.generate = function generate(opt) {
|
|
14760
|
-
var dradius = this.donutRadius;
|
|
14761
|
-
var center = this.radius - dradius;
|
|
14762
|
-
var angle = random(0, Math.PI * 2);
|
|
14763
|
-
var arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
14764
|
-
var rot = tempMat4$2.setFromRotationZ(arc);
|
|
14765
|
-
var direction = new Vector3(Math.cos(angle), Math.sin(angle), 0);
|
|
14766
|
-
var position = new Vector3(center + Math.cos(angle) * dradius, 0, Math.sin(angle) * dradius);
|
|
14767
|
-
return {
|
|
14768
|
-
direction: rot.transformNormal(direction),
|
|
14769
|
-
position: rot.transformPoint(position)
|
|
14770
|
-
};
|
|
14771
|
-
};
|
|
14772
|
-
return Donut;
|
|
14773
|
-
}();
|
|
14774
|
-
|
|
14775
|
-
var tempMat4$1 = new Matrix4();
|
|
14776
|
-
var Sphere = /*#__PURE__*/ function() {
|
|
14777
|
-
function Sphere(props) {
|
|
14778
|
-
var _this = this;
|
|
14779
|
-
Object.keys(props).forEach(function(key) {
|
|
14780
|
-
_this[key] = props[key];
|
|
14781
|
-
});
|
|
14782
|
-
}
|
|
14783
|
-
var _proto = Sphere.prototype;
|
|
14784
|
-
_proto.getHorizontalAngle = function getHorizontalAngle() {
|
|
14785
|
-
return random(-90, 90);
|
|
14786
|
-
};
|
|
14787
|
-
_proto.generate = function generate(opt) {
|
|
14788
|
-
var rz = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
14789
|
-
var rh = this.getHorizontalAngle() * DEG2RAD;
|
|
14790
|
-
var radius = this.radius;
|
|
14791
|
-
var point = new Vector3(Math.cos(rh), 0, Math.sin(rh));
|
|
14792
|
-
var mat4 = tempMat4$1.setFromRotationZ(rz);
|
|
14793
|
-
var p = mat4.transformNormal(point);
|
|
14794
|
-
return {
|
|
14795
|
-
position: p.clone().multiply(radius),
|
|
14796
|
-
direction: p
|
|
14797
|
-
};
|
|
14798
|
-
};
|
|
14799
|
-
return Sphere;
|
|
14800
|
-
}();
|
|
14801
|
-
var Hemisphere = /*#__PURE__*/ function(Sphere) {
|
|
14802
|
-
_inherits(Hemisphere, Sphere);
|
|
14803
|
-
function Hemisphere() {
|
|
14804
|
-
return Sphere.apply(this, arguments);
|
|
14805
|
-
}
|
|
14806
|
-
var _proto = Hemisphere.prototype;
|
|
14807
|
-
_proto.getHorizontalAngle = function getHorizontalAngle() {
|
|
14808
|
-
return random(0, 90);
|
|
14809
|
-
};
|
|
14810
|
-
return Hemisphere;
|
|
14811
|
-
}(Sphere);
|
|
14812
|
-
|
|
14813
|
-
var TextureShape = /*#__PURE__*/ function() {
|
|
14814
|
-
function TextureShape(arg) {
|
|
14815
|
-
var detail = arg.detail || {
|
|
14816
|
-
anchors: [
|
|
14817
|
-
0.5,
|
|
14818
|
-
0.5
|
|
14819
|
-
],
|
|
14820
|
-
block: [
|
|
14821
|
-
0,
|
|
14822
|
-
0
|
|
14823
|
-
]
|
|
14824
|
-
};
|
|
14825
|
-
this.anchors = new Float32Array(detail.anchors);
|
|
14826
|
-
this.width = arg.width || 1;
|
|
14827
|
-
this.height = arg.height || 1;
|
|
14828
|
-
this.block = detail.block;
|
|
14829
|
-
this.arcMode = arg.arcMode;
|
|
14830
|
-
this.random = clamp$1(arg.random || 0, 0, 1);
|
|
14831
|
-
}
|
|
14832
|
-
var _proto = TextureShape.prototype;
|
|
14833
|
-
_proto.generate = function generate(opt) {
|
|
14834
|
-
var anchors = this.anchors;
|
|
14835
|
-
var pointCount = anchors.length / 2 - 1;
|
|
14836
|
-
var index = Math.floor(getArcAngle(pointCount, this.arcMode, opt));
|
|
14837
|
-
var pointX = (anchors[index * 2] + this.block[0] * this.random * Math.random()) % 1 - 0.5;
|
|
14838
|
-
var pointY = (anchors[index * 2 + 1] + this.block[1] * this.random * Math.random()) % 1 - 0.5;
|
|
14839
|
-
var dir = new Vector3(pointX, pointY, 0);
|
|
14840
|
-
return {
|
|
14841
|
-
position: new Vector3(pointX * this.width, pointY * this.height, 0),
|
|
14842
|
-
direction: dir.normalize()
|
|
14843
|
-
};
|
|
14844
|
-
};
|
|
14845
|
-
return TextureShape;
|
|
14846
|
-
}();
|
|
14847
|
-
|
|
14848
|
-
var ShapeNone = /*#__PURE__*/ function() {
|
|
14849
|
-
function ShapeNone() {}
|
|
14850
|
-
var _proto = ShapeNone.prototype;
|
|
14851
|
-
_proto.generate = function generate() {
|
|
14852
|
-
return {
|
|
14853
|
-
position: new Vector3(),
|
|
14854
|
-
direction: new Vector3()
|
|
14855
|
-
};
|
|
14856
|
-
};
|
|
14857
|
-
return ShapeNone;
|
|
14858
|
-
}();
|
|
14859
|
-
var _obj$3;
|
|
14860
|
-
var map = (_obj$3 = {}, _obj$3[ShapeType.NONE] = ShapeNone, _obj$3[ShapeType.CONE] = Cone, _obj$3[ShapeType.SPHERE] = Sphere, _obj$3[ShapeType.HEMISPHERE] = Hemisphere, _obj$3[ShapeType.CIRCLE] = Circle, _obj$3[ShapeType.DONUT] = Donut, _obj$3[ShapeType.RECTANGLE] = Rectangle, _obj$3[ShapeType.EDGE] = Edge, _obj$3[ShapeType.RECTANGLE_EDGE] = RectangleEdge, _obj$3[ShapeType.TEXTURE] = TextureShape, _obj$3);
|
|
14861
|
-
function createShape(shapeOptions) {
|
|
14862
|
-
if (!shapeOptions) {
|
|
14863
|
-
return new ShapeNone();
|
|
14864
|
-
}
|
|
14865
|
-
var options = _extends({
|
|
14866
|
-
radius: 1,
|
|
14867
|
-
arc: 360,
|
|
14868
|
-
angle: 0,
|
|
14869
|
-
arcMode: ShapeArcMode.RANDOM
|
|
14870
|
-
}, shapeOptions);
|
|
14871
|
-
var type = shapeOptions.type;
|
|
14872
|
-
var Ctrl = map[type];
|
|
14873
|
-
if (!Ctrl) {
|
|
14874
|
-
throw Error("invalid shape:" + type);
|
|
14875
|
-
}
|
|
14876
|
-
var ctrl = new Ctrl(options);
|
|
14877
|
-
if (type !== ShapeType.NONE) {
|
|
14878
|
-
var alignSpeedDirection = shapeOptions.alignSpeedDirection, _shapeOptions_upDirection = shapeOptions.upDirection, upDirection = _shapeOptions_upDirection === void 0 ? [
|
|
14879
|
-
0,
|
|
14880
|
-
0,
|
|
14881
|
-
1
|
|
14882
|
-
] : _shapeOptions_upDirection;
|
|
14883
|
-
ctrl.alignSpeedDirection = alignSpeedDirection;
|
|
14884
|
-
ctrl.upDirection = Vector3.fromArray(upDirection).normalize();
|
|
14885
|
-
}
|
|
14886
|
-
return ctrl;
|
|
14887
|
-
}
|
|
14888
|
-
|
|
14889
|
-
// create a circular doubly linked list from polygon points in the specified winding order
|
|
14890
|
-
function linkedList(data, start, end, dim, clockwise) {
|
|
14891
|
-
var i, last;
|
|
14892
|
-
if (clockwise === signedArea(data, start, end, dim) > 0) {
|
|
14893
|
-
for(i = start; i < end; i += dim)last = insertNode(i, data[i], data[i + 1], last);
|
|
14894
|
-
} else {
|
|
14895
|
-
for(i = end - dim; i >= start; i -= dim)last = insertNode(i, data[i], data[i + 1], last);
|
|
14896
|
-
}
|
|
14897
|
-
if (last && equals(last, last.next)) {
|
|
14898
|
-
removeNode(last);
|
|
14899
|
-
last = last.next;
|
|
14900
|
-
}
|
|
14901
|
-
return last;
|
|
14594
|
+
return last;
|
|
14902
14595
|
}
|
|
14903
14596
|
// eliminate colinear or duplicate points
|
|
14904
14597
|
function filterPoints(start, end) {
|
|
@@ -15240,274 +14933,889 @@ function earcut(data, holeIndices, dim, ib) {
|
|
|
15240
14933
|
if (!outerNode || outerNode.next === outerNode.prev) {
|
|
15241
14934
|
return triangles;
|
|
15242
14935
|
}
|
|
15243
|
-
var minX, minY, maxX, maxY, x, y, invSize;
|
|
15244
|
-
if (hasHoles) {
|
|
15245
|
-
outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
|
|
14936
|
+
var minX, minY, maxX, maxY, x, y, invSize;
|
|
14937
|
+
if (hasHoles) {
|
|
14938
|
+
outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
|
|
14939
|
+
}
|
|
14940
|
+
// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
|
|
14941
|
+
if (data.length > 80 * dim) {
|
|
14942
|
+
minX = maxX = data[0];
|
|
14943
|
+
minY = maxY = data[1];
|
|
14944
|
+
for(var i = dim; i < outerLen; i += dim){
|
|
14945
|
+
x = data[i];
|
|
14946
|
+
y = data[i + 1];
|
|
14947
|
+
if (x < minX) {
|
|
14948
|
+
minX = x;
|
|
14949
|
+
}
|
|
14950
|
+
if (y < minY) {
|
|
14951
|
+
minY = y;
|
|
14952
|
+
}
|
|
14953
|
+
if (x > maxX) {
|
|
14954
|
+
maxX = x;
|
|
14955
|
+
}
|
|
14956
|
+
if (y > maxY) {
|
|
14957
|
+
maxY = y;
|
|
14958
|
+
}
|
|
14959
|
+
}
|
|
14960
|
+
// minX, minY and invSize are later used to transform coords into integers for z-order calculation
|
|
14961
|
+
invSize = Math.max(maxX - minX, maxY - minY);
|
|
14962
|
+
invSize = invSize !== 0 ? 1 / invSize : 0;
|
|
14963
|
+
}
|
|
14964
|
+
hackEarcutLinked(outerNode, triangles, dim, minX, minY, invSize);
|
|
14965
|
+
return triangles;
|
|
14966
|
+
}
|
|
14967
|
+
// main ear slicing loop which triangulates a polygon (given as a linked list)
|
|
14968
|
+
function hackEarcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
|
|
14969
|
+
if (!ear) {
|
|
14970
|
+
return;
|
|
14971
|
+
}
|
|
14972
|
+
// interlink polygon nodes in z-order
|
|
14973
|
+
if (!pass && invSize) {
|
|
14974
|
+
indexCurve(ear, minX, minY, invSize);
|
|
14975
|
+
}
|
|
14976
|
+
var stop = ear, prev, next;
|
|
14977
|
+
// iterate through ears, slicing them one by one
|
|
14978
|
+
while(ear.prev !== ear.next){
|
|
14979
|
+
prev = ear.prev;
|
|
14980
|
+
next = ear.next;
|
|
14981
|
+
if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
|
|
14982
|
+
// cut off the triangle
|
|
14983
|
+
triangles.push(prev.i / dim + indexBase);
|
|
14984
|
+
triangles.push(ear.i / dim + indexBase);
|
|
14985
|
+
triangles.push(next.i / dim + indexBase);
|
|
14986
|
+
removeNode(ear);
|
|
14987
|
+
// skipping the next vertex leads to less sliver triangles
|
|
14988
|
+
ear = next.next;
|
|
14989
|
+
stop = next.next;
|
|
14990
|
+
continue;
|
|
14991
|
+
}
|
|
14992
|
+
ear = next;
|
|
14993
|
+
// if we looped through the whole remaining polygon and can't find any more ears
|
|
14994
|
+
if (ear === stop) {
|
|
14995
|
+
// try filtering triangles and slicing again
|
|
14996
|
+
if (!pass) {
|
|
14997
|
+
hackEarcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
|
|
14998
|
+
// if this didn't work, try curing all small self-intersections locally
|
|
14999
|
+
} else if (pass === 1) {
|
|
15000
|
+
ear = hackCureLocalIntersections(filterPoints(ear), triangles, dim);
|
|
15001
|
+
hackEarcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
|
|
15002
|
+
// as a last resort, try splitting the remaining polygon into two
|
|
15003
|
+
} else if (pass === 2) {
|
|
15004
|
+
hackSplitEarcut(ear, triangles, dim, minX, minY, invSize);
|
|
15005
|
+
}
|
|
15006
|
+
break;
|
|
15007
|
+
}
|
|
15008
|
+
}
|
|
15009
|
+
}
|
|
15010
|
+
// go through all polygon nodes and cure small local self-intersections
|
|
15011
|
+
function hackCureLocalIntersections(start, triangles, dim) {
|
|
15012
|
+
var p = start;
|
|
15013
|
+
do {
|
|
15014
|
+
var a = p.prev, b = p.next.next;
|
|
15015
|
+
if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
|
|
15016
|
+
triangles.push(a.i / dim + indexBase);
|
|
15017
|
+
triangles.push(p.i / dim + indexBase);
|
|
15018
|
+
triangles.push(b.i / dim + indexBase);
|
|
15019
|
+
// remove two nodes involved
|
|
15020
|
+
removeNode(p);
|
|
15021
|
+
removeNode(p.next);
|
|
15022
|
+
p = start = b;
|
|
15023
|
+
}
|
|
15024
|
+
p = p.next;
|
|
15025
|
+
}while (p !== start);
|
|
15026
|
+
return filterPoints(p);
|
|
15027
|
+
}
|
|
15028
|
+
// try splitting polygon into two and triangulate them independently
|
|
15029
|
+
function hackSplitEarcut(start, triangles, dim, minX, minY, invSize) {
|
|
15030
|
+
// look for a valid diagonal that divides the polygon into two
|
|
15031
|
+
var a = start;
|
|
15032
|
+
do {
|
|
15033
|
+
var b = a.next.next;
|
|
15034
|
+
while(b !== a.prev){
|
|
15035
|
+
if (a.i !== b.i && isValidDiagonal(a, b)) {
|
|
15036
|
+
// split the polygon in two by the diagonal
|
|
15037
|
+
var c = splitPolygon(a, b);
|
|
15038
|
+
// filter colinear triangles around the cuts
|
|
15039
|
+
a = filterPoints(a, a.next);
|
|
15040
|
+
c = filterPoints(c, c.next);
|
|
15041
|
+
// run earcut on each half
|
|
15042
|
+
hackEarcutLinked(a, triangles, dim, minX, minY, invSize);
|
|
15043
|
+
hackEarcutLinked(c, triangles, dim, minX, minY, invSize);
|
|
15044
|
+
return;
|
|
15045
|
+
}
|
|
15046
|
+
b = b.next;
|
|
15047
|
+
}
|
|
15048
|
+
a = a.next;
|
|
15049
|
+
}while (a !== start);
|
|
15050
|
+
}
|
|
15051
|
+
|
|
15052
|
+
var POINT_INDEX = 2;
|
|
15053
|
+
function getGeometryTriangles(geometry, options) {
|
|
15054
|
+
var s = geometry.s, p = geometry.p;
|
|
15055
|
+
var segments = s[1];
|
|
15056
|
+
var points = p[1];
|
|
15057
|
+
var pointCount = 0;
|
|
15058
|
+
for(var i = 0; i < segments.length; i++){
|
|
15059
|
+
var segment = segments[i];
|
|
15060
|
+
pointCount += segment.length - 1;
|
|
15061
|
+
}
|
|
15062
|
+
var pointData = new Float32Array(pointCount * SPRITE_VERTEX_STRIDE);
|
|
15063
|
+
var _options_indexBase = options.indexBase, indexBase = _options_indexBase === void 0 ? 0 : _options_indexBase, uvTransform = options.uvTransform;
|
|
15064
|
+
var index = 0;
|
|
15065
|
+
var dx = 0, dy = 0, sw = 1, sh = 1, r;
|
|
15066
|
+
if (uvTransform) {
|
|
15067
|
+
dx = uvTransform[0];
|
|
15068
|
+
dy = uvTransform[1];
|
|
15069
|
+
r = uvTransform[4];
|
|
15070
|
+
sw = r ? uvTransform[3] : uvTransform[2];
|
|
15071
|
+
sh = r ? uvTransform[2] : uvTransform[3];
|
|
15072
|
+
}
|
|
15073
|
+
var temp = [
|
|
15074
|
+
0,
|
|
15075
|
+
0
|
|
15076
|
+
];
|
|
15077
|
+
var angle = r === 0 ? 0 : -Math.PI / 2;
|
|
15078
|
+
for(var i1 = 0; i1 < segments.length; i1++){
|
|
15079
|
+
var segment1 = segments[i1];
|
|
15080
|
+
var p0 = points[i1];
|
|
15081
|
+
var p1 = points[i1 + 1] || points[0];
|
|
15082
|
+
var keys = segment1;
|
|
15083
|
+
var point = [
|
|
15084
|
+
0,
|
|
15085
|
+
0
|
|
15086
|
+
];
|
|
15087
|
+
for(var j = 0; j < keys.length - 1; j++){
|
|
15088
|
+
var key = keys[j];
|
|
15089
|
+
getBezier2DValue(point, key, p0, p1, p0[4], p0[5], p1[2], p1[3]);
|
|
15090
|
+
setPoint(point[0], point[1]);
|
|
15091
|
+
}
|
|
15092
|
+
}
|
|
15093
|
+
var indices = earcut(Array.from(pointData), null, SPRITE_VERTEX_STRIDE, indexBase);
|
|
15094
|
+
return {
|
|
15095
|
+
aPoint: pointData,
|
|
15096
|
+
index: new Uint16Array(indices)
|
|
15097
|
+
};
|
|
15098
|
+
function setPoint(x, y) {
|
|
15099
|
+
pointData[index++] = x / 2;
|
|
15100
|
+
pointData[index++] = y / 2;
|
|
15101
|
+
if (uvTransform) {
|
|
15102
|
+
temp[0] = x;
|
|
15103
|
+
temp[1] = y;
|
|
15104
|
+
rotateVec2(temp, temp, angle);
|
|
15105
|
+
pointData[index++] = dx + (temp[0] + 1) / 2 * sw;
|
|
15106
|
+
pointData[index++] = dy + (temp[1] + 1) / 2 * sh;
|
|
15107
|
+
} else {
|
|
15108
|
+
pointData[index++] = (x + 1) / 2;
|
|
15109
|
+
pointData[index++] = (y + 1) / 2;
|
|
15110
|
+
}
|
|
15111
|
+
index += POINT_INDEX;
|
|
15112
|
+
}
|
|
15113
|
+
}
|
|
15114
|
+
/**
|
|
15115
|
+
* 根据新老版形状数据获取形状几何数据
|
|
15116
|
+
* @param shape 新老版形状数据
|
|
15117
|
+
*/ function getGeometriesByShapeData(shape) {
|
|
15118
|
+
var geometries = [];
|
|
15119
|
+
// 该版本的单个形状数据可以包含多个形状,可以加个埋点,五福之后没有就可以下掉
|
|
15120
|
+
if (shape.gs) {
|
|
15121
|
+
shape.gs.forEach(function(gs) {
|
|
15122
|
+
geometries.push({
|
|
15123
|
+
p: [
|
|
15124
|
+
ValueType.SHAPE_POINTS,
|
|
15125
|
+
gs.p
|
|
15126
|
+
],
|
|
15127
|
+
s: [
|
|
15128
|
+
ValueType.SHAPE_SPLITS,
|
|
15129
|
+
gs.s
|
|
15130
|
+
]
|
|
15131
|
+
});
|
|
15132
|
+
});
|
|
15133
|
+
} else if (shape.g) {
|
|
15134
|
+
geometries.push({
|
|
15135
|
+
p: [
|
|
15136
|
+
ValueType.SHAPE_POINTS,
|
|
15137
|
+
shape.g.p
|
|
15138
|
+
],
|
|
15139
|
+
s: [
|
|
15140
|
+
ValueType.SHAPE_SPLITS,
|
|
15141
|
+
shape.g.s
|
|
15142
|
+
]
|
|
15143
|
+
});
|
|
15144
|
+
} else {
|
|
15145
|
+
geometries.push(shape);
|
|
15146
|
+
}
|
|
15147
|
+
return geometries;
|
|
15148
|
+
}
|
|
15149
|
+
function getGeometryByShape(shape, uvTransform) {
|
|
15150
|
+
var datas = [];
|
|
15151
|
+
// 老数据兼容处理
|
|
15152
|
+
var geometries = getGeometriesByShapeData(shape);
|
|
15153
|
+
var indexBase = 0;
|
|
15154
|
+
var aPoint = 0;
|
|
15155
|
+
var index = 0;
|
|
15156
|
+
for(var i = 0; i < geometries.length; i++){
|
|
15157
|
+
var geometry = geometries[i];
|
|
15158
|
+
var data = getGeometryTriangles(geometry, {
|
|
15159
|
+
indexBase: indexBase,
|
|
15160
|
+
uvTransform: uvTransform
|
|
15161
|
+
});
|
|
15162
|
+
indexBase += data.aPoint.length / 5;
|
|
15163
|
+
datas.push(data);
|
|
15164
|
+
aPoint += data.aPoint.length;
|
|
15165
|
+
index += data.index.length;
|
|
15166
|
+
}
|
|
15167
|
+
if (datas.length === 1) {
|
|
15168
|
+
return datas[0];
|
|
15169
|
+
}
|
|
15170
|
+
var aPointData = new Float32Array(aPoint);
|
|
15171
|
+
var indexData = new Uint16Array(index);
|
|
15172
|
+
// @ts-expect-error
|
|
15173
|
+
for(var i1 = 0, pointIndex = 0, idx = 0; i1 < datas[i1]; i1++){
|
|
15174
|
+
var data1 = datas[i1];
|
|
15175
|
+
aPointData.set(data1.aPoint, pointIndex);
|
|
15176
|
+
pointIndex += data1.aPoint.length;
|
|
15177
|
+
indexData.set(data1.index, idx);
|
|
15178
|
+
idx += data1.index.length;
|
|
15179
|
+
}
|
|
15180
|
+
return {
|
|
15181
|
+
aPoint: aPointData,
|
|
15182
|
+
index: indexData
|
|
15183
|
+
};
|
|
15184
|
+
}
|
|
15185
|
+
function rotateVec2(out, vec2, angleInRad) {
|
|
15186
|
+
var c = Math.cos(angleInRad);
|
|
15187
|
+
var s = Math.sin(angleInRad);
|
|
15188
|
+
var x = vec2[0];
|
|
15189
|
+
var y = vec2[1];
|
|
15190
|
+
out[0] = c * x + s * y;
|
|
15191
|
+
out[1] = -s * x + c * y;
|
|
15192
|
+
return out;
|
|
15193
|
+
}
|
|
15194
|
+
function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
|
|
15195
|
+
var ddt = 1 - t;
|
|
15196
|
+
var a = ddt * ddt * ddt;
|
|
15197
|
+
var b = 3 * t * ddt * ddt;
|
|
15198
|
+
var c = 3 * t * t * ddt;
|
|
15199
|
+
var d = t * t * t;
|
|
15200
|
+
out[0] = a * p0[0] + b * cpx0 + c * cpx1 + d * p1[0];
|
|
15201
|
+
out[1] = a * p0[1] + b * cpy0 + c * cpy1 + d * p1[1];
|
|
15202
|
+
return out;
|
|
15203
|
+
}
|
|
15204
|
+
|
|
15205
|
+
/**
|
|
15206
|
+
* @since 2.0.0
|
|
15207
|
+
* @internal
|
|
15208
|
+
*/ var Track = /*#__PURE__*/ function(PlayableAsset) {
|
|
15209
|
+
_inherits(Track, PlayableAsset);
|
|
15210
|
+
function Track() {
|
|
15211
|
+
var _this;
|
|
15212
|
+
_this = PlayableAsset.apply(this, arguments) || this;
|
|
15213
|
+
_this.clips = [];
|
|
15214
|
+
_this.clipSeed = 0;
|
|
15215
|
+
return _this;
|
|
15216
|
+
}
|
|
15217
|
+
var _proto = Track.prototype;
|
|
15218
|
+
_proto.createOutput = function createOutput() {
|
|
15219
|
+
var output = new PlayableOutput();
|
|
15220
|
+
return output;
|
|
15221
|
+
};
|
|
15222
|
+
/**
|
|
15223
|
+
* 重写该方法以创建自定义混合器
|
|
15224
|
+
*/ _proto.createMixerPlayable = function createMixerPlayable() {
|
|
15225
|
+
return new Playable();
|
|
15226
|
+
};
|
|
15227
|
+
_proto.createPlayable = function createPlayable() {
|
|
15228
|
+
var defaultMixPlayable = this.createMixerPlayable();
|
|
15229
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
|
|
15230
|
+
var clip = _step.value;
|
|
15231
|
+
defaultMixPlayable.connect(clip.playable);
|
|
15232
|
+
}
|
|
15233
|
+
return defaultMixPlayable;
|
|
15234
|
+
};
|
|
15235
|
+
_proto.createClip = function createClip(classConstructor, name) {
|
|
15236
|
+
var newClip = new TimelineClip();
|
|
15237
|
+
newClip.playable = new classConstructor();
|
|
15238
|
+
newClip.name = name ? name : "TimelineClip" + newClip.id;
|
|
15239
|
+
this.addClip(newClip);
|
|
15240
|
+
return newClip;
|
|
15241
|
+
};
|
|
15242
|
+
_proto.getClips = function getClips() {
|
|
15243
|
+
return this.clips;
|
|
15244
|
+
};
|
|
15245
|
+
_proto.findClip = function findClip(name) {
|
|
15246
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
|
|
15247
|
+
var clip = _step.value;
|
|
15248
|
+
if (clip.name === name) {
|
|
15249
|
+
return clip;
|
|
15250
|
+
}
|
|
15251
|
+
}
|
|
15252
|
+
};
|
|
15253
|
+
_proto.addClip = function addClip(clip) {
|
|
15254
|
+
clip.playable.bindingItem = this.bindingItem;
|
|
15255
|
+
clip.id = (this.clipSeed++).toString();
|
|
15256
|
+
this.clips.push(clip);
|
|
15257
|
+
};
|
|
15258
|
+
return Track;
|
|
15259
|
+
}(PlayableAsset);
|
|
15260
|
+
/**
|
|
15261
|
+
* @since 2.0.0
|
|
15262
|
+
* @internal
|
|
15263
|
+
*/ var TimelineClip = function TimelineClip() {
|
|
15264
|
+
this.start = 0;
|
|
15265
|
+
this.duration = 0;
|
|
15266
|
+
};
|
|
15267
|
+
|
|
15268
|
+
function _assert_this_initialized(self) {
|
|
15269
|
+
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
15270
|
+
return self;
|
|
15271
|
+
}
|
|
15272
|
+
|
|
15273
|
+
var AnimationStream = /*#__PURE__*/ function() {
|
|
15274
|
+
function AnimationStream(playable) {
|
|
15275
|
+
this.curveValues = {};
|
|
15276
|
+
this.playable = playable;
|
|
15277
|
+
}
|
|
15278
|
+
var _proto = AnimationStream.prototype;
|
|
15279
|
+
_proto.setCurveValue = function setCurveValue(componentType, propertyName, value) {
|
|
15280
|
+
if (!this.findCurveValue(componentType, propertyName)) {
|
|
15281
|
+
this.curveValues[componentType + propertyName] = {
|
|
15282
|
+
componentType: componentType,
|
|
15283
|
+
propertyName: propertyName,
|
|
15284
|
+
value: value
|
|
15285
|
+
};
|
|
15286
|
+
} else {
|
|
15287
|
+
this.curveValues[componentType + propertyName].value = value;
|
|
15288
|
+
}
|
|
15289
|
+
return this.curveValues[componentType + propertyName];
|
|
15290
|
+
};
|
|
15291
|
+
_proto.findCurveValue = function findCurveValue(componentType, propertyName) {
|
|
15292
|
+
return this.curveValues[componentType + propertyName];
|
|
15293
|
+
};
|
|
15294
|
+
_proto.getInputStream = function getInputStream(index) {
|
|
15295
|
+
var inputPlayable = this.playable.getInput(index);
|
|
15296
|
+
if (_instanceof1(inputPlayable, AnimationPlayable)) {
|
|
15297
|
+
return inputPlayable.animationStream;
|
|
15298
|
+
}
|
|
15299
|
+
};
|
|
15300
|
+
return AnimationStream;
|
|
15301
|
+
}();
|
|
15302
|
+
|
|
15303
|
+
var AnimationPlayable = /*#__PURE__*/ function(Playable) {
|
|
15304
|
+
_inherits(AnimationPlayable, Playable);
|
|
15305
|
+
function AnimationPlayable() {
|
|
15306
|
+
var _this;
|
|
15307
|
+
_this = Playable.call(this) || this;
|
|
15308
|
+
_this.animationStream = new AnimationStream(_assert_this_initialized(_this));
|
|
15309
|
+
return _this;
|
|
15310
|
+
}
|
|
15311
|
+
return AnimationPlayable;
|
|
15312
|
+
}(Playable);
|
|
15313
|
+
|
|
15314
|
+
var tempRot$1 = new Euler();
|
|
15315
|
+
var tempSize$1 = new Vector3(1, 1, 1);
|
|
15316
|
+
var tempPos = new Vector3();
|
|
15317
|
+
/**
|
|
15318
|
+
* @since 2.0.0
|
|
15319
|
+
* @internal
|
|
15320
|
+
*/ var TransformAnimationPlayable = /*#__PURE__*/ function(AnimationPlayable) {
|
|
15321
|
+
_inherits(TransformAnimationPlayable, AnimationPlayable);
|
|
15322
|
+
function TransformAnimationPlayable() {
|
|
15323
|
+
return AnimationPlayable.apply(this, arguments);
|
|
15324
|
+
}
|
|
15325
|
+
var _proto = TransformAnimationPlayable.prototype;
|
|
15326
|
+
_proto.processFrame = function processFrame(dt) {
|
|
15327
|
+
if (this.bindingItem.composition) {
|
|
15328
|
+
this.sampleAnimation();
|
|
15329
|
+
}
|
|
15330
|
+
};
|
|
15331
|
+
/**
|
|
15332
|
+
* 应用时间轴K帧数据到对象
|
|
15333
|
+
*/ _proto.sampleAnimation = function sampleAnimation() {
|
|
15334
|
+
var _this = this;
|
|
15335
|
+
var duration = this.bindingItem.duration;
|
|
15336
|
+
var life = this.time / duration;
|
|
15337
|
+
life = life < 0 ? 0 : life > 1 ? 1 : life;
|
|
15338
|
+
if (this.sizeXOverLifetime) {
|
|
15339
|
+
tempSize$1.x = this.sizeXOverLifetime.getValue(life);
|
|
15340
|
+
if (this.sizeSeparateAxes) {
|
|
15341
|
+
tempSize$1.y = this.sizeYOverLifetime.getValue(life);
|
|
15342
|
+
tempSize$1.z = this.sizeZOverLifetime.getValue(life);
|
|
15343
|
+
} else {
|
|
15344
|
+
tempSize$1.z = tempSize$1.y = tempSize$1.x;
|
|
15345
|
+
}
|
|
15346
|
+
var startSize = this.originalTransform.scale;
|
|
15347
|
+
this.bindingItem.transform.setScale(tempSize$1.x * startSize.x, tempSize$1.y * startSize.y, tempSize$1.z * startSize.z);
|
|
15348
|
+
// this.animationStream.setCurveValue('transform', 'scale.x', tempSize.x * startSize.x);
|
|
15349
|
+
// this.animationStream.setCurveValue('transform', 'scale.y', tempSize.y * startSize.y);
|
|
15350
|
+
// this.animationStream.setCurveValue('transform', 'scale.z', tempSize.z * startSize.z);
|
|
15351
|
+
}
|
|
15352
|
+
if (this.rotationOverLifetime) {
|
|
15353
|
+
var func = function(v) {
|
|
15354
|
+
return _this.rotationOverLifetime.asRotation ? v.getValue(life) : v.getIntegrateValue(0, life, duration);
|
|
15355
|
+
};
|
|
15356
|
+
var incZ = func(this.rotationOverLifetime.z);
|
|
15357
|
+
var separateAxes = this.rotationOverLifetime.separateAxes;
|
|
15358
|
+
tempRot$1.x = separateAxes ? func(this.rotationOverLifetime.x) : 0;
|
|
15359
|
+
tempRot$1.y = separateAxes ? func(this.rotationOverLifetime.y) : 0;
|
|
15360
|
+
tempRot$1.z = incZ;
|
|
15361
|
+
var rot = tempRot$1.addEulers(this.originalTransform.rotation, tempRot$1);
|
|
15362
|
+
this.bindingItem.transform.setRotation(rot.x, rot.y, rot.z);
|
|
15363
|
+
// this.animationStream.setCurveValue('transform', 'rotation.x', rot.x);
|
|
15364
|
+
// this.animationStream.setCurveValue('transform', 'rotation.y', rot.y);
|
|
15365
|
+
// this.animationStream.setCurveValue('transform', 'rotation.z', rot.z);
|
|
15366
|
+
}
|
|
15367
|
+
if (this.positionOverLifetime) {
|
|
15368
|
+
var pos = tempPos;
|
|
15369
|
+
calculateTranslation(pos, this, this.gravity, this.time, duration, this.originalTransform.position, this.velocity);
|
|
15370
|
+
if (this.originalTransform.path) {
|
|
15371
|
+
pos.add(this.originalTransform.path.getValue(life));
|
|
15372
|
+
}
|
|
15373
|
+
this.bindingItem.transform.setPosition(pos.x, pos.y, pos.z);
|
|
15374
|
+
// this.animationStream.setCurveValue('transform', 'position.x', pos.x);
|
|
15375
|
+
// this.animationStream.setCurveValue('transform', 'position.y', pos.y);
|
|
15376
|
+
// this.animationStream.setCurveValue('transform', 'position.z', pos.z);
|
|
15377
|
+
}
|
|
15378
|
+
};
|
|
15379
|
+
_proto.fromData = function fromData(data) {
|
|
15380
|
+
var scale = this.bindingItem.transform.scale;
|
|
15381
|
+
this.originalTransform = {
|
|
15382
|
+
position: this.bindingItem.transform.position.clone(),
|
|
15383
|
+
rotation: this.bindingItem.transform.getRotation().clone(),
|
|
15384
|
+
// TODO 编辑器 scale 没有z轴控制
|
|
15385
|
+
scale: new Vector3(scale.x, scale.y, scale.x)
|
|
15386
|
+
};
|
|
15387
|
+
var positionOverLifetime = data.positionOverLifetime;
|
|
15388
|
+
var rotationOverLifetime = data.rotationOverLifetime;
|
|
15389
|
+
var sizeOverLifetime = data.sizeOverLifetime;
|
|
15390
|
+
// TODO: 没有 K 帧数据的不需要传 positionOverLifetime 空对象
|
|
15391
|
+
if (positionOverLifetime && Object.keys(positionOverLifetime).length !== 0) {
|
|
15392
|
+
this.positionOverLifetime = positionOverLifetime;
|
|
15393
|
+
if (positionOverLifetime.path) {
|
|
15394
|
+
this.originalTransform.path = createValueGetter(positionOverLifetime.path);
|
|
15395
|
+
}
|
|
15396
|
+
var linearVelEnable = positionOverLifetime.linearX || positionOverLifetime.linearY || positionOverLifetime.linearZ;
|
|
15397
|
+
if (linearVelEnable) {
|
|
15398
|
+
this.linearVelOverLifetime = {
|
|
15399
|
+
x: positionOverLifetime.linearX && createValueGetter(positionOverLifetime.linearX),
|
|
15400
|
+
y: positionOverLifetime.linearY && createValueGetter(positionOverLifetime.linearY),
|
|
15401
|
+
z: positionOverLifetime.linearZ && createValueGetter(positionOverLifetime.linearZ),
|
|
15402
|
+
asMovement: positionOverLifetime.asMovement,
|
|
15403
|
+
enabled: !!linearVelEnable
|
|
15404
|
+
};
|
|
15405
|
+
}
|
|
15406
|
+
var orbitalVelEnable = positionOverLifetime.orbitalX || positionOverLifetime.orbitalY || positionOverLifetime.orbitalZ;
|
|
15407
|
+
if (orbitalVelEnable) {
|
|
15408
|
+
this.orbitalVelOverLifetime = {
|
|
15409
|
+
x: positionOverLifetime.orbitalX && createValueGetter(positionOverLifetime.orbitalX),
|
|
15410
|
+
y: positionOverLifetime.orbitalY && createValueGetter(positionOverLifetime.orbitalY),
|
|
15411
|
+
z: positionOverLifetime.orbitalZ && createValueGetter(positionOverLifetime.orbitalZ),
|
|
15412
|
+
center: ensureVec3(positionOverLifetime.orbCenter),
|
|
15413
|
+
asRotation: positionOverLifetime.asRotation,
|
|
15414
|
+
enabled: !!orbitalVelEnable
|
|
15415
|
+
};
|
|
15416
|
+
}
|
|
15417
|
+
this.speedOverLifetime = positionOverLifetime.speedOverLifetime && createValueGetter(positionOverLifetime.speedOverLifetime);
|
|
15418
|
+
}
|
|
15419
|
+
if (sizeOverLifetime) {
|
|
15420
|
+
if (sizeOverLifetime.separateAxes) {
|
|
15421
|
+
this.sizeSeparateAxes = true;
|
|
15422
|
+
this.sizeXOverLifetime = createValueGetter(sizeOverLifetime.x || 1);
|
|
15423
|
+
this.sizeYOverLifetime = createValueGetter(sizeOverLifetime.y || 1);
|
|
15424
|
+
this.sizeZOverLifetime = createValueGetter(sizeOverLifetime.z || 1);
|
|
15425
|
+
} else {
|
|
15426
|
+
this.sizeXOverLifetime = createValueGetter(sizeOverLifetime.size || 1);
|
|
15427
|
+
}
|
|
15428
|
+
}
|
|
15429
|
+
if (rotationOverLifetime) {
|
|
15430
|
+
this.rotationOverLifetime = {
|
|
15431
|
+
asRotation: rotationOverLifetime.asRotation,
|
|
15432
|
+
separateAxes: rotationOverLifetime.separateAxes,
|
|
15433
|
+
z: createValueGetter(rotationOverLifetime.z || 0)
|
|
15434
|
+
};
|
|
15435
|
+
if (rotationOverLifetime.separateAxes) {
|
|
15436
|
+
var rotLt = this.rotationOverLifetime;
|
|
15437
|
+
rotLt.x = createValueGetter(rotationOverLifetime.x || 0);
|
|
15438
|
+
rotLt.y = createValueGetter(rotationOverLifetime.y || 0);
|
|
15439
|
+
}
|
|
15440
|
+
}
|
|
15441
|
+
this.gravity = Vector3.fromArray((positionOverLifetime == null ? void 0 : positionOverLifetime.gravity) || []);
|
|
15442
|
+
var _positionOverLifetime_gravityOverLifetime;
|
|
15443
|
+
this.gravityModifier = createValueGetter((_positionOverLifetime_gravityOverLifetime = positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime) != null ? _positionOverLifetime_gravityOverLifetime : 0);
|
|
15444
|
+
this.direction = (positionOverLifetime == null ? void 0 : positionOverLifetime.direction) ? Vector3.fromArray(positionOverLifetime.direction).normalize() : new Vector3();
|
|
15445
|
+
this.startSpeed = (positionOverLifetime == null ? void 0 : positionOverLifetime.startSpeed) || 0;
|
|
15446
|
+
this.velocity = this.direction.clone();
|
|
15447
|
+
this.velocity.multiply(this.startSpeed);
|
|
15448
|
+
};
|
|
15449
|
+
return TransformAnimationPlayable;
|
|
15450
|
+
}(AnimationPlayable);
|
|
15451
|
+
var TransformAnimationPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
15452
|
+
_inherits(TransformAnimationPlayableAsset, PlayableAsset);
|
|
15453
|
+
function TransformAnimationPlayableAsset() {
|
|
15454
|
+
return PlayableAsset.apply(this, arguments);
|
|
15455
|
+
}
|
|
15456
|
+
var _proto = TransformAnimationPlayableAsset.prototype;
|
|
15457
|
+
_proto.createPlayable = function createPlayable() {
|
|
15458
|
+
var transformAnimationPlayable = new TransformAnimationPlayable();
|
|
15459
|
+
transformAnimationPlayable.fromData(this.transformAnimationData);
|
|
15460
|
+
return transformAnimationPlayable;
|
|
15461
|
+
};
|
|
15462
|
+
_proto.fromData = function fromData(data) {
|
|
15463
|
+
this.transformAnimationData = data;
|
|
15464
|
+
};
|
|
15465
|
+
return TransformAnimationPlayableAsset;
|
|
15466
|
+
}(PlayableAsset);
|
|
15467
|
+
/**
|
|
15468
|
+
* @since 2.0.0
|
|
15469
|
+
* @internal
|
|
15470
|
+
*/ var ActivationPlayable = /*#__PURE__*/ function(Playable) {
|
|
15471
|
+
_inherits(ActivationPlayable, Playable);
|
|
15472
|
+
function ActivationPlayable() {
|
|
15473
|
+
return Playable.apply(this, arguments);
|
|
15246
15474
|
}
|
|
15247
|
-
|
|
15248
|
-
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
|
|
15254
|
-
|
|
15255
|
-
|
|
15475
|
+
var _proto = ActivationPlayable.prototype;
|
|
15476
|
+
_proto.onGraphStart = function onGraphStart() {
|
|
15477
|
+
this.bindingItem.transform.setValid(false);
|
|
15478
|
+
this.hideRendererComponents();
|
|
15479
|
+
};
|
|
15480
|
+
_proto.onPlayablePlay = function onPlayablePlay() {
|
|
15481
|
+
this.bindingItem.transform.setValid(true);
|
|
15482
|
+
this.showRendererComponents();
|
|
15483
|
+
};
|
|
15484
|
+
_proto.onPlayableDestroy = function onPlayableDestroy() {
|
|
15485
|
+
this.bindingItem.transform.setValid(false);
|
|
15486
|
+
this.hideRendererComponents();
|
|
15487
|
+
};
|
|
15488
|
+
_proto.hideRendererComponents = function hideRendererComponents() {
|
|
15489
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.bindingItem.rendererComponents), _step; !(_step = _iterator()).done;){
|
|
15490
|
+
var rendererComponent = _step.value;
|
|
15491
|
+
if (rendererComponent.enabled) {
|
|
15492
|
+
rendererComponent.enabled = false;
|
|
15256
15493
|
}
|
|
15257
|
-
|
|
15258
|
-
|
|
15494
|
+
}
|
|
15495
|
+
};
|
|
15496
|
+
_proto.showRendererComponents = function showRendererComponents() {
|
|
15497
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.bindingItem.rendererComponents), _step; !(_step = _iterator()).done;){
|
|
15498
|
+
var rendererComponent = _step.value;
|
|
15499
|
+
if (!rendererComponent.enabled) {
|
|
15500
|
+
rendererComponent.enabled = true;
|
|
15259
15501
|
}
|
|
15260
|
-
|
|
15261
|
-
|
|
15502
|
+
}
|
|
15503
|
+
};
|
|
15504
|
+
return ActivationPlayable;
|
|
15505
|
+
}(Playable);
|
|
15506
|
+
var AnimationClip = /*#__PURE__*/ function(EffectsObject) {
|
|
15507
|
+
_inherits(AnimationClip, EffectsObject);
|
|
15508
|
+
function AnimationClip() {
|
|
15509
|
+
var _this;
|
|
15510
|
+
_this = EffectsObject.apply(this, arguments) || this;
|
|
15511
|
+
_this.positionCurves = [];
|
|
15512
|
+
_this.eulerCurves = [];
|
|
15513
|
+
_this.scaleCurves = [];
|
|
15514
|
+
_this.floatCurves = [];
|
|
15515
|
+
return _this;
|
|
15516
|
+
}
|
|
15517
|
+
var _proto = AnimationClip.prototype;
|
|
15518
|
+
_proto.sampleAnimation = function sampleAnimation(vfxItem, time) {
|
|
15519
|
+
var duration = vfxItem.duration;
|
|
15520
|
+
var life = time / duration;
|
|
15521
|
+
life = life < 0 ? 0 : life > 1 ? 1 : life;
|
|
15522
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.positionCurves), _step; !(_step = _iterator()).done;){
|
|
15523
|
+
var curve = _step.value;
|
|
15524
|
+
var value = curve.keyFrames.getValue(life);
|
|
15525
|
+
var target = this.findTarget(vfxItem, curve.path);
|
|
15526
|
+
target == null ? void 0 : target.transform.setPosition(value.x, value.y, value.z);
|
|
15527
|
+
}
|
|
15528
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.eulerCurves), _step1; !(_step1 = _iterator1()).done;){
|
|
15529
|
+
var curve1 = _step1.value;
|
|
15530
|
+
var value1 = curve1.keyFrames.getValue(life);
|
|
15531
|
+
var target1 = this.findTarget(vfxItem, curve1.path);
|
|
15532
|
+
target1 == null ? void 0 : target1.transform.setRotation(value1.x, value1.y, value1.z);
|
|
15533
|
+
}
|
|
15534
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(this.scaleCurves), _step2; !(_step2 = _iterator2()).done;){
|
|
15535
|
+
var curve2 = _step2.value;
|
|
15536
|
+
var value2 = curve2.keyFrames.getValue(life);
|
|
15537
|
+
var target2 = this.findTarget(vfxItem, curve2.path);
|
|
15538
|
+
target2 == null ? void 0 : target2.transform.setScale(value2.x, value2.y, value2.z);
|
|
15539
|
+
}
|
|
15540
|
+
// TODO float curves 采样
|
|
15541
|
+
};
|
|
15542
|
+
_proto.fromData = function fromData(data) {
|
|
15543
|
+
this.positionCurves.length = 0;
|
|
15544
|
+
this.eulerCurves.length = 0;
|
|
15545
|
+
this.scaleCurves.length = 0;
|
|
15546
|
+
this.floatCurves.length = 0;
|
|
15547
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(data.positionCurves), _step; !(_step = _iterator()).done;){
|
|
15548
|
+
var positionCurveData = _step.value;
|
|
15549
|
+
var curve = {
|
|
15550
|
+
path: positionCurveData.path,
|
|
15551
|
+
keyFrames: createValueGetter(positionCurveData.keyFrames)
|
|
15552
|
+
};
|
|
15553
|
+
this.positionCurves.push(curve);
|
|
15554
|
+
}
|
|
15555
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(data.eulerCurves), _step1; !(_step1 = _iterator1()).done;){
|
|
15556
|
+
var eulerCurveData = _step1.value;
|
|
15557
|
+
var curve1 = {
|
|
15558
|
+
path: eulerCurveData.path,
|
|
15559
|
+
keyFrames: createValueGetter(eulerCurveData.keyFrames)
|
|
15560
|
+
};
|
|
15561
|
+
this.eulerCurves.push(curve1);
|
|
15562
|
+
}
|
|
15563
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(data.scaleCurves), _step2; !(_step2 = _iterator2()).done;){
|
|
15564
|
+
var scaleCurvesData = _step2.value;
|
|
15565
|
+
var curve2 = {
|
|
15566
|
+
path: scaleCurvesData.path,
|
|
15567
|
+
keyFrames: createValueGetter(scaleCurvesData.keyFrames)
|
|
15568
|
+
};
|
|
15569
|
+
this.scaleCurves.push(curve2);
|
|
15570
|
+
}
|
|
15571
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(data.floatCurves), _step3; !(_step3 = _iterator3()).done;){
|
|
15572
|
+
var floatCurveData = _step3.value;
|
|
15573
|
+
var curve3 = {
|
|
15574
|
+
path: floatCurveData.path,
|
|
15575
|
+
keyFrames: createValueGetter(floatCurveData.keyFrames),
|
|
15576
|
+
property: floatCurveData.property,
|
|
15577
|
+
className: floatCurveData.className
|
|
15578
|
+
};
|
|
15579
|
+
this.floatCurves.push(curve3);
|
|
15580
|
+
}
|
|
15581
|
+
};
|
|
15582
|
+
_proto.findTarget = function findTarget(vfxItem, path) {
|
|
15583
|
+
var target = vfxItem;
|
|
15584
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(path), _step; !(_step = _iterator()).done;){
|
|
15585
|
+
var name = _step.value;
|
|
15586
|
+
var findTag = false;
|
|
15587
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(target.children), _step1; !(_step1 = _iterator1()).done;){
|
|
15588
|
+
var child = _step1.value;
|
|
15589
|
+
if (child.name === name) {
|
|
15590
|
+
target = child;
|
|
15591
|
+
findTag = true;
|
|
15592
|
+
break;
|
|
15593
|
+
}
|
|
15262
15594
|
}
|
|
15263
|
-
if (
|
|
15264
|
-
|
|
15595
|
+
if (!findTag) {
|
|
15596
|
+
return;
|
|
15265
15597
|
}
|
|
15266
15598
|
}
|
|
15267
|
-
|
|
15268
|
-
|
|
15269
|
-
|
|
15270
|
-
|
|
15271
|
-
|
|
15272
|
-
|
|
15273
|
-
|
|
15274
|
-
|
|
15275
|
-
function hackEarcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
|
|
15276
|
-
if (!ear) {
|
|
15277
|
-
return;
|
|
15599
|
+
return target;
|
|
15600
|
+
};
|
|
15601
|
+
return AnimationClip;
|
|
15602
|
+
}(EffectsObject);
|
|
15603
|
+
var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
15604
|
+
_inherits(AnimationClipPlayable, Playable);
|
|
15605
|
+
function AnimationClipPlayable() {
|
|
15606
|
+
return Playable.apply(this, arguments);
|
|
15278
15607
|
}
|
|
15279
|
-
|
|
15280
|
-
|
|
15281
|
-
|
|
15608
|
+
var _proto = AnimationClipPlayable.prototype;
|
|
15609
|
+
_proto.processFrame = function processFrame(dt) {
|
|
15610
|
+
if (this.bindingItem.composition) {
|
|
15611
|
+
this.clip.sampleAnimation(this.bindingItem, this.time);
|
|
15612
|
+
}
|
|
15613
|
+
};
|
|
15614
|
+
_proto.fromData = function fromData(data) {
|
|
15615
|
+
this.clip = data.clip;
|
|
15616
|
+
};
|
|
15617
|
+
return AnimationClipPlayable;
|
|
15618
|
+
}(Playable);
|
|
15619
|
+
|
|
15620
|
+
/**
|
|
15621
|
+
* @since 2.0.0
|
|
15622
|
+
* @internal
|
|
15623
|
+
*/ var TimelineComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
15624
|
+
_inherits(TimelineComponent, ItemBehaviour);
|
|
15625
|
+
function TimelineComponent(engine) {
|
|
15626
|
+
var _this;
|
|
15627
|
+
_this = ItemBehaviour.call(this, engine) || this;
|
|
15628
|
+
_this.reusable = false;
|
|
15629
|
+
_this.timelineStarted = false;
|
|
15630
|
+
_this.playableGraph = new PlayableGraph();
|
|
15631
|
+
/**
|
|
15632
|
+
* 元素动画已经播放的时间
|
|
15633
|
+
*/ _this.time = 0;
|
|
15634
|
+
_this.tracks = [];
|
|
15635
|
+
_this.trackSeed = 0;
|
|
15636
|
+
return _this;
|
|
15282
15637
|
}
|
|
15283
|
-
var
|
|
15284
|
-
|
|
15285
|
-
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
removeNode(ear);
|
|
15294
|
-
// skipping the next vertex leads to less sliver triangles
|
|
15295
|
-
ear = next.next;
|
|
15296
|
-
stop = next.next;
|
|
15297
|
-
continue;
|
|
15638
|
+
var _proto = TimelineComponent.prototype;
|
|
15639
|
+
_proto.start = function start() {
|
|
15640
|
+
// TODO TimelineClip 需要传入 start 和 duration 数据
|
|
15641
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
|
|
15642
|
+
var track = _step.value;
|
|
15643
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(track.getClips()), _step1; !(_step1 = _iterator1()).done;){
|
|
15644
|
+
var clip = _step1.value;
|
|
15645
|
+
clip.start = this.item.start;
|
|
15646
|
+
clip.duration = this.item.duration;
|
|
15647
|
+
}
|
|
15298
15648
|
}
|
|
15299
|
-
|
|
15300
|
-
|
|
15301
|
-
|
|
15302
|
-
|
|
15303
|
-
|
|
15304
|
-
|
|
15305
|
-
|
|
15306
|
-
|
|
15307
|
-
|
|
15308
|
-
|
|
15309
|
-
|
|
15310
|
-
|
|
15311
|
-
|
|
15649
|
+
this.compileTracks(this.playableGraph);
|
|
15650
|
+
};
|
|
15651
|
+
// TODO: [1.31] @十弦 vfx-item 下 onUpdate 的改动验证
|
|
15652
|
+
_proto.update = function update(dt) {
|
|
15653
|
+
if (this.item.stopped || !this.item.composition) {
|
|
15654
|
+
return;
|
|
15655
|
+
}
|
|
15656
|
+
if (!this.timelineStarted) {
|
|
15657
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
|
|
15658
|
+
var track = _step.value;
|
|
15659
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(track.getClips()), _step1; !(_step1 = _iterator1()).done;){
|
|
15660
|
+
var clip = _step1.value;
|
|
15661
|
+
clip.playable.onGraphStart();
|
|
15662
|
+
}
|
|
15312
15663
|
}
|
|
15313
|
-
|
|
15664
|
+
this.timelineStarted = true;
|
|
15314
15665
|
}
|
|
15315
|
-
|
|
15316
|
-
|
|
15317
|
-
|
|
15318
|
-
|
|
15319
|
-
|
|
15320
|
-
|
|
15321
|
-
|
|
15322
|
-
|
|
15323
|
-
|
|
15324
|
-
|
|
15325
|
-
|
|
15326
|
-
|
|
15327
|
-
|
|
15328
|
-
|
|
15329
|
-
|
|
15666
|
+
var now = this.time;
|
|
15667
|
+
// 判断动画是否开始
|
|
15668
|
+
if (this.item.delaying && now >= 0 && now <= this.item.duration) {
|
|
15669
|
+
this.item.delaying = false;
|
|
15670
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(this.tracks), _step2; !(_step2 = _iterator2()).done;){
|
|
15671
|
+
var track1 = _step2.value;
|
|
15672
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(track1.getClips()), _step3; !(_step3 = _iterator3()).done;){
|
|
15673
|
+
var clip1 = _step3.value;
|
|
15674
|
+
clip1.playable.onPlayablePlay();
|
|
15675
|
+
}
|
|
15676
|
+
}
|
|
15677
|
+
}
|
|
15678
|
+
// 判断动画是否结束
|
|
15679
|
+
var ended;
|
|
15680
|
+
if (exports.VFXItem.isParticle(this.item)) {
|
|
15681
|
+
ended = this.item.isEnded(now) && this.item.content.destoryed;
|
|
15682
|
+
} else {
|
|
15683
|
+
ended = this.item.isEnded(now);
|
|
15684
|
+
}
|
|
15685
|
+
if (ended) {
|
|
15686
|
+
var endBehavior = this.item.endBehavior;
|
|
15687
|
+
if (!this.item.ended) {
|
|
15688
|
+
this.item.ended = true;
|
|
15689
|
+
this.item.onEnd();
|
|
15690
|
+
if (endBehavior === ItemEndBehavior.destroy) {
|
|
15691
|
+
for(var _iterator4 = _create_for_of_iterator_helper_loose(this.tracks), _step4; !(_step4 = _iterator4()).done;){
|
|
15692
|
+
var track2 = _step4.value;
|
|
15693
|
+
for(var _iterator5 = _create_for_of_iterator_helper_loose(track2.getClips()), _step5; !(_step5 = _iterator5()).done;){
|
|
15694
|
+
var clip2 = _step5.value;
|
|
15695
|
+
clip2.playable.onPlayableDestroy();
|
|
15696
|
+
}
|
|
15697
|
+
}
|
|
15698
|
+
this.item.delaying = true;
|
|
15699
|
+
if (!this.item.reusable && !this.reusable) {
|
|
15700
|
+
this.item.dispose();
|
|
15701
|
+
return;
|
|
15702
|
+
}
|
|
15703
|
+
}
|
|
15704
|
+
}
|
|
15705
|
+
}
|
|
15706
|
+
// TODO: [1.31] @茂安 验证 https://github.com/galacean/effects-runtime/commits/main/packages/effects-core/src/vfx-item.ts
|
|
15707
|
+
// 在生命周期内更新动画
|
|
15708
|
+
if (!this.item.delaying) {
|
|
15709
|
+
var lifetime = this.time / this.item.duration;
|
|
15710
|
+
this.item.lifetime = lifetime;
|
|
15711
|
+
for(var _iterator6 = _create_for_of_iterator_helper_loose(this.tracks), _step6; !(_step6 = _iterator6()).done;){
|
|
15712
|
+
var track3 = _step6.value;
|
|
15713
|
+
for(var _iterator7 = _create_for_of_iterator_helper_loose(track3.getClips()), _step7; !(_step7 = _iterator7()).done;){
|
|
15714
|
+
var clip3 = _step7.value;
|
|
15715
|
+
clip3.playable.setTime(this.time);
|
|
15716
|
+
}
|
|
15717
|
+
}
|
|
15718
|
+
this.playableGraph.evaluate(dt);
|
|
15719
|
+
}
|
|
15720
|
+
};
|
|
15721
|
+
// time 单位秒
|
|
15722
|
+
_proto.setTime = function setTime(time) {
|
|
15723
|
+
this.time = time;
|
|
15724
|
+
};
|
|
15725
|
+
_proto.getTime = function getTime() {
|
|
15726
|
+
return this.time;
|
|
15727
|
+
};
|
|
15728
|
+
_proto.toLocalTime = function toLocalTime(time) {
|
|
15729
|
+
var localTime = time - this.options.start;
|
|
15730
|
+
var duration = this.options.duration;
|
|
15731
|
+
if (localTime - duration > 0.001) {
|
|
15732
|
+
if (this.options.endBehavior === END_BEHAVIOR_RESTART) {
|
|
15733
|
+
localTime = localTime % duration;
|
|
15734
|
+
} else if (this.options.endBehavior === END_BEHAVIOR_FREEZE) {
|
|
15735
|
+
localTime = Math.min(duration, localTime);
|
|
15736
|
+
}
|
|
15330
15737
|
}
|
|
15331
|
-
|
|
15332
|
-
}
|
|
15333
|
-
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
|
|
15337
|
-
|
|
15338
|
-
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
hackEarcutLinked(a, triangles, dim, minX, minY, invSize);
|
|
15350
|
-
hackEarcutLinked(c, triangles, dim, minX, minY, invSize);
|
|
15351
|
-
return;
|
|
15738
|
+
return localTime;
|
|
15739
|
+
};
|
|
15740
|
+
_proto.createTrack = function createTrack(classConstructor, name) {
|
|
15741
|
+
var newTrack = new classConstructor();
|
|
15742
|
+
newTrack.bindingItem = this.item;
|
|
15743
|
+
newTrack.id = (this.trackSeed++).toString();
|
|
15744
|
+
newTrack.name = name ? name : "Track" + newTrack.id;
|
|
15745
|
+
this.tracks.push(newTrack);
|
|
15746
|
+
return newTrack;
|
|
15747
|
+
};
|
|
15748
|
+
_proto.getTracks = function getTracks() {
|
|
15749
|
+
return this.tracks;
|
|
15750
|
+
};
|
|
15751
|
+
_proto.findTrack = function findTrack(name) {
|
|
15752
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
|
|
15753
|
+
var track = _step.value;
|
|
15754
|
+
if (track.name === name) {
|
|
15755
|
+
return track;
|
|
15352
15756
|
}
|
|
15353
|
-
b = b.next;
|
|
15354
15757
|
}
|
|
15355
|
-
|
|
15356
|
-
|
|
15357
|
-
|
|
15358
|
-
|
|
15359
|
-
|
|
15360
|
-
function
|
|
15361
|
-
|
|
15362
|
-
|
|
15363
|
-
|
|
15364
|
-
|
|
15365
|
-
|
|
15366
|
-
|
|
15367
|
-
pointCount += segment.length - 1;
|
|
15368
|
-
}
|
|
15369
|
-
var pointData = new Float32Array(pointCount * SPRITE_VERTEX_STRIDE);
|
|
15370
|
-
var _options_indexBase = options.indexBase, indexBase = _options_indexBase === void 0 ? 0 : _options_indexBase, uvTransform = options.uvTransform;
|
|
15371
|
-
var index = 0;
|
|
15372
|
-
var dx = 0, dy = 0, sw = 1, sh = 1, r;
|
|
15373
|
-
if (uvTransform) {
|
|
15374
|
-
dx = uvTransform[0];
|
|
15375
|
-
dy = uvTransform[1];
|
|
15376
|
-
r = uvTransform[4];
|
|
15377
|
-
sw = r ? uvTransform[3] : uvTransform[2];
|
|
15378
|
-
sh = r ? uvTransform[2] : uvTransform[3];
|
|
15379
|
-
}
|
|
15380
|
-
var temp = [
|
|
15381
|
-
0,
|
|
15382
|
-
0
|
|
15383
|
-
];
|
|
15384
|
-
var angle = r === 0 ? 0 : -Math.PI / 2;
|
|
15385
|
-
for(var i1 = 0; i1 < segments.length; i1++){
|
|
15386
|
-
var segment1 = segments[i1];
|
|
15387
|
-
var p0 = points[i1];
|
|
15388
|
-
var p1 = points[i1 + 1] || points[0];
|
|
15389
|
-
var keys = segment1;
|
|
15390
|
-
var point = [
|
|
15391
|
-
0,
|
|
15392
|
-
0
|
|
15393
|
-
];
|
|
15394
|
-
for(var j = 0; j < keys.length - 1; j++){
|
|
15395
|
-
var key = keys[j];
|
|
15396
|
-
getBezier2DValue(point, key, p0, p1, p0[4], p0[5], p1[2], p1[3]);
|
|
15397
|
-
setPoint(point[0], point[1]);
|
|
15758
|
+
};
|
|
15759
|
+
_proto.rebuildGraph = function rebuildGraph() {
|
|
15760
|
+
this.playableGraph = new PlayableGraph();
|
|
15761
|
+
this.compileTracks(this.playableGraph);
|
|
15762
|
+
};
|
|
15763
|
+
_proto.compileTracks = function compileTracks(graph) {
|
|
15764
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
|
|
15765
|
+
var track = _step.value;
|
|
15766
|
+
var trackMixPlayable = track.createPlayable();
|
|
15767
|
+
var trackOutput = track.createOutput();
|
|
15768
|
+
graph.addOutput(trackOutput);
|
|
15769
|
+
trackOutput.setSourcePlayeble(trackMixPlayable);
|
|
15398
15770
|
}
|
|
15399
|
-
}
|
|
15400
|
-
var indices = earcut(Array.from(pointData), null, SPRITE_VERTEX_STRIDE, indexBase);
|
|
15401
|
-
return {
|
|
15402
|
-
aPoint: pointData,
|
|
15403
|
-
index: new Uint16Array(indices)
|
|
15404
15771
|
};
|
|
15405
|
-
function
|
|
15406
|
-
|
|
15407
|
-
|
|
15408
|
-
|
|
15409
|
-
|
|
15410
|
-
|
|
15411
|
-
|
|
15412
|
-
|
|
15413
|
-
|
|
15414
|
-
|
|
15415
|
-
|
|
15416
|
-
|
|
15772
|
+
_proto.fromData = function fromData(data) {
|
|
15773
|
+
ItemBehaviour.prototype.fromData.call(this, data);
|
|
15774
|
+
this.options = {
|
|
15775
|
+
start: this.item.start,
|
|
15776
|
+
duration: this.item.duration,
|
|
15777
|
+
looping: this.item.endBehavior === ItemEndBehavior.loop,
|
|
15778
|
+
endBehavior: this.item.endBehavior || ItemEndBehavior.destroy
|
|
15779
|
+
};
|
|
15780
|
+
this.id = this.item.id;
|
|
15781
|
+
this.name = this.item.name;
|
|
15782
|
+
var activationTrack = this.createTrack(Track, "ActivationTrack");
|
|
15783
|
+
activationTrack.createClip(ActivationPlayable, "ActivationTimelineClip");
|
|
15784
|
+
//@ts-expect-error
|
|
15785
|
+
if (data.tracks) {
|
|
15786
|
+
//@ts-expect-error
|
|
15787
|
+
var tracks = data.tracks;
|
|
15788
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(tracks), _step; !(_step = _iterator()).done;){
|
|
15789
|
+
var track = _step.value;
|
|
15790
|
+
var newTrack = this.createTrack(Track);
|
|
15791
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(track.clips), _step1; !(_step1 = _iterator1()).done;){
|
|
15792
|
+
var clipAsset = _step1.value;
|
|
15793
|
+
switch(clipAsset.dataType){
|
|
15794
|
+
case "TransformAnimationPlayableAsset":
|
|
15795
|
+
newTrack.name = "TransformAnimationTrack";
|
|
15796
|
+
newTrack.createClip(TransformAnimationPlayable, "TransformAnimationTimelineClip").playable.fromData(clipAsset.animationClip);
|
|
15797
|
+
break;
|
|
15798
|
+
case "SpriteColorAnimationPlayableAsset":
|
|
15799
|
+
newTrack.name = "SpriteColorTrack";
|
|
15800
|
+
newTrack.createClip(SpriteColorPlayable, "SpriteColorClip").playable.fromData(clipAsset.animationClip);
|
|
15801
|
+
break;
|
|
15802
|
+
case "AnimationClipPlayableAsset":
|
|
15803
|
+
newTrack.name = "AnimationTrack";
|
|
15804
|
+
newTrack.createClip(AnimationClipPlayable, "AnimationTimelineClip").playable.fromData(clipAsset.animationClip);
|
|
15805
|
+
break;
|
|
15806
|
+
}
|
|
15807
|
+
}
|
|
15808
|
+
}
|
|
15417
15809
|
}
|
|
15418
|
-
index += POINT_INDEX;
|
|
15419
|
-
}
|
|
15420
|
-
}
|
|
15421
|
-
/**
|
|
15422
|
-
* 根据新老版形状数据获取形状几何数据
|
|
15423
|
-
* @param shape 新老版形状数据
|
|
15424
|
-
*/ function getGeometriesByShapeData(shape) {
|
|
15425
|
-
var geometries = [];
|
|
15426
|
-
// 该版本的单个形状数据可以包含多个形状,可以加个埋点,五福之后没有就可以下掉
|
|
15427
|
-
if (shape.gs) {
|
|
15428
|
-
shape.gs.forEach(function(gs) {
|
|
15429
|
-
geometries.push({
|
|
15430
|
-
p: [
|
|
15431
|
-
ValueType.SHAPE_POINTS,
|
|
15432
|
-
gs.p
|
|
15433
|
-
],
|
|
15434
|
-
s: [
|
|
15435
|
-
ValueType.SHAPE_SPLITS,
|
|
15436
|
-
gs.s
|
|
15437
|
-
]
|
|
15438
|
-
});
|
|
15439
|
-
});
|
|
15440
|
-
} else if (shape.g) {
|
|
15441
|
-
geometries.push({
|
|
15442
|
-
p: [
|
|
15443
|
-
ValueType.SHAPE_POINTS,
|
|
15444
|
-
shape.g.p
|
|
15445
|
-
],
|
|
15446
|
-
s: [
|
|
15447
|
-
ValueType.SHAPE_SPLITS,
|
|
15448
|
-
shape.g.s
|
|
15449
|
-
]
|
|
15450
|
-
});
|
|
15451
|
-
} else {
|
|
15452
|
-
geometries.push(shape);
|
|
15453
|
-
}
|
|
15454
|
-
return geometries;
|
|
15455
|
-
}
|
|
15456
|
-
function getGeometryByShape(shape, uvTransform) {
|
|
15457
|
-
var datas = [];
|
|
15458
|
-
// 老数据兼容处理
|
|
15459
|
-
var geometries = getGeometriesByShapeData(shape);
|
|
15460
|
-
var indexBase = 0;
|
|
15461
|
-
var aPoint = 0;
|
|
15462
|
-
var index = 0;
|
|
15463
|
-
for(var i = 0; i < geometries.length; i++){
|
|
15464
|
-
var geometry = geometries[i];
|
|
15465
|
-
var data = getGeometryTriangles(geometry, {
|
|
15466
|
-
indexBase: indexBase,
|
|
15467
|
-
uvTransform: uvTransform
|
|
15468
|
-
});
|
|
15469
|
-
indexBase += data.aPoint.length / 5;
|
|
15470
|
-
datas.push(data);
|
|
15471
|
-
aPoint += data.aPoint.length;
|
|
15472
|
-
index += data.index.length;
|
|
15473
|
-
}
|
|
15474
|
-
if (datas.length === 1) {
|
|
15475
|
-
return datas[0];
|
|
15476
|
-
}
|
|
15477
|
-
var aPointData = new Float32Array(aPoint);
|
|
15478
|
-
var indexData = new Uint16Array(index);
|
|
15479
|
-
// @ts-expect-error
|
|
15480
|
-
for(var i1 = 0, pointIndex = 0, idx = 0; i1 < datas[i1]; i1++){
|
|
15481
|
-
var data1 = datas[i1];
|
|
15482
|
-
aPointData.set(data1.aPoint, pointIndex);
|
|
15483
|
-
pointIndex += data1.aPoint.length;
|
|
15484
|
-
indexData.set(data1.index, idx);
|
|
15485
|
-
idx += data1.index.length;
|
|
15486
|
-
}
|
|
15487
|
-
return {
|
|
15488
|
-
aPoint: aPointData,
|
|
15489
|
-
index: indexData
|
|
15490
15810
|
};
|
|
15491
|
-
|
|
15492
|
-
|
|
15493
|
-
|
|
15494
|
-
|
|
15495
|
-
|
|
15496
|
-
|
|
15497
|
-
|
|
15498
|
-
|
|
15499
|
-
return out;
|
|
15500
|
-
}
|
|
15501
|
-
function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
|
|
15502
|
-
var ddt = 1 - t;
|
|
15503
|
-
var a = ddt * ddt * ddt;
|
|
15504
|
-
var b = 3 * t * ddt * ddt;
|
|
15505
|
-
var c = 3 * t * t * ddt;
|
|
15506
|
-
var d = t * t * t;
|
|
15507
|
-
out[0] = a * p0[0] + b * cpx0 + c * cpx1 + d * p1[0];
|
|
15508
|
-
out[1] = a * p0[1] + b * cpy0 + c * cpy1 + d * p1[1];
|
|
15509
|
-
return out;
|
|
15510
|
-
}
|
|
15811
|
+
_proto.toData = function toData() {
|
|
15812
|
+
ItemBehaviour.prototype.toData.call(this);
|
|
15813
|
+
};
|
|
15814
|
+
return TimelineComponent;
|
|
15815
|
+
}(ItemBehaviour);
|
|
15816
|
+
__decorate([
|
|
15817
|
+
serialize()
|
|
15818
|
+
], TimelineComponent.prototype, "time", void 0);
|
|
15511
15819
|
|
|
15512
15820
|
var Burst = /*#__PURE__*/ function() {
|
|
15513
15821
|
function Burst(opts) {
|
|
@@ -20427,7 +20735,6 @@ function getStandardCameraContent(model) {
|
|
|
20427
20735
|
}
|
|
20428
20736
|
}
|
|
20429
20737
|
});
|
|
20430
|
-
var itemGuidMap = {};
|
|
20431
20738
|
for(var _iterator = _create_for_of_iterator_helper_loose(composition.items), _step; !(_step = _iterator()).done;){
|
|
20432
20739
|
var item = _step.value;
|
|
20433
20740
|
itemGuidMap[item.id] = generateGUID();
|
|
@@ -23237,17 +23544,6 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
23237
23544
|
})();
|
|
23238
23545
|
};
|
|
23239
23546
|
_create_class(Composition, [
|
|
23240
|
-
{
|
|
23241
|
-
key: "handleEnd",
|
|
23242
|
-
set: /**
|
|
23243
|
-
* 合成结束回调
|
|
23244
|
-
* @param {(composition: Composition) => void} func
|
|
23245
|
-
* @deprecated since 2.0 - use `onEnd` instead
|
|
23246
|
-
*/ function set(func) {
|
|
23247
|
-
console.warn("The handleEnd property is deprecated. Use onEnd instead.");
|
|
23248
|
-
this.onEnd = func;
|
|
23249
|
-
}
|
|
23250
|
-
},
|
|
23251
23547
|
{
|
|
23252
23548
|
key: "textures",
|
|
23253
23549
|
get: /**
|
|
@@ -26045,11 +26341,13 @@ setMaxSpriteMeshItemCount(8);
|
|
|
26045
26341
|
*/ Mesh.create = function(engine, props) {
|
|
26046
26342
|
return new ThreeMesh(engine, props);
|
|
26047
26343
|
};
|
|
26048
|
-
var version = "2.0.0-alpha.
|
|
26344
|
+
var version = "2.0.0-alpha.12";
|
|
26049
26345
|
logger.info("THREEJS plugin version: " + version);
|
|
26050
26346
|
|
|
26051
26347
|
exports.AbstractPlugin = AbstractPlugin;
|
|
26052
26348
|
exports.ActivationPlayable = ActivationPlayable;
|
|
26349
|
+
exports.AnimationClip = AnimationClip;
|
|
26350
|
+
exports.AnimationClipPlayable = AnimationClipPlayable;
|
|
26053
26351
|
exports.AssetLoader = AssetLoader;
|
|
26054
26352
|
exports.AssetManager = AssetManager;
|
|
26055
26353
|
exports.BYTES_TYPE_MAP = BYTES_TYPE_MAP;
|
|
@@ -26083,7 +26381,7 @@ exports.EffectsObject = EffectsObject;
|
|
|
26083
26381
|
exports.Engine = Engine;
|
|
26084
26382
|
exports.EventSystem = EventSystem;
|
|
26085
26383
|
exports.Float16ArrayWrapper = Float16ArrayWrapper;
|
|
26086
|
-
exports.
|
|
26384
|
+
exports.Framebuffer = Framebuffer;
|
|
26087
26385
|
exports.GPUCapability = GPUCapability;
|
|
26088
26386
|
exports.Geometry = Geometry;
|
|
26089
26387
|
exports.GlobalUniforms = GlobalUniforms;
|
|
@@ -26106,6 +26404,7 @@ exports.ParticleLoader = ParticleLoader;
|
|
|
26106
26404
|
exports.ParticleMesh = ParticleMesh;
|
|
26107
26405
|
exports.ParticleSystemRenderer = ParticleSystemRenderer;
|
|
26108
26406
|
exports.PassTextureCache = PassTextureCache;
|
|
26407
|
+
exports.PathSegments = PathSegments;
|
|
26109
26408
|
exports.PluginSystem = PluginSystem;
|
|
26110
26409
|
exports.RENDER_PASS_NAME_PREFIX = RENDER_PASS_NAME_PREFIX;
|
|
26111
26410
|
exports.RENDER_PREFER_LOOKUP_TEXTURE = RENDER_PREFER_LOOKUP_TEXTURE;
|
|
@@ -26113,13 +26412,13 @@ exports.RUNTIME_ENV = RUNTIME_ENV;
|
|
|
26113
26412
|
exports.RandomSetValue = RandomSetValue;
|
|
26114
26413
|
exports.RandomValue = RandomValue;
|
|
26115
26414
|
exports.RandomVectorValue = RandomVectorValue;
|
|
26116
|
-
exports.RenderBuffer = RenderBuffer;
|
|
26117
26415
|
exports.RenderFrame = RenderFrame;
|
|
26118
26416
|
exports.RenderPass = RenderPass;
|
|
26119
26417
|
exports.RenderPassPriorityNormal = RenderPassPriorityNormal;
|
|
26120
26418
|
exports.RenderPassPriorityPostprocess = RenderPassPriorityPostprocess;
|
|
26121
26419
|
exports.RenderPassPriorityPrepare = RenderPassPriorityPrepare;
|
|
26122
26420
|
exports.RenderTargetHandle = RenderTargetHandle;
|
|
26421
|
+
exports.Renderbuffer = Renderbuffer;
|
|
26123
26422
|
exports.Renderer = Renderer;
|
|
26124
26423
|
exports.RendererComponent = RendererComponent;
|
|
26125
26424
|
exports.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0;
|
|
@@ -26191,6 +26490,7 @@ exports.gaussianUpFrag = gaussianUpFrag;
|
|
|
26191
26490
|
exports.generateEmptyTypedArray = generateEmptyTypedArray;
|
|
26192
26491
|
exports.generateGUID = generateGUID;
|
|
26193
26492
|
exports.generateHalfFloatTexture = generateHalfFloatTexture;
|
|
26493
|
+
exports.generateWhiteTexture = generateWhiteTexture;
|
|
26194
26494
|
exports.getBackgroundImage = getBackgroundImage;
|
|
26195
26495
|
exports.getColorFromGradientStops = getColorFromGradientStops;
|
|
26196
26496
|
exports.getConfig = getConfig;
|
|
@@ -26211,6 +26511,7 @@ exports.getStandardItem = getStandardItem;
|
|
|
26211
26511
|
exports.getStandardJSON = getStandardJSON;
|
|
26212
26512
|
exports.getTextureSize = getTextureSize;
|
|
26213
26513
|
exports.glContext = glContext;
|
|
26514
|
+
exports.glType2VertexFormatType = glType2VertexFormatType;
|
|
26214
26515
|
exports.gpuTimer = gpuTimer;
|
|
26215
26516
|
exports.imageDataFromColor = imageDataFromColor;
|
|
26216
26517
|
exports.imageDataFromGradient = imageDataFromGradient;
|
|
@@ -26289,4 +26590,5 @@ exports.vecFill = vecFill;
|
|
|
26289
26590
|
exports.vecMulCombine = vecMulCombine;
|
|
26290
26591
|
exports.vecNormalize = vecNormalize;
|
|
26291
26592
|
exports.version = version;
|
|
26593
|
+
exports.vertexFormatType2GLType = vertexFormatType2GLType;
|
|
26292
26594
|
//# sourceMappingURL=index.js.map
|