@galacean/engine-physics-physx 0.9.10 → 0.9.12

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.
@@ -1516,9 +1516,11 @@ exports.GLCapabilityType = void 0;
1516
1516
  renderTexture
1517
1517
  ];
1518
1518
  for(var i = 0, n = colorTextures.length; i < n; i++){
1519
- if (colorTextures[i]._isDepthTexture) {
1519
+ var colorTexture = colorTextures[i];
1520
+ if (colorTexture._isDepthTexture) {
1520
1521
  throw "Render texture can't use depth format.";
1521
1522
  }
1523
+ colorTexture._addRefCount(1);
1522
1524
  }
1523
1525
  _this._colorTextures = colorTextures;
1524
1526
  } else {
@@ -1529,6 +1531,7 @@ exports.GLCapabilityType = void 0;
1529
1531
  throw "Depth texture must use depth format.";
1530
1532
  }
1531
1533
  _this._depthTexture = depth;
1534
+ _this._depthTexture._addRefCount(1);
1532
1535
  }
1533
1536
  _this._platformRenderTarget = engine._hardwareRenderer.createPlatformRenderTarget(_assert_this_initialized(_this));
1534
1537
  return _this;
@@ -1558,8 +1561,14 @@ exports.GLCapabilityType = void 0;
1558
1561
  /**
1559
1562
  * Destroy render target.
1560
1563
  */ _proto.destroy = function destroy() {
1564
+ var _this__depthTexture;
1561
1565
  this._platformRenderTarget.destroy();
1562
- this._colorTextures.length = 0;
1566
+ var _this = this, colorTextures = _this._colorTextures;
1567
+ for(var i = 0, n = colorTextures.length; i < n; i++){
1568
+ colorTextures[i]._addRefCount(-1);
1569
+ }
1570
+ colorTextures.length = 0;
1571
+ (_this__depthTexture = this._depthTexture) == null ? void 0 : _this__depthTexture._addRefCount(-1);
1563
1572
  this._depthTexture = null;
1564
1573
  this._depth = null;
1565
1574
  };
@@ -2000,6 +2009,7 @@ exports.GLCapabilityType = void 0;
2000
2009
  var fontAtlas = new FontAtlas(engine);
2001
2010
  var texture = new Texture2D(engine, 256, 256);
2002
2011
  fontAtlas.texture = texture;
2012
+ fontAtlas.isGCIgnored = texture.isGCIgnored = true;
2003
2013
  this._fontAtlases.push(fontAtlas);
2004
2014
  return fontAtlas;
2005
2015
  };
@@ -8672,6 +8682,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
8672
8682
  _proto.cloneTo = function cloneTo(target) {
8673
8683
  CloneManager.deepCloneObject(this._macroCollection, target._macroCollection);
8674
8684
  Object.assign(target._macroMap, this._macroMap);
8685
+ var referCount = target._getRefCount();
8675
8686
  var propertyValueMap = this._propertyValueMap;
8676
8687
  var targetPropertyValueMap = target._propertyValueMap;
8677
8688
  var keys = Object.keys(propertyValueMap);
@@ -8683,6 +8694,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
8683
8694
  targetPropertyValueMap[k] = property;
8684
8695
  } else if (_instanceof1$2(property, Texture)) {
8685
8696
  targetPropertyValueMap[k] = property;
8697
+ referCount > 0 && property._addRefCount(referCount);
8686
8698
  } else if (_instanceof1$2(property, Array) || _instanceof1$2(property, Float32Array) || _instanceof1$2(property, Int32Array)) {
8687
8699
  targetPropertyValueMap[k] = property.slice();
8688
8700
  } else {
@@ -10010,6 +10022,14 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
10010
10022
  };
