make building height consistent, at least independent of aspect ratio
This commit is contained in:
parent
b7ca00ae8f
commit
bac46ac6e2
@ -63,7 +63,7 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
static int CACHE_TILES = CACHE_TILES_MAX;
|
static int CACHE_TILES = CACHE_TILES_MAX;
|
||||||
|
|
||||||
private static MapView mMapView;
|
private static MapView mMapView;
|
||||||
static int mWidth, mHeight;
|
static int screenWidth, screenHeight;
|
||||||
|
|
||||||
private static MapViewPosition mMapViewPosition;
|
private static MapViewPosition mMapViewPosition;
|
||||||
private static MapPosition mMapPosition;
|
private static MapPosition mMapPosition;
|
||||||
@ -589,8 +589,8 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
if (width <= 0 || height <= 0)
|
if (width <= 0 || height <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mWidth = width;
|
screenWidth = width;
|
||||||
mHeight = height;
|
screenHeight = height;
|
||||||
|
|
||||||
mMapViewPosition.getMatrix(null, mMatrices.proj, null);
|
mMapViewPosition.getMatrix(null, mMatrices.proj, null);
|
||||||
|
|
||||||
@ -648,8 +648,8 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
mBufferMemoryUsage = 0;
|
mBufferMemoryUsage = 0;
|
||||||
mDrawTiles = null;
|
mDrawTiles = null;
|
||||||
|
|
||||||
int numTiles = (mWidth / (Tile.TILE_SIZE / 2) + 2)
|
int numTiles = (screenWidth / (Tile.TILE_SIZE / 2) + 2)
|
||||||
* (mHeight / (Tile.TILE_SIZE / 2) + 2);
|
* (screenHeight / (Tile.TILE_SIZE / 2) + 2);
|
||||||
|
|
||||||
// Set up vertex buffer objects
|
// Set up vertex buffer objects
|
||||||
int numVBO = (CACHE_TILES + (numTiles * 2));
|
int numVBO = (CACHE_TILES + (numTiles * 2));
|
||||||
@ -682,6 +682,7 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
|||||||
|
|
||||||
public static final boolean debugView = false;
|
public static final boolean debugView = false;
|
||||||
|
|
||||||
|
|
||||||
void clearBuffer() {
|
void clearBuffer() {
|
||||||
mNewSurface = true;
|
mNewSurface = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,7 +67,7 @@ public final class TextureRenderer {
|
|||||||
else
|
else
|
||||||
GLES20.glUniform1f(hTextureScale, 1);
|
GLES20.glUniform1f(hTextureScale, 1);
|
||||||
|
|
||||||
GLES20.glUniform1f(hTextureScreenScale, 1f / GLRenderer.mWidth);
|
GLES20.glUniform1f(hTextureScreenScale, 1f / GLRenderer.screenWidth);
|
||||||
|
|
||||||
m.proj.setAsUniform(hTextureProjMatrix);
|
m.proj.setAsUniform(hTextureProjMatrix);
|
||||||
m.mvp.setAsUniform(hTextureMVMatrix);
|
m.mvp.setAsUniform(hTextureMVMatrix);
|
||||||
|
|||||||
@ -59,8 +59,6 @@ public class ExtrusionLayer extends Layer {
|
|||||||
|
|
||||||
public boolean compiled = false;
|
public boolean compiled = false;
|
||||||
|
|
||||||
//private int[] mVboIds;
|
|
||||||
|
|
||||||
public ExtrusionLayer(int level) {
|
public ExtrusionLayer(int level) {
|
||||||
this.type = Layer.EXTRUSION;
|
this.type = Layer.EXTRUSION;
|
||||||
this.level = level;
|
this.level = level;
|
||||||
@ -89,12 +87,11 @@ public class ExtrusionLayer extends Layer {
|
|||||||
|
|
||||||
// just a guessing to make it look ok
|
// just a guessing to make it look ok
|
||||||
if (height == 0)
|
if (height == 0)
|
||||||
height = 10;
|
height = 14;
|
||||||
height = (int) (height * -Math.log(height / 100000f) * 2.0f);
|
|
||||||
|
|
||||||
if (minHeight != 0)
|
|
||||||
minHeight = (int) (minHeight * -Math.log(minHeight / 100000f) * 2.0f);
|
|
||||||
|
|
||||||
|
float sfactor = GLRenderer.COORD_SCALE * (400f / Tile.TILE_SIZE);
|
||||||
|
height *= sfactor;
|
||||||
|
minHeight *= sfactor;
|
||||||
|
|
||||||
int length = 0;
|
int length = 0;
|
||||||
for (int ipos = 0, ppos = 0, n = way.geom.index.length; ipos < n; ipos++, ppos += length) {
|
for (int ipos = 0, ppos = 0, n = way.geom.index.length; ipos < n; ipos++, ppos += length) {
|
||||||
|
|||||||
@ -332,7 +332,7 @@ public class ExtrusionOverlay extends RenderOverlay {
|
|||||||
scale / GLRenderer.COORD_SCALE);
|
scale / GLRenderer.COORD_SCALE);
|
||||||
|
|
||||||
// scale height
|
// scale height
|
||||||
m.mvp.setValue(10, scale / (1000f * GLRenderer.COORD_SCALE));
|
m.mvp.setValue(10, scale / GLRenderer.COORD_SCALE);
|
||||||
|
|
||||||
m.mvp.multiplyMM(m.viewproj, m.mvp);
|
m.mvp.multiplyMM(m.viewproj, m.mvp);
|
||||||
|
|
||||||
|
|||||||
@ -416,7 +416,7 @@ public class MapViewPosition {
|
|||||||
mRotMatrix.multiplyMM(mTmpMatrix, mRotMatrix);
|
mRotMatrix.multiplyMM(mTmpMatrix, mRotMatrix);
|
||||||
|
|
||||||
// scale to window coordinates
|
// scale to window coordinates
|
||||||
mTmpMatrix.setScale(1 / mWidth, 1 / mWidth, 1);
|
mTmpMatrix.setScale(1 / mWidth, 1 / mWidth, 1 / mWidth);
|
||||||
|
|
||||||
mViewMatrix.multiplyMM(mRotMatrix, mTmpMatrix);
|
mViewMatrix.multiplyMM(mRotMatrix, mTmpMatrix);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user