@galacean/effects-core 2.0.0-alpha.20 → 2.0.0-alpha.22
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/camera.d.ts +7 -1
- package/dist/composition.d.ts +25 -2
- package/dist/index.js +157 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +157 -46
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/interact/click-handler.d.ts +1 -1
- package/dist/plugins/interact/interact-item.d.ts +13 -0
- package/dist/plugins/text/text-item.d.ts +6 -0
- package/dist/plugins/text/text-layout.d.ts +9 -1
- package/dist/scene.d.ts +4 -0
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.22
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -4320,11 +4320,19 @@ var DataType;
|
|
|
4320
4320
|
DataType["Texture"] = "Texture";
|
|
4321
4321
|
DataType["AnimationClip"] = "AnimationClip";
|
|
4322
4322
|
DataType["TextComponent"] = "TextComponent";
|
|
4323
|
+
DataType["BinaryAsset"] = "BinaryAsset";
|
|
4324
|
+
// Timeline
|
|
4323
4325
|
DataType["TrackAsset"] = "TrackAsset";
|
|
4324
4326
|
DataType["TimelineAsset"] = "TimelineAsset";
|
|
4327
|
+
DataType["ObjectBindingTrack"] = "ObjectBindingTrack";
|
|
4328
|
+
DataType["TransformTrack"] = "TransformTrack";
|
|
4329
|
+
DataType["SpriteColorTrack"] = "SpriteColorTrack";
|
|
4330
|
+
DataType["ActivationTrack"] = "ActivationTrack";
|
|
4331
|
+
DataType["SubCompositionTrack"] = "SubCompositionTrack";
|
|
4325
4332
|
DataType["TransformPlayableAsset"] = "TransformPlayableAsset";
|
|
4326
4333
|
DataType["SpriteColorPlayableAsset"] = "SpriteColorPlayableAsset";
|
|
4327
|
-
DataType["
|
|
4334
|
+
DataType["ActivationPlayableAsset"] = "ActivationPlayableAsset";
|
|
4335
|
+
DataType["SubCompositionPlayableAsset"] = "SubCompositionPlayableAsset";
|
|
4328
4336
|
// FIXME: 先完成ECS的场景转换,后面移到spec中
|
|
4329
4337
|
DataType["MeshComponent"] = "MeshComponent";
|
|
4330
4338
|
DataType["SkyboxComponent"] = "SkyboxComponent";
|
|
@@ -4913,10 +4921,25 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
4913
4921
|
var getTouchEventValue = function(event, x, y, dx, dy) {
|
|
4914
4922
|
if (dx === void 0) dx = 0;
|
|
4915
4923
|
if (dy === void 0) dy = 0;
|
|
4916
|
-
var _this_target = _this.target, width = _this_target.width, height = _this_target.height;
|
|
4917
|
-
var ts = performance.now();
|
|
4918
4924
|
var vx = 0;
|
|
4919
4925
|
var vy = 0;
|
|
4926
|
+
var ts = performance.now();
|
|
4927
|
+
if (!_this.target) {
|
|
4928
|
+
logger.error("Trigger TouchEvent after EventSystem is disposed.");
|
|
4929
|
+
return {
|
|
4930
|
+
x: x,
|
|
4931
|
+
y: y,
|
|
4932
|
+
vx: 0,
|
|
4933
|
+
vy: vy,
|
|
4934
|
+
dx: dx,
|
|
4935
|
+
dy: dy,
|
|
4936
|
+
ts: ts,
|
|
4937
|
+
width: 0,
|
|
4938
|
+
height: 0,
|
|
4939
|
+
origin: event
|
|
4940
|
+
};
|
|
4941
|
+
}
|
|
4942
|
+
var _this_target = _this.target, width = _this_target.width, height = _this_target.height;
|
|
4920
4943
|
if (lastTouch) {
|
|
4921
4944
|
var dt = ts - lastTouch.ts;
|
|
4922
4945
|
vx = (dx - lastTouch.dx) / dt || 0;
|
|
@@ -13041,6 +13064,16 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13041
13064
|
function InteractComponent() {
|
|
13042
13065
|
var _this;
|
|
13043
13066
|
_this = RendererComponent.apply(this, arguments) || this;
|
|
13067
|
+
/**
|
|
13068
|
+
* 拖拽的惯性衰减系数,范围[0, 1], 越大惯性越强
|
|
13069
|
+
*/ _this.downgrade = 0.95;
|
|
13070
|
+
/**
|
|
13071
|
+
* 拖拽的距离映射系数,越大越容易拖动
|
|
13072
|
+
*/ _this.dragRatio = [
|
|
13073
|
+
1,
|
|
13074
|
+
1
|
|
13075
|
+
];
|
|
13076
|
+
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
13044
13077
|
_this.getHitTestParams = function(force) {
|
|
13045
13078
|
if (!_this.clickable) {
|
|
13046
13079
|
return;
|
|
@@ -13092,9 +13125,8 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13092
13125
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
13093
13126
|
return;
|
|
13094
13127
|
}
|
|
13095
|
-
|
|
13096
|
-
this.bouncingArg.
|
|
13097
|
-
this.bouncingArg.vy *= downgrade;
|
|
13128
|
+
this.bouncingArg.vx *= this.downgrade;
|
|
13129
|
+
this.bouncingArg.vy *= this.downgrade;
|
|
13098
13130
|
this.bouncingArg.dy += this.bouncingArg.vy;
|
|
13099
13131
|
this.bouncingArg.dx += this.bouncingArg.vx;
|
|
13100
13132
|
if (shouldIgnoreBouncing(this.bouncingArg)) {
|
|
@@ -13122,7 +13154,7 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13122
13154
|
// OVERRIDE
|
|
13123
13155
|
};
|
|
13124
13156
|
_proto.handleDragMove = function handleDragMove(evt, event) {
|
|
13125
|
-
if (!(evt
|
|
13157
|
+
if (!(evt == null ? void 0 : evt.cameraParam) || !this.canInteract() || !this.item.composition) {
|
|
13126
13158
|
return;
|
|
13127
13159
|
}
|
|
13128
13160
|
var options = this.item.props.content.options;
|
|
@@ -13133,8 +13165,8 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13133
13165
|
var sp = Math.tan(fov * Math.PI / 180 / 2) * Math.abs(depth);
|
|
13134
13166
|
var height = dy * sp;
|
|
13135
13167
|
var width = dx * sp;
|
|
13136
|
-
var nx = position[0] - width;
|
|
13137
|
-
var ny = position[1] - height;
|
|
13168
|
+
var nx = position[0] - this.dragRatio[0] * width;
|
|
13169
|
+
var ny = position[1] - this.dragRatio[1] * height;
|
|
13138
13170
|
if (options.dxRange) {
|
|
13139
13171
|
var _options_dxRange = options.dxRange, min = _options_dxRange[0], max = _options_dxRange[1];
|
|
13140
13172
|
nx = clamp$1(nx, min, max);
|
|
@@ -13162,6 +13194,9 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13162
13194
|
var handlerMap = {
|
|
13163
13195
|
touchstart: function(event) {
|
|
13164
13196
|
var _this_item_composition;
|
|
13197
|
+
if (!_this.canInteract()) {
|
|
13198
|
+
return;
|
|
13199
|
+
}
|
|
13165
13200
|
_this.dragEvent = null;
|
|
13166
13201
|
_this.bouncingArg = null;
|
|
13167
13202
|
var camera = (_this_item_composition = _this.item.composition) == null ? void 0 : _this_item_composition.camera;
|
|
@@ -13183,6 +13218,9 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13183
13218
|
_this.bouncingArg = event;
|
|
13184
13219
|
},
|
|
13185
13220
|
touchend: function(event) {
|
|
13221
|
+
if (!_this.canInteract()) {
|
|
13222
|
+
return;
|
|
13223
|
+
}
|
|
13186
13224
|
var bouncingArg = _this.bouncingArg;
|
|
13187
13225
|
if (!shouldIgnoreBouncing(bouncingArg, 3) && bouncingArg) {
|
|
13188
13226
|
var speed = 5;
|
|
@@ -13225,6 +13263,25 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13225
13263
|
RendererComponent.prototype.fromData.call(this, data);
|
|
13226
13264
|
this.interactData = data;
|
|
13227
13265
|
};
|
|
13266
|
+
_proto.canInteract = function canInteract() {
|
|
13267
|
+
var _this_item_composition;
|
|
13268
|
+
return Boolean((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.interactive) && this._interactive;
|
|
13269
|
+
};
|
|
13270
|
+
_create_class(InteractComponent, [
|
|
13271
|
+
{
|
|
13272
|
+
key: "interactive",
|
|
13273
|
+
get: function get() {
|
|
13274
|
+
return this._interactive;
|
|
13275
|
+
},
|
|
13276
|
+
set: function set(enable) {
|
|
13277
|
+
this._interactive = enable;
|
|
13278
|
+
if (!enable) {
|
|
13279
|
+
// 立刻停止惯性滑动
|
|
13280
|
+
this.bouncingArg = null;
|
|
13281
|
+
}
|
|
13282
|
+
}
|
|
13283
|
+
}
|
|
13284
|
+
]);
|
|
13228
13285
|
return InteractComponent;
|
|
13229
13286
|
}(RendererComponent);
|
|
13230
13287
|
InteractComponent = __decorate([
|
|
@@ -16741,17 +16798,12 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16741
16798
|
_proto.onEnd = function onEnd(particle) {};
|
|
16742
16799
|
_proto.onIterate = function onIterate(particle) {};
|
|
16743
16800
|
_proto.initPoint = function initPoint(data) {
|
|
16744
|
-
var _this_item_composition, _this_item_composition1;
|
|
16745
16801
|
var options = this.options;
|
|
16746
16802
|
var lifetime = this.lifetime;
|
|
16747
16803
|
var shape = this.shape;
|
|
16748
16804
|
var speed = options.startSpeed.getValue(lifetime);
|
|
16749
16805
|
var matrix4 = options.particleFollowParent ? this.transform.getMatrix() : this.transform.getWorldMatrix();
|
|
16750
16806
|
var pointPosition = data.position;
|
|
16751
|
-
if (((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderer.env) === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
16752
|
-
pointPosition.x /= this.item.composition.editorScaleRatio;
|
|
16753
|
-
pointPosition.y /= this.item.composition.editorScaleRatio;
|
|
16754
|
-
}
|
|
16755
16807
|
// 粒子的位置受发射器的位置影响,自身的旋转和缩放不受影响
|
|
16756
16808
|
var position = matrix4.transformPoint(pointPosition, new Vector3());
|
|
16757
16809
|
var transform = new Transform({
|
|
@@ -16832,10 +16884,6 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16832
16884
|
size.x *= tempScale.x;
|
|
16833
16885
|
size.y *= tempScale.y;
|
|
16834
16886
|
}
|
|
16835
|
-
if (((_this_item_composition1 = this.item.composition) == null ? void 0 : _this_item_composition1.renderer.env) === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
16836
|
-
size.x /= this.item.composition.editorScaleRatio;
|
|
16837
|
-
size.y /= this.item.composition.editorScaleRatio;
|
|
16838
|
-
}
|
|
16839
16887
|
transform.setScale(size.x, size.y, 1);
|
|
16840
16888
|
return {
|
|
16841
16889
|
size: size,
|
|
@@ -19391,21 +19439,33 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
19391
19439
|
this.lineHeight = lineHeight;
|
|
19392
19440
|
}
|
|
19393
19441
|
var _proto = TextLayout.prototype;
|
|
19394
|
-
|
|
19395
|
-
|
|
19396
|
-
|
|
19442
|
+
/**
|
|
19443
|
+
* 获取初始的行高偏移值
|
|
19444
|
+
* @param style - 字体基础数据
|
|
19445
|
+
* @param lineCount - 渲染行数
|
|
19446
|
+
* @param lineHeight - 渲染时的字体行高
|
|
19447
|
+
* @param fontSize - 渲染时的字体大小
|
|
19448
|
+
* @returns - 行高偏移值
|
|
19449
|
+
*/ _proto.getOffsetY = function getOffsetY(style, lineCount, lineHeight, fontSize) {
|
|
19450
|
+
var outlineWidth = style.outlineWidth, fontScale = style.fontScale;
|
|
19451
|
+
// /3 计算Y轴偏移量,以匹配编辑器行为
|
|
19452
|
+
var offsetY = (lineHeight - fontSize) / 3;
|
|
19453
|
+
// 计算基础偏移量
|
|
19454
|
+
var baseOffset = fontSize + outlineWidth * fontScale;
|
|
19455
|
+
var commonCalculation = lineHeight * (lineCount - 1);
|
|
19456
|
+
var offsetResult = 0;
|
|
19397
19457
|
switch(this.textBaseline){
|
|
19398
19458
|
case TextBaseline.top:
|
|
19399
|
-
|
|
19459
|
+
offsetResult = baseOffset + offsetY;
|
|
19400
19460
|
break;
|
|
19401
19461
|
case TextBaseline.middle:
|
|
19402
|
-
|
|
19462
|
+
offsetResult = (this.height * fontScale - commonCalculation + baseOffset) / 2;
|
|
19403
19463
|
break;
|
|
19404
19464
|
case TextBaseline.bottom:
|
|
19405
|
-
|
|
19465
|
+
offsetResult = this.height * fontScale - commonCalculation - offsetY;
|
|
19406
19466
|
break;
|
|
19407
19467
|
}
|
|
19408
|
-
return
|
|
19468
|
+
return offsetResult;
|
|
19409
19469
|
};
|
|
19410
19470
|
_proto.getOffsetX = function getOffsetX(style, maxWidth) {
|
|
19411
19471
|
var offsetX = 0;
|
|
@@ -19563,6 +19623,9 @@ var TextComponent = /*#__PURE__*/ function(SpriteComponent) {
|
|
|
19563
19623
|
var _this;
|
|
19564
19624
|
_this = SpriteComponent.call(this, engine, props) || this;
|
|
19565
19625
|
_this.isDirty = true;
|
|
19626
|
+
/**
|
|
19627
|
+
* 文本行数
|
|
19628
|
+
*/ _this.lineCount = 0;
|
|
19566
19629
|
_this.canvas = canvasPool.getCanvas();
|
|
19567
19630
|
canvasPool.saveCanvas(_this.canvas);
|
|
19568
19631
|
_this.context = _this.canvas.getContext("2d", {
|
|
@@ -19606,6 +19669,31 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19606
19669
|
this.textStyle = new TextStyle(options);
|
|
19607
19670
|
this.textLayout = new TextLayout(options);
|
|
19608
19671
|
this.text = options.text;
|
|
19672
|
+
this.lineCount = this.getLineCount(options.text, true);
|
|
19673
|
+
};
|
|
19674
|
+
_proto.getLineCount = function getLineCount(text, init) {
|
|
19675
|
+
var context = this.context;
|
|
19676
|
+
var letterSpace = this.textLayout.letterSpace;
|
|
19677
|
+
var fontScale = init ? this.textStyle.fontSize / 10 : 1 / this.textStyle.fontScale;
|
|
19678
|
+
var width = this.textLayout.width + this.textStyle.fontOffset;
|
|
19679
|
+
var lineCount = 1;
|
|
19680
|
+
var x = 0;
|
|
19681
|
+
for(var i = 0; i < text.length; i++){
|
|
19682
|
+
var _context_measureText;
|
|
19683
|
+
var str = text[i];
|
|
19684
|
+
var _context_measureText_width;
|
|
19685
|
+
var textMetrics = ((_context_measureText_width = context == null ? void 0 : (_context_measureText = context.measureText(str)) == null ? void 0 : _context_measureText.width) != null ? _context_measureText_width : 0) * fontScale;
|
|
19686
|
+
// 和浏览器行为保持一致
|
|
19687
|
+
x += letterSpace;
|
|
19688
|
+
if (x + textMetrics > width && i > 0 || str === "\n") {
|
|
19689
|
+
lineCount++;
|
|
19690
|
+
x = 0;
|
|
19691
|
+
}
|
|
19692
|
+
if (str !== "\n") {
|
|
19693
|
+
x += textMetrics;
|
|
19694
|
+
}
|
|
19695
|
+
}
|
|
19696
|
+
return lineCount;
|
|
19609
19697
|
};
|
|
19610
19698
|
/**
|
|
19611
19699
|
* 设置字号大小
|
|
@@ -19652,6 +19740,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19652
19740
|
return;
|
|
19653
19741
|
}
|
|
19654
19742
|
this.text = value;
|
|
19743
|
+
this.lineCount = this.getLineCount(value, false);
|
|
19655
19744
|
this.isDirty = true;
|
|
19656
19745
|
};
|
|
19657
19746
|
/**
|
|
@@ -19814,10 +19903,8 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19814
19903
|
// 文本颜色
|
|
19815
19904
|
context.fillStyle = "rgba(" + style.textColor[0] + ", " + style.textColor[1] + ", " + style.textColor[2] + ", " + style.textColor[3] + ")";
|
|
19816
19905
|
var charsInfo = [];
|
|
19817
|
-
// /3 是为了和编辑器行为保持一致
|
|
19818
|
-
var offsetY = (lineHeight - fontSize) / 3;
|
|
19819
19906
|
var x = 0;
|
|
19820
|
-
var y = layout.getOffsetY(style
|
|
19907
|
+
var y = layout.getOffsetY(style, this.lineCount, lineHeight, fontSize);
|
|
19821
19908
|
var charsArray = [];
|
|
19822
19909
|
var charOffsetX = [];
|
|
19823
19910
|
for(var i = 0; i < this.char.length; i++){
|
|
@@ -22380,10 +22467,6 @@ function getStandardCameraContent(model) {
|
|
|
22380
22467
|
]
|
|
22381
22468
|
});
|
|
22382
22469
|
}
|
|
22383
|
-
// gizmo 的 target id 转换为新的 item guid
|
|
22384
|
-
if (item.content.options.target) {
|
|
22385
|
-
item.content.options.target = itemOldIdToGuidMap[item.content.options.target];
|
|
22386
|
-
}
|
|
22387
22470
|
// 修正老 json 的 item.pluginName
|
|
22388
22471
|
if (item.pn !== undefined) {
|
|
22389
22472
|
var pn = item.pn;
|
|
@@ -22401,6 +22484,10 @@ function getStandardCameraContent(model) {
|
|
|
22401
22484
|
//@ts-expect-error
|
|
22402
22485
|
item.type = "orientation-transformer";
|
|
22403
22486
|
}
|
|
22487
|
+
// gizmo 的 target id 转换为新的 item guid
|
|
22488
|
+
if (item.content.options.target && item.pluginName === "editor-gizmo") {
|
|
22489
|
+
item.content.options.target = itemOldIdToGuidMap[item.content.options.target];
|
|
22490
|
+
}
|
|
22404
22491
|
// Spine 元素转为 guid 索引
|
|
22405
22492
|
if (item.type === ItemType.spine && json.spines && json.spines.length !== 0) {
|
|
22406
22493
|
convertSpineData(json.spines[item.content.options.spine], item.content, result);
|
|
@@ -23207,26 +23294,27 @@ var seed = 1;
|
|
|
23207
23294
|
*/ _proto.loadScene = function loadScene(url, renderer, options) {
|
|
23208
23295
|
var _this = this;
|
|
23209
23296
|
return _async_to_generator(function() {
|
|
23210
|
-
var _gpuInstance_detail, rawJSON, assetUrl, startTime,
|
|
23297
|
+
var _gpuInstance_detail, rawJSON, assetUrl, startTime, timeInfoMessages, gpuInstance, _gpuInstance_detail_asyncShaderCompile, asyncShaderCompile, _gpuInstance_detail_compressedTexture, compressedTexture, timeInfos, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
|
|
23211
23298
|
return __generator(this, function(_state) {
|
|
23212
23299
|
assetUrl = isString(url) ? url : _this.id;
|
|
23213
23300
|
startTime = performance.now();
|
|
23214
|
-
|
|
23301
|
+
timeInfoMessages = [];
|
|
23215
23302
|
gpuInstance = renderer == null ? void 0 : renderer.engine.gpuCapability;
|
|
23216
23303
|
asyncShaderCompile = (_gpuInstance_detail_asyncShaderCompile = gpuInstance == null ? void 0 : (_gpuInstance_detail = gpuInstance.detail) == null ? void 0 : _gpuInstance_detail.asyncShaderCompile) != null ? _gpuInstance_detail_asyncShaderCompile : false;
|
|
23217
23304
|
compressedTexture = (_gpuInstance_detail_compressedTexture = gpuInstance == null ? void 0 : gpuInstance.detail.compressedTexture) != null ? _gpuInstance_detail_compressedTexture : COMPRESSED_TEXTURE.NONE;
|
|
23305
|
+
timeInfos = {};
|
|
23218
23306
|
cancelLoading = false;
|
|
23219
23307
|
waitPromise = new Promise(function(resolve, reject) {
|
|
23220
23308
|
loadTimer = window.setTimeout(function() {
|
|
23221
23309
|
cancelLoading = true;
|
|
23222
23310
|
_this.removeTimer(loadTimer);
|
|
23223
23311
|
var totalTime = performance.now() - startTime;
|
|
23224
|
-
reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " +
|
|
23312
|
+
reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + "."));
|
|
23225
23313
|
}, _this.timeout * 1000);
|
|
23226
23314
|
_this.timers.push(loadTimer);
|
|
23227
23315
|
});
|
|
23228
23316
|
hookTimeInfo = /*#__PURE__*/ _async_to_generator(function(label, func) {
|
|
23229
|
-
var st, result, e;
|
|
23317
|
+
var st, result, time, e;
|
|
23230
23318
|
return __generator(this, function(_state) {
|
|
23231
23319
|
switch(_state.label){
|
|
23232
23320
|
case 0:
|
|
@@ -23249,7 +23337,9 @@ var seed = 1;
|
|
|
23249
23337
|
];
|
|
23250
23338
|
case 2:
|
|
23251
23339
|
result = _state.sent();
|
|
23252
|
-
|
|
23340
|
+
time = performance.now() - st;
|
|
23341
|
+
timeInfoMessages.push("[" + label + ": " + time.toFixed(2) + "]");
|
|
23342
|
+
timeInfos[label] = time;
|
|
23253
23343
|
return [
|
|
23254
23344
|
2,
|
|
23255
23345
|
result
|
|
@@ -23348,7 +23438,7 @@ var seed = 1;
|
|
|
23348
23438
|
hookTimeInfo("processImages", function() {
|
|
23349
23439
|
return _this.processImages(images1, compressedTexture);
|
|
23350
23440
|
}),
|
|
23351
|
-
hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + "
|
|
23441
|
+
hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + "Compile", function() {
|
|
23352
23442
|
return _this.precompile(compositions, pluginSystem, renderer, options);
|
|
23353
23443
|
})
|
|
23354
23444
|
])
|
|
@@ -23381,6 +23471,7 @@ var seed = 1;
|
|
|
23381
23471
|
loadedTextures = _state.sent();
|
|
23382
23472
|
_this.updateSceneData(jsonScene.items);
|
|
23383
23473
|
scene = {
|
|
23474
|
+
timeInfos: timeInfos,
|
|
23384
23475
|
url: url,
|
|
23385
23476
|
renderLevel: _this.options.renderLevel,
|
|
23386
23477
|
storage: {},
|
|
@@ -23403,11 +23494,13 @@ var seed = 1;
|
|
|
23403
23494
|
_state.label = 12;
|
|
23404
23495
|
case 12:
|
|
23405
23496
|
totalTime = performance.now() - startTime;
|
|
23406
|
-
logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " +
|
|
23497
|
+
logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + ".");
|
|
23407
23498
|
window.clearTimeout(loadTimer);
|
|
23408
23499
|
_this.removeTimer(loadTimer);
|
|
23409
23500
|
scene.totalTime = totalTime;
|
|
23410
23501
|
scene.startTime = startTime;
|
|
23502
|
+
// 各部分分段时长
|
|
23503
|
+
scene.timeInfos = timeInfos;
|
|
23411
23504
|
return [
|
|
23412
23505
|
2,
|
|
23413
23506
|
scene
|
|
@@ -23946,6 +24039,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
23946
24039
|
function Camera(name, options) {
|
|
23947
24040
|
if (options === void 0) options = {};
|
|
23948
24041
|
this.name = name;
|
|
24042
|
+
this.fovScaleRatio = 1.0;
|
|
23949
24043
|
this.viewMatrix = Matrix4.fromIdentity();
|
|
23950
24044
|
this.projectionMatrix = Matrix4.fromIdentity();
|
|
23951
24045
|
this.viewProjectionMatrix = Matrix4.fromIdentity();
|
|
@@ -23973,6 +24067,13 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
23973
24067
|
this.updateMatrix();
|
|
23974
24068
|
}
|
|
23975
24069
|
var _proto = Camera.prototype;
|
|
24070
|
+
_proto.setFovScaleRatio = function setFovScaleRatio(value) {
|
|
24071
|
+
this.fovScaleRatio = value;
|
|
24072
|
+
this.dirty = true;
|
|
24073
|
+
};
|
|
24074
|
+
_proto.getFovScaleRatio = function getFovScaleRatio() {
|
|
24075
|
+
return this.fovScaleRatio;
|
|
24076
|
+
};
|
|
23976
24077
|
/**
|
|
23977
24078
|
* 获取相机的视图变换矩阵
|
|
23978
24079
|
* @return
|
|
@@ -24093,7 +24194,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24093
24194
|
*/ _proto.updateMatrix = function updateMatrix() {
|
|
24094
24195
|
if (this.dirty) {
|
|
24095
24196
|
var _this_options = this.options, fov = _this_options.fov, aspect = _this_options.aspect, near = _this_options.near, far = _this_options.far, clipMode = _this_options.clipMode, position = _this_options.position;
|
|
24096
|
-
this.projectionMatrix.perspective(fov * DEG2RAD, aspect, near, far, clipMode === CameraClipMode.portrait);
|
|
24197
|
+
this.projectionMatrix.perspective(fov * DEG2RAD * this.fovScaleRatio, aspect, near, far, clipMode === CameraClipMode.portrait);
|
|
24097
24198
|
this.inverseViewMatrix.compose(position, this.getQuat(), tmpScale);
|
|
24098
24199
|
this.viewMatrix.copyFrom(this.inverseViewMatrix).invert();
|
|
24099
24200
|
this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix, this.viewMatrix);
|
|
@@ -24400,7 +24501,6 @@ var listOrder = 0;
|
|
|
24400
24501
|
/**
|
|
24401
24502
|
* 预合成的合成属性,在 content 中会被其元素属性覆盖
|
|
24402
24503
|
*/ this.refCompositionProps = new Map();
|
|
24403
|
-
this.editorScaleRatio = 1.0;
|
|
24404
24504
|
// TODO: 待优化
|
|
24405
24505
|
this.assigned = false;
|
|
24406
24506
|
/**
|
|
@@ -24437,11 +24537,12 @@ var listOrder = 0;
|
|
|
24437
24537
|
this.renderer = renderer;
|
|
24438
24538
|
this.texInfo = imageUsage != null ? imageUsage : {};
|
|
24439
24539
|
this.event = event;
|
|
24440
|
-
var _scene_startTime;
|
|
24540
|
+
var _scene_startTime, _scene_timeInfos_asyncCompile;
|
|
24441
24541
|
this.statistic = {
|
|
24442
24542
|
loadTime: totalTime != null ? totalTime : 0,
|
|
24443
24543
|
loadStart: (_scene_startTime = scene.startTime) != null ? _scene_startTime : 0,
|
|
24444
|
-
firstFrameTime: 0
|
|
24544
|
+
firstFrameTime: 0,
|
|
24545
|
+
precompileTime: (_scene_timeInfos_asyncCompile = scene.timeInfos["asyncCompile"]) != null ? _scene_timeInfos_asyncCompile : scene.timeInfos["syncCompile"]
|
|
24445
24546
|
};
|
|
24446
24547
|
this.reusable = reusable;
|
|
24447
24548
|
this.speed = speed;
|
|
@@ -24455,6 +24556,7 @@ var listOrder = 0;
|
|
|
24455
24556
|
this.url = scene.url;
|
|
24456
24557
|
this.assigned = true;
|
|
24457
24558
|
this.globalTime = 0;
|
|
24559
|
+
this.interactive = true;
|
|
24458
24560
|
this.onPlayerPause = onPlayerPause;
|
|
24459
24561
|
this.onMessageItem = onMessageItem;
|
|
24460
24562
|
this.onEnd = onEnd;
|
|
@@ -24884,7 +24986,7 @@ var listOrder = 0;
|
|
|
24884
24986
|
* @param options - 最大求交数和求交时的回调
|
|
24885
24987
|
*/ _proto.hitTest = function hitTest(x, y, force, options) {
|
|
24886
24988
|
var _this_rootItem_getComponent;
|
|
24887
|
-
if (this.isDestroyed) {
|
|
24989
|
+
if (this.isDestroyed || !this.interactive) {
|
|
24888
24990
|
return [];
|
|
24889
24991
|
}
|
|
24890
24992
|
var regions = [];
|
|
@@ -25205,6 +25307,15 @@ var listOrder = 0;
|
|
|
25205
25307
|
*/ function get() {
|
|
25206
25308
|
return this.destroyed;
|
|
25207
25309
|
}
|
|
25310
|
+
},
|
|
25311
|
+
{
|
|
25312
|
+
key: "editorScaleRatio",
|
|
25313
|
+
get: function get() {
|
|
25314
|
+
return this.camera.getFovScaleRatio();
|
|
25315
|
+
},
|
|
25316
|
+
set: function set(value) {
|
|
25317
|
+
this.camera.setFovScaleRatio(value);
|
|
25318
|
+
}
|
|
25208
25319
|
}
|
|
25209
25320
|
]);
|
|
25210
25321
|
return Composition;
|
|
@@ -25602,7 +25713,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
25602
25713
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
25603
25714
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
25604
25715
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
25605
|
-
var version = "2.0.0-alpha.
|
|
25716
|
+
var version = "2.0.0-alpha.22";
|
|
25606
25717
|
logger.info("Core version: " + version + ".");
|
|
25607
25718
|
|
|
25608
25719
|
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, 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, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMacros, 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, 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, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
|