Renderer: minor formatting & amendments

This commit is contained in:
Gustl22 2018-05-09 13:30:05 +02:00
parent 7ca09f3acb
commit 5d1da5fecd
4 changed files with 18 additions and 22 deletions

View File

@ -122,8 +122,7 @@ public class BucketRenderer extends LayerRenderer {
b = LineBucket.Renderer.draw(b, v, div, buckets);
break;
case TEXLINE:
b = LineTexBucket.Renderer.draw(b,
v,
b = LineTexBucket.Renderer.draw(b, v,
FastMath.pow(layerPos.zoomLevel - v.pos.zoomLevel) * (float) layerPos.getZoomScale(),
buckets);
break;

View File

@ -202,7 +202,7 @@ public class MapRenderer {
mNewSurface = false;
/** initialize quad indices used by Texture- and LineTexRenderer */
/* initialize quad indices used by Texture- and LineTexRenderer */
int[] vboIds = GLUtils.glGenBuffers(2);
mQuadIndicesID = vboIds[0];
@ -227,7 +227,7 @@ public class MapRenderer {
GL.STATIC_DRAW);
GLState.bindElementBuffer(0);
/** initialize default quad */
/* initialize default quad */
FloatBuffer floatBuffer = MapRenderer.getFloatBuffer(8);
float[] quad = new float[]{-1, -1, -1, 1, 1, -1, 1, 1};
floatBuffer.put(quad);

View File

@ -83,6 +83,9 @@ public class RenderBuckets extends TileData {
private RenderBucket mCurBucket;
public RenderBuckets() {
}
/**
* add the LineBucket for a level with a given Line style. Levels are
* ordered from bottom (0) to top
@ -201,11 +204,7 @@ public class RenderBuckets extends TileData {
if (mCurBucket != null && mCurBucket.level == level) {
bucket = mCurBucket;
if (bucket.type != type) {
log.error("BUG wrong bucket {} {} on level {}",
Integer.valueOf(bucket.type),
Integer.valueOf(type),
Integer.valueOf(level));
log.error("BUG wrong bucket {} {} on level {}", bucket.type, type, level);
throw new IllegalArgumentException();
}
return bucket;
@ -263,11 +262,7 @@ public class RenderBuckets extends TileData {
/* check if found buckets matches requested type */
if (bucket.type != type) {
log.error("BUG wrong bucket {} {} on level {}",
Integer.valueOf(bucket.type),
Integer.valueOf(type),
Integer.valueOf(level));
log.error("BUG wrong bucket {} {} on level {}", bucket.type, type, level);
throw new IllegalArgumentException();
}

View File

@ -51,8 +51,6 @@ public class VertexData extends Inlist.List<Chunk> {
public int used;
}
;
private static class Pool extends SyncPool<Chunk> {
public Pool() {
super(MAX_POOL);
@ -146,6 +144,10 @@ public class VertexData extends Inlist.List<Chunk> {
used = 0;
}
public void add(float a) {
add(toShort(a));
}
public void add(short a) {
if (used == SIZE)
getNext();
@ -153,10 +155,6 @@ public class VertexData extends Inlist.List<Chunk> {
vertices[used++] = a;
}
static final short toShort(float v) {
return (short) FastMath.clamp(v, Short.MIN_VALUE, Short.MAX_VALUE);
}
public void add(float a, float b) {
add(toShort(a), toShort(b));
}
@ -216,6 +214,10 @@ public class VertexData extends Inlist.List<Chunk> {
used += 6;
}
public boolean empty() {
return cur == null;
}
/**
* Direct access to the current chunk of VertexData. Use with care!
* <p/>
@ -250,7 +252,7 @@ public class VertexData extends Inlist.List<Chunk> {
throw new IllegalStateException("seeked too far: " + offset + "/" + used);
}
public boolean empty() {
return cur == null;
static final short toShort(float v) {
return (short) FastMath.clamp(v, Short.MIN_VALUE, Short.MAX_VALUE);
}
}