@galacean/engine-core 0.9.7 → 0.9.8
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 +179 -71
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +179 -71
- package/dist/module.js +179 -71
- 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/miniprogram.js
CHANGED
|
@@ -10490,8 +10490,10 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10490
10490
|
_this = Renderer.call(this, entity) || this;
|
|
10491
10491
|
/** The mask layers the sprite mask influence to. */ _this.influenceLayers = exports.SpriteMaskLayer.Everything;
|
|
10492
10492
|
_this._sprite = null;
|
|
10493
|
-
_this.
|
|
10494
|
-
_this.
|
|
10493
|
+
_this._automaticWidth = 0;
|
|
10494
|
+
_this._automaticHeight = 0;
|
|
10495
|
+
_this._customWidth = undefined;
|
|
10496
|
+
_this._customHeight = undefined;
|
|
10495
10497
|
_this._flipX = false;
|
|
10496
10498
|
_this._flipY = false;
|
|
10497
10499
|
_this._alphaCutoff = 0.5;
|
|
@@ -10521,12 +10523,11 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10521
10523
|
/**
|
|
10522
10524
|
* @override
|
|
10523
10525
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
+
if (this.sprite) {
|
|
10527
|
+
SimpleSpriteAssembler.updatePositions(this);
|
|
10528
|
+
} else {
|
|
10526
10529
|
worldBounds.min.set(0, 0, 0);
|
|
10527
10530
|
worldBounds.max.set(0, 0, 0);
|
|
10528
|
-
} else {
|
|
10529
|
-
SimpleSpriteAssembler.updatePositions(this);
|
|
10530
10531
|
}
|
|
10531
10532
|
};
|
|
10532
10533
|
/**
|
|
@@ -10537,12 +10538,12 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10537
10538
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
10538
10539
|
return;
|
|
10539
10540
|
}
|
|
10540
|
-
// Update position
|
|
10541
|
+
// Update position
|
|
10541
10542
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
10542
10543
|
SimpleSpriteAssembler.updatePositions(this);
|
|
10543
10544
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
10544
10545
|
}
|
|
10545
|
-
// Update uv
|
|
10546
|
+
// Update uv
|
|
10546
10547
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
10547
10548
|
SimpleSpriteAssembler.updateUVs(this);
|
|
10548
10549
|
this._dirtyUpdateFlag &= ~0x2;
|
|
@@ -10553,11 +10554,27 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10553
10554
|
context.camera._renderPipeline._allSpriteMasks.add(this);
|
|
10554
10555
|
this._maskElement = maskElement;
|
|
10555
10556
|
};
|
|
10557
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
10558
|
+
var sprite = this._sprite;
|
|
10559
|
+
if (sprite) {
|
|
10560
|
+
this._automaticWidth = sprite.width;
|
|
10561
|
+
this._automaticHeight = sprite.height;
|
|
10562
|
+
} else {
|
|
10563
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
10564
|
+
}
|
|
10565
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
10566
|
+
};
|
|
10556
10567
|
_proto._onSpriteChange = function _onSpriteChange(type) {
|
|
10557
10568
|
switch(type){
|
|
10558
10569
|
case SpriteModifyFlags.texture:
|
|
10559
10570
|
this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
|
|
10560
10571
|
break;
|
|
10572
|
+
case SpriteModifyFlags.size:
|
|
10573
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
10574
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
10575
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10576
|
+
}
|
|
10577
|
+
break;
|
|
10561
10578
|
case SpriteModifyFlags.region:
|
|
10562
10579
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
10563
10580
|
this._dirtyUpdateFlag |= 0x3;
|
|
@@ -10565,22 +10582,31 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10565
10582
|
case SpriteModifyFlags.atlasRegion:
|
|
10566
10583
|
this._dirtyUpdateFlag |= 0x2;
|
|
10567
10584
|
break;
|
|
10585
|
+
case SpriteModifyFlags.pivot:
|
|
10586
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10587
|
+
break;
|
|
10568
10588
|
}
|
|
10569
10589
|
};
|
|
10570
10590
|
_create_class(SpriteMask, [
|
|
10571
10591
|
{
|
|
10572
10592
|
key: "width",
|
|
10573
10593
|
get: /**
|
|
10574
|
-
* Render width.
|
|
10594
|
+
* Render width (in world coordinates).
|
|
10595
|
+
*
|
|
10596
|
+
* @remarks
|
|
10597
|
+
* If width is set, return the set value,
|
|
10598
|
+
* otherwise return `SpriteMask.sprite.width`.
|
|
10575
10599
|
*/ function get() {
|
|
10576
|
-
if (this.
|
|
10577
|
-
|
|
10600
|
+
if (this._customWidth !== undefined) {
|
|
10601
|
+
return this._customWidth;
|
|
10602
|
+
} else {
|
|
10603
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
10604
|
+
return this._automaticWidth;
|
|
10578
10605
|
}
|
|
10579
|
-
return this._width;
|
|
10580
10606
|
},
|
|
10581
10607
|
set: function set(value) {
|
|
10582
|
-
if (this.
|
|
10583
|
-
this.
|
|
10608
|
+
if (this._customWidth !== value) {
|
|
10609
|
+
this._customWidth = value;
|
|
10584
10610
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10585
10611
|
}
|
|
10586
10612
|
}
|
|
@@ -10588,16 +10614,22 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10588
10614
|
{
|
|
10589
10615
|
key: "height",
|
|
10590
10616
|
get: /**
|
|
10591
|
-
* Render height.
|
|
10617
|
+
* Render height (in world coordinates).
|
|
10618
|
+
*
|
|
10619
|
+
* @remarks
|
|
10620
|
+
* If height is set, return the set value,
|
|
10621
|
+
* otherwise return `SpriteMask.sprite.height`.
|
|
10592
10622
|
*/ function get() {
|
|
10593
|
-
if (this.
|
|
10594
|
-
|
|
10623
|
+
if (this._customHeight !== undefined) {
|
|
10624
|
+
return this._customHeight;
|
|
10625
|
+
} else {
|
|
10626
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
10627
|
+
return this._automaticHeight;
|
|
10595
10628
|
}
|
|
10596
|
-
return this._height;
|
|
10597
10629
|
},
|
|
10598
10630
|
set: function set(value) {
|
|
10599
|
-
if (this.
|
|
10600
|
-
this.
|
|
10631
|
+
if (this._customHeight !== value) {
|
|
10632
|
+
this._customHeight = value;
|
|
10601
10633
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10602
10634
|
}
|
|
10603
10635
|
}
|
|
@@ -10641,9 +10673,9 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10641
10673
|
var lastSprite = this._sprite;
|
|
10642
10674
|
if (lastSprite !== value) {
|
|
10643
10675
|
lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
10676
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
10644
10677
|
if (value) {
|
|
10645
10678
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
10646
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
10647
10679
|
this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
|
|
10648
10680
|
} else {
|
|
10649
10681
|
this.shaderData.setTexture(SpriteMask._textureProperty, null);
|
|
@@ -10683,10 +10715,16 @@ __decorate([
|
|
|
10683
10715
|
], SpriteMask.prototype, "_sprite", void 0);
|
|
10684
10716
|
__decorate([
|
|
10685
10717
|
ignoreClone
|
|
10686
|
-
], SpriteMask.prototype, "
|
|
10718
|
+
], SpriteMask.prototype, "_automaticWidth", void 0);
|
|
10687
10719
|
__decorate([
|
|
10688
10720
|
ignoreClone
|
|
10689
|
-
], SpriteMask.prototype, "
|
|
10721
|
+
], SpriteMask.prototype, "_automaticHeight", void 0);
|
|
10722
|
+
__decorate([
|
|
10723
|
+
assignmentClone
|
|
10724
|
+
], SpriteMask.prototype, "_customWidth", void 0);
|
|
10725
|
+
__decorate([
|
|
10726
|
+
assignmentClone
|
|
10727
|
+
], SpriteMask.prototype, "_customHeight", void 0);
|
|
10690
10728
|
__decorate([
|
|
10691
10729
|
assignmentClone
|
|
10692
10730
|
], SpriteMask.prototype, "_flipX", void 0);
|
|
@@ -10704,7 +10742,9 @@ var /**
|
|
|
10704
10742
|
*/ SpriteMaskUpdateFlags;
|
|
10705
10743
|
(function(SpriteMaskUpdateFlags) {
|
|
10706
10744
|
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
10707
|
-
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/**
|
|
10745
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
10746
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
10747
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
10708
10748
|
})(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
|
|
10709
10749
|
|
|
10710
10750
|
/**
|
|
@@ -19359,8 +19399,10 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19359
19399
|
if (name === void 0) name = null;
|
|
19360
19400
|
var _this;
|
|
19361
19401
|
_this = RefObject.call(this, engine) || this;
|
|
19362
|
-
_this.
|
|
19363
|
-
_this.
|
|
19402
|
+
_this._automaticWidth = 0;
|
|
19403
|
+
_this._automaticHeight = 0;
|
|
19404
|
+
_this._customWidth = undefined;
|
|
19405
|
+
_this._customHeight = undefined;
|
|
19364
19406
|
_this._positions = [
|
|
19365
19407
|
new miniprogram.Vector2(),
|
|
19366
19408
|
new miniprogram.Vector2(),
|
|
@@ -19381,7 +19423,7 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19381
19423
|
_this._region = new miniprogram.Rect(0, 0, 1, 1);
|
|
19382
19424
|
_this._pivot = new miniprogram.Vector2(0.5, 0.5);
|
|
19383
19425
|
_this._border = new miniprogram.Vector4(0, 0, 0, 0);
|
|
19384
|
-
_this._dirtyUpdateFlag =
|
|
19426
|
+
_this._dirtyUpdateFlag = 0x7;
|
|
19385
19427
|
/** @internal */ _this._updateFlagManager = new UpdateFlagManager();
|
|
19386
19428
|
_this._texture = texture;
|
|
19387
19429
|
region && _this._region.copyFrom(region);
|
|
@@ -19430,9 +19472,12 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19430
19472
|
if (this._texture) {
|
|
19431
19473
|
var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
|
|
19432
19474
|
var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
|
|
19433
|
-
this.
|
|
19434
|
-
this.
|
|
19475
|
+
this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
|
|
19476
|
+
this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
|
|
19477
|
+
} else {
|
|
19478
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
19435
19479
|
}
|
|
19480
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
19436
19481
|
};
|
|
19437
19482
|
_proto._updatePositions = function _updatePositions() {
|
|
19438
19483
|
var blank = this._atlasRegionOffset;
|
|
@@ -19486,11 +19531,16 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19486
19531
|
};
|
|
19487
19532
|
_proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
|
|
19488
19533
|
switch(type){
|
|
19534
|
+
case SpriteModifyFlags.texture:
|
|
19535
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
19536
|
+
break;
|
|
19489
19537
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
19490
19538
|
case SpriteModifyFlags.region:
|
|
19491
|
-
this._dirtyUpdateFlag |=
|
|
19539
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
19492
19540
|
break;
|
|
19493
19541
|
case SpriteModifyFlags.atlasRegion:
|
|
19542
|
+
this._dirtyUpdateFlag |= 0x4 | 0x2;
|
|
19543
|
+
break;
|
|
19494
19544
|
case SpriteModifyFlags.border:
|
|
19495
19545
|
this._dirtyUpdateFlag |= 0x2;
|
|
19496
19546
|
break;
|
|
@@ -19509,7 +19559,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19509
19559
|
if (this._texture !== value) {
|
|
19510
19560
|
this._texture = value;
|
|
19511
19561
|
this._dispatchSpriteChange(SpriteModifyFlags.texture);
|
|
19512
|
-
(this.
|
|
19562
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19563
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19564
|
+
}
|
|
19513
19565
|
}
|
|
19514
19566
|
}
|
|
19515
19567
|
},
|
|
@@ -19517,13 +19569,21 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19517
19569
|
key: "width",
|
|
19518
19570
|
get: /**
|
|
19519
19571
|
* The width of the sprite (in world coordinates).
|
|
19572
|
+
*
|
|
19573
|
+
* @remarks
|
|
19574
|
+
* If width is set, return the set value,
|
|
19575
|
+
* otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
19520
19576
|
*/ function get() {
|
|
19521
|
-
this.
|
|
19522
|
-
|
|
19577
|
+
if (this._customWidth !== undefined) {
|
|
19578
|
+
return this._customWidth;
|
|
19579
|
+
} else {
|
|
19580
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
19581
|
+
return this._automaticWidth;
|
|
19582
|
+
}
|
|
19523
19583
|
},
|
|
19524
19584
|
set: function set(value) {
|
|
19525
|
-
if (this.
|
|
19526
|
-
this.
|
|
19585
|
+
if (this._customWidth !== value) {
|
|
19586
|
+
this._customWidth = value;
|
|
19527
19587
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19528
19588
|
}
|
|
19529
19589
|
}
|
|
@@ -19532,13 +19592,21 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19532
19592
|
key: "height",
|
|
19533
19593
|
get: /**
|
|
19534
19594
|
* The height of the sprite (in world coordinates).
|
|
19595
|
+
*
|
|
19596
|
+
* @remarks
|
|
19597
|
+
* If height is set, return the set value,
|
|
19598
|
+
* otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
19535
19599
|
*/ function get() {
|
|
19536
|
-
this.
|
|
19537
|
-
|
|
19600
|
+
if (this._customHeight !== undefined) {
|
|
19601
|
+
return this._customHeight;
|
|
19602
|
+
} else {
|
|
19603
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
19604
|
+
return this._automaticHeight;
|
|
19605
|
+
}
|
|
19538
19606
|
},
|
|
19539
19607
|
set: function set(value) {
|
|
19540
|
-
if (this.
|
|
19541
|
-
this.
|
|
19608
|
+
if (this._customHeight !== value) {
|
|
19609
|
+
this._customHeight = value;
|
|
19542
19610
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19543
19611
|
}
|
|
19544
19612
|
}
|
|
@@ -19568,7 +19636,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19568
19636
|
var y = miniprogram.MathUtil.clamp(value.y, 0, 1);
|
|
19569
19637
|
this._atlasRegion.set(x, y, miniprogram.MathUtil.clamp(value.width, 0, 1 - x), miniprogram.MathUtil.clamp(value.height, 0, 1 - y));
|
|
19570
19638
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
|
|
19571
|
-
(this.
|
|
19639
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19640
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19641
|
+
}
|
|
19572
19642
|
}
|
|
19573
19643
|
},
|
|
19574
19644
|
{
|
|
@@ -19583,7 +19653,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19583
19653
|
var y = miniprogram.MathUtil.clamp(value.y, 0, 1);
|
|
19584
19654
|
this._atlasRegionOffset.set(x, y, miniprogram.MathUtil.clamp(value.z, 0, 1 - x), miniprogram.MathUtil.clamp(value.w, 0, 1 - y));
|
|
19585
19655
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
|
|
19586
|
-
(this.
|
|
19656
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19657
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19658
|
+
}
|
|
19587
19659
|
}
|
|
19588
19660
|
},
|
|
19589
19661
|
{
|
|
@@ -19599,7 +19671,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19599
19671
|
var y = miniprogram.MathUtil.clamp(value.y, 0, 1);
|
|
19600
19672
|
region.set(x, y, miniprogram.MathUtil.clamp(value.width, 0, 1 - x), miniprogram.MathUtil.clamp(value.height, 0, 1 - y));
|
|
19601
19673
|
this._dispatchSpriteChange(SpriteModifyFlags.region);
|
|
19602
|
-
(this.
|
|
19674
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19675
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19676
|
+
}
|
|
19603
19677
|
}
|
|
19604
19678
|
},
|
|
19605
19679
|
{
|
|
@@ -19649,7 +19723,8 @@ var SpriteUpdateFlags;
|
|
|
19649
19723
|
(function(SpriteUpdateFlags) {
|
|
19650
19724
|
SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
|
|
19651
19725
|
SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
|
|
19652
|
-
SpriteUpdateFlags[SpriteUpdateFlags["
|
|
19726
|
+
SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
|
|
19727
|
+
SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
|
|
19653
19728
|
})(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
|
|
19654
19729
|
|
|
19655
19730
|
var _SlicedSpriteAssembler;
|
|
@@ -19802,8 +19877,10 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19802
19877
|
_this = Renderer.call(this, entity) || this;
|
|
19803
19878
|
_this._color = new miniprogram.Color(1, 1, 1, 1);
|
|
19804
19879
|
_this._sprite = null;
|
|
19805
|
-
_this.
|
|
19806
|
-
_this.
|
|
19880
|
+
_this._automaticWidth = 0;
|
|
19881
|
+
_this._automaticHeight = 0;
|
|
19882
|
+
_this._customWidth = undefined;
|
|
19883
|
+
_this._customHeight = undefined;
|
|
19807
19884
|
_this._flipX = false;
|
|
19808
19885
|
_this._flipY = false;
|
|
19809
19886
|
_this._maskLayer = exports.SpriteMaskLayer.Layer0;
|
|
@@ -19819,6 +19896,7 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19819
19896
|
* @internal
|
|
19820
19897
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
19821
19898
|
target.sprite = this._sprite;
|
|
19899
|
+
target.drawMode = this._drawMode;
|
|
19822
19900
|
};
|
|
19823
19901
|
/**
|
|
19824
19902
|
* @internal
|
|
@@ -19834,12 +19912,11 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19834
19912
|
/**
|
|
19835
19913
|
* @override
|
|
19836
19914
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
19837
|
-
|
|
19838
|
-
|
|
19915
|
+
if (this.sprite) {
|
|
19916
|
+
this._assembler.updatePositions(this);
|
|
19917
|
+
} else {
|
|
19839
19918
|
worldBounds.min.set(0, 0, 0);
|
|
19840
19919
|
worldBounds.max.set(0, 0, 0);
|
|
19841
|
-
} else {
|
|
19842
|
-
this._assembler.updatePositions(this);
|
|
19843
19920
|
}
|
|
19844
19921
|
};
|
|
19845
19922
|
/**
|
|
@@ -19849,17 +19926,17 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19849
19926
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
19850
19927
|
return;
|
|
19851
19928
|
}
|
|
19852
|
-
// Update position
|
|
19929
|
+
// Update position
|
|
19853
19930
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
19854
19931
|
this._assembler.updatePositions(this);
|
|
19855
19932
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
19856
19933
|
}
|
|
19857
|
-
// Update uv
|
|
19934
|
+
// Update uv
|
|
19858
19935
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
19859
19936
|
this._assembler.updateUVs(this);
|
|
19860
19937
|
this._dirtyUpdateFlag &= ~0x2;
|
|
19861
19938
|
}
|
|
19862
|
-
// Push primitive
|
|
19939
|
+
// Push primitive
|
|
19863
19940
|
var material = this.getMaterial();
|
|
19864
19941
|
var passes = material.shader.passes;
|
|
19865
19942
|
var renderStates = material.renderStates;
|
|
@@ -19870,6 +19947,16 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19870
19947
|
context.camera._renderPipeline.pushPrimitive(spriteElement);
|
|
19871
19948
|
}
|
|
19872
19949
|
};
|
|
19950
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
19951
|
+
var sprite = this._sprite;
|
|
19952
|
+
if (sprite) {
|
|
19953
|
+
this._automaticWidth = sprite.width;
|
|
19954
|
+
this._automaticHeight = sprite.height;
|
|
19955
|
+
} else {
|
|
19956
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
19957
|
+
}
|
|
19958
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
19959
|
+
};
|
|
19873
19960
|
_proto._updateStencilState = function _updateStencilState() {
|
|
19874
19961
|
// Update stencil.
|
|
19875
19962
|
var material = this.getInstanceMaterial();
|
|
@@ -19895,9 +19982,10 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19895
19982
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, this.sprite.texture);
|
|
19896
19983
|
break;
|
|
19897
19984
|
case SpriteModifyFlags.size:
|
|
19985
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
19898
19986
|
// When the width and height of `SpriteRenderer` are `undefined`,
|
|
19899
19987
|
// the `size` of `Sprite` will affect the position of `SpriteRenderer`.
|
|
19900
|
-
if (this._drawMode === exports.SpriteDrawMode.Sliced || this.
|
|
19988
|
+
if (this._drawMode === exports.SpriteDrawMode.Sliced || this._customWidth === undefined || this._customHeight === undefined) {
|
|
19901
19989
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
19902
19990
|
}
|
|
19903
19991
|
break;
|
|
@@ -19951,9 +20039,9 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19951
20039
|
var lastSprite = this._sprite;
|
|
19952
20040
|
if (lastSprite !== value) {
|
|
19953
20041
|
lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
20042
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
19954
20043
|
if (value) {
|
|
19955
20044
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
19956
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
19957
20045
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
|
|
19958
20046
|
} else {
|
|
19959
20047
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
|
|
@@ -19978,16 +20066,22 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19978
20066
|
{
|
|
19979
20067
|
key: "width",
|
|
19980
20068
|
get: /**
|
|
19981
|
-
* Render width.
|
|
20069
|
+
* Render width (in world coordinates).
|
|
20070
|
+
*
|
|
20071
|
+
* @remarks
|
|
20072
|
+
* If width is set, return the set value,
|
|
20073
|
+
* otherwise return `SpriteRenderer.sprite.width`.
|
|
19982
20074
|
*/ function get() {
|
|
19983
|
-
|
|
19984
|
-
|
|
20075
|
+
if (this._customWidth !== undefined) {
|
|
20076
|
+
return this._customWidth;
|
|
20077
|
+
} else {
|
|
20078
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20079
|
+
return this._automaticWidth;
|
|
20080
|
+
}
|
|
19985
20081
|
},
|
|
19986
20082
|
set: function set(value) {
|
|
19987
|
-
|
|
19988
|
-
|
|
19989
|
-
if (this._width !== value) {
|
|
19990
|
-
this._width = value;
|
|
20083
|
+
if (this._customWidth !== value) {
|
|
20084
|
+
this._customWidth = value;
|
|
19991
20085
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
19992
20086
|
}
|
|
19993
20087
|
}
|
|
@@ -19995,16 +20089,22 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19995
20089
|
{
|
|
19996
20090
|
key: "height",
|
|
19997
20091
|
get: /**
|
|
19998
|
-
* Render height.
|
|
20092
|
+
* Render height (in world coordinates).
|
|
20093
|
+
*
|
|
20094
|
+
* @remarks
|
|
20095
|
+
* If height is set, return the set value,
|
|
20096
|
+
* otherwise return `SpriteRenderer.sprite.height`.
|
|
19999
20097
|
*/ function get() {
|
|
20000
|
-
|
|
20001
|
-
|
|
20098
|
+
if (this._customHeight !== undefined) {
|
|
20099
|
+
return this._customHeight;
|
|
20100
|
+
} else {
|
|
20101
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20102
|
+
return this._automaticHeight;
|
|
20103
|
+
}
|
|
20002
20104
|
},
|
|
20003
20105
|
set: function set(value) {
|
|
20004
|
-
|
|
20005
|
-
|
|
20006
|
-
if (this._height !== value) {
|
|
20007
|
-
this._height = value;
|
|
20106
|
+
if (this._customHeight !== value) {
|
|
20107
|
+
this._customHeight = value;
|
|
20008
20108
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
20009
20109
|
}
|
|
20010
20110
|
}
|
|
@@ -20085,10 +20185,16 @@ __decorate([
|
|
|
20085
20185
|
], SpriteRenderer.prototype, "_sprite", void 0);
|
|
20086
20186
|
__decorate([
|
|
20087
20187
|
ignoreClone
|
|
20088
|
-
], SpriteRenderer.prototype, "
|
|
20188
|
+
], SpriteRenderer.prototype, "_automaticWidth", void 0);
|
|
20089
20189
|
__decorate([
|
|
20090
20190
|
ignoreClone
|
|
20091
|
-
], SpriteRenderer.prototype, "
|
|
20191
|
+
], SpriteRenderer.prototype, "_automaticHeight", void 0);
|
|
20192
|
+
__decorate([
|
|
20193
|
+
assignmentClone
|
|
20194
|
+
], SpriteRenderer.prototype, "_customWidth", void 0);
|
|
20195
|
+
__decorate([
|
|
20196
|
+
assignmentClone
|
|
20197
|
+
], SpriteRenderer.prototype, "_customHeight", void 0);
|
|
20092
20198
|
__decorate([
|
|
20093
20199
|
assignmentClone
|
|
20094
20200
|
], SpriteRenderer.prototype, "_flipX", void 0);
|
|
@@ -20109,7 +20215,9 @@ var /**
|
|
|
20109
20215
|
*/ SpriteRendererUpdateFlags;
|
|
20110
20216
|
(function(SpriteRendererUpdateFlags) {
|
|
20111
20217
|
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
20112
|
-
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/**
|
|
20218
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
20219
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
20220
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
20113
20221
|
})(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
|
|
20114
20222
|
|
|
20115
20223
|
/**
|