Merge pull request #541 from Gustl22/bucket_format
Package renderer: minor formatting & amendments
This commit is contained in:
commit
7a9fc99079
@ -122,8 +122,7 @@ public class BucketRenderer extends LayerRenderer {
|
|||||||
b = LineBucket.Renderer.draw(b, v, div, buckets);
|
b = LineBucket.Renderer.draw(b, v, div, buckets);
|
||||||
break;
|
break;
|
||||||
case TEXLINE:
|
case TEXLINE:
|
||||||
b = LineTexBucket.Renderer.draw(b,
|
b = LineTexBucket.Renderer.draw(b, v,
|
||||||
v,
|
|
||||||
FastMath.pow(layerPos.zoomLevel - v.pos.zoomLevel) * (float) layerPos.getZoomScale(),
|
FastMath.pow(layerPos.zoomLevel - v.pos.zoomLevel) * (float) layerPos.getZoomScale(),
|
||||||
buckets);
|
buckets);
|
||||||
break;
|
break;
|
||||||
|
@ -202,7 +202,7 @@ public class MapRenderer {
|
|||||||
|
|
||||||
mNewSurface = false;
|
mNewSurface = false;
|
||||||
|
|
||||||
/** initialize quad indices used by Texture- and LineTexRenderer */
|
/* initialize quad indices used by Texture- and LineTexRenderer */
|
||||||
int[] vboIds = GLUtils.glGenBuffers(2);
|
int[] vboIds = GLUtils.glGenBuffers(2);
|
||||||
|
|
||||||
mQuadIndicesID = vboIds[0];
|
mQuadIndicesID = vboIds[0];
|
||||||
@ -227,7 +227,7 @@ public class MapRenderer {
|
|||||||
GL.STATIC_DRAW);
|
GL.STATIC_DRAW);
|
||||||
GLState.bindElementBuffer(0);
|
GLState.bindElementBuffer(0);
|
||||||
|
|
||||||
/** initialize default quad */
|
/* initialize default quad */
|
||||||
FloatBuffer floatBuffer = MapRenderer.getFloatBuffer(8);
|
FloatBuffer floatBuffer = MapRenderer.getFloatBuffer(8);
|
||||||
float[] quad = new float[]{-1, -1, -1, 1, 1, -1, 1, 1};
|
float[] quad = new float[]{-1, -1, -1, 1, 1, -1, 1, 1};
|
||||||
floatBuffer.put(quad);
|
floatBuffer.put(quad);
|
||||||
|
@ -85,6 +85,9 @@ public class RenderBuckets extends TileData {
|
|||||||
|
|
||||||
private RenderBucket mCurBucket;
|
private RenderBucket mCurBucket;
|
||||||
|
|
||||||
|
public RenderBuckets() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add the LineBucket for a level with a given Line style. Levels are
|
* add the LineBucket for a level with a given Line style. Levels are
|
||||||
* ordered from bottom (0) to top
|
* ordered from bottom (0) to top
|
||||||
@ -203,11 +206,7 @@ public class RenderBuckets extends TileData {
|
|||||||
if (mCurBucket != null && mCurBucket.level == level) {
|
if (mCurBucket != null && mCurBucket.level == level) {
|
||||||
bucket = mCurBucket;
|
bucket = mCurBucket;
|
||||||
if (bucket.type != type) {
|
if (bucket.type != type) {
|
||||||
log.error("BUG wrong bucket {} {} on level {}",
|
log.error("BUG wrong bucket {} {} on level {}", bucket.type, type, level);
|
||||||
Integer.valueOf(bucket.type),
|
|
||||||
Integer.valueOf(type),
|
|
||||||
Integer.valueOf(level));
|
|
||||||
|
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
return bucket;
|
return bucket;
|
||||||
@ -265,11 +264,7 @@ public class RenderBuckets extends TileData {
|
|||||||
|
|
||||||
/* check if found buckets matches requested type */
|
/* check if found buckets matches requested type */
|
||||||
if (bucket.type != type) {
|
if (bucket.type != type) {
|
||||||
log.error("BUG wrong bucket {} {} on level {}",
|
log.error("BUG wrong bucket {} {} on level {}", bucket.type, type, level);
|
||||||
Integer.valueOf(bucket.type),
|
|
||||||
Integer.valueOf(type),
|
|
||||||
Integer.valueOf(level));
|
|
||||||
|
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,8 +51,6 @@ public class VertexData extends Inlist.List<Chunk> {
|
|||||||
public int used;
|
public int used;
|
||||||
}
|
}
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
private static class Pool extends SyncPool<Chunk> {
|
private static class Pool extends SyncPool<Chunk> {
|
||||||
public Pool() {
|
public Pool() {
|
||||||
super(MAX_POOL);
|
super(MAX_POOL);
|
||||||
@ -146,6 +144,10 @@ public class VertexData extends Inlist.List<Chunk> {
|
|||||||
used = 0;
|
used = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void add(float a) {
|
||||||
|
add(toShort(a));
|
||||||
|
}
|
||||||
|
|
||||||
public void add(short a) {
|
public void add(short a) {
|
||||||
if (used == SIZE)
|
if (used == SIZE)
|
||||||
getNext();
|
getNext();
|
||||||
@ -153,10 +155,6 @@ public class VertexData extends Inlist.List<Chunk> {
|
|||||||
vertices[used++] = a;
|
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) {
|
public void add(float a, float b) {
|
||||||
add(toShort(a), toShort(b));
|
add(toShort(a), toShort(b));
|
||||||
}
|
}
|
||||||
@ -216,6 +214,10 @@ public class VertexData extends Inlist.List<Chunk> {
|
|||||||
used += 6;
|
used += 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean empty() {
|
||||||
|
return cur == null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Direct access to the current chunk of VertexData. Use with care!
|
* Direct access to the current chunk of VertexData. Use with care!
|
||||||
* <p/>
|
* <p/>
|
||||||
@ -250,7 +252,7 @@ public class VertexData extends Inlist.List<Chunk> {
|
|||||||
throw new IllegalStateException("seeked too far: " + offset + "/" + used);
|
throw new IllegalStateException("seeked too far: " + offset + "/" + used);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean empty() {
|
static final short toShort(float v) {
|
||||||
return cur == null;
|
return (short) FastMath.clamp(v, Short.MIN_VALUE, Short.MAX_VALUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user