rename COORD_MULTIPLIER to COORD_SCALE

This commit is contained in:
Hannes Janetzek
2013-03-09 12:25:09 +01:00
parent b3b392bdb8
commit c0a08c11c8
11 changed files with 62 additions and 16 deletions

View File

@@ -58,7 +58,7 @@ public class GLRenderer implements GLSurfaceView.Renderer {
private static final int CACHE_TILES_MAX = 250;
private static final int LIMIT_BUFFERS = 16 * MB;
public static final float COORD_MULTIPLIER = 8.0f;
public static final float COORD_SCALE = 8.0f;
static int CACHE_TILES = CACHE_TILES_MAX;

View File

@@ -42,7 +42,7 @@ public final class LineRenderer {
// factor to normalize extrusion vector and scale to coord scale
private final static float COORD_SCALE_BY_DIR_SCALE =
GLRenderer.COORD_MULTIPLIER / LineLayer.DIR_SCALE;
GLRenderer.COORD_SCALE / LineLayer.DIR_SCALE;
// shader handles
private static int[] lineProgram = new int[2];

View File

@@ -36,7 +36,7 @@ import android.util.Log;
*/
public class ExtrusionLayer extends Layer {
private final static String TAG = ExtrusionLayer.class.getName();
private static final float S = GLRenderer.COORD_MULTIPLIER;
private static final float S = GLRenderer.COORD_SCALE;
private int mNumVertices = 0;
private final VertexPoolItem mVertices;
private VertexPoolItem mCurVertices;

View File

@@ -28,7 +28,7 @@ import android.graphics.Paint.Cap;
* @author Hannes Janetzek
*/
public final class LineLayer extends Layer {
private static final float COORD_SCALE = GLRenderer.COORD_MULTIPLIER;
private static final float COORD_SCALE = GLRenderer.COORD_SCALE;
// scale factor mapping extrusion vector to short values
public static final float DIR_SCALE = 2048;
// mask for packing last two bits of extrusion vector with texture

View File

@@ -65,7 +65,7 @@ public final class LineTexLayer extends Layer {
// - in our case there is always the polygon fill array at start
// - see addLine hack otherwise.
private static final float COORD_SCALE = GLRenderer.COORD_MULTIPLIER;
private static final float COORD_SCALE = GLRenderer.COORD_SCALE;
// scale factor mapping extrusion vector to short values
public static final float DIR_SCALE = 2048;

View File

@@ -21,7 +21,7 @@ import org.oscim.renderer.GLRenderer;
import org.oscim.theme.renderinstruction.Area;
public final class PolygonLayer extends Layer {
private static final float S = GLRenderer.COORD_MULTIPLIER;
private static final float S = GLRenderer.COORD_SCALE;
public Area area;

View File

@@ -438,7 +438,7 @@ public class BuildingOverlay extends RenderOverlay {
m.mvp[13] = y * scale;
// scale to current tile world coordinates
scale = (curPos.scale / oPos.scale) / div;
scale /= GLRenderer.COORD_MULTIPLIER;
scale /= GLRenderer.COORD_SCALE;
m.mvp[0] = scale;
m.mvp[5] = scale;
m.mvp[10] = scale / 1000f;

View File

@@ -238,7 +238,7 @@ public class ModelOverlay extends RenderOverlay {
m.mvp[13] = y * scale;
// scale to current tile world coordinates
scale = (curPos.scale / oPos.scale) / div;
scale /= GLRenderer.COORD_MULTIPLIER;
scale /= GLRenderer.COORD_SCALE;
m.mvp[0] = scale;
m.mvp[5] = scale;
m.mvp[10] = scale; // 1000f;

View File

@@ -103,7 +103,7 @@ public abstract class RenderOverlay {
float s = (curPos.scale / oPos.scale) / div;
GlUtils.setMatrix(m.mvp, x * scale, y * scale,
s / GLRenderer.COORD_MULTIPLIER);
s / GLRenderer.COORD_SCALE);
if (project)
Matrix.multiplyMM(m.mvp, 0, m.viewproj, 0, m.mvp, 0);

View File

@@ -425,7 +425,7 @@ public class TestLineOverlay extends RenderOverlay {
m.mvp[13] = y * scale;
// scale to current tile world coordinates
scale = (curPos.scale / oPos.scale) / div;
scale /= GLRenderer.COORD_MULTIPLIER;
scale /= GLRenderer.COORD_SCALE;
m.mvp[0] = scale;
m.mvp[5] = scale;
m.mvp[10] = 1; //scale; // 1000f;

View File

@@ -15,6 +15,17 @@
package org.oscim.renderer.overlays;
// TODO
// 1. rewrite :)
// 1.1 test if label is actually visible
// 2. compare previous to current state
// 2.1 test for new labels to be placed
// 2.2 handle collisions
// 3 join segments that belong to one feature
// 4 handle zoom-level changes
// 5 R-Tree might be handy
//
import org.oscim.core.MapPosition;
import org.oscim.core.Tile;
import org.oscim.renderer.GLRenderer;
@@ -50,10 +61,45 @@ public class TextOverlay extends BasicOverlay {
private MapPosition mWorkPos;
// TextLayer that is updating
private TextLayer mWorkLayer;
// TextLayer that is ready to be added to 'layers'
private TextLayer mCurLayer;
private TextLayer mNextLayer;
// local pool, avoids synchronized TextItem.get()/release()
private Label mPool;
private Label mPrevLabels;
private final float[] mTmpCoords = new float[8];
//private HashMap<MapTile, Label> mItemMap;
//private Label mNewLabels;
//private final HashMap<MapTile, Link> mActiveTiles;
class Label extends TextItem {
TextItem item;
//Link blocking;
//Link blockedBy;
// shared list of all label for a tile
//Link siblings;
MapTile tile;
public byte origin;
public int active;
public OBB2D bbox;
}
// class Conflict {
// Conflict next;
// Label other;
// }
//
// class ActiveTile {
// MapTile tile;
// int activeLabels;
// Label labels;
// }
/* package */boolean mRun;
/* package */boolean mRerun;
@@ -422,10 +468,10 @@ public class TextOverlay extends BasicOverlay {
float x = (float) (oPos.x - curPos.x * div);
float y = (float) (oPos.y - curPos.y * div);
float scale = curPos.scale / div;
GlUtils.setMatrix(m.mvp, x * scale, y * scale,
scale / GLRenderer.COORD_MULTIPLIER);
float scale = (curPos.scale / mMapPosition.scale) / div;
float s = curPos.scale / div;
GlUtils.setMatrix(m.mvp, x * s, y * s,
scale / GLRenderer.COORD_SCALE);
Matrix.multiplyMM(m.mvp, 0, m.view, 0, m.mvp, 0);
}