@galacean/effects-core 2.0.0-alpha.20 → 2.0.0-alpha.21
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 +5 -1
- package/dist/composition.d.ts +25 -2
- package/dist/index.js +143 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +143 -45
- 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 +1 -1
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.21
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -4913,10 +4913,25 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
4913
4913
|
var getTouchEventValue = function(event, x, y, dx, dy) {
|
|
4914
4914
|
if (dx === void 0) dx = 0;
|
|
4915
4915
|
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
4916
|
var vx = 0;
|
|
4919
4917
|
var vy = 0;
|
|
4918
|
+
var ts = performance.now();
|
|
4919
|
+
if (!_this.target) {
|
|
4920
|
+
logger.error("Trigger TouchEvent after EventSystem is disposed.");
|
|
4921
|
+
return {
|
|
4922
|
+
x: x,
|
|
4923
|
+
y: y,
|
|
4924
|
+
vx: 0,
|
|
4925
|
+
vy: vy,
|
|
4926
|
+
dx: dx,
|
|
4927
|
+
dy: dy,
|
|
4928
|
+
ts: ts,
|
|
4929
|
+
width: 0,
|
|
4930
|
+
height: 0,
|
|
4931
|
+
origin: event
|
|
4932
|
+
};
|
|
4933
|
+
}
|
|
4934
|
+
var _this_target = _this.target, width = _this_target.width, height = _this_target.height;
|
|
4920
4935
|
if (lastTouch) {
|
|
4921
4936
|
var dt = ts - lastTouch.ts;
|
|
4922
4937
|
vx = (dx - lastTouch.dx) / dt || 0;
|
|
@@ -13041,6 +13056,16 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13041
13056
|
function InteractComponent() {
|
|
13042
13057
|
var _this;
|
|
13043
13058
|
_this = RendererComponent.apply(this, arguments) || this;
|
|
13059
|
+
/**
|
|
13060
|
+
* 拖拽的惯性衰减系数,范围[0, 1], 越大惯性越强
|
|
13061
|
+
*/ _this.downgrade = 0.95;
|
|
13062
|
+
/**
|
|
13063
|
+
* 拖拽的距离映射系数,越大越容易拖动
|
|
13064
|
+
*/ _this.dragRatio = [
|
|
13065
|
+
1,
|
|
13066
|
+
1
|
|
13067
|
+
];
|
|
13068
|
+
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
13044
13069
|
_this.getHitTestParams = function(force) {
|
|
13045
13070
|
if (!_this.clickable) {
|
|
13046
13071
|
return;
|
|
@@ -13092,9 +13117,8 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13092
13117
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
13093
13118
|
return;
|
|
13094
13119
|
}
|
|
13095
|
-
|
|
13096
|
-
this.bouncingArg.
|
|
13097
|
-
this.bouncingArg.vy *= downgrade;
|
|
13120
|
+
this.bouncingArg.vx *= this.downgrade;
|
|
13121
|
+
this.bouncingArg.vy *= this.downgrade;
|
|
13098
13122
|
this.bouncingArg.dy += this.bouncingArg.vy;
|
|
13099
13123
|
this.bouncingArg.dx += this.bouncingArg.vx;
|
|
13100
13124
|
if (shouldIgnoreBouncing(this.bouncingArg)) {
|
|
@@ -13122,7 +13146,7 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13122
13146
|
// OVERRIDE
|
|
13123
13147
|
};
|
|
13124
13148
|
_proto.handleDragMove = function handleDragMove(evt, event) {
|
|
13125
|
-
if (!(evt
|
|
13149
|
+
if (!(evt == null ? void 0 : evt.cameraParam) || !this.canInteract() || !this.item.composition) {
|
|
13126
13150
|
return;
|
|
13127
13151
|
}
|
|
13128
13152
|
var options = this.item.props.content.options;
|
|
@@ -13133,8 +13157,8 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13133
13157
|
var sp = Math.tan(fov * Math.PI / 180 / 2) * Math.abs(depth);
|
|
13134
13158
|
var height = dy * sp;
|
|
13135
13159
|
var width = dx * sp;
|
|
13136
|
-
var nx = position[0] - width;
|
|
13137
|
-
var ny = position[1] - height;
|
|
13160
|
+
var nx = position[0] - this.dragRatio[0] * width;
|
|
13161
|
+
var ny = position[1] - this.dragRatio[1] * height;
|
|
13138
13162
|
if (options.dxRange) {
|
|
13139
13163
|
var _options_dxRange = options.dxRange, min = _options_dxRange[0], max = _options_dxRange[1];
|
|
13140
13164
|
nx = clamp$1(nx, min, max);
|
|
@@ -13162,6 +13186,9 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13162
13186
|
var handlerMap = {
|
|
13163
13187
|
touchstart: function(event) {
|
|
13164
13188
|
var _this_item_composition;
|
|
13189
|
+
if (!_this.canInteract()) {
|
|
13190
|
+
return;
|
|
13191
|
+
}
|
|
13165
13192
|
_this.dragEvent = null;
|
|
13166
13193
|
_this.bouncingArg = null;
|
|
13167
13194
|
var camera = (_this_item_composition = _this.item.composition) == null ? void 0 : _this_item_composition.camera;
|
|
@@ -13183,6 +13210,9 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13183
13210
|
_this.bouncingArg = event;
|
|
13184
13211
|
},
|
|
13185
13212
|
touchend: function(event) {
|
|
13213
|
+
if (!_this.canInteract()) {
|
|
13214
|
+
return;
|
|
13215
|
+
}
|
|
13186
13216
|
var bouncingArg = _this.bouncingArg;
|
|
13187
13217
|
if (!shouldIgnoreBouncing(bouncingArg, 3) && bouncingArg) {
|
|
13188
13218
|
var speed = 5;
|
|
@@ -13225,6 +13255,25 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13225
13255
|
RendererComponent.prototype.fromData.call(this, data);
|
|
13226
13256
|
this.interactData = data;
|
|
13227
13257
|
};
|
|
13258
|
+
_proto.canInteract = function canInteract() {
|
|
13259
|
+
var _this_item_composition;
|
|
13260
|
+
return Boolean((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.interactive) && this._interactive;
|
|
13261
|
+
};
|
|
13262
|
+
_create_class(InteractComponent, [
|
|
13263
|
+
{
|
|
13264
|
+
key: "interactive",
|
|
13265
|
+
get: function get() {
|
|
13266
|
+
return this._interactive;
|
|
13267
|
+
},
|
|
13268
|
+
set: function set(enable) {
|
|
13269
|
+
this._interactive = enable;
|
|
13270
|
+
if (!enable) {
|
|
13271
|
+
// 立刻停止惯性滑动
|
|
13272
|
+
this.bouncingArg = null;
|
|
13273
|
+
}
|
|
13274
|
+
}
|
|
13275
|
+
}
|
|
13276
|
+
]);
|
|
13228
13277
|
return InteractComponent;
|
|
13229
13278
|
}(RendererComponent);
|
|
13230
13279
|
InteractComponent = __decorate([
|
|
@@ -16741,17 +16790,12 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16741
16790
|
_proto.onEnd = function onEnd(particle) {};
|
|
16742
16791
|
_proto.onIterate = function onIterate(particle) {};
|
|
16743
16792
|
_proto.initPoint = function initPoint(data) {
|
|
16744
|
-
var _this_item_composition, _this_item_composition1;
|
|
16745
16793
|
var options = this.options;
|
|
16746
16794
|
var lifetime = this.lifetime;
|
|
16747
16795
|
var shape = this.shape;
|
|
16748
16796
|
var speed = options.startSpeed.getValue(lifetime);
|
|
16749
16797
|
var matrix4 = options.particleFollowParent ? this.transform.getMatrix() : this.transform.getWorldMatrix();
|
|
16750
16798
|
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
16799
|
// 粒子的位置受发射器的位置影响,自身的旋转和缩放不受影响
|
|
16756
16800
|
var position = matrix4.transformPoint(pointPosition, new Vector3());
|
|
16757
16801
|
var transform = new Transform({
|
|
@@ -16832,10 +16876,6 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16832
16876
|
size.x *= tempScale.x;
|
|
16833
16877
|
size.y *= tempScale.y;
|
|
16834
16878
|
}
|
|
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
16879
|
transform.setScale(size.x, size.y, 1);
|
|
16840
16880
|
return {
|
|
16841
16881
|
size: size,
|
|
@@ -19391,21 +19431,33 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
19391
19431
|
this.lineHeight = lineHeight;
|
|
19392
19432
|
}
|
|
19393
19433
|
var _proto = TextLayout.prototype;
|
|
19394
|
-
|
|
19395
|
-
|
|
19396
|
-
|
|
19434
|
+
/**
|
|
19435
|
+
* 获取初始的行高偏移值
|
|
19436
|
+
* @param style - 字体基础数据
|
|
19437
|
+
* @param lineCount - 渲染行数
|
|
19438
|
+
* @param lineHeight - 渲染时的字体行高
|
|
19439
|
+
* @param fontSize - 渲染时的字体大小
|
|
19440
|
+
* @returns - 行高偏移值
|
|
19441
|
+
*/ _proto.getOffsetY = function getOffsetY(style, lineCount, lineHeight, fontSize) {
|
|
19442
|
+
var outlineWidth = style.outlineWidth, fontScale = style.fontScale;
|
|
19443
|
+
// /3 计算Y轴偏移量,以匹配编辑器行为
|
|
19444
|
+
var offsetY = (lineHeight - fontSize) / 3;
|
|
19445
|
+
// 计算基础偏移量
|
|
19446
|
+
var baseOffset = fontSize + outlineWidth * fontScale;
|
|
19447
|
+
var commonCalculation = lineHeight * (lineCount - 1);
|
|
19448
|
+
var offsetResult = 0;
|
|
19397
19449
|
switch(this.textBaseline){
|
|
19398
19450
|
case TextBaseline.top:
|
|
19399
|
-
|
|
19451
|
+
offsetResult = baseOffset + offsetY;
|
|
19400
19452
|
break;
|
|
19401
19453
|
case TextBaseline.middle:
|
|
19402
|
-
|
|
19454
|
+
offsetResult = (this.height * fontScale - commonCalculation + baseOffset) / 2;
|
|
19403
19455
|
break;
|
|
19404
19456
|
case TextBaseline.bottom:
|
|
19405
|
-
|
|
19457
|
+
offsetResult = this.height * fontScale - commonCalculation - offsetY;
|
|
19406
19458
|
break;
|
|
19407
19459
|
}
|
|
19408
|
-
return
|
|
19460
|
+
return offsetResult;
|
|
19409
19461
|
};
|
|
19410
19462
|
_proto.getOffsetX = function getOffsetX(style, maxWidth) {
|
|
19411
19463
|
var offsetX = 0;
|
|
@@ -19563,6 +19615,9 @@ var TextComponent = /*#__PURE__*/ function(SpriteComponent) {
|
|
|
19563
19615
|
var _this;
|
|
19564
19616
|
_this = SpriteComponent.call(this, engine, props) || this;
|
|
19565
19617
|
_this.isDirty = true;
|
|
19618
|
+
/**
|
|
19619
|
+
* 文本行数
|
|
19620
|
+
*/ _this.lineCount = 0;
|
|
19566
19621
|
_this.canvas = canvasPool.getCanvas();
|
|
19567
19622
|
canvasPool.saveCanvas(_this.canvas);
|
|
19568
19623
|
_this.context = _this.canvas.getContext("2d", {
|
|
@@ -19606,6 +19661,31 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19606
19661
|
this.textStyle = new TextStyle(options);
|
|
19607
19662
|
this.textLayout = new TextLayout(options);
|
|
19608
19663
|
this.text = options.text;
|
|
19664
|
+
this.lineCount = this.getLineCount(options.text, true);
|
|
19665
|
+
};
|
|
19666
|
+
_proto.getLineCount = function getLineCount(text, init) {
|
|
19667
|
+
var context = this.context;
|
|
19668
|
+
var letterSpace = this.textLayout.letterSpace;
|
|
19669
|
+
var fontScale = init ? this.textStyle.fontSize / 10 : 1 / this.textStyle.fontScale;
|
|
19670
|
+
var width = this.textLayout.width + this.textStyle.fontOffset;
|
|
19671
|
+
var lineCount = 1;
|
|
19672
|
+
var x = 0;
|
|
19673
|
+
for(var i = 0; i < text.length; i++){
|
|
19674
|
+
var _context_measureText;
|
|
19675
|
+
var str = text[i];
|
|
19676
|
+
var _context_measureText_width;
|
|
19677
|
+
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;
|
|
19678
|
+
// 和浏览器行为保持一致
|
|
19679
|
+
x += letterSpace;
|
|
19680
|
+
if (x + textMetrics > width && i > 0 || str === "\n") {
|
|
19681
|
+
lineCount++;
|
|
19682
|
+
x = 0;
|
|
19683
|
+
}
|
|
19684
|
+
if (str !== "\n") {
|
|
19685
|
+
x += textMetrics;
|
|
19686
|
+
}
|
|
19687
|
+
}
|
|
19688
|
+
return lineCount;
|
|
19609
19689
|
};
|
|
19610
19690
|
/**
|
|
19611
19691
|
* 设置字号大小
|
|
@@ -19652,6 +19732,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19652
19732
|
return;
|
|
19653
19733
|
}
|
|
19654
19734
|
this.text = value;
|
|
19735
|
+
this.lineCount = this.getLineCount(value, false);
|
|
19655
19736
|
this.isDirty = true;
|
|
19656
19737
|
};
|
|
19657
19738
|
/**
|
|
@@ -19814,10 +19895,8 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19814
19895
|
// 文本颜色
|
|
19815
19896
|
context.fillStyle = "rgba(" + style.textColor[0] + ", " + style.textColor[1] + ", " + style.textColor[2] + ", " + style.textColor[3] + ")";
|
|
19816
19897
|
var charsInfo = [];
|
|
19817
|
-
// /3 是为了和编辑器行为保持一致
|
|
19818
|
-
var offsetY = (lineHeight - fontSize) / 3;
|
|
19819
19898
|
var x = 0;
|
|
19820
|
-
var y = layout.getOffsetY(style
|
|
19899
|
+
var y = layout.getOffsetY(style, this.lineCount, lineHeight, fontSize);
|
|
19821
19900
|
var charsArray = [];
|
|
19822
19901
|
var charOffsetX = [];
|
|
19823
19902
|
for(var i = 0; i < this.char.length; i++){
|
|
@@ -22380,10 +22459,6 @@ function getStandardCameraContent(model) {
|
|
|
22380
22459
|
]
|
|
22381
22460
|
});
|
|
22382
22461
|
}
|
|
22383
|
-
// gizmo 的 target id 转换为新的 item guid
|
|
22384
|
-
if (item.content.options.target) {
|
|
22385
|
-
item.content.options.target = itemOldIdToGuidMap[item.content.options.target];
|
|
22386
|
-
}
|
|
22387
22462
|
// 修正老 json 的 item.pluginName
|
|
22388
22463
|
if (item.pn !== undefined) {
|
|
22389
22464
|
var pn = item.pn;
|
|
@@ -22401,6 +22476,10 @@ function getStandardCameraContent(model) {
|
|
|
22401
22476
|
//@ts-expect-error
|
|
22402
22477
|
item.type = "orientation-transformer";
|
|
22403
22478
|
}
|
|
22479
|
+
// gizmo 的 target id 转换为新的 item guid
|
|
22480
|
+
if (item.content.options.target && item.pluginName === "editor-gizmo") {
|
|
22481
|
+
item.content.options.target = itemOldIdToGuidMap[item.content.options.target];
|
|
22482
|
+
}
|
|
22404
22483
|
// Spine 元素转为 guid 索引
|
|
22405
22484
|
if (item.type === ItemType.spine && json.spines && json.spines.length !== 0) {
|
|
22406
22485
|
convertSpineData(json.spines[item.content.options.spine], item.content, result);
|
|
@@ -23207,26 +23286,27 @@ var seed = 1;
|
|
|
23207
23286
|
*/ _proto.loadScene = function loadScene(url, renderer, options) {
|
|
23208
23287
|
var _this = this;
|
|
23209
23288
|
return _async_to_generator(function() {
|
|
23210
|
-
var _gpuInstance_detail, rawJSON, assetUrl, startTime,
|
|
23289
|
+
var _gpuInstance_detail, rawJSON, assetUrl, startTime, timeInfoMessages, gpuInstance, _gpuInstance_detail_asyncShaderCompile, asyncShaderCompile, _gpuInstance_detail_compressedTexture, compressedTexture, timeInfos, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
|
|
23211
23290
|
return __generator(this, function(_state) {
|
|
23212
23291
|
assetUrl = isString(url) ? url : _this.id;
|
|
23213
23292
|
startTime = performance.now();
|
|
23214
|
-
|
|
23293
|
+
timeInfoMessages = [];
|
|
23215
23294
|
gpuInstance = renderer == null ? void 0 : renderer.engine.gpuCapability;
|
|
23216
23295
|
asyncShaderCompile = (_gpuInstance_detail_asyncShaderCompile = gpuInstance == null ? void 0 : (_gpuInstance_detail = gpuInstance.detail) == null ? void 0 : _gpuInstance_detail.asyncShaderCompile) != null ? _gpuInstance_detail_asyncShaderCompile : false;
|
|
23217
23296
|
compressedTexture = (_gpuInstance_detail_compressedTexture = gpuInstance == null ? void 0 : gpuInstance.detail.compressedTexture) != null ? _gpuInstance_detail_compressedTexture : COMPRESSED_TEXTURE.NONE;
|
|
23297
|
+
timeInfos = {};
|
|
23218
23298
|
cancelLoading = false;
|
|
23219
23299
|
waitPromise = new Promise(function(resolve, reject) {
|
|
23220
23300
|
loadTimer = window.setTimeout(function() {
|
|
23221
23301
|
cancelLoading = true;
|
|
23222
23302
|
_this.removeTimer(loadTimer);
|
|
23223
23303
|
var totalTime = performance.now() - startTime;
|
|
23224
|
-
reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " +
|
|
23304
|
+
reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + "."));
|
|
23225
23305
|
}, _this.timeout * 1000);
|
|
23226
23306
|
_this.timers.push(loadTimer);
|
|
23227
23307
|
});
|
|
23228
23308
|
hookTimeInfo = /*#__PURE__*/ _async_to_generator(function(label, func) {
|
|
23229
|
-
var st, result, e;
|
|
23309
|
+
var st, result, time, e;
|
|
23230
23310
|
return __generator(this, function(_state) {
|
|
23231
23311
|
switch(_state.label){
|
|
23232
23312
|
case 0:
|
|
@@ -23249,7 +23329,9 @@ var seed = 1;
|
|
|
23249
23329
|
];
|
|
23250
23330
|
case 2:
|
|
23251
23331
|
result = _state.sent();
|
|
23252
|
-
|
|
23332
|
+
time = performance.now() - st;
|
|
23333
|
+
timeInfoMessages.push("[" + label + ": " + time.toFixed(2) + "]");
|
|
23334
|
+
timeInfos[label] = time;
|
|
23253
23335
|
return [
|
|
23254
23336
|
2,
|
|
23255
23337
|
result
|
|
@@ -23348,7 +23430,7 @@ var seed = 1;
|
|
|
23348
23430
|
hookTimeInfo("processImages", function() {
|
|
23349
23431
|
return _this.processImages(images1, compressedTexture);
|
|
23350
23432
|
}),
|
|
23351
|
-
hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + "
|
|
23433
|
+
hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + "Compile", function() {
|
|
23352
23434
|
return _this.precompile(compositions, pluginSystem, renderer, options);
|
|
23353
23435
|
})
|
|
23354
23436
|
])
|
|
@@ -23381,6 +23463,7 @@ var seed = 1;
|
|
|
23381
23463
|
loadedTextures = _state.sent();
|
|
23382
23464
|
_this.updateSceneData(jsonScene.items);
|
|
23383
23465
|
scene = {
|
|
23466
|
+
timeInfos: timeInfos,
|
|
23384
23467
|
url: url,
|
|
23385
23468
|
renderLevel: _this.options.renderLevel,
|
|
23386
23469
|
storage: {},
|
|
@@ -23403,11 +23486,13 @@ var seed = 1;
|
|
|
23403
23486
|
_state.label = 12;
|
|
23404
23487
|
case 12:
|
|
23405
23488
|
totalTime = performance.now() - startTime;
|
|
23406
|
-
logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " +
|
|
23489
|
+
logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + ".");
|
|
23407
23490
|
window.clearTimeout(loadTimer);
|
|
23408
23491
|
_this.removeTimer(loadTimer);
|
|
23409
23492
|
scene.totalTime = totalTime;
|
|
23410
23493
|
scene.startTime = startTime;
|
|
23494
|
+
// 各部分分段时长
|
|
23495
|
+
scene.timeInfos = timeInfos;
|
|
23411
23496
|
return [
|
|
23412
23497
|
2,
|
|
23413
23498
|
scene
|
|
@@ -23946,6 +24031,9 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
23946
24031
|
function Camera(name, options) {
|
|
23947
24032
|
if (options === void 0) options = {};
|
|
23948
24033
|
this.name = name;
|
|
24034
|
+
this./**
|
|
24035
|
+
* 编辑器用于缩放画布
|
|
24036
|
+
*/ fovScaleRatio = 1.0;
|
|
23949
24037
|
this.viewMatrix = Matrix4.fromIdentity();
|
|
23950
24038
|
this.projectionMatrix = Matrix4.fromIdentity();
|
|
23951
24039
|
this.viewProjectionMatrix = Matrix4.fromIdentity();
|
|
@@ -24093,7 +24181,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24093
24181
|
*/ _proto.updateMatrix = function updateMatrix() {
|
|
24094
24182
|
if (this.dirty) {
|
|
24095
24183
|
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);
|
|
24184
|
+
this.projectionMatrix.perspective(fov * DEG2RAD * this.fovScaleRatio, aspect, near, far, clipMode === CameraClipMode.portrait);
|
|
24097
24185
|
this.inverseViewMatrix.compose(position, this.getQuat(), tmpScale);
|
|
24098
24186
|
this.viewMatrix.copyFrom(this.inverseViewMatrix).invert();
|
|
24099
24187
|
this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix, this.viewMatrix);
|
|
@@ -24400,7 +24488,6 @@ var listOrder = 0;
|
|
|
24400
24488
|
/**
|
|
24401
24489
|
* 预合成的合成属性,在 content 中会被其元素属性覆盖
|
|
24402
24490
|
*/ this.refCompositionProps = new Map();
|
|
24403
|
-
this.editorScaleRatio = 1.0;
|
|
24404
24491
|
// TODO: 待优化
|
|
24405
24492
|
this.assigned = false;
|
|
24406
24493
|
/**
|
|
@@ -24437,11 +24524,12 @@ var listOrder = 0;
|
|
|
24437
24524
|
this.renderer = renderer;
|
|
24438
24525
|
this.texInfo = imageUsage != null ? imageUsage : {};
|
|
24439
24526
|
this.event = event;
|
|
24440
|
-
var _scene_startTime;
|
|
24527
|
+
var _scene_startTime, _scene_timeInfos_asyncCompile;
|
|
24441
24528
|
this.statistic = {
|
|
24442
24529
|
loadTime: totalTime != null ? totalTime : 0,
|
|
24443
24530
|
loadStart: (_scene_startTime = scene.startTime) != null ? _scene_startTime : 0,
|
|
24444
|
-
firstFrameTime: 0
|
|
24531
|
+
firstFrameTime: 0,
|
|
24532
|
+
precompileTime: (_scene_timeInfos_asyncCompile = scene.timeInfos["asyncCompile"]) != null ? _scene_timeInfos_asyncCompile : scene.timeInfos["syncCompile"]
|
|
24445
24533
|
};
|
|
24446
24534
|
this.reusable = reusable;
|
|
24447
24535
|
this.speed = speed;
|
|
@@ -24455,6 +24543,7 @@ var listOrder = 0;
|
|
|
24455
24543
|
this.url = scene.url;
|
|
24456
24544
|
this.assigned = true;
|
|
24457
24545
|
this.globalTime = 0;
|
|
24546
|
+
this.interactive = true;
|
|
24458
24547
|
this.onPlayerPause = onPlayerPause;
|
|
24459
24548
|
this.onMessageItem = onMessageItem;
|
|
24460
24549
|
this.onEnd = onEnd;
|
|
@@ -24884,7 +24973,7 @@ var listOrder = 0;
|
|
|
24884
24973
|
* @param options - 最大求交数和求交时的回调
|
|
24885
24974
|
*/ _proto.hitTest = function hitTest(x, y, force, options) {
|
|
24886
24975
|
var _this_rootItem_getComponent;
|
|
24887
|
-
if (this.isDestroyed) {
|
|
24976
|
+
if (this.isDestroyed || !this.interactive) {
|
|
24888
24977
|
return [];
|
|
24889
24978
|
}
|
|
24890
24979
|
var regions = [];
|
|
@@ -25205,6 +25294,15 @@ var listOrder = 0;
|
|
|
25205
25294
|
*/ function get() {
|
|
25206
25295
|
return this.destroyed;
|
|
25207
25296
|
}
|
|
25297
|
+
},
|
|
25298
|
+
{
|
|
25299
|
+
key: "editorScaleRatio",
|
|
25300
|
+
get: function get() {
|
|
25301
|
+
return this.camera.fovScaleRatio;
|
|
25302
|
+
},
|
|
25303
|
+
set: function set(value) {
|
|
25304
|
+
this.camera.fovScaleRatio = value;
|
|
25305
|
+
}
|
|
25208
25306
|
}
|
|
25209
25307
|
]);
|
|
25210
25308
|
return Composition;
|
|
@@ -25602,7 +25700,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
25602
25700
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
25603
25701
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
25604
25702
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
25605
|
-
var version = "2.0.0-alpha.
|
|
25703
|
+
var version = "2.0.0-alpha.21";
|
|
25606
25704
|
logger.info("Core version: " + version + ".");
|
|
25607
25705
|
|
|
25608
25706
|
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 };
|