mostly fixes openra startup time
git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1928 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
@@ -10,30 +10,23 @@ namespace OpenRa.Game
|
||||
public readonly Rectangle bounds;
|
||||
public readonly Sheet sheet;
|
||||
public readonly TextureChannel channel;
|
||||
public readonly RectangleF uv;
|
||||
|
||||
internal Sprite(Sheet sheet, Rectangle bounds, TextureChannel channel)
|
||||
{
|
||||
this.bounds = bounds;
|
||||
this.sheet = sheet;
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
RectangleF TextureCoords
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RectangleF(
|
||||
uv = new RectangleF(
|
||||
(float)(bounds.Left + 0.5f) / sheet.Size.Width,
|
||||
(float)(bounds.Top + 0.5f) / sheet.Size.Height,
|
||||
(float)(bounds.Width) / sheet.Size.Width,
|
||||
(float)(bounds.Height) / sheet.Size.Height);
|
||||
}
|
||||
}
|
||||
|
||||
public float2 MapTextureCoords(float2 p)
|
||||
{
|
||||
RectangleF uv = TextureCoords;
|
||||
|
||||
return new float2(
|
||||
p.X > 0 ? uv.Right : uv.Left,
|
||||
p.Y > 0 ? uv.Bottom : uv.Top);
|
||||
@@ -42,9 +35,9 @@ namespace OpenRa.Game
|
||||
|
||||
public enum TextureChannel
|
||||
{
|
||||
Red,
|
||||
Green,
|
||||
Blue,
|
||||
Alpha,
|
||||
Red = 0,
|
||||
Green = 1,
|
||||
Blue = 2,
|
||||
Alpha = 3,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user