diff --git a/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs b/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs index 36b228b58f..94b2bc4abd 100755 --- a/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs +++ b/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs @@ -61,9 +61,9 @@ namespace OpenRA.FileFormats.Graphics public interface IShader { - void SetValue( string name, float x, float y ); - void SetValue( string param, ITexture texture ); - void Render( Action a ); + void SetVec(string name, float x, float y); + void SetTexture(string param, ITexture texture); + void Render(Action a); } public interface ITexture diff --git a/OpenRA.Game/Graphics/Renderer.cs b/OpenRA.Game/Graphics/Renderer.cs index e354698882..45ac965884 100644 --- a/OpenRA.Game/Graphics/Renderer.cs +++ b/OpenRA.Game/Graphics/Renderer.cs @@ -89,10 +89,10 @@ namespace OpenRA.Graphics void SetShaderParams(IShader s, float2 r1, float2 r2, float2 scroll) { - s.SetValue("Palette", PaletteTexture); - s.SetValue("Scroll", (int)scroll.X, (int)scroll.Y); - s.SetValue("r1", r1.X, r1.Y); - s.SetValue("r2", r2.X, r2.Y); + s.SetTexture("Palette", PaletteTexture); + s.SetVec("Scroll", (int)scroll.X, (int)scroll.Y); + s.SetVec("r1", r1.X, r1.Y); + s.SetVec("r2", r2.X, r2.Y); } public void EndFrame(IInputHandler inputHandler) diff --git a/OpenRA.Game/Graphics/SpriteRenderer.cs b/OpenRA.Game/Graphics/SpriteRenderer.cs index b1bba04e3a..9670441dcf 100644 --- a/OpenRA.Game/Graphics/SpriteRenderer.cs +++ b/OpenRA.Game/Graphics/SpriteRenderer.cs @@ -34,7 +34,7 @@ namespace OpenRA.Graphics { if (nv > 0) { - shader.SetValue( "DiffuseTexture", currentSheet.Texture ); + shader.SetTexture("DiffuseTexture", currentSheet.Texture); shader.Render(() => { var vb = renderer.GetTempVertexBuffer(); diff --git a/OpenRA.Game/Graphics/TerrainRenderer.cs b/OpenRA.Game/Graphics/TerrainRenderer.cs index 317820217a..2468e4d917 100644 --- a/OpenRA.Game/Graphics/TerrainRenderer.cs +++ b/OpenRA.Game/Graphics/TerrainRenderer.cs @@ -84,7 +84,7 @@ namespace OpenRA.Graphics if( lastRow < firstRow ) lastRow = firstRow; - Game.Renderer.WorldSpriteShader.SetValue( "DiffuseTexture", terrainSheet.Texture ); + Game.Renderer.WorldSpriteShader.SetTexture("DiffuseTexture", terrainSheet.Texture); Game.Renderer.WorldSpriteShader.Render(() => Game.Renderer.DrawBatch(vertexBuffer, verticesPerRow * firstRow, verticesPerRow * (lastRow - firstRow), diff --git a/OpenRA.Renderer.Cg/Shader.cs b/OpenRA.Renderer.Cg/Shader.cs index 22173a144e..59aac51084 100644 --- a/OpenRA.Renderer.Cg/Shader.cs +++ b/OpenRA.Renderer.Cg/Shader.cs @@ -67,7 +67,7 @@ namespace OpenRA.Renderer.Cg Tao.Cg.CgGl.cgGLDisableProfile(dev.vertexProfile); } - public void SetValue(string name, ITexture t) + public void SetTexture(string name, ITexture t) { var texture = (Texture)t; var param = Tao.Cg.Cg.cgGetNamedEffectParameter(effect, name); @@ -75,7 +75,7 @@ namespace OpenRA.Renderer.Cg Tao.Cg.CgGl.cgGLSetupSampler(param, texture.texture); } - public void SetValue(string name, float x, float y) + public void SetVec(string name, float x, float y) { var param = Tao.Cg.Cg.cgGetNamedEffectParameter(effect, name); if (param != IntPtr.Zero) diff --git a/OpenRA.Renderer.Gl/Shader.cs b/OpenRA.Renderer.Gl/Shader.cs index 8f39d77aac..f4731d0074 100644 --- a/OpenRA.Renderer.Gl/Shader.cs +++ b/OpenRA.Renderer.Gl/Shader.cs @@ -132,15 +132,16 @@ namespace OpenRA.Renderer.Glsl ErrorHandler.CheckGlError(); } - public void SetValue(string name, ITexture t) + public void SetTexture(string name, ITexture t) { - if( t == null ) return; + if (t == null) + return; int texUnit; - if( samplers.TryGetValue( name, out texUnit ) ) + if (samplers.TryGetValue(name, out texUnit)) textures[texUnit] = t; } - public void SetValue(string name, float x, float y) + public void SetVec(string name, float x, float y) { Gl.glUseProgramObjectARB(program); ErrorHandler.CheckGlError(); diff --git a/OpenRA.Renderer.Null/NullGraphicsDevice.cs b/OpenRA.Renderer.Null/NullGraphicsDevice.cs index 63d86b9657..56f3627e92 100644 --- a/OpenRA.Renderer.Null/NullGraphicsDevice.cs +++ b/OpenRA.Renderer.Null/NullGraphicsDevice.cs @@ -60,8 +60,8 @@ namespace OpenRA.Renderer.Null public class NullShader : IShader { - public void SetValue(string name, float x, float y) { } - public void SetValue(string param, ITexture texture) { } + public void SetVec(string name, float x, float y) { } + public void SetTexture(string param, ITexture texture) { } public void Commit() { } public void Render(Action a) { } }