Support rectangular tiles.
This commit is contained in:
@@ -235,8 +235,8 @@ namespace OpenRA.Graphics
|
||||
// Conversion between world and screen coordinates
|
||||
public float2 ScreenPosition(WPos pos)
|
||||
{
|
||||
var c = Game.CellSize / 1024f;
|
||||
return new float2(c * pos.X, c * (pos.Y - pos.Z));
|
||||
var ts = Game.modData.Manifest.TileSize;
|
||||
return new float2(ts.Width * pos.X / 1024f, ts.Height * (pos.Y - pos.Z) / 1024f);
|
||||
}
|
||||
|
||||
public int2 ScreenPxPosition(WPos pos)
|
||||
@@ -249,8 +249,8 @@ namespace OpenRA.Graphics
|
||||
// For scaling vectors to pixel sizes in the voxel renderer
|
||||
public float[] ScreenVector(WVec vec)
|
||||
{
|
||||
var c = Game.CellSize / 1024f;
|
||||
return new float[] { c * vec.X, c * vec.Y, c * vec.Z, 1 };
|
||||
var ts = Game.modData.Manifest.TileSize;
|
||||
return new float[] { ts.Width * vec.X / 1024f, ts.Height * vec.Y / 1024f, ts.Height * vec.Z / 1024f, 1 };
|
||||
}
|
||||
|
||||
public int2 ScreenPxOffset(WVec vec)
|
||||
@@ -262,12 +262,14 @@ namespace OpenRA.Graphics
|
||||
|
||||
public float ScreenZPosition(WPos pos, int offset)
|
||||
{
|
||||
return (pos.Y + pos.Z + offset) * Game.CellSize / 1024f;
|
||||
var ts = Game.modData.Manifest.TileSize;
|
||||
return (pos.Y + pos.Z + offset) * ts.Height / 1024f;
|
||||
}
|
||||
|
||||
public WPos Position(int2 screenPx)
|
||||
{
|
||||
return new WPos(1024 * screenPx.X / Game.CellSize, 1024 * screenPx.Y / Game.CellSize, 0);
|
||||
var ts = Game.modData.Manifest.TileSize;
|
||||
return new WPos(1024 * screenPx.X / ts.Width, 1024 * screenPx.Y / ts.Height, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user