rename vars: vertices counts are actually indices

This commit is contained in:
Hannes Janetzek 2014-05-16 17:38:12 +02:00
parent 89edbf90f2
commit f62ea65f25
5 changed files with 20 additions and 20 deletions

View File

@ -75,7 +75,7 @@ public class BitmapLayer extends TextureLayer {
}
TextureItem t = textures;
t.vertices = TextureLayer.INDICES_PER_SPRITE;
t.indices = TextureLayer.INDICES_PER_SPRITE;
}
private void setVertices(ShortBuffer sbuf) {
@ -215,10 +215,10 @@ public class BitmapLayer extends TextureLayer {
t.bind();
int maxVertices = MapRenderer.maxQuads * INDICES_PER_SPRITE;
int maxIndices = MapRenderer.maxQuads * INDICES_PER_SPRITE;
// draw up to maxVertices in each iteration
for (int i = 0; i < t.vertices; i += maxVertices) {
for (int i = 0; i < t.indices; i += maxIndices) {
// to.offset * (24(shorts) * 2(short-bytes) / 6(indices) == 8)
int off = (t.offset + i) * 8 + tl.offset;
@ -228,11 +228,11 @@ public class BitmapLayer extends TextureLayer {
GL.glVertexAttribPointer(s.aTexCoord, 2,
GL20.GL_SHORT, false, 12, off + 8);
int numVertices = t.vertices - i;
if (numVertices > maxVertices)
numVertices = maxVertices;
int numIndices = t.indices - i;
if (numIndices > maxIndices)
numIndices = maxIndices;
GL.glDrawElements(GL20.GL_TRIANGLES, numVertices,
GL.glDrawElements(GL20.GL_TRIANGLES, numIndices,
GL20.GL_UNSIGNED_SHORT, 0);
}
}

View File

@ -112,7 +112,7 @@ public final class SymbolLayer extends TextureLayer {
t.upload();
t.offset = numIndices;
t.vertices = 0;
t.indices = 0;
}
width = t.width;
height = t.height;
@ -176,9 +176,9 @@ public final class SymbolLayer extends TextureLayer {
pos += TextLayer.VERTICES_PER_SPRITE * 6;
/* six elements used to draw the four vertices */
t.vertices += TextureLayer.INDICES_PER_SPRITE;
t.indices += TextureLayer.INDICES_PER_SPRITE;
}
numIndices += t.vertices;
numIndices += t.indices;
}
if (pos > 0)
@ -199,7 +199,7 @@ public final class SymbolLayer extends TextureLayer {
textures = Inlist.appendItem(textures, t);
t.offset = 0;
t.vertices = 0;
t.indices = 0;
return t;
}
}

View File

@ -112,7 +112,7 @@ public final class TextLayer extends TextureLayer {
if (y + height > TEXTURE_HEIGHT) {
t.offset = offsetIndices;
t.vertices = (short) (numIndices - offsetIndices);
t.indices = (short) (numIndices - offsetIndices);
offsetIndices = numIndices;
t.next = pool.get();
@ -167,7 +167,7 @@ public final class TextLayer extends TextureLayer {
vi.used = pos;
t.offset = offsetIndices;
t.vertices = (short) (numIndices - offsetIndices);
t.indices = (short) (numIndices - offsetIndices);
return true;
}

View File

@ -44,7 +44,7 @@ public class TextureItem extends Inlist<TextureItem> {
/** vertex offset from which this texture is referenced */
public short offset;
public short vertices;
public short indices;
/** temporary Bitmap */
public Bitmap bitmap;

View File

@ -172,10 +172,10 @@ public abstract class TextureLayer extends RenderElement {
1f / (t.height * COORD_SCALE));
t.bind();
int maxVertices = MapRenderer.maxQuads * INDICES_PER_SPRITE;
int maxIndices = MapRenderer.maxQuads * INDICES_PER_SPRITE;
/* draw up to maxVertices in each iteration */
for (int i = 0; i < t.vertices; i += maxVertices) {
for (int i = 0; i < t.indices; i += maxIndices) {
/* to.offset * (24(shorts) * 2(short-bytes)
* / 6(indices) == 8) */
int off = (t.offset + i) * 8 + tl.offset;
@ -198,11 +198,11 @@ public abstract class TextureLayer extends RenderElement {
2, GL20.GL_SHORT, false, 12,
layers.vertexArrayBuffer);
}
int numVertices = t.vertices - i;
if (numVertices > maxVertices)
numVertices = maxVertices;
int numIndices = t.indices - i;
if (numIndices > maxIndices)
numIndices = maxIndices;
GL.glDrawElements(GL20.GL_TRIANGLES, numVertices,
GL.glDrawElements(GL20.GL_TRIANGLES, numIndices,
GL20.GL_UNSIGNED_SHORT, 0);
}