move near plane back, fixes clipping issue with most large buildings
This commit is contained in:
parent
c462793b99
commit
b8287f9ecf
@ -412,22 +412,24 @@ public class ExtrusionOverlay extends RenderOverlay {
|
|||||||
+ " color = u_color[0];"
|
+ " color = u_color[0];"
|
||||||
+ " else {"
|
+ " else {"
|
||||||
// decrease contrast with distance
|
// decrease contrast with distance
|
||||||
+ " float z = (0.9 + gl_Position.z * 0.1);"
|
|
||||||
+ " if (u_mode == 1){"
|
+ " if (u_mode == 1){"
|
||||||
// sides 1 - use 0xff00
|
// sides 1 - use 0xff00
|
||||||
// scale direction to -0.5<>0.5
|
// scale direction to -0.5<>0.5
|
||||||
+ " float dir = abs(a_light.y / ff - 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;"
|
+ " color.rgb *= (0.7 + dir * 0.4) * z;"
|
||||||
+ " } else if (u_mode == 2){"
|
+ " } else if (u_mode == 2){"
|
||||||
// sides 2 - use 0x00ff
|
// sides 2 - use 0x00ff
|
||||||
+ " float dir = abs(a_light.x / ff - 0.5);"
|
+ " float dir = abs(a_light.x / ff - 0.5);"
|
||||||
|
+ " float z = (0.95 + gl_Position.z * 0.05);"
|
||||||
+ " color = u_color[2] * z;"
|
+ " color = u_color[2] * z;"
|
||||||
+ " color.rgb *= (0.7 + dir * 0.4) * z;"
|
+ " color.rgb *= (0.7 + dir * 0.4) * z;"
|
||||||
+ " } else"
|
+ " } else {"
|
||||||
// outline
|
// outline
|
||||||
|
+ " float z = (0.8 - gl_Position.z * 0.2);"
|
||||||
+ " color = u_color[3] * z;"
|
+ " color = u_color[3] * z;"
|
||||||
+ "}}"
|
+ "}}}"
|
||||||
};
|
};
|
||||||
|
|
||||||
final static String extrusionFragmentShader = ""
|
final static String extrusionFragmentShader = ""
|
||||||
@ -437,16 +439,16 @@ public class ExtrusionOverlay extends RenderOverlay {
|
|||||||
+ " gl_FragColor = color;"
|
+ " gl_FragColor = color;"
|
||||||
+ "}";
|
+ "}";
|
||||||
|
|
||||||
// final static String extrusionFragmentShader = ""
|
final static String extrusionFragmentShaderZ = ""
|
||||||
// + "precision highp float;"
|
+ "precision highp float;"
|
||||||
// + "uniform vec4 u_color;"
|
+ "uniform vec4 u_color;"
|
||||||
// + "varying float z;"
|
+ "varying float z;"
|
||||||
// + "void main() {"
|
+ "void main() {"
|
||||||
// + "if (z < 0.0)"
|
+ "if (z < 0.0)"
|
||||||
// + " gl_FragColor = vec4(z * -1.0, 0.0, 0.0, 1.0);"
|
+ " gl_FragColor = vec4(z * -1.0, 0.0, 0.0, 1.0);"
|
||||||
// + "else"
|
+ "else"
|
||||||
// + " gl_FragColor = vec4(0.0, 0.0, z, 1.0);"
|
+ " gl_FragColor = vec4(0.0, 0.0, z, 1.0);"
|
||||||
// + "}";
|
+ "}";
|
||||||
|
|
||||||
public void setAlpha(float a) {
|
public void setAlpha(float a) {
|
||||||
mAlpha = a;
|
mAlpha = a;
|
||||||
|
@ -26,7 +26,6 @@ import org.oscim.core.MapPosition;
|
|||||||
import org.oscim.core.MercatorProjection;
|
import org.oscim.core.MercatorProjection;
|
||||||
import org.oscim.core.Tile;
|
import org.oscim.core.Tile;
|
||||||
import org.oscim.utils.FastMath;
|
import org.oscim.utils.FastMath;
|
||||||
import org.oscim.utils.GeometryUtils;
|
|
||||||
import org.oscim.utils.GeometryUtils.Point2D;
|
import org.oscim.utils.GeometryUtils.Point2D;
|
||||||
import org.oscim.utils.GlUtils;
|
import org.oscim.utils.GlUtils;
|
||||||
|
|
||||||
@ -98,8 +97,8 @@ public class MapViewPosition {
|
|||||||
private float mHeight, mWidth;
|
private float mHeight, mWidth;
|
||||||
|
|
||||||
public final static float VIEW_DISTANCE = 3.0f;
|
public final static float VIEW_DISTANCE = 3.0f;
|
||||||
public final static float VIEW_NEAR = 2;
|
public final static float VIEW_NEAR = 1;
|
||||||
public final static float VIEW_FAR = 7;
|
public final static float VIEW_FAR = 6;
|
||||||
// scale map plane at VIEW_DISTANCE to near plane
|
// scale map plane at VIEW_DISTANCE to near plane
|
||||||
public final static float VIEW_SCALE = (VIEW_NEAR / VIEW_DISTANCE) * 0.5f;
|
public final static float VIEW_SCALE = (VIEW_NEAR / VIEW_DISTANCE) * 0.5f;
|
||||||
|
|
||||||
@ -163,22 +162,6 @@ public class MapViewPosition {
|
|||||||
return true;
|
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
|
// get the z-value of the map-plane for a point on screen
|
||||||
private float getZ(float y) {
|
private float getZ(float y) {
|
||||||
// calculate the intersection of a ray from
|
// calculate the intersection of a ray from
|
||||||
|
Loading…
x
Reference in New Issue
Block a user