fix rendering of very large maps
This commit is contained in:
@@ -18,7 +18,7 @@ namespace OpenRA.Graphics
|
||||
Renderer renderer;
|
||||
|
||||
Vertex[] vertices = new Vertex[ Renderer.TempBufferSize ];
|
||||
ushort[] indices = new ushort[ Renderer.TempBufferSize ];
|
||||
uint[] indices = new uint[ Renderer.TempBufferSize ];
|
||||
int nv = 0, ni = 0;
|
||||
|
||||
public LineRenderer( Renderer renderer )
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenRA.Graphics
|
||||
IShader shader;
|
||||
|
||||
Vertex[] vertices = new Vertex[Renderer.TempBufferSize];
|
||||
ushort[] indices = new ushort[Renderer.TempBufferSize];
|
||||
uint[] indices = new uint[Renderer.TempBufferSize];
|
||||
Sheet currentSheet = null;
|
||||
int nv = 0, ni = 0;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Graphics
|
||||
x => Game.modData.SheetBuilder.Add(world.TileSet.GetBytes(x), tileSize));
|
||||
|
||||
Vertex[] vertices = new Vertex[4 * map.Bounds.Height * map.Bounds.Width];
|
||||
ushort[] indices = new ushort[6 * map.Bounds.Height * map.Bounds.Width];
|
||||
uint[] indices = new uint[6 * map.Bounds.Height * map.Bounds.Width];
|
||||
|
||||
terrainSheet = tileMapping[map.MapTiles.Value[map.Bounds.Left, map.Bounds.Top]].sheet;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
static float[] channelSelect = { 0.75f, 0.25f, -0.25f, -0.75f };
|
||||
|
||||
public static void FastCreateQuad(Vertex[] vertices, ushort[] indices, float2 o, Sprite r, int palette, int nv, int ni, float2 size)
|
||||
public static void FastCreateQuad(Vertex[] vertices, uint[] indices, float2 o, Sprite r, int palette, int nv, int ni, float2 size)
|
||||
{
|
||||
var attrib = new float2(palette / (float)HardwarePalette.MaxPalettes, channelSelect[(int)r.channel]);
|
||||
|
||||
@@ -55,12 +55,12 @@ namespace OpenRA.Graphics
|
||||
vertices[nv + 2] = new Vertex(new float2(o.X, o.Y + size.Y),
|
||||
r.FastMapTextureCoords(2), attrib);
|
||||
vertices[nv + 3] = new Vertex(new float2(o.X + size.X, o.Y + size.Y),
|
||||
r.FastMapTextureCoords(3), attrib);
|
||||
|
||||
indices[ni] = (ushort)(nv);
|
||||
indices[ni + 1] = indices[ni + 3] = (ushort)(nv + 1);
|
||||
indices[ni + 2] = indices[ni + 5] = (ushort)(nv + 2);
|
||||
indices[ni + 4] = (ushort)(nv + 3);
|
||||
r.FastMapTextureCoords(3), attrib);
|
||||
|
||||
indices[ni] = (uint)(nv);
|
||||
indices[ni + 1] = indices[ni + 3] = (uint)(nv + 1);
|
||||
indices[ni + 2] = indices[ni + 5] = (uint)(nv + 2);
|
||||
indices[ni + 4] = (uint)(nv + 3);
|
||||
}
|
||||
|
||||
static readonly int[] channelMasks = { 2, 1, 0, 3 }; // yes, our channel order is nuts.
|
||||
|
||||
Reference in New Issue
Block a user