Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative stencil behavior to allow logical AND #1032

Open
bvssvni opened this issue Feb 8, 2016 · 3 comments
Open

Alternative stencil behavior to allow logical AND #1032

bvssvni opened this issue Feb 8, 2016 · 3 comments

Comments

@bvssvni
Copy link
Member

bvssvni commented Feb 8, 2016

The planned simplied draw state in #996 suggests using:

  • replace operator for Stencil::Clip
  • equality comparison for Stencil::Inside
  • non-equality comparison for Stencil::Outside

This design allows up to 255 different clip shapes at once, but they can not be combined using logical AND.

An idea is to use these settings to allow logical AND:

  • increment_clamp operator for Stencil::Clip
  • greater_equal comparison for Stencil::Inside
  • less comparison for Stencil::Outside

For a single clip shape, the behavior is the same in both alternatives.

The behavior is also the same when you have multiple clip shapes followed by Stencil::Inside(1), because the value will be greater or equal for all cases where the clip shapes overlap.

If you want to render A AND B, you can use Stencil::Clip(1) for both, and then Stencil::Inside(2).

The problem with this idea is that the algorithm for concave polygons will not work.

A downside is you can not have as many clip shapes at once.

@bvssvni
Copy link
Member Author

bvssvni commented Feb 8, 2016

Another idea is to use:

  • replace operator for Stencil::Clip
  • increment_clamp operator for a new variant Stencil::Add(u8)
  • greater_equal comparison for Stencil::Inside
  • less comparison for Stencil::Outside

@bvssvni
Copy link
Member Author

bvssvni commented Feb 8, 2016

Not sure if there is any benefit of having many clip shapes at once.

@bvssvni
Copy link
Member Author

bvssvni commented Feb 9, 2016

I think this needs more time, could wait after upgrading to the new Gfx design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant