@galacean/engine-core 1.1.0-alpha.1 → 1.1.0-alpha.2

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 (145) hide show
  1. package/dist/main.js +93 -31
  2. package/dist/main.js.map +1 -1
  3. package/dist/miniprogram.js +93 -31
  4. package/dist/module.js +93 -31
  5. package/dist/module.js.map +1 -1
  6. package/package.json +3 -3
  7. package/types/RenderPipeline/MeshRenderElement.d.ts +1 -3
  8. package/types/RenderPipeline/RenderElementX.d.ts +12 -0
  9. package/types/RenderPipeline/SpriteElement.d.ts +1 -3
  10. package/types/RenderPipeline/SpriteMaskElement.d.ts +1 -3
  11. package/types/RenderPipeline/TextRenderElement.d.ts +1 -3
  12. package/types/SafeLoopArray.d.ts +37 -0
  13. package/types/Ticker.d.ts +30 -0
  14. package/types/Transform.d.ts +1 -0
  15. package/types/animation/internal/AnimationCurveOwnerLayerData.d.ts +1 -0
  16. package/types/asset/Loader.d.ts +1 -1
  17. package/types/asset/ResourceManager.d.ts +8 -0
  18. package/types/graphic/Primitive.d.ts +1 -0
  19. package/types/graphic/PrimitiveVertexBinding.d.ts +1 -0
  20. package/types/graphic/SubPrimitive.d.ts +9 -0
  21. package/types/index.d.ts +1 -1
  22. package/types/particle/ParticleBufferUtils.d.ts +1 -0
  23. package/types/particle/ParticleData.d.ts +1 -0
  24. package/types/particle/ParticleGenerator.d.ts +72 -0
  25. package/types/particle/ParticleMaterial.d.ts +28 -0
  26. package/types/particle/ParticleMesh.d.ts +289 -0
  27. package/types/particle/ParticleShaderDeclaration.d.ts +1 -0
  28. package/types/particle/ParticleShaderMacro.d.ts +1 -0
  29. package/types/particle/ParticleShaderProperty.d.ts +1 -0
  30. package/types/particle/ParticleSystem.d.ts +41 -0
  31. package/types/particle/ParticleVertexElements.d.ts +1 -0
  32. package/types/particle/ParticleVertexUtils.d.ts +1 -0
  33. package/types/particle/enum/ParticleAnimationRowMode.d.ts +9 -0
  34. package/types/particle/enum/ParticleAnimationType.d.ts +9 -0
  35. package/types/particle/enum/ParticleCurveMode.d.ts +13 -0
  36. package/types/particle/enum/ParticleGradientMode.d.ts +13 -0
  37. package/types/particle/enum/ParticleRenderMode.d.ts +17 -0
  38. package/types/particle/enum/ParticleScaleMode.d.ts +11 -0
  39. package/types/particle/enum/ParticleShapeMultiModeValue.d.ts +9 -0
  40. package/types/particle/enum/ParticleShapeType.d.ts +15 -0
  41. package/types/particle/enum/ParticleSimulationSpace.d.ts +9 -0
  42. package/types/particle/enum/index.d.ts +9 -0
  43. package/types/particle/enums/ParticleCurveMode.d.ts +9 -0
  44. package/types/particle/enums/ParticleGradientMode.d.ts +9 -0
  45. package/types/particle/enums/ParticleRandomSubSeeds.d.ts +1 -0
  46. package/types/particle/enums/ParticleRenderMode.d.ts +17 -0
  47. package/types/particle/enums/ParticleScaleMode.d.ts +11 -0
  48. package/types/particle/enums/ParticleSimulationSpace.d.ts +9 -0
  49. package/types/particle/enums/ParticleStopMode.d.ts +6 -0
  50. package/types/particle/enums/attributes/BillboardParticleVertexAttribute.d.ts +1 -0
  51. package/types/particle/enums/attributes/MeshParticleVertexAttribute.d.ts +5 -0
  52. package/types/particle/enums/attributes/ParticleInstanceVertexAttribute.d.ts +1 -0
  53. package/types/particle/module/Burst.d.ts +38 -0
  54. package/types/particle/module/ColorGradient.d.ts +75 -0
  55. package/types/particle/module/ColorOverLifetimeModule.d.ts +20 -0
  56. package/types/particle/module/EmissionModule.d.ts +63 -0
  57. package/types/particle/module/FrameOverTime.d.ts +73 -0
  58. package/types/particle/module/ParticleCurve.d.ts +37 -0
  59. package/types/particle/module/RotationOverLifetimeModule.d.ts +21 -0
  60. package/types/particle/module/RotationVelocityGradient.d.ts +184 -0
  61. package/types/particle/module/SizeGradient.d.ts +151 -0
  62. package/types/particle/module/SizeOverLifetimeModule.d.ts +21 -0
  63. package/types/particle/module/StartFrame.d.ts +46 -0
  64. package/types/particle/module/TextureSheetAnimationModule.d.ts +37 -0
  65. package/types/particle/module/VelocityGradient.d.ts +110 -0
  66. package/types/particle/module/VelocityOverLifetimeModule.d.ts +22 -0
  67. package/types/particle/module/index.d.ts +15 -0
  68. package/types/particle/module/shape/BaseShape.d.ts +26 -0
  69. package/types/particle/module/shape/BoxShape.d.ts +20 -0
  70. package/types/particle/module/shape/CircleShape.d.ts +27 -0
  71. package/types/particle/module/shape/ConeShape.d.ts +35 -0
  72. package/types/particle/module/shape/HemisphereShape.d.ts +23 -0
  73. package/types/particle/module/shape/ShapeUtils.d.ts +1 -0
  74. package/types/particle/module/shape/SphereShape.d.ts +23 -0
  75. package/types/particle/module/shape/index.d.ts +5 -0
  76. package/types/particle/modules/Burst.d.ts +14 -0
  77. package/types/particle/modules/ColorOverLifetimeModule.d.ts +20 -0
  78. package/types/particle/modules/EmissionModule.d.ts +45 -0
  79. package/types/particle/modules/MainModule.d.ts +68 -0
  80. package/types/particle/modules/ParticleCompositeCurve.d.ts +56 -0
  81. package/types/particle/modules/ParticleCompositeGradient.d.ts +55 -0
  82. package/types/particle/modules/ParticleCurve.d.ts +56 -0
  83. package/types/particle/modules/ParticleGeneratorModule.d.ts +12 -0
  84. package/types/particle/modules/ParticleGradient.d.ts +94 -0
  85. package/types/particle/modules/RotationOverLifetimeModule.d.ts +34 -0
  86. package/types/particle/modules/ShapeModule.d.ts +9 -0
  87. package/types/particle/modules/SizeOverLifetimeModule.d.ts +34 -0
  88. package/types/particle/modules/TextureSheetAnimationModule.d.ts +42 -0
  89. package/types/particle/modules/VelocityOverLifetimeModule.d.ts +34 -0
  90. package/types/particle/modules/shape/BaseShape.d.ts +12 -0
  91. package/types/particle/modules/shape/BoxShape.d.ts +11 -0
  92. package/types/particle/modules/shape/CircleShape.d.ts +17 -0
  93. package/types/particle/modules/shape/ConeShape.d.ts +28 -0
  94. package/types/particle/modules/shape/HemisphereShape.d.ts +9 -0
  95. package/types/particle/modules/shape/ShapeUtils.d.ts +1 -0
  96. package/types/particle/modules/shape/SphereShape.d.ts +9 -0
  97. package/types/particle/modules/shape/enums/ParticleShapeArcMode.d.ts +9 -0
  98. package/types/particle/modules/shape/enums/ParticleShapeMultiModeValue.d.ts +9 -0
  99. package/types/particle/modules/shape/enums/ParticleShapeType.d.ts +15 -0
  100. package/types/particle/modules/shape/index.d.ts +6 -0
  101. package/types/particle/moudules/Burst.d.ts +25 -0
  102. package/types/particle/moudules/Emission.d.ts +47 -0
  103. package/types/particle/moudules/EmissionModule.d.ts +49 -0
  104. package/types/particle/moudules/MainModule.d.ts +59 -0
  105. package/types/particle/moudules/ParticleCurve.d.ts +27 -0
  106. package/types/particle/moudules/ParticleGradient.d.ts +28 -0
  107. package/types/particle/moudules/ShapeModule.d.ts +7 -0
  108. package/types/particle/moudules/shape/BaseShape.d.ts +28 -0
  109. package/types/particle/moudules/shape/BoxShape.d.ts +20 -0
  110. package/types/particle/moudules/shape/CircleShape.d.ts +27 -0
  111. package/types/particle/moudules/shape/ConeShape.d.ts +35 -0
  112. package/types/particle/moudules/shape/HemisphereShape.d.ts +23 -0
  113. package/types/particle/moudules/shape/ShapeUtils.d.ts +1 -0
  114. package/types/particle/moudules/shape/SphereShape.d.ts +23 -0
  115. package/types/particle/moudules/shape/enums/ParticleShapeMultiModeValue.d.ts +9 -0
  116. package/types/particle/moudules/shape/enums/ParticleShapeType.d.ts +15 -0
  117. package/types/particle/moudules/shape/index.d.ts +5 -0
  118. package/types/physics/PhysicsScene.d.ts +6 -2
  119. package/types/shaderlib/particle/index.d.ts +14 -0
  120. package/types/shadow/PipelinePass.d.ts +16 -0
  121. package/types/utils/BoolUpdateFlag.d.ts +12 -0
  122. package/types/utils/DisorderedArray.d.ts +18 -0
  123. package/types/utils/UpdateFlag.d.ts +20 -0
  124. package/types/utils/UpdateFlagManager.d.ts +1 -0
  125. package/types/utils/Utils.d.ts +31 -0
  126. package/types/xr/XRManager.d.ts +31 -0
  127. package/types/xr/component/XRPoseDriver.d.ts +10 -0
  128. package/types/xr/data/XRCamera.d.ts +6 -0
  129. package/types/xr/data/XRDevice.d.ts +9 -0
  130. package/types/xr/data/XRHandle.d.ts +10 -0
  131. package/types/xr/enum/EnumXRButton.d.ts +5 -0
  132. package/types/xr/enum/EnumXRDevicePhase.d.ts +4 -0
  133. package/types/xr/enum/EnumXRFeature.d.ts +9 -0
  134. package/types/xr/enum/EnumXRInputSource.d.ts +8 -0
  135. package/types/xr/enum/EnumXRMode.d.ts +7 -0
  136. package/types/xr/enum/EnumXRSubsystem.d.ts +4 -0
  137. package/types/xr/enum/EnumXRTrackingMode.d.ts +7 -0
  138. package/types/xr/feature/XRCameraManager.d.ts +21 -0
  139. package/types/xr/feature/XRFeature.d.ts +29 -0
  140. package/types/xr/feature/XRImageTrackManager.d.ts +10 -0
  141. package/types/xr/feature/XRInputManager.d.ts +16 -0
  142. package/types/xr/index.d.ts +18 -0
  143. package/types/xr/provider/XRProvider.d.ts +19 -0
  144. package/types/xr/subsystem/XRInputSubsystem.d.ts +5 -0
  145. package/types/xr/subsystem/XRSubsystem.d.ts +30 -0
