- rename class Tiles -> TileSet
- cleanup + comments
This commit is contained in:
parent
64c56ce7df
commit
3dc36e108a
@ -98,7 +98,7 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
// happens rarely, unless you live on Fidschi
|
// happens rarely, unless you live on Fidschi
|
||||||
|
|
||||||
/* package */static int mHolderCount;
|
/* package */static int mHolderCount;
|
||||||
/* package */static Tiles mDrawTiles;
|
/* package */static TileSet mDrawTiles;
|
||||||
|
|
||||||
static boolean[] vertexArray = { false, false };
|
static boolean[] vertexArray = { false, false };
|
||||||
|
|
||||||
@ -142,20 +142,17 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
else
|
else
|
||||||
xx = x - xmax;
|
xx = x - xmax;
|
||||||
|
|
||||||
if (xx < 0 || xx >= xmax) {
|
if (xx < 0 || xx >= xmax)
|
||||||
// Log.d(TAG, "out of bounds " + y + " " + x + "/" + xx);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
for (int i = cnt; i < cnt + mHolderCount; i++)
|
for (int i = cnt; i < cnt + mHolderCount; i++)
|
||||||
if (tiles[i].tileX == x && tiles[i].tileY == y) {
|
if (tiles[i].tileX == x && tiles[i].tileY == y) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found) {
|
if (found)
|
||||||
// Log.d(TAG, "already added " + y + " " + x + "/" + xx);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < cnt; i++)
|
for (int i = 0; i < cnt; i++)
|
||||||
if (tiles[i].tileX == xx && tiles[i].tileY == y) {
|
if (tiles[i].tileX == xx && tiles[i].tileY == y) {
|
||||||
@ -163,10 +160,8 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tile == null) {
|
if (tile == null)
|
||||||
// Log.d(TAG, "not found " + y + " " + x + "/" + xx);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
holder = new MapTile(x, y, mZoom);
|
holder = new MapTile(x, y, mZoom);
|
||||||
holder.isVisible = true;
|
holder.isVisible = true;
|
||||||
@ -211,17 +206,8 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
shortBuffer[i] = bbuf.asShortBuffer();
|
shortBuffer[i] = bbuf.asShortBuffer();
|
||||||
shortBuffer[i].put(mFillCoords, 0, 8);
|
shortBuffer[i].put(mFillCoords, 0, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
// overlays = new ArrayList<RenderOverlay>();
|
|
||||||
|
|
||||||
// mOverlays.add(new OverlayGrid(mapView));
|
|
||||||
// mOverlays.add(new OverlayTest(mapView));
|
|
||||||
// overlays.add(new OverlayText(mapView));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private static ArrayList<RenderOverlay> overlays;
|
|
||||||
|
|
||||||
public static void setRenderTheme(RenderTheme t) {
|
public static void setRenderTheme(RenderTheme t) {
|
||||||
mClearColor = GlUtils.colorToFloat(t.getMapBackground());
|
mClearColor = GlUtils.colorToFloat(t.getMapBackground());
|
||||||
mUpdateColor = true;
|
mUpdateColor = true;
|
||||||
@ -233,7 +219,6 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
|
|
||||||
int newSize = layers.getSize();
|
int newSize = layers.getSize();
|
||||||
if (newSize == 0) {
|
if (newSize == 0) {
|
||||||
// FIXME why are there so many tiles empty?
|
|
||||||
// Log.d(TAG, "empty");
|
// Log.d(TAG, "empty");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -252,7 +237,6 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
if (addFill)
|
if (addFill)
|
||||||
newSize += 8;
|
newSize += 8;
|
||||||
|
|
||||||
// probably not a good idea to do this in gl thread...
|
|
||||||
if (sbuf.capacity() < newSize) {
|
if (sbuf.capacity() < newSize) {
|
||||||
sbuf = ByteBuffer
|
sbuf = ByteBuffer
|
||||||
.allocateDirect(newSize * SHORT_BYTES)
|
.allocateDirect(newSize * SHORT_BYTES)
|
||||||
@ -260,16 +244,15 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
.asShortBuffer();
|
.asShortBuffer();
|
||||||
|
|
||||||
shortBuffer[curBuffer] = sbuf;
|
shortBuffer[curBuffer] = sbuf;
|
||||||
if (addFill)
|
|
||||||
sbuf.put(mFillCoords, 0, 8);
|
|
||||||
} else {
|
} else {
|
||||||
sbuf.clear();
|
sbuf.clear();
|
||||||
if (addFill)
|
|
||||||
sbuf.put(mFillCoords, 0, 8);
|
|
||||||
// if (addFill)
|
// if (addFill)
|
||||||
// sbuf.position(8);
|
// sbuf.position(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (addFill)
|
||||||
|
sbuf.put(mFillCoords, 0, 8);
|
||||||
|
|
||||||
layers.compile(sbuf, addFill);
|
layers.compile(sbuf, addFill);
|
||||||
sbuf.flip();
|
sbuf.flip();
|
||||||
|
|
||||||
@ -279,8 +262,6 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
+ sbuf.position() + " "
|
+ sbuf.position() + " "
|
||||||
+ sbuf.limit() + " "
|
+ sbuf.limit() + " "
|
||||||
+ sbuf.remaining());
|
+ sbuf.remaining());
|
||||||
|
|
||||||
// tile.newData = false;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
newSize *= SHORT_BYTES;
|
newSize *= SHORT_BYTES;
|
||||||
@ -291,10 +272,10 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
&& mBufferMemoryUsage < LIMIT_BUFFERS) {
|
&& mBufferMemoryUsage < LIMIT_BUFFERS) {
|
||||||
GLES20.glBufferSubData(GL_ARRAY_BUFFER, 0, newSize, sbuf);
|
GLES20.glBufferSubData(GL_ARRAY_BUFFER, 0, newSize, sbuf);
|
||||||
} else {
|
} else {
|
||||||
mBufferMemoryUsage -= vbo.size;
|
mBufferMemoryUsage += newSize - vbo.size;
|
||||||
vbo.size = newSize;
|
vbo.size = newSize;
|
||||||
GLES20.glBufferData(GL_ARRAY_BUFFER, vbo.size, sbuf, GL_DYNAMIC_DRAW);
|
GLES20.glBufferData(GL_ARRAY_BUFFER, vbo.size, sbuf, GL_DYNAMIC_DRAW);
|
||||||
mBufferMemoryUsage += vbo.size;
|
//mBufferMemoryUsage += vbo.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -303,7 +284,9 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
private static boolean uploadTileData(MapTile tile) {
|
private static boolean uploadTileData(MapTile tile) {
|
||||||
if (tile.layers != null) {
|
if (tile.layers != null) {
|
||||||
tile.isReady = uploadLayers(tile.layers, tile.vbo, true);
|
tile.isReady = uploadLayers(tile.layers, tile.vbo, true);
|
||||||
|
|
||||||
if (!tile.isReady) {
|
if (!tile.isReady) {
|
||||||
|
Log.d(TAG, "uploadTileData " + tile + " is empty!");
|
||||||
tile.layers.clear();
|
tile.layers.clear();
|
||||||
tile.layers = null;
|
tile.layers = null;
|
||||||
}
|
}
|
||||||
@ -466,11 +449,8 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
|
|
||||||
tileCnt += mHolderCount;
|
tileCnt += mHolderCount;
|
||||||
|
|
||||||
// Log.d(TAG, "visible: " + tileCnt);
|
/* compile layer data and upload to VBOs */
|
||||||
|
|
||||||
uploadCnt = 0;
|
uploadCnt = 0;
|
||||||
|
|
||||||
// compile data and upload to VBOsi
|
|
||||||
for (int i = 0; i < tileCnt; i++) {
|
for (int i = 0; i < tileCnt; i++) {
|
||||||
MapTile tile = tiles[i];
|
MapTile tile = tiles[i];
|
||||||
|
|
||||||
@ -514,15 +494,15 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
|
|
||||||
tilesChanged |= (uploadCnt > 0);
|
tilesChanged |= (uploadCnt > 0);
|
||||||
|
|
||||||
// update overlays
|
/* update overlays */
|
||||||
List<RenderOverlay> overlays = mMapView.getOverlayManager().getRenderLayers();
|
List<RenderOverlay> overlays = mMapView.getOverlayManager().getRenderLayers();
|
||||||
|
|
||||||
for (int i = 0, n = overlays.size(); i < n; i++)
|
for (int i = 0, n = overlays.size(); i < n; i++)
|
||||||
overlays.get(i).update(mMapPosition, changed, tilesChanged);
|
overlays.get(i).update(mMapPosition, changed, tilesChanged);
|
||||||
|
|
||||||
|
/* draw base layer */
|
||||||
GLES20.glEnable(GL_DEPTH_TEST);
|
GLES20.glEnable(GL_DEPTH_TEST);
|
||||||
GLES20.glEnable(GL_POLYGON_OFFSET_FILL);
|
GLES20.glEnable(GL_POLYGON_OFFSET_FILL);
|
||||||
|
|
||||||
mDrawCount = 0;
|
mDrawCount = 0;
|
||||||
|
|
||||||
for (int i = 0; i < tileCnt; i++) {
|
for (int i = 0; i < tileCnt; i++) {
|
||||||
@ -543,11 +523,9 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
|
|
||||||
GLES20.glDisable(GL_POLYGON_OFFSET_FILL);
|
GLES20.glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
GLES20.glDisable(GL_DEPTH_TEST);
|
GLES20.glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
// Log.d(TAG, "tiles: " + mDrawCount);
|
|
||||||
|
|
||||||
mDrawSerial++;
|
mDrawSerial++;
|
||||||
|
|
||||||
|
/* draw overlays */
|
||||||
GLES20.glEnable(GL_BLEND);
|
GLES20.glEnable(GL_BLEND);
|
||||||
|
|
||||||
// call overlay renderer
|
// call overlay renderer
|
||||||
@ -599,9 +577,6 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
mapPosition.viewMatrix, 0);
|
mapPosition.viewMatrix, 0);
|
||||||
PolygonRenderer.debugDraw(mMVPMatrix, mDebugCoords, 1);
|
PolygonRenderer.debugDraw(mMVPMatrix, mDebugCoords, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mMapView.getOverlayManager().onUpdate(mMapPosition);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// used to not draw a tile twice per frame.
|
// used to not draw a tile twice per frame.
|
||||||
@ -732,13 +707,11 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
if (width <= 0 || height <= 0)
|
if (width <= 0 || height <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// boolean changed = true;
|
|
||||||
// if (mWidth == width || mHeight == height)
|
|
||||||
// changed = false;
|
|
||||||
|
|
||||||
mWidth = width;
|
mWidth = width;
|
||||||
mHeight = height;
|
mHeight = height;
|
||||||
|
|
||||||
|
GLES20.glScissor(0, 0, mWidth, mHeight);
|
||||||
|
|
||||||
float s = MapViewPosition.VIEW_SCALE;
|
float s = MapViewPosition.VIEW_SCALE;
|
||||||
float aspect = mHeight / (float) mWidth;
|
float aspect = mHeight / (float) mWidth;
|
||||||
|
|
||||||
@ -802,8 +775,7 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
TextureRenderer.init();
|
TextureRenderer.init();
|
||||||
TextureObject.init(10);
|
TextureObject.init(10);
|
||||||
|
|
||||||
// glEnable(GL_SCISSOR_TEST);
|
GLES20.glEnable(GLES20.GL_SCISSOR_TEST);
|
||||||
// glScissor(0, 0, mWidth, mHeight);
|
|
||||||
GLES20.glClearStencil(0);
|
GLES20.glClearStencil(0);
|
||||||
GLES20.glDisable(GLES20.GL_CULL_FACE);
|
GLES20.glDisable(GLES20.GL_CULL_FACE);
|
||||||
GLES20.glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
GLES20.glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
@ -90,20 +90,20 @@ public final class LineRenderer {
|
|||||||
|
|
||||||
GLES20.glUseProgram(lineProgram[mode]);
|
GLES20.glUseProgram(lineProgram[mode]);
|
||||||
|
|
||||||
int va = hLineVertexPosition[mode];
|
// int va = hLineVertexPosition[mode];
|
||||||
//if (!GLRenderer.vertexArray[va]) {
|
// if (!GLRenderer.vertexArray[va]) {
|
||||||
GLES20.glEnableVertexAttribArray(va);
|
// GLES20.glEnableVertexAttribArray(va);
|
||||||
// GLRenderer.vertexArray[va] = true;
|
// GLRenderer.vertexArray[va] = true;
|
||||||
//}
|
// }
|
||||||
|
|
||||||
va = hLineTexturePosition[mode];
|
// va = hLineTexturePosition[mode];
|
||||||
//if (!GLRenderer.vertexArray[va]) {
|
// if (!GLRenderer.vertexArray[va]) {
|
||||||
GLES20.glEnableVertexAttribArray(va);
|
// GLES20.glEnableVertexAttribArray(va);
|
||||||
// GLRenderer.vertexArray[va] = true;
|
// GLRenderer.vertexArray[va] = true;
|
||||||
//}
|
// }
|
||||||
|
|
||||||
// GLES20.glEnableVertexAttribArray(hLineVertexPosition[mode]);
|
GLES20.glEnableVertexAttribArray(hLineVertexPosition[mode]);
|
||||||
// GLES20.glEnableVertexAttribArray(hLineTexturePosition[mode]);
|
GLES20.glEnableVertexAttribArray(hLineTexturePosition[mode]);
|
||||||
|
|
||||||
GLES20.glVertexAttribPointer(hLineVertexPosition[mode], 2, GLES20.GL_SHORT,
|
GLES20.glVertexAttribPointer(hLineVertexPosition[mode], 2, GLES20.GL_SHORT,
|
||||||
false, 8, bufferOffset + LINE_VERTICES_DATA_POS_OFFSET);
|
false, 8, bufferOffset + LINE_VERTICES_DATA_POS_OFFSET);
|
||||||
|
@ -102,15 +102,16 @@ public final class PolygonRenderer {
|
|||||||
f = 1.0f;
|
f = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
f *= l.area.color[3];
|
|
||||||
|
|
||||||
if (!blend) {
|
if (!blend) {
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
blend = true;
|
blend = true;
|
||||||
}
|
}
|
||||||
|
if (f != 1) {
|
||||||
|
f *= l.area.color[3];
|
||||||
GlUtils.setColor(hPolygonColor, l.area.color, f);
|
GlUtils.setColor(hPolygonColor, l.area.color, f);
|
||||||
|
} else {
|
||||||
|
glUniform4fv(hPolygonColor, 1, l.area.color, 0);
|
||||||
|
}
|
||||||
} else if (l.area.blend == zoom) {
|
} else if (l.area.blend == zoom) {
|
||||||
/* blend colors */
|
/* blend colors */
|
||||||
f = scale - 1.0f;
|
f = scale - 1.0f;
|
||||||
@ -168,17 +169,18 @@ public final class PolygonRenderer {
|
|||||||
|
|
||||||
glUseProgram(polygonProgram);
|
glUseProgram(polygonProgram);
|
||||||
|
|
||||||
int va = hPolygonVertexPosition;
|
// int va = hPolygonVertexPosition;
|
||||||
//if (!GLRenderer.vertexArray[va]) {
|
// if (!GLRenderer.vertexArray[va]) {
|
||||||
GLES20.glEnableVertexAttribArray(va);
|
// GLES20.glEnableVertexAttribArray(va);
|
||||||
// GLRenderer.vertexArray[va] = true;
|
// GLRenderer.vertexArray[va] = true;
|
||||||
//}
|
// }
|
||||||
//va = va == 0 ? 1 : 0;
|
// va = va == 0 ? 1 : 0;
|
||||||
//if (GLRenderer.vertexArray[va]) {
|
// if (GLRenderer.vertexArray[va]) {
|
||||||
// GLES20.glDisableVertexAttribArray(va);
|
// GLES20.glDisableVertexAttribArray(va);
|
||||||
// GLRenderer.vertexArray[va] = false;
|
// GLRenderer.vertexArray[va] = false;
|
||||||
//}
|
// }
|
||||||
// GLES20.glEnableVertexAttribArray(hPolygonVertexPosition);
|
|
||||||
|
GLES20.glEnableVertexAttribArray(hPolygonVertexPosition);
|
||||||
|
|
||||||
glVertexAttribPointer(hPolygonVertexPosition, 2, GLES20.GL_SHORT,
|
glVertexAttribPointer(hPolygonVertexPosition, 2, GLES20.GL_SHORT,
|
||||||
false, 0, POLYGON_VERTICES_DATA_POS_OFFSET);
|
false, 0, POLYGON_VERTICES_DATA_POS_OFFSET);
|
||||||
|
@ -61,8 +61,8 @@ public class TileManager {
|
|||||||
|
|
||||||
static int mUpdateCnt;
|
static int mUpdateCnt;
|
||||||
static Object tilelock = new Object();
|
static Object tilelock = new Object();
|
||||||
static Tiles mCurrentTiles;
|
static TileSet mCurrentTiles;
|
||||||
/* package */static Tiles mNewTiles;
|
/* package */static TileSet mNewTiles;
|
||||||
|
|
||||||
static int tileCounter;
|
static int tileCounter;
|
||||||
|
|
||||||
@ -191,8 +191,8 @@ public class TileManager {
|
|||||||
int num = Math.max(mWidth, mHeight);
|
int num = Math.max(mWidth, mHeight);
|
||||||
int size = Tile.TILE_SIZE >> 1;
|
int size = Tile.TILE_SIZE >> 1;
|
||||||
int numTiles = (num * num) / (size * size) * 4;
|
int numTiles = (num * num) / (size * size) * 4;
|
||||||
mNewTiles = new Tiles(numTiles);
|
mNewTiles = new TileSet(numTiles);
|
||||||
mCurrentTiles = new Tiles(numTiles);
|
mCurrentTiles = new TileSet(numTiles);
|
||||||
|
|
||||||
GLRenderer.drawlock.unlock();
|
GLRenderer.drawlock.unlock();
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ public class TileManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Tiles getActiveTiles(Tiles td) {
|
public static TileSet getActiveTiles(TileSet td) {
|
||||||
if (mCurrentTiles == null)
|
if (mCurrentTiles == null)
|
||||||
return td;
|
return td;
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ public class TileManager {
|
|||||||
MapTile[] nextTiles;
|
MapTile[] nextTiles;
|
||||||
|
|
||||||
if (td == null) {
|
if (td == null) {
|
||||||
td = new Tiles(newTiles.length);
|
td = new TileSet(newTiles.length);
|
||||||
} else if (td.serial > mUpdateCnt) {
|
} else if (td.serial > mUpdateCnt) {
|
||||||
Log.d(TAG, "ignore previous tile data " + td.cnt);
|
Log.d(TAG, "ignore previous tile data " + td.cnt);
|
||||||
// tile data was cleared, ignore tiles
|
// tile data was cleared, ignore tiles
|
||||||
@ -280,7 +280,7 @@ public class TileManager {
|
|||||||
return td;
|
return td;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void releaseTiles(Tiles tiles) {
|
// public void releaseTiles(TileSet tiles) {
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ public class TileManager {
|
|||||||
for (int i = 0, n = mCurrentTiles.cnt; i < n; i++)
|
for (int i = 0, n = mCurrentTiles.cnt; i < n; i++)
|
||||||
curTiles[i].unlock();
|
curTiles[i].unlock();
|
||||||
|
|
||||||
Tiles tmp = mCurrentTiles;
|
TileSet tmp = mCurrentTiles;
|
||||||
mCurrentTiles = mNewTiles;
|
mCurrentTiles = mNewTiles;
|
||||||
mNewTiles = tmp;
|
mNewTiles = tmp;
|
||||||
|
|
||||||
|
@ -15,20 +15,20 @@
|
|||||||
package org.oscim.renderer;
|
package org.oscim.renderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* use with TileManager.getActiveTiles(Tiles) to get the current tiles. tiles
|
* use with TileManager.getActiveTiles(TileSet) to get the current tiles. tiles
|
||||||
* are locked to not be modifed until getActiveTiles passes them back on a
|
* are locked to not be modifed until getActiveTiles passes them back on a
|
||||||
* second invocation or TODO: implement TileManager.releaseTiles(Tiles).
|
* second invocation or TODO: implement TileManager.releaseTiles(TileSet).
|
||||||
*/
|
*/
|
||||||
public final class Tiles {
|
public final class TileSet {
|
||||||
public int cnt = 0;
|
public int cnt = 0;
|
||||||
public MapTile[] tiles;
|
public MapTile[] tiles;
|
||||||
|
|
||||||
int serial;
|
int serial;
|
||||||
|
|
||||||
Tiles() {
|
TileSet() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Tiles(int numTiles) {
|
TileSet(int numTiles) {
|
||||||
tiles = new MapTile[numTiles];
|
tiles = new MapTile[numTiles];
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -28,6 +28,7 @@ public class Layers {
|
|||||||
|
|
||||||
private Layer mCurLayer;
|
private Layer mCurLayer;
|
||||||
|
|
||||||
|
// get or add the line- or polygon-layer for a level.
|
||||||
public Layer getLayer(int level, byte type) {
|
public Layer getLayer(int level, byte type) {
|
||||||
Layer l = layers;
|
Layer l = layers;
|
||||||
Layer ret = null;
|
Layer ret = null;
|
||||||
@ -177,9 +178,6 @@ public class Layers {
|
|||||||
l.curItem = null;
|
l.curItem = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (l instanceof TextLayer)
|
|
||||||
// ((TextLayer) l).clear();
|
|
||||||
|
|
||||||
l = l.next;
|
l = l.next;
|
||||||
}
|
}
|
||||||
textureLayers = null;
|
textureLayers = null;
|
||||||
|
@ -20,7 +20,7 @@ import org.oscim.core.Tile;
|
|||||||
import org.oscim.renderer.GLRenderer;
|
import org.oscim.renderer.GLRenderer;
|
||||||
import org.oscim.renderer.MapTile;
|
import org.oscim.renderer.MapTile;
|
||||||
import org.oscim.renderer.TileManager;
|
import org.oscim.renderer.TileManager;
|
||||||
import org.oscim.renderer.Tiles;
|
import org.oscim.renderer.TileSet;
|
||||||
import org.oscim.renderer.layer.TextItem;
|
import org.oscim.renderer.layer.TextItem;
|
||||||
import org.oscim.renderer.layer.TextLayer;
|
import org.oscim.renderer.layer.TextLayer;
|
||||||
import org.oscim.utils.FastMath;
|
import org.oscim.utils.FastMath;
|
||||||
@ -34,7 +34,7 @@ import android.util.FloatMath;
|
|||||||
|
|
||||||
public class OverlayText extends RenderOverlay {
|
public class OverlayText extends RenderOverlay {
|
||||||
|
|
||||||
private Tiles tiles;
|
private TileSet tiles;
|
||||||
private LabelThread mThread;
|
private LabelThread mThread;
|
||||||
|
|
||||||
private MapPosition mWorkPos;
|
private MapPosition mWorkPos;
|
||||||
|
@ -46,6 +46,8 @@ public abstract class RenderOverlay {
|
|||||||
|
|
||||||
public BufferObject vbo;
|
public BufferObject vbo;
|
||||||
|
|
||||||
|
protected float[] mvp = new float[16];
|
||||||
|
|
||||||
public RenderOverlay(MapView mapView) {
|
public RenderOverlay(MapView mapView) {
|
||||||
mMapView = mapView;
|
mMapView = mapView;
|
||||||
mMapPosition = new MapPosition();
|
mMapPosition = new MapPosition();
|
||||||
@ -68,7 +70,7 @@ public abstract class RenderOverlay {
|
|||||||
* @param positionChanged
|
* @param positionChanged
|
||||||
* true when MapPosition has changed
|
* true when MapPosition has changed
|
||||||
* @param tilesChanged
|
* @param tilesChanged
|
||||||
* true when loaded tiles changed
|
* true when current tiles changed
|
||||||
*/
|
*/
|
||||||
public synchronized void update(MapPosition curPos, boolean positionChanged,
|
public synchronized void update(MapPosition curPos, boolean positionChanged,
|
||||||
boolean tilesChanged) {
|
boolean tilesChanged) {
|
||||||
@ -86,8 +88,15 @@ public abstract class RenderOverlay {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
float[] mvp = new float[16];
|
/**
|
||||||
|
* Default overlay render function
|
||||||
|
* @param pos
|
||||||
|
* current MapPosition
|
||||||
|
* @param mv
|
||||||
|
* current model-view matrix
|
||||||
|
* @param proj
|
||||||
|
* current projection matrix
|
||||||
|
*/
|
||||||
public synchronized void render(MapPosition pos, float[] mv, float[] proj) {
|
public synchronized void render(MapPosition pos, float[] mv, float[] proj) {
|
||||||
float div = setMatrix(pos, mv);
|
float div = setMatrix(pos, mv);
|
||||||
|
|
||||||
@ -105,8 +114,6 @@ public abstract class RenderOverlay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// float scale = curPos.scale / div;
|
|
||||||
|
|
||||||
for (Layer l = layers.textureLayers; l != null;) {
|
for (Layer l = layers.textureLayers; l != null;) {
|
||||||
|
|
||||||
l = TextureRenderer.draw(l, (mMapPosition.scale / pos.scale) * div, proj, mv,
|
l = TextureRenderer.draw(l, (mMapPosition.scale / pos.scale) * div, proj, mv,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user