Merge pull request #541 from Gustl22/bucket_format

Package renderer: minor formatting & amendments
This commit is contained in:
Emux 2018-05-10 15:12:47 +03:00 committed by GitHub
commit 7a9fc99079
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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

@ -85,6 +85,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
@ -203,11 +206,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;
@ -265,11 +264,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);
}
}