Announcement

Collapse
No announcement yet.

UI Masks

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Hi guachitonico,

    We have in our backlog improve the layers behavior.
    But I have tested the project you have shared and I think that you can achieve the desired behavior changing the layer class to:


    Code:
        public class ScissoredLayer : AlphaLayer
        {
            private bool oldScissorTestEnabled;
            private Rectangle oldScissorRectangle;
    
            public Rectangle ScissorRectangle { get; set; }
    
            public ScissoredLayer(RenderManager renderManager)
                : base(renderManager)
            {
    
            }
    
            protected override void SetDevice()
            {
                base.SetDevice();
    
                this.oldScissorRectangle = this.renderState.ScissorRectangle;
                this.oldScissorTestEnabled = this.renderState.ScissorTestEnabled;
    
                this.renderState.ScissorTestEnabled = true;
                this.renderState.ScissorRectangle = this.ScissorRectangle;
    
            }
    
            protected override void RestoreDevice()
            {
                this.renderState.ScissorRectangle = this.oldScissorRectangle;
                this.renderState.ScissorTestEnabled = this.oldScissorTestEnabled;
    
                base.RestoreDevice();
            }
        }
    The only change is the order of the lines in the RestoreDevice method.
    I hope this can help you.

    Greetings.
    Daniel Cáceres

    Comment


    • #17
      Hi @Guathitonico,

      In the next Wave Engine version we changed the scissor functionality in Layers to avoid problems.


      To enable the scissor, you only need to set the rectangle to the ScissorRectangle property:
      Code:
      this.renderState.ScissorRectangle = this.ScissorRectangle;
      To disable the scissor:
      Code:
      this.renderState.ScissorRectangle = null;

      Best regards,
      David Ávila

      Comment


      • #18
        Great news! Can't check the update right now, but I'm confident that it'll be fixed.
        Great work once again guys!

        Comment

        Working...
        X