This commit is contained in:
Hannes Janetzek 2013-03-18 03:53:30 +01:00
parent 654ca7c5b8
commit 45b8bf75de
5 changed files with 44 additions and 84 deletions

View File

@ -28,7 +28,7 @@ import android.graphics.drawable.Drawable;
import android.view.MotionEvent; import android.view.MotionEvent;
public class ItemizedIconOverlay<Item extends OverlayItem> extends ItemizedOverlay<Item> { public class ItemizedIconOverlay<Item extends OverlayItem> extends ItemizedOverlay<Item> {
private static final String TAG = ItemizedIconOverlay.class.getName(); //private static final String TAG = ItemizedIconOverlay.class.getName();
protected final List<Item> mItemList; protected final List<Item> mItemList;
protected OnItemGestureListener<Item> mOnItemGestureListener; protected OnItemGestureListener<Item> mOnItemGestureListener;

View File

@ -34,7 +34,7 @@ import android.opengl.GLES20;
* @author Hannes Janetzek * @author Hannes Janetzek
*/ */
public class TileRenderer { public class TileRenderer {
//private final static String TAG = BaseMap.class.getName(); //private final static String TAG = TileRenderer.class.getName();
// used to increase polygon-offset for each tile drawn. // used to increase polygon-offset for each tile drawn.
private static int mDrawCnt; private static int mDrawCnt;

View File

@ -68,11 +68,6 @@ public final class TextLayer extends TextureLayer {
TextItem it = labels; TextItem it = labels;
for (; it != null; it = it.next) { for (; it != null; it = it.next) {
// todo add captions at the end
//if (item.text.caption && !it.text.caption)
//continue;
//if (!item.text.caption && it.text.caption)
//continue;
if (item.text == it.text) { if (item.text == it.text) {
while (it.next != null while (it.next != null

View File

@ -71,7 +71,7 @@ public class ExtrusionOverlay extends RenderOverlay {
for (int i = 1; i < 2; i++) { for (int i = 1; i < 2; i++) {
// Set up the program for rendering extrusions // Set up the program for rendering extrusions
shaderProgram[i] = GlUtils.createProgram(extrusionVertexShader[i], shaderProgram[i] = GlUtils.createProgram(extrusionVertexShader,
extrusionFragmentShader); extrusionFragmentShader);
if (shaderProgram[i] == 0) { if (shaderProgram[i] == 0) {
Log.e(TAG, "Could not create extrusion shader program. " + i); Log.e(TAG, "Could not create extrusion shader program. " + i);
@ -371,81 +371,46 @@ public class ExtrusionOverlay extends RenderOverlay {
1.0f, 1.0f,
}; };
final static String[] extrusionVertexShader = { final static String extrusionVertexShader = ""
"precision mediump float;" + "precision mediump float;"
+ "uniform mat4 u_mvp;" + "uniform mat4 u_mvp;"
+ "uniform vec4 u_color[4];" + "uniform vec4 u_color[4];"
+ "uniform int u_mode;" + "uniform int u_mode;"
+ "uniform float u_alpha;" + "uniform float u_alpha;"
+ "attribute vec4 a_pos;" + "attribute vec4 a_pos;"
+ "attribute vec2 a_light;" + "attribute vec2 a_light;"
+ "varying vec4 color;" + "varying vec4 color;"
+ "const float ff = 255.0;" //+ "varying float z;"
+ "float c_alpha = 0.8;" + "const float ff = 255.0;"
+ "void main() {" + "void main() {"
+ " gl_Position = u_mvp * a_pos;" // change height by u_alpha
+ " if (u_mode == 0)" + " gl_Position = u_mvp * vec4(a_pos.xy, a_pos.z * u_alpha, 1.0);"
// roof / depth pass //+ " z = gl_Position.z;"
+ " color = u_color[0];" + " if (u_mode == 0)"
+ " else {" // roof / depth pass
// decrease contrast with distance + " color = u_color[0];"
+ " float z = (0.96 + gl_Position.z * 0.04);" + " else {"
+ " if (u_mode == 1){" // decrease contrast with distance
// sides 1 - use 0xff00 + " if (u_mode == 1){"
// scale direction to -0.5<>0.5 // sides 1 - use 0xff00
+ " float dir = abs(a_light.y / ff - 0.5);" // scale direction to -0.5<>0.5
+ " color = u_color[1] * z;" //+ " float dir = abs(a_light.y / ff - 0.5);"
+ " color.rgb *= (0.7 + dir * 0.4);" + " float dir = a_light.y / ff;"
+ " } else if (u_mode == 2){" + " float z = (0.98 + gl_Position.z * 0.02);"
// sides 2 - use 0x00ff + " color = u_color[1];"
+ " float dir = abs(a_light.x / ff - 0.5);" + " color.rgb *= (0.85 + dir * 0.15) * z;"
+ " color = u_color[2] * z;" + " } else if (u_mode == 2){"
+ " color.rgb *= (0.7 + dir * 0.4);" // sides 2 - use 0x00ff
+ " } else" //+ " float dir = abs(a_light.x / ff - 0.5);"
// outline + " float dir = a_light.x / ff;"
+ " color = u_color[3] * z;" + " float z = (0.98 + gl_Position.z * 0.02);"
+ "}}", + " color = u_color[2] * z;"
+ " color.rgb *= (0.85 + dir * 0.15) * z;"
"precision mediump float;" + " } else {"
+ "uniform mat4 u_mvp;" // outline
+ "uniform vec4 u_color[4];" + " float z = (0.8 - gl_Position.z * 0.2);"
+ "uniform int u_mode;" + " color = u_color[3] * z;"
+ "uniform float u_alpha;" + "}}}";
+ "attribute vec4 a_pos;"
+ "attribute vec2 a_light;"
+ "varying vec4 color;"
//+ "varying float z;"
+ "const float ff = 255.0;"
+ "void main() {"
// change height by u_alpha
+ " gl_Position = u_mvp * vec4(a_pos.xy, a_pos.z * u_alpha, 1.0);"
//+ " z = gl_Position.z;"
+ " if (u_mode == 0)"
// roof / depth pass
+ " color = u_color[0];"
+ " else {"
// decrease contrast with distance
+ " if (u_mode == 1){"
// sides 1 - use 0xff00
// scale direction to -0.5<>0.5
//+ " float dir = abs(a_light.y / ff - 0.5);"
+ " float dir = a_light.y / ff;"
+ " float z = (0.98 + gl_Position.z * 0.02);"
+ " color = u_color[1];"
+ " color.rgb *= (0.85 + dir * 0.15) * z;"
+ " } else if (u_mode == 2){"
// sides 2 - use 0x00ff
//+ " float dir = abs(a_light.x / ff - 0.5);"
+ " float dir = a_light.x / ff;"
+ " float z = (0.98 + gl_Position.z * 0.02);"
+ " color = u_color[2] * z;"
+ " color.rgb *= (0.85 + dir * 0.15) * z;"
+ " } else {"
// outline
+ " float z = (0.8 - gl_Position.z * 0.2);"
+ " color = u_color[3] * z;"
+ "}}}"
};
final static String extrusionFragmentShader = "" final static String extrusionFragmentShader = ""
+ "precision mediump float;" + "precision mediump float;"

View File

@ -194,7 +194,7 @@ public final class GeometryUtils {
} }
double ua = ua_numr / denr; double ua = ua_numr / denr;
double ub = ub_numr / denr; //double ub = ub_numr / denr;
//if (ua >= 0.0 && ua <= 1.0 && ub >= 0.0 && ub <= 1.0) //if (ua >= 0.0 && ua <= 1.0 && ub >= 0.0 && ub <= 1.0)
{ {