@galacean/engine-core 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.
- package/dist/main.js +194 -42
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +194 -42
- package/dist/module.js +194 -42
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/sprite/Sprite.d.ts +0 -4
- package/types/2d/sprite/SpriteMask.d.ts +2 -8
- package/types/2d/sprite/SpriteRenderer.d.ts +2 -3
- package/types/2d/text/TextRenderer.d.ts +2 -3
- package/types/Renderer.d.ts +2 -1
- package/types/mesh/MeshRenderer.d.ts +1 -2
- package/types/sky/Sky.d.ts +12 -4
package/dist/module.js
CHANGED
|
@@ -1461,9 +1461,11 @@ var GLCapabilityType;
|
|
|
1461
1461
|
renderTexture
|
|
1462
1462
|
];
|
|
1463
1463
|
for(var i = 0, n = colorTextures.length; i < n; i++){
|
|
1464
|
-
|
|
1464
|
+
var colorTexture = colorTextures[i];
|
|
1465
|
+
if (colorTexture._isDepthTexture) {
|
|
1465
1466
|
throw "Render texture can't use depth format.";
|
|
1466
1467
|
}
|
|
1468
|
+
colorTexture._addRefCount(1);
|
|
1467
1469
|
}
|
|
1468
1470
|
_this._colorTextures = colorTextures;
|
|
1469
1471
|
} else {
|
|
@@ -1474,6 +1476,7 @@ var GLCapabilityType;
|
|
|
1474
1476
|
throw "Depth texture must use depth format.";
|
|
1475
1477
|
}
|
|
1476
1478
|
_this._depthTexture = depth;
|
|
1479
|
+
_this._depthTexture._addRefCount(1);
|
|
1477
1480
|
}
|
|
1478
1481
|
_this._platformRenderTarget = engine._hardwareRenderer.createPlatformRenderTarget(_assert_this_initialized(_this));
|
|
1479
1482
|
return _this;
|
|
@@ -1502,8 +1505,14 @@ var GLCapabilityType;
|
|
|
1502
1505
|
/**
|
|
1503
1506
|
* Destroy render target.
|
|
1504
1507
|
*/ _proto.destroy = function destroy() {
|
|
1508
|
+
var _this__depthTexture;
|
|
1505
1509
|
this._platformRenderTarget.destroy();
|
|
1506
|
-
this
|
|
1510
|
+
var _this = this, colorTextures = _this._colorTextures;
|
|
1511
|
+
for(var i = 0, n = colorTextures.length; i < n; i++){
|
|
1512
|
+
colorTextures[i]._addRefCount(-1);
|
|
1513
|
+
}
|
|
1514
|
+
colorTextures.length = 0;
|
|
1515
|
+
(_this__depthTexture = this._depthTexture) == null ? void 0 : _this__depthTexture._addRefCount(-1);
|
|
1507
1516
|
this._depthTexture = null;
|
|
1508
1517
|
this._depth = null;
|
|
1509
1518
|
};
|
|
@@ -1949,6 +1958,7 @@ var GLCapabilityType;
|
|
|
1949
1958
|
var fontAtlas = new FontAtlas(engine);
|
|
1950
1959
|
var texture = new Texture2D(engine, 256, 256);
|
|
1951
1960
|
fontAtlas.texture = texture;
|
|
1961
|
+
fontAtlas.isGCIgnored = texture.isGCIgnored = true;
|
|
1952
1962
|
this._fontAtlases.push(fontAtlas);
|
|
1953
1963
|
return fontAtlas;
|
|
1954
1964
|
};
|
|
@@ -8754,6 +8764,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
8754
8764
|
_proto.cloneTo = function cloneTo(target) {
|
|
8755
8765
|
CloneManager.deepCloneObject(this._macroCollection, target._macroCollection);
|
|
8756
8766
|
Object.assign(target._macroMap, this._macroMap);
|
|
8767
|
+
var referCount = target._getRefCount();
|
|
8757
8768
|
var propertyValueMap = this._propertyValueMap;
|
|
8758
8769
|
var targetPropertyValueMap = target._propertyValueMap;
|
|
8759
8770
|
var keys = Object.keys(propertyValueMap);
|
|
@@ -8765,6 +8776,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
8765
8776
|
targetPropertyValueMap[k] = property;
|
|
8766
8777
|
} else if (_instanceof(property, Texture)) {
|
|
8767
8778
|
targetPropertyValueMap[k] = property;
|
|
8779
|
+
referCount > 0 && property._addRefCount(referCount);
|
|
8768
8780
|
} else if (_instanceof(property, Array) || _instanceof(property, Float32Array) || _instanceof(property, Int32Array)) {
|
|
8769
8781
|
targetPropertyValueMap[k] = property.slice();
|
|
8770
8782
|
} else {
|
|
@@ -10113,6 +10125,14 @@ var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10113
10125
|
};
|
|
10114
10126
|
/**
|
|
10115
10127
|
* @internal
|
|
10128
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
10129
|
+
var materials = this._materials;
|
|
10130
|
+
for(var i = 0, n = materials.length; i < n; i++){
|
|
10131
|
+
target._setMaterial(i, materials[i]);
|
|
10132
|
+
}
|
|
10133
|
+
};
|
|
10134
|
+
/**
|
|
10135
|
+
* @internal
|
|
10116
10136
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
10117
10137
|
this.entity.transform._updateFlagManager.removeListener(this._onTransformChanged);
|
|
10118
10138
|
this.shaderData._addRefCount(-1);
|
|
@@ -10291,7 +10311,7 @@ __decorate([
|
|
|
10291
10311
|
ignoreClone
|
|
10292
10312
|
], Renderer.prototype, "_overrideUpdate", void 0);
|
|
10293
10313
|
__decorate([
|
|
10294
|
-
|
|
10314
|
+
ignoreClone
|
|
10295
10315
|
], Renderer.prototype, "_materials", void 0);
|
|
10296
10316
|
__decorate([
|
|
10297
10317
|
ignoreClone
|
|
@@ -10501,18 +10521,9 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10501
10521
|
}
|
|
10502
10522
|
var _proto = SpriteMask.prototype;
|
|
10503
10523
|
/**
|
|
10504
|
-
* @override
|
|
10505
|
-
* @inheritdoc
|
|
10506
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
10507
|
-
var _this__sprite;
|
|
10508
|
-
(_this__sprite = this._sprite) == null ? void 0 : _this__sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
10509
|
-
this._sprite = null;
|
|
10510
|
-
this._renderData = null;
|
|
10511
|
-
Renderer.prototype._onDestroy.call(this);
|
|
10512
|
-
};
|
|
10513
|
-
/**
|
|
10514
10524
|
* @internal
|
|
10515
10525
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
10526
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
10516
10527
|
target.sprite = this._sprite;
|
|
10517
10528
|
};
|
|
10518
10529
|
/**
|
|
@@ -10549,6 +10560,19 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10549
10560
|
context.camera._renderPipeline._allSpriteMasks.add(this);
|
|
10550
10561
|
this._maskElement = maskElement;
|
|
10551
10562
|
};
|
|
10563
|
+
/**
|
|
10564
|
+
* @internal
|
|
10565
|
+
* @inheritdoc
|
|
10566
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
10567
|
+
Renderer.prototype._onDestroy.call(this);
|
|
10568
|
+
var sprite = this._sprite;
|
|
10569
|
+
if (sprite) {
|
|
10570
|
+
sprite._addRefCount(-1);
|
|
10571
|
+
sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
10572
|
+
}
|
|
10573
|
+
this._sprite = null;
|
|
10574
|
+
this._renderData = null;
|
|
10575
|
+
};
|
|
10552
10576
|
_proto._calDefaultSize = function _calDefaultSize() {
|
|
10553
10577
|
var sprite = this._sprite;
|
|
10554
10578
|
if (sprite) {
|
|
@@ -10667,9 +10691,13 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10667
10691
|
set: function set(value) {
|
|
10668
10692
|
var lastSprite = this._sprite;
|
|
10669
10693
|
if (lastSprite !== value) {
|
|
10670
|
-
|
|
10694
|
+
if (lastSprite) {
|
|
10695
|
+
lastSprite._addRefCount(-1);
|
|
10696
|
+
lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
10697
|
+
}
|
|
10671
10698
|
this._dirtyUpdateFlag |= 0x7;
|
|
10672
10699
|
if (value) {
|
|
10700
|
+
value._addRefCount(1);
|
|
10673
10701
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
10674
10702
|
this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
|
|
10675
10703
|
} else {
|
|
@@ -11236,10 +11264,11 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11236
11264
|
/**
|
|
11237
11265
|
* @internal
|
|
11238
11266
|
*/ _proto._setVertexBufferBinding = function _setVertexBufferBinding(index, binding) {
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
|
|
11242
|
-
|
|
11267
|
+
var referCount = this._getRefCount();
|
|
11268
|
+
if (referCount > 0) {
|
|
11269
|
+
var _this__vertexBufferBindings_index;
|
|
11270
|
+
(_this__vertexBufferBindings_index = this._vertexBufferBindings[index]) == null ? void 0 : _this__vertexBufferBindings_index._buffer._addRefCount(-referCount);
|
|
11271
|
+
binding == null ? void 0 : binding._buffer._addRefCount(referCount);
|
|
11243
11272
|
}
|
|
11244
11273
|
this._vertexBufferBindings[index] = binding;
|
|
11245
11274
|
this._bufferStructChanged = true;
|
|
@@ -11253,11 +11282,13 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11253
11282
|
/**
|
|
11254
11283
|
* @override
|
|
11255
11284
|
*/ _proto._addRefCount = function _addRefCount(value) {
|
|
11285
|
+
var _this__indexBufferBinding;
|
|
11256
11286
|
RefObject.prototype._addRefCount.call(this, value);
|
|
11257
11287
|
var vertexBufferBindings = this._vertexBufferBindings;
|
|
11258
11288
|
for(var i = 0, n = vertexBufferBindings.length; i < n; i++){
|
|
11259
11289
|
vertexBufferBindings[i]._buffer._addRefCount(value);
|
|
11260
11290
|
}
|
|
11291
|
+
(_this__indexBufferBinding = this._indexBufferBinding) == null ? void 0 : _this__indexBufferBinding._buffer._addRefCount(value);
|
|
11261
11292
|
};
|
|
11262
11293
|
/**
|
|
11263
11294
|
* @override
|
|
@@ -11277,6 +11308,11 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11277
11308
|
};
|
|
11278
11309
|
_proto._setIndexBufferBinding = function _setIndexBufferBinding(binding) {
|
|
11279
11310
|
var lastBinding = this._indexBufferBinding;
|
|
11311
|
+
var referCount = this._getRefCount();
|
|
11312
|
+
if (referCount > 0) {
|
|
11313
|
+
lastBinding == null ? void 0 : lastBinding.buffer._addRefCount(-referCount);
|
|
11314
|
+
binding == null ? void 0 : binding.buffer._addRefCount(referCount);
|
|
11315
|
+
}
|
|
11280
11316
|
if (binding) {
|
|
11281
11317
|
this._indexBufferBinding = binding;
|
|
11282
11318
|
this._glIndexType = BufferUtil._getGLIndexType(binding.format);
|
|
@@ -12949,12 +12985,14 @@ var VertexChangedFlags;
|
|
|
12949
12985
|
var mesh = this._mesh;
|
|
12950
12986
|
if (mesh && !mesh.destroyed) {
|
|
12951
12987
|
mesh._addRefCount(-1);
|
|
12988
|
+
mesh._updateFlagManager.removeListener(this._onMeshChanged);
|
|
12952
12989
|
this._mesh = null;
|
|
12953
12990
|
}
|
|
12954
12991
|
};
|
|
12955
12992
|
/**
|
|
12956
12993
|
* @internal
|
|
12957
12994
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
12995
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
12958
12996
|
target.mesh = this._mesh;
|
|
12959
12997
|
};
|
|
12960
12998
|
/**
|
|
@@ -13247,6 +13285,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13247
13285
|
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
13248
13286
|
this._jointTexture = new Texture2D(engine, 4, jointCount, TextureFormat.R32G32B32A32, false);
|
|
13249
13287
|
this._jointTexture.filterMode = TextureFilterMode.Point;
|
|
13288
|
+
this._jointTexture.isGCIgnored = true;
|
|
13250
13289
|
}
|
|
13251
13290
|
shaderData.disableMacro("O3_JOINTS_NUM");
|
|
13252
13291
|
shaderData.enableMacro("O3_USE_JOINT_TEXTURE");
|
|
@@ -13280,6 +13319,15 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13280
13319
|
};
|
|
13281
13320
|
/**
|
|
13282
13321
|
* @internal
|
|
13322
|
+
* @override
|
|
13323
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
13324
|
+
var _this_rootBone, _this__jointTexture;
|
|
13325
|
+
MeshRenderer.prototype._onDestroy.call(this);
|
|
13326
|
+
(_this_rootBone = this.rootBone) == null ? void 0 : _this_rootBone.transform._updateFlagManager.removeListener(this._onTransformChanged);
|
|
13327
|
+
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
13328
|
+
};
|
|
13329
|
+
/**
|
|
13330
|
+
* @internal
|
|
13283
13331
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13284
13332
|
MeshRenderer.prototype._cloneTo.call(this, target);
|
|
13285
13333
|
this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
|
|
@@ -14443,14 +14491,17 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
14443
14491
|
_proto._createMesh = function _createMesh(engine, index) {
|
|
14444
14492
|
var MAX_VERTEX_COUNT = Basic2DBatcher.MAX_VERTEX_COUNT;
|
|
14445
14493
|
var mesh = new BufferMesh(engine, "BufferMesh" + index);
|
|
14494
|
+
mesh.isGCIgnored = true;
|
|
14446
14495
|
var vertexElements = [];
|
|
14447
14496
|
var vertexStride = this.createVertexElements(vertexElements);
|
|
14448
14497
|
// vertices
|
|
14449
|
-
this._vertexBuffers[index] = new Buffer(engine, BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, BufferUsage.Dynamic);
|
|
14498
|
+
var vertexBuffer = this._vertexBuffers[index] = new Buffer(engine, BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, BufferUsage.Dynamic);
|
|
14499
|
+
vertexBuffer.isGCIgnored = true;
|
|
14450
14500
|
// indices
|
|
14451
|
-
this._indiceBuffers[index] = new Buffer(engine, BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, BufferUsage.Dynamic);
|
|
14452
|
-
|
|
14453
|
-
mesh.
|
|
14501
|
+
var indiceBuffer = this._indiceBuffers[index] = new Buffer(engine, BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, BufferUsage.Dynamic);
|
|
14502
|
+
indiceBuffer.isGCIgnored = true;
|
|
14503
|
+
mesh.setVertexBufferBinding(vertexBuffer, vertexStride);
|
|
14504
|
+
mesh.setIndexBufferBinding(indiceBuffer, IndexFormat.UInt16);
|
|
14454
14505
|
mesh.setVertexElements(vertexElements);
|
|
14455
14506
|
return mesh;
|
|
14456
14507
|
};
|
|
@@ -14689,6 +14740,12 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
|
|
|
14689
14740
|
var _proto = Sky.prototype;
|
|
14690
14741
|
/**
|
|
14691
14742
|
* @internal
|
|
14743
|
+
*/ _proto.destroy = function destroy() {
|
|
14744
|
+
this.mesh = null;
|
|
14745
|
+
this.material = null;
|
|
14746
|
+
};
|
|
14747
|
+
/**
|
|
14748
|
+
* @internal
|
|
14692
14749
|
*/ _proto._render = function _render(context) {
|
|
14693
14750
|
var _this = this, material = _this.material, mesh = _this.mesh;
|
|
14694
14751
|
if (!material) {
|
|
@@ -14727,6 +14784,40 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
|
|
|
14727
14784
|
rhi.drawPrimitive(mesh, mesh.subMesh, program);
|
|
14728
14785
|
cameraShaderData.setMatrix(RenderContext._vpMatrixProperty, originViewProjMatrix);
|
|
14729
14786
|
};
|
|
14787
|
+
_create_class(Sky, [
|
|
14788
|
+
{
|
|
14789
|
+
key: "material",
|
|
14790
|
+
get: /**
|
|
14791
|
+
* Material of the sky.
|
|
14792
|
+
*/ function get() {
|
|
14793
|
+
return this._material;
|
|
14794
|
+
},
|
|
14795
|
+
set: function set(value) {
|
|
14796
|
+
if (this._material !== value) {
|
|
14797
|
+
var _this__material;
|
|
14798
|
+
value == null ? void 0 : value._addRefCount(1);
|
|
14799
|
+
(_this__material = this._material) == null ? void 0 : _this__material._addRefCount(-1);
|
|
14800
|
+
this._material = value;
|
|
14801
|
+
}
|
|
14802
|
+
}
|
|
14803
|
+
},
|
|
14804
|
+
{
|
|
14805
|
+
key: "mesh",
|
|
14806
|
+
get: /**
|
|
14807
|
+
* Mesh of the sky.
|
|
14808
|
+
*/ function get() {
|
|
14809
|
+
return this._mesh;
|
|
14810
|
+
},
|
|
14811
|
+
set: function set(value) {
|
|
14812
|
+
if (this._mesh !== value) {
|
|
14813
|
+
var _this__mesh;
|
|
14814
|
+
value == null ? void 0 : value._addRefCount(1);
|
|
14815
|
+
(_this__mesh = this._mesh) == null ? void 0 : _this__mesh._addRefCount(-1);
|
|
14816
|
+
this._mesh = value;
|
|
14817
|
+
}
|
|
14818
|
+
}
|
|
14819
|
+
}
|
|
14820
|
+
]);
|
|
14730
14821
|
return Sky;
|
|
14731
14822
|
}();
|
|
14732
14823
|
(function() {
|
|
@@ -14757,11 +14848,28 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
|
|
|
14757
14848
|
this.sky = new Sky();
|
|
14758
14849
|
this./** @internal */ _textureFillMode = BackgroundTextureFillMode.AspectFitHeight;
|
|
14759
14850
|
this._texture = null;
|
|
14760
|
-
this.
|
|
14851
|
+
this._initMesh(_engine);
|
|
14761
14852
|
}
|
|
14762
14853
|
var _proto = Background.prototype;
|
|
14763
14854
|
/**
|
|
14764
14855
|
* @internal
|
|
14856
|
+
*/ _proto.destroy = function destroy() {
|
|
14857
|
+
this._mesh._addRefCount(-1);
|
|
14858
|
+
this._mesh = null;
|
|
14859
|
+
this.texture = null;
|
|
14860
|
+
this.solidColor = null;
|
|
14861
|
+
this.sky.destroy();
|
|
14862
|
+
this._engine = null;
|
|
14863
|
+
};
|
|
14864
|
+
/**
|
|
14865
|
+
* @internal
|
|
14866
|
+
* Standalone for CanvasRenderer plugin.
|
|
14867
|
+
*/ _proto._initMesh = function _initMesh(engine) {
|
|
14868
|
+
this._mesh = this._createPlane(engine);
|
|
14869
|
+
this._mesh._addRefCount(1);
|
|
14870
|
+
};
|
|
14871
|
+
/**
|
|
14872
|
+
* @internal
|
|
14765
14873
|
*/ _proto._resizeBackgroundTexture = function _resizeBackgroundTexture() {
|
|
14766
14874
|
if (!this._texture) {
|
|
14767
14875
|
return;
|
|
@@ -14830,6 +14938,9 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
|
|
|
14830
14938
|
},
|
|
14831
14939
|
set: function set(value) {
|
|
14832
14940
|
if (this._texture !== value) {
|
|
14941
|
+
var _this__texture;
|
|
14942
|
+
value == null ? void 0 : value._addRefCount(1);
|
|
14943
|
+
(_this__texture = this._texture) == null ? void 0 : _this__texture._addRefCount(-1);
|
|
14833
14944
|
this._texture = value;
|
|
14834
14945
|
this._engine._backgroundTextureMaterial.shaderData.setTexture("u_baseTexture", value);
|
|
14835
14946
|
}
|
|
@@ -15333,6 +15444,7 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
|
|
|
15333
15444
|
this._rootEntities[0].destroy();
|
|
15334
15445
|
}
|
|
15335
15446
|
this._activeCameras.length = 0;
|
|
15447
|
+
this.background.destroy();
|
|
15336
15448
|
this.shaderData._addRefCount(-1);
|
|
15337
15449
|
};
|
|
15338
15450
|
_proto._addToRootEntityList = function _addToRootEntityList(index, rootEntity) {
|
|
@@ -15746,7 +15858,7 @@ ShaderPool.init();
|
|
|
15746
15858
|
_this._spriteDefaultMaterial = _this._createSpriteMaterial();
|
|
15747
15859
|
_this._spriteMaskDefaultMaterial = _this._createSpriteMaskMaterial();
|
|
15748
15860
|
_this._textDefaultFont = Font.createFromOS(_assert_this_initialized(_this), "Arial");
|
|
15749
|
-
_this._textDefaultFont.isGCIgnored =
|
|
15861
|
+
_this._textDefaultFont.isGCIgnored = true;
|
|
15750
15862
|
_this.inputManager = new InputManager(_assert_this_initialized(_this));
|
|
15751
15863
|
var magentaPixel = new Uint8Array([
|
|
15752
15864
|
255,
|
|
@@ -15781,6 +15893,7 @@ ShaderPool.init();
|
|
|
15781
15893
|
_this._magentaTexture2DArray = magentaTexture2DArray;
|
|
15782
15894
|
}
|
|
15783
15895
|
var magentaMaterial = new Material(_assert_this_initialized(_this), Shader.find("unlit"));
|
|
15896
|
+
magentaMaterial.isGCIgnored = true;
|
|
15784
15897
|
magentaMaterial.shaderData.setColor("u_baseColor", new Color(1.0, 0.0, 1.01, 1.0));
|
|
15785
15898
|
_this._magentaMaterial = magentaMaterial;
|
|
15786
15899
|
var backgroundTextureMaterial = new Material(_assert_this_initialized(_this), Shader.find("background-texture"));
|
|
@@ -17313,7 +17426,11 @@ var /**
|
|
|
17313
17426
|
var height = shadowCascades == ShadowCascadesMode.TwoCascades ? shadowTileResolution : shadowTileResolution * 2;
|
|
17314
17427
|
this._shadowMapSize.set(1.0 / width, 1.0 / height, width, height);
|
|
17315
17428
|
}
|
|
17316
|
-
this._renderTargets
|
|
17429
|
+
var renderTargets = this._renderTargets;
|
|
17430
|
+
if (renderTargets) {
|
|
17431
|
+
renderTargets.destroy();
|
|
17432
|
+
this._renderTargets = null;
|
|
17433
|
+
}
|
|
17317
17434
|
var viewportOffset = this._viewportOffsets;
|
|
17318
17435
|
var shadowTileResolution1 = this._shadowTileResolution;
|
|
17319
17436
|
switch(shadowCascades){
|
|
@@ -19355,10 +19472,17 @@ var TextVerticalAlignment;
|
|
|
19355
19472
|
* @internal
|
|
19356
19473
|
*/ _proto._addSprite = function _addSprite(sprite) {
|
|
19357
19474
|
this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
|
|
19475
|
+
sprite._atlas = this;
|
|
19476
|
+
sprite.isGCIgnored = true;
|
|
19358
19477
|
};
|
|
19359
19478
|
/**
|
|
19360
19479
|
* @override
|
|
19361
19480
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
19481
|
+
var _this = this, sprites = _this._sprites;
|
|
19482
|
+
for(var i = 0, n = sprites.length; i < n; i++){
|
|
19483
|
+
sprites[i].destroy();
|
|
19484
|
+
}
|
|
19485
|
+
sprites.length = 0;
|
|
19362
19486
|
this._sprites = null;
|
|
19363
19487
|
this._spriteNamesToIndex = null;
|
|
19364
19488
|
};
|
|
@@ -19459,10 +19583,29 @@ var TextVerticalAlignment;
|
|
|
19459
19583
|
};
|
|
19460
19584
|
/**
|
|
19461
19585
|
* @override
|
|
19586
|
+
* @internal
|
|
19587
|
+
*/ _proto._addRefCount = function _addRefCount(value) {
|
|
19588
|
+
var _this__atlas;
|
|
19589
|
+
RefObject.prototype._addRefCount.call(this, value);
|
|
19590
|
+
(_this__atlas = this._atlas) == null ? void 0 : _this__atlas._addRefCount(value);
|
|
19591
|
+
};
|
|
19592
|
+
/**
|
|
19593
|
+
* @override
|
|
19594
|
+
* @internal
|
|
19462
19595
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
19463
|
-
|
|
19464
|
-
|
|
19465
|
-
|
|
19596
|
+
this._positions.length = 0;
|
|
19597
|
+
this._positions = null;
|
|
19598
|
+
this._uvs.length = 0;
|
|
19599
|
+
this._uvs = null;
|
|
19600
|
+
this._atlasRegion = null;
|
|
19601
|
+
this._atlasRegionOffset = null;
|
|
19602
|
+
this._region = null;
|
|
19603
|
+
this._pivot = null;
|
|
19604
|
+
this._border = null;
|
|
19605
|
+
this._bounds = null;
|
|
19606
|
+
this._atlas = null;
|
|
19607
|
+
this._texture = null;
|
|
19608
|
+
this._updateFlagManager = null;
|
|
19466
19609
|
};
|
|
19467
19610
|
_proto._calDefaultSize = function _calDefaultSize() {
|
|
19468
19611
|
if (this._texture) {
|
|
@@ -19565,7 +19708,7 @@ var TextVerticalAlignment;
|
|
|
19565
19708
|
key: "width",
|
|
19566
19709
|
get: /**
|
|
19567
19710
|
* The width of the sprite (in world coordinates).
|
|
19568
|
-
*
|
|
19711
|
+
*
|
|
19569
19712
|
* @remarks
|
|
19570
19713
|
* If width is set, return the set value,
|
|
19571
19714
|
* otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
@@ -19588,7 +19731,7 @@ var TextVerticalAlignment;
|
|
|
19588
19731
|
key: "height",
|
|
19589
19732
|
get: /**
|
|
19590
19733
|
* The height of the sprite (in world coordinates).
|
|
19591
|
-
*
|
|
19734
|
+
*
|
|
19592
19735
|
* @remarks
|
|
19593
19736
|
* If height is set, return the set value,
|
|
19594
19737
|
* otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
@@ -19891,21 +20034,11 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19891
20034
|
/**
|
|
19892
20035
|
* @internal
|
|
19893
20036
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
20037
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
19894
20038
|
target.sprite = this._sprite;
|
|
19895
20039
|
target.drawMode = this._drawMode;
|
|
19896
20040
|
};
|
|
19897
20041
|
/**
|
|
19898
|
-
* @internal
|
|
19899
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
19900
|
-
var _this__sprite;
|
|
19901
|
-
(_this__sprite = this._sprite) == null ? void 0 : _this__sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
19902
|
-
this._color = null;
|
|
19903
|
-
this._sprite = null;
|
|
19904
|
-
this._assembler = null;
|
|
19905
|
-
this._renderData = null;
|
|
19906
|
-
Renderer.prototype._onDestroy.call(this);
|
|
19907
|
-
};
|
|
19908
|
-
/**
|
|
19909
20042
|
* @override
|
|
19910
20043
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
19911
20044
|
if (this.sprite) {
|
|
@@ -19943,6 +20076,20 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19943
20076
|
context.camera._renderPipeline.pushPrimitive(spriteElement);
|
|
19944
20077
|
}
|
|
19945
20078
|
};
|
|
20079
|
+
/**
|
|
20080
|
+
* @internal
|
|
20081
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
20082
|
+
Renderer.prototype._onDestroy.call(this);
|
|
20083
|
+
var sprite = this._sprite;
|
|
20084
|
+
if (sprite) {
|
|
20085
|
+
sprite._addRefCount(-1);
|
|
20086
|
+
sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
20087
|
+
}
|
|
20088
|
+
this._color = null;
|
|
20089
|
+
this._sprite = null;
|
|
20090
|
+
this._assembler = null;
|
|
20091
|
+
this._renderData = null;
|
|
20092
|
+
};
|
|
19946
20093
|
_proto._calDefaultSize = function _calDefaultSize() {
|
|
19947
20094
|
var sprite = this._sprite;
|
|
19948
20095
|
if (sprite) {
|
|
@@ -20034,9 +20181,13 @@ SlicedSpriteAssembler = __decorate([
|
|
|
20034
20181
|
set: function set(value) {
|
|
20035
20182
|
var lastSprite = this._sprite;
|
|
20036
20183
|
if (lastSprite !== value) {
|
|
20037
|
-
|
|
20184
|
+
if (lastSprite) {
|
|
20185
|
+
lastSprite._addRefCount(-1);
|
|
20186
|
+
lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
20187
|
+
}
|
|
20038
20188
|
this._dirtyUpdateFlag |= 0x7;
|
|
20039
20189
|
if (value) {
|
|
20190
|
+
value._addRefCount(1);
|
|
20040
20191
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
20041
20192
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
|
|
20042
20193
|
} else {
|
|
@@ -20644,6 +20795,7 @@ var /**
|
|
|
20644
20795
|
/**
|
|
20645
20796
|
* @internal
|
|
20646
20797
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
20798
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
20647
20799
|
target.font = this._font;
|
|
20648
20800
|
target._subFont = this._subFont;
|
|
20649
20801
|
};
|