@galacean/effects-threejs 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/index.js +144 -46
- 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 +144 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.21
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -4939,10 +4939,25 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
4939
4939
|
var getTouchEventValue = function(event, x, y, dx, dy) {
|
|
4940
4940
|
if (dx === void 0) dx = 0;
|
|
4941
4941
|
if (dy === void 0) dy = 0;
|
|
4942
|
-
var _this_target = _this.target, width = _this_target.width, height = _this_target.height;
|
|
4943
|
-
var ts = performance.now();
|
|
4944
4942
|
var vx = 0;
|
|
4945
4943
|
var vy = 0;
|
|
4944
|
+
var ts = performance.now();
|
|
4945
|
+
if (!_this.target) {
|
|
4946
|
+
logger.error("Trigger TouchEvent after EventSystem is disposed.");
|
|
4947
|
+
return {
|
|
4948
|
+
x: x,
|
|
4949
|
+
y: y,
|
|
4950
|
+
vx: 0,
|
|
4951
|
+
vy: vy,
|
|
4952
|
+
dx: dx,
|
|
4953
|
+
dy: dy,
|
|
4954
|
+
ts: ts,
|
|
4955
|
+
width: 0,
|
|
4956
|
+
height: 0,
|
|
4957
|
+
origin: event
|
|
4958
|
+
};
|
|
4959
|
+
}
|
|
4960
|
+
var _this_target = _this.target, width = _this_target.width, height = _this_target.height;
|
|
4946
4961
|
if (lastTouch) {
|
|
4947
4962
|
var dt = ts - lastTouch.ts;
|
|
4948
4963
|
vx = (dx - lastTouch.dx) / dt || 0;
|
|
@@ -13067,6 +13082,16 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13067
13082
|
function InteractComponent() {
|
|
13068
13083
|
var _this;
|
|
13069
13084
|
_this = RendererComponent.apply(this, arguments) || this;
|
|
13085
|
+
/**
|
|
13086
|
+
* 拖拽的惯性衰减系数,范围[0, 1], 越大惯性越强
|
|
13087
|
+
*/ _this.downgrade = 0.95;
|
|
13088
|
+
/**
|
|
13089
|
+
* 拖拽的距离映射系数,越大越容易拖动
|
|
13090
|
+
*/ _this.dragRatio = [
|
|
13091
|
+
1,
|
|
13092
|
+
1
|
|
13093
|
+
];
|
|
13094
|
+
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
13070
13095
|
_this.getHitTestParams = function(force) {
|
|
13071
13096
|
if (!_this.clickable) {
|
|
13072
13097
|
return;
|
|
@@ -13118,9 +13143,8 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13118
13143
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
13119
13144
|
return;
|
|
13120
13145
|
}
|
|
13121
|
-
|
|
13122
|
-
this.bouncingArg.
|
|
13123
|
-
this.bouncingArg.vy *= downgrade;
|
|
13146
|
+
this.bouncingArg.vx *= this.downgrade;
|
|
13147
|
+
this.bouncingArg.vy *= this.downgrade;
|
|
13124
13148
|
this.bouncingArg.dy += this.bouncingArg.vy;
|
|
13125
13149
|
this.bouncingArg.dx += this.bouncingArg.vx;
|
|
13126
13150
|
if (shouldIgnoreBouncing(this.bouncingArg)) {
|
|
@@ -13148,7 +13172,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13148
13172
|
// OVERRIDE
|
|
13149
13173
|
};
|
|
13150
13174
|
_proto.handleDragMove = function handleDragMove(evt, event) {
|
|
13151
|
-
if (!(evt
|
|
13175
|
+
if (!(evt == null ? void 0 : evt.cameraParam) || !this.canInteract() || !this.item.composition) {
|
|
13152
13176
|
return;
|
|
13153
13177
|
}
|
|
13154
13178
|
var options = this.item.props.content.options;
|
|
@@ -13159,8 +13183,8 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13159
13183
|
var sp = Math.tan(fov * Math.PI / 180 / 2) * Math.abs(depth);
|
|
13160
13184
|
var height = dy * sp;
|
|
13161
13185
|
var width = dx * sp;
|
|
13162
|
-
var nx = position[0] - width;
|
|
13163
|
-
var ny = position[1] - height;
|
|
13186
|
+
var nx = position[0] - this.dragRatio[0] * width;
|
|
13187
|
+
var ny = position[1] - this.dragRatio[1] * height;
|
|
13164
13188
|
if (options.dxRange) {
|
|
13165
13189
|
var _options_dxRange = options.dxRange, min = _options_dxRange[0], max = _options_dxRange[1];
|
|
13166
13190
|
nx = clamp$1(nx, min, max);
|
|
@@ -13188,6 +13212,9 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13188
13212
|
var handlerMap = {
|
|
13189
13213
|
touchstart: function(event) {
|
|
13190
13214
|
var _this_item_composition;
|
|
13215
|
+
if (!_this.canInteract()) {
|
|
13216
|
+
return;
|
|
13217
|
+
}
|
|
13191
13218
|
_this.dragEvent = null;
|
|
13192
13219
|
_this.bouncingArg = null;
|
|
13193
13220
|
var camera = (_this_item_composition = _this.item.composition) == null ? void 0 : _this_item_composition.camera;
|
|
@@ -13209,6 +13236,9 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13209
13236
|
_this.bouncingArg = event;
|
|
13210
13237
|
},
|
|
13211
13238
|
touchend: function(event) {
|
|
13239
|
+
if (!_this.canInteract()) {
|
|
13240
|
+
return;
|
|
13241
|
+
}
|
|
13212
13242
|
var bouncingArg = _this.bouncingArg;
|
|
13213
13243
|
if (!shouldIgnoreBouncing(bouncingArg, 3) && bouncingArg) {
|
|
13214
13244
|
var speed = 5;
|
|
@@ -13251,6 +13281,25 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13251
13281
|
RendererComponent.prototype.fromData.call(this, data);
|
|
13252
13282
|
this.interactData = data;
|
|
13253
13283
|
};
|
|
13284
|
+
_proto.canInteract = function canInteract() {
|
|
13285
|
+
var _this_item_composition;
|
|
13286
|
+
return Boolean((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.interactive) && this._interactive;
|
|
13287
|
+
};
|
|
13288
|
+
_create_class(InteractComponent, [
|
|
13289
|
+
{
|
|
13290
|
+
key: "interactive",
|
|
13291
|
+
get: function get() {
|
|
13292
|
+
return this._interactive;
|
|
13293
|
+
},
|
|
13294
|
+
set: function set(enable) {
|
|
13295
|
+
this._interactive = enable;
|
|
13296
|
+
if (!enable) {
|
|
13297
|
+
// 立刻停止惯性滑动
|
|
13298
|
+
this.bouncingArg = null;
|
|
13299
|
+
}
|
|
13300
|
+
}
|
|
13301
|
+
}
|
|
13302
|
+
]);
|
|
13254
13303
|
return InteractComponent;
|
|
13255
13304
|
}(RendererComponent);
|
|
13256
13305
|
exports.InteractComponent = __decorate([
|
|
@@ -16767,17 +16816,12 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16767
16816
|
_proto.onEnd = function onEnd(particle) {};
|
|
16768
16817
|
_proto.onIterate = function onIterate(particle) {};
|
|
16769
16818
|
_proto.initPoint = function initPoint(data) {
|
|
16770
|
-
var _this_item_composition, _this_item_composition1;
|
|
16771
16819
|
var options = this.options;
|
|
16772
16820
|
var lifetime = this.lifetime;
|
|
16773
16821
|
var shape = this.shape;
|
|
16774
16822
|
var speed = options.startSpeed.getValue(lifetime);
|
|
16775
16823
|
var matrix4 = options.particleFollowParent ? this.transform.getMatrix() : this.transform.getWorldMatrix();
|
|
16776
16824
|
var pointPosition = data.position;
|
|
16777
|
-
if (((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderer.env) === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
16778
|
-
pointPosition.x /= this.item.composition.editorScaleRatio;
|
|
16779
|
-
pointPosition.y /= this.item.composition.editorScaleRatio;
|
|
16780
|
-
}
|
|
16781
16825
|
// 粒子的位置受发射器的位置影响,自身的旋转和缩放不受影响
|
|
16782
16826
|
var position = matrix4.transformPoint(pointPosition, new Vector3());
|
|
16783
16827
|
var transform = new Transform({
|
|
@@ -16858,10 +16902,6 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16858
16902
|
size.x *= tempScale.x;
|
|
16859
16903
|
size.y *= tempScale.y;
|
|
16860
16904
|
}
|
|
16861
|
-
if (((_this_item_composition1 = this.item.composition) == null ? void 0 : _this_item_composition1.renderer.env) === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
16862
|
-
size.x /= this.item.composition.editorScaleRatio;
|
|
16863
|
-
size.y /= this.item.composition.editorScaleRatio;
|
|
16864
|
-
}
|
|
16865
16905
|
transform.setScale(size.x, size.y, 1);
|
|
16866
16906
|
return {
|
|
16867
16907
|
size: size,
|
|
@@ -19417,21 +19457,33 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
19417
19457
|
this.lineHeight = lineHeight;
|
|
19418
19458
|
}
|
|
19419
19459
|
var _proto = TextLayout.prototype;
|
|
19420
|
-
|
|
19421
|
-
|
|
19422
|
-
|
|
19460
|
+
/**
|
|
19461
|
+
* 获取初始的行高偏移值
|
|
19462
|
+
* @param style - 字体基础数据
|
|
19463
|
+
* @param lineCount - 渲染行数
|
|
19464
|
+
* @param lineHeight - 渲染时的字体行高
|
|
19465
|
+
* @param fontSize - 渲染时的字体大小
|
|
19466
|
+
* @returns - 行高偏移值
|
|
19467
|
+
*/ _proto.getOffsetY = function getOffsetY(style, lineCount, lineHeight, fontSize) {
|
|
19468
|
+
var outlineWidth = style.outlineWidth, fontScale = style.fontScale;
|
|
19469
|
+
// /3 计算Y轴偏移量,以匹配编辑器行为
|
|
19470
|
+
var offsetY = (lineHeight - fontSize) / 3;
|
|
19471
|
+
// 计算基础偏移量
|
|
19472
|
+
var baseOffset = fontSize + outlineWidth * fontScale;
|
|
19473
|
+
var commonCalculation = lineHeight * (lineCount - 1);
|
|
19474
|
+
var offsetResult = 0;
|
|
19423
19475
|
switch(this.textBaseline){
|
|
19424
19476
|
case TextBaseline.top:
|
|
19425
|
-
|
|
19477
|
+
offsetResult = baseOffset + offsetY;
|
|
19426
19478
|
break;
|
|
19427
19479
|
case TextBaseline.middle:
|
|
19428
|
-
|
|
19480
|
+
offsetResult = (this.height * fontScale - commonCalculation + baseOffset) / 2;
|
|
19429
19481
|
break;
|
|
19430
19482
|
case TextBaseline.bottom:
|
|
19431
|
-
|
|
19483
|
+
offsetResult = this.height * fontScale - commonCalculation - offsetY;
|
|
19432
19484
|
break;
|
|
19433
19485
|
}
|
|
19434
|
-
return
|
|
19486
|
+
return offsetResult;
|
|
19435
19487
|
};
|
|
19436
19488
|
_proto.getOffsetX = function getOffsetX(style, maxWidth) {
|
|
19437
19489
|
var offsetX = 0;
|
|
@@ -19589,6 +19641,9 @@ exports.TextComponent = /*#__PURE__*/ function(SpriteComponent) {
|
|
|
19589
19641
|
var _this;
|
|
19590
19642
|
_this = SpriteComponent.call(this, engine, props) || this;
|
|
19591
19643
|
_this.isDirty = true;
|
|
19644
|
+
/**
|
|
19645
|
+
* 文本行数
|
|
19646
|
+
*/ _this.lineCount = 0;
|
|
19592
19647
|
_this.canvas = canvasPool.getCanvas();
|
|
19593
19648
|
canvasPool.saveCanvas(_this.canvas);
|
|
19594
19649
|
_this.context = _this.canvas.getContext("2d", {
|
|
@@ -19632,6 +19687,31 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19632
19687
|
this.textStyle = new TextStyle(options);
|
|
19633
19688
|
this.textLayout = new TextLayout(options);
|
|
19634
19689
|
this.text = options.text;
|
|
19690
|
+
this.lineCount = this.getLineCount(options.text, true);
|
|
19691
|
+
};
|
|
19692
|
+
_proto.getLineCount = function getLineCount(text, init) {
|
|
19693
|
+
var context = this.context;
|
|
19694
|
+
var letterSpace = this.textLayout.letterSpace;
|
|
19695
|
+
var fontScale = init ? this.textStyle.fontSize / 10 : 1 / this.textStyle.fontScale;
|
|
19696
|
+
var width = this.textLayout.width + this.textStyle.fontOffset;
|
|
19697
|
+
var lineCount = 1;
|
|
19698
|
+
var x = 0;
|
|
19699
|
+
for(var i = 0; i < text.length; i++){
|
|
19700
|
+
var _context_measureText;
|
|
19701
|
+
var str = text[i];
|
|
19702
|
+
var _context_measureText_width;
|
|
19703
|
+
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;
|
|
19704
|
+
// 和浏览器行为保持一致
|
|
19705
|
+
x += letterSpace;
|
|
19706
|
+
if (x + textMetrics > width && i > 0 || str === "\n") {
|
|
19707
|
+
lineCount++;
|
|
19708
|
+
x = 0;
|
|
19709
|
+
}
|
|
19710
|
+
if (str !== "\n") {
|
|
19711
|
+
x += textMetrics;
|
|
19712
|
+
}
|
|
19713
|
+
}
|
|
19714
|
+
return lineCount;
|
|
19635
19715
|
};
|
|
19636
19716
|
/**
|
|
19637
19717
|
* 设置字号大小
|
|
@@ -19678,6 +19758,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19678
19758
|
return;
|
|
19679
19759
|
}
|
|
19680
19760
|
this.text = value;
|
|
19761
|
+
this.lineCount = this.getLineCount(value, false);
|
|
19681
19762
|
this.isDirty = true;
|
|
19682
19763
|
};
|
|
19683
19764
|
/**
|
|
@@ -19840,10 +19921,8 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19840
19921
|
// 文本颜色
|
|
19841
19922
|
context.fillStyle = "rgba(" + style.textColor[0] + ", " + style.textColor[1] + ", " + style.textColor[2] + ", " + style.textColor[3] + ")";
|
|
19842
19923
|
var charsInfo = [];
|
|
19843
|
-
// /3 是为了和编辑器行为保持一致
|
|
19844
|
-
var offsetY = (lineHeight - fontSize) / 3;
|
|
19845
19924
|
var x = 0;
|
|
19846
|
-
var y = layout.getOffsetY(style
|
|
19925
|
+
var y = layout.getOffsetY(style, this.lineCount, lineHeight, fontSize);
|
|
19847
19926
|
var charsArray = [];
|
|
19848
19927
|
var charOffsetX = [];
|
|
19849
19928
|
for(var i = 0; i < this.char.length; i++){
|
|
@@ -22406,10 +22485,6 @@ function getStandardCameraContent(model) {
|
|
|
22406
22485
|
]
|
|
22407
22486
|
});
|
|
22408
22487
|
}
|
|
22409
|
-
// gizmo 的 target id 转换为新的 item guid
|
|
22410
|
-
if (item.content.options.target) {
|
|
22411
|
-
item.content.options.target = itemOldIdToGuidMap[item.content.options.target];
|
|
22412
|
-
}
|
|
22413
22488
|
// 修正老 json 的 item.pluginName
|
|
22414
22489
|
if (item.pn !== undefined) {
|
|
22415
22490
|
var pn = item.pn;
|
|
@@ -22427,6 +22502,10 @@ function getStandardCameraContent(model) {
|
|
|
22427
22502
|
//@ts-expect-error
|
|
22428
22503
|
item.type = "orientation-transformer";
|
|
22429
22504
|
}
|
|
22505
|
+
// gizmo 的 target id 转换为新的 item guid
|
|
22506
|
+
if (item.content.options.target && item.pluginName === "editor-gizmo") {
|
|
22507
|
+
item.content.options.target = itemOldIdToGuidMap[item.content.options.target];
|
|
22508
|
+
}
|
|
22430
22509
|
// Spine 元素转为 guid 索引
|
|
22431
22510
|
if (item.type === ItemType.spine && json.spines && json.spines.length !== 0) {
|
|
22432
22511
|
convertSpineData(json.spines[item.content.options.spine], item.content, result);
|
|
@@ -23233,26 +23312,27 @@ var seed$1 = 1;
|
|
|
23233
23312
|
*/ _proto.loadScene = function loadScene(url, renderer, options) {
|
|
23234
23313
|
var _this = this;
|
|
23235
23314
|
return _async_to_generator(function() {
|
|
23236
|
-
var _gpuInstance_detail, rawJSON, assetUrl, startTime,
|
|
23315
|
+
var _gpuInstance_detail, rawJSON, assetUrl, startTime, timeInfoMessages, gpuInstance, _gpuInstance_detail_asyncShaderCompile, asyncShaderCompile, _gpuInstance_detail_compressedTexture, compressedTexture, timeInfos, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
|
|
23237
23316
|
return __generator(this, function(_state) {
|
|
23238
23317
|
assetUrl = isString(url) ? url : _this.id;
|
|
23239
23318
|
startTime = performance.now();
|
|
23240
|
-
|
|
23319
|
+
timeInfoMessages = [];
|
|
23241
23320
|
gpuInstance = renderer == null ? void 0 : renderer.engine.gpuCapability;
|
|
23242
23321
|
asyncShaderCompile = (_gpuInstance_detail_asyncShaderCompile = gpuInstance == null ? void 0 : (_gpuInstance_detail = gpuInstance.detail) == null ? void 0 : _gpuInstance_detail.asyncShaderCompile) != null ? _gpuInstance_detail_asyncShaderCompile : false;
|
|
23243
23322
|
compressedTexture = (_gpuInstance_detail_compressedTexture = gpuInstance == null ? void 0 : gpuInstance.detail.compressedTexture) != null ? _gpuInstance_detail_compressedTexture : exports.COMPRESSED_TEXTURE.NONE;
|
|
23323
|
+
timeInfos = {};
|
|
23244
23324
|
cancelLoading = false;
|
|
23245
23325
|
waitPromise = new Promise(function(resolve, reject) {
|
|
23246
23326
|
loadTimer = window.setTimeout(function() {
|
|
23247
23327
|
cancelLoading = true;
|
|
23248
23328
|
_this.removeTimer(loadTimer);
|
|
23249
23329
|
var totalTime = performance.now() - startTime;
|
|
23250
|
-
reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " +
|
|
23330
|
+
reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + "."));
|
|
23251
23331
|
}, _this.timeout * 1000);
|
|
23252
23332
|
_this.timers.push(loadTimer);
|
|
23253
23333
|
});
|
|
23254
23334
|
hookTimeInfo = /*#__PURE__*/ _async_to_generator(function(label, func) {
|
|
23255
|
-
var st, result, e;
|
|
23335
|
+
var st, result, time, e;
|
|
23256
23336
|
return __generator(this, function(_state) {
|
|
23257
23337
|
switch(_state.label){
|
|
23258
23338
|
case 0:
|
|
@@ -23275,7 +23355,9 @@ var seed$1 = 1;
|
|
|
23275
23355
|
];
|
|
23276
23356
|
case 2:
|
|
23277
23357
|
result = _state.sent();
|
|
23278
|
-
|
|
23358
|
+
time = performance.now() - st;
|
|
23359
|
+
timeInfoMessages.push("[" + label + ": " + time.toFixed(2) + "]");
|
|
23360
|
+
timeInfos[label] = time;
|
|
23279
23361
|
return [
|
|
23280
23362
|
2,
|
|
23281
23363
|
result
|
|
@@ -23374,7 +23456,7 @@ var seed$1 = 1;
|
|
|
23374
23456
|
hookTimeInfo("processImages", function() {
|
|
23375
23457
|
return _this.processImages(images1, compressedTexture);
|
|
23376
23458
|
}),
|
|
23377
|
-
hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + "
|
|
23459
|
+
hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + "Compile", function() {
|
|
23378
23460
|
return _this.precompile(compositions, pluginSystem, renderer, options);
|
|
23379
23461
|
})
|
|
23380
23462
|
])
|
|
@@ -23407,6 +23489,7 @@ var seed$1 = 1;
|
|
|
23407
23489
|
loadedTextures = _state.sent();
|
|
23408
23490
|
_this.updateSceneData(jsonScene.items);
|
|
23409
23491
|
scene = {
|
|
23492
|
+
timeInfos: timeInfos,
|
|
23410
23493
|
url: url,
|
|
23411
23494
|
renderLevel: _this.options.renderLevel,
|
|
23412
23495
|
storage: {},
|
|
@@ -23429,11 +23512,13 @@ var seed$1 = 1;
|
|
|
23429
23512
|
_state.label = 12;
|
|
23430
23513
|
case 12:
|
|
23431
23514
|
totalTime = performance.now() - startTime;
|
|
23432
|
-
logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " +
|
|
23515
|
+
logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + ".");
|
|
23433
23516
|
window.clearTimeout(loadTimer);
|
|
23434
23517
|
_this.removeTimer(loadTimer);
|
|
23435
23518
|
scene.totalTime = totalTime;
|
|
23436
23519
|
scene.startTime = startTime;
|
|
23520
|
+
// 各部分分段时长
|
|
23521
|
+
scene.timeInfos = timeInfos;
|
|
23437
23522
|
return [
|
|
23438
23523
|
2,
|
|
23439
23524
|
scene
|
|
@@ -23972,6 +24057,9 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
23972
24057
|
function Camera(name, options) {
|
|
23973
24058
|
if (options === void 0) options = {};
|
|
23974
24059
|
this.name = name;
|
|
24060
|
+
this./**
|
|
24061
|
+
* 编辑器用于缩放画布
|
|
24062
|
+
*/ fovScaleRatio = 1.0;
|
|
23975
24063
|
this.viewMatrix = Matrix4.fromIdentity();
|
|
23976
24064
|
this.projectionMatrix = Matrix4.fromIdentity();
|
|
23977
24065
|
this.viewProjectionMatrix = Matrix4.fromIdentity();
|
|
@@ -24119,7 +24207,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24119
24207
|
*/ _proto.updateMatrix = function updateMatrix() {
|
|
24120
24208
|
if (this.dirty) {
|
|
24121
24209
|
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;
|
|
24122
|
-
this.projectionMatrix.perspective(fov * DEG2RAD, aspect, near, far, clipMode === CameraClipMode.portrait);
|
|
24210
|
+
this.projectionMatrix.perspective(fov * DEG2RAD * this.fovScaleRatio, aspect, near, far, clipMode === CameraClipMode.portrait);
|
|
24123
24211
|
this.inverseViewMatrix.compose(position, this.getQuat(), tmpScale);
|
|
24124
24212
|
this.viewMatrix.copyFrom(this.inverseViewMatrix).invert();
|
|
24125
24213
|
this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix, this.viewMatrix);
|
|
@@ -24426,7 +24514,6 @@ var listOrder = 0;
|
|
|
24426
24514
|
/**
|
|
24427
24515
|
* 预合成的合成属性,在 content 中会被其元素属性覆盖
|
|
24428
24516
|
*/ this.refCompositionProps = new Map();
|
|
24429
|
-
this.editorScaleRatio = 1.0;
|
|
24430
24517
|
// TODO: 待优化
|
|
24431
24518
|
this.assigned = false;
|
|
24432
24519
|
/**
|
|
@@ -24463,11 +24550,12 @@ var listOrder = 0;
|
|
|
24463
24550
|
this.renderer = renderer;
|
|
24464
24551
|
this.texInfo = imageUsage != null ? imageUsage : {};
|
|
24465
24552
|
this.event = event;
|
|
24466
|
-
var _scene_startTime;
|
|
24553
|
+
var _scene_startTime, _scene_timeInfos_asyncCompile;
|
|
24467
24554
|
this.statistic = {
|
|
24468
24555
|
loadTime: totalTime != null ? totalTime : 0,
|
|
24469
24556
|
loadStart: (_scene_startTime = scene.startTime) != null ? _scene_startTime : 0,
|
|
24470
|
-
firstFrameTime: 0
|
|
24557
|
+
firstFrameTime: 0,
|
|
24558
|
+
precompileTime: (_scene_timeInfos_asyncCompile = scene.timeInfos["asyncCompile"]) != null ? _scene_timeInfos_asyncCompile : scene.timeInfos["syncCompile"]
|
|
24471
24559
|
};
|
|
24472
24560
|
this.reusable = reusable;
|
|
24473
24561
|
this.speed = speed;
|
|
@@ -24481,6 +24569,7 @@ var listOrder = 0;
|
|
|
24481
24569
|
this.url = scene.url;
|
|
24482
24570
|
this.assigned = true;
|
|
24483
24571
|
this.globalTime = 0;
|
|
24572
|
+
this.interactive = true;
|
|
24484
24573
|
this.onPlayerPause = onPlayerPause;
|
|
24485
24574
|
this.onMessageItem = onMessageItem;
|
|
24486
24575
|
this.onEnd = onEnd;
|
|
@@ -24910,7 +24999,7 @@ var listOrder = 0;
|
|
|
24910
24999
|
* @param options - 最大求交数和求交时的回调
|
|
24911
25000
|
*/ _proto.hitTest = function hitTest(x, y, force, options) {
|
|
24912
25001
|
var _this_rootItem_getComponent;
|
|
24913
|
-
if (this.isDestroyed) {
|
|
25002
|
+
if (this.isDestroyed || !this.interactive) {
|
|
24914
25003
|
return [];
|
|
24915
25004
|
}
|
|
24916
25005
|
var regions = [];
|
|
@@ -25231,6 +25320,15 @@ var listOrder = 0;
|
|
|
25231
25320
|
*/ function get() {
|
|
25232
25321
|
return this.destroyed;
|
|
25233
25322
|
}
|
|
25323
|
+
},
|
|
25324
|
+
{
|
|
25325
|
+
key: "editorScaleRatio",
|
|
25326
|
+
get: function get() {
|
|
25327
|
+
return this.camera.fovScaleRatio;
|
|
25328
|
+
},
|
|
25329
|
+
set: function set(value) {
|
|
25330
|
+
this.camera.fovScaleRatio = value;
|
|
25331
|
+
}
|
|
25234
25332
|
}
|
|
25235
25333
|
]);
|
|
25236
25334
|
return Composition;
|
|
@@ -25628,7 +25726,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
25628
25726
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
25629
25727
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
25630
25728
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
25631
|
-
var version$1 = "2.0.0-alpha.
|
|
25729
|
+
var version$1 = "2.0.0-alpha.21";
|
|
25632
25730
|
logger.info("Core version: " + version$1 + ".");
|
|
25633
25731
|
|
|
25634
25732
|
var _obj;
|
|
@@ -27216,7 +27314,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
27216
27314
|
*/ Mesh.create = function(engine, props) {
|
|
27217
27315
|
return new ThreeMesh(engine, props);
|
|
27218
27316
|
};
|
|
27219
|
-
var version = "2.0.0-alpha.
|
|
27317
|
+
var version = "2.0.0-alpha.21";
|
|
27220
27318
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
27221
27319
|
|
|
27222
27320
|
exports.AbstractPlugin = AbstractPlugin;
|