@galacean/engine-core 2.0.0-alpha.49 → 2.0.0-alpha.50

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.
Files changed (90) hide show
  1. package/dist/main.js +89 -74
  2. package/dist/main.js.map +1 -1
  3. package/dist/module.js +89 -74
  4. package/dist/module.js.map +1 -1
  5. package/package.json +3 -3
  6. package/types/2d/assembler/ISpriteRenderer.d.ts +2 -2
  7. package/types/2d/sprite/Sprite.d.ts +3 -3
  8. package/types/2d/sprite/SpriteMask.d.ts +1 -1
  9. package/types/2d/sprite/SpriteRenderer.d.ts +1 -1
  10. package/types/2d/text/CharInfo.d.ts +1 -1
  11. package/types/2d/text/Font.d.ts +1 -1
  12. package/types/2d/text/SubFont.d.ts +2 -2
  13. package/types/2d/text/TextRenderer.d.ts +2 -2
  14. package/types/Background.d.ts +2 -2
  15. package/types/Camera.d.ts +3 -3
  16. package/types/Component.d.ts +2 -2
  17. package/types/Engine.d.ts +1 -1
  18. package/types/Entity.d.ts +19 -19
  19. package/types/RenderPipeline/Blitter.d.ts +1 -1
  20. package/types/RenderPipeline/DepthOnlyPass.d.ts +1 -1
  21. package/types/RenderPipeline/PipelineUtils.d.ts +1 -1
  22. package/types/RenderPipeline/PrimitiveChunkManager.d.ts +1 -1
  23. package/types/RenderPipeline/RenderContext.d.ts +5 -5
  24. package/types/RenderPipeline/VertexArea.d.ts +2 -2
  25. package/types/Renderer.d.ts +8 -8
  26. package/types/Scene.d.ts +7 -8
  27. package/types/SceneManager.d.ts +5 -6
  28. package/types/Utils.d.ts +1 -1
  29. package/types/animation/AnimationClipCurveBinding.d.ts +1 -1
  30. package/types/animation/AnimationEvent.d.ts +2 -2
  31. package/types/animation/Animator.d.ts +1 -1
  32. package/types/animation/AnimatorController.d.ts +2 -2
  33. package/types/animation/AnimatorControllerParameter.d.ts +1 -1
  34. package/types/animation/AnimatorState.d.ts +3 -3
  35. package/types/animation/AnimatorStateInstance.d.ts +1 -1
  36. package/types/animation/AnimatorStateTransition.d.ts +1 -1
  37. package/types/animation/Keyframe.d.ts +1 -1
  38. package/types/animation/animationCurve/AnimationCurve.d.ts +2 -2
  39. package/types/animation/animationCurve/AnimationRefCurve.d.ts +4 -4
  40. package/types/animation/internal/AnimatorLayerData.d.ts +1 -1
  41. package/types/animation/internal/animationCurveOwner/AnimationCurveOwner.d.ts +4 -4
  42. package/types/asset/AssetPromise.d.ts +4 -4
  43. package/types/asset/JSONAsset.d.ts +1 -1
  44. package/types/asset/Loader.d.ts +2 -2
  45. package/types/asset/ResourceManager.d.ts +1 -1
  46. package/types/audio/AudioClip.d.ts +1 -1
  47. package/types/audio/AudioSource.d.ts +2 -2
  48. package/types/env-probe/Probe.d.ts +1 -1
  49. package/types/graphic/Buffer.d.ts +2 -2
  50. package/types/graphic/Mesh.d.ts +2 -2
  51. package/types/graphic/Primitive.d.ts +5 -5
  52. package/types/input/keyboard/KeyboardManager.d.ts +1 -1
  53. package/types/input/pointer/emitter/IHitResult.d.ts +1 -1
  54. package/types/input/pointer/emitter/PhysicsPointerEventEmitter.d.ts +3 -3
  55. package/types/lighting/KHR_lights.d.ts +13 -1
  56. package/types/mesh/BlendShape.d.ts +1 -1
  57. package/types/mesh/BlendShapeFrame.d.ts +4 -4
  58. package/types/mesh/BlendShapeManager.d.ts +1 -1
  59. package/types/mesh/BufferMesh.d.ts +2 -2
  60. package/types/mesh/ModelMesh.d.ts +4 -4
  61. package/types/mesh/PrimitiveMesh.d.ts +1 -1
  62. package/types/mesh/SkinnedMeshRenderer.d.ts +1 -1
  63. package/types/particle/ParticleGenerator.d.ts +1 -1
  64. package/types/particle/modules/ParticleCompositeCurve.d.ts +2 -2
  65. package/types/particle/modules/ParticleCompositeGradient.d.ts +1 -1
  66. package/types/particle/modules/ParticleGeneratorModule.d.ts +1 -1
  67. package/types/particle/modules/ParticleGradient.d.ts +4 -4
  68. package/types/particle/modules/SubEmitter.d.ts +2 -2
  69. package/types/particle/modules/shape/MeshShape.d.ts +2 -2
  70. package/types/particle/modules/shape/ShapeUtils.d.ts +1 -1
  71. package/types/physics/HitResult.d.ts +2 -2
  72. package/types/physics/joint/Joint.d.ts +3 -3
  73. package/types/physics/shape/ColliderShape.d.ts +3 -3
  74. package/types/physics/shape/MeshColliderShape.d.ts +2 -2
  75. package/types/postProcess/PostProcess.d.ts +6 -6
  76. package/types/postProcess/PostProcessEffectParameter.d.ts +2 -2
  77. package/types/postProcess/PostProcessManager.d.ts +1 -1
  78. package/types/postProcess/PostProcessPass.d.ts +2 -2
  79. package/types/shader/Shader.d.ts +8 -8
  80. package/types/shader/ShaderData.d.ts +3 -3
  81. package/types/shader/ShaderMacro.d.ts +2 -2
  82. package/types/shader/state/BlendState.d.ts +1 -1
  83. package/types/shader/state/DepthState.d.ts +1 -1
  84. package/types/shader/state/RasterState.d.ts +1 -1
  85. package/types/shader/state/RenderState.d.ts +1 -1
  86. package/types/shader/state/StencilState.d.ts +1 -1
  87. package/types/sky/Sky.d.ts +4 -4
  88. package/types/texture/RenderTarget.d.ts +3 -3
  89. package/types/utils/DisorderedArray.d.ts +1 -1
  90. package/types/xr/XRManager.d.ts +2 -2
