use setTileMatrix utility function

This commit is contained in:
Hannes Janetzek
2013-01-11 09:44:46 +01:00
parent 5b3b299217
commit bfe8cf2889
3 changed files with 53 additions and 53 deletions

View File

@@ -14,6 +14,8 @@
*/
package org.oscim.utils;
import org.oscim.renderer.GLRenderer;
import android.graphics.Bitmap;
import android.opengl.GLES20;
import android.opengl.GLUtils;
@@ -186,4 +188,25 @@ public class GlUtils {
c[2] = (color >> 0 & 0xff) / 255.0f * c[3];
return c;
}
public static void setTileMatrix(float[] matrix, float tx, float ty, float s) {
// scale tile relative to map scale
matrix[0] = matrix[5] = s / GLRenderer.COORD_MULTIPLIER;
matrix[1] = 0;
matrix[2] = 0;
matrix[3] = 0;
matrix[4] = 0;
matrix[6] = 0;
matrix[7] = 0;
matrix[8] = 0;
matrix[9] = 0;
matrix[10] = 1;
matrix[11] = 0;
// translate relative to map center
matrix[12] = tx * s;
matrix[13] = ty * s;
matrix[14] = 0;
matrix[15] = 1;
}
}