diff --git a/OpenRA.Game/Graphics/IGraphicsDevice.cs b/OpenRA.Game/Graphics/IGraphicsDevice.cs index deb7ee4b48..64d46048ca 100644 --- a/OpenRA.Game/Graphics/IGraphicsDevice.cs +++ b/OpenRA.Game/Graphics/IGraphicsDevice.cs @@ -89,6 +89,7 @@ namespace OpenRA public interface IShader { + void SetBool(string name, bool value); void SetVec(string name, float x); void SetVec(string name, float x, float y); void SetVec(string name, float[] vec, int length); diff --git a/OpenRA.Platforms.Default/Shader.cs b/OpenRA.Platforms.Default/Shader.cs index 2414aa3604..06e15247fb 100644 --- a/OpenRA.Platforms.Default/Shader.cs +++ b/OpenRA.Platforms.Default/Shader.cs @@ -148,6 +148,17 @@ namespace OpenRA.Platforms.Default textures[texUnit] = t; } + public void SetBool(string name, bool value) + { + VerifyThreadAffinity(); + GL.UseProgram(program); + ErrorHandler.CheckGlError(); + var param = GL.GetUniformLocation(program, name); + ErrorHandler.CheckGlError(); + GL.Uniform1(param, value ? 1 : 0); + ErrorHandler.CheckGlError(); + } + public void SetVec(string name, float x) { VerifyThreadAffinity(); diff --git a/OpenRA.Platforms.Null/NullGraphicsDevice.cs b/OpenRA.Platforms.Null/NullGraphicsDevice.cs index b6a9174b63..57c3b8d159 100644 --- a/OpenRA.Platforms.Null/NullGraphicsDevice.cs +++ b/OpenRA.Platforms.Null/NullGraphicsDevice.cs @@ -63,6 +63,7 @@ namespace OpenRA.Platforms.Null public class NullShader : IShader { + public void SetBool(string name, bool value) { } public void SetVec(string name, float x) { } public void SetVec(string name, float x, float y) { } public void SetVec(string name, float[] vec, int length) { }