mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-23 16:10:50 +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.width !== this._roomSprite.width) || (this._canvasTexture.height !== this._roomSprite.height))) this._canvasTexture = null;
|
||||||
|
|
||||||
if(!this._canvasTexture)
|
this.clearCanvas();
|
||||||
{
|
|
||||||
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._centerX = -(this._roomSprite.offsetX);
|
this._centerX = -(this._roomSprite.offsetX);
|
||||||
this._centerY = -(this._roomSprite.offsetY);
|
this._centerY = -(this._roomSprite.offsetY);
|
||||||
@ -183,10 +170,7 @@ export class FurnitureParticleSystem
|
|||||||
|
|
||||||
if(!this._canvasTexture) this.updateCanvas();
|
if(!this._canvasTexture) this.updateCanvas();
|
||||||
|
|
||||||
Nitro.instance.renderer.render(this._emptySprite, {
|
this.clearCanvas();
|
||||||
renderTexture: this._canvasTexture,
|
|
||||||
clear: true
|
|
||||||
});
|
|
||||||
|
|
||||||
for(const particle of this._currentEmitter.particles)
|
for(const particle of this._currentEmitter.particles)
|
||||||
{
|
{
|
||||||
@ -323,4 +307,29 @@ export class FurnitureParticleSystem
|
|||||||
|
|
||||||
this._canvasTexture = null;
|
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