10011
10023
  /**
10012
10024
  * @internal
10025
+ */ _proto._cloneTo = function _cloneTo(target) {
10026
+ var materials = this._materials;
10027
+ for(var i = 0, n = materials.length; i < n; i++){
10028
+ target._setMaterial(i, materials[i]);
10029
+ }
10030
+ };
10031
+ /**
10032
+ * @internal
10013
10033
  */ _proto._onDestroy = function _onDestroy() {
10014
10034
  this.entity.transform._updateFlagManager.removeListener(this._onTransformChanged);
10015
10035
  this.shaderData._addRefCount(-1);
@@ -10188,7 +10208,7 @@ __decorate$1([
10188
10208
  ignoreClone
10189
10209
  ], exports.Renderer.prototype, "_overrideUpdate", void 0);
10190
10210
  __decorate$1([
10191
- shallowClone
10211
+ ignoreClone
10192
10212
  ], exports.Renderer.prototype, "_materials", void 0);
10193
10213
  __decorate$1([
10194
10214
  ignoreClone
@@ -10391,18 +10411,9 @@ SimpleSpriteAssembler = __decorate$1([
10391
10411
  }
10392
10412
  var _proto = SpriteMask.prototype;
10393
10413
  /**
10394
- * @override
10395
- * @inheritdoc
10396
- */ _proto._onDestroy = function _onDestroy() {
10397
- var _this__sprite;
10398
- (_this__sprite = this._sprite) == null ? void 0 : _this__sprite._updateFlagManager.removeListener(this._onSpriteChange);
10399
- this._sprite = null;
10400
- this._renderData = null;
10401
- Renderer.prototype._onDestroy.call(this);
10402
- };
10403
- /**
10404
10414
  * @internal
10405
10415
  */ _proto._cloneTo = function _cloneTo(target) {
10416
+ Renderer.prototype._cloneTo.call(this, target);
10406
10417
  target.sprite = this._sprite;
10407
10418
  };
10408
10419
  /**
@@ -10439,6 +10450,19 @@ SimpleSpriteAssembler = __decorate$1([
10439
10450
  context.camera._renderPipeline._allSpriteMasks.add(this);
10440
10451
  this._maskElement = maskElement;
10441
10452
  };
10453
+ /**
10454
+ * @internal
10455
+ * @inheritdoc
10456
+ */ _proto._onDestroy = function _onDestroy() {
10457
+ Renderer.prototype._onDestroy.call(this);
10458
+ var sprite = this._sprite;
10459
+ if (sprite) {
10460
+ sprite._addRefCount(-1);
10461
+ sprite._updateFlagManager.removeListener(this._onSpriteChange);
10462
+ }
10463
+ this._sprite = null;
10464
+ this._renderData = null;
10465
+ };
10442
10466
  _proto._calDefaultSize = function _calDefaultSize() {
10443
10467
  var sprite = this._sprite;
10444
10468
  if (sprite) {
@@ -10557,9 +10581,13 @@ SimpleSpriteAssembler = __decorate$1([
10557
10581
  set: function set(value) {
10558
10582
  var lastSprite = this._sprite;
10559
10583
  if (lastSprite !== value) {
10560
- lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
10584
+ if (lastSprite) {
10585
+ lastSprite._addRefCount(-1);
10586
+ lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
10587
+ }
10561
10588
  this._dirtyUpdateFlag |= 0x7;
10562
10589
  if (value) {
10590
+ value._addRefCount(1);
10563
10591
  value._updateFlagManager.addListener(this._onSpriteChange);
10564
10592
  this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
10565
10593
  } else {
@@ -11114,10 +11142,11 @@ var BufferUtil = /*#__PURE__*/ function() {
11114
11142
  /**
11115
11143
  * @internal
11116
11144
  */ _proto._setVertexBufferBinding = function _setVertexBufferBinding(index, binding) {
11117
- if (this._getRefCount() > 0) {
11118
- var lastBinding = this._vertexBufferBindings[index];
11119
- lastBinding && lastBinding._buffer._addRefCount(-1);
11120
- binding._buffer._addRefCount(1);
11145
+ var referCount = this._getRefCount();
11146
+ if (referCount > 0) {
11147
+ var _this__vertexBufferBindings_index;
11148
+ (_this__vertexBufferBindings_index = this._vertexBufferBindings[index]) == null ? void 0 : _this__vertexBufferBindings_index._buffer._addRefCount(-referCount);
11149
+ binding == null ? void 0 : binding._buffer._addRefCount(referCount);
11121
11150
  }
11122
11151
  this._vertexBufferBindings[index] = binding;
11123
11152
  this._bufferStructChanged = true;
@@ -11131,11 +11160,13 @@ var BufferUtil = /*#__PURE__*/ function() {
11131
11160
  /**
11132
11161
  * @override
11133
11162
  */ _proto._addRefCount = function _addRefCount(value) {
11163
+ var _this__indexBufferBinding;
11134
11164
  RefObject.prototype._addRefCount.call(this, value);
11135
11165
  var vertexBufferBindings = this._vertexBufferBindings;
11136
11166
  for(var i = 0, n = vertexBufferBindings.length; i < n; i++){
11137
11167
  vertexBufferBindings[i]._buffer._addRefCount(value);
11138
11168
  }
11169
+ (_this__indexBufferBinding = this._indexBufferBinding) == null ? void 0 : _this__indexBufferBinding._buffer._addRefCount(value);
11139
11170
  };
11140
11171
  /**
11141
11172
  * @override
@@ -11155,6 +11186,11 @@ var BufferUtil = /*#__PURE__*/ function() {
11155
11186
  };
11156
11187
  _proto._setIndexBufferBinding = function _setIndexBufferBinding(binding) {
11157
11188
  var lastBinding = this._indexBufferBinding;
11189
+ var referCount = this._getRefCount();
11190
+ if (referCount > 0) {
11191
+ lastBinding == null ? void 0 : lastBinding.buffer._addRefCount(-referCount);
11192
+ binding == null ? void 0 : binding.buffer._addRefCount(referCount);
11193
+ }
11158
11194
  if (binding) {
11159
11195
  this._indexBufferBinding = binding;
11160
11196
  this._glIndexType = BufferUtil._getGLIndexType(binding.format);
@@ -12821,12 +12857,14 @@ var VertexChangedFlags;
12821
12857
  var mesh = this._mesh;
12822
12858
  if (mesh && !mesh.destroyed) {
12823
12859
  mesh._addRefCount(-1);
12860
+ mesh._updateFlagManager.removeListener(this._onMeshChanged);
12824
12861
  this._mesh = null;
12825
12862
  }
12826
12863
  };
12827
12864
  /**
12828
12865
  * @internal
12829
12866
  */ _proto._cloneTo = function _cloneTo(target) {
12867
+ Renderer.prototype._cloneTo.call(this, target);
12830
12868
  target.mesh = this._mesh;
12831
12869
  };
12832
12870
  /**
@@ -13116,6 +13154,7 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13116
13154
  (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
13117
13155
  this._jointTexture = new Texture2D(engine, 4, jointCount, exports.TextureFormat.R32G32B32A32, false);
13118
13156
  this._jointTexture.filterMode = exports.TextureFilterMode.Point;
13157
+ this._jointTexture.isGCIgnored = true;
13119
13158
  }
13120
13159
  shaderData.disableMacro("O3_JOINTS_NUM");
13121
13160
  shaderData.enableMacro("O3_USE_JOINT_TEXTURE");
@@ -13149,6 +13188,15 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13149
13188
  };
13150
13189
  /**
13151
13190
  * @internal
13191
+ * @override
13192
+ */ _proto._onDestroy = function _onDestroy() {
13193
+ var _this_rootBone, _this__jointTexture;
13194
+ MeshRenderer.prototype._onDestroy.call(this);
13195
+ (_this_rootBone = this.rootBone) == null ? void 0 : _this_rootBone.transform._updateFlagManager.removeListener(this._onTransformChanged);
13196
+ (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
13197
+ };
13198
+ /**
13199
+ * @internal
13152
13200
  */ _proto._cloneTo = function _cloneTo(target) {
13153
13201
  MeshRenderer.prototype._cloneTo.call(this, target);
13154
13202
  this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
@@ -14302,14 +14350,17 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
14302
14350
  _proto._createMesh = function _createMesh(engine, index) {
14303
14351
  var MAX_VERTEX_COUNT = Basic2DBatcher.MAX_VERTEX_COUNT;
14304
14352
  var mesh = new BufferMesh(engine, "BufferMesh" + index);
14353
+ mesh.isGCIgnored = true;
14305
14354
  var vertexElements = [];
14306
14355
  var vertexStride = this.createVertexElements(vertexElements);
14307
14356
  // vertices
14308
- this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
14357
+ var vertexBuffer = this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
14358
+ vertexBuffer.isGCIgnored = true;
14309
14359
  // indices
14310
- this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
14311
- mesh.setVertexBufferBinding(this._vertexBuffers[index], vertexStride);
14312
- mesh.setIndexBufferBinding(this._indiceBuffers[index], exports.IndexFormat.UInt16);
14360
+ var indiceBuffer = this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
14361
+ indiceBuffer.isGCIgnored = true;
14362
+ mesh.setVertexBufferBinding(vertexBuffer, vertexStride);
14363
+ mesh.setIndexBufferBinding(indiceBuffer, exports.IndexFormat.UInt16);
14313
14364
  mesh.setVertexElements(vertexElements);
14314
14365
  return mesh;
14315
14366
  };
@@ -14542,6 +14593,12 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
14542
14593
  var _proto = Sky.prototype;
14543
14594
  /**
14544
14595
  * @internal
14596
+ */ _proto.destroy = function destroy() {
14597
+ this.mesh = null;
14598
+ this.material = null;
14599
+ };
14600
+ /**
14601
+ * @internal
14545
14602
  */ _proto._render = function _render(context) {
14546
14603
  var _this = this, material = _this.material, mesh = _this.mesh;
14547
14604
  if (!material) {
@@ -14580,6 +14637,40 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
14580
14637
  rhi.drawPrimitive(mesh, mesh.subMesh, program);
14581
14638
  cameraShaderData.setMatrix(RenderContext._vpMatrixProperty, originViewProjMatrix);
14582
14639
  };
14640
+ _create_class$2(Sky, [
14641
+ {
14642
+ key: "material",
14643
+ get: /**
14644
+ * Material of the sky.
14645
+ */ function get() {
14646
+ return this._material;
14647
+ },
14648
+ set: function set(value) {
14649
+ if (this._material !== value) {
14650
+ var _this__material;
14651
+ value == null ? void 0 : value._addRefCount(1);
14652
+ (_this__material = this._material) == null ? void 0 : _this__material._addRefCount(-1);
14653
+ this._material = value;
14654
+ }
14655
+ }
14656
+ },
14657
+ {
14658
+ key: "mesh",
14659
+ get: /**
14660
+ * Mesh of the sky.
14661
+ */ function get() {
14662
+ return this._mesh;
14663
+ },
14664
+ set: function set(value) {
14665
+ if (this._mesh !== value) {
14666
+ var _this__mesh;
14667
+ value == null ? void 0 : value._addRefCount(1);
14668
+ (_this__mesh = this._mesh) == null ? void 0 : _this__mesh._addRefCount(-1);
14669
+ this._mesh = value;
14670
+ }
14671
+ }
14672
+ }
14673
+ ]);
14583
14674
  return Sky;
14584
14675
  }();
14585
14676
  (function() {
@@ -14609,11 +14700,28 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
14609
14700
  this.sky = new Sky();
14610
14701
  this./** @internal */ _textureFillMode = exports.BackgroundTextureFillMode.AspectFitHeight;
14611
14702
  this._texture = null;
14612
- this._mesh = this._createPlane(_engine);
14703
+ this._initMesh(_engine);
14613
14704
  };
14614
14705
  var _proto = Background.prototype;
14615
14706
  /**
14616
14707
  * @internal
14708
+ */ _proto.destroy = function destroy() {
14709
+ this._mesh._addRefCount(-1);
14710
+ this._mesh = null;
14711
+ this.texture = null;
14712
+ this.solidColor = null;
14713
+ this.sky.destroy();
14714
+ this._engine = null;
14715
+ };
14716
+ /**
14717
+ * @internal
14718
+ * Standalone for CanvasRenderer plugin.
14719
+ */ _proto._initMesh = function _initMesh(engine) {
14720
+ this._mesh = this._createPlane(engine);
14721
+ this._mesh._addRefCount(1);
14722
+ };
14723
+ /**
14724
+ * @internal
14617
14725
  */ _proto._resizeBackgroundTexture = function _resizeBackgroundTexture() {
14618
14726
  if (!this._texture) {
14619
14727
  return;
@@ -14682,6 +14790,9 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
14682
14790
  },
14683
14791
  set: function set(value) {
14684
14792
  if (this._texture !== value) {
14793
+ var _this__texture;
14794
+ value == null ? void 0 : value._addRefCount(1);
14795
+ (_this__texture = this._texture) == null ? void 0 : _this__texture._addRefCount(-1);
14685
14796
  this._texture = value;
14686
14797
  this._engine._backgroundTextureMaterial.shaderData.setTexture("u_baseTexture", value);
14687
14798
  }
@@ -15181,6 +15292,7 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
15181
15292
  this._rootEntities[0].destroy();
15182
15293
  }
15183
15294
  this._activeCameras.length = 0;
15295
+ this.background.destroy();
15184
15296
  this.shaderData._addRefCount(-1);
15185
15297
  };
15186
15298
  _proto._addToRootEntityList = function _addToRootEntityList(index, rootEntity) {
@@ -15571,7 +15683,7 @@ ShaderPool.init();
15571
15683
  _this._spriteDefaultMaterial = _this._createSpriteMaterial();
15572
15684
  _this._spriteMaskDefaultMaterial = _this._createSpriteMaskMaterial();
15573
15685
  _this._textDefaultFont = Font.createFromOS(_assert_this_initialized(_this), "Arial");
15574
- _this._textDefaultFont.isGCIgnored = false;
15686
+ _this._textDefaultFont.isGCIgnored = true;
15575
15687
  _this.inputManager = new InputManager(_assert_this_initialized(_this));
15576
15688
  var magentaPixel = new Uint8Array([
15577
15689
  255,
@@ -15606,6 +15718,7 @@ ShaderPool.init();
15606
15718
  _this._magentaTexture2DArray = magentaTexture2DArray;
15607
15719
  }
15608
15720
  var magentaMaterial = new Material(_assert_this_initialized(_this), Shader.find("unlit"));
15721
+ magentaMaterial.isGCIgnored = true;
15609
15722
  magentaMaterial.shaderData.setColor("u_baseColor", new Color(1.0, 0.0, 1.01, 1.0));
15610
15723
  _this._magentaMaterial = magentaMaterial;
15611
15724
  var backgroundTextureMaterial = new Material(_assert_this_initialized(_this), Shader.find("background-texture"));
@@ -17131,7 +17244,11 @@ var /**
17131
17244
  var height = shadowCascades == exports.ShadowCascadesMode.TwoCascades ? shadowTileResolution : shadowTileResolution * 2;
17132
17245
  this._shadowMapSize.set(1.0 / width, 1.0 / height, width, height);
17133
17246
  }
17134
- this._renderTargets = null;
17247
+ var renderTargets = this._renderTargets;
17248
+ if (renderTargets) {
17249
+ renderTargets.destroy();
17250
+ this._renderTargets = null;
17251
+ }
17135
17252
  var viewportOffset = this._viewportOffsets;
17136
17253
  var shadowTileResolution1 = this._shadowTileResolution;
17137
17254
  switch(shadowCascades){
@@ -19153,10 +19270,17 @@ exports.TextVerticalAlignment = void 0;
19153
19270
  * @internal
19154
19271
  */ _proto._addSprite = function _addSprite(sprite) {
19155
19272
  this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
19273
+ sprite._atlas = this;
19274
+ sprite.isGCIgnored = true;
19156
19275
  };
19157
19276
  /**
19158
19277
  * @override
19159
19278
  */ _proto._onDestroy = function _onDestroy() {
19279
+ var _this = this, sprites = _this._sprites;
19280
+ for(var i = 0, n = sprites.length; i < n; i++){
19281
+ sprites[i].destroy();
19282
+ }
19283
+ sprites.length = 0;
19160
19284
  this._sprites = null;
19161
19285
  this._spriteNamesToIndex = null;
19162
19286
  };
@@ -19255,10 +19379,29 @@ exports.TextVerticalAlignment = void 0;
19255
19379
  };
19256
19380
  /**
19257
19381
  * @override
19382
+ * @internal
19383
+ */ _proto._addRefCount = function _addRefCount(value) {
19384
+ var _this__atlas;
19385
+ RefObject.prototype._addRefCount.call(this, value);
19386
+ (_this__atlas = this._atlas) == null ? void 0 : _this__atlas._addRefCount(value);
19387
+ };
19388
+ /**
19389
+ * @override
19390
+ * @internal
19258
19391
  */ _proto._onDestroy = function _onDestroy() {
19259
- if (this._texture) {
19260
- this._texture = null;
19261
- }
19392
+ this._positions.length = 0;
19393
+ this._positions = null;
19394
+ this._uvs.length = 0;
19395
+ this._uvs = null;
19396
+ this._atlasRegion = null;
19397
+ this._atlasRegionOffset = null;
19398
+ this._region = null;
19399
+ this._pivot = null;
19400
+ this._border = null;
19401
+ this._bounds = null;
19402
+ this._atlas = null;
19403
+ this._texture = null;
19404
+ this._updateFlagManager = null;
19262
19405
  };
19263
19406
  _proto._calDefaultSize = function _calDefaultSize() {
19264
19407
  if (this._texture) {
@@ -19361,7 +19504,7 @@ exports.TextVerticalAlignment = void 0;
19361
19504
  key: "width",
19362
19505
  get: /**
19363
19506
  * The width of the sprite (in world coordinates).
19364
- *
19507
+ *
19365
19508
  * @remarks
19366
19509
  * If width is set, return the set value,
19367
19510
  * otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
@@ -19384,7 +19527,7 @@ exports.TextVerticalAlignment = void 0;
19384
19527
  key: "height",
19385
19528
  get: /**
19386
19529
  * The height of the sprite (in world coordinates).
19387
- *
19530
+ *
19388
19531
  * @remarks
19389
19532
  * If height is set, return the set value,
19390
19533
  * otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
@@ -19685,21 +19828,11 @@ SlicedSpriteAssembler = __decorate$1([
19685
19828
  /**
19686
19829
  * @internal
19687
19830
  */ _proto._cloneTo = function _cloneTo(target) {
19831
+ Renderer.prototype._cloneTo.call(this, target);
19688
19832
  target.sprite = this._sprite;
19689
19833
  target.drawMode = this._drawMode;
19690
19834
  };
19691
19835
  /**
19692
- * @internal
19693
- */ _proto._onDestroy = function _onDestroy() {
19694
- var _this__sprite;
19695
- (_this__sprite = this._sprite) == null ? void 0 : _this__sprite._updateFlagManager.removeListener(this._onSpriteChange);
19696
- this._color = null;
19697
- this._sprite = null;
19698
- this._assembler = null;
19699
- this._renderData = null;
19700
- Renderer.prototype._onDestroy.call(this);
19701
- };
19702
- /**
19703
19836
  * @override
19704
19837
  */ _proto._updateBounds = function _updateBounds(worldBounds) {
19705
19838
  if (this.sprite) {
@@ -19737,6 +19870,20 @@ SlicedSpriteAssembler = __decorate$1([
19737
19870
  context.camera._renderPipeline.pushPrimitive(spriteElement);
19738
19871
  }
19739
19872
  };
19873
+ /**
19874
+ * @internal
19875
+ */ _proto._onDestroy = function _onDestroy() {
19876
+ Renderer.prototype._onDestroy.call(this);
19877
+ var sprite = this._sprite;
19878
+ if (sprite) {
19879
+ sprite._addRefCount(-1);
19880
+ sprite._updateFlagManager.removeListener(this._onSpriteChange);
19881
+ }
19882
+ this._color = null;
19883
+ this._sprite = null;
19884
+ this._assembler = null;
19885
+ this._renderData = null;
19886
+ };
19740
19887
  _proto._calDefaultSize = function _calDefaultSize() {
19741
19888
  var sprite = this._sprite;
19742
19889
  if (sprite) {
@@ -19828,9 +19975,13 @@ SlicedSpriteAssembler = __decorate$1([
19828
19975
  set: function set(value) {
19829
19976
  var lastSprite = this._sprite;
19830
19977
  if (lastSprite !== value) {
19831
- lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
19978
+ if (lastSprite) {
19979
+ lastSprite._addRefCount(-1);
19980
+ lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
19981
+ }
19832
19982
  this._dirtyUpdateFlag |= 0x7;
19833
19983
  if (value) {
19984
+ value._addRefCount(1);
19834
19985
  value._updateFlagManager.addListener(this._onSpriteChange);
19835
19986
  this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
19836
19987
  } else {
@@ -20434,6 +20585,7 @@ var /**
20434
20585
  /**
20435
20586
  * @internal
20436
20587
  */ _proto._cloneTo = function _cloneTo(target) {
20588
+ Renderer.prototype._cloneTo.call(this, target);
20437
20589
  target.font = this._font;
20438
20590
  target._subFont = this._subFont;
20439
20591
  };
@@ -35854,7 +36006,7 @@ function _interopNamespace(e) {
35854
36006
  }
35855
36007
  var CoreObjects__namespace = /*#__PURE__*/ _interopNamespace(CoreObjects);
35856
36008
  //@ts-ignore
35857
- var version = "0.9.10";
36009
+ var version = "0.9.12";
35858
36010
  console.log("Galacean engine version: " + version);
35859
36011
  for(var key in CoreObjects__namespace){
35860
36012
  CoreObjects.Loader.registerClass(key, CoreObjects__namespace[key]);