Skip to content
Permalink
Browse files

[Rendering] Add Sprite to rendering only if it's enabled

  • Loading branch information
xen2 committed Mar 12, 2019
1 parent 8227cfd commit 559f0c4d802cc6dca204cf2f508248dc607a1646
Showing with 4 additions and 3 deletions.
  1. +4 −3 sources/engine/Xenko.Engine/Rendering/Sprites/SpriteRenderProcessor.cs
@@ -55,10 +55,11 @@ public override void Draw(RenderContext gameTime)
}

// TODO Should we allow adding RenderSprite without a CurrentSprite instead? (if yes, need some improvement in RenderSystem)
if (spriteStateKeyPair.Value.Active != (currentSprite != null))
var isActive = (currentSprite != null) && renderSprite.Enabled;
if (spriteStateKeyPair.Value.Active != isActive)
{
spriteStateKeyPair.Value.Active = (currentSprite != null);
if (spriteStateKeyPair.Value.Active)
spriteStateKeyPair.Value.Active = isActive;
if (isActive)
VisibilityGroup.RenderObjects.Add(renderSprite);
else
VisibilityGroup.RenderObjects.Remove(renderSprite);

0 comments on commit 559f0c4

Please sign in to comment.
You can’t perform that action at this time.