@galacean/engine 0.0.0-experimental-2.0-game.14 → 0.0.0-experimental-2.0-game.16

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/browser.js CHANGED
@@ -5457,10 +5457,14 @@
5457
5457
  if (_instanceof1$2(sourceProperty, Map) || _instanceof1$2(sourceProperty, Set)) return CloneMode.Deep;
5458
5458
  // Value types with copyFrom (math types like Vector3, Color, etc.)
5459
5459
  if (sourceProperty.copyFrom) return CloneMode.Deep;
5460
- // Plain objects - deep clone (may contain Entity/Component refs)
5461
- if (sourceProperty.constructor === Object) return CloneMode.Deep;
5462
- // Other class instances (engine resources like Material, Texture) - shared reference
5463
- return CloneMode.Assignment;
5460
+ // Engine resources (Material, Texture, Mesh, Shader, ...) refCount-managed,
5461
+ // shared by reference. Anything outside this contract is treated as a value-like
5462
+ // user class and gets a deep clone (so nested Entity/Component refs are remapped).
5463
+ if (_instanceof1$2(sourceProperty, ReferResource)) return CloneMode.Assignment;
5464
+ // Default: deep clone. Covers plain objects {...} and user-defined value classes
5465
+ // (EventHandler, business data containers). Internal Entity/Component refs reach
5466
+ // line 109's _remap branch and are correctly rebound to the target tree.
5467
+ return CloneMode.Deep;
5464
5468
  };