package/dist/main.js CHANGED
@@ -3286,6 +3286,23 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
3286
3286
  scale.z < 0 && (isInvert = !isInvert);
3287
3287
  return isInvert;
3288
3288
  };
3289
+ _proto._onDestroy = function _onDestroy() {
3290
+ Component.prototype._onDestroy.call(this);
3291
+ //@ts-ignore
3292
+ this._worldPosition._onValueChanged = null;
3293
+ //@ts-ignore
3294
+ this._rotation._onValueChanged = null;
3295
+ //@ts-ignore
3296
+ this._worldRotation._onValueChanged = null;
3297
+ //@ts-ignore
3298
+ this._rotationQuaternion._onValueChanged = null;
3299
+ //@ts-ignore
3300
+ this._worldRotationQuaternion._onValueChanged = null;
3301
+ //@ts-ignore
3302
+ this._position._onValueChanged = null;
3303
+ //@ts-ignore
3304
+ this._scale._onValueChanged = null;
3305
+ };
3289
3306
  /**
3290
3307
  * Get worldMatrix: Will trigger the worldMatrix update of itself and all parent entities.
3291
3308
  * Get worldPosition: Will trigger the worldMatrix, local position update of itself and the worldMatrix update of all parent entities.
@@ -12546,6 +12563,7 @@ var /** @internal */ PromiseState;
12546
12563
  this._referResourcePool = Object.create(null);
