added MapLensOverlay
This commit is contained in:
@@ -294,7 +294,7 @@ public final class PolygonRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawOver(Matrices m) {
|
||||
public static void drawOver(Matrices m, boolean drawColor, int color) {
|
||||
if (GLState.useProgram(polygonProgram)) {
|
||||
|
||||
GLState.enableVertexArrays(hPolygonVertexPosition, -1);
|
||||
@@ -310,9 +310,13 @@ public final class PolygonRenderer {
|
||||
* a quad with func 'always' and op 'zero'
|
||||
*/
|
||||
|
||||
// disable drawing to framebuffer (will be re-enabled in fill)
|
||||
glColorMask(false, false, false, false);
|
||||
|
||||
if (drawColor) {
|
||||
GlUtils.setColor(hPolygonColor, color, 1);
|
||||
GLState.blend(true);
|
||||
} else {
|
||||
// disable drawing to framebuffer (will be re-enabled in fill)
|
||||
glColorMask(false, false, false, false);
|
||||
}
|
||||
// always pass stencil test:
|
||||
glStencilFunc(GL_ALWAYS, 0x00, 0x00);
|
||||
// write to all bits
|
||||
@@ -321,7 +325,9 @@ public final class PolygonRenderer {
|
||||
glStencilOp(GLES20.GL_KEEP, GLES20.GL_KEEP, GLES20.GL_ZERO);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
glColorMask(true, true, true, true);
|
||||
|
||||
if (!drawColor)
|
||||
glColorMask(true, true, true, true);
|
||||
}
|
||||
|
||||
private static float[] debugFillColor = { 0.3f, 0.0f, 0.0f, 0.3f };
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.oscim.core.MapPosition;
|
||||
import org.oscim.renderer.GLRenderer.Matrices;
|
||||
import org.oscim.renderer.layer.Layer;
|
||||
import org.oscim.utils.FastMath;
|
||||
import org.oscim.utils.Matrix4;
|
||||
|
||||
import android.opengl.GLES20;
|
||||
|
||||
@@ -44,10 +45,17 @@ public class TileRenderer {
|
||||
|
||||
private static Matrices mMatrices;
|
||||
|
||||
private static final Matrix4 mProjMatrix = new Matrix4();
|
||||
|
||||
static void draw(MapTile[] tiles, int tileCnt, MapPosition pos, Matrices m) {
|
||||
mDrawCnt = 0;
|
||||
mMatrices = m;
|
||||
|
||||
mProjMatrix.copy(m.viewproj);
|
||||
// discard z projection from tilt
|
||||
mProjMatrix.setValue(10, 0);
|
||||
mProjMatrix.setValue(14, 0);
|
||||
|
||||
GLES20.glDepthFunc(GLES20.GL_LESS);
|
||||
|
||||
// load texture for line caps
|
||||
@@ -116,11 +124,11 @@ public class TileRenderer {
|
||||
Matrices m = mMatrices;
|
||||
m.mvp.setTransScale(x * scale, y * scale, scale / GLRenderer.COORD_SCALE);
|
||||
|
||||
m.mvp.multiplyMM(m.viewproj, m.mvp);
|
||||
m.mvp.multiplyMM(mProjMatrix, m.mvp);
|
||||
|
||||
// set depth offset (used for clipping to tile boundaries)
|
||||
GLES20.glPolygonOffset(1, mDrawCnt++);
|
||||
if (mDrawCnt > 20)
|
||||
if (mDrawCnt == 100)
|
||||
mDrawCnt = 0;
|
||||
|
||||
// simple line shader does not take forward shortening into account
|
||||
@@ -160,7 +168,7 @@ public class TileRenderer {
|
||||
}
|
||||
|
||||
// clear clip-region and could also draw 'fade-effect'
|
||||
PolygonRenderer.drawOver(m);
|
||||
PolygonRenderer.drawOver(m, true, 0x22000000);
|
||||
}
|
||||
|
||||
private static int drawProxyChild(MapTile tile, MapPosition pos) {
|
||||
|
||||
Reference in New Issue
Block a user