Clarify building TRANSLUCENT flag #181 (#555)

This commit is contained in:
Gustl22 2018-06-21 17:00:53 +02:00 committed by Emux
parent 857b2318f9
commit c0efc78d37
No known key found for this signature in database
GPG Key ID: 64ED9980896038C3
3 changed files with 13 additions and 5 deletions

View File

@ -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 class BuildingLayer extends Layer implements TileLoaderThemeHook, ZoomLim
// 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);
}

View File

@ -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;

View File

@ -32,7 +32,9 @@ import static org.oscim.renderer.MapRenderer.COORD_SCALE;
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 {