mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-12-03 12:16:28 +01:00
Fix clear particle texture on reset
This commit is contained in:
parent
30d56bf180
commit
76e9fad2fd
@ -109,20 +109,7 @@ export class FurnitureParticleSystem
|
||||
|
||||
if(this._canvasTexture && ((this._canvasTexture.width !== this._roomSprite.width) || (this._canvasTexture.height !== this._roomSprite.height))) this._canvasTexture = null;
|
||||
|
||||
if(!this._canvasTexture)
|
||||
{
|
||||
this._canvasTexture = RenderTexture.create({
|
||||
width: this._roomSprite.width,
|
||||
height: this._roomSprite.height
|
||||
});
|
||||
}
|
||||
|
||||
if(!this._emptySprite)
|
||||
{
|
||||
this._emptySprite = new NitroSprite(Texture.EMPTY);
|
||||
|
||||
this._emptySprite.alpha = 0;
|
||||
}
|
||||
this.clearCanvas();
|
||||
|
||||
this._centerX = -(this._roomSprite.offsetX);
|
||||
this._centerY = -(this._roomSprite.offsetY);
|
||||
@ -183,10 +170,7 @@ export class FurnitureParticleSystem
|
||||
|
||||
if(!this._canvasTexture) this.updateCanvas();
|
||||
|
||||
Nitro.instance.renderer.render(this._emptySprite, {
|
||||
renderTexture: this._canvasTexture,
|
||||
clear: true
|
||||
});
|
||||
this.clearCanvas();
|
||||
|
||||
for(const particle of this._currentEmitter.particles)
|
||||
{
|
||||
@ -323,4 +307,29 @@ export class FurnitureParticleSystem
|
||||
|
||||
this._canvasTexture = null;
|
||||
}
|
||||
|
||||
private clearCanvas(): void
|
||||
{
|
||||
if(!this._emptySprite)
|
||||
{
|
||||
this._emptySprite = new NitroSprite(Texture.EMPTY);
|
||||
|
||||
this._emptySprite.alpha = 0;
|
||||
}
|
||||
|
||||
if(!this._canvasTexture)
|
||||
{
|
||||
this._canvasTexture = RenderTexture.create({
|
||||
width: this._roomSprite.width,
|
||||
height: this._roomSprite.height
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Nitro.instance.renderer.render(this._emptySprite, {
|
||||
renderTexture: this._canvasTexture,
|
||||
clear: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user