package/dist/main.js CHANGED
@@ -601,12 +601,12 @@ var AssetPromise = /*#__PURE__*/ function() {
601
601
  var completeProgress = this._taskCompleteProgress;
602
602
  var detailProgress = this._taskDetailProgress;
603
603
  if (completeProgress) {
604
- onTaskComplete(completeProgress.loaded, completeProgress.total);
604
+ onTaskComplete == null ? void 0 : onTaskComplete(completeProgress.loaded, completeProgress.total);
605
605
  }
606
606
  if (detailProgress) {
607
607
  for(var url in detailProgress){
608
608
  var _detailProgress_url = detailProgress[url], loaded = _detailProgress_url.loaded, total = _detailProgress_url.total;
609
- onTaskDetail(url, loaded, total);
609
+ onTaskDetail == null ? void 0 : onTaskDetail(url, loaded, total);
610
610
  }
611
611
  }
612
612
  if (this._state === "pending") {
@@ -3588,7 +3588,8 @@ exports.TiledSpriteAssembler = /*#__PURE__*/ function() {
3588
3588
  }
3589
3589
  };
3590
3590
  TiledSpriteAssembler._calculateDividing = function _calculateDividing(renderer, width, height, rPos, cPos, rUV, cUV, referenceResolutionPerUnit) {
3591
- var sprite = renderer.sprite, threshold = renderer.tiledAdaptiveThreshold;
3591
+ var sprite = renderer.sprite;
3592
+ var threshold = renderer.tiledAdaptiveThreshold;
3592
3593
  var border = sprite.border;
3593
3594
  var spritePositions = sprite._getPositions();
3594
3595
  var _spritePositions_ = spritePositions[0], left = _spritePositions_.x, bottom = _spritePositions_.y;
@@ -3764,7 +3765,7 @@ exports.TiledSpriteAssembler = __decorate([
3764
3765
  /**
3765
3766
  * @internal
3766
3767
  */ _proto._addSprite = function _addSprite(sprite) {
3767
- this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
3768
+ this._spriteNamesToIndex[String(sprite.name)] = this._sprites.push(sprite) - 1;
3768
3769
  sprite._atlas = this;
3769
3770
  sprite.isGCIgnored = true;
3770
3771
  };
@@ -4979,7 +4980,7 @@ var ActiveChangeFlag = /*#__PURE__*/ function(ActiveChangeFlag) {
4979
4980
  {
4980
4981
  key: "scene",
4981
4982
  get: /**
4982
- * The scene which the component's entity belongs to.
4983
+ * The owning entity's scene, or null/undefined if it is not in a scene.
4983
4984
  */ function get() {
4984
4985
  return this._entity.scene;
4985
4986
  }
@@ -6327,17 +6328,17 @@ function _construct(Parent, args, Class) {
6327
6328
  child._setParent(null);
6328
6329
  };
6329
6330
  /**
6331
+ * Get a child entity by index.
6332
+ * @param index - The zero-based child index
6333
+ * @returns The child at the index, or undefined if none exists
6330
6334
  * @deprecated Please use `children` property instead.
6331
- * Find child entity by index.
6332
- * @param index - The index of the child entity
6333
- * @returns The entity that was found
6334
6335
  */ _proto.getChild = function getChild(index) {
6335
6336
  return this._children[index];
6336
6337
  };
6337
6338
  /**
6338
- * Find entity by name.
6339
+ * Find the first entity with the given name in this entity and its descendants.
6339
6340
  * @param name - The name of the entity to find
6340
- * @returns The entity that was found
6341
+ * @returns The first matching entity, or null if none is found
6341
6342
  */ _proto.findByName = function findByName(name) {
6342
6343
  if (name === this.name) {
6343
6344
  return this;
@@ -6352,9 +6353,9 @@ function _construct(Parent, args, Class) {
6352
6353
  return null;
6353
6354
  };
6354
6355
  /**
6355
- * Find the entity by path.
6356
- * @param path - The path of the entity eg: /entity
6357
- * @returns The entity that was found
6356
+ * Find a descendant by its path relative to this entity.
6357
+ * @param path - The entity path, with names separated by "/"
6358
+ * @returns The matching entity, this entity for an empty path, or null if none is found
6358
6359
  */ _proto.findByPath = function findByPath(path) {
6359
6360
  var splits = path.split("/").filter(Boolean);
6360
6361
  if (!splits.length) {
@@ -6823,7 +6824,7 @@ function _construct(Parent, args, Class) {
6823
6824
  {
6824
6825
  key: "parent",
6825
6826
  get: /**
6826
- * The parent entity.
6827
+ * The parent entity, or null if this entity has no parent.
6827
6828
  */ function get() {
6828
6829
  return this._parent;
6829
6830
  },
@@ -6851,7 +6852,7 @@ function _construct(Parent, args, Class) {
6851
6852
  {
6852
6853
  key: "scene",
6853
6854
  get: /**
6854
- * The scene the entity belongs to.
6855
+ * The owning scene, or null/undefined if this entity is not in a scene.
6855
6856
  */ function get() {
6856
6857
  return this._scene;
6857
6858
  }
@@ -7515,8 +7516,9 @@ exports.Renderer = /*#__PURE__*/ function(Component) {
7515
7516
  var materials = this._materials;
7516
7517
  var materialsInstance = this._materialsInstanced;
7517
7518
  for(var i = 0, n = materials.length; i < n; i++){
7518
- if (!materialsInstance[i]) {
7519
- this._createInstanceMaterial(this._materials[i], i);
7519
+ var material = materials[i];
7520
+ if (material && !materialsInstance[i]) {
7521
+ this._createInstanceMaterial(material, i);
7520
7522
  }
7521
7523
  }
7522
7524
  return materials;
@@ -14626,7 +14628,8 @@ __decorate([
14626
14628
  * @internal
14627
14629
  */ _proto._updateVertexBuffers = function _updateVertexBuffers(vertexCount, force) {
14628
14630
  var _this = this, blendShapes = _this._blendShapes, maxCountSingleBuffer = _this._maxCountSingleVertexBuffer;
14629
- var _this1 = this, vertices = _this1._vertices, vertexBuffers = _this1._vertexBuffers, storeInfos = _this1._storeInVertexBufferInfo;
14631
+ var _this1 = this, vertexBuffers = _this1._vertexBuffers, storeInfos = _this1._storeInVertexBufferInfo;
14632
+ var vertices = this._vertices;
14630
14633
  var subDataDirtyFlags = this._subDataDirtyFlags;
14631
14634
  var blendShapeFloatStride = this._vertexElementCount * 3;
14632
14635
  var blendShapeByteStride = blendShapeFloatStride * 4;
@@ -14699,7 +14702,8 @@ __decorate([
14699
14702
  }
14700
14703
  };
14701
14704
  _proto._updateTextureArray = function _updateTextureArray(vertexCount, force) {
14702
- var _this = this, blendShapes = _this._blendShapes, vertexTexture = _this._vertexTexture, vertices = _this._vertices, subDataDirtyFlags = _this._subDataDirtyFlags;
14705
+ var _this = this, blendShapes = _this._blendShapes, vertexTexture = _this._vertexTexture, subDataDirtyFlags = _this._subDataDirtyFlags;
14706
+ var vertices = this._vertices;
14703
14707
  for(var i = 0, n = blendShapes.length; i < n; i++){
14704
14708
  var subDirtyFlag = subDataDirtyFlags[i];
14705
14709
  var subBlendShapeDataStride = vertexTexture.width * vertexTexture.height * 4;
@@ -14710,7 +14714,8 @@ __decorate([
14710
14714
  if (frameCount > 0 && endFrame.deltaPositions.length !== vertexCount) {
14711
14715
  throw "BlendShape frame deltaPositions length must same with mesh vertexCount.";
14712
14716
  }
14713
- var deltaPositions = endFrame.deltaPositions, deltaNormals = endFrame.deltaNormals, deltaTangents = endFrame.deltaTangents;
14717
+ var deltaNormals = endFrame.deltaNormals, deltaTangents = endFrame.deltaTangents;
14718
+ var deltaPositions = endFrame.deltaPositions;
14714
14719
  var offset = i * subBlendShapeDataStride;
14715
14720
  for(var j = 0; j < vertexCount; j++){
14716
14721
  var position = deltaPositions[j];
@@ -17259,7 +17264,7 @@ var SkinUpdateFlag = /*#__PURE__*/ function(SkinUpdateFlag) {
17259
17264
  };
17260
17265
  _proto._update = function _update(context) {
17261
17266
  var skin = this.skin;
17262
- if ((skin == null ? void 0 : skin.bones.length) > 0) {
17267
+ if (skin && skin.bones.length > 0) {
17263
17268
  skin._updateSkinMatrices(this);
17264
17269
  }
17265
17270
  var shaderData = this.shaderData;
@@ -18402,19 +18407,20 @@ registerDefaultCloneMode(SafeLoopArray, CloneMode.Ignore);
18402
18407
  index = scenes.length;
18403
18408
  scene = indexOrScene;
18404
18409
  }
18405
- if (scene.engine !== this.engine) {
18410
+ var targetScene = scene;
18411
+ if (targetScene.engine !== this.engine) {
18406
18412
  throw "The scene is not belong to this engine.";
18407
18413
  }
18408
- if (scene._sceneManager) {
18409
- var currentIndex = scenes.indexOf(scene);
18414
+ if (targetScene._sceneManager) {
18415
+ var currentIndex = scenes.indexOf(targetScene);
18410
18416
  if (currentIndex !== index) {
18411
18417
  scenes.removeByIndex(currentIndex);
18412
- scenes.add(index, scene);
18418
+ scenes.add(index, targetScene);
18413
18419
  }
18414
18420
  } else {
18415
- scene._sceneManager = this;
18416
- scenes.add(index, scene);
18417
- scene.isActive && scene._processActive(true);
18421
+ targetScene._sceneManager = this;
18422
+ scenes.add(index, targetScene);
18423
+ targetScene.isActive && targetScene._processActive(true);
18418
18424
  }
18419
18425
  };
18420
18426
  /**
@@ -18484,10 +18490,9 @@ registerDefaultCloneMode(SafeLoopArray, CloneMode.Ignore);
18484
18490
  {
18485
18491
  key: "activeScene",
18486
18492
  get: /**
18487
- * @deprecated
18488
- * Please use `scenes` instead.
18489
- *
18490
- * Get the first scene.
18493
+ * Get the first scene, or undefined if no scene is registered.
18494
+ * @remarks Assigning null or undefined removes the first scene.
18495
+ * @deprecated Please use `scenes` instead.
18491
18496
  */ function get() {
18492
18497
  return this._scenes.getArray()[0];
18493
18498
  },
@@ -19059,7 +19064,7 @@ var MultiExecutor = /*#__PURE__*/ function() {
19059
19064
  };
19060
19065
  _proto._parseURL = function _parseURL(path) {
19061
19066
  var _path_split = path.split("?"), baseUrl = _path_split[0], searchStr = _path_split[1];
19062
- var queryPath = undefined;
19067
+ var queryPath;
19063
19068
  var assetBaseURL = baseUrl;
19064
19069
  if (searchStr) {
19065
19070
  var params = searchStr.split("&");
@@ -21471,7 +21476,7 @@ __decorate([
21471
21476
  if (!shape) {
21472
21477
  return false;
21473
21478
  }
21474
- return shape.collider.collisionLayer & mask && shape.isSceneQuery;
21479
+ return (shape.collider.collisionLayer & mask) !== 0 && shape.isSceneQuery;
21475
21480
  };
21476
21481
  };
21477
21482
  _proto._createHitCallback = function _createHitCallback(outHitResult) {
@@ -24257,7 +24262,7 @@ Sky._projectionMatrix = new engineMath.Matrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, Sky.
24257
24262
  * @internal
24258
24263
  */ _proto._resizeBackgroundTexture = function _resizeBackgroundTexture() {
24259
24264
  var _this = this, texture = _this._texture, mesh = _this._mesh;
24260
- if (!this._texture) {
24265
+ if (!texture) {
24261
24266
  return;
24262
24267
  }
24263
24268
  var _this__engine_canvas = this._engine.canvas, width = _this__engine_canvas.width, height = _this__engine_canvas.height;
@@ -25253,7 +25258,8 @@ exports.Camera = __decorate([
25253
25258
  _proto.onRender = function onRender(context) {
25254
25259
  var engine = this.engine;
25255
25260
  var camera = context.camera;
25256
- camera.viewport; var scene = camera.scene, pixelViewport = camera.pixelViewport;
25261
+ camera.viewport; var pixelViewport = camera.pixelViewport;
25262
+ var scene = camera.scene;
25257
25263
  var ambientOcclusion = scene.ambientOcclusion;
25258
25264
  var shaderData = this._material.shaderData;
25259
25265
  var projectionMatrix = context.projectionMatrix;
@@ -25282,7 +25288,8 @@ exports.Camera = __decorate([
25282
25288
  var farPlaneOverEdgeDistance = -camera.farClipPlane / ambientOcclusion.bilateralThreshold;
25283
25289
  shaderData.setFloat(ScalableAmbientObscurancePass._projectionScaleRadiusProp, radius * projectionScale);
25284
25290
  shaderData.setFloat(ScalableAmbientObscurancePass._farPlaneOverEdgeDistanceProp, farPlaneOverEdgeDistance);
25285
- var _this = this, saoTarget = _this._saoRenderTarget, material = _this._material;
25291
+ var _this = this, material = _this._material;
25292
+ var saoTarget = this._saoRenderTarget;
25286
25293
  // Draw ambient occlusion texture
25287
25294
  var sourceTexture = this._depthRenderTarget.depthTexture;
25288
25295
  Blitter.blitTexture(engine, sourceTexture, saoTarget, 0, undefined, material, 0);
@@ -25386,7 +25393,7 @@ ScalableAmbientObscurancePass._kernelProp = ShaderProperty.getByName("material_k
25386
25393
  /**
25387
25394
  * Get the PostProcessEffect by type.
25388
25395
  * @param type - The type of PostProcessEffect
25389
- * @returns The PostProcessEffect found
25396
+ * @returns The effect, or `undefined` if none matches.
25390
25397
  */ _proto.getEffect = function getEffect(type) {
25391
25398
  var effects = this._effects;
25392
25399
  var length = effects.length;
@@ -25401,7 +25408,7 @@ ScalableAmbientObscurancePass._kernelProp = ShaderProperty.getByName("material_k
25401
25408
  * Add a PostProcessEffect to the PostProcess.
25402
25409
  * @remarks Only one effect of the same type can be added to the PostProcess.
25403
25410
  * @param type - The type of PostProcessEffect
25404
- * @returns The PostProcessEffect added
25411
+ * @returns The added effect, or `undefined` if the type already exists.
25405
25412
  */ _proto.addEffect = function addEffect(type) {
25406
25413
  if (this.getEffect(type)) {
25407
25414
  Logger.error('effect "' + type.name + '" already exists in the PostProcess.');
@@ -25414,7 +25421,7 @@ ScalableAmbientObscurancePass._kernelProp = ShaderProperty.getByName("material_k
25414
25421
  /**
25415
25422
  * Remove a PostProcessEffect from the PostProcess.
25416
25423
  * @param type - The type of PostProcessEffect
25417
- * @returns The PostProcessEffect removed
25424
+ * @returns The removed effect, or `undefined` if none matches.
25418
25425
  */ _proto.removeEffect = function removeEffect(type) {
25419
25426
  var effects = this._effects;
25420
25427
  var length = effects.length;
@@ -25776,7 +25783,8 @@ PostProcessManager._tempVector3 = new engineMath.Vector3();
25776
25783
  if (length === 0) {
25777
25784
  return;
25778
25785
  }
25779
- var _context_camera = context.camera, engine = _context_camera.engine, scene = _context_camera.scene, cameraId = _context_camera.instanceId, cameraData = _context_camera.shaderData;
25786
+ var _context_camera = context.camera, engine = _context_camera.engine, cameraId = _context_camera.instanceId, cameraData = _context_camera.shaderData;
25787
+ var scene = context.camera.scene;
25780
25788
  var sceneId = scene.instanceId, sceneData = scene.shaderData, maskManager = scene._maskManager;
25781
25789
  var renderCount = engine._renderCount;
25782
25790
  var rhi = engine._hardwareRenderer;
@@ -26822,7 +26830,8 @@ CascadedShadowCasterPass._tempMatrix0 = new engineMath.Matrix();
26822
26830
  */ _proto.render = function render(context, cubeFace, mipLevel, ignoreClear) {
26823
26831
  this._cullingResults.setRenderUpdateFlagTrue(ContextRendererUpdateFlag.All);
26824
26832
  var camera = this._camera;
26825
- var scene = camera.scene, engine = camera.engine, renderTarget = camera.renderTarget;
26833
+ var engine = camera.engine, renderTarget = camera.renderTarget;
26834
+ var scene = camera.scene;
26826
26835
  var independentCanvasEnabled = camera._isIndependentCanvasEnabled();
26827
26836
  var rhi = engine._hardwareRenderer;
26828
26837
  var cullingResults = this._cullingResults;
@@ -26908,7 +26917,8 @@ CascadedShadowCasterPass._tempMatrix0 = new engineMath.Matrix();
26908
26917
  _proto._drawRenderPass = function _drawRenderPass(context, camera, finalClearFlags, cubeFace, mipLevel) {
26909
26918
  var cullingResults = this._cullingResults;
26910
26919
  var opaqueQueue = cullingResults.opaqueQueue, alphaTestQueue = cullingResults.alphaTestQueue, transparentQueue = cullingResults.transparentQueue;
26911
- var engine = camera.engine, scene = camera.scene, cameraRenderTarget = camera.renderTarget;
26920
+ var engine = camera.engine, cameraRenderTarget = camera.renderTarget;
26921
+ var scene = camera.scene;
26912
26922
  var background = scene.background;
26913
26923
  var rhi = engine._hardwareRenderer;
26914
26924
  var internalColorTarget = this._internalColorTarget;
@@ -27582,7 +27592,7 @@ var OverlayCamera = function OverlayCamera() {
27582
27592
  shaderCompiler._setIncludeMap(ShaderFactory.includeMap);
27583
27593
  Shader._shaderCompiler = shaderCompiler;
27584
27594
  }
27585
- var initializePromises = new Array();
27595
+ var initializePromises = [];
27586
27596
  if (physics) {
27587
27597
  initializePromises.push(physics.initialize().then(function() {
27588
27598
  if (Engine._nativePhysics) {
@@ -29077,42 +29087,43 @@ AmbientOcclusion._enableMacro = ShaderMacro.getByName("SCENE_ENABLE_AMBIENT_OCCL
29077
29087
  index = undefined;
29078
29088
  entity = indexOrChild;
29079
29089
  }
29080
- var isRoot = entity._isRoot;
29081
- // Let entity become root
29090
+ var rootEntity = entity;
29091
+ var isRoot = rootEntity._isRoot;
29092
+ // Let rootEntity become root
29082
29093
  if (!isRoot) {
29083
- entity._isRoot = true;
29084
- entity._removeFromParent();
29085
- entity._setParentChange();
29094
+ rootEntity._isRoot = true;
29095
+ rootEntity._removeFromParent();
29096
+ rootEntity._setParentChange();
29086
29097
  }
29087
29098
  // Add or remove from scene's rootEntities
29088
- var oldScene = entity._scene;
29099
+ var oldScene = rootEntity._scene;
29089
29100
  if (oldScene !== this) {
29090
29101
  if (oldScene && isRoot) {
29091
- Entity._removeFromChildren(oldScene._rootEntities, entity);
29102
+ Entity._removeFromChildren(oldScene._rootEntities, rootEntity);
29092
29103
  }
29093
- Entity._addToChildren(this._rootEntities, entity, index);
29104
+ Entity._addToChildren(this._rootEntities, rootEntity, index);
29094
29105
  } else if (!isRoot) {
29095
- Entity._addToChildren(this._rootEntities, entity, index);
29106
+ Entity._addToChildren(this._rootEntities, rootEntity, index);
29096
29107
  }
29097
- // Process entity active/inActive
29108
+ // Process rootEntity active/inActive
29098
29109
  var inActiveChangeFlag = ActiveChangeFlag.None;
29099
- if (entity._isActiveInHierarchy) {
29110
+ if (rootEntity._isActiveInHierarchy) {
29100
29111
  this._isActiveInEngine || (inActiveChangeFlag |= ActiveChangeFlag.Hierarchy);
29101
29112
  }
29102
29113
  // Cross scene should inActive first and then active
29103
- entity._isActiveInScene && oldScene !== this && (inActiveChangeFlag |= ActiveChangeFlag.Scene);
29104
- inActiveChangeFlag && entity._processInActive(inActiveChangeFlag);
29114
+ rootEntity._isActiveInScene && oldScene !== this && (inActiveChangeFlag |= ActiveChangeFlag.Scene);
29115
+ inActiveChangeFlag && rootEntity._processInActive(inActiveChangeFlag);
29105
29116
  if (oldScene !== this) {
29106
- Entity._traverseSetOwnerScene(entity, this);
29117
+ Entity._traverseSetOwnerScene(rootEntity, this);
29107
29118
  }
29108
29119
  var activeChangeFlag = ActiveChangeFlag.None;
29109
- if (entity._isActive) {
29120
+ if (rootEntity._isActive) {
29110
29121
  if (this._isActiveInEngine) {
29111
- !entity._isActiveInHierarchy && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
29122
+ !rootEntity._isActiveInHierarchy && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
29112
29123
  }
29113
- (!entity._isActiveInScene || oldScene !== this) && (activeChangeFlag |= ActiveChangeFlag.Scene);
29124
+ (!rootEntity._isActiveInScene || oldScene !== this) && (activeChangeFlag |= ActiveChangeFlag.Scene);
29114
29125
  }
29115
- activeChangeFlag && entity._processActive(activeChangeFlag);
29126
+ activeChangeFlag && rootEntity._processActive(activeChangeFlag);
29116
29127
  };
29117
29128
  /**
29118
29129
  * Remove an entity.
@@ -29129,9 +29140,9 @@ AmbientOcclusion._enableMacro = ShaderMacro.getByName("SCENE_ENABLE_AMBIENT_OCCL
29129
29140
  }
29130
29141
  };
29131
29142
  /**
29132
- * Get root entity from index.
29133
- * @param index - Index
29134
- * @returns Entity
29143
+ * Get a root entity by index.
29144
+ * @param index - The zero-based root entity index
29145
+ * @returns The root entity at the index, or undefined if none exists
29135
29146
  */ _proto.getRootEntity = function getRootEntity(index) {
29136
29147
  if (index === void 0) index = 0;
29137
29148
  return this._rootEntities[index];
@@ -29413,8 +29424,7 @@ AmbientOcclusion._enableMacro = ShaderMacro.getByName("SCENE_ENABLE_AMBIENT_OCCL
29413
29424
  {
29414
29425
  key: "sun",
29415
29426
  get: /**
29416
- * Sun light source.
29417
- * @remarks If set this to null, scene will use the brightest directional light.
29427
+ * The explicit sun light; null or undefined enables automatic selection.
29418
29428
  */ function get() {
29419
29429
  return this._sun;
29420
29430
  },
@@ -32390,7 +32400,9 @@ var AnimatorLayerBlendingMode = /*#__PURE__*/ function(AnimatorLayerBlendingMode
32390
32400
  }
32391
32401
  };
32392
32402
  _proto._updateCrossFadeState = function _updateCrossFadeState(layerData, weight, additive, deltaTime, aniUpdate) {
32393
- var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData, layerIndex = layerData.layerIndex;
32403
+ var layerIndex = layerData.layerIndex;
32404
+ var srcPlayData = layerData.srcPlayData;
32405
+ var destPlayData = layerData.destPlayData;
32394
32406
  var speed = this.speed;
32395
32407
  var srcState = srcPlayData.state;
32396
32408
  var destState = destPlayData.state;
@@ -32845,7 +32857,8 @@ var AnimatorLayerBlendingMode = /*#__PURE__*/ function(AnimatorLayerBlendingMode
32845
32857
  var eventIndex = playState.currentEventIndex;
32846
32858
  for(var n = eventHandlers.length; eventIndex < n; eventIndex++){
32847
32859
  var eventHandler = eventHandlers[eventIndex];
32848
- var _eventHandler_event = eventHandler.event, time = _eventHandler_event.time, parameter = _eventHandler_event.parameter;
32860
+ var parameter = eventHandler.event.parameter;
32861
+ var time = eventHandler.event.time;
32849
32862
  if (time > curClipTime) {
32850
32863
  break;
32851
32864
  }
@@ -32864,7 +32877,8 @@ var AnimatorLayerBlendingMode = /*#__PURE__*/ function(AnimatorLayerBlendingMode
32864
32877
  var eventIndex = playState.currentEventIndex;
32865
32878
  for(; eventIndex >= 0; eventIndex--){
32866
32879
  var eventHandler = eventHandlers[eventIndex];
32867
- var _eventHandler_event = eventHandler.event, time = _eventHandler_event.time, parameter = _eventHandler_event.parameter;
32880
+ var parameter = eventHandler.event.parameter;
32881
+ var time = eventHandler.event.time;
32868
32882
  if (time < curClipTime) {
32869
32883
  break;
32870
32884
  }
@@ -35604,8 +35618,8 @@ CustomDataModule._zeroVector4 = new engineMath.Vector4(0, 0, 0, 0);
35604
35618
  this._updateManager.removeListener(listener);
35605
35619
  };
35606
35620
  _proto._getKeyMinMax = function _getKeyMinMax(keys, out) {
35607
- var min = undefined;
35608
- var max = undefined;
35621
+ var min;
35622
+ var max;
35609
35623
  var _keys_length;
35610
35624
  var count = (_keys_length = keys == null ? void 0 : keys.length) != null ? _keys_length : 0;
35611
35625
  if (count > 0) {
@@ -39935,7 +39949,6 @@ __decorate([
39935
39949
  out.z = out.z * range;
39936
39950
  };
39937
39951
  ShapeUtils._randomPointInsideHalfUnitBox = function _randomPointInsideHalfUnitBox(out, rand) {
39938
- if (rand === void 0) rand = null;
39939
39952
  out.x = rand.random() - 0.5;
39940
39953
  out.y = rand.random() - 0.5;
39941
39954
  out.z = rand.random() - 0.5;
@@ -40363,7 +40376,9 @@ __decorate([
40363
40376
  /**
40364
40377
  * @internal
40365
40378
  */ _proto._generateLocalPositionAndDirection = function _generateLocalPositionAndDirection(rand, emitTime, position, direction) {
40366
- var _this = this, positions = _this._positionBuffer, positionInfo = _this._positionElementInfo, normals = _this._normalBuffer, normalInfo = _this._normalElementInfo;
40379
+ var _this = this, optionalPositions = _this._positionBuffer, positionInfo = _this._positionElementInfo, optionalNormals = _this._normalBuffer, normalInfo = _this._normalElementInfo;
40380
+ var positions = optionalPositions;
40381
+ var normals = optionalNormals;
40367
40382
  var randomIndex = Math.floor(rand.random() * this._mesh.vertexCount);
40368
40383
  // index = randomIndex * stride + offset
40369
40384
  var positionIndex = randomIndex * positionInfo.y + positionInfo.x;