diff --git a/vtm/src/org/oscim/layers/tile/buildings/BuildingLayer.java b/vtm/src/org/oscim/layers/tile/buildings/BuildingLayer.java index 053e58ada..2762037d1 100644 --- a/vtm/src/org/oscim/layers/tile/buildings/BuildingLayer.java +++ b/vtm/src/org/oscim/layers/tile/buildings/BuildingLayer.java @@ -47,6 +47,11 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook, ZoomLim public final static int MIN_ZOOM = 17; public static boolean POST_AA = false; + + /** + * Don't draw extrusions which are covered by others. + * Especially if the side of extrusion is translucent. + */ public static boolean TRANSLUCENT = true; private static final Object BUILDING_DATA = BuildingLayer.class.getName(); @@ -83,8 +88,9 @@ public BuildingLayer(Map map, VectorTileLayer tileLayer, int zoomMin, int zoomMa // Use zoomMin as zoomLimit to render buildings only once mZoomLimiter = new ZoomLimiter(tileLayer.getManager(), zoomMin, zoomMax, zoomMin); + // Covered extrusions must be drawn for mesh renderer mRenderer = new BuildingRenderer(tileLayer.tileRenderer(), mZoomLimiter, - mesh, !mesh && TRANSLUCENT); // alpha must be disabled for mesh renderer + mesh, !mesh && TRANSLUCENT); if (POST_AA) mRenderer = new OffscreenRenderer(Mode.SSAO_FXAA, mRenderer); } diff --git a/vtm/src/org/oscim/layers/tile/buildings/BuildingRenderer.java b/vtm/src/org/oscim/layers/tile/buildings/BuildingRenderer.java index 3fcbb0284..71955f24a 100644 --- a/vtm/src/org/oscim/layers/tile/buildings/BuildingRenderer.java +++ b/vtm/src/org/oscim/layers/tile/buildings/BuildingRenderer.java @@ -54,8 +54,8 @@ public class BuildingRenderer extends ExtrusionRenderer { private boolean mShow; public BuildingRenderer(TileRenderer tileRenderer, ZoomLimiter zoomLimiter, - boolean mesh, boolean alpha) { - super(mesh, alpha); + boolean mesh, boolean translucent) { + super(mesh, translucent); mZoomLimiter = zoomLimiter; mTileRenderer = tileRenderer; diff --git a/vtm/src/org/oscim/renderer/ExtrusionRenderer.java b/vtm/src/org/oscim/renderer/ExtrusionRenderer.java index 5bbe12e8e..f198aebab 100644 --- a/vtm/src/org/oscim/renderer/ExtrusionRenderer.java +++ b/vtm/src/org/oscim/renderer/ExtrusionRenderer.java @@ -32,7 +32,9 @@ public abstract class ExtrusionRenderer extends LayerRenderer { static final Logger log = LoggerFactory.getLogger(ExtrusionRenderer.class); + // Don't draw extrusions which are covered by others private final boolean mTranslucent; + private final int mMode; private Shader mShader; @@ -42,9 +44,9 @@ public abstract class ExtrusionRenderer extends LayerRenderer { private float mZLimit = Float.MAX_VALUE; - public ExtrusionRenderer(boolean mesh, boolean alpha) { + public ExtrusionRenderer(boolean mesh, boolean translucent) { mMode = mesh ? 1 : 0; - mTranslucent = alpha; + mTranslucent = translucent; } public static class Shader extends GLShader {