no need to 'flatten' projection anymore, depth test is only used for drawing clip rectangles

This commit is contained in:
Hannes Janetzek 2013-03-16 20:58:33 +01:00
parent f440920a4b
commit 3f4a8980a9
2 changed files with 2 additions and 25 deletions

View File

@ -22,7 +22,6 @@ 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;
@ -35,11 +34,7 @@ import android.opengl.GLES20;
* @author Hannes Janetzek
*/
public class BaseMap {
private final static String TAG = BaseMap.class.getName();
//private static Matrix4 mMVPMatrix = new Matrix4();
private static Matrix4 mVPMatrix = new Matrix4();
private static Matrix4 mfProjMatrix = new Matrix4();
//private final static String TAG = BaseMap.class.getName();
// used to increase polygon-offset for each tile drawn.
private static int mDrawCnt;
@ -47,27 +42,12 @@ public class BaseMap {
// used to not draw a tile twice per frame.
private static int mDrawSerial = 0;
static void setProjection(Matrix4 projMatrix) {
float[] tmp = new float[16];
projMatrix.get(tmp);
//System.arraycopy(projMatrix, 0, mfProjMatrix, 0, 16);
// set to zero: we modify the z value with polygon-offset for clipping
tmp[10] = 0;
tmp[14] = 0;
mfProjMatrix.set(tmp);
}
private static Matrices mMatrices;
static void draw(MapTile[] tiles, int tileCnt, MapPosition pos, Matrices m) {
mDrawCnt = 0;
mMatrices = m;
// use our 'flat' projection matrix
mVPMatrix.multiplyMM(mfProjMatrix, m.view);
//Matrix.multiplyMM(mVPMatrix, 0, mfProjMatrix, 0, m.view, 0);
GLES20.glDepthFunc(GLES20.GL_LESS);
// load texture for line caps
@ -136,8 +116,7 @@ public class BaseMap {
Matrices m = mMatrices;
m.mvp.setTransScale(x * scale, y * scale, scale / GLRenderer.COORD_SCALE);
// add view-projection matrix
m.mvp.multiplyMM(mVPMatrix, m.mvp);
m.mvp.multiplyMM(m.viewproj, m.mvp);
// set depth offset (used for clipping to tile boundaries)
GLES20.glPolygonOffset(1, mDrawCnt++);

View File

@ -591,8 +591,6 @@ public class GLRenderer implements GLSurfaceView.Renderer {
// Matrix.multiplyMM(mMatrices.proj, 0, mMatrices.mvp, 0, mMatrices.proj, 0);
//}
BaseMap.setProjection(mMatrices.proj);
GLES20.glViewport(0, 0, width, height);
GLES20.glScissor(0, 0, width, height);
GLES20.glEnable(GLES20.GL_SCISSOR_TEST);