diff --git a/src/org/oscim/renderer/overlays/ExtrusionOverlay.java b/src/org/oscim/renderer/overlays/ExtrusionOverlay.java index 5d48ec32..2b700574 100644 --- a/src/org/oscim/renderer/overlays/ExtrusionOverlay.java +++ b/src/org/oscim/renderer/overlays/ExtrusionOverlay.java @@ -412,22 +412,24 @@ public class ExtrusionOverlay extends RenderOverlay { + " color = u_color[0];" + " else {" // decrease contrast with distance - + " float z = (0.9 + gl_Position.z * 0.1);" + " if (u_mode == 1){" // sides 1 - use 0xff00 // scale direction to -0.5<>0.5 + " float dir = abs(a_light.y / ff - 0.5);" - + " color = u_color[1] * z;" + + " float z = (0.98 + gl_Position.z * 0.02);" + + " color = u_color[1];" + " color.rgb *= (0.7 + dir * 0.4) * z;" + " } else if (u_mode == 2){" // sides 2 - use 0x00ff + " float dir = abs(a_light.x / ff - 0.5);" + + " float z = (0.95 + gl_Position.z * 0.05);" + " color = u_color[2] * z;" + " color.rgb *= (0.7 + dir * 0.4) * z;" - + " } else" + + " } else {" // outline + + " float z = (0.8 - gl_Position.z * 0.2);" + " color = u_color[3] * z;" - + "}}" + + "}}}" }; final static String extrusionFragmentShader = "" @@ -437,16 +439,16 @@ public class ExtrusionOverlay extends RenderOverlay { + " gl_FragColor = color;" + "}"; - // final static String extrusionFragmentShader = "" - // + "precision highp float;" - // + "uniform vec4 u_color;" - // + "varying float z;" - // + "void main() {" - // + "if (z < 0.0)" - // + " gl_FragColor = vec4(z * -1.0, 0.0, 0.0, 1.0);" - // + "else" - // + " gl_FragColor = vec4(0.0, 0.0, z, 1.0);" - // + "}"; + final static String extrusionFragmentShaderZ = "" + + "precision highp float;" + + "uniform vec4 u_color;" + + "varying float z;" + + "void main() {" + + "if (z < 0.0)" + + " gl_FragColor = vec4(z * -1.0, 0.0, 0.0, 1.0);" + + "else" + + " gl_FragColor = vec4(0.0, 0.0, z, 1.0);" + + "}"; public void setAlpha(float a) { mAlpha = a; diff --git a/src/org/oscim/view/MapViewPosition.java b/src/org/oscim/view/MapViewPosition.java index 5f723c68..497a16c1 100644 --- a/src/org/oscim/view/MapViewPosition.java +++ b/src/org/oscim/view/MapViewPosition.java @@ -26,7 +26,6 @@ import org.oscim.core.MapPosition; import org.oscim.core.MercatorProjection; import org.oscim.core.Tile; import org.oscim.utils.FastMath; -import org.oscim.utils.GeometryUtils; import org.oscim.utils.GeometryUtils.Point2D; import org.oscim.utils.GlUtils; @@ -98,8 +97,8 @@ public class MapViewPosition { private float mHeight, mWidth; public final static float VIEW_DISTANCE = 3.0f; - public final static float VIEW_NEAR = 2; - public final static float VIEW_FAR = 7; + public final static float VIEW_NEAR = 1; + public final static float VIEW_FAR = 6; // scale map plane at VIEW_DISTANCE to near plane public final static float VIEW_SCALE = (VIEW_NEAR / VIEW_DISTANCE) * 0.5f; @@ -163,22 +162,6 @@ public class MapViewPosition { return true; } - public static byte calcLinesIntersect( - - double ax2, double ay2, - double bx1, double by1, - double bx2, double by2, - GeometryUtils.Point2D point) - { - double ua_numr = (bx2 - bx1) * (-by1) - (by2 - by1) * (-bx1); - double denr = (by2 - by1) * (ax2) - (bx2 - bx1) * (ay2); - double ua = ua_numr / denr; - - point.x = ua * ax2; - point.y = ua * ay2; - return 1; - } - // get the z-value of the map-plane for a point on screen private float getZ(float y) { // calculate the intersection of a ray from