add alpha channel to every possible blend mode

This commit is contained in:
Matthias Mailänder
2015-04-19 08:18:31 +02:00
parent 1b31001661
commit 63e4d40770
8 changed files with 25 additions and 34 deletions

View File

@@ -17,6 +17,7 @@ namespace OpenRA.Graphics
public readonly Rectangle Bounds;
public readonly Sheet Sheet;
public readonly BlendMode BlendMode;
public readonly float Alpha;
public readonly TextureChannel Channel;
public readonly float2 Size;
public readonly float2 Offset;
@@ -24,12 +25,9 @@ namespace OpenRA.Graphics
public readonly float Top, Left, Bottom, Right;
public Sprite(Sheet sheet, Rectangle bounds, TextureChannel channel)
: this(sheet, bounds, float2.Zero, channel, BlendMode.Alpha) { }
: this(sheet, bounds, float2.Zero, channel) { }
public Sprite(Sheet sheet, Rectangle bounds, TextureChannel channel, BlendMode blendMode)
: this(sheet, bounds, float2.Zero, channel, blendMode) { }
public Sprite(Sheet sheet, Rectangle bounds, float2 offset, TextureChannel channel, BlendMode blendMode)
public Sprite(Sheet sheet, Rectangle bounds, float2 offset, TextureChannel channel, BlendMode blendMode = BlendMode.Alpha, float alpha = 1f)
{
Sheet = sheet;
Bounds = bounds;
@@ -37,6 +35,7 @@ namespace OpenRA.Graphics
Channel = channel;
Size = new float2(bounds.Size);
BlendMode = blendMode;
Alpha = alpha;
FractionalOffset = offset / Size;