Open bvssvni opened 8 years ago
Another idea is to use:
Stencil::Clip
Stencil::Add(u8)
Stencil::Inside
Stencil::Outside
Not sure if there is any benefit of having many clip shapes at once.
I think this needs more time, could wait after upgrading to the new Gfx design.
The planned simplied draw state in https://github.com/PistonDevelopers/graphics/issues/996 suggests using:
Stencil::Clip
Stencil::Inside
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
:Stencil::Clip
Stencil::Inside
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 useStencil::Clip(1)
for both, and thenStencil::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.