Rename uniform setters to avoid future ambiguity.

This commit is contained in:
Paul Chote
2013-03-02 10:33:05 +13:00
parent 2f3def3f86
commit 786c3b1f1a
7 changed files with 18 additions and 17 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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();

View File

@@ -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),

View File

@@ -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)

View File

@@ -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();

View File

@@ -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) { }
}