12547
12564
  this._graphicResourcePool = Object.create(null);
12548
12565
  this._contentRestorerPool = Object.create(null);
12566
+ this._subAssetPromiseCallbacks = {};
12549
12567
  this.//-----------------Editor temp solution-----------------
12550
12568
  /** @internal */ _objectPool = Object.create(null);
12551
12569
  this./** @internal */ _editorResourceConfig = Object.create(null);
@@ -12573,6 +12591,21 @@ var /** @internal */ PromiseState;
12573
12591
  return (_this__assetUrlPool_url = this._assetUrlPool[url]) != null ? _this__assetUrlPool_url : null;
12574
12592
  };
12575
12593
  /**
12594
+ * Find the resource by type.
12595
+ * @param type - Resource type
12596
+ * @returns - Resource collection
12597
+ */ _proto.findResourcesByType = function findResourcesByType(type) {
12598
+ var resources = new Array();
12599
+ var referResourcePool = this._referResourcePool;
12600
+ for(var k in referResourcePool){
12601
+ var resource = referResourcePool[k];
12602
+ if (_instanceof(resource, type)) {
12603
+ resources.push(resource);
12604
+ }
12605
+ }
12606
+ return resources;
12607
+ };
12608
+ /**
12576
12609
  * Get asset url from instanceId.
12577
12610
  * @param instanceId - Engine instance id
12578
12611
  * @returns Asset url
@@ -12610,6 +12643,20 @@ var /** @internal */ PromiseState;
12610
12643
  };
