fix: AreaStyle blend
This commit is contained in:
parent
29f19b36ce
commit
0b1fba58bb
@ -182,9 +182,6 @@ public class MeshBucket extends RenderBucket {
|
||||
float heightOffset = 0;
|
||||
gl.uniform1f(s.uHeight, heightOffset);
|
||||
|
||||
int zoom = v.pos.zoomLevel;
|
||||
float scale = (float) v.pos.getZoomScale();
|
||||
|
||||
for (; l != null && l.type == MESH; l = l.next) {
|
||||
MeshBucket ml = (MeshBucket) l;
|
||||
|
||||
@ -225,8 +222,6 @@ public class MeshBucket extends RenderBucket {
|
||||
|
||||
private static final int OPAQUE = 0xff000000;
|
||||
|
||||
//private static final float FADE_START = 1.3f;
|
||||
|
||||
static void setColor(AreaStyle a, Shader s, MapPosition pos) {
|
||||
float fade = a.getFade(pos.scale);
|
||||
float blend = a.getBlend(pos.scale);
|
||||
@ -234,12 +229,12 @@ public class MeshBucket extends RenderBucket {
|
||||
if (fade < 1.0f) {
|
||||
GLState.blend(true);
|
||||
GLUtils.setColor(s.uColor, a.color, fade);
|
||||
} else if (blend < 1.0f) {
|
||||
if (blend == 0.0f)
|
||||
} else if (blend > 0.0f) {
|
||||
if (blend == 1.0f)
|
||||
GLUtils.setColor(s.uColor, a.blendColor, 1);
|
||||
else
|
||||
GLUtils.setColorBlend(s.uColor, a.color,
|
||||
a.blendColor, 1 - blend);
|
||||
a.blendColor, blend);
|
||||
} else {
|
||||
/* test if color contains alpha */
|
||||
GLState.blend((a.color & OPAQUE) != OPAQUE);
|
||||
|
@ -161,8 +161,6 @@ public final class PolygonBucket extends RenderBucket {
|
||||
private static final int STENCIL_BITS = 8;
|
||||
public final static int CLIP_BIT = 0x80;
|
||||
|
||||
//private static final float FADE_START = 1.3f;
|
||||
|
||||
private static PolygonBucket[] mAreaLayer;
|
||||
|
||||
private static Shader polyShader;
|
||||
@ -214,12 +212,12 @@ public final class PolygonBucket extends RenderBucket {
|
||||
if (fade < 1.0f) {
|
||||
GLState.blend(true);
|
||||
GLUtils.setColor(s.uColor, a.color, fade);
|
||||
} else if (blend < 1.0f) {
|
||||
if (blend == 0.0f)
|
||||
} else if (blend > 0.0f) {
|
||||
if (blend == 1.0f)
|
||||
GLUtils.setColor(s.uColor, a.blendColor, 1);
|
||||
else
|
||||
GLUtils.setColorBlend(s.uColor, a.color,
|
||||
a.blendColor, 1 - blend);
|
||||
a.blendColor, blend);
|
||||
} else {
|
||||
/* test if color contains alpha */
|
||||
GLState.blend((a.color & OPAQUE) != OPAQUE);
|
||||
|
@ -28,6 +28,7 @@ import org.oscim.utils.FastMath;
|
||||
*/
|
||||
public class AreaStyle extends RenderStyle {
|
||||
private static final int OPAQUE = 0xff000000;
|
||||
private static final float FADE_START = 0.25f;
|
||||
|
||||
/** Drawing order level */
|
||||
private final int level;
|
||||
@ -119,14 +120,14 @@ public class AreaStyle extends RenderStyle {
|
||||
return 1;
|
||||
|
||||
float f = (float) (scale / (1 << fadeScale)) - 1;
|
||||
return FastMath.clamp(f, 0, 1);
|
||||
return FastMath.clamp(f, FADE_START, 1);
|
||||
}
|
||||
|
||||
public float getBlend(double scale) {
|
||||
if (blendScale < 0)
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
float f = (float) ((1 << blendScale) / scale) - 1;
|
||||
float f = (float) (scale / (1 << blendScale)) - 1;
|
||||
return FastMath.clamp(f, 0, 1);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user