@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 CHANGED
@@ -1,5 +1,5 @@
1
+ import { Euler, Matrix4, Quaternion, Vector3 } from '@galacean/effects-math/es/core/index';
1
2
  import * as spec from '@galacean/effects-specification';
2
- import { Matrix4, Vector3, Euler, Quaternion } from '@galacean/effects-math/es/core/index';
3
3
  interface CameraOptionsBase {
4
4
  /**
5
5
  * 相机近平面
@@ -58,6 +58,10 @@ export interface CameraOptionsEx extends CameraOptionsBase {
58
58
  */
59
59
  export declare class Camera {
60
60
  name: string;
61
+ /**
62
+ * 编辑器用于缩放画布
63
+ */
64
+ private fovScaleRatio;
61
65
  private options;
62
66
  private viewMatrix;
63
67
  private projectionMatrix;
@@ -114,6 +118,8 @@ export declare class Camera {
114
118
  */
115
119
  set rotation(value: Euler);
116
120
  get rotation(): Euler;
121
+ setFovScaleRatio(value: number): void;
122
+ getFovScaleRatio(): number;
117
123
  /**
118
124
  * 获取相机的视图变换矩阵
119
125
  * @return
@@ -1,5 +1,6 @@
1
- import type { Ray } from '@galacean/effects-math/es/core/index';
2
1
  import * as spec from '@galacean/effects-specification';
2
+ import type { Ray } from '@galacean/effects-math/es/core/ray';
3
+ import type { Vector3 } from '@galacean/effects-math/es/core/vector3';
3
4
  import { Camera } from './camera';
4
5
  import { CompositionComponent } from './comp-vfx-item';
5
6
  import { CompositionSourceManager } from './composition-source-manager';
@@ -16,6 +17,7 @@ export interface CompositionStatistic {
16
17
  loadTime: number;
17
18
  loadStart: number;
18
19
  firstFrameTime: number;
20
+ precompileTime: number;
19
21
  }
20
22
  export interface MessageItem {
21
23
  id: string;
@@ -23,6 +25,12 @@ export interface MessageItem {
23
25
  phrase: number;
24
26
  compositionId: string;
25
27
  }
28
+ export interface CompItemClickedData {
29
+ name: string;
30
+ id: string;
31
+ hitPositions: Vector3[];
32
+ position: Vector3;
33
+ }
26
34
  /**
27
35
  *
28
36
  */
@@ -36,6 +44,7 @@ export interface CompositionProps {
36
44
  baseRenderOrder?: number;
37
45
  renderer: Renderer;
38
46
  onPlayerPause?: (item: VFXItem) => void;
47
+ onItemClicked?: (item: VFXItem) => void;
39
48
  onMessageItem?: (item: MessageItem) => void;
40
49
  onEnd?: (composition: Composition) => void;
41
50
  event?: EventSystem;
@@ -76,6 +85,11 @@ export declare class Composition implements Disposable, LostHandler {
76
85
  */
77
86
  keepResource: boolean;
78
87
  extraCamera: VFXItem;
88
+ /**
89
+ * 合成内的元素否允许点击、拖拽交互
90
+ * @since 1.6.0
91
+ */
92
+ interactive: boolean;
79
93
  /**
80
94
  * 合成结束行为是 spec.END_BEHAVIOR_PAUSE 或 spec.END_BEHAVIOR_PAUSE_AND_DESTROY 时执行的回调
81
95
  * @internal
@@ -89,6 +103,14 @@ export declare class Composition implements Disposable, LostHandler {
89
103
  * 合成中消息元素创建/销毁时触发的回调
90
104
  */
91
105
  onMessageItem?: (item: MessageItem) => void;
106
+ /**
107
+ * 合成中元素点击时触发的回调
108
+ * 注意:此接口随时可能下线,请务使用!
109
+ * @since 1.6.0
110
+ * @ignore
111
+ * @deprecated
112
+ */
113
+ onItemClicked?: (data: CompItemClickedData) => void;
92
114
  /**
93
115
  * 合成id
94
116
  */
@@ -149,7 +171,6 @@ export declare class Composition implements Disposable, LostHandler {
149
171
  * 合成全局时间
150
172
  */
151
173
  globalTime: number;
152
- editorScaleRatio: number;
153
174
  protected rendererOptions: MeshRendererOptions | null;
154
175
  protected assigned: boolean;
155
176
  /**
@@ -204,6 +225,8 @@ export declare class Composition implements Disposable, LostHandler {
204
225
  * 获取销毁状态
205
226
  */
206
227
  get isDestroyed(): boolean;
228
+ set editorScaleRatio(value: number);
229
+ get editorScaleRatio(): number;
207
230
  /**
208
231
  * 获取合成的时长
209
232
  */
package/dist/index.js 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.20
6
+ * Version: v2.0.0-alpha.22
7
7
  */
8
8
 
9
9
  'use strict';
@@ -4324,11 +4324,19 @@ var DataType;
4324
4324
  DataType["Texture"] = "Texture";
4325
4325
  DataType["AnimationClip"] = "AnimationClip";
4326
4326
  DataType["TextComponent"] = "TextComponent";
4327
+ DataType["BinaryAsset"] = "BinaryAsset";
4328
+ // Timeline
4327
4329
  DataType["TrackAsset"] = "TrackAsset";
4328
4330
  DataType["TimelineAsset"] = "TimelineAsset";
4331
+ DataType["ObjectBindingTrack"] = "ObjectBindingTrack";
4332
+ DataType["TransformTrack"] = "TransformTrack";
4333
+ DataType["SpriteColorTrack"] = "SpriteColorTrack";
4334
+ DataType["ActivationTrack"] = "ActivationTrack";
4335
+ DataType["SubCompositionTrack"] = "SubCompositionTrack";
4329
4336
  DataType["TransformPlayableAsset"] = "TransformPlayableAsset";
4330
4337
  DataType["SpriteColorPlayableAsset"] = "SpriteColorPlayableAsset";
4331
- DataType["BinaryAsset"] = "BinaryAsset";
4338
+ DataType["ActivationPlayableAsset"] = "ActivationPlayableAsset";
4339
+ DataType["SubCompositionPlayableAsset"] = "SubCompositionPlayableAsset";
4332
4340
  // FIXME: 先完成ECS的场景转换,后面移到spec中
4333
4341
  DataType["MeshComponent"] = "MeshComponent";
4334
4342
  DataType["SkyboxComponent"] = "SkyboxComponent";
@@ -4917,10 +4925,25 @@ var EventSystem = /*#__PURE__*/ function() {
4917
4925
  var getTouchEventValue = function(event, x, y, dx, dy) {
4918
4926
  if (dx === void 0) dx = 0;
4919
4927
  if (dy === void 0) dy = 0;
4920
- var _this_target = _this.target, width = _this_target.width, height = _this_target.height;
4921
- var ts = performance.now();
4922
4928
  var vx = 0;
4923
4929
  var vy = 0;
4930
+ var ts = performance.now();
4931
+ if (!_this.target) {
4932
+ logger.error("Trigger TouchEvent after EventSystem is disposed.");
4933
+ return {
4934
+ x: x,
4935
+ y: y,
4936
+ vx: 0,
4937
+ vy: vy,
4938
+ dx: dx,
4939
+ dy: dy,
4940
+ ts: ts,
4941
+ width: 0,
4942
+ height: 0,
4943
+ origin: event
4944
+ };
4945
+ }
4946
+ var _this_target = _this.target, width = _this_target.width, height = _this_target.height;
4924
4947
  if (lastTouch) {
4925
4948
  var dt = ts - lastTouch.ts;
4926
4949
  vx = (dx - lastTouch.dx) / dt || 0;
@@ -13045,6 +13068,16 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13045
13068
  function InteractComponent() {
13046
13069
  var _this;
13047
13070
  _this = RendererComponent.apply(this, arguments) || this;
13071
+ /**
13072
+ * 拖拽的惯性衰减系数,范围[0, 1], 越大惯性越强
13073
+ */ _this.downgrade = 0.95;
13074
+ /**
13075
+ * 拖拽的距离映射系数,越大越容易拖动
13076
+ */ _this.dragRatio = [
13077
+ 1,
13078
+ 1
13079
+ ];
13080
+ /** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
13048
13081
  _this.getHitTestParams = function(force) {
13049
13082
  if (!_this.clickable) {
13050
13083
  return;
@@ -13096,9 +13129,8 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13096
13129
  if (!this.dragEvent || !this.bouncingArg) {
13097
13130
  return;
13098
13131
  }
13099
- var downgrade = 0.95;
13100
- this.bouncingArg.vx *= downgrade;
13101
- this.bouncingArg.vy *= downgrade;
13132
+ this.bouncingArg.vx *= this.downgrade;
13133
+ this.bouncingArg.vy *= this.downgrade;
13102
13134
  this.bouncingArg.dy += this.bouncingArg.vy;
13103
13135
  this.bouncingArg.dx += this.bouncingArg.vx;
13104
13136
  if (shouldIgnoreBouncing(this.bouncingArg)) {
@@ -13126,7 +13158,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13126
13158
  // OVERRIDE
13127
13159
  };
13128
13160
  _proto.handleDragMove = function handleDragMove(evt, event) {
13129
- if (!(evt && evt.cameraParam) || !this.item.composition) {
13161
+ if (!(evt == null ? void 0 : evt.cameraParam) || !this.canInteract() || !this.item.composition) {
13130
13162
  return;
13131
13163
  }
13132
13164
  var options = this.item.props.content.options;
@@ -13137,8 +13169,8 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13137
13169
  var sp = Math.tan(fov * Math.PI / 180 / 2) * Math.abs(depth);
13138
13170
  var height = dy * sp;
13139
13171
  var width = dx * sp;
13140
- var nx = position[0] - width;
13141
- var ny = position[1] - height;
13172
+ var nx = position[0] - this.dragRatio[0] * width;
13173
+ var ny = position[1] - this.dragRatio[1] * height;
13142
13174
  if (options.dxRange) {
13143
13175
  var _options_dxRange = options.dxRange, min = _options_dxRange[0], max = _options_dxRange[1];
13144
13176
  nx = clamp$1(nx, min, max);
@@ -13166,6 +13198,9 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13166
13198
  var handlerMap = {
13167
13199
  touchstart: function(event) {
13168
13200
  var _this_item_composition;
13201
+ if (!_this.canInteract()) {
13202
+ return;
13203
+ }
13169
13204
  _this.dragEvent = null;
13170
13205
  _this.bouncingArg = null;
13171
13206
  var camera = (_this_item_composition = _this.item.composition) == null ? void 0 : _this_item_composition.camera;
@@ -13187,6 +13222,9 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13187
13222
  _this.bouncingArg = event;
13188
13223
  },
13189
13224
  touchend: function(event) {
13225
+ if (!_this.canInteract()) {
13226
+ return;
13227
+ }
13190
13228
  var bouncingArg = _this.bouncingArg;
13191
13229
  if (!shouldIgnoreBouncing(bouncingArg, 3) && bouncingArg) {
13192
13230
  var speed = 5;
@@ -13229,6 +13267,25 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13229
13267
  RendererComponent.prototype.fromData.call(this, data);
13230
13268
  this.interactData = data;
13231
13269
  };
13270
+ _proto.canInteract = function canInteract() {
13271
+ var _this_item_composition;
13272
+ return Boolean((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.interactive) && this._interactive;
13273
+ };
13274
+ _create_class(InteractComponent, [
13275
+ {
13276
+ key: "interactive",
13277
+ get: function get() {
13278
+ return this._interactive;
13279
+ },
13280
+ set: function set(enable) {
13281
+ this._interactive = enable;
13282
+ if (!enable) {
13283
+ // 立刻停止惯性滑动
13284
+ this.bouncingArg = null;
13285
+ }
13286
+ }
13287
+ }
13288
+ ]);
13232
13289
  return InteractComponent;
13233
13290
  }(RendererComponent);
13234
13291
  exports.InteractComponent = __decorate([
@@ -16745,17 +16802,12 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16745
16802
  _proto.onEnd = function onEnd(particle) {};
16746
16803
  _proto.onIterate = function onIterate(particle) {};
16747
16804
  _proto.initPoint = function initPoint(data) {
16748
- var _this_item_composition, _this_item_composition1;
16749
16805
  var options = this.options;
16750
16806
  var lifetime = this.lifetime;
16751
16807
  var shape = this.shape;
16752
16808
  var speed = options.startSpeed.getValue(lifetime);
16753
16809
  var matrix4 = options.particleFollowParent ? this.transform.getMatrix() : this.transform.getWorldMatrix();
16754
16810
  var pointPosition = data.position;
16755
- if (((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderer.env) === PLAYER_OPTIONS_ENV_EDITOR) {
16756
- pointPosition.x /= this.item.composition.editorScaleRatio;
16757
- pointPosition.y /= this.item.composition.editorScaleRatio;
16758
- }
16759
16811
  // 粒子的位置受发射器的位置影响,自身的旋转和缩放不受影响
16760
16812
  var position = matrix4.transformPoint(pointPosition, new Vector3());
16761
16813
  var transform = new Transform({
@@ -16836,10 +16888,6 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16836
16888
  size.x *= tempScale.x;
16837
16889
  size.y *= tempScale.y;
16838
16890
  }
16839
- if (((_this_item_composition1 = this.item.composition) == null ? void 0 : _this_item_composition1.renderer.env) === PLAYER_OPTIONS_ENV_EDITOR) {
16840
- size.x /= this.item.composition.editorScaleRatio;
16841
- size.y /= this.item.composition.editorScaleRatio;
16842
- }
16843
16891
  transform.setScale(size.x, size.y, 1);
16844
16892
  return {
16845
16893
  size: size,
@@ -19395,21 +19443,33 @@ var TextLayout = /*#__PURE__*/ function() {
19395
19443
  this.lineHeight = lineHeight;
19396
19444
  }
19397
19445
  var _proto = TextLayout.prototype;
19398
- _proto.getOffsetY = function getOffsetY(style) {
19399
- var offsetY = 0;
19400
- var offset = (style.fontSize + style.outlineWidth) * style.fontScale;
19446
+ /**
19447
+ * 获取初始的行高偏移值
19448
+ * @param style - 字体基础数据
19449
+ * @param lineCount - 渲染行数
19450
+ * @param lineHeight - 渲染时的字体行高
19451
+ * @param fontSize - 渲染时的字体大小
19452
+ * @returns - 行高偏移值
19453
+ */ _proto.getOffsetY = function getOffsetY(style, lineCount, lineHeight, fontSize) {
19454
+ var outlineWidth = style.outlineWidth, fontScale = style.fontScale;
19455
+ // /3 计算Y轴偏移量,以匹配编辑器行为
19456
+ var offsetY = (lineHeight - fontSize) / 3;
19457
+ // 计算基础偏移量
19458
+ var baseOffset = fontSize + outlineWidth * fontScale;
19459
+ var commonCalculation = lineHeight * (lineCount - 1);
19460
+ var offsetResult = 0;
19401
19461
  switch(this.textBaseline){
19402
19462
  case TextBaseline.top:
19403
- offsetY = offset;
19463
+ offsetResult = baseOffset + offsetY;
19404
19464
  break;
19405
19465
  case TextBaseline.middle:
19406
- offsetY = (this.height + offset) / 2; // fonSize;
19466
+ offsetResult = (this.height * fontScale - commonCalculation + baseOffset) / 2;
19407
19467
  break;
19408
19468
  case TextBaseline.bottom:
19409
- offsetY = this.height - offset / 2;
19469
+ offsetResult = this.height * fontScale - commonCalculation - offsetY;
19410
19470
  break;
19411
19471
  }
19412
- return offsetY;
19472
+ return offsetResult;
19413
19473
  };
19414
19474
  _proto.getOffsetX = function getOffsetX(style, maxWidth) {
19415
19475
  var offsetX = 0;
@@ -19567,6 +19627,9 @@ exports.TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19567
19627
  var _this;
19568
19628
  _this = SpriteComponent.call(this, engine, props) || this;
19569
19629
  _this.isDirty = true;
19630
+ /**
19631
+ * 文本行数
19632
+ */ _this.lineCount = 0;
19570
19633
  _this.canvas = canvasPool.getCanvas();
19571
19634
  canvasPool.saveCanvas(_this.canvas);
19572
19635
  _this.context = _this.canvas.getContext("2d", {
@@ -19610,6 +19673,31 @@ var TextComponentBase = /*#__PURE__*/ function() {
19610
19673
  this.textStyle = new TextStyle(options);
19611
19674
  this.textLayout = new TextLayout(options);
19612
19675
  this.text = options.text;
19676
+ this.lineCount = this.getLineCount(options.text, true);
19677
+ };
19678
+ _proto.getLineCount = function getLineCount(text, init) {
19679
+ var context = this.context;
19680
+ var letterSpace = this.textLayout.letterSpace;
19681
+ var fontScale = init ? this.textStyle.fontSize / 10 : 1 / this.textStyle.fontScale;
19682
+ var width = this.textLayout.width + this.textStyle.fontOffset;
19683
+ var lineCount = 1;
19684
+ var x = 0;
19685
+ for(var i = 0; i < text.length; i++){
19686
+ var _context_measureText;
19687
+ var str = text[i];
19688
+ var _context_measureText_width;
19689
+ 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;
19690
+ // 和浏览器行为保持一致
19691
+ x += letterSpace;
19692
+ if (x + textMetrics > width && i > 0 || str === "\n") {
19693
+ lineCount++;
19694
+ x = 0;
19695
+ }
19696
+ if (str !== "\n") {
19697
+ x += textMetrics;
19698
+ }
19699
+ }
19700
+ return lineCount;
19613
19701
  };
19614
19702
  /**
19615
19703
  * 设置字号大小
@@ -19656,6 +19744,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
19656
19744
  return;
19657
19745
  }
19658
19746
  this.text = value;
19747
+ this.lineCount = this.getLineCount(value, false);
19659
19748
  this.isDirty = true;
19660
19749
  };
19661
19750
  /**
@@ -19818,10 +19907,8 @@ var TextComponentBase = /*#__PURE__*/ function() {
19818
19907
  // 文本颜色
19819
19908
  context.fillStyle = "rgba(" + style.textColor[0] + ", " + style.textColor[1] + ", " + style.textColor[2] + ", " + style.textColor[3] + ")";
19820
19909
  var charsInfo = [];
19821
- // /3 是为了和编辑器行为保持一致
19822
- var offsetY = (lineHeight - fontSize) / 3;
19823
19910
  var x = 0;
19824
- var y = layout.getOffsetY(style) + offsetY;
19911
+ var y = layout.getOffsetY(style, this.lineCount, lineHeight, fontSize);
19825
19912
  var charsArray = [];
19826
19913
  var charOffsetX = [];
19827
19914
  for(var i = 0; i < this.char.length; i++){
@@ -22384,10 +22471,6 @@ function getStandardCameraContent(model) {
22384
22471
  ]
22385
22472
  });
22386
22473
  }
22387
- // gizmo 的 target id 转换为新的 item guid
22388
- if (item.content.options.target) {
22389
- item.content.options.target = itemOldIdToGuidMap[item.content.options.target];
22390
- }
22391
22474
  // 修正老 json 的 item.pluginName
22392
22475
  if (item.pn !== undefined) {
22393
22476
  var pn = item.pn;
@@ -22405,6 +22488,10 @@ function getStandardCameraContent(model) {
22405
22488
  //@ts-expect-error
22406
22489
  item.type = "orientation-transformer";
22407
22490
  }
22491
+ // gizmo 的 target id 转换为新的 item guid
22492
+ if (item.content.options.target && item.pluginName === "editor-gizmo") {
22493
+ item.content.options.target = itemOldIdToGuidMap[item.content.options.target];
22494
+ }
22408
22495
  // Spine 元素转为 guid 索引
22409
22496
  if (item.type === ItemType.spine && json.spines && json.spines.length !== 0) {
22410
22497
  convertSpineData(json.spines[item.content.options.spine], item.content, result);
@@ -23211,26 +23298,27 @@ var seed = 1;
23211
23298
  */ _proto.loadScene = function loadScene(url, renderer, options) {
23212
23299
  var _this = this;
23213
23300
  return _async_to_generator(function() {
23214
- var _gpuInstance_detail, rawJSON, assetUrl, startTime, timeInfos, gpuInstance, _gpuInstance_detail_asyncShaderCompile, asyncShaderCompile, _gpuInstance_detail_compressedTexture, compressedTexture, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
23301
+ var _gpuInstance_detail, rawJSON, assetUrl, startTime, timeInfoMessages, gpuInstance, _gpuInstance_detail_asyncShaderCompile, asyncShaderCompile, _gpuInstance_detail_compressedTexture, compressedTexture, timeInfos, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
23215
23302
  return __generator(this, function(_state) {
23216
23303
  assetUrl = isString(url) ? url : _this.id;
23217
23304
  startTime = performance.now();
23218
- timeInfos = [];
23305
+ timeInfoMessages = [];
23219
23306
  gpuInstance = renderer == null ? void 0 : renderer.engine.gpuCapability;
23220
23307
  asyncShaderCompile = (_gpuInstance_detail_asyncShaderCompile = gpuInstance == null ? void 0 : (_gpuInstance_detail = gpuInstance.detail) == null ? void 0 : _gpuInstance_detail.asyncShaderCompile) != null ? _gpuInstance_detail_asyncShaderCompile : false;
23221
23308
  compressedTexture = (_gpuInstance_detail_compressedTexture = gpuInstance == null ? void 0 : gpuInstance.detail.compressedTexture) != null ? _gpuInstance_detail_compressedTexture : exports.COMPRESSED_TEXTURE.NONE;
23309
+ timeInfos = {};
23222
23310
  cancelLoading = false;
23223
23311
  waitPromise = new Promise(function(resolve, reject) {
23224
23312
  loadTimer = window.setTimeout(function() {
23225
23313
  cancelLoading = true;
23226
23314
  _this.removeTimer(loadTimer);
23227
23315
  var totalTime = performance.now() - startTime;
23228
- reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + "."));
23316
+ reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + "."));
23229
23317
  }, _this.timeout * 1000);
23230
23318
  _this.timers.push(loadTimer);
23231
23319
  });
23232
23320
  hookTimeInfo = /*#__PURE__*/ _async_to_generator(function(label, func) {
23233
- var st, result, e;
23321
+ var st, result, time, e;
23234
23322
  return __generator(this, function(_state) {
23235
23323
  switch(_state.label){
23236
23324
  case 0:
@@ -23253,7 +23341,9 @@ var seed = 1;
23253
23341
  ];
23254
23342
  case 2:
23255
23343
  result = _state.sent();
23256
- timeInfos.push("[" + label + ": " + (performance.now() - st).toFixed(2) + "]");
23344
+ time = performance.now() - st;
23345
+ timeInfoMessages.push("[" + label + ": " + time.toFixed(2) + "]");
23346
+ timeInfos[label] = time;
23257
23347
  return [
23258
23348
  2,
23259
23349
  result
@@ -23352,7 +23442,7 @@ var seed = 1;
23352
23442
  hookTimeInfo("processImages", function() {
23353
23443
  return _this.processImages(images1, compressedTexture);
23354
23444
  }),
23355
- hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + " compile", function() {
23445
+ hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + "Compile", function() {
23356
23446
  return _this.precompile(compositions, pluginSystem, renderer, options);
23357
23447
  })
23358
23448
  ])
@@ -23385,6 +23475,7 @@ var seed = 1;
23385
23475
  loadedTextures = _state.sent();
23386
23476
  _this.updateSceneData(jsonScene.items);
23387
23477
  scene = {
23478
+ timeInfos: timeInfos,
23388
23479
  url: url,
23389
23480
  renderLevel: _this.options.renderLevel,
23390
23481
  storage: {},
@@ -23407,11 +23498,13 @@ var seed = 1;
23407
23498
  _state.label = 12;
23408
23499
  case 12:
23409
23500
  totalTime = performance.now() - startTime;
23410
- logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + ".");
23501
+ logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + ".");
23411
23502
  window.clearTimeout(loadTimer);
23412
23503
  _this.removeTimer(loadTimer);
23413
23504
  scene.totalTime = totalTime;
23414
23505
  scene.startTime = startTime;
23506
+ // 各部分分段时长
23507
+ scene.timeInfos = timeInfos;
23415
23508
  return [
23416
23509
  2,
23417
23510
  scene
@@ -23950,6 +24043,7 @@ var tmpScale = new Vector3(1, 1, 1);
23950
24043
  function Camera(name, options) {
23951
24044
  if (options === void 0) options = {};
23952
24045
  this.name = name;
24046
+ this.fovScaleRatio = 1.0;
23953
24047
  this.viewMatrix = Matrix4.fromIdentity();
23954
24048
  this.projectionMatrix = Matrix4.fromIdentity();
23955
24049
  this.viewProjectionMatrix = Matrix4.fromIdentity();
@@ -23977,6 +24071,13 @@ var tmpScale = new Vector3(1, 1, 1);
23977
24071
  this.updateMatrix();
23978
24072
  }
23979
24073
  var _proto = Camera.prototype;
24074
+ _proto.setFovScaleRatio = function setFovScaleRatio(value) {
24075
+ this.fovScaleRatio = value;
24076
+ this.dirty = true;
24077
+ };
24078
+ _proto.getFovScaleRatio = function getFovScaleRatio() {
24079
+ return this.fovScaleRatio;
24080
+ };
23980
24081
  /**
23981
24082
  * 获取相机的视图变换矩阵
23982
24083
  * @return
@@ -24097,7 +24198,7 @@ var tmpScale = new Vector3(1, 1, 1);
24097
24198
  */ _proto.updateMatrix = function updateMatrix() {
24098
24199
  if (this.dirty) {
24099
24200
  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;
24100
- this.projectionMatrix.perspective(fov * DEG2RAD, aspect, near, far, clipMode === CameraClipMode.portrait);
24201
+ this.projectionMatrix.perspective(fov * DEG2RAD * this.fovScaleRatio, aspect, near, far, clipMode === CameraClipMode.portrait);
24101
24202
  this.inverseViewMatrix.compose(position, this.getQuat(), tmpScale);
24102
24203
  this.viewMatrix.copyFrom(this.inverseViewMatrix).invert();
24103
24204
  this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix, this.viewMatrix);
@@ -24404,7 +24505,6 @@ var listOrder = 0;
24404
24505
  /**
24405
24506
  * 预合成的合成属性,在 content 中会被其元素属性覆盖
24406
24507
  */ this.refCompositionProps = new Map();
24407
- this.editorScaleRatio = 1.0;
24408
24508
  // TODO: 待优化
24409
24509
  this.assigned = false;
24410
24510
  /**
@@ -24441,11 +24541,12 @@ var listOrder = 0;
24441
24541
  this.renderer = renderer;
24442
24542
  this.texInfo = imageUsage != null ? imageUsage : {};
24443
24543
  this.event = event;
24444
- var _scene_startTime;
24544
+ var _scene_startTime, _scene_timeInfos_asyncCompile;
24445
24545
  this.statistic = {
24446
24546
  loadTime: totalTime != null ? totalTime : 0,
24447
24547
  loadStart: (_scene_startTime = scene.startTime) != null ? _scene_startTime : 0,
24448
- firstFrameTime: 0
24548
+ firstFrameTime: 0,
24549
+ precompileTime: (_scene_timeInfos_asyncCompile = scene.timeInfos["asyncCompile"]) != null ? _scene_timeInfos_asyncCompile : scene.timeInfos["syncCompile"]
24449
24550
  };
24450
24551
  this.reusable = reusable;
24451
24552
  this.speed = speed;
@@ -24459,6 +24560,7 @@ var listOrder = 0;
24459
24560
  this.url = scene.url;
24460
24561
  this.assigned = true;
24461
24562
  this.globalTime = 0;
24563
+ this.interactive = true;
24462
24564
  this.onPlayerPause = onPlayerPause;
24463
24565
  this.onMessageItem = onMessageItem;
24464
24566
  this.onEnd = onEnd;
@@ -24888,7 +24990,7 @@ var listOrder = 0;
24888
24990
  * @param options - 最大求交数和求交时的回调
24889
24991
  */ _proto.hitTest = function hitTest(x, y, force, options) {
24890
24992
  var _this_rootItem_getComponent;
24891
- if (this.isDestroyed) {
24993
+ if (this.isDestroyed || !this.interactive) {
24892
24994
  return [];
24893
24995
  }
24894
24996
  var regions = [];
@@ -25209,6 +25311,15 @@ var listOrder = 0;
25209
25311
  */ function get() {
25210
25312
  return this.destroyed;
25211
25313
  }
25314
+ },
25315
+ {
25316
+ key: "editorScaleRatio",
25317
+ get: function get() {
25318
+ return this.camera.getFovScaleRatio();
25319
+ },
25320
+ set: function set(value) {
25321
+ this.camera.setFovScaleRatio(value);
25322
+ }
25212
25323
  }
25213
25324
  ]);
25214
25325
  return Composition;
@@ -25606,7 +25717,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
25606
25717
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
25607
25718
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
25608
25719
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
25609
- var version = "2.0.0-alpha.20";
25720
+ var version = "2.0.0-alpha.22";
25610
25721
  logger.info("Core version: " + version + ".");
25611
25722
 
25612
25723
  exports.AbstractPlugin = AbstractPlugin;