@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.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.21
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -4915,10 +4915,25 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
4915
4915
|
var getTouchEventValue = function(event, x, y, dx, dy) {
|
|
4916
4916
|
if (dx === void 0) dx = 0;
|
|
4917
4917
|
if (dy === void 0) dy = 0;
|
|
4918
|
-
var _this_target = _this.target, width = _this_target.width, height = _this_target.height;
|
|
4919
|
-
var ts = performance.now();
|
|
4920
4918
|
var vx = 0;
|
|
4921
4919
|
var vy = 0;
|
|
4920
|
+
var ts = performance.now();
|
|
4921
|
+
if (!_this.target) {
|
|
4922
|
+
logger.error("Trigger TouchEvent after EventSystem is disposed.");
|
|
4923
|
+
return {
|
|
4924
|
+
x: x,
|
|
4925
|
+
y: y,
|
|
4926
|
+
vx: 0,
|
|
4927
|
+
vy: vy,
|
|
4928
|
+
dx: dx,
|
|
4929
|
+
dy: dy,
|
|
4930
|
+
ts: ts,
|
|
4931
|
+
width: 0,
|
|
4932
|
+
height: 0,
|
|
4933
|
+
origin: event
|
|
4934
|
+
};
|
|
4935
|
+
}
|
|
4936
|
+
var _this_target = _this.target, width = _this_target.width, height = _this_target.height;
|
|
4922
4937
|
if (lastTouch) {
|
|
4923
4938
|
var dt = ts - lastTouch.ts;
|
|
4924
4939
|
vx = (dx - lastTouch.dx) / dt || 0;
|
|
@@ -13043,6 +13058,16 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13043
13058
|
function InteractComponent() {
|
|
13044
13059
|
var _this;
|
|
13045
13060
|
_this = RendererComponent.apply(this, arguments) || this;
|
|
13061
|
+
/**
|
|
13062
|
+
* 拖拽的惯性衰减系数,范围[0, 1], 越大惯性越强
|
|
13063
|
+
*/ _this.downgrade = 0.95;
|
|
13064
|
+
/**
|
|
13065
|
+
* 拖拽的距离映射系数,越大越容易拖动
|
|
13066
|
+
*/ _this.dragRatio = [
|
|
13067
|
+
1,
|
|
13068
|
+
1
|
|
13069
|
+
];
|
|
13070
|
+
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
13046
13071
|
_this.getHitTestParams = function(force) {
|
|
13047
13072
|
if (!_this.clickable) {
|
|
13048
13073
|
return;
|
|
@@ -13094,9 +13119,8 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13094
13119
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
13095
13120
|
return;
|
|
13096
13121
|
}
|
|
13097
|
-
|
|
13098
|
-
this.bouncingArg.
|
|
13099
|
-
this.bouncingArg.vy *= downgrade;
|
|
13122
|
+
this.bouncingArg.vx *= this.downgrade;
|
|
13123
|
+
this.bouncingArg.vy *= this.downgrade;
|
|
13100
13124
|
this.bouncingArg.dy += this.bouncingArg.vy;
|
|
13101
13125
|
this.bouncingArg.dx += this.bouncingArg.vx;
|
|
13102
13126
|
if (shouldIgnoreBouncing(this.bouncingArg)) {
|
|
@@ -13124,7 +13148,7 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13124
13148
|
// OVERRIDE
|
|
13125
13149
|
};
|
|
13126
13150
|
_proto.handleDragMove = function handleDragMove(evt, event) {
|
|
13127
|
-
if (!(evt
|
|
13151
|
+
if (!(evt == null ? void 0 : evt.cameraParam) || !this.canInteract() || !this.item.composition) {
|
|
13128
13152
|
return;
|
|
13129
13153
|
}
|
|
13130
13154
|
var options = this.item.props.content.options;
|
|
@@ -13135,8 +13159,8 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13135
13159
|
var sp = Math.tan(fov * Math.PI / 180 / 2) * Math.abs(depth);
|
|
13136
13160
|
var height = dy * sp;
|
|
13137
13161
|
var width = dx * sp;
|
|
13138
|
-
var nx = position[0] - width;
|
|
13139
|
-
var ny = position[1] - height;
|
|
13162
|
+
var nx = position[0] - this.dragRatio[0] * width;
|
|
13163
|
+
var ny = position[1] - this.dragRatio[1] * height;
|
|
13140
13164
|
if (options.dxRange) {
|
|
13141
13165
|
var _options_dxRange = options.dxRange, min = _options_dxRange[0], max = _options_dxRange[1];
|
|
13142
13166
|
nx = clamp$1(nx, min, max);
|
|
@@ -13164,6 +13188,9 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13164
13188
|
var handlerMap = {
|
|
13165
13189
|
touchstart: function(event) {
|
|
13166
13190
|
var _this_item_composition;
|
|
13191
|
+
if (!_this.canInteract()) {
|
|
13192
|
+
return;
|
|
13193
|
+
}
|
|
13167
13194
|
_this.dragEvent = null;
|
|
13168
13195
|
_this.bouncingArg = null;
|
|
13169
13196
|
var camera = (_this_item_composition = _this.item.composition) == null ? void 0 : _this_item_composition.camera;
|
|
@@ -13185,6 +13212,9 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13185
13212
|
_this.bouncingArg = event;
|
|
13186
13213
|
},
|
|
13187
13214
|
touchend: function(event) {
|
|
13215
|
+
if (!_this.canInteract()) {
|
|
13216
|
+
return;
|
|
13217
|
+
}
|
|
13188
13218
|
var bouncingArg = _this.bouncingArg;
|
|
13189
13219
|
if (!shouldIgnoreBouncing(bouncingArg, 3) && bouncingArg) {
|
|
13190
13220
|
var speed = 5;
|
|
@@ -13227,6 +13257,25 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13227
13257
|
RendererComponent.prototype.fromData.call(this, data);
|
|
13228
13258
|
this.interactData = data;
|
|
13229
13259
|
};
|
|
13260
|
+
_proto.canInteract = function canInteract() {
|
|
13261
|
+
var _this_item_composition;
|
|
13262
|
+
return Boolean((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.interactive) && this._interactive;
|
|
13263
|
+
};
|
|
13264
|
+
_create_class(InteractComponent, [
|
|
13265
|
+
{
|
|
13266
|
+
key: "interactive",
|
|
13267
|
+
get: function get() {
|
|
13268
|
+
return this._interactive;
|
|
13269
|
+
},
|
|
13270
|
+
set: function set(enable) {
|
|
13271
|
+
this._interactive = enable;
|
|
13272
|
+
if (!enable) {
|
|
13273
|
+
// 立刻停止惯性滑动
|
|
13274
|
+
this.bouncingArg = null;
|
|
13275
|
+
}
|
|
13276
|
+
}
|
|
13277
|
+
}
|
|
13278
|
+
]);
|
|
13230
13279
|
return InteractComponent;
|
|
13231
13280
|
}(RendererComponent);
|
|
13232
13281
|
InteractComponent = __decorate([
|
|
@@ -16743,17 +16792,12 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16743
16792
|
_proto.onEnd = function onEnd(particle) {};
|
|
16744
16793
|
_proto.onIterate = function onIterate(particle) {};
|
|
16745
16794
|
_proto.initPoint = function initPoint(data) {
|
|
16746
|
-
var _this_item_composition, _this_item_composition1;
|
|
16747
16795
|
var options = this.options;
|
|
16748
16796
|
var lifetime = this.lifetime;
|
|
16749
16797
|
var shape = this.shape;
|
|
16750
16798
|
var speed = options.startSpeed.getValue(lifetime);
|
|
16751
16799
|
var matrix4 = options.particleFollowParent ? this.transform.getMatrix() : this.transform.getWorldMatrix();
|
|
16752
16800
|
var pointPosition = data.position;
|
|
16753
|
-
if (((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderer.env) === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
16754
|
-
pointPosition.x /= this.item.composition.editorScaleRatio;
|
|
16755
|
-
pointPosition.y /= this.item.composition.editorScaleRatio;
|
|
16756
|
-
}
|
|
16757
16801
|
// 粒子的位置受发射器的位置影响,自身的旋转和缩放不受影响
|
|
16758
16802
|
var position = matrix4.transformPoint(pointPosition, new Vector3());
|
|
16759
16803
|
var transform = new Transform({
|
|
@@ -16834,10 +16878,6 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16834
16878
|
size.x *= tempScale.x;
|
|
16835
16879
|
size.y *= tempScale.y;
|
|
16836
16880
|
}
|
|
16837
|
-
if (((_this_item_composition1 = this.item.composition) == null ? void 0 : _this_item_composition1.renderer.env) === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
16838
|
-
size.x /= this.item.composition.editorScaleRatio;
|
|
16839
|
-
size.y /= this.item.composition.editorScaleRatio;
|
|
16840
|
-
}
|
|
16841
16881
|
transform.setScale(size.x, size.y, 1);
|
|
16842
16882
|
return {
|
|
16843
16883
|
size: size,
|
|
@@ -19393,21 +19433,33 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
19393
19433
|
this.lineHeight = lineHeight;
|
|
19394
19434
|
}
|
|
19395
19435
|
var _proto = TextLayout.prototype;
|
|
19396
|
-
|
|
19397
|
-
|
|
19398
|
-
|
|
19436
|
+
/**
|
|
19437
|
+
* 获取初始的行高偏移值
|
|
19438
|
+
* @param style - 字体基础数据
|
|
19439
|
+
* @param lineCount - 渲染行数
|
|
19440
|
+
* @param lineHeight - 渲染时的字体行高
|
|
19441
|
+
* @param fontSize - 渲染时的字体大小
|
|
19442
|
+
* @returns - 行高偏移值
|
|
19443
|
+
*/ _proto.getOffsetY = function getOffsetY(style, lineCount, lineHeight, fontSize) {
|
|
19444
|
+
var outlineWidth = style.outlineWidth, fontScale = style.fontScale;
|
|
19445
|
+
// /3 计算Y轴偏移量,以匹配编辑器行为
|
|
19446
|
+
var offsetY = (lineHeight - fontSize) / 3;
|
|
19447
|
+
// 计算基础偏移量
|
|
19448
|
+
var baseOffset = fontSize + outlineWidth * fontScale;
|
|
19449
|
+
var commonCalculation = lineHeight * (lineCount - 1);
|
|
19450
|
+
var offsetResult = 0;
|
|
19399
19451
|
switch(this.textBaseline){
|
|
19400
19452
|
case TextBaseline.top:
|
|
19401
|
-
|
|
19453
|
+
offsetResult = baseOffset + offsetY;
|
|
19402
19454
|
break;
|
|
19403
19455
|
case TextBaseline.middle:
|
|
19404
|
-
|
|
19456
|
+
offsetResult = (this.height * fontScale - commonCalculation + baseOffset) / 2;
|
|
19405
19457
|
break;
|
|
19406
19458
|
case TextBaseline.bottom:
|
|
19407
|
-
|
|
19459
|
+
offsetResult = this.height * fontScale - commonCalculation - offsetY;
|
|
19408
19460
|
break;
|
|
19409
19461
|
}
|
|
19410
|
-
return
|
|
19462
|
+
return offsetResult;
|
|
19411
19463
|
};
|
|
19412
19464
|
_proto.getOffsetX = function getOffsetX(style, maxWidth) {
|
|
19413
19465
|
var offsetX = 0;
|
|
@@ -19565,6 +19617,9 @@ var TextComponent = /*#__PURE__*/ function(SpriteComponent) {
|
|
|
19565
19617
|
var _this;
|
|
19566
19618
|
_this = SpriteComponent.call(this, engine, props) || this;
|
|
19567
19619
|
_this.isDirty = true;
|
|
19620
|
+
/**
|
|
19621
|
+
* 文本行数
|
|
19622
|
+
*/ _this.lineCount = 0;
|
|
19568
19623
|
_this.canvas = canvasPool.getCanvas();
|
|
19569
19624
|
canvasPool.saveCanvas(_this.canvas);
|
|
19570
19625
|
_this.context = _this.canvas.getContext("2d", {
|
|
@@ -19608,6 +19663,31 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19608
19663
|
this.textStyle = new TextStyle(options);
|
|
19609
19664
|
this.textLayout = new TextLayout(options);
|
|
19610
19665
|
this.text = options.text;
|
|
19666
|
+
this.lineCount = this.getLineCount(options.text, true);
|
|
19667
|
+
};
|
|
19668
|
+
_proto.getLineCount = function getLineCount(text, init) {
|
|
19669
|
+
var context = this.context;
|
|
19670
|
+
var letterSpace = this.textLayout.letterSpace;
|
|
19671
|
+
var fontScale = init ? this.textStyle.fontSize / 10 : 1 / this.textStyle.fontScale;
|
|
19672
|
+
var width = this.textLayout.width + this.textStyle.fontOffset;
|
|
19673
|
+
var lineCount = 1;
|
|
19674
|
+
var x = 0;
|
|
19675
|
+
for(var i = 0; i < text.length; i++){
|
|
19676
|
+
var _context_measureText;
|
|
19677
|
+
var str = text[i];
|
|
19678
|
+
var _context_measureText_width;
|
|
19679
|
+
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;
|
|
19680
|
+
// 和浏览器行为保持一致
|
|
19681
|
+
x += letterSpace;
|
|
19682
|
+
if (x + textMetrics > width && i > 0 || str === "\n") {
|
|
19683
|
+
lineCount++;
|
|
19684
|
+
x = 0;
|
|
19685
|
+
}
|
|
19686
|
+
if (str !== "\n") {
|
|
19687
|
+
x += textMetrics;
|
|
19688
|
+
}
|
|
19689
|
+
}
|
|
19690
|
+
return lineCount;
|
|
19611
19691
|
};
|
|
19612
19692
|
/**
|
|
19613
19693
|
* 设置字号大小
|
|
@@ -19654,6 +19734,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19654
19734
|
return;
|
|
19655
19735
|
}
|
|
19656
19736
|
this.text = value;
|
|
19737
|
+
this.lineCount = this.getLineCount(value, false);
|
|
19657
19738
|
this.isDirty = true;
|
|
19658
19739
|
};
|
|
19659
19740
|
/**
|
|
@@ -19816,10 +19897,8 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19816
19897
|
// 文本颜色
|
|
19817
19898
|
context.fillStyle = "rgba(" + style.textColor[0] + ", " + style.textColor[1] + ", " + style.textColor[2] + ", " + style.textColor[3] + ")";
|
|
19818
19899
|
var charsInfo = [];
|
|
19819
|
-
// /3 是为了和编辑器行为保持一致
|
|
19820
|
-
var offsetY = (lineHeight - fontSize) / 3;
|
|
19821
19900
|
var x = 0;
|
|
19822
|
-
var y = layout.getOffsetY(style
|
|
19901
|
+
var y = layout.getOffsetY(style, this.lineCount, lineHeight, fontSize);
|
|
19823
19902
|
var charsArray = [];
|
|
19824
19903
|
var charOffsetX = [];
|
|
19825
19904
|
for(var i = 0; i < this.char.length; i++){
|
|
@@ -22382,10 +22461,6 @@ function getStandardCameraContent(model) {
|
|
|
22382
22461
|
]
|
|
22383
22462
|
});
|
|
22384
22463
|
}
|
|
22385
|
-
// gizmo 的 target id 转换为新的 item guid
|
|
22386
|
-
if (item.content.options.target) {
|
|
22387
|
-
item.content.options.target = itemOldIdToGuidMap[item.content.options.target];
|
|
22388
|
-
}
|
|
22389
22464
|
// 修正老 json 的 item.pluginName
|
|
22390
22465
|
if (item.pn !== undefined) {
|
|
22391
22466
|
var pn = item.pn;
|
|
@@ -22403,6 +22478,10 @@ function getStandardCameraContent(model) {
|
|
|
22403
22478
|
//@ts-expect-error
|
|
22404
22479
|
item.type = "orientation-transformer";
|
|
22405
22480
|
}
|
|
22481
|
+
// gizmo 的 target id 转换为新的 item guid
|
|
22482
|
+
if (item.content.options.target && item.pluginName === "editor-gizmo") {
|
|
22483
|
+
item.content.options.target = itemOldIdToGuidMap[item.content.options.target];
|
|
22484
|
+
}
|
|
22406
22485
|
// Spine 元素转为 guid 索引
|
|
22407
22486
|
if (item.type === ItemType.spine && json.spines && json.spines.length !== 0) {
|
|
22408
22487
|
convertSpineData(json.spines[item.content.options.spine], item.content, result);
|
|
@@ -23209,26 +23288,27 @@ var seed$1 = 1;
|
|
|
23209
23288
|
*/ _proto.loadScene = function loadScene(url, renderer, options) {
|
|
23210
23289
|
var _this = this;
|
|
23211
23290
|
return _async_to_generator(function() {
|
|
23212
|
-
var _gpuInstance_detail, rawJSON, assetUrl, startTime,
|
|
23291
|
+
var _gpuInstance_detail, rawJSON, assetUrl, startTime, timeInfoMessages, gpuInstance, _gpuInstance_detail_asyncShaderCompile, asyncShaderCompile, _gpuInstance_detail_compressedTexture, compressedTexture, timeInfos, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
|
|
23213
23292
|
return __generator(this, function(_state) {
|
|
23214
23293
|
assetUrl = isString(url) ? url : _this.id;
|
|
23215
23294
|
startTime = performance.now();
|
|
23216
|
-
|
|
23295
|
+
timeInfoMessages = [];
|
|
23217
23296
|
gpuInstance = renderer == null ? void 0 : renderer.engine.gpuCapability;
|
|
23218
23297
|
asyncShaderCompile = (_gpuInstance_detail_asyncShaderCompile = gpuInstance == null ? void 0 : (_gpuInstance_detail = gpuInstance.detail) == null ? void 0 : _gpuInstance_detail.asyncShaderCompile) != null ? _gpuInstance_detail_asyncShaderCompile : false;
|
|
23219
23298
|
compressedTexture = (_gpuInstance_detail_compressedTexture = gpuInstance == null ? void 0 : gpuInstance.detail.compressedTexture) != null ? _gpuInstance_detail_compressedTexture : COMPRESSED_TEXTURE.NONE;
|
|
23299
|
+
timeInfos = {};
|
|
23220
23300
|
cancelLoading = false;
|
|
23221
23301
|
waitPromise = new Promise(function(resolve, reject) {
|
|
23222
23302
|
loadTimer = window.setTimeout(function() {
|
|
23223
23303
|
cancelLoading = true;
|
|
23224
23304
|
_this.removeTimer(loadTimer);
|
|
23225
23305
|
var totalTime = performance.now() - startTime;
|
|
23226
|
-
reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " +
|
|
23306
|
+
reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + "."));
|
|
23227
23307
|
}, _this.timeout * 1000);
|
|
23228
23308
|
_this.timers.push(loadTimer);
|
|
23229
23309
|
});
|
|
23230
23310
|
hookTimeInfo = /*#__PURE__*/ _async_to_generator(function(label, func) {
|
|
23231
|
-
var st, result, e;
|
|
23311
|
+
var st, result, time, e;
|
|
23232
23312
|
return __generator(this, function(_state) {
|
|
23233
23313
|
switch(_state.label){
|
|
23234
23314
|
case 0:
|
|
@@ -23251,7 +23331,9 @@ var seed$1 = 1;
|
|
|
23251
23331
|
];
|
|
23252
23332
|
case 2:
|
|
23253
23333
|
result = _state.sent();
|
|
23254
|
-
|
|
23334
|
+
time = performance.now() - st;
|
|
23335
|
+
timeInfoMessages.push("[" + label + ": " + time.toFixed(2) + "]");
|
|
23336
|
+
timeInfos[label] = time;
|
|
23255
23337
|
return [
|
|
23256
23338
|
2,
|
|
23257
23339
|
result
|
|
@@ -23350,7 +23432,7 @@ var seed$1 = 1;
|
|
|
23350
23432
|
hookTimeInfo("processImages", function() {
|
|
23351
23433
|
return _this.processImages(images1, compressedTexture);
|
|
23352
23434
|
}),
|
|
23353
|
-
hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + "
|
|
23435
|
+
hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + "Compile", function() {
|
|
23354
23436
|
return _this.precompile(compositions, pluginSystem, renderer, options);
|
|
23355
23437
|
})
|
|
23356
23438
|
])
|
|
@@ -23383,6 +23465,7 @@ var seed$1 = 1;
|
|
|
23383
23465
|
loadedTextures = _state.sent();
|
|
23384
23466
|
_this.updateSceneData(jsonScene.items);
|
|
23385
23467
|
scene = {
|
|
23468
|
+
timeInfos: timeInfos,
|
|
23386
23469
|
url: url,
|
|
23387
23470
|
renderLevel: _this.options.renderLevel,
|
|
23388
23471
|
storage: {},
|
|
@@ -23405,11 +23488,13 @@ var seed$1 = 1;
|
|
|
23405
23488
|
_state.label = 12;
|
|
23406
23489
|
case 12:
|
|
23407
23490
|
totalTime = performance.now() - startTime;
|
|
23408
|
-
logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " +
|
|
23491
|
+
logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + ".");
|
|
23409
23492
|
window.clearTimeout(loadTimer);
|
|
23410
23493
|
_this.removeTimer(loadTimer);
|
|
23411
23494
|
scene.totalTime = totalTime;
|
|
23412
23495
|
scene.startTime = startTime;
|
|
23496
|
+
// 各部分分段时长
|
|
23497
|
+
scene.timeInfos = timeInfos;
|
|
23413
23498
|
return [
|
|
23414
23499
|
2,
|
|
23415
23500
|
scene
|
|
@@ -23948,6 +24033,9 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
23948
24033
|
function Camera(name, options) {
|
|
23949
24034
|
if (options === void 0) options = {};
|
|
23950
24035
|
this.name = name;
|
|
24036
|
+
this./**
|
|
24037
|
+
* 编辑器用于缩放画布
|
|
24038
|
+
*/ fovScaleRatio = 1.0;
|
|
23951
24039
|
this.viewMatrix = Matrix4.fromIdentity();
|
|
23952
24040
|
this.projectionMatrix = Matrix4.fromIdentity();
|
|
23953
24041
|
this.viewProjectionMatrix = Matrix4.fromIdentity();
|
|
@@ -24095,7 +24183,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24095
24183
|
*/ _proto.updateMatrix = function updateMatrix() {
|
|
24096
24184
|
if (this.dirty) {
|
|
24097
24185
|
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;
|
|
24098
|
-
this.projectionMatrix.perspective(fov * DEG2RAD, aspect, near, far, clipMode === CameraClipMode.portrait);
|
|
24186
|
+
this.projectionMatrix.perspective(fov * DEG2RAD * this.fovScaleRatio, aspect, near, far, clipMode === CameraClipMode.portrait);
|
|
24099
24187
|
this.inverseViewMatrix.compose(position, this.getQuat(), tmpScale);
|
|
24100
24188
|
this.viewMatrix.copyFrom(this.inverseViewMatrix).invert();
|
|
24101
24189
|
this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix, this.viewMatrix);
|
|
@@ -24402,7 +24490,6 @@ var listOrder = 0;
|
|
|
24402
24490
|
/**
|
|
24403
24491
|
* 预合成的合成属性,在 content 中会被其元素属性覆盖
|
|
24404
24492
|
*/ this.refCompositionProps = new Map();
|
|
24405
|
-
this.editorScaleRatio = 1.0;
|
|
24406
24493
|
// TODO: 待优化
|
|
24407
24494
|
this.assigned = false;
|
|
24408
24495
|
/**
|
|
@@ -24439,11 +24526,12 @@ var listOrder = 0;
|
|
|
24439
24526
|
this.renderer = renderer;
|
|
24440
24527
|
this.texInfo = imageUsage != null ? imageUsage : {};
|
|
24441
24528
|
this.event = event;
|
|
24442
|
-
var _scene_startTime;
|
|
24529
|
+
var _scene_startTime, _scene_timeInfos_asyncCompile;
|
|
24443
24530
|
this.statistic = {
|
|
24444
24531
|
loadTime: totalTime != null ? totalTime : 0,
|
|
24445
24532
|
loadStart: (_scene_startTime = scene.startTime) != null ? _scene_startTime : 0,
|
|
24446
|
-
firstFrameTime: 0
|
|
24533
|
+
firstFrameTime: 0,
|
|
24534
|
+
precompileTime: (_scene_timeInfos_asyncCompile = scene.timeInfos["asyncCompile"]) != null ? _scene_timeInfos_asyncCompile : scene.timeInfos["syncCompile"]
|
|
24447
24535
|
};
|
|
24448
24536
|
this.reusable = reusable;
|
|
24449
24537
|
this.speed = speed;
|
|
@@ -24457,6 +24545,7 @@ var listOrder = 0;
|
|
|
24457
24545
|
this.url = scene.url;
|
|
24458
24546
|
this.assigned = true;
|
|
24459
24547
|
this.globalTime = 0;
|
|
24548
|
+
this.interactive = true;
|
|
24460
24549
|
this.onPlayerPause = onPlayerPause;
|
|
24461
24550
|
this.onMessageItem = onMessageItem;
|
|
24462
24551
|
this.onEnd = onEnd;
|
|
@@ -24886,7 +24975,7 @@ var listOrder = 0;
|
|
|
24886
24975
|
* @param options - 最大求交数和求交时的回调
|
|
24887
24976
|
*/ _proto.hitTest = function hitTest(x, y, force, options) {
|
|
24888
24977
|
var _this_rootItem_getComponent;
|
|
24889
|
-
if (this.isDestroyed) {
|
|
24978
|
+
if (this.isDestroyed || !this.interactive) {
|
|
24890
24979
|
return [];
|
|
24891
24980
|
}
|
|
24892
24981
|
var regions = [];
|
|
@@ -25207,6 +25296,15 @@ var listOrder = 0;
|
|
|
25207
25296
|
*/ function get() {
|
|
25208
25297
|
return this.destroyed;
|
|
25209
25298
|
}
|
|
25299
|
+
},
|
|
25300
|
+
{
|
|
25301
|
+
key: "editorScaleRatio",
|
|
25302
|
+
get: function get() {
|
|
25303
|
+
return this.camera.fovScaleRatio;
|
|
25304
|
+
},
|
|
25305
|
+
set: function set(value) {
|
|
25306
|
+
this.camera.fovScaleRatio = value;
|
|
25307
|
+
}
|
|
25210
25308
|
}
|
|
25211
25309
|
]);
|
|
25212
25310
|
return Composition;
|
|
@@ -25604,7 +25702,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
25604
25702
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
25605
25703
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
25606
25704
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
25607
|
-
var version$1 = "2.0.0-alpha.
|
|
25705
|
+
var version$1 = "2.0.0-alpha.21";
|
|
25608
25706
|
logger.info("Core version: " + version$1 + ".");
|
|
25609
25707
|
|
|
25610
25708
|
var _obj;
|
|
@@ -27192,7 +27290,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
27192
27290
|
*/ Mesh.create = function(engine, props) {
|
|
27193
27291
|
return new ThreeMesh(engine, props);
|
|
27194
27292
|
};
|
|
27195
|
-
var version = "2.0.0-alpha.
|
|
27293
|
+
var version = "2.0.0-alpha.21";
|
|
27196
27294
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
27197
27295
|
|
|
27198
27296
|
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, TextComponentBase, 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, 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, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
|