Skip to content

Commit

Permalink
Clarify building TRANSLUCENT flag opensciencemap#181 (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustl22 authored and devemux86 committed Jun 24, 2018
1 parent 857b231 commit c0efc78
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 7 additions & 1 deletion vtm/src/org/oscim/layers/tile/buildings/BuildingLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions vtm/src/org/oscim/layers/tile/buildings/BuildingRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions vtm/src/org/oscim/renderer/ExtrusionRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 {
Expand Down

0 comments on commit c0efc78

Please sign in to comment.