@galacean/effects-threejs 2.0.0-alpha.16 → 2.0.0-alpha.17
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 +196 -177
- 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 +192 -175
- package/dist/index.mjs.map +1 -1
- package/dist/material/three-material.d.ts +1 -1
- package/dist/three-texture.d.ts +5 -0
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.17
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -450,7 +450,6 @@ function isSimulatorCellPhone() {
|
|
|
450
450
|
}
|
|
451
451
|
function isAlipayMiniApp() {
|
|
452
452
|
var _my;
|
|
453
|
-
// @ts-expect-error
|
|
454
453
|
return typeof my !== "undefined" && ((_my = my) == null ? void 0 : _my.renderTarget) === "web";
|
|
455
454
|
}
|
|
456
455
|
|
|
@@ -706,8 +705,8 @@ function noop() {}
|
|
|
706
705
|
*
|
|
707
706
|
* @static
|
|
708
707
|
* @function isString
|
|
709
|
-
* @param
|
|
710
|
-
* @return
|
|
708
|
+
* @param obj - 要判断的对象
|
|
709
|
+
* @return
|
|
711
710
|
*/ function isString(obj) {
|
|
712
711
|
return typeof obj === "string";
|
|
713
712
|
}
|
|
@@ -716,8 +715,8 @@ function noop() {}
|
|
|
716
715
|
*
|
|
717
716
|
* @static
|
|
718
717
|
* @function isArray
|
|
719
|
-
* @param
|
|
720
|
-
* @return
|
|
718
|
+
* @param obj - 要判断的对象
|
|
719
|
+
* @return
|
|
721
720
|
*/ var isArray = Array.isArray || function(obj) {
|
|
722
721
|
return Object.prototype.toString.call(obj) === "[object Array]";
|
|
723
722
|
};
|
|
@@ -726,8 +725,8 @@ function noop() {}
|
|
|
726
725
|
*
|
|
727
726
|
* @static
|
|
728
727
|
* @function isFunction
|
|
729
|
-
* @param
|
|
730
|
-
* @return
|
|
728
|
+
* @param obj - 要判断的对象
|
|
729
|
+
* @return
|
|
731
730
|
*/ function isFunction(obj) {
|
|
732
731
|
return Object.prototype.toString.call(obj) === "[object Function]";
|
|
733
732
|
}
|
|
@@ -736,8 +735,8 @@ function noop() {}
|
|
|
736
735
|
*
|
|
737
736
|
* @static
|
|
738
737
|
* @function isObject
|
|
739
|
-
* @param
|
|
740
|
-
* @return
|
|
738
|
+
* @param obj - 要判断的对象
|
|
739
|
+
* @return
|
|
741
740
|
*/ function isObject(obj) {
|
|
742
741
|
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
743
742
|
}
|
|
@@ -746,25 +745,12 @@ function isCanvas(canvas) {
|
|
|
746
745
|
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
747
746
|
return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
|
|
748
747
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
}
|
|
756
|
-
var ret = {};
|
|
757
|
-
var kas = Object.keys(obj);
|
|
758
|
-
for(var i = 0; i < kas.length; i++){
|
|
759
|
-
var key = kas[i];
|
|
760
|
-
ret[key] = deepClone(obj[key]);
|
|
761
|
-
}
|
|
762
|
-
return ret;
|
|
763
|
-
}
|
|
764
|
-
return obj;
|
|
765
|
-
}
|
|
766
|
-
// TODO: 改名
|
|
767
|
-
function random(min, max) {
|
|
748
|
+
/**
|
|
749
|
+
* 生成一个位于 min 和 max 之间的随机数
|
|
750
|
+
* @param min
|
|
751
|
+
* @param max
|
|
752
|
+
* @returns
|
|
753
|
+
*/ function randomInRange(min, max) {
|
|
768
754
|
return min + Math.random() * (max - min);
|
|
769
755
|
}
|
|
770
756
|
function throwDestroyedError() {
|
|
@@ -4095,7 +4081,7 @@ var CameraClipMode;
|
|
|
4095
4081
|
* 蒙版形状切分
|
|
4096
4082
|
*/ ValueType[ValueType["SHAPE_SPLITS"] = 11] = "SHAPE_SPLITS";
|
|
4097
4083
|
/**
|
|
4098
|
-
|
|
4084
|
+
* 直线路径
|
|
4099
4085
|
*/ ValueType[ValueType["LINEAR_PATH"] = 12] = "LINEAR_PATH";
|
|
4100
4086
|
/**
|
|
4101
4087
|
* 多色
|
|
@@ -4271,7 +4257,7 @@ var TextAlignment;
|
|
|
4271
4257
|
(function(TextAlignment) {
|
|
4272
4258
|
/**
|
|
4273
4259
|
* text alignment starts from(x,y) to right direction
|
|
4274
|
-
* 从(x,y)开始第一个字符,向右边延伸
|
|
4260
|
+
* 从 (x,y) 开始第一个字符,向右边延伸
|
|
4275
4261
|
*/ TextAlignment[TextAlignment["left"] = 0] = "left";
|
|
4276
4262
|
/**
|
|
4277
4263
|
* (x,y) is middle position of text, where (left + right)/2 =(x,y)
|
|
@@ -4279,7 +4265,7 @@ var TextAlignment;
|
|
|
4279
4265
|
*/ TextAlignment[TextAlignment["middle"] = 1] = "middle";
|
|
4280
4266
|
/**
|
|
4281
4267
|
* text alignment ends with(x,y) from left direction
|
|
4282
|
-
* 从(x,y)结束最后一个字符,向左边延伸
|
|
4268
|
+
* 从 (x,y) 结束最后一个字符,向左边延伸
|
|
4283
4269
|
*/ TextAlignment[TextAlignment["right"] = 2] = "right";
|
|
4284
4270
|
})(TextAlignment || (TextAlignment = {}));
|
|
4285
4271
|
/**
|
|
@@ -4329,6 +4315,7 @@ var DataType;
|
|
|
4329
4315
|
DataType["TimelineAsset"] = "TimelineAsset";
|
|
4330
4316
|
DataType["TransformPlayableAsset"] = "TransformPlayableAsset";
|
|
4331
4317
|
DataType["SpriteColorPlayableAsset"] = "SpriteColorPlayableAsset";
|
|
4318
|
+
DataType["BinaryAsset"] = "BinaryAsset";
|
|
4332
4319
|
// FIXME: 先完成ECS的场景转换,后面移到spec中
|
|
4333
4320
|
DataType["MeshComponent"] = "MeshComponent";
|
|
4334
4321
|
DataType["SkyboxComponent"] = "SkyboxComponent";
|
|
@@ -4337,6 +4324,7 @@ var DataType;
|
|
|
4337
4324
|
DataType["ModelPluginComponent"] = "ModelPluginComponent";
|
|
4338
4325
|
DataType["TreeComponent"] = "TreeComponent";
|
|
4339
4326
|
DataType["AnimationComponent"] = "AnimationComponent";
|
|
4327
|
+
DataType["SpineComponent"] = "SpineComponent";
|
|
4340
4328
|
// Non-EffectObject
|
|
4341
4329
|
DataType["TimelineClip"] = "TimelineClip";
|
|
4342
4330
|
})(DataType || (DataType = {}));
|
|
@@ -4424,11 +4412,11 @@ var VertexBufferSemantic;
|
|
|
4424
4412
|
VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
|
|
4425
4413
|
})(VertexBufferSemantic || (VertexBufferSemantic = {}));
|
|
4426
4414
|
|
|
4427
|
-
var BuiltinObjectGUID =
|
|
4415
|
+
var BuiltinObjectGUID = {
|
|
4416
|
+
WhiteTexture: "whitetexture00000000000000000000",
|
|
4417
|
+
PBRShader: "pbr00000000000000000000000000000",
|
|
4418
|
+
UnlitShader: "unlit000000000000000000000000000"
|
|
4428
4419
|
};
|
|
4429
|
-
BuiltinObjectGUID.WhiteTexture = "whitetexture00000000000000000000";
|
|
4430
|
-
BuiltinObjectGUID.PBRShader = "pbr00000000000000000000000000000";
|
|
4431
|
-
BuiltinObjectGUID.UnlitShader = "unlit000000000000000000000000000";
|
|
4432
4420
|
|
|
4433
4421
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
4434
4422
|
__proto__: null,
|
|
@@ -4484,15 +4472,20 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4484
4472
|
BuiltinObjectGUID: BuiltinObjectGUID
|
|
4485
4473
|
});
|
|
4486
4474
|
|
|
4487
|
-
var effectsClassStore = {};
|
|
4488
4475
|
var decoratorInitialStore = {};
|
|
4489
4476
|
var mergedStore = {};
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4477
|
+
var effectsClassStore = {};
|
|
4478
|
+
function effectsClass(className) {
|
|
4479
|
+
return function(target, context) {
|
|
4480
|
+
if (effectsClassStore[className]) {
|
|
4481
|
+
console.warn("Class " + className + " 重复注册");
|
|
4482
|
+
}
|
|
4483
|
+
// TODO: three修改json dataType, 这边重复注册直接 return
|
|
4484
|
+
effectsClassStore[className] = target;
|
|
4485
|
+
};
|
|
4486
|
+
}
|
|
4487
|
+
function serialize(type, sourceName) {
|
|
4488
|
+
return generateSerializableMember(type, sourceName); // value member
|
|
4496
4489
|
}
|
|
4497
4490
|
function getMergedStore(target) {
|
|
4498
4491
|
var classKey = target.constructor.name;
|
|
@@ -4517,18 +4510,6 @@ function getMergedStore(target) {
|
|
|
4517
4510
|
}
|
|
4518
4511
|
return store;
|
|
4519
4512
|
}
|
|
4520
|
-
function serialize(type, sourceName) {
|
|
4521
|
-
return generateSerializableMember(type, sourceName); // value member
|
|
4522
|
-
}
|
|
4523
|
-
function effectsClass(className) {
|
|
4524
|
-
return function(target, context) {
|
|
4525
|
-
if (effectsClassStore[className]) {
|
|
4526
|
-
console.warn("Class " + className + " 重复注册");
|
|
4527
|
-
}
|
|
4528
|
-
//TODO: three修改json dataType, 这边重复注册直接 return
|
|
4529
|
-
effectsClassStore[className] = target;
|
|
4530
|
-
};
|
|
4531
|
-
}
|
|
4532
4513
|
function generateSerializableMember(type, sourceName) {
|
|
4533
4514
|
return function(target, propertyKey) {
|
|
4534
4515
|
var classStore = getDirectStore(target);
|
|
@@ -4540,6 +4521,13 @@ function generateSerializableMember(type, sourceName) {
|
|
|
4540
4521
|
}
|
|
4541
4522
|
};
|
|
4542
4523
|
}
|
|
4524
|
+
function getDirectStore(target) {
|
|
4525
|
+
var classKey = target.constructor.name;
|
|
4526
|
+
if (!decoratorInitialStore[classKey]) {
|
|
4527
|
+
decoratorInitialStore[classKey] = {};
|
|
4528
|
+
}
|
|
4529
|
+
return decoratorInitialStore[classKey];
|
|
4530
|
+
}
|
|
4543
4531
|
|
|
4544
4532
|
/**
|
|
4545
4533
|
* @since 2.0.0
|
|
@@ -4571,6 +4559,9 @@ function generateSerializableMember(type, sourceName) {
|
|
|
4571
4559
|
}
|
|
4572
4560
|
};
|
|
4573
4561
|
_proto.dispose = function dispose() {};
|
|
4562
|
+
EffectsObject.is = function is(obj) {
|
|
4563
|
+
return _instanceof1(obj, EffectsObject) && "guid" in obj;
|
|
4564
|
+
};
|
|
4574
4565
|
return EffectsObject;
|
|
4575
4566
|
}();
|
|
4576
4567
|
__decorate([
|
|
@@ -4723,6 +4714,7 @@ __decorate([
|
|
|
4723
4714
|
_this = Component.apply(this, arguments) || this;
|
|
4724
4715
|
_this.started = false;
|
|
4725
4716
|
_this.materials = [];
|
|
4717
|
+
_this._priority = 0;
|
|
4726
4718
|
_this._enabled = true;
|
|
4727
4719
|
return _this;
|
|
4728
4720
|
}
|
|
@@ -9979,7 +9971,7 @@ var RandomValue = /*#__PURE__*/ function(ValueGetter) {
|
|
|
9979
9971
|
this.max = props[1];
|
|
9980
9972
|
};
|
|
9981
9973
|
_proto.getValue = function getValue(time) {
|
|
9982
|
-
return
|
|
9974
|
+
return randomInRange(this.min, this.max);
|
|
9983
9975
|
};
|
|
9984
9976
|
_proto.toUniform = function toUniform() {
|
|
9985
9977
|
return new Float32Array([
|
|
@@ -14715,7 +14707,7 @@ var Cone = /*#__PURE__*/ function() {
|
|
|
14715
14707
|
// dir + [0,0,1]
|
|
14716
14708
|
dir.z += 1;
|
|
14717
14709
|
return {
|
|
14718
|
-
position: position.multiply(
|
|
14710
|
+
position: position.multiply(randomInRange(0, 1)),
|
|
14719
14711
|
direction: dir.normalize()
|
|
14720
14712
|
};
|
|
14721
14713
|
};
|
|
@@ -14723,7 +14715,7 @@ var Cone = /*#__PURE__*/ function() {
|
|
|
14723
14715
|
}();
|
|
14724
14716
|
function getArcAngle(arc, arcMode, opt) {
|
|
14725
14717
|
if (arcMode === ShapeArcMode.RANDOM) {
|
|
14726
|
-
arc =
|
|
14718
|
+
arc = randomInRange(0, arc);
|
|
14727
14719
|
} else if (arcMode === ShapeArcMode.UNIDIRECTIONAL_CYCLE) {
|
|
14728
14720
|
var d = opt.index % (opt.total + 1);
|
|
14729
14721
|
arc = arc / opt.total * d;
|
|
@@ -14763,8 +14755,8 @@ var Rectangle = /*#__PURE__*/ function() {
|
|
|
14763
14755
|
}
|
|
14764
14756
|
var _proto = Rectangle.prototype;
|
|
14765
14757
|
_proto.generate = function generate(opt) {
|
|
14766
|
-
var x =
|
|
14767
|
-
var y =
|
|
14758
|
+
var x = randomInRange(-this._d, this._d);
|
|
14759
|
+
var y = randomInRange(-this._h, this._h);
|
|
14768
14760
|
return {
|
|
14769
14761
|
direction: new Vector3(0, 0, 1),
|
|
14770
14762
|
position: new Vector3(x, y, 0)
|
|
@@ -14814,7 +14806,7 @@ var Edge = /*#__PURE__*/ function() {
|
|
|
14814
14806
|
}
|
|
14815
14807
|
var _proto = Edge.prototype;
|
|
14816
14808
|
_proto.generate = function generate(options) {
|
|
14817
|
-
var x = this.arcMode === ShapeArcMode.UNIFORM_BURST ? options.burstIndex % options.burstCount / (options.burstCount - 1) :
|
|
14809
|
+
var x = this.arcMode === ShapeArcMode.UNIFORM_BURST ? options.burstIndex % options.burstCount / (options.burstCount - 1) : randomInRange(0, 1);
|
|
14818
14810
|
return {
|
|
14819
14811
|
direction: new Vector3(0, 1, 0),
|
|
14820
14812
|
position: new Vector3(this._d * (x - 0.5), 0, 0)
|
|
@@ -14835,7 +14827,7 @@ var Donut = /*#__PURE__*/ function() {
|
|
|
14835
14827
|
_proto.generate = function generate(opt) {
|
|
14836
14828
|
var dradius = this.donutRadius;
|
|
14837
14829
|
var center = this.radius - dradius;
|
|
14838
|
-
var angle =
|
|
14830
|
+
var angle = randomInRange(0, Math.PI * 2);
|
|
14839
14831
|
var arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
14840
14832
|
var rot = tempMat4$2.setFromRotationZ(arc);
|
|
14841
14833
|
var direction = new Vector3(Math.cos(angle), Math.sin(angle), 0);
|
|
@@ -14858,7 +14850,7 @@ var Sphere = /*#__PURE__*/ function() {
|
|
|
14858
14850
|
}
|
|
14859
14851
|
var _proto = Sphere.prototype;
|
|
14860
14852
|
_proto.getHorizontalAngle = function getHorizontalAngle() {
|
|
14861
|
-
return
|
|
14853
|
+
return randomInRange(-90, 90);
|
|
14862
14854
|
};
|
|
14863
14855
|
_proto.generate = function generate(opt) {
|
|
14864
14856
|
var rz = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
|
|
@@ -14881,7 +14873,7 @@ var Hemisphere = /*#__PURE__*/ function(Sphere) {
|
|
|
14881
14873
|
}
|
|
14882
14874
|
var _proto = Hemisphere.prototype;
|
|
14883
14875
|
_proto.getHorizontalAngle = function getHorizontalAngle() {
|
|
14884
|
-
return
|
|
14876
|
+
return randomInRange(0, 90);
|
|
14885
14877
|
};
|
|
14886
14878
|
return Hemisphere;
|
|
14887
14879
|
}(Sphere);
|
|
@@ -16919,11 +16911,9 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16919
16911
|
this.props = props;
|
|
16920
16912
|
this.destroyed = false;
|
|
16921
16913
|
var cachePrefix = "";
|
|
16922
|
-
var options = props.options;
|
|
16923
|
-
var
|
|
16924
|
-
var
|
|
16925
|
-
var gravityModifier = positionOverLifetime.gravityOverLifetime;
|
|
16926
|
-
var gravity = ensureVec3(positionOverLifetime.gravity);
|
|
16914
|
+
var options = props.options, _props_positionOverLifetime = props.positionOverLifetime, positionOverLifetime = _props_positionOverLifetime === void 0 ? {} : _props_positionOverLifetime, shape = props.shape;
|
|
16915
|
+
var gravityModifier = positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime;
|
|
16916
|
+
var gravity = ensureVec3(positionOverLifetime == null ? void 0 : positionOverLifetime.gravity);
|
|
16927
16917
|
var _textureSheetAnimation = props.textureSheetAnimation;
|
|
16928
16918
|
var textureSheetAnimation = _textureSheetAnimation ? {
|
|
16929
16919
|
animationDelay: createValueGetter(_textureSheetAnimation.animationDelay || 0),
|
|
@@ -16934,7 +16924,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16934
16924
|
row: _textureSheetAnimation.row,
|
|
16935
16925
|
total: _textureSheetAnimation.total || _textureSheetAnimation.col * _textureSheetAnimation.row
|
|
16936
16926
|
} : undefined;
|
|
16937
|
-
var startTurbulence = !!(shape && shape.turbulenceX || shape.turbulenceY || shape.turbulenceZ);
|
|
16927
|
+
var startTurbulence = !!(shape && shape.turbulenceX || (shape == null ? void 0 : shape.turbulenceY) || (shape == null ? void 0 : shape.turbulenceZ));
|
|
16938
16928
|
var turbulence;
|
|
16939
16929
|
if (startTurbulence) {
|
|
16940
16930
|
var _shape_turbulenceX, _shape_turbulenceY, _shape_turbulenceZ;
|
|
@@ -16967,7 +16957,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16967
16957
|
}
|
|
16968
16958
|
}
|
|
16969
16959
|
var forceTarget;
|
|
16970
|
-
if (positionOverLifetime.forceTarget) {
|
|
16960
|
+
if (positionOverLifetime == null ? void 0 : positionOverLifetime.forceTarget) {
|
|
16971
16961
|
forceTarget = {
|
|
16972
16962
|
target: positionOverLifetime.target || [
|
|
16973
16963
|
0,
|
|
@@ -18671,6 +18661,29 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
18671
18661
|
return AnimationClipPlayable;
|
|
18672
18662
|
}(Playable);
|
|
18673
18663
|
|
|
18664
|
+
/**
|
|
18665
|
+
* @since 2.0.0
|
|
18666
|
+
* @internal
|
|
18667
|
+
*/ var TimelineClip = /*#__PURE__*/ function() {
|
|
18668
|
+
function TimelineClip() {
|
|
18669
|
+
this.start = 0;
|
|
18670
|
+
this.duration = 0;
|
|
18671
|
+
}
|
|
18672
|
+
var _proto = TimelineClip.prototype;
|
|
18673
|
+
_proto.toLocalTime = function toLocalTime(time) {
|
|
18674
|
+
var localTime = time - this.start;
|
|
18675
|
+
var duration = this.duration;
|
|
18676
|
+
if (localTime - duration > 0.001) {
|
|
18677
|
+
if (this.endBehaviour === ItemEndBehavior.loop) {
|
|
18678
|
+
localTime = localTime % duration;
|
|
18679
|
+
} else if (this.endBehaviour === ItemEndBehavior.freeze) {
|
|
18680
|
+
localTime = Math.min(duration, localTime);
|
|
18681
|
+
}
|
|
18682
|
+
}
|
|
18683
|
+
return localTime;
|
|
18684
|
+
};
|
|
18685
|
+
return TimelineClip;
|
|
18686
|
+
}();
|
|
18674
18687
|
var TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
18675
18688
|
_inherits(TrackAsset, PlayableAsset);
|
|
18676
18689
|
function TrackAsset() {
|
|
@@ -18759,7 +18772,7 @@ var TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
18759
18772
|
return TrackAsset;
|
|
18760
18773
|
}(PlayableAsset);
|
|
18761
18774
|
__decorate([
|
|
18762
|
-
serialize(
|
|
18775
|
+
serialize(TimelineClip)
|
|
18763
18776
|
], TrackAsset.prototype, "clips", void 0);
|
|
18764
18777
|
__decorate([
|
|
18765
18778
|
serialize()
|
|
@@ -18772,29 +18785,6 @@ var TrackType;
|
|
|
18772
18785
|
TrackType[TrackType["MasterTrack"] = 0] = "MasterTrack";
|
|
18773
18786
|
TrackType[TrackType["ObjectTrack"] = 1] = "ObjectTrack";
|
|
18774
18787
|
})(TrackType || (TrackType = {}));
|
|
18775
|
-
var TimelineClip = /*#__PURE__*/ function() {
|
|
18776
|
-
function TimelineClip() {
|
|
18777
|
-
this.start = 0;
|
|
18778
|
-
this.duration = 0;
|
|
18779
|
-
}
|
|
18780
|
-
var _proto = TimelineClip.prototype;
|
|
18781
|
-
_proto.toLocalTime = function toLocalTime(time) {
|
|
18782
|
-
var localTime = time - this.start;
|
|
18783
|
-
var duration = this.duration;
|
|
18784
|
-
if (localTime - duration > 0.001) {
|
|
18785
|
-
if (this.endBehaviour === ItemEndBehavior.loop) {
|
|
18786
|
-
localTime = localTime % duration;
|
|
18787
|
-
} else if (this.endBehaviour === ItemEndBehavior.freeze) {
|
|
18788
|
-
localTime = Math.min(duration, localTime);
|
|
18789
|
-
}
|
|
18790
|
-
}
|
|
18791
|
-
return localTime;
|
|
18792
|
-
};
|
|
18793
|
-
return TimelineClip;
|
|
18794
|
-
}();
|
|
18795
|
-
TimelineClip = __decorate([
|
|
18796
|
-
effectsClass("TimelineClip")
|
|
18797
|
-
], TimelineClip);
|
|
18798
18788
|
var RuntimeClip = /*#__PURE__*/ function() {
|
|
18799
18789
|
function RuntimeClip(clip, clipPlayable, parentMixer, track) {
|
|
18800
18790
|
this.clip = clip;
|
|
@@ -18881,10 +18871,6 @@ var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
|
|
|
18881
18871
|
particleClip.endBehaviour = boundItem.endBehavior;
|
|
18882
18872
|
}
|
|
18883
18873
|
};
|
|
18884
|
-
_proto.fromData = function fromData(data) {
|
|
18885
|
-
TrackAsset1.prototype.fromData.call(this, data);
|
|
18886
|
-
this.data = data;
|
|
18887
|
-
};
|
|
18888
18874
|
return ObjectBindingTrack;
|
|
18889
18875
|
}(TrackAsset);
|
|
18890
18876
|
ObjectBindingTrack = __decorate([
|
|
@@ -19124,7 +19110,6 @@ function compareTracks(a, b) {
|
|
|
19124
19110
|
this.startTime = startTime;
|
|
19125
19111
|
this.resolveBindings();
|
|
19126
19112
|
this.timelinePlayable = this.timelineAsset.createPlayable(this.graph);
|
|
19127
|
-
this.timelinePlayable.play();
|
|
19128
19113
|
// 重播不销毁元素
|
|
19129
19114
|
if (this.item.endBehavior !== ItemEndBehavior.destroy) {
|
|
19130
19115
|
this.setReusable(true);
|
|
@@ -19543,7 +19528,6 @@ var CanvasPool = /*#__PURE__*/ function() {
|
|
|
19543
19528
|
return this.elements.shift();
|
|
19544
19529
|
}
|
|
19545
19530
|
if (getConfig(TEMPLATE_USE_OFFSCREEN_CANVAS)) {
|
|
19546
|
-
// @ts-expect-error
|
|
19547
19531
|
return window._createOffscreenCanvas(10, 10);
|
|
19548
19532
|
} else {
|
|
19549
19533
|
// in hongmeng system, create too many canvas will case render error
|
|
@@ -20112,6 +20096,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20112
20096
|
/**
|
|
20113
20097
|
* 元素动画的速度
|
|
20114
20098
|
*/ _this.speed = 1;
|
|
20099
|
+
_this.listIndex = 0;
|
|
20115
20100
|
_this.name = "VFXItem";
|
|
20116
20101
|
_this.transform.name = _this.name;
|
|
20117
20102
|
_this.transform.engine = engine;
|
|
@@ -20382,7 +20367,6 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20382
20367
|
this.parentId = parentId;
|
|
20383
20368
|
this.duration = duration;
|
|
20384
20369
|
this.endBehavior = endBehavior;
|
|
20385
|
-
this.renderOrder = listIndex;
|
|
20386
20370
|
//@ts-expect-error
|
|
20387
20371
|
this.oldId = data.oldId;
|
|
20388
20372
|
if (!data.content) {
|
|
@@ -20393,18 +20377,12 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20393
20377
|
if (duration <= 0) {
|
|
20394
20378
|
throw Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"]);
|
|
20395
20379
|
}
|
|
20396
|
-
|
|
20397
|
-
|
|
20398
|
-
|
|
20399
|
-
var newComponent = component;
|
|
20400
|
-
this.components.push(newComponent);
|
|
20401
|
-
if (_instanceof1(newComponent, RendererComponent)) {
|
|
20402
|
-
this.rendererComponents.push(newComponent);
|
|
20403
|
-
} else if (_instanceof1(newComponent, ItemBehaviour)) {
|
|
20404
|
-
this.itemBehaviours.push(newComponent);
|
|
20405
|
-
}
|
|
20406
|
-
}
|
|
20380
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
20381
|
+
var component = _step.value;
|
|
20382
|
+
component.onAttached();
|
|
20407
20383
|
}
|
|
20384
|
+
// renderOrder 在 component 初始化后设置。确保能拿到 rendererComponent。
|
|
20385
|
+
this.renderOrder = listIndex;
|
|
20408
20386
|
};
|
|
20409
20387
|
_proto.toData = function toData() {
|
|
20410
20388
|
var _this_parent;
|
|
@@ -20535,6 +20513,9 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20535
20513
|
]);
|
|
20536
20514
|
return VFXItem;
|
|
20537
20515
|
}(EffectsObject);
|
|
20516
|
+
__decorate([
|
|
20517
|
+
serialize()
|
|
20518
|
+
], VFXItem.prototype, "components", void 0);
|
|
20538
20519
|
VFXItem = __decorate([
|
|
20539
20520
|
effectsClass(DataType.VFXItemData)
|
|
20540
20521
|
], VFXItem);
|
|
@@ -20764,22 +20745,22 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20764
20745
|
if (value === undefined) {
|
|
20765
20746
|
value = effectsObject[key];
|
|
20766
20747
|
}
|
|
20767
|
-
if (
|
|
20768
|
-
|
|
20769
|
-
} else if (
|
|
20748
|
+
if (EffectsObject.is(value)) {
|
|
20749
|
+
SerializationHelper.collectSerializableObject(value, res);
|
|
20750
|
+
} else if (isArray(value)) {
|
|
20770
20751
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(value), _step1; !(_step1 = _iterator1()).done;){
|
|
20771
20752
|
var arrayValue = _step1.value;
|
|
20772
|
-
if (
|
|
20773
|
-
|
|
20753
|
+
if (EffectsObject.is(arrayValue)) {
|
|
20754
|
+
SerializationHelper.collectSerializableObject(arrayValue, res);
|
|
20774
20755
|
}
|
|
20775
20756
|
}
|
|
20776
|
-
} else if (
|
|
20757
|
+
} else if (isObject(value)) {
|
|
20777
20758
|
// 非 EffectsObject 对象只递归一层
|
|
20778
20759
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(Object.keys(value)), _step2; !(_step2 = _iterator2()).done;){
|
|
20779
20760
|
var objectKey = _step2.value;
|
|
20780
20761
|
var objectValue = value[objectKey];
|
|
20781
|
-
if (
|
|
20782
|
-
|
|
20762
|
+
if (EffectsObject.is(objectValue)) {
|
|
20763
|
+
SerializationHelper.collectSerializableObject(objectValue, res);
|
|
20783
20764
|
}
|
|
20784
20765
|
}
|
|
20785
20766
|
}
|
|
@@ -20816,17 +20797,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20816
20797
|
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(value)) {
|
|
20817
20798
|
// TODO json 数据避免传 typedArray
|
|
20818
20799
|
serializedData[key] = value;
|
|
20819
|
-
} else if (
|
|
20800
|
+
} else if (isArray(value)) {
|
|
20820
20801
|
if (!serializedData[key]) {
|
|
20821
20802
|
serializedData[key] = [];
|
|
20822
20803
|
}
|
|
20823
20804
|
SerializationHelper.serializeArrayProperty(value, serializedData[key], 0);
|
|
20824
|
-
} else if (
|
|
20805
|
+
} else if (EffectsObject.is(value)) {
|
|
20825
20806
|
// TODO 处理 EffectsObject 递归序列化
|
|
20826
20807
|
serializedData[key] = {
|
|
20827
20808
|
id: value.getInstanceId()
|
|
20828
20809
|
};
|
|
20829
|
-
} else if (
|
|
20810
|
+
} else if (isObject(value)) {
|
|
20830
20811
|
if (!serializedData[key]) {
|
|
20831
20812
|
serializedData[key] = {};
|
|
20832
20813
|
}
|
|
@@ -20840,17 +20821,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20840
20821
|
if (typeof value1 === "number" || typeof value1 === "string" || typeof value1 === "boolean" || SerializationHelper.checkTypedArray(value1)) {
|
|
20841
20822
|
// TODO json 数据避免传 typedArray
|
|
20842
20823
|
serializedData[key1] = value1;
|
|
20843
|
-
} else if (
|
|
20824
|
+
} else if (isArray(value1)) {
|
|
20844
20825
|
if (!serializedData[key1]) {
|
|
20845
20826
|
serializedData[key1] = [];
|
|
20846
20827
|
}
|
|
20847
20828
|
SerializationHelper.serializeArrayProperty(value1, serializedData[key1], 0);
|
|
20848
|
-
} else if (
|
|
20829
|
+
} else if (EffectsObject.is(value1)) {
|
|
20849
20830
|
// TODO 处理 EffectsObject 递归序列化
|
|
20850
20831
|
serializedData[key1] = {
|
|
20851
20832
|
id: value1.getInstanceId()
|
|
20852
20833
|
};
|
|
20853
|
-
} else if (
|
|
20834
|
+
} else if (isObject(value1)) {
|
|
20854
20835
|
if (!serializedData[key1]) {
|
|
20855
20836
|
serializedData[key1] = {};
|
|
20856
20837
|
}
|
|
@@ -20963,13 +20944,13 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20963
20944
|
SerializationHelper.checkTypedArray = function checkTypedArray(obj) {
|
|
20964
20945
|
return _instanceof1(obj, Int8Array) || _instanceof1(obj, Uint8Array) || _instanceof1(obj, Uint8ClampedArray) || _instanceof1(obj, Int16Array) || _instanceof1(obj, Uint16Array) || _instanceof1(obj, Int32Array) || _instanceof1(obj, Uint32Array) || _instanceof1(obj, Float32Array) || _instanceof1(obj, Float64Array) || _instanceof1(obj, ArrayBuffer);
|
|
20965
20946
|
};
|
|
20947
|
+
// check value is { id: 7e69662e964e4892ae8933f24562395b }
|
|
20966
20948
|
SerializationHelper.checkDataPath = function checkDataPath(value) {
|
|
20967
|
-
|
|
20968
|
-
return _instanceof1(value, Object) && Object.keys(value).length === 1 && value.id && value.id.length === 32;
|
|
20949
|
+
return !!(isObject(value) && Object.keys(value).length === 1 && "id" in value && isString(value.id) && value.id.length === 32);
|
|
20969
20950
|
};
|
|
20970
20951
|
// TODO 测试函数,2.0 上线后移除
|
|
20971
20952
|
SerializationHelper.checkGLTFNode = function checkGLTFNode(value) {
|
|
20972
|
-
return
|
|
20953
|
+
return isObject(value) && value.nodeIndex !== undefined && value.isJoint !== undefined;
|
|
20973
20954
|
};
|
|
20974
20955
|
SerializationHelper.checkImageSource = function checkImageSource(value) {
|
|
20975
20956
|
return isCanvas(value) || _instanceof1(value, HTMLImageElement);
|
|
@@ -20980,7 +20961,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20980
20961
|
return;
|
|
20981
20962
|
}
|
|
20982
20963
|
// 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
|
|
20983
|
-
if (
|
|
20964
|
+
if (isArray(property)) {
|
|
20984
20965
|
var res = [];
|
|
20985
20966
|
for(var _iterator = _create_for_of_iterator_helper_loose(property), _step; !(_step = _iterator()).done;){
|
|
20986
20967
|
var value = _step.value;
|
|
@@ -20990,17 +20971,15 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20990
20971
|
// TODO json 数据避免传 typedArray
|
|
20991
20972
|
} else if (SerializationHelper.checkDataPath(property)) {
|
|
20992
20973
|
return engine.assetLoader.loadGUID(property.id);
|
|
20993
|
-
} else if (
|
|
20974
|
+
} else if (isObject(property) && property.constructor === Object) {
|
|
20994
20975
|
var res1;
|
|
20995
20976
|
if (type) {
|
|
20996
|
-
|
|
20997
|
-
res1 = new classConstructor();
|
|
20977
|
+
res1 = new type();
|
|
20998
20978
|
} else {
|
|
20999
20979
|
res1 = {};
|
|
21000
20980
|
}
|
|
21001
20981
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)), _step1; !(_step1 = _iterator1()).done;){
|
|
21002
20982
|
var key = _step1.value;
|
|
21003
|
-
// @ts-expect-error
|
|
21004
20983
|
res1[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
|
|
21005
20984
|
}
|
|
21006
20985
|
return res1;
|
|
@@ -21010,7 +20989,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21010
20989
|
};
|
|
21011
20990
|
SerializationHelper.deserializePropertyAsync = function deserializePropertyAsync(property, engine, level, type) {
|
|
21012
20991
|
return _async_to_generator(function() {
|
|
21013
|
-
var res, _iterator, _step, value, _, res1, res2,
|
|
20992
|
+
var res, _iterator, _step, value, _, res1, res2, _iterator1, _step1, key;
|
|
21014
20993
|
return __generator(this, function(_state) {
|
|
21015
20994
|
switch(_state.label){
|
|
21016
20995
|
case 0:
|
|
@@ -21020,7 +20999,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21020
20999
|
2
|
|
21021
21000
|
];
|
|
21022
21001
|
}
|
|
21023
|
-
if (!
|
|
21002
|
+
if (!isArray(property)) return [
|
|
21024
21003
|
3,
|
|
21025
21004
|
5
|
|
21026
21005
|
];
|
|
@@ -21069,16 +21048,14 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21069
21048
|
res1
|
|
21070
21049
|
];
|
|
21071
21050
|
case 7:
|
|
21072
|
-
if (
|
|
21051
|
+
if (isObject(property) && property.constructor === Object) {
|
|
21073
21052
|
if (type) {
|
|
21074
|
-
|
|
21075
|
-
res2 = new classConstructor();
|
|
21053
|
+
res2 = new type();
|
|
21076
21054
|
} else {
|
|
21077
21055
|
res2 = {};
|
|
21078
21056
|
}
|
|
21079
21057
|
for(_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)); !(_step1 = _iterator1()).done;){
|
|
21080
21058
|
key = _step1.value;
|
|
21081
|
-
// @ts-expect-error
|
|
21082
21059
|
res2[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
|
|
21083
21060
|
}
|
|
21084
21061
|
return [
|
|
@@ -21113,17 +21090,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21113
21090
|
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(objectProperty)) {
|
|
21114
21091
|
// TODO json 数据避免传 typedArray
|
|
21115
21092
|
serializedData[key] = value;
|
|
21116
|
-
} else if (
|
|
21093
|
+
} else if (isArray(value)) {
|
|
21117
21094
|
if (!serializedData[key]) {
|
|
21118
21095
|
serializedData[key] = [];
|
|
21119
21096
|
}
|
|
21120
21097
|
SerializationHelper.serializeArrayProperty(value, serializedData[key], level + 1);
|
|
21121
|
-
} else if (
|
|
21098
|
+
} else if (EffectsObject.is(value)) {
|
|
21122
21099
|
// TODO 处理 EffectsObject 递归序列化
|
|
21123
21100
|
serializedData[key] = {
|
|
21124
21101
|
id: value.getInstanceId()
|
|
21125
21102
|
};
|
|
21126
|
-
} else if (
|
|
21103
|
+
} else if (isObject(value)) {
|
|
21127
21104
|
if (!serializedData[key]) {
|
|
21128
21105
|
serializedData[key] = {};
|
|
21129
21106
|
}
|
|
@@ -21144,17 +21121,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21144
21121
|
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(arrayProperty)) {
|
|
21145
21122
|
// TODO json 数据避免传 typedArray
|
|
21146
21123
|
serializedData[i] = value;
|
|
21147
|
-
} else if (
|
|
21124
|
+
} else if (isArray(value)) {
|
|
21148
21125
|
if (!serializedData[i]) {
|
|
21149
21126
|
serializedData[i] = [];
|
|
21150
21127
|
}
|
|
21151
|
-
|
|
21152
|
-
} else if (
|
|
21128
|
+
SerializationHelper.serializeArrayProperty(value, serializedData[i], level + 1);
|
|
21129
|
+
} else if (EffectsObject.is(value)) {
|
|
21153
21130
|
// TODO 处理 EffectsObject 递归序列化
|
|
21154
21131
|
serializedData[i] = {
|
|
21155
21132
|
id: value.getInstanceId()
|
|
21156
21133
|
};
|
|
21157
|
-
} else if (
|
|
21134
|
+
} else if (isObject(value)) {
|
|
21158
21135
|
if (!serializedData[i]) {
|
|
21159
21136
|
serializedData[i] = {};
|
|
21160
21137
|
}
|
|
@@ -22194,8 +22171,6 @@ function getStandardCameraContent(model) {
|
|
|
22194
22171
|
// 生成时间轴数据
|
|
22195
22172
|
convertTimelineAsset(compositionData, guidToItemMap, result);
|
|
22196
22173
|
};
|
|
22197
|
-
var // 更正 spine 数据中的 images 属性
|
|
22198
|
-
_json_spines;
|
|
22199
22174
|
var // 兼容老版本数据中不存在textures的情况
|
|
22200
22175
|
_result;
|
|
22201
22176
|
var result = _extends({}, json, {
|
|
@@ -22205,7 +22180,8 @@ function getStandardCameraContent(model) {
|
|
|
22205
22180
|
materials: [],
|
|
22206
22181
|
shaders: [],
|
|
22207
22182
|
geometries: [],
|
|
22208
|
-
animations: []
|
|
22183
|
+
animations: [],
|
|
22184
|
+
miscs: []
|
|
22209
22185
|
});
|
|
22210
22186
|
// image数据添加 guid
|
|
22211
22187
|
for(var _iterator = _create_for_of_iterator_helper_loose(result.images), _step; !(_step = _iterator()).done;){
|
|
@@ -22235,17 +22211,10 @@ function getStandardCameraContent(model) {
|
|
|
22235
22211
|
});
|
|
22236
22212
|
}
|
|
22237
22213
|
}
|
|
22238
|
-
|
|
22239
|
-
|
|
22240
|
-
|
|
22241
|
-
|
|
22242
|
-
var textureId = (_json_textures_spine_images_i = json.textures[spine.images[i]]) == null ? void 0 : _json_textures_spine_images_i.id;
|
|
22243
|
-
//@ts-expect-error
|
|
22244
|
-
spine.images[i] = {
|
|
22245
|
-
id: textureId
|
|
22246
|
-
};
|
|
22247
|
-
}
|
|
22248
|
-
});
|
|
22214
|
+
// 处理老版本数据中 bins 没有 id 的情况
|
|
22215
|
+
if (json.bins) {
|
|
22216
|
+
convertBinaryAsset(json.bins, result);
|
|
22217
|
+
}
|
|
22249
22218
|
var itemOldIdToGuidMap = {};
|
|
22250
22219
|
var guidToItemMap = {};
|
|
22251
22220
|
// 更正Composition.endBehavior
|
|
@@ -22409,6 +22378,10 @@ function getStandardCameraContent(model) {
|
|
|
22409
22378
|
//@ts-expect-error
|
|
22410
22379
|
item.type = "orientation-transformer";
|
|
22411
22380
|
}
|
|
22381
|
+
// Spine 元素转为 guid 索引
|
|
22382
|
+
if (item.type === ItemType.spine && json.spines && json.spines.length !== 0) {
|
|
22383
|
+
convertSpineData(json.spines[item.content.options.spine], item.content, result);
|
|
22384
|
+
}
|
|
22412
22385
|
// item 的 content 转为 component data 加入 JSONScene.components
|
|
22413
22386
|
if (item.type === ItemType.sprite || item.type === ItemType.particle || item.type === ItemType.mesh || item.type === ItemType.skybox || item.type === ItemType.light || item.type === "camera" || item.type === ItemType.tree || item.type === ItemType.interact || item.type === ItemType.camera || item.type === ItemType.text || item.type === ItemType.spine || item.type === "editor-gizmo" || item.type === "orientation-transformer") {
|
|
22414
22387
|
item.components = [];
|
|
@@ -22656,22 +22629,54 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22656
22629
|
id: timelineAssetData.id
|
|
22657
22630
|
};
|
|
22658
22631
|
composition.sceneBindings = sceneBindings;
|
|
22659
|
-
|
|
22660
|
-
jsonScene.animations = [];
|
|
22661
|
-
}
|
|
22662
|
-
// @ts-expect-error
|
|
22663
|
-
jsonScene.animations.push(timelineAssetData);
|
|
22632
|
+
jsonScene.miscs.push(timelineAssetData);
|
|
22664
22633
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(trackDatas), _step2; !(_step2 = _iterator2()).done;){
|
|
22665
22634
|
var trackData1 = _step2.value;
|
|
22666
22635
|
//@ts-expect-error
|
|
22667
|
-
jsonScene.
|
|
22636
|
+
jsonScene.miscs.push(trackData1);
|
|
22668
22637
|
}
|
|
22669
22638
|
for(var _iterator3 = _create_for_of_iterator_helper_loose(playableAssetDatas), _step3; !(_step3 = _iterator3()).done;){
|
|
22670
22639
|
var playableAsset = _step3.value;
|
|
22671
22640
|
//@ts-expect-error
|
|
22672
|
-
jsonScene.
|
|
22641
|
+
jsonScene.miscs.push(playableAsset);
|
|
22673
22642
|
}
|
|
22674
22643
|
}
|
|
22644
|
+
function convertBinaryAsset(bins, jsonScene) {
|
|
22645
|
+
//@ts-expect-error
|
|
22646
|
+
jsonScene.bins = bins.map(function(bin) {
|
|
22647
|
+
return {
|
|
22648
|
+
url: bin.url,
|
|
22649
|
+
"dataType": "BinaryAsset",
|
|
22650
|
+
id: generateGUID()
|
|
22651
|
+
};
|
|
22652
|
+
});
|
|
22653
|
+
}
|
|
22654
|
+
function convertSpineData(resource, content, jsonScene) {
|
|
22655
|
+
//@ts-expect-error
|
|
22656
|
+
content.resource = {
|
|
22657
|
+
"atlas": {
|
|
22658
|
+
"bins": {
|
|
22659
|
+
//@ts-expect-error
|
|
22660
|
+
"id": jsonScene.bins[resource.atlas[1][0]].id
|
|
22661
|
+
},
|
|
22662
|
+
"source": resource.atlas[1].slice(1)
|
|
22663
|
+
},
|
|
22664
|
+
"skeleton": {
|
|
22665
|
+
"bins": {
|
|
22666
|
+
//@ts-expect-error
|
|
22667
|
+
"id": jsonScene.bins[resource.skeleton[1][0]].id
|
|
22668
|
+
},
|
|
22669
|
+
"source": resource.skeleton[1].slice(1)
|
|
22670
|
+
},
|
|
22671
|
+
"skeletonType": resource.skeletonType,
|
|
22672
|
+
"images": resource.images.map(function(i) {
|
|
22673
|
+
return {
|
|
22674
|
+
//@ts-expect-error
|
|
22675
|
+
id: jsonScene.textures[i].id
|
|
22676
|
+
};
|
|
22677
|
+
})
|
|
22678
|
+
};
|
|
22679
|
+
}
|
|
22675
22680
|
|
|
22676
22681
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
22677
22682
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
@@ -23417,7 +23422,7 @@ var seed$1 = 1;
|
|
|
23417
23422
|
return [
|
|
23418
23423
|
4,
|
|
23419
23424
|
new Promise(function(resolve) {
|
|
23420
|
-
shaderLibrary.compileAllShaders(function() {
|
|
23425
|
+
shaderLibrary == null ? void 0 : shaderLibrary.compileAllShaders(function() {
|
|
23421
23426
|
resolve(null);
|
|
23422
23427
|
});
|
|
23423
23428
|
})
|
|
@@ -25231,7 +25236,7 @@ var listOrder = 0;
|
|
|
25231
25236
|
};
|
|
25232
25237
|
_proto.addPackageDatas = function addPackageDatas(scene) {
|
|
25233
25238
|
var jsonScene = scene.jsonScene, _scene_textureOptions = scene.textureOptions, textureOptions = _scene_textureOptions === void 0 ? [] : _scene_textureOptions;
|
|
25234
|
-
var _jsonScene_items = jsonScene.items, items = _jsonScene_items === void 0 ? [] : _jsonScene_items, _jsonScene_materials = jsonScene.materials, materials = _jsonScene_materials === void 0 ? [] : _jsonScene_materials, _jsonScene_shaders = jsonScene.shaders, shaders = _jsonScene_shaders === void 0 ? [] : _jsonScene_shaders, _jsonScene_geometries = jsonScene.geometries, geometries = _jsonScene_geometries === void 0 ? [] : _jsonScene_geometries, _jsonScene_components = jsonScene.components, components = _jsonScene_components === void 0 ? [] : _jsonScene_components, _jsonScene_animations = jsonScene.animations, animations = _jsonScene_animations === void 0 ? [] : _jsonScene_animations, _jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins;
|
|
25239
|
+
var _jsonScene_items = jsonScene.items, items = _jsonScene_items === void 0 ? [] : _jsonScene_items, _jsonScene_materials = jsonScene.materials, materials = _jsonScene_materials === void 0 ? [] : _jsonScene_materials, _jsonScene_shaders = jsonScene.shaders, shaders = _jsonScene_shaders === void 0 ? [] : _jsonScene_shaders, _jsonScene_geometries = jsonScene.geometries, geometries = _jsonScene_geometries === void 0 ? [] : _jsonScene_geometries, _jsonScene_components = jsonScene.components, components = _jsonScene_components === void 0 ? [] : _jsonScene_components, _jsonScene_animations = jsonScene.animations, animations = _jsonScene_animations === void 0 ? [] : _jsonScene_animations, _jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, _jsonScene_miscs = jsonScene.miscs, miscs = _jsonScene_miscs === void 0 ? [] : _jsonScene_miscs;
|
|
25235
25240
|
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
25236
25241
|
var vfxItemData = _step.value;
|
|
25237
25242
|
this.addEffectsObjectData(vfxItemData);
|
|
@@ -25256,6 +25261,10 @@ var listOrder = 0;
|
|
|
25256
25261
|
var animationData = _step5.value;
|
|
25257
25262
|
this.addEffectsObjectData(animationData);
|
|
25258
25263
|
}
|
|
25264
|
+
for(var _iterator6 = _create_for_of_iterator_helper_loose(miscs), _step6; !(_step6 = _iterator6()).done;){
|
|
25265
|
+
var miscData = _step6.value;
|
|
25266
|
+
this.addEffectsObjectData(miscData);
|
|
25267
|
+
}
|
|
25259
25268
|
for(var i = 0; i < bins.length; i++){
|
|
25260
25269
|
var binaryData = bins[i];
|
|
25261
25270
|
var binaryBuffer = scene.bins[i];
|
|
@@ -25267,8 +25276,8 @@ var listOrder = 0;
|
|
|
25267
25276
|
this.addEffectsObjectData(binaryData);
|
|
25268
25277
|
}
|
|
25269
25278
|
}
|
|
25270
|
-
for(var
|
|
25271
|
-
var textureData =
|
|
25279
|
+
for(var _iterator7 = _create_for_of_iterator_helper_loose(textureOptions), _step7; !(_step7 = _iterator7()).done;){
|
|
25280
|
+
var textureData = _step7.value;
|
|
25272
25281
|
this.addEffectsObjectData(textureData);
|
|
25273
25282
|
}
|
|
25274
25283
|
};
|
|
@@ -26636,6 +26645,14 @@ var seed = 1;
|
|
|
26636
26645
|
*/ _proto.dispose = function dispose() {
|
|
26637
26646
|
this.texture.dispose();
|
|
26638
26647
|
};
|
|
26648
|
+
/**
|
|
26649
|
+
* 通过图层设置创建贴图
|
|
26650
|
+
* @param data - 图层设置
|
|
26651
|
+
*/ _proto.fromData = function fromData(data) {
|
|
26652
|
+
Texture.prototype.fromData.call(this, data);
|
|
26653
|
+
this.texture = this.createTextureByType(data);
|
|
26654
|
+
this.texture.needsUpdate = true;
|
|
26655
|
+
};
|
|
26639
26656
|
_proto.createTextureByType = function createTextureByType(options) {
|
|
26640
26657
|
var assembleOptions = this.assembleOptions(options);
|
|
26641
26658
|
// TODO renderer.getMaxAnisotropy() 查询最大各向异性
|
|
@@ -27156,8 +27173,8 @@ setMaxSpriteMeshItemCount(8);
|
|
|
27156
27173
|
*/ Mesh.create = function(engine, props) {
|
|
27157
27174
|
return new ThreeMesh(engine, props);
|
|
27158
27175
|
};
|
|
27159
|
-
var version = "2.0.0-alpha.
|
|
27176
|
+
var version = "2.0.0-alpha.17";
|
|
27160
27177
|
logger.info("THREEJS plugin version: " + version);
|
|
27161
27178
|
|
|
27162
|
-
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextLoader, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, decimalEqual,
|
|
27179
|
+
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, maxSpriteTextureCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, pointOnLine, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxFragmentTextures, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
|
|
27163
27180
|
//# sourceMappingURL=index.mjs.map
|