add base layer 'faded' option for MapLens
This commit is contained in:
parent
54035374bd
commit
b92d939dfb
@ -37,6 +37,12 @@ public class TileRenderLayer extends RenderOverlay {
|
|||||||
mBoxCoords = new float[8];
|
mBoxCoords = new float[8];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean mFaded;
|
||||||
|
|
||||||
|
public void setFaded(boolean faded){
|
||||||
|
mFaded = faded;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(MapPosition curPos, boolean positionChanged, boolean tilesChanged,
|
public void update(MapPosition curPos, boolean positionChanged, boolean tilesChanged,
|
||||||
Matrices matrices) {
|
Matrices matrices) {
|
||||||
@ -81,7 +87,7 @@ public class TileRenderLayer extends RenderOverlay {
|
|||||||
|
|
||||||
tilesChanged |= (uploadCnt > 0);
|
tilesChanged |= (uploadCnt > 0);
|
||||||
|
|
||||||
TileRenderer.draw(tiles, tileCnt, curPos, matrices);
|
TileRenderer.draw(tiles, tileCnt, curPos, matrices, mFaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -50,12 +50,14 @@ public class TileRenderer {
|
|||||||
private static int mDrawSerial = 0;
|
private static int mDrawSerial = 0;
|
||||||
|
|
||||||
private static Matrices mMatrices;
|
private static Matrices mMatrices;
|
||||||
|
private static boolean mFaded;
|
||||||
|
|
||||||
private static final Matrix4 mProjMatrix = new Matrix4();
|
private static final Matrix4 mProjMatrix = new Matrix4();
|
||||||
|
|
||||||
static void draw(MapTile[] tiles, int tileCnt, MapPosition pos, Matrices m) {
|
static void draw(MapTile[] tiles, int tileCnt, MapPosition pos, Matrices m, boolean fade) {
|
||||||
mDrawCnt = 0;
|
mDrawCnt = 0;
|
||||||
mMatrices = m;
|
mMatrices = m;
|
||||||
|
mFaded = fade;
|
||||||
|
|
||||||
mProjMatrix.copy(m.viewproj);
|
mProjMatrix.copy(m.viewproj);
|
||||||
// discard z projection from tilt
|
// discard z projection from tilt
|
||||||
@ -76,7 +78,7 @@ public class TileRenderer {
|
|||||||
drawTile(t, pos);
|
drawTile(t, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
double scale = pos.getZoomScale();
|
double scale = pos.getZoomScale();
|
||||||
|
|
||||||
// Draw parent or children as proxy for visibile tiles that dont
|
// Draw parent or children as proxy for visibile tiles that dont
|
||||||
// have data yet. Proxies are clipped to the region where nothing
|
// have data yet. Proxies are clipped to the region where nothing
|
||||||
@ -84,7 +86,7 @@ public class TileRenderer {
|
|||||||
// TODO draw proxies for placeholder
|
// TODO draw proxies for placeholder
|
||||||
for (int i = 0; i < tileCnt; i++) {
|
for (int i = 0; i < tileCnt; i++) {
|
||||||
MapTile t = tiles[i];
|
MapTile t = tiles[i];
|
||||||
if (t.isVisible && (t.state != STATE_READY) && (t.holder == null)){
|
if (t.isVisible && (t.state != STATE_READY) && (t.holder == null)) {
|
||||||
boolean preferParent = (scale > 1.5) || (pos.zoomLevel - t.zoomLevel < 0);
|
boolean preferParent = (scale > 1.5) || (pos.zoomLevel - t.zoomLevel < 0);
|
||||||
drawProxyTile(t, pos, true, preferParent);
|
drawProxyTile(t, pos, true, preferParent);
|
||||||
}
|
}
|
||||||
@ -108,7 +110,6 @@ public class TileRenderer {
|
|||||||
mMatrices = null;
|
mMatrices = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void drawTile(MapTile tile, MapPosition pos) {
|
private static void drawTile(MapTile tile, MapPosition pos) {
|
||||||
// draw parents only once
|
// draw parents only once
|
||||||
if (tile.lastDraw == mDrawSerial)
|
if (tile.lastDraw == mDrawSerial)
|
||||||
@ -139,7 +140,7 @@ public class TileRenderer {
|
|||||||
float y = (float) ((tile.y - pos.y) * curScale);
|
float y = (float) ((tile.y - pos.y) * curScale);
|
||||||
|
|
||||||
Matrices m = mMatrices;
|
Matrices m = mMatrices;
|
||||||
m.mvp.setTransScale(x, y, (float)(scale / GLRenderer.COORD_SCALE));
|
m.mvp.setTransScale(x, y, (float) (scale / GLRenderer.COORD_SCALE));
|
||||||
|
|
||||||
m.mvp.multiplyMM(mProjMatrix, m.mvp);
|
m.mvp.multiplyMM(mProjMatrix, m.mvp);
|
||||||
|
|
||||||
@ -185,8 +186,10 @@ public class TileRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// clear clip-region and could also draw 'fade-effect'
|
// clear clip-region and could also draw 'fade-effect'
|
||||||
//PolygonRenderer.drawOver(m, true, 0x22000000);
|
if (mFaded)
|
||||||
PolygonRenderer.drawOver(m, false, 0);
|
PolygonRenderer.drawOver(m, true, 0x22000000);
|
||||||
|
else
|
||||||
|
PolygonRenderer.drawOver(m, false, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int drawProxyChild(MapTile tile, MapPosition pos) {
|
private static int drawProxyChild(MapTile tile, MapPosition pos) {
|
||||||
@ -206,7 +209,8 @@ public class TileRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// just FIXME!
|
// just FIXME!
|
||||||
private static void drawProxyTile(MapTile tile, MapPosition pos, boolean parent, boolean preferParent) {
|
private static void drawProxyTile(MapTile tile, MapPosition pos, boolean parent,
|
||||||
|
boolean preferParent) {
|
||||||
|
|
||||||
QuadTree<MapTile> r = tile.rel;
|
QuadTree<MapTile> r = tile.rel;
|
||||||
MapTile proxy;
|
MapTile proxy;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user