@galacean/engine-core 0.9.7 → 0.9.9
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 +181 -72
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +181 -72
- package/dist/module.js +181 -72
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/sprite/Sprite.d.ts +12 -2
- package/types/2d/sprite/SpriteMask.d.ts +15 -4
- package/types/2d/sprite/SpriteRenderer.d.ts +15 -4
package/dist/module.js
CHANGED
|
@@ -10485,8 +10485,10 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10485
10485
|
_this = Renderer.call(this, entity) || this;
|
|
10486
10486
|
/** The mask layers the sprite mask influence to. */ _this.influenceLayers = SpriteMaskLayer.Everything;
|
|
10487
10487
|
_this._sprite = null;
|
|
10488
|
-
_this.
|
|
10489
|
-
_this.
|
|
10488
|
+
_this._automaticWidth = 0;
|
|
10489
|
+
_this._automaticHeight = 0;
|
|
10490
|
+
_this._customWidth = undefined;
|
|
10491
|
+
_this._customHeight = undefined;
|
|
10490
10492
|
_this._flipX = false;
|
|
10491
10493
|
_this._flipY = false;
|
|
10492
10494
|
_this._alphaCutoff = 0.5;
|
|
@@ -10516,12 +10518,11 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10516
10518
|
/**
|
|
10517
10519
|
* @override
|
|
10518
10520
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
10519
|
-
|
|
10520
|
-
|
|
10521
|
+
if (this.sprite) {
|
|
10522
|
+
SimpleSpriteAssembler.updatePositions(this);
|
|
10523
|
+
} else {
|
|
10521
10524
|
worldBounds.min.set(0, 0, 0);
|
|
10522
10525
|
worldBounds.max.set(0, 0, 0);
|
|
10523
|
-
} else {
|
|
10524
|
-
SimpleSpriteAssembler.updatePositions(this);
|
|
10525
10526
|
}
|
|
10526
10527
|
};
|
|
10527
10528
|
/**
|
|
@@ -10532,12 +10533,12 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10532
10533
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
10533
10534
|
return;
|
|
10534
10535
|
}
|
|
10535
|
-
// Update position
|
|
10536
|
+
// Update position
|
|
10536
10537
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
10537
10538
|
SimpleSpriteAssembler.updatePositions(this);
|
|
10538
10539
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
10539
10540
|
}
|
|
10540
|
-
// Update uv
|
|
10541
|
+
// Update uv
|
|
10541
10542
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
10542
10543
|
SimpleSpriteAssembler.updateUVs(this);
|
|
10543
10544
|
this._dirtyUpdateFlag &= ~0x2;
|
|
@@ -10548,11 +10549,27 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10548
10549
|
context.camera._renderPipeline._allSpriteMasks.add(this);
|
|
10549
10550
|
this._maskElement = maskElement;
|
|
10550
10551
|
};
|
|
10552
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
10553
|
+
var sprite = this._sprite;
|
|
10554
|
+
if (sprite) {
|
|
10555
|
+
this._automaticWidth = sprite.width;
|
|
10556
|
+
this._automaticHeight = sprite.height;
|
|
10557
|
+
} else {
|
|
10558
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
10559
|
+
}
|
|
10560
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
10561
|
+
};
|
|
10551
10562
|
_proto._onSpriteChange = function _onSpriteChange(type) {
|
|
10552
10563
|
switch(type){
|
|
10553
10564
|
case SpriteModifyFlags.texture:
|
|
10554
10565
|
this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
|
|
10555
10566
|
break;
|
|
10567
|
+
case SpriteModifyFlags.size:
|
|
10568
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
10569
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
10570
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10571
|
+
}
|
|
10572
|
+
break;
|
|
10556
10573
|
case SpriteModifyFlags.region:
|
|
10557
10574
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
10558
10575
|
this._dirtyUpdateFlag |= 0x3;
|
|
@@ -10560,22 +10577,31 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10560
10577
|
case SpriteModifyFlags.atlasRegion:
|
|
10561
10578
|
this._dirtyUpdateFlag |= 0x2;
|
|
10562
10579
|
break;
|
|
10580
|
+
case SpriteModifyFlags.pivot:
|
|
10581
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10582
|
+
break;
|
|
10563
10583
|
}
|
|
10564
10584
|
};
|
|
10565
10585
|
_create_class(SpriteMask, [
|
|
10566
10586
|
{
|
|
10567
10587
|
key: "width",
|
|
10568
10588
|
get: /**
|
|
10569
|
-
* Render width.
|
|
10589
|
+
* Render width (in world coordinates).
|
|
10590
|
+
*
|
|
10591
|
+
* @remarks
|
|
10592
|
+
* If width is set, return the set value,
|
|
10593
|
+
* otherwise return `SpriteMask.sprite.width`.
|
|
10570
10594
|
*/ function get() {
|
|
10571
|
-
if (this.
|
|
10572
|
-
|
|
10595
|
+
if (this._customWidth !== undefined) {
|
|
10596
|
+
return this._customWidth;
|
|
10597
|
+
} else {
|
|
10598
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
10599
|
+
return this._automaticWidth;
|
|
10573
10600
|
}
|
|
10574
|
-
return this._width;
|
|
10575
10601
|
},
|
|
10576
10602
|
set: function set(value) {
|
|
10577
|
-
if (this.
|
|
10578
|
-
this.
|
|
10603
|
+
if (this._customWidth !== value) {
|
|
10604
|
+
this._customWidth = value;
|
|
10579
10605
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10580
10606
|
}
|
|
10581
10607
|
}
|
|
@@ -10583,16 +10609,22 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10583
10609
|
{
|
|
10584
10610
|
key: "height",
|
|
10585
10611
|
get: /**
|
|
10586
|
-
* Render height.
|
|
10612
|
+
* Render height (in world coordinates).
|
|
10613
|
+
*
|
|
10614
|
+
* @remarks
|
|
10615
|
+
* If height is set, return the set value,
|
|
10616
|
+
* otherwise return `SpriteMask.sprite.height`.
|
|
10587
10617
|
*/ function get() {
|
|
10588
|
-
if (this.
|
|
10589
|
-
|
|
10618
|
+
if (this._customHeight !== undefined) {
|
|
10619
|
+
return this._customHeight;
|
|
10620
|
+
} else {
|
|
10621
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
10622
|
+
return this._automaticHeight;
|
|
10590
10623
|
}
|
|
10591
|
-
return this._height;
|
|
10592
10624
|
},
|
|
10593
10625
|
set: function set(value) {
|
|
10594
|
-
if (this.
|
|
10595
|
-
this.
|
|
10626
|
+
if (this._customHeight !== value) {
|
|
10627
|
+
this._customHeight = value;
|
|
10596
10628
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10597
10629
|
}
|
|
10598
10630
|
}
|
|
@@ -10636,9 +10668,9 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10636
10668
|
var lastSprite = this._sprite;
|
|
10637
10669
|
if (lastSprite !== value) {
|
|
10638
10670
|
lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
10671
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
10639
10672
|
if (value) {
|
|
10640
10673
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
10641
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
10642
10674
|
this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
|
|
10643
10675
|
} else {
|
|
10644
10676
|
this.shaderData.setTexture(SpriteMask._textureProperty, null);
|
|
@@ -10678,10 +10710,16 @@ __decorate([
|
|
|
10678
10710
|
], SpriteMask.prototype, "_sprite", void 0);
|
|
10679
10711
|
__decorate([
|
|
10680
10712
|
ignoreClone
|
|
10681
|
-
], SpriteMask.prototype, "
|
|
10713
|
+
], SpriteMask.prototype, "_automaticWidth", void 0);
|
|
10682
10714
|
__decorate([
|
|
10683
10715
|
ignoreClone
|
|
10684
|
-
], SpriteMask.prototype, "
|
|
10716
|
+
], SpriteMask.prototype, "_automaticHeight", void 0);
|
|
10717
|
+
__decorate([
|
|
10718
|
+
assignmentClone
|
|
10719
|
+
], SpriteMask.prototype, "_customWidth", void 0);
|
|
10720
|
+
__decorate([
|
|
10721
|
+
assignmentClone
|
|
10722
|
+
], SpriteMask.prototype, "_customHeight", void 0);
|
|
10685
10723
|
__decorate([
|
|
10686
10724
|
assignmentClone
|
|
10687
10725
|
], SpriteMask.prototype, "_flipX", void 0);
|
|
@@ -10699,7 +10737,9 @@ var /**
|
|
|
10699
10737
|
*/ SpriteMaskUpdateFlags;
|
|
10700
10738
|
(function(SpriteMaskUpdateFlags) {
|
|
10701
10739
|
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
10702
|
-
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/**
|
|
10740
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
10741
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
10742
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
10703
10743
|
})(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
|
|
10704
10744
|
|
|
10705
10745
|
/**
|
|
@@ -11564,6 +11604,7 @@ var MeshModifyFlags;
|
|
|
11564
11604
|
var subDataDirtyFlags = this._subDataDirtyFlags;
|
|
11565
11605
|
var blendShapeFloatStride = this._vertexElementCount * 3;
|
|
11566
11606
|
var blendShapeByteStride = blendShapeFloatStride * 4;
|
|
11607
|
+
var bufferOffset = this._bufferBindingOffset;
|
|
11567
11608
|
// @todo: should fix bug when dataChangedFlag is true
|
|
11568
11609
|
for(var i = 0, n = blendShapes.length; i < n; i++){
|
|
11569
11610
|
var dataChangedFlag = subDataDirtyFlags[i];
|
|
@@ -11581,7 +11622,7 @@ var MeshModifyFlags;
|
|
|
11581
11622
|
var offset = indexInBuffer * blendShapeFloatStride;
|
|
11582
11623
|
var storeInfo = storeInfos[i];
|
|
11583
11624
|
storeInfo || (storeInfos[i] = storeInfo = new Vector2());
|
|
11584
|
-
storeInfo.set(
|
|
11625
|
+
storeInfo.set(bufferOffset + bufferIndex, indexInBuffer * blendShapeByteStride); // BufferOffset is mesh vertexBuffer offset
|
|
11585
11626
|
var deltaPositions = endFrame.deltaPositions;
|
|
11586
11627
|
for(var j = 0; j < vertexCount; j++){
|
|
11587
11628
|
var start = offset + bufferFloatStride * j;
|
|
@@ -19354,8 +19395,10 @@ var TextVerticalAlignment;
|
|
|
19354
19395
|
if (name === void 0) name = null;
|
|
19355
19396
|
var _this;
|
|
19356
19397
|
_this = RefObject.call(this, engine) || this;
|
|
19357
|
-
_this.
|
|
19358
|
-
_this.
|
|
19398
|
+
_this._automaticWidth = 0;
|
|
19399
|
+
_this._automaticHeight = 0;
|
|
19400
|
+
_this._customWidth = undefined;
|
|
19401
|
+
_this._customHeight = undefined;
|
|
19359
19402
|
_this._positions = [
|
|
19360
19403
|
new Vector2(),
|
|
19361
19404
|
new Vector2(),
|
|
@@ -19376,7 +19419,7 @@ var TextVerticalAlignment;
|
|
|
19376
19419
|
_this._region = new Rect(0, 0, 1, 1);
|
|
19377
19420
|
_this._pivot = new Vector2(0.5, 0.5);
|
|
19378
19421
|
_this._border = new Vector4(0, 0, 0, 0);
|
|
19379
|
-
_this._dirtyUpdateFlag =
|
|
19422
|
+
_this._dirtyUpdateFlag = 0x7;
|
|
19380
19423
|
/** @internal */ _this._updateFlagManager = new UpdateFlagManager();
|
|
19381
19424
|
_this._texture = texture;
|
|
19382
19425
|
region && _this._region.copyFrom(region);
|
|
@@ -19425,9 +19468,12 @@ var TextVerticalAlignment;
|
|
|
19425
19468
|
if (this._texture) {
|
|
19426
19469
|
var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
|
|
19427
19470
|
var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
|
|
19428
|
-
this.
|
|
19429
|
-
this.
|
|
19471
|
+
this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
|
|
19472
|
+
this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
|
|
19473
|
+
} else {
|
|
19474
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
19430
19475
|
}
|
|
19476
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
19431
19477
|
};
|
|
19432
19478
|
_proto._updatePositions = function _updatePositions() {
|
|
19433
19479
|
var blank = this._atlasRegionOffset;
|
|
@@ -19481,11 +19527,16 @@ var TextVerticalAlignment;
|
|
|
19481
19527
|
};
|
|
19482
19528
|
_proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
|
|
19483
19529
|
switch(type){
|
|
19530
|
+
case SpriteModifyFlags.texture:
|
|
19531
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
19532
|
+
break;
|
|
19484
19533
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
19485
19534
|
case SpriteModifyFlags.region:
|
|
19486
|
-
this._dirtyUpdateFlag |=
|
|
19535
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
19487
19536
|
break;
|
|
19488
19537
|
case SpriteModifyFlags.atlasRegion:
|
|
19538
|
+
this._dirtyUpdateFlag |= 0x4 | 0x2;
|
|
19539
|
+
break;
|
|
19489
19540
|
case SpriteModifyFlags.border:
|
|
19490
19541
|
this._dirtyUpdateFlag |= 0x2;
|
|
19491
19542
|
break;
|
|
@@ -19504,7 +19555,9 @@ var TextVerticalAlignment;
|
|
|
19504
19555
|
if (this._texture !== value) {
|
|
19505
19556
|
this._texture = value;
|
|
19506
19557
|
this._dispatchSpriteChange(SpriteModifyFlags.texture);
|
|
19507
|
-
(this.
|
|
19558
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19559
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19560
|
+
}
|
|
19508
19561
|
}
|
|
19509
19562
|
}
|
|
19510
19563
|
},
|
|
@@ -19512,13 +19565,21 @@ var TextVerticalAlignment;
|
|
|
19512
19565
|
key: "width",
|
|
19513
19566
|
get: /**
|
|
19514
19567
|
* The width of the sprite (in world coordinates).
|
|
19568
|
+
*
|
|
19569
|
+
* @remarks
|
|
19570
|
+
* If width is set, return the set value,
|
|
19571
|
+
* otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
19515
19572
|
*/ function get() {
|
|
19516
|
-
this.
|
|
19517
|
-
|
|
19573
|
+
if (this._customWidth !== undefined) {
|
|
19574
|
+
return this._customWidth;
|
|
19575
|
+
} else {
|
|
19576
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
19577
|
+
return this._automaticWidth;
|
|
19578
|
+
}
|
|
19518
19579
|
},
|
|
19519
19580
|
set: function set(value) {
|
|
19520
|
-
if (this.
|
|
19521
|
-
this.
|
|
19581
|
+
if (this._customWidth !== value) {
|
|
19582
|
+
this._customWidth = value;
|
|
19522
19583
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19523
19584
|
}
|
|
19524
19585
|
}
|
|
@@ -19527,13 +19588,21 @@ var TextVerticalAlignment;
|
|
|
19527
19588
|
key: "height",
|
|
19528
19589
|
get: /**
|
|
19529
19590
|
* The height of the sprite (in world coordinates).
|
|
19591
|
+
*
|
|
19592
|
+
* @remarks
|
|
19593
|
+
* If height is set, return the set value,
|
|
19594
|
+
* otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
19530
19595
|
*/ function get() {
|
|
19531
|
-
this.
|
|
19532
|
-
|
|
19596
|
+
if (this._customHeight !== undefined) {
|
|
19597
|
+
return this._customHeight;
|
|
19598
|
+
} else {
|
|
19599
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
19600
|
+
return this._automaticHeight;
|
|
19601
|
+
}
|
|
19533
19602
|
},
|
|
19534
19603
|
set: function set(value) {
|
|
19535
|
-
if (this.
|
|
19536
|
-
this.
|
|
19604
|
+
if (this._customHeight !== value) {
|
|
19605
|
+
this._customHeight = value;
|
|
19537
19606
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19538
19607
|
}
|
|
19539
19608
|
}
|
|
@@ -19563,7 +19632,9 @@ var TextVerticalAlignment;
|
|
|
19563
19632
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
19564
19633
|
this._atlasRegion.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
|
|
19565
19634
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
|
|
19566
|
-
(this.
|
|
19635
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19636
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19637
|
+
}
|
|
19567
19638
|
}
|
|
19568
19639
|
},
|
|
19569
19640
|
{
|
|
@@ -19578,7 +19649,9 @@ var TextVerticalAlignment;
|
|
|
19578
19649
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
19579
19650
|
this._atlasRegionOffset.set(x, y, MathUtil$1.clamp(value.z, 0, 1 - x), MathUtil$1.clamp(value.w, 0, 1 - y));
|
|
19580
19651
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
|
|
19581
|
-
(this.
|
|
19652
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19653
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19654
|
+
}
|
|
19582
19655
|
}
|
|
19583
19656
|
},
|
|
19584
19657
|
{
|
|
@@ -19594,7 +19667,9 @@ var TextVerticalAlignment;
|
|
|
19594
19667
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
19595
19668
|
region.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
|
|
19596
19669
|
this._dispatchSpriteChange(SpriteModifyFlags.region);
|
|
19597
|
-
(this.
|
|
19670
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19671
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19672
|
+
}
|
|
19598
19673
|
}
|
|
19599
19674
|
},
|
|
19600
19675
|
{
|
|
@@ -19644,7 +19719,8 @@ var SpriteUpdateFlags;
|
|
|
19644
19719
|
(function(SpriteUpdateFlags) {
|
|
19645
19720
|
SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
|
|
19646
19721
|
SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
|
|
19647
|
-
SpriteUpdateFlags[SpriteUpdateFlags["
|
|
19722
|
+
SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
|
|
19723
|
+
SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
|
|
19648
19724
|
})(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
|
|
19649
19725
|
|
|
19650
19726
|
var _SlicedSpriteAssembler;
|
|
@@ -19797,8 +19873,10 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19797
19873
|
_this = Renderer.call(this, entity) || this;
|
|
19798
19874
|
_this._color = new Color$1(1, 1, 1, 1);
|
|
19799
19875
|
_this._sprite = null;
|
|
19800
|
-
_this.
|
|
19801
|
-
_this.
|
|
19876
|
+
_this._automaticWidth = 0;
|
|
19877
|
+
_this._automaticHeight = 0;
|
|
19878
|
+
_this._customWidth = undefined;
|
|
19879
|
+
_this._customHeight = undefined;
|
|
19802
19880
|
_this._flipX = false;
|
|
19803
19881
|
_this._flipY = false;
|
|
19804
19882
|
_this._maskLayer = SpriteMaskLayer.Layer0;
|
|
@@ -19814,6 +19892,7 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19814
19892
|
* @internal
|
|
19815
19893
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
19816
19894
|
target.sprite = this._sprite;
|
|
19895
|
+
target.drawMode = this._drawMode;
|
|
19817
19896
|
};
|
|
19818
19897
|
/**
|
|
19819
19898
|
* @internal
|
|
@@ -19829,12 +19908,11 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19829
19908
|
/**
|
|
19830
19909
|
* @override
|
|
19831
19910
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
19832
|
-
|
|
19833
|
-
|
|
19911
|
+
if (this.sprite) {
|
|
19912
|
+
this._assembler.updatePositions(this);
|
|
19913
|
+
} else {
|
|
19834
19914
|
worldBounds.min.set(0, 0, 0);
|
|
19835
19915
|
worldBounds.max.set(0, 0, 0);
|
|
19836
|
-
} else {
|
|
19837
|
-
this._assembler.updatePositions(this);
|
|
19838
19916
|
}
|
|
19839
19917
|
};
|
|
19840
19918
|
/**
|
|
@@ -19844,17 +19922,17 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19844
19922
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
19845
19923
|
return;
|
|
19846
19924
|
}
|
|
19847
|
-
// Update position
|
|
19925
|
+
// Update position
|
|
19848
19926
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
19849
19927
|
this._assembler.updatePositions(this);
|
|
19850
19928
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
19851
19929
|
}
|
|
19852
|
-
// Update uv
|
|
19930
|
+
// Update uv
|
|
19853
19931
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
19854
19932
|
this._assembler.updateUVs(this);
|
|
19855
19933
|
this._dirtyUpdateFlag &= ~0x2;
|
|
19856
19934
|
}
|
|
19857
|
-
// Push primitive
|
|
19935
|
+
// Push primitive
|
|
19858
19936
|
var material = this.getMaterial();
|
|
19859
19937
|
var passes = material.shader.passes;
|
|
19860
19938
|
var renderStates = material.renderStates;
|
|
@@ -19865,6 +19943,16 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19865
19943
|
context.camera._renderPipeline.pushPrimitive(spriteElement);
|
|
19866
19944
|
}
|
|
19867
19945
|
};
|
|
19946
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
19947
|
+
var sprite = this._sprite;
|
|
19948
|
+
if (sprite) {
|
|
19949
|
+
this._automaticWidth = sprite.width;
|
|
19950
|
+
this._automaticHeight = sprite.height;
|
|
19951
|
+
} else {
|
|
19952
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
19953
|
+
}
|
|
19954
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
19955
|
+
};
|
|
19868
19956
|
_proto._updateStencilState = function _updateStencilState() {
|
|
19869
19957
|
// Update stencil.
|
|
19870
19958
|
var material = this.getInstanceMaterial();
|
|
@@ -19890,9 +19978,10 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19890
19978
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, this.sprite.texture);
|
|
19891
19979
|
break;
|
|
19892
19980
|
case SpriteModifyFlags.size:
|
|
19981
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
19893
19982
|
// When the width and height of `SpriteRenderer` are `undefined`,
|
|
19894
19983
|
// the `size` of `Sprite` will affect the position of `SpriteRenderer`.
|
|
19895
|
-
if (this._drawMode === SpriteDrawMode.Sliced || this.
|
|
19984
|
+
if (this._drawMode === SpriteDrawMode.Sliced || this._customWidth === undefined || this._customHeight === undefined) {
|
|
19896
19985
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
19897
19986
|
}
|
|
19898
19987
|
break;
|
|
@@ -19946,9 +20035,9 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19946
20035
|
var lastSprite = this._sprite;
|
|
19947
20036
|
if (lastSprite !== value) {
|
|
19948
20037
|
lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
20038
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
19949
20039
|
if (value) {
|
|
19950
20040
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
19951
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
19952
20041
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
|
|
19953
20042
|
} else {
|
|
19954
20043
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
|
|
@@ -19973,16 +20062,22 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19973
20062
|
{
|
|
19974
20063
|
key: "width",
|
|
19975
20064
|
get: /**
|
|
19976
|
-
* Render width.
|
|
20065
|
+
* Render width (in world coordinates).
|
|
20066
|
+
*
|
|
20067
|
+
* @remarks
|
|
20068
|
+
* If width is set, return the set value,
|
|
20069
|
+
* otherwise return `SpriteRenderer.sprite.width`.
|
|
19977
20070
|
*/ function get() {
|
|
19978
|
-
|
|
19979
|
-
|
|
20071
|
+
if (this._customWidth !== undefined) {
|
|
20072
|
+
return this._customWidth;
|
|
20073
|
+
} else {
|
|
20074
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20075
|
+
return this._automaticWidth;
|
|
20076
|
+
}
|
|
19980
20077
|
},
|
|
19981
20078
|
set: function set(value) {
|
|
19982
|
-
|
|
19983
|
-
|
|
19984
|
-
if (this._width !== value) {
|
|
19985
|
-
this._width = value;
|
|
20079
|
+
if (this._customWidth !== value) {
|
|
20080
|
+
this._customWidth = value;
|
|
19986
20081
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
19987
20082
|
}
|
|
19988
20083
|
}
|
|
@@ -19990,16 +20085,22 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19990
20085
|
{
|
|
19991
20086
|
key: "height",
|
|
19992
20087
|
get: /**
|
|
19993
|
-
* Render height.
|
|
20088
|
+
* Render height (in world coordinates).
|
|
20089
|
+
*
|
|
20090
|
+
* @remarks
|
|
20091
|
+
* If height is set, return the set value,
|
|
20092
|
+
* otherwise return `SpriteRenderer.sprite.height`.
|
|
19994
20093
|
*/ function get() {
|
|
19995
|
-
|
|
19996
|
-
|
|
20094
|
+
if (this._customHeight !== undefined) {
|
|
20095
|
+
return this._customHeight;
|
|
20096
|
+
} else {
|
|
20097
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20098
|
+
return this._automaticHeight;
|
|
20099
|
+
}
|
|
19997
20100
|
},
|
|
19998
20101
|
set: function set(value) {
|
|
19999
|
-
|
|
20000
|
-
|
|
20001
|
-
if (this._height !== value) {
|
|
20002
|
-
this._height = value;
|
|
20102
|
+
if (this._customHeight !== value) {
|
|
20103
|
+
this._customHeight = value;
|
|
20003
20104
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
20004
20105
|
}
|
|
20005
20106
|
}
|
|
@@ -20080,10 +20181,16 @@ __decorate([
|
|
|
20080
20181
|
], SpriteRenderer.prototype, "_sprite", void 0);
|
|
20081
20182
|
__decorate([
|
|
20082
20183
|
ignoreClone
|
|
20083
|
-
], SpriteRenderer.prototype, "
|
|
20184
|
+
], SpriteRenderer.prototype, "_automaticWidth", void 0);
|
|
20084
20185
|
__decorate([
|
|
20085
20186
|
ignoreClone
|
|
20086
|
-
], SpriteRenderer.prototype, "
|
|
20187
|
+
], SpriteRenderer.prototype, "_automaticHeight", void 0);
|
|
20188
|
+
__decorate([
|
|
20189
|
+
assignmentClone
|
|
20190
|
+
], SpriteRenderer.prototype, "_customWidth", void 0);
|
|
20191
|
+
__decorate([
|
|
20192
|
+
assignmentClone
|
|
20193
|
+
], SpriteRenderer.prototype, "_customHeight", void 0);
|
|
20087
20194
|
__decorate([
|
|
20088
20195
|
assignmentClone
|
|
20089
20196
|
], SpriteRenderer.prototype, "_flipX", void 0);
|
|
@@ -20104,7 +20211,9 @@ var /**
|
|
|
20104
20211
|
*/ SpriteRendererUpdateFlags;
|
|
20105
20212
|
(function(SpriteRendererUpdateFlags) {
|
|
20106
20213
|
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
20107
|
-
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/**
|
|
20214
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
20215
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
20216
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
20108
20217
|
})(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
|
|
20109
20218
|
|
|
20110
20219
|
/**
|