enable PolygonLayer pattern textures and repeat (tile_size/texture_width) times

This commit is contained in:
Hannes Janetzek 2013-09-23 01:39:20 +02:00
parent fa28799a5b
commit 425c12593b

View File

@ -31,12 +31,18 @@ import org.oscim.renderer.MapRenderer;
import org.oscim.renderer.MapRenderer.Matrices;
import org.oscim.theme.renderinstruction.Area;
import org.oscim.utils.FastMath;
import org.oscim.utils.Interpolation;
/**
* Special Renderer for drawing tile polygons
*/
public final class PolygonLayer extends RenderElement {
private static final String TAG = PolygonLayer.class.getName();
private static final float S = MapRenderer.COORD_SCALE;
private static final boolean enableTexture = true;
public Area area;
PolygonLayer(int layer) {
@ -115,9 +121,6 @@ public final class PolygonLayer extends RenderElement {
protected void clear() {
}
/**
* Special Renderer for drawing tile polygon layers
*/
public static final class Renderer {
private static GL20 GL;
@ -141,8 +144,6 @@ public final class PolygonLayer extends RenderElement {
private static int[] hPolygonColor = new int[numShaders];
private static int[] hPolygonScale = new int[numShaders];
private static boolean enableTexture = false;
static boolean init(GL20 gl) {
GL = gl;
@ -194,8 +195,12 @@ public final class PolygonLayer extends RenderElement {
if (enableTexture && a.texture != null) {
shader = texShader;
setShader(texShader, m);
GL.glUniform2f(hPolygonScale[1], FastMath.clamp(scale - 1, 0, 1), div);
float num = (Tile.SIZE / a.texture.width) >> 1;
float transition = Interpolation.exp5.apply(FastMath.clamp(scale - 1, 0, 1));
GL.glUniform2f(hPolygonScale[1], transition, div / num);
//if (a.texture.alpha);
GLState.blend(true);
a.texture.bind();
} else if (a.fade >= zoom) {