From 868e404b22a090cd7eb4c00f822b49484f313209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 4 Apr 2015 12:35:03 +0200 Subject: [PATCH] add 2 new blend modes: Multiplicative, DoubleMultiplicative --- OpenRA.Game/Graphics/IGraphicsDevice.cs | 4 +++- OpenRA.Renderer.Sdl2/Sdl2GraphicsDevice.cs | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Graphics/IGraphicsDevice.cs b/OpenRA.Game/Graphics/IGraphicsDevice.cs index fcb356aad0..2fdafe30d2 100755 --- a/OpenRA.Game/Graphics/IGraphicsDevice.cs +++ b/OpenRA.Game/Graphics/IGraphicsDevice.cs @@ -44,7 +44,9 @@ namespace OpenRA SoftAdditive, Translucency25, Translucency50, - Translucency75 + Translucency75, + Multiplicative, + DoubleMultiplicative } public interface IGraphicsDevice : IDisposable diff --git a/OpenRA.Renderer.Sdl2/Sdl2GraphicsDevice.cs b/OpenRA.Renderer.Sdl2/Sdl2GraphicsDevice.cs index 2c866d194f..a5b749aa23 100755 --- a/OpenRA.Renderer.Sdl2/Sdl2GraphicsDevice.cs +++ b/OpenRA.Renderer.Sdl2/Sdl2GraphicsDevice.cs @@ -267,6 +267,16 @@ namespace OpenRA.Renderer.Sdl2 ErrorHandler.CheckGlError(); GL.BlendColor(1f, 1f, 1f, 0.75f); break; + case BlendMode.Multiplicative: + GL.Enable(EnableCap.Blend); + ErrorHandler.CheckGlError(); + GL.BlendFunc(BlendingFactorSrc.Zero, BlendingFactorDest.SrcColor); + break; + case BlendMode.DoubleMultiplicative: + GL.Enable(EnableCap.Blend); + ErrorHandler.CheckGlError(); + GL.BlendFunc(BlendingFactorSrc.DstColor, BlendingFactorDest.SrcColor); + break; } ErrorHandler.CheckGlError();