Siv3D / OpenSiv3D

C++20 framework for creative coding 🎮🎨🎹 / Cross-platform support (Windows, macOS, Linux, and the Web)
https://siv3d.github.io/
MIT License
1k stars 138 forks source link

StencilStateを使用したいです #335

Open tyanmahou opened 5 years ago

tyanmahou commented 5 years ago

主にマスク処理などに使用するため、StencilStateを使用したいです。


また、提案ですが ScopedRenderStates2Dのようなスコープ制御で簡単にマスク処理ができると便利かもしれません。

以下のようなことがしたいイメージです

ScopedStencilMask::ScopedStencilMask(std::function<void()> base, s3d::StencilFunc stencilFunc, s3d::uint8 stencilValue):
    m_oldStencilState(Graphics2D::GetStencilState()),
    m_oldStencilValue(Graphics2D::GetStencilValue())
{
    Graphics2D::SetStencilState(StencilState::Replace);
    Graphics2D::SetStencilValue(stencilValue);

    base();

    Graphics2D::SetStencilState(StencilState::Test(stencilFunc));
}
Reputeless commented 5 years ago

2D 描画でのステンシル実装は直近で予定はありません。 v0.4.1 からの ・マルチテクスチャ ・RenderTexture ・カスタムピクセルシェーダ で代替できないか検討してください。 どうしてもできない / 効率的にできない場合はまたご報告ください。