12611
12644
  /**
12612
12645
  * @internal
12646
+ */ _proto._onSubAssetSuccess = function _onSubAssetSuccess(assetURL, value) {
12647
+ var _this__subAssetPromiseCallbacks_assetURL;
12648
+ (_this__subAssetPromiseCallbacks_assetURL = this._subAssetPromiseCallbacks[assetURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetURL.resolve(value);
12649
+ delete this._subAssetPromiseCallbacks[assetURL];
12650
+ };
12651
+ /**
12652
+ * @internal
12653
+ */ _proto._onSubAssetFail = function _onSubAssetFail(assetURL, value) {
12654
+ var _this__subAssetPromiseCallbacks_assetURL;
12655
+ (_this__subAssetPromiseCallbacks_assetURL = this._subAssetPromiseCallbacks[assetURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetURL.reject(value);
12656
+ delete this._subAssetPromiseCallbacks[assetURL];
12657
+ };
12658
+ /**
12659
+ * @internal
12613
12660
  */ _proto._addAsset = function _addAsset(path, asset) {
12614
12661
  this._assetPool[asset.instanceId] = path;
12615
12662
  this._assetUrlPool[path] = asset;
@@ -12719,6 +12766,10 @@ var /** @internal */ PromiseState;
12719
12766
  var assetURL = assetBaseURL;
12720
12767
  if (queryPath) {
12721
12768
  assetURL += "?q=" + paths.shift();
12769
+ var index;
12770
+ while(index = paths.shift()){
12771
+ assetURL += "[" + index + "]";
12772
+ }
12722
12773
  }
12723
12774
  // Check is loading
12724
12775
  var loadingPromises = this._loadingPromises;
@@ -12726,7 +12777,7 @@ var /** @internal */ PromiseState;
12726
12777
  if (loadingPromise) {
12727
12778
  return new AssetPromise(function(resolve, reject) {
12728
12779
  loadingPromise.then(function(resource) {
12729
- resolve(_this._getResolveResource(resource, paths));
12780
+ resolve(resource);
12730
12781
  }).catch(function(error) {
12731
12782
  reject(error);
12732
12783
  });
@@ -12740,38 +12791,37 @@ var /** @internal */ PromiseState;
12740
12791
  // Load asset
12741
12792
  item.url = assetBaseURL;
12742
12793
  var promise = loader.load(item, this);
12743
- if (_instanceof(promise, AssetPromise)) {
12744
- loadingPromises[assetBaseURL] = promise;
12745
- promise.then(function(resource) {
12746
- if (loader.useCache) {
12747
- _this._addAsset(assetBaseURL, resource);
12748
- }
12749
- delete loadingPromises[assetBaseURL];
12794
+ loadingPromises[assetBaseURL] = promise;
12795
+ promise.then(function(resource) {
12796
+ if (loader.useCache) {
12797
+ _this._addAsset(assetBaseURL, resource);
12798
+ }
12799
+ delete loadingPromises[assetBaseURL];
12800
+ }, function() {
12801
+ return delete loadingPromises[assetBaseURL];
12802
+ });
12803
+ if (queryPath) {
12804
+ var subPromise = new AssetPromise(function(resolve, reject) {
12805
+ _this._pushSubAssetPromiseCallback(assetURL, resolve, reject);
12806
+ });
12807
+ loadingPromises[assetURL] = subPromise;
12808
+ subPromise.then(function() {
12809
+ delete loadingPromises[assetURL];
12750
12810
  }, function() {
12751
- return delete loadingPromises[assetBaseURL];
12811
+ return delete loadingPromises[assetURL];
12752
12812
  });
12753
- return promise;
12754
- } else {
12755
- var _loop = function(subURL) {
12756
- var subPromise = promise[subURL];
12757
- var isMaster = assetBaseURL === subURL;
12758
- loadingPromises[subURL] = subPromise;
12759
- subPromise.then(function(resource) {
12760
- if (isMaster) {
12761
- if (loader.useCache) {
12762
- _this._addAsset(subURL, resource);
12763
- for(var k in promise)delete loadingPromises[k];
12764
- }
12765
- }
12766
- }, function() {
12767
- for(var k in promise)delete loadingPromises[k];
12768
- });
12769
- };
12770
- for(var subURL in promise)_loop(subURL);
12771
- return promise[assetURL].then(function(resource) {
12772
- return _this._getResolveResource(resource, paths);
12813
+ promise.catch(function(e) {
12814
+ _this._onSubAssetFail(assetURL, e);
12773
12815
  });
12816
+ return subPromise;
12774
12817
  }
12818
+ return promise;
12819
+ };
12820
+ _proto._pushSubAssetPromiseCallback = function _pushSubAssetPromiseCallback(assetURL, resolve, reject) {
12821
+ this._subAssetPromiseCallbacks[assetURL] = {
12822
+ resolve: resolve,
12823
+ reject: reject
12824
+ };
12775
12825
  };
12776
12826
  _proto._gc = function _gc(forceDestroy) {
12777
12827
  var objects = Utils.objectValues(this._referResourcePool);
@@ -13581,6 +13631,7 @@ var Collision = function Collision() {
13581
13631
  function PhysicsScene(scene) {
13582
13632
  var _this = this;
13583
13633
  this._restTime = 0;
13634
+ this._fixedTimeStep = 1 / 60;
13584
13635
  this._colliders = new DisorderedArray();
13585
13636
  this._gravity = new engineMath.Vector3(0, -9.81, 0);
13586
13637
  this._onContactEnter = function(obj1, obj2) {
@@ -13697,7 +13748,6 @@ var Collision = function Collision() {
13697
13748
  script1._waitHandlingInValid || script1.onTriggerStay(shape1);
13698
13749
  }
13699
13750
  };
13700
- /** The fixed time step in seconds at which physics are performed. */ this.fixedTimeStep = 1 / 60;
13701
13751
  this._scene = scene;
13702
13752
  this._setGravity = this._setGravity.bind(this);
13703
13753
  //@ts-ignore
@@ -13754,7 +13804,7 @@ var Collision = function Collision() {
13754
13804
  * Call on every frame to update pose of objects.
13755
13805
  * @internal
13756
13806
  */ _proto._update = function _update(deltaTime) {
13757
- var _this = this, fixedTimeStep = _this.fixedTimeStep, nativePhysicsManager = _this._nativePhysicsScene;
13807
+ var _this = this, fixedTimeStep = _this._fixedTimeStep, nativePhysicsManager = _this._nativePhysicsScene;
13758
13808
  var componentsManager = this._scene._componentsManager;
13759
13809
  var simulateTime = this._restTime + deltaTime;
13760
13810
  var step = Math.floor(simulateTime / fixedTimeStep);
@@ -13862,6 +13912,17 @@ var Collision = function Collision() {
13862
13912
  gravity.copyFrom(value);
13863
13913
  }
13864
13914
  }
13915
+ },
13916
+ {
13917
+ key: "fixedTimeStep",
13918
+ get: /**
13919
+ * The fixed time step in seconds at which physics are performed.
13920
+ */ function get() {
13921
+ return this._fixedTimeStep;
13922
+ },
13923
+ set: function set(value) {
13924
+ this._fixedTimeStep = Math.max(value, engineMath.MathUtil.zeroTolerance);
13925
+ }
13865
13926
  }
13866
13927
  ]);
13867
13928
  return PhysicsScene;
@@ -15735,6 +15796,7 @@ exports.Joint = __decorate([
15735
15796
  CloneManager.deepCloneObject(this.renderStates, target.renderStates);
15736
15797
  };
15737
15798
  _proto._addReferCount = function _addReferCount(value) {
15799
+ if (this._destroyed) return;
15738
15800
  ReferResource.prototype._addReferCount.call(this, value);
15739
15801
  this.shaderData._addReferCount(value);
15740
15802
  };