5465
5469
  CloneManager.deepCloneObject = function deepCloneObject(source, target, deepInstanceMap) {
5466
5470
  for(var k in source){
@@ -9620,6 +9624,18 @@
9620
9624
  this.subChunk = subChunk;
9621
9625
  this.instancedRenderers.length = 0;
9622
9626
  };
9627
+ /**
9628
+ * @internal
9629
+ * Copy identity fields from `source` and reset per-queue batch state, so the same
9630
+ * logical element can live in multiple queues (e.g. an Opaque + Transparent multi-pass
9631
+ * material) without one queue's batching corrupting another's `instancedRenderers`.
9632
+ */ _proto._cloneFrom = function _cloneFrom(source) {
9633
+ this.set(source.component, source.material, source.primitive, source.subPrimitive, source.texture, source.subChunk);
9634
+ this.priority = source.priority;
9635
+ this.distanceForSort = source.distanceForSort;
9636
+ this.subShader = source.subShader;
9637
+ this.shaderData = source.shaderData;
9638
+ };
9623
9639
  _proto.dispose = function dispose() {
9624
9640
  this.component = null;
9625
9641
  this.material = null;
@@ -10592,7 +10608,7 @@
10592
10608
  _inherits$2(Transform, Component);
10593
10609
  function Transform(entity) {
10594
10610
  var _this;
10595
- _this = Component.call(this, entity) || this, _this._position = new Vector3(), _this._rotation = new Vector3(), _this._rotationQuaternion = new Quaternion(), _this._scale = new Vector3(1, 1, 1), _this._localUniformScaling = true, _this._worldPosition = new Vector3(), _this._worldRotation = new Vector3(), _this._worldRotationQuaternion = new Quaternion(), _this._worldUniformScaling = true, _this._lossyWorldScale = new Vector3(1, 1, 1), _this._localMatrix = new Matrix(), _this._worldMatrix = new Matrix(), _this._worldForward = null, _this._worldRight = null, _this._worldUp = null, _this._isParentDirty = true, _this._parentTransformCache = null, _this._dirtyFlag = 510;
10611
+ _this = Component.call(this, entity) || this, _this._position = new Vector3(), _this._rotation = new Vector3(), _this._rotationQuaternion = new Quaternion(), _this._scale = new Vector3(1, 1, 1), _this._localUniformScaling = true, _this._worldPosition = new Vector3(), _this._worldRotation = new Vector3(), _this._worldRotationQuaternion = new Quaternion(), _this._worldUniformScaling = true, _this._lossyWorldScale = new Vector3(1, 1, 1), _this._localMatrix = new Matrix(), _this._worldMatrix = new Matrix(), _this._worldForward = null, _this._worldRight = null, _this._worldUp = null, _this._frontFaceInvert = false, _this._isParentDirty = true, _this._parentTransformCache = null, _this._dirtyFlag = 2558;
10596
10612
  _this._onPositionChanged = _this._onPositionChanged.bind(_this);
10597
10613
  _this._onWorldPositionChanged = _this._onWorldPositionChanged.bind(_this);
10598
10614
  _this._onRotationChanged = _this._onRotationChanged.bind(_this);
@@ -10750,7 +10766,7 @@
10750
10766
  // `_getParentTransform` was ever called while their ancestor chain was
10751
10767
  // partially constructed during clone/instantiate). Force them to
10752
10768
  // re-resolve the parent transform on next access.
10753
- this._propagateReparentDirty(444);
10769
+ this._propagateReparentDirty(2492);
10754
10770
  };
10755
10771
  _proto._propagateReparentDirty = function _propagateReparentDirty(flags) {
10756
10772
  this._worldAssociatedChange(flags);
@@ -10766,11 +10782,16 @@
10766
10782
  /**
10767
10783
  * @internal
10768
10784
  */ _proto._isFrontFaceInvert = function _isFrontFaceInvert() {
10769
- var scale = this.lossyWorldScale;
10770
- var isInvert = scale.x < 0;
10771
- scale.y < 0 && (isInvert = !isInvert);
10772
- scale.z < 0 && (isInvert = !isInvert);
10773
- return isInvert;
10785
+ if (this._isContainDirtyFlag(2048)) {
10786
+ var s = this._scale;
10787
+ var invert = s.x < 0;
10788
+ s.y < 0 && (invert = !invert);
10789
+ s.z < 0 && (invert = !invert);
10790
+ var parent = this._getParentTransform();
10791
+ this._frontFaceInvert = parent ? invert !== parent._isFrontFaceInvert() : invert;
10792
+ this._setDirtyFlagFalse(2048);
10793
+ }
10794
+ return this._frontFaceInvert;
10774
10795
  };
10775
10796
  /**
10776
10797
  * @internal
@@ -10793,7 +10814,7 @@
10793
10814
  // the computed value. After this _cloneTo writes new local values, those world-derived caches are stale,
10794
10815
  // so re-dirty them and notify listeners (Collider._updateFlag etc.) so subsequent reads recompute correctly.
10795
10816
  target._setDirtyFlagTrue(2 | 64);
10796
- target._worldAssociatedChange(444);
10817
+ target._worldAssociatedChange(2492);
10797
10818
  };
10798
10819
  _proto._onLocalMatrixChanging = function _onLocalMatrixChanging() {
10799
10820
  this._setDirtyFlagFalse(64);
@@ -10876,10 +10897,10 @@
10876
10897
  */ _proto._updateWorldRotationFlag = function _updateWorldRotationFlag() {
10877
10898
  var parent = this._getParentTransform();
10878
10899
  var parentWorldUniformScaling = parent ? parent._getWorldUniformScaling() : true;
10879
- var flags = parentWorldUniformScaling ? 152 : 184;
10900
+ var flags = parentWorldUniformScaling ? 152 : 2232;
10880
10901
  if (!this._isContainDirtyFlags(flags)) {
10881
10902
  this._worldAssociatedChange(flags);
10882
- flags = this._getWorldUniformScaling() ? 156 : 188;
10903
+ flags = this._getWorldUniformScaling() ? 156 : 2236;
10883
10904
  var children = this._entity._children;
10884
10905
  for(var i = 0, n = children.length; i < n; i++){
10885
10906
  var _children_i_transform;
@@ -10898,7 +10919,7 @@
10898
10919
  */ _proto._updateWorldPositionAndRotationFlag = function _updateWorldPositionAndRotationFlag(flags) {
10899
10920
  if (!this._isContainDirtyFlags(flags)) {
10900
10921
  this._worldAssociatedChange(flags);
10901
- flags = this._getWorldUniformScaling() ? 156 : 188;
10922
+ flags = this._getWorldUniformScaling() ? 156 : 2236;
10902
10923
  var children = this._entity._children;
10903
10924
  for(var i = 0, n = children.length; i < n; i++){
10904
10925
  var _children_i_transform;
@@ -11020,9 +11041,9 @@
11020
11041
  var localUniformScaling = x == y && y == z;
11021
11042
  if (this._localUniformScaling !== localUniformScaling) {
11022
11043
  this._localUniformScaling = localUniformScaling;
11023
- this._updateWorldScaleFlag(416);
11044
+ this._updateWorldScaleFlag(2464);
11024
11045
  } else {
11025
- this._updateWorldScaleFlag(160);
11046
+ this._updateWorldScaleFlag(2208);
11026
11047
  }
11027
11048
  };
11028
11049
  _proto._getWorldUniformScaling = function _getWorldUniformScaling() {
@@ -11260,9 +11281,9 @@
11260
11281
  var localUniformScaling = scale.x === scale.y && scale.y === scale.z;
11261
11282
  if (this._localUniformScaling !== localUniformScaling) {
11262
11283
  this._localUniformScaling = localUniformScaling;
11263
- this._updateAllWorldFlag(444);
11284
+ this._updateAllWorldFlag(2492);
11264
11285
  } else {
11265
- this._updateAllWorldFlag(188);
11286
+ this._updateAllWorldFlag(2236);
11266
11287
  }
11267
11288
  }
11268
11289
  },
@@ -11388,6 +11409,9 @@
11388
11409
  __decorate$1([
11389
11410
  ignoreClone
11390
11411
  ], Transform.prototype, "_worldUp", void 0);
11412
+ __decorate$1([
11413
+ ignoreClone
11414
+ ], Transform.prototype, "_frontFaceInvert", void 0);
11391
11415
  __decorate$1([
11392
11416
  ignoreClone
11393
11417
  ], Transform.prototype, "_isParentDirty", void 0);
@@ -11429,16 +11453,18 @@
11429
11453
  /** This is an internal flag used to assist in determining the dispatch
11430
11454
  * of world scaling dirty flags in the case of non-uniform scaling.
11431
11455
  */ TransformModifyFlags[TransformModifyFlags["IsWorldUniformScaling"] = 256] = "IsWorldUniformScaling";
11456
+ // Note: 0x200 (UITransformModifyFlags.Size) and 0x400 (Pivot) are reserved by UITransform — do not reuse.
11457
+ TransformModifyFlags[TransformModifyFlags["WorldFrontFaceInvert"] = 2048] = "WorldFrontFaceInvert";
11432
11458
  /** WorldMatrix | WorldPosition */ TransformModifyFlags[TransformModifyFlags["WmWp"] = 132] = "WmWp";
11433
11459
  /** WorldMatrix | WorldEuler | WorldQuat */ TransformModifyFlags[TransformModifyFlags["WmWeWq"] = 152] = "WmWeWq";
11434
- /** WorldMatrix | WorldEuler | WorldQuat | WorldScale*/ TransformModifyFlags[TransformModifyFlags["WmWeWqWs"] = 184] = "WmWeWqWs";
11460
+ /** WorldMatrix | WorldEuler | WorldQuat | WorldScale | WorldFrontFaceInvert */ TransformModifyFlags[TransformModifyFlags["WmWeWqWs"] = 2232] = "WmWeWqWs";
11435
11461
  /** WorldMatrix | WorldPosition | WorldEuler | WorldQuat */ TransformModifyFlags[TransformModifyFlags["WmWpWeWq"] = 156] = "WmWpWeWq";
11436
- /** WorldMatrix | WorldScale */ TransformModifyFlags[TransformModifyFlags["WmWs"] = 160] = "WmWs";
11437
- /** WorldMatrix | WorldScale | WorldUniformScaling */ TransformModifyFlags[TransformModifyFlags["WmWsWus"] = 416] = "WmWsWus";
11438
- /** WorldMatrix | WorldPosition | WorldScale */ TransformModifyFlags[TransformModifyFlags["WmWpWs"] = 164] = "WmWpWs";
11439
- /** WorldMatrix | WorldPosition | WorldEuler | WorldQuat | WorldScale */ TransformModifyFlags[TransformModifyFlags["WmWpWeWqWs"] = 188] = "WmWpWeWqWs";
11440
- /** WorldMatrix | WorldPosition | WorldEuler | WorldQuat | WorldScale | WorldUniformScaling */ TransformModifyFlags[TransformModifyFlags["WmWpWeWqWsWus"] = 444] = "WmWpWeWqWsWus";
11441
- /** LocalQuat | LocalMatrix | WorldMatrix | WorldPosition | WorldEuler | WorldQuat | WorldScale | WorldUniformScaling */ TransformModifyFlags[TransformModifyFlags["LqLmWmWpWeWqWsWus"] = 510] = "LqLmWmWpWeWqWsWus";
11462
+ /** WorldMatrix | WorldScale | WorldFrontFaceInvert */ TransformModifyFlags[TransformModifyFlags["WmWs"] = 2208] = "WmWs";
11463
+ /** WorldMatrix | WorldScale | WorldUniformScaling | WorldFrontFaceInvert */ TransformModifyFlags[TransformModifyFlags["WmWsWus"] = 2464] = "WmWsWus";
11464
+ /** WorldMatrix | WorldPosition | WorldScale | WorldFrontFaceInvert */ TransformModifyFlags[TransformModifyFlags["WmWpWs"] = 2212] = "WmWpWs";
11465
+ /** WorldMatrix | WorldPosition | WorldEuler | WorldQuat | WorldScale | WorldFrontFaceInvert */ TransformModifyFlags[TransformModifyFlags["WmWpWeWqWs"] = 2236] = "WmWpWeWqWs";
11466
+ /** WorldMatrix | WorldPosition | WorldEuler | WorldQuat | WorldScale | WorldUniformScaling | WorldFrontFaceInvert */ TransformModifyFlags[TransformModifyFlags["WmWpWeWqWsWus"] = 2492] = "WmWpWeWqWsWus";
11467
+ /** LocalQuat | LocalMatrix | WorldMatrix | WorldPosition | WorldEuler | WorldQuat | WorldScale | WorldUniformScaling | WorldFrontFaceInvert */ TransformModifyFlags[TransformModifyFlags["LqLmWmWpWeWqWsWus"] = 2558] = "LqLmWmWpWeWqWsWus";
11442
11468
  return TransformModifyFlags;
11443
11469
  }({});
11444
11470
  /**
@@ -11486,6 +11512,12 @@
11486
11512
  function ShaderData(group) {
11487
11513
  /** @internal */ this._propertyValueMap = Object.create(null);
11488
11514
  /** @internal */ this._macroCollection = new ShaderMacroCollection();
11515
+ /**
11516
+ * @internal
11517
+ * Sorted (ascending) property ids of renderer-group samplers and arrays. These values
11518
+ * can't differ across instances inside an instanced draw call — `_canBatch` uses this
11519
+ * list to refuse batching renderers that would disagree on what to bind
11520
+ */ this._instanceBatchFields = [];
11489
11521
  this._macroMap = Object.create(null);
11490
11522
  this._refCount = 0;
11491
11523
  this._group = group;
@@ -11704,7 +11736,52 @@
11704
11736
  throw "Shader property " + property.name + " has been used as " + ShaderPropertyType[property._type] + " type.";
11705
11737
  }
11706
11738
  }
11707
- this._propertyValueMap[property._uniqueId] = value;
11739
+ var id = property._uniqueId;
11740
+ // Track renderer-group samplers/arrays so `_canBatch` can refuse instanced batches
11741
+ // whose leader and follower would disagree on what to bind
11742
+ if (this._group === ShaderDataGroup.Renderer && (type === ShaderPropertyType.Texture || type === ShaderPropertyType.TextureArray || type === ShaderPropertyType.FloatArray || type === ShaderPropertyType.IntArray)) {
11743
+ var oldHas = this._propertyValueMap[id] != null;
11744
+ var newHas = value != null;
11745
+ if (oldHas !== newHas) {
11746
+ var fields = this._instanceBatchFields;
11747
+ if (newHas) {
11748
+ // Insert keeping ascending order so exact compare is index-by-index
11749
+ var lo = 0;
11750
+ var hi = fields.length;
11751
+ while(lo < hi){
11752
+ var mid = lo + hi >>> 1;
11753
+ if (fields[mid] < id) {
11754
+ lo = mid + 1;
11755
+ } else {
11756
+ hi = mid;
11757
+ }
11758
+ }
11759
+ fields.splice(lo, 0, id);
11760
+ } else {
11761
+ fields.splice(fields.indexOf(id), 1);
11762
+ }
11763
+ }
11764
+ }
11765
+ this._propertyValueMap[id] = value;
11766
+ };
11767
+ /**
11768
+ * @internal
11769
+ */ _proto._matchesRendererInstanceBatch = function _matchesRendererInstanceBatch(other) {
11770
+ var selfFields = this._instanceBatchFields;
11771
+ var otherFields = other._instanceBatchFields;
11772
+ var fieldCount = selfFields.length;
11773
+ if (fieldCount !== otherFields.length) {
11774
+ return false;
11775
+ }
11776
+ var selfMap = this._propertyValueMap;
11777
+ var otherMap = other._propertyValueMap;
11778
+ for(var i = 0; i < fieldCount; i++){
11779
+ var id = selfFields[i];
11780
+ if (id !== otherFields[i] || selfMap[id] !== otherMap[id]) {
11781
+ return false;
11782
+ }
11783
+ }
11784
+ return true;
11708
11785
  };
11709
11786
  /**
11710
11787
  * @internal
@@ -11735,6 +11812,9 @@
11735
11812
  __decorate$1([
11736
11813
  ignoreClone
11737
11814
  ], ShaderData.prototype, "_macroCollection", void 0);
11815
+ __decorate$1([
11816
+ ignoreClone
11817
+ ], ShaderData.prototype, "_instanceBatchFields", void 0);
11738
11818
  __decorate$1([
11739
11819
  ignoreClone
11740
11820
  ], ShaderData.prototype, "_macroMap", void 0);
@@ -19293,7 +19373,9 @@
19293
19373
  * @internal
19294
19374
  */ _proto._canBatch = function _canBatch(preElement, curElement) {
19295
19375
  if (!this._engine._hardwareRenderer.isWebGL2) return false;
19296
- return preElement.primitive === curElement.primitive && preElement.subPrimitive === curElement.subPrimitive && preElement.material === curElement.material && this._isFrontFaceInvert() === curElement.component._isFrontFaceInvert() && this.shaderData._macroCollection.isEqual(curElement.component.shaderData._macroCollection);
19376
+ var curShaderData = curElement.component.shaderData;
19377
+ return preElement.primitive === curElement.primitive && preElement.subPrimitive === curElement.subPrimitive && preElement.material === curElement.material && this._isFrontFaceInvert() === curElement.component._isFrontFaceInvert() && this.shaderData._macroCollection.isEqual(curShaderData._macroCollection) && // Renderer-group samplers/arrays are shared across the whole instanced draw call
19378
+ this.shaderData._matchesRendererInstanceBatch(curShaderData);
19297
19379
  };
19298
19380
  /**
19299
19381
  * @internal
@@ -23837,8 +23919,11 @@
23837
23919
  * @internal
23838
23920
  */ var RenderTargetPool = /*#__PURE__*/ function() {
23839
23921
  function RenderTargetPool(engine) {
23922
+ /** Frames an entry may sit idle before `tick()` destroys it. */ this.maxFreeAgeFrames = 60;
23840
23923
  this._freeRenderTargets = [];
23924
+ this._freeRenderTargetFrames = [];
23841
23925
  this._freeTextures = [];
23926
+ this._freeTextureFrames = [];
23842
23927
  this._engine = engine;
23843
23928
  }
23844
23929
  var _proto = RenderTargetPool.prototype;
@@ -23847,8 +23932,7 @@
23847
23932
  for(var i = freeRenderTargets.length - 1; i >= 0; i--){
23848
23933
  var renderTarget = freeRenderTargets[i];
23849
23934
  if (RenderTargetPool._matchRenderTarget(renderTarget, width, height, colorFormat, depthFormat, needDepthTexture, mipmap, isSRGBColorSpace, antiAliasing)) {
23850
- freeRenderTargets[i] = freeRenderTargets[freeRenderTargets.length - 1];
23851
- freeRenderTargets.length--;
23935
+ this._removeFreeRenderTargetAt(i);
23852
23936
  var colorTexture = renderTarget.getColorTexture(0);
23853
23937
  if (colorTexture) {
23854
23938
  colorTexture.wrapModeU = colorTexture.wrapModeV = wrapMode;
@@ -23891,8 +23975,7 @@
23891
23975
  for(var i = freeTextures.length - 1; i >= 0; i--){
23892
23976
  var texture = freeTextures[i];
23893
23977
  if (texture.width === width && texture.height === height && texture.format === format && texture.mipmapCount > 1 === mipmap && texture.isSRGBColorSpace === isSRGBColorSpace) {
23894
- freeTextures[i] = freeTextures[freeTextures.length - 1];
23895
- freeTextures.length--;
23978
+ this._removeFreeTextureAt(i);
23896
23979
  texture.wrapModeU = texture.wrapModeV = wrapMode;
23897
23980
  texture.filterMode = filterMode;
23898
23981
  return texture;
@@ -23907,29 +23990,98 @@
23907
23990
  _proto.freeRenderTarget = function freeRenderTarget(renderTarget) {
23908
23991
  if (!renderTarget || renderTarget.destroyed) return;
23909
23992
  this._freeRenderTargets.push(renderTarget);
23993
+ this._freeRenderTargetFrames.push(this._engine.time.frameCount);
23910
23994
  };
23911
23995
  _proto.freeTexture = function freeTexture(texture) {
23912
23996
  if (!texture || texture.destroyed) return;
23913
23997
  this._freeTextures.push(texture);
23998
+ this._freeTextureFrames.push(this._engine.time.frameCount);
23999
+ };
24000
+ _proto.tick = function tick(currentFrame) {
24001
+ var maxAge = this.maxFreeAgeFrames;
24002
+ var rtFrames = this._freeRenderTargetFrames;
24003
+ for(var i = rtFrames.length - 1; i >= 0; i--){
24004
+ if (currentFrame - rtFrames[i] > maxAge) {
24005
+ this._destroyFreeRenderTargetAt(i);
24006
+ }
24007
+ }
24008
+ var texFrames = this._freeTextureFrames;
24009
+ for(var i1 = texFrames.length - 1; i1 >= 0; i1--){
24010
+ if (currentFrame - texFrames[i1] > maxAge) {
24011
+ this._destroyFreeTextureAt(i1);
24012
+ }
24013
+ }
24014
+ };
24015
+ _proto.evictBySize = function evictBySize(width, height) {
24016
+ var freeRenderTargets = this._freeRenderTargets;
24017
+ for(var i = freeRenderTargets.length - 1; i >= 0; i--){
24018
+ var rt = freeRenderTargets[i];
24019
+ if (rt.width === width && rt.height === height) {
24020
+ this._destroyFreeRenderTargetAt(i);
24021
+ }
24022
+ }
24023
+ var freeTextures = this._freeTextures;
24024
+ for(var i1 = freeTextures.length - 1; i1 >= 0; i1--){
24025
+ var tex = freeTextures[i1];
24026
+ if (tex.width === width && tex.height === height) {
24027
+ this._destroyFreeTextureAt(i1);
24028
+ }
24029
+ }
23914
24030
  };
23915
24031
  _proto.gc = function gc() {
23916
24032
  var freeRenderTargets = this._freeRenderTargets;
23917
24033
  for(var i = 0, n = freeRenderTargets.length; i < n; i++){
23918
- var renderTarget = freeRenderTargets[i];
23919
- var colorTexture = renderTarget.getColorTexture(0);
23920
- var depthTexture = renderTarget.depthTexture;
23921
- renderTarget.destroy(true);
23922
- colorTexture == null ? void 0 : colorTexture.destroy(true);
23923
- if (depthTexture && depthTexture !== colorTexture) {
23924
- depthTexture.destroy(true);
23925
- }
24034
+ RenderTargetPool._destroyRenderTargetResource(freeRenderTargets[i]);
23926
24035
  }
23927
24036
  freeRenderTargets.length = 0;
24037
+ this._freeRenderTargetFrames.length = 0;
23928
24038
  var freeTextures = this._freeTextures;
23929
24039
  for(var i1 = 0, n1 = freeTextures.length; i1 < n1; i1++){
23930
24040
  freeTextures[i1].destroy(true);
23931
24041
  }
23932
24042
  freeTextures.length = 0;
24043
+ this._freeTextureFrames.length = 0;
24044
+ };
24045
+ _proto._removeFreeRenderTargetAt = function _removeFreeRenderTargetAt(index) {
24046
+ var rts = this._freeRenderTargets;
24047
+ var frames = this._freeRenderTargetFrames;
24048
+ var last = rts.length - 1;
24049
+ if (index !== last) {
24050
+ rts[index] = rts[last];
24051
+ frames[index] = frames[last];
24052
+ }
24053
+ rts.length = last;
24054
+ frames.length = last;
24055
+ };
24056
+ _proto._removeFreeTextureAt = function _removeFreeTextureAt(index) {
24057
+ var texs = this._freeTextures;
24058
+ var frames = this._freeTextureFrames;
24059
+ var last = texs.length - 1;
24060
+ if (index !== last) {
24061
+ texs[index] = texs[last];
24062
+ frames[index] = frames[last];
24063
+ }
24064
+ texs.length = last;
24065
+ frames.length = last;
24066
+ };
24067
+ _proto._destroyFreeRenderTargetAt = function _destroyFreeRenderTargetAt(index) {
24068
+ var rt = this._freeRenderTargets[index];
24069
+ this._removeFreeRenderTargetAt(index);
24070
+ RenderTargetPool._destroyRenderTargetResource(rt);
24071
+ };
24072
+ _proto._destroyFreeTextureAt = function _destroyFreeTextureAt(index) {
24073
+ var tex = this._freeTextures[index];
24074
+ this._removeFreeTextureAt(index);
24075
+ tex.destroy(true);
24076
+ };
24077
+ RenderTargetPool._destroyRenderTargetResource = function _destroyRenderTargetResource(rt) {
24078
+ var colorTexture = rt.getColorTexture(0);
24079
+ var depthTexture = rt.depthTexture;
24080
+ rt.destroy(true);
24081
+ colorTexture == null ? void 0 : colorTexture.destroy(true);
24082
+ if (depthTexture && depthTexture !== colorTexture) {
24083
+ depthTexture.destroy(true);
24084
+ }
23933
24085
  };
23934
24086
  RenderTargetPool._matchRenderTarget = function _matchRenderTarget(renderTarget, width, height, colorFormat, depthFormat, needDepthTexture, mipmap, isSRGBColorSpace, antiAliasing) {
23935
24087
  if (renderTarget.width !== width || renderTarget.height !== height || renderTarget.antiAliasing !== antiAliasing) {
@@ -31907,17 +32059,15 @@
31907
32059
  }
31908
32060
  var switchProgram = program.bind();
31909
32061
  var switchRenderCount = renderCount !== program._uploadRenderCount;
31910
- // Upload uniforms (cache-aware per block)
32062
+ // Upload uniforms (cache-aware per block). Renderer block carries plain samplers/arrays
32063
+ // even on the instanced path (GLSL forbids them in UBOs); `_canBatch` ensures the whole
32064
+ // batch agrees on those, so the leader's values are correct for the draw call
31911
32065
  if (switchRenderCount) {
31912
32066
  program.groupingOtherUniformBlock();
31913
32067
  program.uploadAll(program.sceneUniformBlock, sceneData);
31914
32068
  program.uploadAll(program.cameraUniformBlock, cameraData);
31915
- if (isInstanced) {
31916
- program._uploadRendererId = -1;
31917
- } else {
31918
- program.uploadAll(program.rendererUniformBlock, rendererData);
31919
- program._uploadRendererId = rendererId;
31920
- }
32069
+ program.uploadAll(program.rendererUniformBlock, rendererData);
32070
+ program._uploadRendererId = isInstanced ? -1 : rendererId;
31921
32071
  program.uploadAll(program.materialUniformBlock, materialData);
31922
32072
  renderElementShaderData && program.uploadAll(program.renderElementUniformBlock, renderElementShaderData);
31923
32073
  // UnGroup textures should upload default value, texture uint maybe change by logic of texture bind
@@ -31939,13 +32089,15 @@
31939
32089
  } else if (switchProgram) {
31940
32090
  program.uploadTextures(program.cameraUniformBlock, cameraData);
31941
32091
  }
31942
- if (!isInstanced) {
31943
- if (program._uploadRendererId !== rendererId) {
31944
- program.uploadAll(program.rendererUniformBlock, rendererData);
31945
- program._uploadRendererId = rendererId;
31946
- } else if (switchProgram) {
31947
- program.uploadTextures(program.rendererUniformBlock, rendererData);
31948
- }
32092
+ if (isInstanced) {
32093
+ // Different batches may have different leaders, re-upload every time
32094
+ program.uploadAll(program.rendererUniformBlock, rendererData);
32095
+ program._uploadRendererId = -1;
32096
+ } else if (program._uploadRendererId !== rendererId) {
32097
+ program.uploadAll(program.rendererUniformBlock, rendererData);
32098
+ program._uploadRendererId = rendererId;
32099
+ } else if (switchProgram) {
32100
+ program.uploadTextures(program.rendererUniformBlock, rendererData);
31949
32101
  }
31950
32102
  if (program._uploadMaterialId !== materialId) {
31951
32103
  program.uploadAll(program.materialUniformBlock, materialData);
@@ -32953,19 +33105,8 @@
32953
33105
  this._copyBackgroundTexture = copyBackgroundTexture;
32954
33106
  }
32955
33107
  this._internalColorTarget = internalColorTarget;
32956
- } else {
32957
- var internalColorTarget1 = this._internalColorTarget;
32958
- var copyBackgroundTexture1 = this._copyBackgroundTexture;
32959
- var pool = engine._renderTargetPool;
32960
- if (internalColorTarget1) {
32961
- pool.freeRenderTarget(internalColorTarget1);
32962
- this._internalColorTarget = null;
32963
- }
32964
- if (copyBackgroundTexture1) {
32965
- pool.freeTexture(copyBackgroundTexture1);
32966
- this._copyBackgroundTexture = null;
32967
- }
32968
33108
  }
33109
+ // Both fields are released at the end of `_drawRenderPass`, so they're null on every entry here.
32969
33110
  // Scalable ambient obscurance pass
32970
33111
  // Before opaque pass so materials can sample ambient occlusion in BRDF
32971
33112
  var saoPass = this._saoPass;
@@ -33082,6 +33223,16 @@
33082
33223
  }
33083
33224
  cameraRenderTarget == null ? void 0 : cameraRenderTarget._blitRenderTarget();
33084
33225
  cameraRenderTarget == null ? void 0 : cameraRenderTarget.generateMipmaps();
33226
+ // Release per-frame leases so the next camera with matching shape can reuse them.
33227
+ var pool = engine._renderTargetPool;
33228
+ if (this._internalColorTarget) {
33229
+ pool.freeRenderTarget(this._internalColorTarget);
33230
+ this._internalColorTarget = null;
33231
+ }
33232
+ if (this._copyBackgroundTexture) {
33233
+ pool.freeTexture(this._copyBackgroundTexture);
33234
+ this._copyBackgroundTexture = null;
33235
+ }
33085
33236
  };
33086
33237
  /**
33087
33238
  * Push render data to render queue.
@@ -33117,6 +33268,7 @@
33117
33268
  _proto._pushRenderElementByType = function _pushRenderElementByType(renderElement, subShader, renderStates) {
33118
33269
  var shaderPasses = subShader.passes;
33119
33270
  var cullingResults = this._cullingResults;
33271
+ renderElement.subShader = subShader;
33120
33272
  var pushedQueueFlags = 0;
33121
33273
  for(var i = 0, n = shaderPasses.length; i < n; i++){
33122
33274
  var renderQueueType = void 0;
@@ -33128,19 +33280,28 @@
33128
33280
  renderQueueType = renderStates[i].renderQueueType;
33129
33281
  }
33130
33282
  var flag = 1 << renderQueueType;
33131
- renderElement.subShader = subShader;
33132
33283
  if (pushedQueueFlags & flag) {
33133
33284
  continue;
33134
33285
  }
33286
+ // First queue keeps the original element; subsequent queues each get an isolated
33287
+ // clone so per-queue batch state (`_isBatched`, `instancedRenderers`) doesn't
33288
+ // leak across queues for multi-pass materials (e.g. Opaque + Transparent)
33289
+ var elementForQueue = void 0;
33290
+ if (pushedQueueFlags === 0) {
33291
+ elementForQueue = renderElement;
33292
+ } else {
33293
+ elementForQueue = renderElement.component.engine._renderElementPool.get();
33294
+ elementForQueue._cloneFrom(renderElement);
33295
+ }
33135
33296
  switch(renderQueueType){
33136
33297
  case RenderQueueType.Opaque:
33137
- cullingResults.opaqueQueue.pushRenderElement(renderElement);
33298
+ cullingResults.opaqueQueue.pushRenderElement(elementForQueue);
33138
33299
  break;
33139
33300
  case RenderQueueType.AlphaTest:
33140
- cullingResults.alphaTestQueue.pushRenderElement(renderElement);
33301
+ cullingResults.alphaTestQueue.pushRenderElement(elementForQueue);
33141
33302
  break;
33142
33303
  case RenderQueueType.Transparent:
33143
- cullingResults.transparentQueue.pushRenderElement(renderElement);
33304
+ cullingResults.transparentQueue.pushRenderElement(elementForQueue);
33144
33305
  break;
33145
33306
  }
33146
33307
  pushedQueueFlags |= flag;
@@ -33353,7 +33514,18 @@
33353
33514
  _inherits$2(Engine, EventDispatcher);
33354
33515
  function Engine(canvas, hardwareRenderer, configuration) {
33355
33516
  var _this;
33356
- _this = EventDispatcher.call(this) || this, /** @internal */ _this._renderingStatistics = new RenderingStatistics(), /** @internal */ _this._isDeviceLost = false, /** @internal */ _this._frameInProcess = false, /** @internal */ _this._pendingDestroyObjects = [], /** @internal */ _this._processingPendingDestroys = false, /** @internal */ _this._physicsInitialized = false, /* @internal */ _this._lastRenderState = new RenderState(), /* @internal */ _this._renderElementPool = new ClearableObjectPool(RenderElement), /* @internal */ _this._textRenderElementPool = new ClearableObjectPool(RenderElement), /* @internal */ _this._charRenderInfoPool = new ReturnableObjectPool(CharRenderInfo, 50), /* @internal */ _this._renderContext = new RenderContext(), /* @internal */ _this._renderCount = 0, /* @internal */ _this._shaderProgramMaps = [], /** @internal */ _this._fontMap = {}, /** @internal */ _this._macroCollection = new ShaderMacroCollection(), /** @internal */ _this._postProcessPassNeedRefresh = false, _this._settings = {}, _this._resourceManager = new ResourceManager(_this), _this._sceneManager = new SceneManager(_this), _this._vSyncCount = 1, _this._targetFrameRate = 60, _this._time = new Time(), _this._isPaused = true, _this._vSyncCounter = 1, _this._targetFrameInterval = 1000 / 60, _this._destroyed = false, _this._waitingDestroy = false, _this._waitingGC = false, _this._postProcessPasses = new Array(), _this._activePostProcessPasses = new Array(), _this._animate = function() {
33517
+ _this = EventDispatcher.call(this) || this, /** @internal */ _this._renderingStatistics = new RenderingStatistics(), /** @internal */ _this._isDeviceLost = false, /** @internal */ _this._frameInProcess = false, /** @internal */ _this._pendingDestroyObjects = [], /** @internal */ _this._processingPendingDestroys = false, /** @internal */ _this._physicsInitialized = false, /* @internal */ _this._lastRenderState = new RenderState(), /* @internal */ _this._renderElementPool = new ClearableObjectPool(RenderElement), /* @internal */ _this._textRenderElementPool = new ClearableObjectPool(RenderElement), /* @internal */ _this._charRenderInfoPool = new ReturnableObjectPool(CharRenderInfo, 50), /* @internal */ _this._renderContext = new RenderContext(), /* @internal */ _this._renderCount = 0, /* @internal */ _this._shaderProgramMaps = [], /** @internal */ _this._fontMap = {}, /** @internal */ _this._macroCollection = new ShaderMacroCollection(), /** @internal */ _this._postProcessPassNeedRefresh = false, _this._settings = {}, _this._resourceManager = new ResourceManager(_this), _this._sceneManager = new SceneManager(_this), _this._vSyncCount = 1, _this._targetFrameRate = 60, _this._time = new Time(), _this._isPaused = true, _this._vSyncCounter = 1, _this._targetFrameInterval = 1000 / 60, _this._destroyed = false, _this._waitingDestroy = false, _this._waitingGC = false, _this._postProcessPasses = new Array(), _this._activePostProcessPasses = new Array(), _this._lastCanvasWidth = -1, _this._lastCanvasHeight = -1, /** Evict pool entries sized to the previous canvas dimensions. */ _this._onCanvasResize = function() {
33518
+ var _$canvas = _this._canvas;
33519
+ var newWidth = _$canvas.width;
33520
+ var newHeight = _$canvas.height;
33521
+ if (_this._lastCanvasWidth !== newWidth || _this._lastCanvasHeight !== newHeight) {
33522
+ if (_this._lastCanvasWidth >= 0) {
33523
+ _this._renderTargetPool.evictBySize(_this._lastCanvasWidth, _this._lastCanvasHeight);
33524
+ }
33525
+ _this._lastCanvasWidth = newWidth;
33526
+ _this._lastCanvasHeight = newHeight;
33527
+ }
33528
+ }, _this._animate = function() {
33357
33529
  if (_this._vSyncCount) {
33358
33530
  var _this_xrManager;
33359
33531
  var raf = ((_this_xrManager = _this.xrManager) == null ? void 0 : _this_xrManager._getRequestAnimationFrame()) || requestAnimationFrame;
@@ -33374,6 +33546,9 @@
33374
33546
  _this._textDefaultFont.isGCIgnored = true;
33375
33547
  _this._batcherManager = new BatcherManager(_this);
33376
33548
  _this._renderTargetPool = new RenderTargetPool(_this);
33549
+ _this._lastCanvasWidth = canvas.width;
33550
+ _this._lastCanvasHeight = canvas.height;
33551
+ canvas._sizeUpdateFlagManager.addListener(_this._onCanvasResize);
33377
33552
  _this.inputManager = new InputManager(_this, configuration.input);
33378
33553
  var xrDevice = configuration.xrDevice;
33379
33554
  if (xrDevice) {
@@ -33433,6 +33608,7 @@
33433
33608
  var _this_xrManager;
33434
33609
  var time = this._time;
33435
33610
  time._update();
33611
+ this._renderTargetPool.tick(time.frameCount);
33436
33612
  var deltaTime = time.deltaTime;
33437
33613
  this._frameInProcess = true;
33438
33614
  this._renderElementPool.clear();
@@ -33577,6 +33753,7 @@
33577
33753
  var _this_xrManager;
33578
33754
  this._destroyed = true;
33579
33755
  this._waitingDestroy = false;
33756
+ this._canvas._sizeUpdateFlagManager.removeListener(this._onCanvasResize);
33580
33757
  this._sceneManager._destroyAllScene();
33581
33758
  this._resourceManager._destroy();
33582
33759
  this.inputManager._destroy();
@@ -36360,7 +36537,7 @@
36360
36537
  */ var AnimationClipCurveBinding = /*#__PURE__*/ function() {
36361
36538
  function AnimationClipCurveBinding() {
36362
36539
  /** The index of the component that is animated. */ this.typeIndex = 0;
36363
- this._tempCurveOwner = {};
36540
+ this._tempCurveOwner = new WeakMap();
36364
36541
  }
36365
36542
  var _proto = AnimationClipCurveBinding.prototype;
36366
36543
  /**
@@ -36386,11 +36563,12 @@
36386
36563
  /**
36387
36564
  * @internal
36388
36565
  */ _proto._getTempCurveOwner = function _getTempCurveOwner(entity, component) {
36389
- var instanceId = entity.instanceId;
36390
- if (!this._tempCurveOwner[instanceId]) {
36391
- this._tempCurveOwner[instanceId] = this._createCurveOwner(entity, component);
36566
+ var owner = this._tempCurveOwner.get(entity);
36567
+ if (!owner) {
36568
+ owner = this._createCurveOwner(entity, component);
36569
+ this._tempCurveOwner.set(entity, owner);
36392
36570
  }
36393
- return this._tempCurveOwner[instanceId];
36571
+ return owner;
36394
36572
  };
36395
36573
  return AnimationClipCurveBinding;
36396
36574
  }();
@@ -36469,6 +36647,13 @@
36469
36647
  this._length = 0;
36470
36648
  };
36471
36649
  /**
36650
+ * Samples an animation at a given time.
36651
+ * @param entity - The animated entity
36652
+ * @param time - The time to sample an animation
36653
+ */ _proto.sampleAnimation = function sampleAnimation(entity, time) {
36654
+ this._sampleAnimation(entity, time);
36655
+ };
36656
+ /**
36472
36657
  * @internal
36473
36658
  * Samples an animation at a given time.
36474
36659
  * @param entity - The animated entity
@@ -37833,7 +38018,7 @@
37833
38018
  * @internal
37834
38019
  */ var AnimatorLayerData = /*#__PURE__*/ function() {
37835
38020
  function AnimatorLayerData() {
37836
- this.curveOwnerPool = Object.create(null);
38021
+ this.curveOwnerPool = new WeakMap();
37837
38022
  this.animatorStateDataMap = {};
37838
38023
  this.srcPlayData = new AnimatorStatePlayData();
37839
38024
  this.destPlayData = new AnimatorStatePlayData();
@@ -37860,6 +38045,8 @@
37860
38045
  */ var AnimatorStateData = function AnimatorStateData() {
37861
38046
  this.curveLayerOwner = [];
37862
38047
  this.eventHandlers = [];
38048
+ this.state = null;
38049
+ this.clipChangedListener = null;
37863
38050
  };
37864
38051
  /**
37865
38052
  * The controller of the animation system.
@@ -37867,7 +38054,7 @@
37867
38054
  _inherits$2(Animator, Component);
37868
38055
  function Animator(entity) {
37869
38056
  var _this;
37870
- _this = Component.call(this, entity) || this, /** Culling mode of this Animator. */ _this.cullingMode = AnimatorCullingMode.None, /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0, /** @internal */ _this._playFrameCount = -1, /** @internal */ _this._onUpdateIndex = -1, _this._updateMark = 0, _this._animatorLayersData = new Array(), _this._curveOwnerPool = Object.create(null), _this._animationEventHandlerPool = new ClearableObjectPool(AnimationEventHandler), _this._parametersValueMap = Object.create(null), _this._tempAnimatorStateInfo = {
38057
+ _this = Component.call(this, entity) || this, /** Culling mode of this Animator. */ _this.cullingMode = AnimatorCullingMode.None, /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0, /** Whether the Animator sends AnimationEvent callbacks. */ _this.fireEvents = true, /** @internal */ _this._playFrameCount = -1, /** @internal */ _this._onUpdateIndex = -1, _this._updateMark = 0, _this._animatorLayersData = new Array(), _this._curveOwnerPool = new WeakMap(), _this._animationEventHandlerPool = new ClearableObjectPool(AnimationEventHandler), _this._parametersValueMap = Object.create(null), _this._tempAnimatorStateInfo = {
37871
38058
  layerIndex: -1,
37872
38059
  state: null
37873
38060
  }, _this._controlledRenderers = new Array();
@@ -38063,16 +38250,32 @@
38063
38250
  /**
38064
38251
  * @internal
38065
38252
  */ _proto._reset = function _reset() {
38066
- var _this = this, animationCurveOwners = _this._curveOwnerPool;
38067
- for(var instanceId in animationCurveOwners){
38068
- var propertyOwners = animationCurveOwners[instanceId];
38069
- for(var property in propertyOwners){
38070
- var owner = propertyOwners[property];
38071
- owner.revertDefaultValue();
38253
+ // revertDefaultValue 可能在死 target 上抛;listener 清理必须始终发生,否则
38254
+ // polyfill clipChangedListener 会留在共享的 AnimatorState 上,捕获 this(Animator)→Entity 整树。
38255
+ // try/catch 隔离 revert,listener 块紧跟其后无条件执行。
38256
+ var layersData = this._animatorLayersData;
38257
+ for(var i = 0, n = layersData.length; i < n; i++){
38258
+ var stateDataMap = layersData[i].animatorStateDataMap;
38259
+ for(var stateName in stateDataMap){
38260
+ var stateData = stateDataMap[stateName];
38261
+ var layerOwners = stateData.curveLayerOwner;
38262
+ for(var j = 0, m = layerOwners.length; j < m; j++){
38263
+ try {
38264
+ var _layerOwners_j_curveOwner, _layerOwners_j;
38265
+ (_layerOwners_j = layerOwners[j]) == null ? void 0 : (_layerOwners_j_curveOwner = _layerOwners_j.curveOwner) == null ? void 0 : _layerOwners_j_curveOwner.revertDefaultValue();
38266
+ } catch (e) {
38267
+ Logger.warn("Animator._reset: revertDefaultValue threw", e);
38268
+ }
38269
+ }
38270
+ if (stateData.clipChangedListener && stateData.state) {
38271
+ stateData.state._updateFlagManager.removeListener(stateData.clipChangedListener);
38272
+ stateData.clipChangedListener = null;
38273
+ stateData.state = null;
38274
+ }
38072
38275
  }
38073
38276
  }
38074
38277
  this._animatorLayersData.length = 0;
38075
- this._curveOwnerPool = Object.create(null);
38278
+ this._curveOwnerPool = new WeakMap();
38076
38279
  this._parametersValueMap = Object.create(null);
38077
38280
  this._animationEventHandlerPool.clear();
38078
38281
  if (this._controllerUpdateFlag) {
@@ -38090,6 +38293,7 @@
38090
38293
  };
38091
38294
  _proto._onDestroy = function _onDestroy() {
38092
38295
  Component.prototype._onDestroy.call(this);
38296
+ this._reset();
38093
38297
  var controller = this._animatorController;
38094
38298
  if (controller) {
38095
38299
  var _this__controllerUpdateFlag;
@@ -38156,19 +38360,26 @@
38156
38360
  var relativePath = curve.relativePath;
38157
38361
  var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
38158
38362
  if (targetEntity) {
38159
- var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
38363
+ var _propertyOwners, _property, _layerPropertyOwners, _property1;
38160
38364
  var component = curve.typeIndex > 0 ? targetEntity.getComponents(curve.type, components)[curve.typeIndex] : targetEntity.getComponent(curve.type);
38161
38365
  components.length = 0;
38162
38366
  if (!component) {
38163
38367
  continue;
38164
38368
  }
38165
38369
  var property = curve.property;
38166
- var instanceId = component.instanceId;
38167
- // Get owner
38168
- var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
38370
+ // Get owner — WeakMap keyed by Component so dead components let entries GC.
38371
+ var propertyOwners = curveOwnerPool.get(component);
38372
+ if (!propertyOwners) {
38373
+ propertyOwners = Object.create(null);
38374
+ curveOwnerPool.set(component, propertyOwners);
38375
+ }
38169
38376
  var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity, component));
38170
- // Get layer owner
38171
- var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
38377
+ // Get layer owner — same WeakMap-by-Component pattern (was Record<instanceId,...> which kept dead components pinned for the Animator's lifetime).
38378
+ var layerPropertyOwners = layerCurveOwnerPool.get(component);
38379
+ if (!layerPropertyOwners) {
38380
+ layerPropertyOwners = Object.create(null);
38381
+ layerCurveOwnerPool.set(component, layerPropertyOwners);
38382
+ }
38172
38383
  var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
38173
38384
  if (mask && mask.pathMasks.length) {
38174
38385
  var _mask_getPathMask;
@@ -38210,6 +38421,8 @@
38210
38421
  };
38211
38422
  clipChangedListener();
38212
38423
  state._updateFlagManager.addListener(clipChangedListener);
38424
+ animatorStateData.state = state;
38425
+ animatorStateData.clipChangedListener = clipChangedListener;
38213
38426
  };
38214
38427
  _proto._clearCrossData = function _clearCrossData(animatorLayerData) {
38215
38428
  animatorLayerData.crossCurveMark++;
@@ -38874,7 +39087,7 @@
38874
39087
  };
38875
39088
  _proto._fireAnimationEventsAndCallScripts = function _fireAnimationEventsAndCallScripts(layerIndex, playData, state, lastClipTime, lastPlayState, deltaTime) {
38876
39089
  var eventHandlers = playData.stateData.eventHandlers;
38877
- eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, deltaTime);
39090
+ this.fireEvents && eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, deltaTime);
38878
39091
  if (lastPlayState === AnimatorStatePlayState.UnStarted) {
38879
39092
  state._callOnEnter(this, layerIndex);
38880
39093
  }
@@ -38938,6 +39151,9 @@
38938
39151
  __decorate$1([
38939
39152
  assignmentClone
38940
39153
  ], Animator.prototype, "speed", void 0);
39154
+ __decorate$1([
39155
+ assignmentClone
39156
+ ], Animator.prototype, "fireEvents", void 0);
38941
39157
  __decorate$1([
38942
39158
  assignmentClone
38943
39159
  ], Animator.prototype, "_animatorController", void 0);
@@ -56421,7 +56637,7 @@
56421
56637
  ], EXT_texture_webp);
56422
56638
 
56423
56639
  //@ts-ignore
56424
- var version = "0.0.0-experimental-2.0-game.14";
56640
+ var version = "0.0.0-experimental-2.0-game.16";
56425
56641
  console.log("Galacean Engine Version: " + version);
56426
56642
  for(var key in CoreObjects){
56427
56643
  Loader.registerClass(key, CoreObjects[key]);