prime31 / Nez

Nez is a free 2D focused framework that works with MonoGame and FNA
MIT License
1.76k stars 355 forks source link

ImageMaskTransition has problem #720

Open zengzhining opened 2 years ago

zengzhining commented 2 years ago

I use ImageMaskTransition but the background color is not black. 屏幕截图 2022-05-06 095427

I think the problem is in PreRender method, it should add Clear method? I add it and it works.

public override void PreRender(Batcher batcher)
{
    Core.GraphicsDevice.SetRenderTarget(_maskRenderTarget);
    // Core.GraphicsDevice.Clear( Color.Black );
    batcher.Begin(BlendState.AlphaBlend, Core.DefaultSamplerState, DepthStencilState.None, null);
    batcher.Draw(_maskTexture, _maskPosition, null, Color.White, _renderRotation, _maskOrigin,
        _renderScale, SpriteEffects.None, 0);
    batcher.End();
    Core.GraphicsDevice.SetRenderTarget(null);
}